@lacneu/atrium 0.62.2 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-CAsqZ6Oe.js +1 -0
- package/dist/assets/AdvancedFilter-CAZse6g9.js +1 -0
- package/dist/assets/AgentFilesTab-BRgTx-O-.js +3 -0
- package/dist/assets/AnomaliesTab-QOz38Dl8.js +1 -0
- package/dist/assets/AuditTab-a5iD6OvB.js +1 -0
- package/dist/assets/BridgeTab-De8R_lT4.js +1 -0
- package/dist/assets/ChatDefaultsTab-BOt-jkMY.js +1 -0
- package/dist/assets/DataTableShell-NMYUihjL.js +1 -0
- package/dist/assets/DetailChips-2kEsgn1k.js +1 -0
- package/dist/assets/FeedbacksTab-CdqQtSm1.js +1 -0
- package/dist/assets/{FieldLabel-z7bxzKHq.js → FieldLabel-C647EVei.js} +2 -2
- package/dist/assets/FilesTab-DKocgIqP.js +1 -0
- package/dist/assets/FilterBar-DHVMse_G.js +1 -0
- package/dist/assets/GroupsTab-CBVya3O8.js +1 -0
- package/dist/assets/InstancesTab-DaFyjZeq.js +1 -0
- package/dist/assets/IntegrationsTab-s2Ug2twA.js +1 -0
- package/dist/assets/KpiTab-Bxe5EM3h.js +1 -0
- package/dist/assets/PreferencesTab-D150a7hV.js +1 -0
- package/dist/assets/ProjectPage-BvCAGro7.js +1 -0
- package/dist/assets/ProjectPage-LzMKBi2V.css +1 -0
- package/dist/assets/PromptInjectionsTab-DcP-BjeV.js +4 -0
- package/dist/assets/RolesTab-DgNPzDM1.js +1 -0
- package/dist/assets/ScheduledTab-xwd7u-vS.js +1 -0
- package/dist/assets/ServiceAccountsTab-BPH6depc.js +1 -0
- package/dist/assets/SubAgentReportsTab-BPYm-SSC.js +1 -0
- package/dist/assets/ThemeShowroom-DfNiNZX7.js +1 -0
- package/dist/assets/TimeRangePicker-Dtw6LWMh.js +1 -0
- package/dist/assets/TracesTab-yLnuqGC_.js +1 -0
- package/dist/assets/UsersTab-CopN-6p5.js +1 -0
- package/dist/assets/VoiceTab-C0oik6ML.js +1 -0
- package/dist/assets/{button-BtQwDeC7.js → button-Bz9USCnz.js} +1 -1
- package/dist/assets/{card-BbBjwTkQ.js → card-DKADL750.js} +1 -1
- package/dist/assets/check-Wm4Ks3tL.js +1 -0
- package/dist/assets/chevron-up-BFinjgRw.js +1 -0
- package/dist/assets/chevrons-up-down-DKu9IjDi.js +1 -0
- package/dist/assets/{compatView-BvZyYwOM.js → compatView-BHdx-XYA.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CjAxcZ1X.js → dispatchErrorInfo-oI5p4wEL.js} +1 -1
- package/dist/assets/dist-DiGkpPjG.js +1 -0
- package/dist/assets/dist-_9JGogtQ.js +44 -0
- package/dist/assets/{dist-CHUv7VZU.js → dist-xYoBFyN7.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-D3YWtB-x.js → highlighted-body-OFNGDK62-DSCsm23K.js} +1 -1
- package/dist/assets/index-CjUx3yzx.css +1 -0
- package/dist/assets/index-DIc5ekpE.js +238 -0
- package/dist/assets/mermaid-GHXKKRXX-BsmnBvV3.js +1 -0
- package/dist/assets/{pdf-BAfFGrd0.js → pdf-D0Fddibm.js} +1 -1
- package/dist/assets/roleDescriptions-5AP7N2O_.js +1 -0
- package/dist/assets/{table-C9PafBK9.js → table-C8QBboJq.js} +1 -1
- package/dist/assets/{tabs-CQ2rDwF5.js → tabs-DSFq9Jhc.js} +1 -1
- package/dist/assets/x-CfJhGjMr.js +1 -0
- package/dist/index.html +9 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-C0DMrq_T.js +0 -1
- package/dist/assets/AdvancedFilter-CjfYhQlT.js +0 -1
- package/dist/assets/AgentFilesTab-Vt7ogGL4.js +0 -3
- package/dist/assets/AnomaliesTab-Bl8B8nuQ.js +0 -1
- package/dist/assets/AuditTab-Jv3VbFgH.js +0 -1
- package/dist/assets/BridgeTab-BURazhGl.js +0 -1
- package/dist/assets/ChatDefaultsTab-A2iJG8ZL.js +0 -1
- package/dist/assets/DataTableShell-zzaGmfMk.js +0 -1
- package/dist/assets/DetailChips-DNNrvZqq.js +0 -1
- package/dist/assets/FeedbacksTab-ChZeDaM6.js +0 -1
- package/dist/assets/FilesTab-jc4m4WW7.js +0 -1
- package/dist/assets/FilterBar-DRRfKRTQ.js +0 -1
- package/dist/assets/GroupsTab-HTPhJMAF.js +0 -1
- package/dist/assets/InstancesTab-DUwMvn_C.js +0 -1
- package/dist/assets/IntegrationsTab-2PvwRR8s.js +0 -1
- package/dist/assets/KpiTab-D4aTV56S.js +0 -1
- package/dist/assets/PreferencesTab-LYojtSoz.js +0 -1
- package/dist/assets/PromptInjectionsTab-DN8RscNv.js +0 -4
- package/dist/assets/RolesTab-BexLEI7q.js +0 -1
- package/dist/assets/ScheduledTab-Cm1PSyqy.js +0 -1
- package/dist/assets/ServiceAccountsTab-Krm3IzaJ.js +0 -1
- package/dist/assets/SubAgentReportsTab-DJNmIHbP.js +0 -1
- package/dist/assets/ThemeShowroom-CN7-gPFJ.js +0 -1
- package/dist/assets/TimeRangePicker-BPVkrNZN.js +0 -1
- package/dist/assets/TracesTab-BTN0YBPo.js +0 -1
- package/dist/assets/UsersTab-CclKbkrB.js +0 -1
- package/dist/assets/VoiceTab-DS6LrGiz.js +0 -1
- package/dist/assets/chevrons-up-down-ImFHIr_N.js +0 -1
- package/dist/assets/dist-BCNlHm__.js +0 -1
- package/dist/assets/dist-CNZ9o3sc.js +0 -44
- package/dist/assets/dist-VGy3W8j2.js +0 -1
- package/dist/assets/index-9R1hg_pA.js +0 -238
- package/dist/assets/index-jScX6cAP.css +0 -2
- package/dist/assets/mermaid-GHXKKRXX-DM0jE2ZW.js +0 -1
- package/dist/assets/roleDescriptions-DGSYA21e.js +0 -1
- package/dist/assets/x-BR1chqO3.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Cf as i,Df as a,Ef as o,Ff as s,Mf as c,Nf as l,Of as u,Pf as d,RI as f,Sf as p,T as m,Tf as h,jf as g,kI as _,kf as v,wf as y,xf as b}from"./dist-_9JGogtQ.js";import{At as x,Dt as S,Ot as C,gt as w,jt as T,kt as E}from"./index-DIc5ekpE.js";var D=t(e(),1);function O(e){return e===`user`?h():e===`all`?y():i({group:e.group})}function k(e){return e===`common`?p():e===`owner`?b():i({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=f(m.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=f(m.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,A.jsxs)(S,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":d(),children:(0,A.jsx)(T,{placeholder:d()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(E,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(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:c()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:o()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gm as r,Hm as i,Jm as a,Km as o,Um as s,Wm as c,qm as l}from"./dist-_9JGogtQ.js";import{r as u}from"./dist-DiGkpPjG.js";import{t as d}from"./x-CfJhGjMr.js";import{t as f}from"./button-Bz9USCnz.js";import{At as p,Dt as m,Ot as h,_t as g,jt as _,kt as v,ln as y}from"./index-DIc5ekpE.js";import{r as b}from"./TimeRangePicker-Dtw6LWMh.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{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 a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.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}),l(),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:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(m,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:r()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(m,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(g,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),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)(y,{}),i()]})]}):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{$i as r,$l as i,$u as a,Bi as o,FI as s,Gl as c,Hi as l,Hl as u,Jl as d,Kl as f,LI as p,Qi as m,Ql as h,RI as g,Ri as _,T as v,Ui as y,Ul as b,Vi as x,Vl as S,Wi as C,Wl as w,Xl as T,Yl as E,Zi as D,Zl as O,Zu as k,_a as A,aa as j,au as M,ca as N,cu as P,da as F,du as I,ea as L,eu as ee,fa as R,fu as z,ga as B,gu as te,ha as V,hu as ne,ia as H,iu as U,jI as W,kI as G,la as re,lu as ie,ma as ae,mu as oe,na as se,nu as ce,oa as le,ou as ue,pa as de,pu as fe,ql as pe,ra as me,ru as he,sa as ge,su as _e,ta as ve,tu as ye,ua as be,uk as xe,uu as Se,zi as Ce}from"./dist-_9JGogtQ.js";import{t as K}from"./button-Bz9USCnz.js";import{$ as we,At as Te,Ct as Ee,Dt as De,Lt as Oe,Ot as ke,St as Ae,V as je,at as Me,bt as Ne,et as Pe,gt as Fe,it as Ie,jt as Le,kt as Re,nt as ze,ot as Be,qt as q,rn as J,rt as Ve,tt as He,vt as Ue,yt as We}from"./index-DIc5ekpE.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-BHdx-XYA.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=g(v.me.getMe,{host:Oe}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=g(v.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=g(v.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),c=g(v.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,c]),[u,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,p=s(v.agentFiles.listAgentFiles),[m,h]=(0,Y.useState)({status:`idle`}),_=f?.instanceName??null,y=f?.agentId??null,b=g(v.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),x=n&&_!==null?je(b,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,C=(0,Y.useCallback)(async()=>{if(!(_===null||y===null)){h({status:`loading`});try{h({status:`done`,files:(await p({instanceName:_,agentId:y})).files})}catch{h({status:`error`})}}},[p,_,y]);(0,Y.useEffect)(()=>{S===!1&&C()},[C,S]);let[w,T]=(0,Y.useState)(null),E=g(v.agentFileCuration.listCurations,t&&_!==null&&y!==null?{instanceName:_,agentId:y}:`skip`),D=g(v.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),O=s(v.agentFileCuration.requestCuration),[A,j]=(0,Y.useState)(null),[N,F]=(0,Y.useState)(null),{toast:L}=q(),ee=(0,Y.useMemo)(()=>{let e=new Map;for(let t of E??[])e.has(t.name)||e.set(t.name,t);return e},[E]),B=(0,Y.useCallback)(async e=>{if(!(_===null||y===null)){j(e);try{let t=await O({instanceName:_,agentId:y,name:e,trigger:`manual`});t.ok?L({title:ae(),variant:`success`}):L({title:de({reason:t.reason??`unknown`}),variant:`error`})}catch{L({title:R(),variant:`error`})}finally{j(null)}}},[O,_,y,L]),V=W(),H=(0,Y.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(De,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":ne(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(ke,{children:(r??[]).map(e=>(0,Q.jsx)(Re,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(De,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":oe(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(ke,{children:l.map(e=>(0,Q.jsx)(Re,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()})]}),f===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(x.gatewayVersion,x.provider)]}):m.status===`loading`||m.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):m.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[I(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:k()})]}):m.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:m.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Fe,{variant:`outline`,children:Se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ie({size:Z(e.size,V)})}),(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:P({pct:H.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":_e()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>T(e),children:t?M():U()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:D?.budgetChars??null,enabled:D?.enabled??!1,curation:ee.get(e.name)??null,inFlight:A===e.name,onCurate:()=>void B(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ue({used:Z(Ze(m.files),V),total:Z(Je,V),pct:H.format(Xe(Ze(m.files)))})})]}),w&&f?(0,Q.jsx)(rt,{instanceName:f.instanceName,agentId:f.agentId,name:w.name,isAdmin:t,onClose:()=>T(null),onSaved:()=>void C()}):null,N?(0,Q.jsx)(it,{curationId:N,onClose:()=>F(null),onApplied:()=>{F(null),C()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:B()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Fe,{variant:`outline`,className:`oc-afiles__curate-status`,children:V()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:A()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:o,onSaved:l}){let p=s(v.agentFiles.getAgentFile),m=s(v.agentFiles.setAgentFile),g=q(),[_,y]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(!1),[D,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(!1),[N,P]=(0,Y.useState)(!1),[F,I]=(0,Y.useState)(!1),[L,R]=(0,Y.useState)(!1),z=(0,Y.useCallback)(async r=>{C(!1);try{let i=await p({instanceName:e,agentId:t,name:n});y({content:i.content,updatedAtMs:i.updatedAtMs}),r||A(i.content),I(!1)}catch{C(!0)}},[p,e,t,n]);(0,Y.useEffect)(()=>{z(!1)},[z]);async function B(){if(_!==null){P(!0),R(!1);try{await m({instanceName:e,agentId:t,name:n,content:D,baseUpdatedAtMs:_.updatedAtMs??void 0}),g.success(O({name:n})),l(),await z(!1)}catch(e){et(e)?I(!0):R(!0)}finally{P(!1)}}}let te=_!==null&&D!==_.content,V=(0,Y.useMemo)(()=>_===null?null:$e(_.content,D),[_,D]),ne=D.length>X,H=W(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(We,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Ee,{children:he({name:n})}),(0,Q.jsxs)(Ne,{children:[ce({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ye()]})]})]}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[E(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void z(!1),children:k()})]}):_===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:D,readOnly:!r,spellCheck:!1,onChange:e=>A(e.target.value),"aria-label":he({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ee()}),F?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[d(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void z(!0),children:pe()})]}):null,L?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:T()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:i({count:U.format(D.length),max:U.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!te||N||F,onClick:()=>M(!0),children:N?a():h()}):null]})]}),(0,Q.jsx)(we,{open:j,onOpenChange:M,children:(0,Q.jsxs)(ze,{children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Be,{children:f({name:n})}),(0,Q.jsx)(Ve,{children:c({agent:t})})]}),V?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:w({added:V.added,removed:V.removed})}),V.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:b()}),V.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,V.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:u()}),V.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(He,{children:xe()}),(0,Q.jsx)(Pe,{onClick:()=>void B(),children:S()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let i=g(v.agentFileCuration.getProposal,{curationId:e}),c=s(v.agentFileCuration.approveCuration),u=p(v.agentFileCuration.rejectCuration),{toast:d}=q(),[f,h]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(``),E=W(),O=(0,Y.useMemo)(()=>i?$e(i.beforeContent,i.proposedContent):null,[i]);async function k(){h(`approve`);try{let t=await c({curationId:e});t.ok?(d({title:F(),variant:`success`}),n()):d({title:t.reason===`conflict`?re():N({reason:t.reason??`unknown`}),variant:`error`})}catch{d({title:R(),variant:`error`})}finally{h(null)}}async function A(n){h(`reject`);try{let r=w.trim();(await u({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?d({title:n?Ce():be(),variant:`success`}):d({title:j(),variant:`error`}),t()}catch{d({title:R(),variant:`error`})}finally{h(null)}}return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(We,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Ee,{children:i?ge({name:i.name}):G()}),(0,Q.jsx)(Ne,{children:le()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[H({before:Z(i.beforeSize,E),after:Z(i.proposedSize,E)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,me()]}):null]}),O?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:se({added:O.added,removed:O.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:_({feedback:i.feedback})}):null,O&&O.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:D()}),(0,Q.jsx)(`ul`,{children:O.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:m()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ve()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),b?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:C()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:y(),value:w,onChange:e=>T(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>S(!1),disabled:f!==null,children:l()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void A(!1),disabled:f!==null,children:f===`reject`?a():x()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void A(!0),disabled:f!==null,children:f===`reject`?a():o()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>S(!0),disabled:f!==null||i==null,children:L()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void k(),disabled:f!==null||i==null,children:f===`approve`?a():r()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ax as i,Cx as ee,Dx as a,Ex as te,Fx as ne,Ix as re,Jb as o,LI as ie,Lx as s,Mx as c,Nx as l,Ox as ae,Px as oe,Qb as u,RI as d,Rx as f,Sx as se,T as p,Tx as ce,Xb as m,Yb as h,Zb as g,_x as le,ax as ue,bx as _,cx as de,dx as fe,ex as v,fx as y,gx as b,hx as pe,ix as me,jx as he,kx as ge,lx as _e,mx as x,nx as ve,ox as S,px as C,qb as w,rx as T,sx as E,tx as D,ux as O,vx as k,wx as A,xx as j,yx as M,zx as N}from"./dist-_9JGogtQ.js";import{At as P,Ct as F,Dt as I,Fn as ye,Lt as be,Ot as L,Pn as R,St as z,Z as xe,ct as B,gt as V,i as Se,jt as H,kt as U,o as Ce,qt as we,vt as W,yt as G}from"./index-DIc5ekpE.js";import{n as Te}from"./TimeRangePicker-Dtw6LWMh.js";import{t as Ee}from"./FilterBar-DHVMse_G.js";import{t as De}from"./DataTableShell-NMYUihjL.js";import{t as K}from"./dispatchErrorInfo-oI5p4wEL.js";var q=t(e(),1),J=n(),Y=`__all__`,Oe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function ke(e){return e===`open`?N():e===`acknowledged`?f():s()}var Ae=[`info`,`warn`,`critical`],je=[`detector`,`agent`,`user`],Me={kind:`relative`,from:`now-30d`,to:`now`},Ne=200,X=`all`;function Z(){let e=ye({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,r=e.status===X?Y:e.status,o=e.severity??Y,s=e.kind??Y,[u,f]=(0,q.useState)(Y),m=Se(e.from,e.to),{from:h,to:g}=Te(m),v=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),w=e=>void t({search:t=>({...t,status:e===Y?X:e})}),N=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),F=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,...Ce(e)})}),W=xe(),G=we(),K=ie(p.anomalies.resolveAnomaly),Z=(d(p.me.getMe,{host:be})?.permissions??[]).includes(`admin.manage`),Q=d(p.anomalies.listAnomalies,{limit:Ne,filter:{q:n||void 0,from:h,to:g,anomalyStatus:r===Y?void 0:r,severity:o===Y?void 0:o,source:u===Y?void 0:u,kind:s===Y?void 0:s}}),$=(0,q.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),ze=n!==``||r!==`open`||o!==Y||u!==Y||s!==Y||m.kind!==`relative`||m.from!==Me.from;function Be(){f(Y),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await W({title:re(),description:(0,J.jsxs)(J.Fragment,{children:[ne(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,oe(),` `,(0,J.jsx)(`strong`,{children:l()}),`.`,` `,c()]}),confirmLabel:he()}))try{await K({anomalyId:e._id,status:`resolved`}),G.success(i(),e.kind)}catch(e){G.error(ge(),e)}}async function He(e){try{await K({anomalyId:e._id,status:`acknowledged`}),G.success(ae(),e.kind)}catch(e){G.error(a(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,J.jsx)(`strong`,{children:ce()}),` `,A(),` `,(0,J.jsx)(`strong`,{children:ee()}),` `,se(),` `,(0,J.jsx)(`strong`,{children:j()}),` `,_(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:M()})]}),(0,J.jsxs)(Ee,{q:n,onQChange:v,searchPlaceholder:k(),timeRange:m,onTimeRangeChange:z,onReset:Be,canReset:ze,children:[(0,J.jsxs)(I,{value:r,onValueChange:w,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:le()}),Oe.map(e=>(0,J.jsx)(U,{value:e.value,children:ke(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:o,onValueChange:N,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{placeholder:b()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:pe()}),Ae.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:u,onValueChange:f,children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:x()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:C()}),je.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:F,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{placeholder:y()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:fe()}),$.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]})]}),(0,J.jsx)(De,{title:O(),rows:Q,emptyHint:r===`open`?_e():de(),rowActions:e=>Z&&e.status===`open`?[{label:E(),onSelect:()=>void Ve(e)},{label:S(),onSelect:()=>void He(e)}]:[],columns:[{header:ue(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:B(e.at)}),sort:e=>e.at},{header:y(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:b(),cell:e=>(0,J.jsx)(Ie,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:me(),cell:e=>(0,J.jsx)(Le,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:x(),cell:e=>(0,J.jsx)(V,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:T(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Fe,{row:e})]}),sort:e=>e.message},{header:ve(),cell:e=>(0,J.jsx)(Pe,{row:e}),sort:e=>e.evidence??null},{header:D(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Pe({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=$(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,v()]}):null]})}let n=Q(e);if(!n.dominantCode)return(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=K(n.dominantCode),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,v()]}):null]})}function Fe({row:e}){let[t,n]=(0,q.useState)(!1),i=d(p.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[r(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(W,{open:t,onOpenChange:n,children:(0,J.jsxs)(G,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(F,{children:u()})}),i===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:g()}):i.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:m()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:i.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ie({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Le({status:e}){return e===`open`?(0,J.jsx)(V,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,J.jsx)(V,{variant:`secondary`,children:o()}):(0,J.jsx)(V,{variant:`outline`,children:w()})}function Re(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,BS as i,Br as a,FS as o,Fr as s,HS as c,IS as l,Ir as u,LS as d,Lr as f,MS as p,NS as m,PS as h,RI as g,RS as _,Rr as v,T as y,US as b,VS as x,WS as S,jS as C,zS as w,zr as T}from"./dist-_9JGogtQ.js";import{At as E,Dt as D,Fn as O,Ot as k,Pn as A,a as j,ct as M,i as N,jt as P,kt as F,n as I,o as L,s as R}from"./index-DIc5ekpE.js";import{n as ee}from"./TimeRangePicker-Dtw6LWMh.js";import{t as z}from"./FilterBar-DHVMse_G.js";import{t as B}from"./AdvancedFilter-CAZse6g9.js";import{t as V}from"./DataTableShell-NMYUihjL.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:T()},{value:`targetLabel`,label:v()},{value:`impersonated`,label:f()},{value:`resource`,label:u()},{value:`resourceId`,label:s()}];function q(){let e=O({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,a=e.action??G,s=e.impersonated??G,u=e.resource??G,f=N(e.from,e.to),v=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:I}=ee(f),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:j(e)}),replace:!0}),$=g(y.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:a===G?void 0:a,resource:u===G?void 0:u,impersonated:s===G?void 0:s===`yes`,advanced:v.length>0?v:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||a!==G||s!==G||u!==G||v.length>0||f.kind!==`relative`||f.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:c(),timeRange:f,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(D,{value:a,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:x()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(F,{value:G,children:i()}),te.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}),(0,U.jsxs)(D,{value:s,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(F,{value:G,children:w()}),(0,U.jsx)(F,{value:`yes`,children:_()}),(0,U.jsx)(F,{value:`no`,children:d()})]})]}),(0,U.jsxs)(D,{value:u,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:l()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(F,{value:G,children:o()}),ne.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:v,onChange:Q}),(0,U.jsx)(V,{title:h(),rows:$,emptyHint:m(),columns:[{header:p(),cell:e=>M(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:C(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:l(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,A_ as i,Al as a,B_ as o,Bv as s,C_ as c,Cl as l,D as u,D_ as d,Dl as f,E_ as p,El as m,FI as h,F_ as g,Fv as ee,G_ as _,Gv as te,H_ as v,Hv as ne,I_ as y,J_ as b,Jv as x,K_ as re,LI as ie,L_ as ae,M_ as oe,N_ as se,O_ as ce,Ol as le,P_ as ue,Pv as de,Q_ as fe,RI as S,R_ as pe,Rv as me,S_ as he,Sl as ge,T as C,T_ as _e,Tl as w,U_ as ve,Uv as ye,V_ as be,Vv as xe,W_ as Se,Wv as Ce,X_ as we,Y_ as Te,Z_ as Ee,__ as T,ar as De,av as Oe,b_ as ke,bl as Ae,cv as je,dv as Me,ev as Ne,fv as Pe,g_ as Fe,h_ as Ie,ir as Le,iv as Re,j_ as ze,k_ as E,kl as Be,lv as Ve,ml as He,nv as Ue,or as We,ov as Ge,q_ as Ke,qv as qe,rr as Je,rv as Ye,sr as Xe,sv as Ze,tv as Qe,ur as $e,uv as et,v_ as tt,vl as nt,w_ as rt,wl as it,x_ as at,xl as ot,y_ as st,yl as ct,z_ as lt,zv as ut}from"./dist-_9JGogtQ.js";import{r as D}from"./dist-DiGkpPjG.js";import{t as dt}from"./chevron-up-BFinjgRw.js";import{t as ft}from"./chevrons-up-down-DKu9IjDi.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-C647EVei.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-DSFq9Jhc.js";import{t as xt}from"./button-Bz9USCnz.js";import{An as St,At as k,Ct,Dt as A,Et as wt,Fn as Tt,I as Et,Lt as Dt,Ot as j,P as Ot,Pn as kt,St as At,Tt as jt,_t as M,bn as Mt,bt as Nt,ct as N,gt as P,jn as F,jt as I,kt as L,lt as R,on as z,qt as Pt,rn as B,vt as Ft,wt as It,yt as Lt}from"./index-DIc5ekpE.js";import{r as Rt}from"./locales-CPjguROj.js";import{a as zt,i as V,n as Bt,o as H,r as U,t as Vt}from"./table-C8QBboJq.js";import{t as Ht}from"./FilterBar-DHVMse_G.js";import{a as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt}from"./compatView-BHdx-XYA.js";import{t as W}from"./dispatchErrorInfo-oI5p4wEL.js";var Yt=u(`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`}]]),Xt=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function K(e){return e.filter(e=>e.state===`error`)}function Zt(e){return e.reachable&&K(e.targets).length===0}function Qt(e){return Zt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function $t(e){return e.state===`error`&&e.lastErrorCode!==null}function en(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function tn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function nn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return tn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,rn={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Gt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function dn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Gt(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(rn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),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]),l=(0,G.useMemo)(()=>un(s),[s]),u=(0,G.useMemo)(()=>dn(s),[s]),f=(0,G.useMemo)(()=>fn(s),[s]),m=(0,G.useMemo)(()=>ln(on(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:i(),onReset:()=>r(rn),canReset:an(n),children:[(0,Q.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(I,{placeholder:ce()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(L,{value:Y,children:E()}),l.map(e=>(0,Q.jsx)(L,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(I,{placeholder:d()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(L,{value:Y,children:E()}),u.map(e=>(0,Q.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(I,{placeholder:p()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(L,{value:Y,children:E()}),f.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,Q.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Q.jsx)(zt,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:rt(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:c(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:he(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:at(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ke(),sortKey:`version`,sort:a,onSort:h}),(0,Q.jsx)(V,{children:st()}),(0,Q.jsx)($,{label:tt(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Q.jsx)(Bt,{children:m.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(dt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=$t(e)?W(e.lastErrorCode):null,n=en(e)?W(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:oe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ze({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?T():e===`error`?Fe():Ie()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(P,{variant:`secondary`,children:T()}):e===`error`?(0,Q.jsx)(P,{variant:`destructive`,children:Fe()}):(0,Q.jsx)(P,{variant:`outline`,children:Ie()})}function _n(){return S(C.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=S(C.compat.getBridgeCompat,{}),n=S(C.me.getMe,{host:Dt})?.role===`admin`,r=S(C.admin.listInstances,n?{}:`skip`),i=S(C.agents.usageForInstances,n?{}:`skip`),a=kt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=nn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Tt({from:`/settings/bridge`}),l=kt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Wt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:fe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ee()}),(0,Q.jsxs)(Vt,{children:[(0,Q.jsx)(zt,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Xe()}),(0,Q.jsx)(V,{children:We()}),(0,Q.jsx)(V,{children:De()}),(0,Q.jsx)(V,{children:Le()}),(0,Q.jsx)(V,{children:Je()})]})}),(0,Q.jsx)(Bt,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(P,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(bt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(yt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(z,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(vt,{value:e.key,children:(0,Q.jsx)(bn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):null]})}function yn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:le(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,f({build:t.buildVersion??`?`})]}):null,` · `,m(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ve()});let s=K(e.targets),c=!e.reachable,l=Qt(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,p=N(e.checkedAt),h=e.startedAt==null?null:N(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(St,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(Xt,{size:22}):(0,Q.jsx)(B,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?v():l===`gateways_unreachable`?pe({count:u.length}):c?be():o({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Yt,{size:12,"aria-hidden":!0}),` `,lt({time:p})]}),h?(0,Q.jsx)(`span`,{children:y({time:h})}):null,a]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ae({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:g()})]})}function bn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:o,protocol:s}){let c=r?qt(r,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:Jt(t,e,r)})}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,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(P,{variant:p===`beyond`?`destructive`:`secondary`,children:Kt(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:a()}),(0,Q.jsx)(Sn,{providerName:J(e),support:c,compatStatus:i,compatReachable:o,manifest:r,instanceRows:u}),s?(0,Q.jsx)(xn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(F,{size:13,"aria-hidden":!0}),ue({count:t.length})]}),m?(0,Q.jsx)(pn,{connections:t,displayByInstance:l}):null]})}function xn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[we(),i.length>0?(0,Q.jsx)(P,{variant:`destructive`,children:b({count:i.length})}):(0,Q.jsx)(P,{variant:`secondary`,children:Te()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ke({version:e.vendoredVersion}),r?` · `+re({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(F,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:it()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:$e({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ge({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:w()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(e.version)}),(0,Q.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Kt(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(Ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ct,{children:x({instance:e.displayName??e.name})}),(0,Q.jsx)(Nt,{children:qe()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(St,{"aria-hidden":!0}):(0,Q.jsx)(B,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ue():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Qe()]}):null}function Tn({instance:e,onClose:t}){let n=ie(C.admin.upsertInstanceConfig),i=h(C.bridge.validateMediaPaths),a=Pt(),o=Rt(e.config?.contentLocale,void 0),[c,l]=(0,G.useState)(()=>pt(e.config??{},o)),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,g]=(0,G.useState)(null),_=c.inboundMediaMode===`shared-fs`,v=c.mediaMode===`shared-fs`,y=_||v;async function b(){p(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){a.error(Ge(),e)}finally{p(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(c,r,o)}),t()}catch(e){a.error(s(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:te(),help:ut()}),(0,Q.jsxs)(A,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(j,{children:gt.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Ce(),help:me()}),(0,Q.jsxs)(A,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(j,{children:mt.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ye(),help:ee()}),(0,Q.jsx)(M,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Pe(),help:Me()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:et(),help:Ve()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Ot,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(O,{label:ne(),help:de()})]}),y&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),r({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:Re(),result:m.inbound}),(0,Q.jsx)(wn,{label:Ye(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),Ne()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:f,children:[f?(0,Q.jsx)(Mt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ze():je()]}),(0,Q.jsx)(xt,{size:`sm`,onClick:()=>void x(),disabled:u,children:xe()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(It,{children:[(0,Q.jsx)(wt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ot():Ae({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(jt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ct()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,FI as i,Fl as a,Il as o,Ku as s,Kv as c,LI as l,Ll as u,Ml as d,Nl as f,Pl as p,RI as m,Rl as h,T as g,Zu as _,ao as v,co as y,do as b,hu as x,io as S,jl as C,kI as w,lo as T,lr as E,no as D,oo as O,qu as k,ro as A,so as j,uo as M,zl as N}from"./dist-_9JGogtQ.js";import{t as P}from"./button-Bz9USCnz.js";import{At as F,Dt as I,M as L,N as R,Ot as z,P as B,V,_t as H,jt as U,kt as W,rn as G}from"./index-DIc5ekpE.js";import{i as K}from"./compatView-BHdx-XYA.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=l(g.admin.upsertInstanceConfig),n=m(g.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,q.useState)(i),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(i),c(`idle`)},[e._id,i]);let u=`__none__`,p=a!==i;async function h(){c(`saving`);try{let n={...e.config??{}};a===``||a===u?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let _=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(I,{value:a===``?u:a,onValueChange:e=>o(e===u?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":y(),children:(0,X.jsx)(U,{placeholder:O()})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(W,{value:u,children:O()}),_.map(e=>(0,X.jsx)(W,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?r():f()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null]})}function Q({instance:e}){let t=l(g.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[s,c]=(0,q.useState)(i===null?``:String(i)),[u,p]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),c(i===null?``:String(i)),p(`idle`)},[e._id,n,i]);let m=s.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,_=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,y=a!==n||(h??null)!==i;async function b(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(B,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":T()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(H,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":v(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!y||!_||u===`saving`,onClick:()=>void b(),children:u===`saving`?r():f()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]})}function $({instance:e}){let t=l(g.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=i.trim(),u=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,p=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(H,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||o===`saving`,onClick:()=>void h(),children:o===`saving`?r():f()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]})}function ee(){let e=i(g.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=m(g.admin.listInstances,{}),[l,d]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!l||!r.some(e=>e.name===l))&&d(r[0].name)},[r,l]);let f=(r?.length??0)>1,v=r!==void 0&&r.length===0,y=m(g.compat.forInstance,l?{instanceName:l}:`skip`),b=l?V(y,`configDefaults`):`loading`,S=b===`loading`?null:b.blocked,C=(0,q.useMemo)(()=>f&&l?{instanceName:l}:{},[f,l]),T=(0,q.useRef)(0),D=(0,q.useCallback)(async()=>{let t=++T.current;n({status:`loading`});try{let r=Y(await e(C));if(T.current!==t)return;n({status:`done`,current:r})}catch{if(T.current!==t)return;n({status:`error`})}},[e,C]);(0,q.useEffect)(()=>{S===!1&&(f&&!l||D())},[D,S,f,l]);let O=t.status===`done`?t.current:null,A=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:k()},{id:`standard`,label:s()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:N()}),f&&l?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,X.jsxs)(I,{value:l,onValueChange:e=>d(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":x(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(z,{children:(r??[]).map(e=>(0,X.jsx)(W,{value:e.name,children:e.name},e.name))})]})]}):null,v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:c()}):b===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):b.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(G,{size:14,"aria-hidden":!0}),` `,K(b.gatewayVersion,b.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[p(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:_()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,X.jsx)(L,{options:A,value:O?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,X.jsx)(L,{options:j,value:O===null||O.fastModeDefault===null?null:O.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:E()})]}),(()=>{let e=r?.find(e=>e.name===(l??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{am as r,em as i,im as a,nm as o,om as s,rm as c,tm as l}from"./dist-_9JGogtQ.js";import{r as u}from"./dist-DiGkpPjG.js";import{t as d}from"./chevron-up-BFinjgRw.js";import{t as f}from"./chevrons-up-down-DKu9IjDi.js";import{t as p}from"./button-Bz9USCnz.js";import{En as m,P as h,dt as g,ft as _,ht as v,in as y,ln as b,mt as x,ut as S}from"./index-DIc5ekpE.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-C8QBboJq.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=s(),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)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(h,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(h,{"aria-label":o(),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)(S,{children:[(0,M.jsx)(v,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(x,{}):null,(0,M.jsx)(_,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{gt as t}from"./index-DIc5ekpE.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{$T as r,AT as i,BT as a,CT as o,Ca as s,DT as c,ET as l,FT as u,GT as d,HT as f,IT as p,JT as ee,KT as te,LI as m,LT as ne,MT as h,NT as g,OT as re,PT as _,QT as v,RI as y,RT as ie,ST as b,T as x,TT as S,UT as C,VT as w,WT as T,XT as E,YT as D,ZT as O,_T as k,aE as A,bT as j,cE as M,cT as N,dT as P,eE as F,fT as I,gT as L,hT as R,iE as z,jT as B,kT as V,lE as H,lT as U,mT as W,nE as G,oE as K,pT as ae,qT as q,rE as J,sE as oe,tE as se,uE as ce,uT as le,vT as ue,wT as de,xT as fe,xa as pe,yT as me,zT as he}from"./dist-_9JGogtQ.js";import{t as ge}from"./button-Bz9USCnz.js";import{Z as _e,ct as Y}from"./index-DIc5ekpE.js";import{t as ve}from"./DataTableShell-NMYUihjL.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>ce(),incorrect:()=>H(),incoherence:()=>M(),formatting:()=>oe(),latency:()=>K(),api_error:()=>A(),other:()=>z()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:se()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:J()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=m(x.feedback.respondToFeedback),[c,l]=(0,X.useState)(e.thread),[h,g]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1);async function S(){let t=h.trim();if(!(!t||y)){b(!0);try{await o({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),g(``)}finally{b(!1)}}}let k=[];try{k=i.contextJson?JSON.parse(i.contextJson):[]}catch{k=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${F()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:re(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),c.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:c.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?O():e.authorRole===`agent`?e.authorLabel??s():E()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:D()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ee(),value:h,maxLength:2e3,rows:3,onChange:e=>g(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void S(),disabled:!h.trim()||y,children:y?q():te()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||T()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||T()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,k.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w({count:i.contextCount??k.length,truncated:i.contextTruncated?a():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:k.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:he()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?p({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[u(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,_()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=y(x.feedback.listForAdmin,{}),t=m(x.feedback.readSnapshot),n=m(x.feedback.deleteFeedback),r=_e(),[a,s]=(0,X.useState)(null),[u,d]=(0,X.useState)({});async function f(e){if(a===e._id){s(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}s(e._id)}async function p(e){await r({title:le(),description:U(),confirmLabel:N(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,Z.jsx)(`strong`,{children:h()}),` `,B()]}),(0,Z.jsx)(ve,{title:i(),rows:e,emptyHint:V(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:c(),cell:e=>Y(e.at),sort:e=>e.at},{header:l(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:S(),cell:e=>e.messageRole===`user`?de():o(),sort:e=>e.messageRole},{header:b(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${fe({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:j(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:me(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ue(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:k()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:L()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:R()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?ae():I(),onSelect:()=>void f(e)},{label:P(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,GI as n}from"./dist-_9JGogtQ.js";import{B as r,L as i,R as a,z as o}from"./index-DIc5ekpE.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -72,4 +72,4 @@ STRICT OUTPUT RULES:
|
|
|
72
72
|
[ADMIN FEEDBACK]
|
|
73
73
|
{feedback}
|
|
74
74
|
|
|
75
|
-
{content}`}}},l=Object.keys(c);function u(e,t,n){return t.enabled?t.template:c[e].disabledTemplate?.[n]??``}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()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),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,t){let n={};for(let r of l){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:c[r].defaultTemplate[t]}}return n}function v(e,t){let n={};for(let r of l){let i=c[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let s=a.template.trim();s.length>0&&s!==i.defaultTemplate[t]&&(o.template=s),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function y(e,t){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,t)}}var b=[`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function x(e,t,n){let r={},i=n=>{(e[n]!==g[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=v(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of b){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var S=e();function C({text:e}){return(0,S.jsx)(
|
|
75
|
+
{content}`}}},l=Object.keys(c);function u(e,t,n){return t.enabled?t.template:c[e].disabledTemplate?.[n]??``}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()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),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,t){let n={};for(let r of l){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:c[r].defaultTemplate[t]}}return n}function v(e,t){let n={};for(let r of l){let i=c[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let s=a.template.trim();s.length>0&&s!==i.defaultTemplate[t]&&(o.template=s),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function y(e,t){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,t)}}var b=[`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function x(e,t,n){let r={},i=n=>{(e[n]!==g[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=v(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of b){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var S=e();function C({text:e}){return(0,S.jsx)(o,{delayDuration:150,children:(0,S.jsxs)(i,{children:[(0,S.jsx)(r,{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)(a,{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{$F as r,AF as ee,BF as i,CF as te,DF as ne,Da as a,EF as re,Ea as ie,FF as ae,GF as o,HF as s,IF as c,JF as l,KF as u,LF as d,LI as f,MF as p,NF as m,OF as oe,PF as se,QF as h,RF as ce,RI as le,SF as ue,T as g,TF as de,UF as _,VF as v,WF as y,XF as fe,YF as pe,ZF as me,eI as he,jF as ge,jI as _e,kF as b,kI as ve,nI as x,qF as S,tI as C,uk as w,wF as T,xF as E,zF as D}from"./dist-_9JGogtQ.js";import{t as O}from"./button-Bz9USCnz.js";import{$ as k,At as A,Dn as j,Dt as M,En as N,Ot as P,P as F,at as ye,cn as be,dt as xe,et as Se,ft as I,gt as L,ht as Ce,in as we,it as Te,jt as R,kt as z,nt as Ee,ot as De,qt as Oe,rt as ke,tt as Ae,ut as je}from"./index-DIc5ekpE.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-C8QBboJq.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return o();case`audio`:return y();case`video`:return _();case`pdf`:return s();case`document`:return v();case`archive`:return i();default:return D()}}function q(){let[e,t]=(0,U.useState)(G),[n,i]=(0,U.useState)(G),[o,s]=(0,U.useState)(G),[_,v]=(0,U.useState)(G),[y,D]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=f(g.files.softDelete),Y=Oe();function Ie(){t(G),i(G),s(G),v(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(oe())}catch(e){Y.error(ne(),e)}}let X=le(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:o===G?void 0:o,category:_===G?void 0:_,includeAutoGenerated:y||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(_e(),{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||o!==G||_!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(M,{value:e,onValueChange:t,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":C(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:he()}),(0,W.jsx)(z,{value:`inbound`,children:r()}),(0,W.jsx)(z,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(M,{value:n,onValueChange:i,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:fe()}),Q.chats.map(e=>(0,W.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(M,{value:o,onValueChange:s,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:l()}),Q.instances.map(e=>(0,W.jsx)(z,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(M,{value:_,onValueChange:v,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":S(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:u()}),Q.categories.map(e=>(0,W.jsx)(z,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(F,{checked:y,onCheckedChange:e=>D(e===!0),"aria-label":a()}),(0,W.jsx)(`span`,{children:a()})]}),$?(0,W.jsxs)(O,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(be,{size:14,"aria-hidden":!0}),ge()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ue():te()}):(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:d()}),(0,W.jsx)(B,{children:c()}),(0,W.jsx)(B,{children:ae()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{className:`text-right`,children:m()})]})}),(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)(L,{variant:`outline`,style:{marginLeft:6},children:ie()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(L,{variant:`secondary`,children:e.direction===`inbound`?r():h()})}),(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)(je,{children:[(0,W.jsx)(Ce,{asChild:!0,children:(0,W.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":ee(),children:(0,W.jsx)(N,{size:16})})}),(0,W.jsxs)(xe,{align:`end`,children:[e.url?(0,W.jsx)(I,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(j,{size:14}),p()]})}):(0,W.jsxs)(I,{disabled:!0,children:[(0,W.jsx)(j,{size:14}),T()]}),(0,W.jsxs)(I,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(we,{size:14}),b()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:E({cap:Be})}):null]}),(0,W.jsx)(k,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ee,{children:[(0,W.jsxs)(ye,{children:[(0,W.jsx)(De,{children:re()}),(0,W.jsx)(ke,{children:de()})]}),(0,W.jsxs)(Te,{children:[(0,W.jsx)(Ae,{children:w()}),(0,W.jsx)(Se,{onClick:()=>void Le(),children:b()})]})]})})]})}export{q as FilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cm as r,sm as i}from"./dist-_9JGogtQ.js";import{t as a}from"./button-Bz9USCnz.js";import{_t as o,cn as s,sn as c}from"./index-DIc5ekpE.js";import{t as l}from"./TimeRangePicker-Dtw6LWMh.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(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)(s,{}),i()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Bd as a,Cd as o,D as s,Dd as c,Ed as l,Fd as u,Gd as d,Hd as f,Id as p,Jd as m,Kd as h,LI as g,Ld as _,Md as v,Nd as y,Od as b,Pd as x,Qd as S,RI as C,Rd as w,Sd as T,T as E,Td as D,Ud as ee,Vd as O,Wd as te,Xd as ne,Yd as re,Zd as ie,_d as ae,_f as k,af as A,bd as oe,bf as j,cf as M,dd as N,df as se,ef as P,fd as ce,ff as F,gd as le,gf as ue,hd as I,hf as L,if as R,jd as z,kd as de,lf as fe,md as pe,mf as me,nf as he,of as ge,pd as _e,pf as ve,qd as ye,rf as be,sf as xe,tf as Se,uf as Ce,vd as we,vf as Te,wd as Ee,xd as De,yd as Oe,yf as ke,zd as Ae}from"./dist-_9JGogtQ.js";import{t as je}from"./x-CfJhGjMr.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-DSFq9Jhc.js";import{t as H}from"./button-Bz9USCnz.js";import{At as Pe,Ct as Fe,Dt as Ie,Lt as Le,Mn as Re,Ot as ze,P as U,St as Be,Z as Ve,_ as He,_t as W,an as G,bt as Ue,gt as K,jn as We,jt as Ge,kt as Ke,on as q,qt as J,vt as qe,yt as Je}from"./index-DIc5ekpE.js";import{t as Ye}from"./FilterBar-DHVMse_G.js";import{t as Xe}from"./DataTableShell-NMYUihjL.js";import{t as Y}from"./DetailChips-2kEsgn1k.js";var Ze=s(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=s(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=s(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),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 O();case`user`:return a();case`pending`:return Ae();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=C(E.groups.listGroups,{}),t=C(E.me.getMe,{host:Le})?.role===`admin`,n=g(E.groups.createGroup),i=g(E.groups.updateGroup),a=g(E.groups.deleteGroup),o=Ve(),s=J(),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)($),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(``),y=(0,Z.useMemo)(()=>{if(!e)return e;let t=_.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,_]);function b(){d(null),p($),l(!0)}function x(e){d(e),p({name:e.name,description:e.description??``}),l(!0)}async function S(){try{u?await i({groupId:u._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p($),d(null),l(!1)}catch(e){s.error(pe(),e)}}async function w(e){if(await o({title:Se({name:e.name}),description:P(),confirmWord:e.name,confirmLabel:r(),cancelLabel:xe(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(_e(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),(0,Q.jsx)(Ye,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:F()}),(0,Q.jsx)(Xe,{title:j(),rows:y,addLabel:Te(),onAdd:t?b:void 0,emptyHint:k(),columns:[{header:ue(),cell:e=>e.name,sort:e=>e.name},{header:L(),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:me(),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:ve(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:se(),onSelect:()=>h({groupId:e._id,name:e.name})},...t?[{label:Ce(),onSelect:()=>x(e)},{label:fe(),variant:`destructive`,onSelect:()=>void w(e)}]:[]]}),(0,Q.jsx)(He,{open:c,onOpenChange:l,title:u?A():ge(),description:R(),canSubmit:!!f.name.trim(),onSubmit:S,submitLabel:M(),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:be()}),(0,Q.jsx)(W,{value:f.name,onChange:e=>p({...f,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)(W,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:m?.groupId??null,groupName:m?.name??``,open:m!==null,onOpenChange:e=>{e||h(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)(Re,{size:14,"aria-hidden":!0}),te()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":f({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:[ee(),(0,Q.jsx)(We,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=C(E.groups.getGroup,n&&e?{groupId:e}:`skip`),a=C(E.groups.listAssignableInstances,n?{}:`skip`),o=C(E.groups.listAssignableUsers,n?{}:`skip`),s=g(E.groups.addMember),l=g(E.groups.removeMember),u=g(E.groups.bulkSetMembers),f=g(E.groups.setGroupManager),_=J(),[v,b]=(0,Z.useState)(``),[T,D]=(0,Z.useState)(``),[ee,O]=(0,Z.useState)(`members`),[te,k]=(0,Z.useState)(1),[A,oe]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),N=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),se=i?.viewerIsAdmin===!0,P=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{b(``),D(``),O(`members`),k(1),j.current=null},[n,e]),(0,Z.useEffect)(()=>{k(1)},[v]),(0,Z.useEffect)(()=>{n&&i&&e&&j.current!==e&&(j.current=e,oe(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let F=(0,Z.useMemo)(()=>o?$e(o,v,A):[],[o,v,A]);async function ue(t,n){if(e)try{n?await l({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){_.error(ce(),e)}}async function I(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){_.error(le(),e)}}let L=rt(F,e=>M.has(e.userId)),R=F.filter(e=>M.has(e.userId)).length,z=it(F,te,ot);async function de(){if(!e||F.length===0)return;let t=F.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:L!==`all`})}catch(e){_.error(ce(),e)}}return(0,Q.jsx)(qe,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Je,{className:`oc-access`,children:[(0,Q.jsxs)(Be,{children:[(0,Q.jsx)(Fe,{children:S({name:t})}),(0,Q.jsx)(Ue,{children:ie()})]}),(0,Q.jsxs)(Ne,{value:ee,onValueChange:O,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}),ne(),i?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),m(),i?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),c(),i?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:o===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:v,onChange:e=>b(e.target.value),placeholder:re(),className:`oc-access__search`}),F.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[F.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(U,{checked:L===`all`?!0:L===`some`?`indeterminate`:!1,onCheckedChange:()=>void de(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()}),(0,Q.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[R,` / `,F.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:z.pageItems.map(e=>{let t=M.has(e.userId),n=tt(e),r=N.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(U,{checked:t,onCheckedChange:()=>void ue(e.userId,t),"aria-label":w({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)(K,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&se?(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?ae():we(),title:r?ae():we(),onClick:()=>void I(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":Oe(),title:Oe(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:z.page,pageCount:z.pageCount,onPage:k})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):a.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:T,onChange:e=>D(e.target.value),placeholder:ye(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,query:T},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let o=C(E.groups.listAssignableAgents,{instanceName:t}),s=g(E.groups.assignAgentToGroup),c=g(E.groups.removeAgentFromGroup),l=g(E.groups.bulkSetGroupAgents),f=J(),[p,m]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{m(1)},[a]),!e)return null;let h=et(o?.agents??[],a),y=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&h.length===0)return null;let x=h.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),S=rt(x,e=>r.has(`${t}/${e.agentId}`)),w=it(h,p,ot);async function T(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){f.error(N(),e)}}async function D(){if(x.length===0)return;let n=x.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:S!==`all`})}catch(e){f.error(N(),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)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),y?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:i()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y?z():v()}):(0,Q.jsxs)(Q.Fragment,{children:[x.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(U,{checked:S===`all`?!0:S===`some`?`indeterminate`:!1,onCheckedChange:()=>void D(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()})]}):null,w.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(U,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void T(e.agentId,i),"aria-label":_({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":b(),title:b(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:de()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:w.page,pageCount:w.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=C(E.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=g(E.charts.assignChartToGroup),r=g(E.charts.removeChartFromGroup),i=g(E.charts.setGroupDefaultChart),a=g(E.charts.addChartToGroupPool),s=g(E.charts.removeChartFromGroupPool),c=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(I(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(I(),e)}}async function _(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(I(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(I(),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)(U,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":T({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":De(),title:De(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:oe()}):null,f?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":o({name:e.name}),title:o({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)(Ie,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:Ee()})}),(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:D()}):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{$C as r,$S as i,AC as a,Aw as o,BC as s,CC as c,Cw as l,DC as u,Do as d,Dw as f,EC as p,Eo as m,Ew as h,FC as g,FI as _,GC as v,GS as y,HC as b,IC as x,Iv as S,JC as ee,JS as C,KC as te,KS as w,LC as ne,LI as T,Lv as E,MC as D,Mw as re,NC as ie,Nw as ae,OC as oe,Oo as se,Ow as ce,PC as le,Pw as ue,QC as de,QS as fe,RC as pe,RI as O,SC as me,Sw as he,T as k,TC as ge,Tw as _e,UC as ve,VC as ye,WC as be,XC as A,XS as xe,YC as Se,YS as Ce,ZC as j,ZS as we,_C as Te,_w as Ee,aC as De,aw as Oe,bC as ke,bw as Ae,cC as je,cw as Me,dC as Ne,dw as Pe,eC as Fe,ew as Ie,fC as Le,fr as Re,fw as ze,gC as Be,gw as Ve,hC as M,hw as He,iC as Ue,iw as We,jC as Ge,jw as Ke,kC as qe,ko as Je,kw as Ye,lC as Xe,lw as Ze,mr as Qe,mw as $e,nA as N,nC as et,nw as tt,oC as nt,ow as rt,pC as it,pr as at,pw as ot,qC as st,qS as ct,rA as P,rC as lt,rw as ut,sC as dt,sw as ft,tC as pt,tw as mt,uC as ht,uw as gt,vC as F,vw as _t,wC as vt,ww as yt,xC as bt,xw as xt,yC as St,yw as Ct,zC as wt}from"./dist-_9JGogtQ.js";import{a as Tt,c as Et}from"./FieldLabel-C647EVei.js";import{t as I}from"./button-Bz9USCnz.js";import{At as L,Ct as R,Dt as z,Et as Dt,Ot as B,P as V,St as H,Tt as Ot,Z as kt,_ as At,_t as U,bt as W,gt as G,jt as K,kt as q,qt as J,vt as jt,wt as Mt,yt as Nt}from"./index-DIc5ekpE.js";import{t as Pt}from"./DataTableShell-NMYUihjL.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-De8R_lT4.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=O(k.admin.listInstances,{}),t=O(k.agents.listAllInstanceAgents,{}),n=T(k.admin.upsertInstance),r=T(k.admin.deleteInstance),i=J(),[a,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(Q),[d,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);async function x(){try{await n({instanceId:y??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),u(Q),b(null),s(!1)}catch(e){i.error(re(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ke(),(0,Z.jsx)(`strong`,{children:o()}),Ye()]}),(0,Z.jsx)(Pt,{title:ce(),rows:e,addLabel:f(),onAdd:()=>{b(null),u(Q),s(!0)},emptyHint:h(),columns:[{header:_e(),cell:e=>e.name,sort:e=>e.name},{header:yt(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:l(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:he(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ue(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?w():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:_t(),onSelect:()=>{b(e._id),u(Bt(e)),s(!0)}},{label:ae(),onSelect:()=>p(e.name)},{label:ut(),onSelect:()=>v(e)},{label:xt(),onSelect:()=>g(e)},{label:Ae(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:Ae(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(At,{open:a,onOpenChange:s,title:y?Ee():Ct(),description:He(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:x,submitLabel:$e(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ot(),children:[(0,Z.jsx)(U,{value:c.name,disabled:y!==null,onChange:e=>u({...c,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ve()}):null]}),(0,Z.jsx)($,{label:ze(),children:(0,Z.jsxs)(z,{value:c.kind,onValueChange:e=>u({...c,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:Qe(),children:(0,Z.jsxs)(z,{value:c.transport,onValueChange:e=>u({...c,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(q,{value:`ws`,children:at()}),(0,Z.jsx)(q,{value:`rest`,children:Re()})]})]})}):null,(0,Z.jsx)($,{label:Pe(),children:(0,Z.jsx)(U,{value:c.gatewayUrl,onChange:e=>u({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:gt(),children:(0,Z.jsx)(U,{value:c.bridgeUrl,placeholder:Ze(),onChange:e=>u({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Me(),children:(0,Z.jsx)(U,{value:c.displayName,onChange:e=>u({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:E(),children:[(0,Z.jsxs)(z,{value:c.streamTransport,onValueChange:e=>u({...c,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(B,{children:Et.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S()})]}),(0,Z.jsx)($,{label:ft(),children:(0,Z.jsx)(U,{value:c.gatewayVersion,placeholder:rt(),onChange:e=>u({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Oe(),children:(0,Z.jsx)(U,{value:c.gatewayHttpUrl,placeholder:We(),onChange:e=>u({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Ft,{instance:m,onClose:()=>g(null)},m._id):null,_?(0,Z.jsx)(Ht,{instance:_,onClose:()=>v(null)},_._id):null]})}function Ht({instance:e,onClose:t}){let n=O(k.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(R,{children:tt({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)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=_(k.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(g());break;case`no_agents`:n.success(ie());break;case`no_bridge_url`:n.error(D());break;case`deploy_misconfigured`:n.error(Ge());break;case`unauthorized`:n.error(qe());break;case`not_served`:n.error(oe());break;default:n.error(a());break}}catch(e){n.error(le(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?x():ne()})})]})}function Wt({instance:e}){let t=O(k.bridgeAuth.listBridgeAuthStatus,{}),n=_(k.bridgeAuth.mintBridgeSecret),r=T(k.bridgeAuth.revokeBridgeSecret),i=J(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),m=f!==void 0;async function h(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(ke(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(bt())}catch(e){i.error(ke(),e)}finally{o(!1)}}}async function v(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:p(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:m?`outline`:`secondary`,children:m?`${j()} · ${f.prefix}…${f.lastFour}`:A()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?c():vt()}),m?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:me()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:St()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:u?P():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:F()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let i=_(k.instanceSecrets.setInstanceSecret),a=T(k.instanceSecrets.clearInstanceSecret),o=_(k.deviceIdentity.generateDeviceIdentity),c=J(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),y=n!==null,x=t===`deviceIdentity`,S=t===`token`?Ie():t===`deviceIdentity`?r():de();async function C(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),g(!1),c.success(v())}catch(e){c.error(be(),e)}finally{f(!1)}}}async function w(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),c.success(ve())}catch(e){c.error(be(),e)}finally{f(!1)}}}async function ne(){if(!d){f(!0);try{m(await o({instanceId:e})),g(!1),c.success(s())}catch(e){c.error(pe(),e)}finally{f(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function D(){if(E)try{await navigator.clipboard.writeText(E),g(!0)}catch{}}return(0,Z.jsxs)($,{label:S,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:y?`outline`:`secondary`,children:y?j():A()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:y?ee():Se(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void C(),disabled:d||l.trim().length===0,children:st()}),x?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void ne(),disabled:d,children:b()}):null,y?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void w(),disabled:d,children:te()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:s()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:wt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:h?P():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:F()})]}):null]})}var Kt={conversational:dt,documentary:De,summarizer:Je,curator:d},qt={conversational:nt,documentary:Ue,summarizer:se,curator:m},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Ne()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Mt,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ht()})}),(0,Z.jsxs)(Ot,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Xe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:je()}),(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)(V,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=O(k.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=T(k.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(k.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(k.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=T(k.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(k.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(k.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=T(k.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(k.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(k.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=T(k.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(k.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(k.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=T(k.agents.removeInstanceAgent),u=kt(),d=J();async function f(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(M(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(M(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(M(),e)}}async function h(t,n){if(e&&await u({title:pt({name:n}),description:Fe(),confirmLabel:i(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(fe())}catch(e){d.error(M(),e)}}return(0,Z.jsx)(jt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(Nt,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(R,{children:Te({name:e??``})}),(0,Z.jsx)(W,{children:Be()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?xe():r.discovery.lastPollOk?Ce():C({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ct()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(V,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:y()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:et()})]}):i?(0,Z.jsx)(G,{variant:`default`,children:w()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:lt()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(M(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:it(),"aria-label":Le(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CE as r,FI as i,Gs as a,Hs as o,Js as s,Ks as c,LI as l,RI as u,SE as d,T as f,TE as p,Us as m,Ws as h,Xs as g,Ys as _,_E as v,bE as y,fE as b,gE as x,hE as S,mE as C,pE as w,qs as T,vE as E,wE as D,xE as O,yE as k}from"./dist-_9JGogtQ.js";import{t as A}from"./button-Bz9USCnz.js";import{P as j,_t as M,gt as N}from"./index-DIc5ekpE.js";var P=t(e(),1),F=n();function I(){let e=u(f.integrations.status.status,{}),t=l(f.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let a=n,o=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),c=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[D(),` `,(0,F.jsx)(`strong`,{children:r()}),` `,d()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:y()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:E(),children:[(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>o(`langfuse`,`host`,e.target.value),onBlur:()=>c(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:b(),checked:a.langfuse.enabled??!0,onChange:e=>{o(`langfuse`,`enabled`,e),c(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:y()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:v(),children:[(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>o(`opik`,`baseUrl`,e.target.value),onBlur:()=>c(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||w(),onChange:e=>o(`opik`,`workspace`,e.target.value),onBlur:()=>c(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:b(),checked:a.opik.enabled??!0,onChange:e=>{o(`opik`,`enabled`,e),c(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:y()}):(0,F.jsx)(N,{variant:`outline`,children:g()}),note:_(),children:[(0,F.jsx)(R,{label:s(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>o(`otlp`,`endpoint`,e.target.value),onBlur:()=>c(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:b(),checked:a.otlp.enabled??!0,onChange:e=>{o(`otlp`,`enabled`,e),c(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(j,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=i(f.integrations.otlpSecret.setOtlpHeaders),n=l(f.integrations.otlpSecret.clearOtlpHeaders),[r,s]=(0,P.useState)(``),[u,d]=(0,P.useState)(null),[p,g]=(0,P.useState)(!1),_=async()=>{g(!0),d(null);try{await t({headersJson:r}),s(``)}catch(e){d(e instanceof Error?e.message:String(e))}finally{g(!1)}};return(0,F.jsxs)(R,{label:T(),children:[(0,F.jsx)(M,{value:r,placeholder:e?c():a(),onChange:e=>s(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:p||r.trim().length===0,onClick:()=>void _(),children:h()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:p,onClick:()=>void n({}),children:m()}):null]}),u?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:u}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:o()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Gg as i,Hg as a,Jg as o,Kg as s,ND as c,QE as l,Qg as u,RI as d,T as f,Ug as p,Wg as m,Xg as h,Yg as g,ZE as ee,Zg as _,aD as v,cD as y,e_ as b,oD as x,qg as S,sD as C,t_ as w}from"./dist-_9JGogtQ.js";import{Fn as T,Lt as E,Pn as D,i as te,o as ne,r as re}from"./index-DIc5ekpE.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DKADL750.js";import{n as N,t as P}from"./TimeRangePicker-Dtw6LWMh.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=d(f.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=d(f.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:y()}),(0,I.jsx)(j,{children:x()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(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:[ee(),` p50 `,R(s.cP50),` `,C()]}),(0,I.jsxs)(`span`,{children:[l(),` p50 `,R(s.aP50),` `,C()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":y(),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:w(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:b(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:r(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:_(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:h(),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=T({from:`/settings/kpi`}),t=D({from:`/settings/kpi`}),n=te(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:i,to:a}=N(n),{rowLimit:c,buckets:l}=K(i,a),u=d(f.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),p=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),m=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:o()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:p.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:i({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:m()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:p({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,o=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":a({max:Q(r),unit:n}),children:e.map((e,a)=>{let s=r>0?e.value/r*(Z-1):0,c=a*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:o,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{$j as r,Aj as i,Bj as a,Cj as o,Dj as s,E as c,Ej as l,Et as u,Fj as d,Gj as ee,Hj as te,Ij as ne,Jj as re,Kj as ie,LI as f,Lj as ae,Mj as oe,Mt as se,Nj as ce,Oj as p,Pj as le,Qj as ue,RI as m,Rj as de,Sj as h,T as g,Tj as fe,Uj as pe,Vj as me,Wj as _,Xj as v,Yj as y,Zj as b,_I as x,_j as S,_t as C,aI as w,bI as T,bj as E,cI as D,dI as O,dt as k,eM as A,fI as j,ft as M,gI as N,gj as P,gt as F,hI as I,hj as L,ht as R,iI as z,jj as he,jt as ge,kI as _e,kj as ve,lI as ye,mI as be,mt as xe,mw as Se,oI as Ce,pI as we,pt as Te,qj as Ee,sI as De,uI as Oe,vI as ke,vj as Ae,vt as je,wI as Me,wj as B,xI as Ne,xj as Pe,yI as Fe,yj as Ie,zj as Le}from"./dist-_9JGogtQ.js";import{t as V}from"./button-Bz9USCnz.js";import{At as Re,Dt as ze,Ft as Be,It as Ve,Lt as H,Ot as He,P as U,Pt as Ue,_t as W,gt as G,jt as We,kt as K,q as Ge,qt as Ke,t as qe}from"./index-DIc5ekpE.js";import{t as Je}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=n();function Ye({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:c(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:c(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>A()},{id:`composer`,label:()=>r()},{id:`sidebar`,label:()=>ue()},{id:`notifications`,label:()=>d()},{id:`other`,label:()=>b()}],X={showSource:{category:`messages`,label:()=>v(),help:()=>y()},showReport:{category:`messages`,label:()=>re(),help:()=>Ee()},copyAssistant:{category:`messages`,label:()=>ie()},copyUser:{category:`messages`,label:()=>ee()},showDelete:{category:`messages`,label:()=>_()},showTools:{category:`messages`,label:()=>pe(),help:()=>te()},voiceInput:{category:`composer`,label:()=>me(),help:()=>a()},showUsage:{category:`composer`,label:()=>Le(),help:()=>de()},autoReadAloud:{category:`composer`,label:()=>se(),help:()=>ge()},showChatAge:{category:`sidebar`,label:()=>ae(),help:()=>ne()},notifSound:{category:`notifications`,label:()=>le(),help:()=>ce()},notifSystem:{category:`notifications`,label:()=>oe(),help:()=>he()},replySound:{category:`notifications`,label:()=>i(),help:()=>ve()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>Ie()};function rt({prefKey:e,ui:t}){let n=f(g.admin.setUiPrefDefault),r=f(g.admin.setFeatureEnabled),i=tt(e),a=i?nt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:o()}),(0,J.jsxs)(ze,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,J.jsx)(Re,{size:`sm`,className:`w-36`,children:(0,J.jsx)(We,{})}),(0,J.jsxs)(He,{children:[(0,J.jsx)(K,{value:`on`,children:S()}),(0,J.jsx)(K,{value:`off`,children:P()}),(0,J.jsx)(K,{value:`inherit`,children:L()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(U,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":h()}),h()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function it({current:e,enabled:t}){let n=f(g.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Be(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[je(),e?(0,J.jsx)(G,{variant:`secondary`,children:Ve(e,Ue())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?R():r?F():C()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:k()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?M():e?Te():xe()})]})]})}function at(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=m(g.me.getMe,{host:H}),a=i?.ui,o=$(i?.role)&&n,c=f(g.me.setUiPref).withOptimisticUpdate(Ge),d=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(U,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":B()}),B()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Pe()}),(0,J.jsx)(`p`,{children:E()}),(0,J.jsx)(`p`,{children:Ae()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:p(),"aria-label":p(),className:`mb-2`}),d.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:s()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:d.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],s=a.effective[e],d=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(G,{variant:`outline`,children:l()}):d?(0,J.jsx)(G,{variant:`secondary`,children:u()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&d?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:fe()}):null,(0,J.jsx)(Ye,{checked:s,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(rt,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(it,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:_e()})}var ot={sm:()=>ye(),md:()=>D(),lg:()=>De(),xl:()=>Ce()};function st(){let e=m(g.me.getMe,{host:H}),t=f(g.me.setLocale),n=f(g.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(g.me.getMe,{host:H});n&&e.setQuery(g.me.getMe,{host:H},{...n,fontScale:t,resolvedFontScale:t??`md`})}),r=f(g.me.setMyName),i=Ke(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,q.useState)(null),l=s??o,u=l.trim()!==o.trim();async function d(){try{await r({name:l}),c(null),i.success(x())}catch(e){i.error(N(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ne()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:T()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:l,maxLength:120,placeholder:Fe(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u&&(e.preventDefault(),d())}}),(0,J.jsx)(V,{size:`sm`,disabled:!u,onClick:()=>void d(),children:Se()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:I()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[Je().map(e=>(0,J.jsx)(V,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Me()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:j()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:qe.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:w()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(0,J.jsx)(at,{})]})]})}export{st as PreferencesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bh as r,Cg as i,Ch as a,Cm as o,D as s,Dh as c,Eh as l,Gh as u,Hh as d,Ih as f,Jh as ee,Kh as p,LI as m,Lh as h,Mh as g,Nh as te,Ph as _,Qh as v,RI as y,Rh as b,Sh as x,T as S,Tg as ne,Th as C,Uh as re,Vh as ie,Wh as w,Xh as T,Yh as ae,Zh as E,_h as oe,bh as D,cg as se,eg as ce,fg as le,gg as ue,hg as de,hh as fe,ig as O,jh as pe,kI as k,lg as me,ng as he,og as A,qh as ge,rg as j,sg as _e,tg as ve,ug as ye,vg as M,vh as be,wg as xe,xh as N,yg as P,yh as Se,zh as Ce}from"./dist-_9JGogtQ.js";import{r as we}from"./dist-DiGkpPjG.js";import{t as F}from"./button-Bz9USCnz.js";import{A as Te,C as Ee,Cn as De,D as I,E as Oe,En as ke,F as Ae,Fn as je,In as Me,O as L,Pn as R,Q as Ne,Rt as Pe,S as Fe,Sn as z,T as Ie,Z as Le,_ as Re,_n as ze,_t as B,b as V,d as Be,dn as Ve,dt as He,f as Ue,fn as H,ft as U,g as We,h as W,hn as Ge,ht as Ke,in as qe,j as G,jn as Je,k as Ye,m as Xe,mt as Ze,p as Qe,pn as $e,pt as et,qt as tt,ut as nt,v as K,vn as rt,w as it,wn as q,x as J,y as at,zt as ot}from"./index-DIc5ekpE.js";var st=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),ct=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),lt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ut=s(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),dt=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function Z({className:e}){return(0,X.jsx)(Ke,{asChild:!0,children:(0,X.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":a(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(ke,{})})})}function ft({folderId:e,name:t,color:n,currentParentId:r,className:a,onOpen:o}){let s=m(S.projects.renameProject),c=m(S.projects.setProjectColor),u=m(S.projects.moveProject),d=m(S.projects.deleteProject),f=m(S.projects.createProject),ee=Le(),p=Ne(),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(t),[b,re]=(0,Y.useState)(!1),[ie,w]=(0,Y.useState)(!1),T=y(S.projects.projectTreeCount,ie?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(nt,{onOpenChange:e=>e&&w(!0),children:[(0,X.jsx)(Z,{className:a}),(0,X.jsxs)(He,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(U,{onSelect:()=>o(),children:[(0,X.jsx)(q,{}),` `,A()]}),(0,X.jsxs)(U,{onSelect:()=>{v(t),g(!0)},children:[(0,X.jsx)($e,{}),` `,x()]}),(0,X.jsxs)(U,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await p({title:E(),label:ne(),placeholder:xe(),confirmLabel:i()});t&&await f({name:t,parentId:e})})},children:[(0,X.jsx)(De,{}),` `,E()]}),(0,X.jsxs)(U,{onSelect:()=>re(!0),children:[(0,X.jsx)(ct,{}),` `,te()]}),(0,X.jsx)(et,{children:Se()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":be(),children:`✕`}),Xe.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(Ze,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=T?.folders??0,r=T?.chats??0;await ee({title:me({name:t}),description:n>0?_e({folders:n,chats:r}):r>0?se({count:r}):l(),confirmWord:C(),confirmLabel:ye(),destructive:!0})&&await d({projectId:e})})},children:[(0,X.jsx)(qe,{}),` `,C()]})]})]}),(0,X.jsx)(Re,{open:h,onOpenChange:g,title:de(),canSubmit:_.trim().length>0,onSubmit:async()=>{await s({projectId:e,name:_.trim()}),g(!1)},submitLabel:x(),children:(0,X.jsx)(B,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),b?(0,X.jsx)(Qe,{open:b,onOpenChange:re,title:pe(),movingFolderId:e,currentId:r,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function Q({chat:e,currentFolderId:t,className:n}){let r=m(S.chats.pinChat),i=m(S.chats.deleteChat),a=m(S.chats.renameChat),o=m(S.chats.setChatSidebar),s=m(S.chats.moveChatToProject),c=Le(),[u,d]=(0,Y.useState)(!1),[f,ee]=(0,Y.useState)(e.title??``),[p,h]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(nt,{children:[(0,X.jsx)(Z,{className:n}),(0,X.jsxs)(He,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(U,{onSelect:()=>{ee(e.title??``),d(!0)},children:[(0,X.jsx)($e,{}),` `,x()]}),(0,X.jsxs)(U,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(Ve,{}):(0,X.jsx)(H,{}),e.pinned?N():D()]}),(0,X.jsxs)(U,{onSelect:()=>h(!0),children:[(0,X.jsx)(ct,{}),` `,_()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(U,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(Ge,{}):(0,X.jsx)(dt,{}),e.inSidebar?j():O()]}),(0,X.jsx)(Ze,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:oe(),description:l(),confirmLabel:C(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,X.jsx)(qe,{}),` `,C()]})]})]}),(0,X.jsx)(Re,{open:u,onOpenChange:d,title:fe(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:x(),children:(0,X.jsx)(B,{value:f,onChange:e=>ee(e.target.value),autoFocus:!0})}),p?(0,X.jsx)(Qe,{open:p,onOpenChange:h,title:g(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function pt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function mt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function ht(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var gt=`oc.projpage.view`;function _t(){let e=localStorage.getItem(gt);return e===`cards`||e===`list`?e:`columns`}var vt=e=>`into:${e}`,yt=e=>`col:${e??`null`}`,bt=e=>`crumb:${e}`;function xt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function St(){let{projectId:e}=Me({from:`/project/$projectId`}),t=R(),n=y(S.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:k()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:Ce()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}),(0,X.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:h()})]}):(0,X.jsx)(Ct,{page:n})})}function Ct({page:e}){let t=R(),n=Le(),a=Ne(),s=tt(),u=m(S.projects.renameProject),h=m(S.projects.setProjectColor),g=m(S.projects.deleteProject),_=m(S.projects.createProject),b=m(S.projects.moveProject),w=m(S.chats.moveChatToProject),T=m(S.chats.reorderChat),ae=m(S.projects.reorderProject),oe=y(S.projects.projectTreeCount,{projectId:e.project._id}),[D,le]=(0,Y.useState)(_t),fe=e=>{localStorage.setItem(gt,e),le(e)},O=y(S.projects.folderColumns,D===`columns`?{projectId:e.project._id}:`skip`),k=y(S.projects.projectTreeList,D===`list`?{projectId:e.project._id}:`skip`),{c:A}=je({from:`/project/$projectId`}),j=y(S.projects.listProjects,{}),M=y(S.chatReads.myBusyChats,{}),N=(0,Y.useMemo)(()=>new Set(M??[]),[M]),Ce=y(S.chatReads.myChatReads,{}),we=(0,Y.useMemo)(()=>ht(e.chats,Ce??[]),[e.chats,Ce]),{startNewChat:Me,picker:L}=Be(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[V,Ve]=(0,Y.useState)(``),[Ue,H]=(0,Y.useState)(!1),[W,Ge]=(0,Y.useState)(e.project.name),[G,Je]=(0,Y.useState)(!1),[q,dt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>dt(V.trim()),180);return()=>clearTimeout(e)},[V]);let Z=y(S.search.searchConversations,q.length>=2?{query:q,projectId:e.project._id}:`skip`),ft=Te(Ye(it,{activationConstraint:{distance:4}}),Ye(Ie,{activationConstraint:{delay:250,tolerance:8}})),Q=(0,Y.useRef)(!1),vt=()=>{Q.current=!0,setTimeout(()=>{Q.current=!1},0)},[yt,bt]=(0,Y.useState)(null),St=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=O?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||P()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(j??[]).find(t=>t._id===e)?.name??``}}return null},Ct=e=>bt(St(String(e.active.id))),Et=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=I(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Oe(n(t?`folder:`:`chat:`))},[]),$=t=>{if(D===`columns`){for(let e of O?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(D===`list`){let e=k?.chats.find(e=>e._id===t);return e?{list:k.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},kt=t=>{if(D===`columns`){for(let e of O?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(D===`list`){let e=k?.folders.find(e=>e._id===t);if(!e||!k)return null;let n=e.parentId??k.rootId;return{list:ot(k.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},At=async e=>{bt(null),vt();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=xt(r);if(e!==void 0){if(a)await w({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Pe(j??[],t,e)){s.error(v());return}await b({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=$(t);if(!n)return;n.list.some(t=>t._id===e)||await w({chatId:e,projectId:n.folderId});let a=mt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await T({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=kt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Pe(j??[],e,n.parentId)){s.error(v());return}await b({projectId:e,parentId:n.parentId})}let a=mt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ae({projectId:e,...a});return}}catch{s.error(v())}},[,Mt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Mt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Nt=Date.now(),Pt=We(e.project),Ft=pt(e.chats,V),It=e.breadcrumb.slice(0,-1),Lt=e=>()=>{Q.current||e()};return(0,X.jsxs)(Fe,{sensors:ft,collisionDetection:Et,onDragStart:Ct,onDragEnd:At,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Pt},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":f(),children:[It.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(wt,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Lt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":he(),children:[(0,X.jsx)(F,{variant:D===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":he(),title:he(),"aria-pressed":D===`cards`,onClick:()=>fe(`cards`),children:(0,X.jsx)(lt,{})}),(0,X.jsx)(F,{variant:D===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ve(),title:ve(),"aria-pressed":D===`columns`,onClick:()=>fe(`columns`),children:(0,X.jsx)(st,{})}),(0,X.jsx)(F,{variant:D===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ce(),title:ce(),"aria-pressed":D===`list`,onClick:()=>fe(`list`),children:(0,X.jsx)(ut,{})})]}),(0,X.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void Me({projectId:e.project._id}),children:[(0,X.jsx)(rt,{}),p()]}),(0,X.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await a({title:E(),label:ne(),placeholder:xe(),confirmLabel:i()});t&&await _({name:t,parentId:e.project._id})},children:[(0,X.jsx)(De,{}),E()]}),(0,X.jsxs)(nt,{children:[(0,X.jsx)(Ke,{asChild:!0,children:(0,X.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":ue(),children:(0,X.jsx)(ke,{})})}),(0,X.jsxs)(He,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(U,{onSelect:()=>{Ge(e.project.name),H(!0)},children:[(0,X.jsx)($e,{}),` `,x()]}),(0,X.jsxs)(U,{onSelect:()=>Je(!0),children:[(0,X.jsx)(ct,{}),` `,te()]}),(0,X.jsx)(et,{children:Se()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void h({projectId:e.project._id,color:null}),"aria-label":be(),children:`✕`}),Xe.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void h({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(Ze,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=oe?.folders??0,a=oe?.chats??0;await n({title:me({name:e.project.name}),description:i>0?_e({folders:i,chats:a}):a>0?se({count:a}):l(),confirmWord:C(),confirmLabel:ye(),destructive:!0})&&(await g({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(qe,{}),` `,C()]})]})]})]})]}),D===`columns`?(0,X.jsx)(jt,{data:O,currentId:e.project._id,busyIds:N,suppressClick:Q,locateChatId:A??null}):D===`list`?(0,X.jsx)(Ot,{data:k,busyIds:N,suppressClick:Q,locateChatId:A??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:at,children:e.children.map(t=>(0,X.jsx)(Tt,{child:t,parentId:e.project._id,now:Nt,suppressClick:Q},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ge()}),e.chats.length>0?(0,X.jsx)(B,{value:V,onChange:e=>Ve(e.target.value),placeholder:re(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?ie():r()}):Ft.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:d({term:V.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(K,{items:Ft.map(e=>`chat:${e._id}`),strategy:J,children:Ft.map(t=>(0,X.jsx)(Dt,{chat:t,currentFolderId:e.project._id,now:Nt,busy:N.has(t._id),unread:we.has(t._id),locate:t._id===A,suppressClick:Q},t._id))})})]}),q.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:c()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:d({term:q})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&q&&Ae(e.messageId,q),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(ze,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||o()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(Re,{open:Ue,onOpenChange:H,title:de(),canSubmit:W.trim().length>0,onSubmit:async()=>{await u({projectId:e.project._id,name:W.trim()}),H(!1)},submitLabel:x(),children:(0,X.jsx)(B,{value:W,onChange:e=>Ge(e.target.value),autoFocus:!0})}),G?(0,X.jsx)(Qe,{open:G,onOpenChange:Je,title:pe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void b({projectId:e.project._id,parentId:t})}):null,L]}),(0,X.jsx)(Ee,{children:yt?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[yt.kind===`folder`?(0,X.jsx)(z,{size:13,"aria-hidden":!0}):(0,X.jsx)(ze,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:yt.label})]}):null})]})}function wt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:bt(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Tt({child:e,parentId:t,now:n,suppressClick:r}){let i=R(),a=V({id:`folder:${e._id}`}),o=L({id:vt(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":We(e),transform:G.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(ft,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?u({count:e.folderCount})+` · `:``,w({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:Ue(e.lastActivityAt,n)})]})}function Et({chat:e}){let t=m(S.chats.setChatSidebar),n=e.inSidebar?j():O();return(0,X.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(Ge,{}):(0,X.jsx)(dt,{})})}function Dt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=R(),c=W(e.color),l=V({id:`chat:${e._id}`}),u=$(a);return(0,X.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:G.Transform.toString(l.transform),transition:l.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||P()}),e.pinned?(0,X.jsx)(H,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:Ue(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,title:M(),"aria-label":M()}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:le(),"aria-label":le()}):null]}),(0,X.jsx)(Et,{chat:e}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function $(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ot({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:k()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=ot(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:J,children:u.map(e=>(0,X.jsx)(At,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:J,children:d.map(t=>(0,X.jsx)(kt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&ot(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:ie()}):c(null,0)})}function kt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=R(),c=V({id:`folder:${e._id}`}),l=L({id:vt(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":We(e),transform:G.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?T():ae(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(Je,{size:13}):(0,X.jsx)(we,{size:13})}),(0,X.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(ft,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function At({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=R(),o=V({id:`chat:${e._id}`}),s=$(r),c=W(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:G.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||P()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Et,{chat:e})]})}function jt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:k()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(Mt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function Mt({col:e,isLast:t,currentId:n,busyIds:i,suppressClick:a,locateChatId:o}){let s=R(),c=L({id:yt(e.folderId)});return(0,X.jsxs)(`div`,{ref:c.setNodeRef,className:`oc-projpage__col`+(c.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:J,children:e.folders.map(t=>(0,X.jsx)(Nt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:a,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:J,children:e.chats.map(t=>(0,X.jsx)(Pt,{chat:t,folderId:e.folderId,busy:i.has(t._id),locate:t._id===o,suppressClick:a,onOpen:()=>void s({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:r()}):null]})}function Nt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=V({id:`folder:${e._id}`}),o=L({id:vt(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":We(e),transform:G.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(ft,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Pt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=V({id:`chat:${e._id}`}),s=$(r),c=W(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:G.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||P()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(Et,{chat:e})]})}export{St as ProjectPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.oc-projpage{height:100%;padding:24px clamp(16px,5vw,48px);overflow-y:auto}.oc-projpage__body{flex-direction:column;gap:20px;max-width:860px;margin:0 auto;display:flex}.oc-projpage__hint{color:var(--muted-foreground);font-size:.85rem}.oc-projpage__notfound{flex-direction:column;align-items:flex-start;gap:10px;max-width:860px;margin:48px auto;display:flex}.oc-projpage__crumbs{color:var(--muted-foreground);flex-wrap:wrap;align-items:center;gap:2px;font-size:.8rem;display:flex}.oc-projpage__crumb{align-items:center;gap:2px;display:inline-flex}.oc-projpage__crumblink{color:inherit;border-radius:6px;padding:2px 4px;text-decoration:none}.oc-projpage__crumblink:hover{color:var(--foreground);background:color-mix(in oklab, var(--proj-hue) 14%, transparent)}.oc-projpage__crumbsep{opacity:.6;padding:0 2px}.oc-projpage__crumbcur{color:var(--foreground);padding:2px 4px;font-weight:500}.oc-projpage__head{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.oc-projpage__dot{background:var(--proj-hue);border-radius:4px;flex:none;width:12px;height:12px}.oc-projpage__title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin:0;font-size:1.25rem;font-weight:600;overflow:hidden}.oc-projpage__actions{flex:none;align-items:center;gap:6px;display:flex}.oc-projpage__section{flex-direction:column;gap:10px;display:flex}.oc-projpage__subtitle{text-transform:uppercase;letter-spacing:.04em;color:var(--muted-foreground);margin:0;font-size:.78rem;font-weight:600}.oc-projpage__cards{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;display:grid}.oc-projpage__card{border:1px solid var(--border);border-left:3px solid color-mix(in oklab, var(--proj-hue) 55%, transparent);border-radius:var(--radius);background:var(--card);color:var(--foreground);flex-direction:column;gap:6px;padding:12px 14px;text-decoration:none;transition:background .14s,border-color .14s,transform .14s;display:flex}.oc-projpage__card:hover{background:color-mix(in oklab, var(--proj-hue) 8%, var(--card));border-color:color-mix(in oklab, var(--proj-hue) 35%, var(--border));transform:translateY(-1px)}@media (prefers-reduced-motion:reduce){.oc-projpage__card{transition:none}.oc-projpage__card:hover{transform:none}}.oc-projpage__cardhead{align-items:center;gap:7px;min-width:0;display:flex}.oc-projpage__cardico{color:var(--proj-hue);flex:none}.oc-projpage__cardname{text-overflow:ellipsis;white-space:nowrap;font-weight:500;overflow:hidden}.oc-projpage__cardmeta{color:var(--muted-foreground);font-size:.75rem}.oc-projpage__cardage{color:var(--muted-foreground);opacity:.8;font-size:.72rem}.oc-projpage__convhead{justify-content:space-between;align-items:center;gap:12px;display:flex}.oc-projpage__filter{max-width:240px;height:30px}.oc-projpage__chats{flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.oc-projpage__chatrow{border-radius:8px;align-items:center;gap:4px;display:flex}.oc-projpage__chatrow:hover{background:color-mix(in oklab, var(--proj-hue) 8%, transparent)}.oc-projpage__chatbtn{text-align:left;cursor:pointer;min-width:0;color:var(--foreground);font:inherit;background:0 0;border:none;flex:1;align-items:center;gap:8px;padding:8px 10px;display:flex;position:relative}.oc-projpage__chattitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oc-projpage__chatpin{color:var(--muted-foreground);flex:none}.oc-projpage__chatage{color:var(--muted-foreground);flex:none;font-size:.72rem}.oc-projpage__chatmenu{opacity:0;flex:none}.oc-projpage__chatrow:hover .oc-projpage__chatmenu,.oc-projpage__chatrow:focus-within .oc-projpage__chatmenu{opacity:1}.oc-projpage__viewtoggle{border:1px solid var(--border);border-radius:calc(var(--radius) - 2px);gap:2px;padding:2px;display:inline-flex}.oc-projpage__card.is-over,.oc-projpage__colentry.is-over,.oc-projpage__col.is-over{outline:2px solid color-mix(in oklab, var(--proj-hue,var(--highlight)) 60%, transparent);outline-offset:-2px;background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__card.is-dragging,.oc-projpage__chatrow.is-dragging,.oc-projpage__colentry.is-dragging{opacity:.35}.oc-projpage__cdrop.is-over .oc-projpage__crumblink{background:color-mix(in oklab, var(--proj-hue) 22%, transparent);color:var(--foreground)}.oc-projpage__dragghost{border:1px solid var(--border);background:var(--card);color:var(--foreground);border-radius:8px;align-items:center;gap:6px;padding:5px 10px;font-size:.82rem;display:inline-flex;box-shadow:0 4px 14px #0000002e}.oc-projpage__barbtn{opacity:.45;color:var(--muted-foreground);flex:none}.oc-projpage__barbtn.is-on{opacity:1;color:color-mix(in srgb, var(--proj-hue,var(--highlight)) 70%, var(--foreground))}.oc-projpage__chatrow:hover .oc-projpage__barbtn,.oc-projpage__chatrow:focus-within .oc-projpage__barbtn,.oc-projpage__colentry--chat:hover .oc-projpage__barbtn,.oc-projpage__colentry--chat:focus-within .oc-projpage__barbtn{opacity:1}.oc-projpage__cols{border:1px solid var(--border);border-radius:var(--radius);scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--muted-foreground) 45%, transparent) transparent;background:linear-gradient(to right, var(--background) 30%, transparent) left center, linear-gradient(to left, var(--background) 30%, transparent) right center, linear-gradient(to right, color-mix(in srgb, var(--foreground) 16%, transparent), transparent) left center, linear-gradient(to left, color-mix(in srgb, var(--foreground) 16%, transparent), transparent) right center;background-repeat:no-repeat;background-size:40px 100%,40px 100%,16px 100%,16px 100%;background-attachment:local,local,scroll,scroll;align-items:stretch;gap:0;min-height:320px;display:flex;overflow-x:auto}.oc-projpage__cols::-webkit-scrollbar{height:8px}.oc-projpage__cols::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--muted-foreground) 45%, transparent);border-radius:4px}.oc-projpage__cols::-webkit-scrollbar-track{background:0 0}.oc-projpage__col{border-right:1px solid var(--border);flex-direction:column;flex:0 0 220px;gap:1px;min-width:200px;padding:6px;display:flex;overflow-y:auto}.oc-projpage__col.is-last{border-right:none;flex:1 0 240px}.oc-projpage__colempty{color:var(--muted-foreground);margin:0;padding:8px;font-size:.78rem}.oc-projpage__colentry{cursor:pointer;color:var(--foreground);font:inherit;text-align:left;background:0 0;border:none;border-radius:7px;align-items:center;gap:7px;min-width:0;padding:6px 8px;font-size:.84rem;display:flex;position:relative}.oc-projpage__colentry--folder:hover,.oc-projpage__colentry--folder:focus-visible{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__colentry--folder.is-selected{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 18%, transparent)}.oc-projpage__colentry--chat{padding:0;position:relative}.oc-projpage__colentry--chat .oc-projpage__barbtn{position:absolute;top:50%;right:3px;transform:translateY(-50%)}.oc-projpage__colchatbtn{cursor:pointer;min-width:0;color:var(--foreground);font:inherit;text-align:left;background:0 0;border:none;border-radius:7px;flex:1 1 0;align-items:center;gap:7px;padding:6px 8px;font-size:.84rem;display:flex;position:relative;overflow:hidden}.oc-projpage__colchatbtn:hover,.oc-projpage__colchatbtn:focus-visible{background:color-mix(in oklab, var(--highlight) 8%, transparent)}.oc-projpage__colico{color:var(--proj-hue,var(--muted-foreground));flex:none}.oc-projpage__colname{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oc-projpage__colchev{color:var(--muted-foreground);opacity:.7;flex:none}.oc-projpage__cardmenu{opacity:0;flex:none;margin-left:auto}.oc-projpage__card:hover .oc-projpage__cardmenu,.oc-projpage__card:focus-within .oc-projpage__cardmenu,.oc-projpage__cardmenu[aria-expanded=true]{opacity:1}.oc-projpage__colmenu{opacity:0;position:absolute;top:50%;right:2px;transform:translateY(-50%)}.oc-projpage__colmenu--chat{right:26px}.oc-projpage__colentry:hover .oc-projpage__colmenu,.oc-projpage__colentry:focus-within .oc-projpage__colmenu,.oc-projpage__colmenu[aria-expanded=true]{opacity:1}.oc-projpage__colentry--folder:hover .oc-projpage__colchev,.oc-projpage__colentry--folder:focus-within .oc-projpage__colchev{opacity:0}.oc-projpage__colentry--chat .oc-projpage__colchatbtn{padding-right:52px}.oc-projpage__treemenu{opacity:0;flex:none}.oc-projpage__treerow:hover .oc-projpage__treemenu,.oc-projpage__treerow:focus-within .oc-projpage__treemenu,.oc-projpage__treemenu[aria-expanded=true]{opacity:1}.oc-projpage__tree{border:1px solid var(--border);border-radius:var(--radius);flex-direction:column;align-items:stretch;gap:1px;min-height:320px;padding:6px;display:flex}.oc-projpage__treegroup{flex-direction:column;gap:1px;display:flex}.oc-projpage__treerow{padding:5px 8px;padding-left:calc(8px + var(--tree-depth,0) * 18px);cursor:pointer;border-radius:7px;align-items:center;gap:7px;min-width:0;font-size:.84rem;display:flex;position:relative}.oc-projpage__treerow--folder:hover,.oc-projpage__treerow--folder:focus-visible{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__treerow--chat{padding-top:0;padding-bottom:0}.oc-projpage__treerow--chat .oc-projpage__colchatbtn{padding-left:0}.oc-projpage__treechev{cursor:pointer;color:color-mix(in srgb, var(--proj-hue,var(--muted-foreground)) 80%, var(--muted-foreground));background:0 0;border:none;border-radius:5px;flex:none;justify-content:center;align-items:center;margin:0;padding:1px;display:inline-flex}.oc-projpage__treechev:hover,.oc-projpage__treechev:focus-visible{background:color-mix(in srgb, var(--proj-hue,var(--muted-foreground)) 18%, transparent)}.oc-projpage__chatrow.is-locate,.oc-projpage__colentry.is-locate,.oc-projpage__treerow.is-locate{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent);animation:1.6s ease-out 2 oc-locate-flash}@keyframes oc-locate-flash{0%{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 38%, transparent)}to{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}}@media (prefers-reduced-motion:reduce){.oc-projpage__chatrow.is-locate,.oc-projpage__colentry.is-locate,.oc-projpage__treerow.is-locate{animation:none}}.oc-projpage__hitico{color:var(--muted-foreground);flex:none;align-self:flex-start;margin-top:2px}.oc-projpage__hitbody{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.oc-projpage__hitpath{color:var(--muted-foreground);opacity:.85;text-overflow:ellipsis;white-space:nowrap;font-size:.7rem;overflow:hidden}.oc-projpage__hitsnippet{color:var(--muted-foreground);text-overflow:ellipsis;white-space:nowrap;font-size:.78rem;overflow:hidden}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Av as i,Bv as a,Cv as o,Dv as s,Ev as c,Gi as l,Ji as u,Ki as d,LI as f,Mo as p,Mv as m,No as h,Nv as g,Ov as _,Po as ee,RI as v,Sv as te,T as y,Tv as b,Vv as x,Xi as S,Yi as C,_r as w,_v as T,bv as E,gr as D,gv as ne,hr as re,hv as ie,jo as O,jv as k,kv as A,mv as j,qi as M,vv as N,wv as P,xv as F,yv as I}from"./dist-_9JGogtQ.js";import{d as L,f as R,i as z,l as B,n as V,r as H,t as U,u as ae}from"./FieldLabel-C647EVei.js";import{t as W}from"./button-Bz9USCnz.js";import{At as G,Dt as K,Lt as q,Ot as J,P as oe,jt as Y,kt as X,qt as se}from"./index-DIc5ekpE.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:_,help:s},documentary_fetch:{label:c,help:b},inbound_files:{label:P,help:o},history_summary:{label:ee,help:h},file_curation:{label:S,help:C}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
+
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
+
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:ne,references:ie,files:j,previous_summary:p,new_messages:O,max_chars:r,file_name:u,budget_chars:M,feedback:d,content:l};function pe(){let e=v(y.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(V,{label:g(),help:m()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:te()}),(0,$.jsxs)(K,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(J,{children:e.map(e=>(0,$.jsx)(X,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=f(y.admin.upsertInstanceConfig),n=se(),r=v(y.me.getMe,{host:q}),i=e.config??{},o=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>z(i,o));(0,Q.useEffect)(()=>{c(z(i,o))},[o,e._id]);let[l,u]=(0,Q.useState)(!1),d=s.promptInjections,p=(e,t)=>c({...s,promptInjections:{...d,[e]:{...d[e],...t}}});async function m(){u(!0);try{await t({instanceId:e._id,config:H(s,i,o)})}catch(e){n.error(a(),e)}finally{u(!1)}}async function h(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(a(),e)}}let g=e.config?.contentLocale??`default`,_=ce[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:w()}),(0,$.jsxs)(K,{value:g,onValueChange:e=>void h(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(J,{children:[(0,$.jsx)(X,{value:`default`,children:re({locale:_})}),le().map(e=>(0,$.jsx)(X,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]}),ae.map(e=>(0,$.jsx)(he,{injKey:e,def:B[e],i18n:ue[e],row:d[e]??{enabled:!0,template:B[e].defaultTemplate[o]},contentLocale:o,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void m(),disabled:l,children:x()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=L(e,r,a),p=f?R(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(oe,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(V,{label:n.label(),help:n.help()})]}):(0,$.jsx)(V,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:i()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:A()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(U,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?I():E()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:k()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:N()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:T()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bx as r,CS as i,DS as a,ES as o,Gx as s,Hx as c,Jx as l,Kx as u,LI as d,OS as f,RI as p,SS as m,T as h,TS as g,Ux as _,Vx as v,Wx as ee,_S as y,aS as b,bS as x,ba as S,cS as te,dS as ne,eS as re,fS as ie,gS as ae,hS as C,iS as w,kS as T,lS as E,mS as D,nS as O,oS as k,pS as A,qx as j,rS as M,sS as N,tS as P,uS as F,vS as I,wS as L,xS as R,yS as z}from"./dist-_9JGogtQ.js";import{t as B}from"./button-Bz9USCnz.js";import{P as V,Z as H,_ as U,_t as W,gt as G,qt as K,yn as q}from"./index-DIc5ekpE.js";import{t as J}from"./roleDescriptions-5AP7N2O_.js";var Y=t(e(),1),X=n(),Z=[{group:()=>T(),keys:[{key:`traces.read`,label:()=>L()},{key:`traces.read.content`,label:()=>i(),phi:!0},{key:`traces.write`,label:()=>m()}]},{group:()=>f(),keys:[{key:`kpi.read`,label:()=>L()},{key:`kpi.write`,label:()=>m()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>R()},{key:`anomalies.read`,label:()=>x()},{key:`anomalies.report`,label:()=>z()}]},{group:()=>o(),keys:[{key:`chats.read`,label:()=>L()},{key:`selfheal`,label:()=>y()},{key:`feedback.respond`,label:()=>S()}]},{group:()=>g(),keys:[{key:`admin.manage`,label:()=>I()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=p(h.apiKeys.listRoles,{}),t=d(h.apiKeys.createRole),n=d(h.apiKeys.ensureRolesSeeded),i=d(h.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(h.apiKeys.listRoles,{});r&&e.setQuery(h.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=H(),o=K(),[f,m]=(0,Y.useState)(!1),[g,y]=(0,Y.useState)($),[x,S]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(C(),e)})},[n,o]);let T=e??[];async function I(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:D({name:e.name}),description:A(),confirmLabel:ie()});return}if(x.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];S(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(ne(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function L(){try{await t({key:g.key,name:g.name,description:g.description||void 0,permissions:[]}),y($),m(!1)}catch(e){o.error(F(),e)}}let R=e===void 0,z=!R&&T.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,te(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,N()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:k()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{y($),m(!0)},children:b()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:O()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?ae({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:T.map(e=>{let t=Q(e.permissions),n=x.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,P()]}):(0,X.jsx)(G,{variant:`secondary`,children:re()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?l():n?j():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(U,{open:f,onOpenChange:m,title:u(),description:s(),canSubmit:!!(g.key&&g.name),onSubmit:L,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:_()}),(0,X.jsx)(W,{value:g.key,placeholder:c(),onChange:e=>y({...g,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:v()}),(0,X.jsx)(W,{value:g.name,onChange:e=>y({...g,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,X.jsx)(W,{value:g.description,onChange:e=>y({...g,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|