@lacneu/atrium 0.68.12 → 0.69.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-BSVA9k6K.js → AccessTab-BrxEpjsr.js} +1 -1
- package/dist/assets/{AdvancedFilter-CCC-hSAD.js → AdvancedFilter-B3seyYt-.js} +1 -1
- package/dist/assets/AgentFilesTab-Cs8Nzz_I.js +3 -0
- package/dist/assets/AnomaliesTab-D6D6CYSk.js +1 -0
- package/dist/assets/AuditTab-DhuJS60M.js +1 -0
- package/dist/assets/BridgeTab-DnIaX4fN.js +1 -0
- package/dist/assets/ChatDefaultsTab-BnteHH3v.js +1 -0
- package/dist/assets/{DataTableShell-C4JNv9nB.js → DataTableShell-CgSphYFu.js} +1 -1
- package/dist/assets/{DetailChips-ZTmtiMGp.js → DetailChips-D3CrYO3c.js} +1 -1
- package/dist/assets/FeedbacksTab-CSsK5q9T.js +1 -0
- package/dist/assets/{FieldLabel-CEeFouyE.js → FieldLabel-Dt5eJKiD.js} +1 -1
- package/dist/assets/FilesTab-DRf2WHHd.js +1 -0
- package/dist/assets/{FilterBar-DKJ0vcLq.js → FilterBar-I6E15DsP.js} +1 -1
- package/dist/assets/GroupsTab-DdMjDK06.js +1 -0
- package/dist/assets/InstancesTab-s9iO39kt.js +1 -0
- package/dist/assets/IntegrationsTab-0BQN2eLD.js +1 -0
- package/dist/assets/{KpiTab-_LHhdq4q.js → KpiTab-Cqfp8moM.js} +1 -1
- package/dist/assets/PreferencesTab-iuWpDWjc.js +1 -0
- package/dist/assets/ProjectPage-CLKrB8ZU.js +1 -0
- package/dist/assets/PromptInjectionsTab-CV-LnDsD.js +4 -0
- package/dist/assets/RolesTab-BlEtFwR8.js +1 -0
- package/dist/assets/ScheduledTab-C_ijI98X.js +1 -0
- package/dist/assets/ServiceAccountsTab-0RaoKfJe.js +1 -0
- package/dist/assets/SubAgentReportsTab-wWGDafZX.js +1 -0
- package/dist/assets/ThemeShowroom-BMPThlV5.js +1 -0
- package/dist/assets/{TimeRangePicker-Dg2XDCtQ.js → TimeRangePicker-CVMLr89E.js} +1 -1
- package/dist/assets/{TimezoneCombobox-EjRXLgwd.js → TimezoneCombobox-ko6S60ZX.js} +1 -1
- package/dist/assets/TracesTab-BFLB5V7D.js +1 -0
- package/dist/assets/UsersTab-CBVfw_2T.js +1 -0
- package/dist/assets/VoiceTab-D55jFmxr.js +1 -0
- package/dist/assets/api-CbVyaw6f.js +44 -0
- package/dist/assets/{button-B_41ue1q.js → button-B_rxV4Hv.js} +1 -1
- package/dist/assets/{card-jjobvHi-.js → card-1R1vH3Wp.js} +1 -1
- package/dist/assets/check-DI-pspfc.js +1 -0
- package/dist/assets/chevron-up-D9LbKOmX.js +1 -0
- package/dist/assets/chevrons-up-down-huJFCk51.js +1 -0
- package/dist/assets/{compatView-D_RQaV5Q.js → compatView-Dg7wsTPK.js} +1 -1
- package/dist/assets/dispatchErrorInfo-sCqe0cBT.js +1 -0
- package/dist/assets/{dist-CMGgchWl.js → dist-60cgSkkV.js} +1 -1
- package/dist/assets/{dist-DhTrc5f7.js → dist-Bzknt9lC.js} +1 -1
- package/dist/assets/{dist-D_PfFX2y.js → dist-mHgdDBUV.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-leoLGCWI.js → highlighted-body-OFNGDK62-CsJyfjdy.js} +1 -1
- package/dist/assets/index-Dr-TdniH.css +1 -0
- package/dist/assets/index-EISUCtE9.js +238 -0
- package/dist/assets/{list-CKn6A_6h.js → list-CJldmRo5.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-C9ORYnsN.js +1 -0
- package/dist/assets/{pdf-Cm84j6oW.js → pdf-D-Us2R6E.js} +1 -1
- package/dist/assets/roleDescriptions-B4jROh9m.js +1 -0
- package/dist/assets/{table-CcvWpXCm.js → table-C2BiIaq6.js} +1 -1
- package/dist/assets/{tabs-CMi9VYg6.js → tabs-CJVl3r7X.js} +1 -1
- package/dist/assets/x-DniS1cpm.js +1 -0
- package/dist/index.html +10 -10
- package/package.json +5 -4
- package/dist/assets/AgentFilesTab-C3kG8y4n.js +0 -3
- package/dist/assets/AnomaliesTab-Bf2VgLD6.js +0 -1
- package/dist/assets/AuditTab-D--2qtm6.js +0 -1
- package/dist/assets/BridgeTab-C9uI_Jkn.js +0 -1
- package/dist/assets/ChatDefaultsTab-BR4evcvF.js +0 -1
- package/dist/assets/FeedbacksTab-bn3r3ZkW.js +0 -1
- package/dist/assets/FilesTab-BkcRo9Tb.js +0 -1
- package/dist/assets/GroupsTab-DOZlj0pg.js +0 -1
- package/dist/assets/InstancesTab-M2jqVZka.js +0 -1
- package/dist/assets/IntegrationsTab-BfvVJJEY.js +0 -1
- package/dist/assets/PreferencesTab-DtFLdomR.js +0 -1
- package/dist/assets/ProjectPage-i387XExs.js +0 -1
- package/dist/assets/PromptInjectionsTab-T3JmPufg.js +0 -4
- package/dist/assets/RolesTab-D67TfduS.js +0 -1
- package/dist/assets/ScheduledTab-23blJw9f.js +0 -1
- package/dist/assets/ServiceAccountsTab-7h2WTk0b.js +0 -1
- package/dist/assets/SubAgentReportsTab-CQiiP_Y0.js +0 -1
- package/dist/assets/ThemeShowroom-CLR_y50D.js +0 -1
- package/dist/assets/TracesTab-SJeno4nA.js +0 -1
- package/dist/assets/UsersTab-CfeANHzM.js +0 -1
- package/dist/assets/VoiceTab-bjL-Kaf5.js +0 -1
- package/dist/assets/api-cIxpvlxL.js +0 -44
- package/dist/assets/check-kD0OtbaK.js +0 -1
- package/dist/assets/chevron-up-BITJ61RO.js +0 -1
- package/dist/assets/chevrons-up-down--uZabsui.js +0 -1
- package/dist/assets/dispatchErrorInfo-BQ_k0x02.js +0 -1
- package/dist/assets/index-B6dXsL9w.css +0 -1
- package/dist/assets/index-Bvfgr5EK.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-DWYC55v0.js +0 -1
- package/dist/assets/roleDescriptions-B3FKKHwq.js +0 -1
- package/dist/assets/x-CoxK7tW1.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Jf as i,Kf as a,Qf as o,SR as s,Xf as c,Yf as l,Zf as u,ap as d,ep as f,ip as p,jR as m,np as h,op as g,qf as _,rp as v,t as y,tp as b}from"./api-CbVyaw6f.js";import{_t as x,bt as S,ut as C,vt as w,xt as T,yt as E}from"./index-EISUCtE9.js";var D=t(e(),1);function O(e){return e===`user`?c():e===`all`?l():i({group:e.group})}function k(e){return e===`common`?_():e===`owner`?a():i({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=m(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,A.jsxs)(x,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":d(),children:(0,A.jsx)(T,{placeholder:d()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(E,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:u()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,_h as a,bh as o,vh as s,xh as c,yh as l}from"./api-CbVyaw6f.js";import{r as u}from"./dist-mHgdDBUV.js";import{t as d}from"./x-DniS1cpm.js";import{t as f}from"./button-B_rxV4Hv.js";import{_t as p,bt as m,jt as h,ln as g,vt as _,xt as v,yt as y}from"./index-EISUCtE9.js";import{r as b}from"./TimeRangePicker-CVMLr89E.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{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 r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.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}),i(),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:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(p,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:o()})}),(0,S.jsx)(_,{children:e.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(p,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(_,{children:C.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(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)(g,{}),a()]})]}):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{AR as r,Aa as i,Au as a,Ca as o,Cu as s,Da as c,Du as l,Ea as u,Eu as d,FA as f,Fu as p,Gi as m,Iu as h,Ji as g,Ki as _,Lu as v,Mu as y,Nu as b,O as x,OR as S,Oa as C,Ou as ee,Pu as te,Ru as w,SR as T,Sa as E,Sd as ne,Su as D,Ta as O,Tu as k,Ui as A,Wi as j,Yi as M,_a as N,_u as re,ba as P,bu as ie,da as ae,du as oe,fa as F,fu as I,ga as se,gu as L,ha as R,hu as z,jR as B,ja as V,ju as ce,ka as le,ku as ue,lu as de,ma as H,mu as U,pa as fe,pu as pe,qi as me,t as W,uu as he,va as ge,vu as _e,wR as G,wa as ve,wd as K,wu as ye,xa as be,xu as xe,ya as Se,yu as Ce}from"./api-CbVyaw6f.js";import{t as q}from"./button-B_rxV4Hv.js";import{$ as we,Dt as J,V as Te,_t as Ee,at as De,bt as Oe,dt as ke,et as Ae,ft as je,gt as Me,ht as Ne,it as Pe,nt as Fe,ot as Ie,pt as Le,rn as Y,rt as Re,tt as ze,ut as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-EISUCtE9.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-Dg7wsTPK.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*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 Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(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<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=B(W.me.getMe,{host:He}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=B(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[t,r,i]);let s=B(W.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),f=B(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return i===null||s===void 0?r!==void 0&&r.length===0?[]:void 0:s.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,s,r,f]),[g,_]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!g||!m.some(e=>$(e)===g))&&_($(m[0]))},[m,g]);let E=m?.find(e=>$(e)===g)??null,D=S(W.agentFiles.listAgentFiles),[O,k]=(0,X.useState)({status:`idle`}),A=E?.instanceName??null,j=E?.agentId??null,M=B(W.compat.forInstance,n&&A!==null?{instanceName:A}:`skip`),N=n&&A!==null?Te(M,`agentFiles`):null,re=N===null?!1:N===`loading`?null:N.blocked,P=(0,X.useCallback)(async()=>{if(!(A===null||j===null)){k({status:`loading`});try{k({status:`done`,files:(await D({instanceName:A,agentId:j})).files})}catch(e){k({status:`error`,dashboardAbsent:tt(e)})}}},[D,A,j]);(0,X.useEffect)(()=>{re===!1&&P()},[P,re]);let[ie,ae]=(0,X.useState)(null),oe=B(W.agentFileCuration.listCurations,t&&A!==null&&j!==null?{instanceName:A,agentId:j}:`skip`),F=B(W.agentFileCuration.curationSettings,t&&A!==null?{instanceName:A}:`skip`),I=S(W.agentFileCuration.requestCuration),[se,L]=(0,X.useState)(null),[R,z]=(0,X.useState)(null),{toast:V}=J(),le=(0,X.useMemo)(()=>{let e=new Map;for(let t of oe??[])e.has(t.name)||e.set(t.name,t);return e},[oe]),de=(0,X.useCallback)(async e=>{if(!(A===null||j===null)){L(e);try{let t=await I({instanceName:A,agentId:j,name:e,trigger:`manual`});t.ok?V({title:C(),variant:`success`}):V({title:c({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:u(),variant:`error`})}finally{L(null)}}},[I,A,j,V]),H=G(),U=(0,X.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ee,{value:i??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Oe,{size:`sm`,"aria-label":v(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:(r??[]).map(e=>(0,Q.jsx)(We,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(Ee,{value:g??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(Oe,{size:`sm`,"aria-label":h(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:m.map(e=>(0,Q.jsx)(We,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}),E===null?null:N===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):N!==null&&N.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(N.gatewayVersion,N.provider)]}):O.status===`loading`||O.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):O.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O.dashboardAbsent?x():b(),` `,!O.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void P(),children:ne()})]}):O.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:O.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Be,{variant:`outline`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ce({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:a({pct:U.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":ue()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>ae(e),children:t?l():d()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:F?.budgetChars??null,enabled:F?.enabled??!1,curation:le.get(e.name)??null,inFlight:se===e.name,onCurate:()=>void de(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ee({used:Z(Qe(O.files),H),total:Z(Ye,H),pct:U.format(Ze(Qe(O.files)))})})]}),ie&&E?(0,Q.jsx)(at,{instanceName:E.instanceName,agentId:E.agentId,name:ie.name,isAdmin:t,onClose:()=>ae(null),onSaved:()=>void P()}):null,R?(0,Q.jsx)(ot,{curationId:R,onClose:()=>z(null),onApplied:()=>{z(null),P()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:i()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Be,{variant:`outline`,className:`oc-afiles__curate-status`,children:le()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:V()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=S(W.agentFiles.getAgentFile),c=S(W.agentFiles.setAgentFile),l=J(),[u,d]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),[x,C]=(0,X.useState)(!1),[ee,te]=(0,X.useState)(!1),w=(0,X.useCallback)(async r=>{m(!1);try{let i=await o({instanceName:e,agentId:t,name:n});d({content:i.content,updatedAtMs:i.updatedAtMs}),r||g(i.content),C(!1)}catch{m(!0)}},[o,e,t,n]);(0,X.useEffect)(()=>{w(!1)},[w]);async function E(){if(u!==null){b(!0),te(!1);try{await c({instanceName:e,agentId:t,name:n,content:h,baseUpdatedAtMs:u.updatedAtMs??void 0}),l.success(Ce({name:n})),a(),await w(!1)}catch(e){nt(e)?C(!0):te(!0)}finally{b(!1)}}}let O=u!==null&&h!==u.content,A=(0,X.useMemo)(()=>u===null?null:et(u.content,h),[u,h]),j=h.length>Je,M=G(),N=(0,X.useMemo)(()=>new Intl.NumberFormat(M),[M]);return(0,Q.jsx)(ke,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(je,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Me,{children:k({name:n})}),(0,Q.jsxs)(Le,{children:[ye({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,s()]})]})]}),p?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[re(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void w(!1),children:ne()})]}):u===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:h,readOnly:!r,spellCheck:!1,onChange:e=>g(e.target.value),"aria-label":k({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:D()}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[L(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void w(!0),children:z()})]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:_e()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${j?` is-over`:``}`,children:xe({count:N.format(h.length),max:N.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!O||y||x,onClick:()=>v(!0),children:y?K():ie()}):null]})]}),(0,Q.jsx)(we,{open:_,onOpenChange:v,children:(0,Q.jsxs)(Fe,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Ie,{children:U({name:n})}),(0,Q.jsx)(Re,{children:pe({agent:t})})]}),A?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:I({added:A.added,removed:A.removed})}),A.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:oe()}),A.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,A.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:he()}),A.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(ze,{children:f()}),(0,Q.jsx)(Ae,{onClick:()=>void E(),children:de()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=B(W.agentFileCuration.getProposal,{curationId:e}),a=S(W.agentFileCuration.approveCuration),s=r(W.agentFileCuration.rejectCuration),{toast:c}=J(),[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),[h,v]=(0,X.useState)(``),y=G(),b=(0,X.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function x(){d(`approve`);try{let t=await a({curationId:e});t.ok?(c({title:O(),variant:`success`}),n()):c({title:t.reason===`conflict`?o():E({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:u(),variant:`error`})}finally{d(null)}}async function C(n){d(`reject`);try{let r=h.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?j():ve(),variant:`success`}):c({title:Se(),variant:`error`}),t()}catch{c({title:u(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(ke,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(je,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Me,{children:i?be({name:i.name}):T()}),(0,Q.jsx)(Le,{children:P()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[ge({before:Z(i.beforeSize,y),after:Z(i.proposedSize,y)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,N()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:se({added:b.added,removed:b.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:A({feedback:i.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ae()}),(0,Q.jsx)(`ul`,{children:b.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:F()}),(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:R()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),f?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:M()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:g(),value:h,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>p(!1),disabled:l!==null,children:me()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void C(!1),disabled:l!==null,children:l===`reject`?K():_()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void C(!0),disabled:l!==null,children:l===`reject`?K():m()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>p(!0),disabled:l!==null||i==null,children:H()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void x(),disabled:l!==null||i==null,children:l===`approve`?K():fe()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AR as i,AS as ee,BS as a,CS as te,DS as ne,ES as re,FS as ie,GS as ae,HS as oe,IS as o,JS as se,KS as ce,LS as s,MS as c,NS as l,OS as u,PS as d,QS as le,RS as ue,SS as f,TS as de,US as fe,VS as p,WS as pe,XS as me,YS as he,ZS as ge,_S as m,aC as _e,bS as h,cC as g,eC as ve,gS as _,hS as v,iC as ye,jR as y,jS as be,kS as xe,lC as b,nC as x,oC as S,qS as C,rC as w,sC as T,t as E,tC as D,uC as O,vS as k,wS as A,xS as j,yS as M,zS as Se}from"./api-CbVyaw6f.js";import{Dt as Ce,Fn as we,Pn as N,Z as Te,_t as P,bt as F,ct as I,dt as L,ft as R,gt as z,ht as B,i as Ee,o as De,ut as V,vt as H,wt as Oe,xt as U,yt as W}from"./index-EISUCtE9.js";import{n as ke}from"./TimeRangePicker-CVMLr89E.js";import{t as Ae}from"./FilterBar-I6E15DsP.js";import{t as je}from"./DataTableShell-CgSphYFu.js";import{t as G}from"./dispatchErrorInfo-sCqe0cBT.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?O():e===`acknowledged`?b():g()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=we({from:`/settings/anomalies`}),t=N({from:`/settings/anomalies`}),n=e.q??``,f=e.status===Y?J:e.status,m=e.severity??J,h=e.kind??J,[g,_]=(0,K.useState)(J),v=Ee(e.from,e.to),{from:b,to:O}=ke(v),k=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),j=e=>void t({search:t=>({...t,status:e===J?Y:e})}),M=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),L=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,...De(e)})}),z=Te(),B=Ce(),G=i(E.anomalies.resolveAnomaly),X=(y(E.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=y(E.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:b,to:O,anomalyStatus:f===J?void 0:f,severity:m===J?void 0:m,source:g===J?void 0:g,kind:h===J?void 0:h}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),He=n!==``||f!==`open`||m!==J||g!==J||h!==J||v.kind!==`relative`||v.from!==Ie.from;function Ue(){_(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await z({title:T(),description:(0,q.jsxs)(q.Fragment,{children:[S(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,_e(),` `,(0,q.jsx)(`strong`,{children:ye()}),`.`,` `,w()]}),confirmLabel:x()}))try{await G({anomalyId:e._id,status:`resolved`}),B.success(D(),e.kind)}catch(e){B.error(ve(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),B.success(r(),e.kind)}catch(e){B.error(le(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ge(),` `,(0,q.jsx)(`strong`,{children:me()}),` `,he(),` `,(0,q.jsx)(`strong`,{children:se()}),` `,C(),` `,(0,q.jsx)(`strong`,{children:ce()}),` `,ae(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:pe()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:k,searchPlaceholder:fe(),timeRange:v,onTimeRangeChange:R,onReset:Ue,canReset:He,children:[(0,q.jsxs)(P,{value:f,onValueChange:j,children:[(0,q.jsx)(F,{size:`sm`,className:`w-36`,children:(0,q.jsx)(U,{})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(W,{value:J,children:oe()}),Me.map(e=>(0,q.jsx)(W,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(P,{value:m,onValueChange:M,children:[(0,q.jsx)(F,{size:`sm`,className:`w-36`,children:(0,q.jsx)(U,{placeholder:p()})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(W,{value:J,children:s()}),Pe.map(e=>(0,q.jsx)(W,{value:e,children:e},e))]})]}),(0,q.jsxs)(P,{value:g,onValueChange:_,children:[(0,q.jsx)(F,{size:`sm`,className:`w-32`,children:(0,q.jsx)(U,{placeholder:o()})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(W,{value:J,children:ie()}),Fe.map(e=>(0,q.jsx)(W,{value:e,children:e},e))]})]}),(0,q.jsxs)(P,{value:h,onValueChange:L,children:[(0,q.jsx)(F,{size:`sm`,className:`w-36`,children:(0,q.jsx)(U,{placeholder:d()})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(W,{value:J,children:l()}),Q.map(e=>(0,q.jsx)(W,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:c(),rows:Z,emptyHint:f===`open`?be():ee(),rowActions:e=>X&&e.status===`open`?[{label:xe(),onSelect:()=>void We(e)},{label:u(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ne(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:I(e.at)}),sort:e=>e.at},{header:d(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:a(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:ue({when:I(e.firstAt)}),children:Se({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:p(),cell:e=>(0,q.jsx)(ze,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:re(),cell:e=>(0,q.jsx)(Be,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:o(),cell:e=>(0,q.jsx)(V,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:de(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(Re,{row:e})]}),sort:e=>e.message},{header:A(),cell:e=>(0,q.jsx)($,{row:e}),sort:e=>e.evidence??null},{header:te(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:Ve(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Z(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function $({row:e}){let t=N();if(e.kind===`subagent.failure`){let n=Q(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,f()]}):null]})}let n=Z(e);if(!n.dominantCode)return(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,f()]}):null]})}function Re({row:e}){let[t,n]=(0,K.useState)(!1),r=y(E.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[j(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(L,{open:t,onOpenChange:n,children:(0,q.jsxs)(R,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(B,{children:(0,q.jsx)(z,{children:h()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:M()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:k()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function ze({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Be({status:e}){return e===`open`?(0,q.jsx)(V,{variant:`destructive`,children:m()}):e===`acknowledged`?(0,q.jsx)(V,{variant:`secondary`,children:_()}):(0,q.jsx)(V,{variant:`outline`,children:v()})}function Ve(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Br as r,Gr as i,Hr as a,Ur as o,Vr as s,Wr as c,aw as l,cw as u,dw as d,fw as f,hw as p,iw as m,jR as h,lw as g,mw as _,nw as v,ow as y,pw as b,rw as x,sw as S,t as C,tw as w,uw as T}from"./api-CbVyaw6f.js";import{Fn as E,Pn as D,_t as O,a as k,bt as A,ct as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-EISUCtE9.js";import{n as ee}from"./TimeRangePicker-CVMLr89E.js";import{t as z}from"./FilterBar-I6E15DsP.js";import{t as B}from"./AdvancedFilter-B3seyYt-.js";import{t as V}from"./DataTableShell-CgSphYFu.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:i()},{value:`realLabel`,label:c()},{value:`targetLabel`,label:o()},{value:`impersonated`,label:a()},{value:`resource`,label:s()},{value:`resourceId`,label:r()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,i=e.impersonated??G,a=e.resource??G,o=M(e.from,e.to),s=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:c,to:N}=ee(o),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:k(e)}),replace:!0}),$=h(C.admin.listAudit,{filter:{q:n||void 0,from:c,to:N,action:r===G?void 0:r,resource:a===G?void 0:a,impersonated:i===G?void 0:i===`yes`,advanced:s.length>0?s:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||i!==G||a!==G||s.length>0||o.kind!==`relative`||o.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:[p(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:b(),timeRange:o,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(O,{value:r,onValueChange:J,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:f()})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:d()}),te.map(e=>(0,U.jsx)(R,{value:e,children:e},e))]})]}),(0,U.jsxs)(O,{value:i,onValueChange:Y,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:T()}),(0,U.jsx)(R,{value:`yes`,children:g()}),(0,U.jsx)(R,{value:`no`,children:u()})]})]}),(0,U.jsxs)(O,{value:a,onValueChange:X,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:S()})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:y()}),ne.map(e=>(0,U.jsx)(R,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:s,onChange:Q}),(0,U.jsx)(V,{title:l(),rows:$,emptyHint:m(),columns:[{header:x(),cell:e=>j(e.at),sort:e=>e.at},{header:f(),cell:e=>e.action,sort:e=>e.action},{header:v(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:w(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:S(),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{$v as r,AR as i,Ay as a,Bl as o,Bv as s,Cy as c,D as l,Dy as u,Ey as d,Gl as f,Gv as p,Hl as m,Hv as h,Il as g,Iv as _,Jl as v,Jv as y,Kl as b,Kv as ee,Lv as x,My as te,Ny as ne,OR as re,Oy as ie,Py as ae,Ql as oe,Qv as se,Rv as ce,Sy as le,Ty as ue,Ul as de,Uv as fe,Vl as pe,Vv as me,Wl as he,Wv as ge,Xl as _e,Xv as S,Yl as ve,Yv as ye,Zl as be,Zv as xe,_y as Se,ay as Ce,by as we,cb as Te,cr as Ee,cy as De,db as Oe,dr as ke,dy as C,ey as Ae,fb as je,fr as Me,fy as Ne,gb as Pe,gy as Fe,hb as Ie,hr as Le,hy as Re,iy as ze,jR as w,jy as Be,k as Ve,ky as He,lb as Ue,lr as We,ly as Ge,my as Ke,nb as qe,ny as Je,ob as Ye,oy as Xe,pb as Ze,py as Qe,ql as $e,qv as et,rb as tt,ry as nt,sb as rt,sy as it,t as T,ty as at,ub as ot,ur as st,uy as ct,vy as lt,wy as ut,xy as dt,yy as ft,zv as pt}from"./api-CbVyaw6f.js";import{r as E}from"./dist-mHgdDBUV.js";import{t as mt}from"./chevron-up-D9LbKOmX.js";import{t as ht}from"./chevrons-up-down-huJFCk51.js";import{i as gt,n as D,o as _t,r as vt,s as yt}from"./FieldLabel-Dt5eJKiD.js";import{i as bt,n as xt,r as St,t as Ct}from"./tabs-CJVl3r7X.js";import{t as wt}from"./button-B_rxV4Hv.js";import{An as Tt,Bt as Et,Dt,Fn as Ot,I as kt,P as At,Pn as jt,Rt as Mt,_t as O,bn as Nt,bt as k,ct as Pt,dt as Ft,ft as It,gt as Lt,ht as Rt,jn as zt,jt as A,lt as j,on as Bt,pt as Vt,rn as M,ut as N,vt as P,wt as Ht,xt as F,yt as I,zt as Ut}from"./index-EISUCtE9.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as Gt,i as L,n as Kt,o as R,r as z,t as B}from"./table-C2BiIaq6.js";import{t as qt}from"./FilterBar-I6E15DsP.js";import{a as V,n as Jt,o as H,r as U,s as Yt,t as Xt}from"./compatView-Dg7wsTPK.js";import{t as W}from"./dispatchErrorInfo-sCqe0cBT.js";var Zt=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Qt=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function $t(e){return e.filter(e=>e.state===`error`)}function en(e){return e.reachable&&$t(e.targets).length===0}function tn(e){return en(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function nn(e){return e.state===`error`&&e.lastErrorCode!==null}function rn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function an(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function on(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return an(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Y={q:``,state:J,instance:J,version:J},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(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 ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(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 H(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(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 pn(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 mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>H(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(Y),[i,a]=(0,G.useState)(null),o=(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]),c=(0,G.useMemo)(()=>fn(o),[o]),l=(0,G.useMemo)(()=>pn(o),[o]),u=(0,G.useMemo)(()=>mn(o),[o]),d=(0,G.useMemo)(()=>dn(cn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(qt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:xe(),onReset:()=>r(Y),canReset:sn(n),children:[(0,Q.jsxs)(O,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:ye()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(I,{value:J,children:S()}),c.map(e=>(0,Q.jsx)(I,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(O,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(F,{placeholder:y()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(I,{value:J,children:S()}),l.map(e=>(0,Q.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(O,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:et()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(I,{value:J,children:S()}),u.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,Q.jsxs)(B,{className:`oc-conn__table`,children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)($,{label:p(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ge(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:fe(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:h(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:me(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(L,{children:s()}),(0,Q.jsx)($,{label:pt(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Kt,{children:d.map(e=>(0,Q.jsx)(gn,{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)(L,{"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)(mt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=nn(e)?W(e.lastErrorCode):null,n=rn(e)?W(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(R,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(z,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(z,{children:(0,Q.jsx)(vn,{state:e.state})}),(0,Q.jsx)(z,{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)(z,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(z,{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)(z,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:r({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(z,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:j(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(R,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(z,{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?` · ${j(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:[se({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${j(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?ce():e===`error`?x():_()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(N,{variant:`secondary`,children:ce()}):e===`error`?(0,Q.jsx)(N,{variant:`destructive`,children:x()}):(0,Q.jsx)(N,{variant:`outline`,children:_()})}function yn(){return w(T.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=w(T.compat.getBridgeCompat,{}),n=w(T.me.getMe,{host:Ht})?.role===`admin`,r=w(T.admin.listInstances,n?{}:`skip`),i=w(T.agents.usageForInstances,n?{}:`skip`),a=jt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=on(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ot({from:`/settings/bridge`}),l=jt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Jt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:we()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ft()}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)(L,{children:Me()}),(0,Q.jsx)(L,{children:ke()}),(0,Q.jsx)(L,{children:st()}),(0,Q.jsx)(L,{children:We()}),(0,Q.jsx)(L,{children:Ee()})]})}),(0,Q.jsx)(Kt,{children:i.flatMap(e=>{let t=kt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(R,{children:[(0,Q.jsx)(z,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(z,{children:t.provider}),(0,Q.jsx)(z,{children:t.label}),(0,Q.jsx)(z,{children:(0,Q.jsxs)(N,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(z,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Ct,{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)(St,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Bt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(xt,{value:e.key,children:(0,Q.jsx)(Sn,{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:g()}):null]})}function xn({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:V(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:_e(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ve({build:t.buildVersion??`?`})]}):null,` · `,v(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?$e():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ct()});let o=$t(e.targets),s=!e.reachable,c=tn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=Pt(e.checkedAt),f=e.startedAt==null?null:Pt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(Tt,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Qt,{size:22}):(0,Q.jsx)(M,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Ge():c===`gateways_unreachable`?Ce({count:l.length}):s?De():it({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Zt,{size:12,"aria-hidden":!0}),` `,Xe({time:d})]}),f?(0,Q.jsx)(`span`,{children:nt({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ze({names:l.join(`, `)})}):null,s?(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:Je()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Yt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Xt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,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)(Bt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),f?(0,Q.jsx)(N,{variant:f===`beyond`?`destructive`:`secondary`,children:U(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:oe()}),(0,Q.jsx)(wn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Cn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(zt,{size:13,"aria-hidden":!0}),at({count:t.length})]}),p?(0,Q.jsx)(hn,{connections:t,displayByInstance:c}):null]})}function Cn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[lt(),i.length>0?(0,Q.jsx)(N,{variant:`destructive`,children:Fe({count:i.length})}):a>0?(0,Q.jsx)(N,{variant:`destructive`,children:Re()}):(0,Q.jsx)(N,{variant:`secondary`,children:Se()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ke({version:e.vendoredVersion}),r?` · `+Qe({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):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)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(zt,{size:13,"aria-hidden":!0}),Ne({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 wn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):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:b()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Le({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:he({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:$e()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:V(e.version)}),(0,Q.jsx)(N,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:U(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Rt,{children:[(0,Q.jsx)(Lt,{children:Pe({instance:e.displayName??e.name})}),(0,Q.jsx)(Vt,{children:Ie()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({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)(Tt,{"aria-hidden":!0}):(0,Q.jsx)(M,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?ut():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,c()]}):null}function Dn({instance:e,onClose:t}){let n=i(T.admin.upsertInstanceConfig),r=re(T.bridge.validateMediaPaths),o=Dt(),s=Wt(e.config?.contentLocale,void 0),[c,l]=(0,G.useState)(()=>gt(e.config??{},s)),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(null),v=c.inboundMediaMode===`shared-fs`,y=c.mediaMode===`shared-fs`,b=v||y;async function ee(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){o.error(ie(),e)}finally{h(!1)}}async function x(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(c,r,s)}),t()}catch(e){o.error(Te(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ze(),help:rt()}),(0,Q.jsxs)(O,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(P,{children:yt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:je(),help:Ye()}),(0,Q.jsxs)(O,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(P,{children:_t.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Oe(),help:tt()}),(0,Q.jsx)(A,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ae(),help:ne()}),(0,Q.jsx)(A,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:te(),help:Be()}),(0,Q.jsx)(A,{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)(At,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(D,{label:ot(),help:qe()})]}),b&&g!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(M,{"aria-hidden":!0}),dt({reason:g.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:d(),result:g.inbound}),(0,Q.jsx)(En,{label:ue(),result:g.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(M,{"aria-hidden":!0}),le()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Q.jsxs)(wt,{variant:`outline`,size:`sm`,onClick:()=>void ee(),disabled:m,children:[m?(0,Q.jsx)(Nt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?He():a()]}),(0,Q.jsx)(wt,{size:`sm`,onClick:()=>void x(),disabled:f,children:Ue()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Mt,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?de():m({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:pe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(N,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,AR as i,Ao as a,Co as o,Do as s,Eo as c,Lu as l,OR as u,Oo as d,SR as f,Sd as p,So as m,To as h,_d as g,au as _,eu as v,iu as y,jR as b,jo as x,ko as S,mb as C,mr as w,nu as T,ou as E,ru as D,su as O,t as k,tu as A,vd as j,wd as M,wo as N}from"./api-CbVyaw6f.js";import{t as P}from"./button-B_rxV4Hv.js";import{M as F,N as I,P as L,V as R,_t as z,bt as B,jt as V,rn as H,vt as U,xt as W,yt as G}from"./index-EISUCtE9.js";import{i as K}from"./compatView-Dg7wsTPK.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=i(k.admin.upsertInstanceConfig),n=b(k.agents.listAgentsForInstance,{instanceName:e.name}),a=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[o,l]=(0,q.useState)(a),[u,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{l(a),f(`idle`)},[e._id,a]);let p=`__none__`,m=o!==a;async function h(){f(`saving`);try{let n={...e.config??{}};o===``||o===p?delete n.converterAgentId:n.converterAgentId=o,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}let g=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(z,{value:o===``?p:o,onValueChange:e=>l(e===p?``:e),children:[(0,X.jsx)(B,{className:`oc-cdefaults__select`,"aria-label":d(),children:(0,X.jsx)(W,{placeholder:c()})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(G,{value:p,children:c()}),g.map(e=>(0,X.jsx)(G,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!m||u===`saving`,onClick:()=>void h(),children:u===`saving`?M():A()})]}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}):null]})}function Q({instance:e}){let t=i(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,a=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[s,c]=(0,q.useState)(n),[l,u]=(0,q.useState)(a===null?``:String(a)),[d,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(n),u(a===null?``:String(a)),f(`idle`)},[e._id,n,a]);let p=l.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,g=!s||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,_=s!==n||(m??null)!==a;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=s,!s||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(L,{checked:s,onCheckedChange:e=>c(e===!0),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:l,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":h(),disabled:!s}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||d===`saving`,onClick:()=>void y(),children:d===`saving`?M():A()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()})]})}function $({instance:e}){let t=i(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[o,s]=(0,q.useState)(n===null?``:String(n)),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n===null?``:String(n)),l(`idle`)},[e._id,n]);let u=o.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,p=(d??null)!==n;async function h(){l(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||c===`saving`,onClick:()=>void h(),children:c===`saving`?M():A()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]})}function ee(){let e=u(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=b(k.admin.listInstances,{}),[i,a]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let o=(r?.length??0)>1,s=r!==void 0&&r.length===0,c=b(k.compat.forInstance,i?{instanceName:i}:`skip`),d=i?R(c,`configDefaults`):`loading`,m=d===`loading`?null:d.blocked,h=(0,q.useMemo)(()=>o&&i?{instanceName:i}:{},[o,i]),v=(0,q.useRef)(0),x=(0,q.useCallback)(async()=>{let t=++v.current;n({status:`loading`});try{let r=Y(await e(h));if(v.current!==t)return;n({status:`done`,current:r})}catch{if(v.current!==t)return;n({status:`error`})}},[e,h]);(0,q.useEffect)(()=>{m===!1&&(o&&!i||x())},[x,m,o,i]);let S=t.status===`done`?t.current:null,A=(0,q.useMemo)(()=>J.map(e=>({id:e,label:I(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:j()},{id:`standard`,label:g()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}),o&&i?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,X.jsxs)(z,{value:i,onValueChange:e=>a(e),children:[(0,X.jsx)(B,{size:`sm`,"aria-label":l(),children:(0,X.jsx)(W,{})}),(0,X.jsx)(U,{children:(r??[]).map(e=>(0,X.jsx)(G,{value:e.name,children:e.name},e.name))})]})]}):null,s?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):d===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):d.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(H,{size:14,"aria-hidden":!0}),` `,K(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[T(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:p()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,X.jsx)(F,{options:A,value:S?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,X.jsx)(F,{options:M,value:S===null||S.fastModeDefault===null?null:S.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:D()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Fm as i,Mm as a,Nm as o,Pm as s,jm as c,km as l}from"./api-CbVyaw6f.js";import{r as u}from"./dist-mHgdDBUV.js";import{t as d}from"./chevron-up-D9LbKOmX.js";import{t as f}from"./chevrons-up-down-huJFCk51.js";import{t as p}from"./button-B_rxV4Hv.js";import{En as m,It as h,Lt as g,Mt as _,Nt as v,P as y,Pt as b,in as x,ln as S}from"./index-EISUCtE9.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-C2BiIaq6.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=i(),bulkActions:F,emptyHint:I=s(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(S,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(y,{"aria-label":a(),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":l({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)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(y,{"aria-label":c(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(b,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ut as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ut as t}from"./index-EISUCtE9.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{$E as r,AD as i,AR as a,BE as o,CD as s,DD as c,ED as l,FD as u,FE as d,Fa as f,GE as p,HE as m,IE as h,JE as ee,KE as g,LE as te,La as _,MD as ne,ND as re,NE as ie,OD as ae,PD as v,PE as y,QE as b,RE as x,SD as S,TD as C,UE as w,VE as T,WE as E,XE as D,YE as O,ZE as k,_D as A,aD as j,bD as M,cD as N,dD as P,eD as F,fD as I,gD as L,hD as R,iD as z,jD as B,jR as V,kD as oe,lD as H,mD as U,nD as W,oD as G,pD as K,qE as q,rD as se,sD as ce,t as J,tD as le,uD as ue,vD as de,wD as fe,xD as pe,yD as me,zE as he}from"./api-CbVyaw6f.js";import{t as ge}from"./button-B_rxV4Hv.js";import{Z as _e,ct as Y}from"./index-EISUCtE9.js";import{t as ve}from"./DataTableShell-CgSphYFu.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>u(),incorrect:()=>v(),incoherence:()=>re(),formatting:()=>ne(),latency:()=>B(),api_error:()=>i(),other:()=>oe()},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:c()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:l()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ae()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=a(J.feedback.respondToFeedback),[c,l]=(0,X.useState)(e.thread),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1);async function m(){let t=u.trim();if(!(!t||f)){p(!0);try{await o({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!1)}}}let h=[];try{h=i.contextJson?JSON.parse(i.contextJson):[]}catch{h=[]}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?` · ${C()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:r(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(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:he()}),(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:s()}),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`?S():e.authorRole===`agent`?e.authorLabel??_():pe()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:M()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:me(),value:u,maxLength:2e3,rows:3,onChange:e=>d(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 m(),disabled:!u.trim()||f,children:f?de():A()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||R()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||R()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,h.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I({count:i.contextCount??h.length,truncated:i.contextTruncated?P():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:h.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:ue()}),(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:H()}),(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:N()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?ce({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:[G(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,j()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=V(J.feedback.listForAdmin,{}),t=a(J.feedback.readSnapshot),n=a(J.feedback.deleteFeedback),r=_e(),[i,s]=(0,X.useState)(null),[c,l]=(0,X.useState)({});async function u(e){if(i===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await r({title:d(),description:y(),confirmLabel:ie(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,Z.jsx)(`strong`,{children:se()}),` `,W()]}),(0,Z.jsx)(ve,{title:le(),rows:e,emptyHint:F(),isExpanded:e=>i===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(be,{data:c[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:b(),cell:e=>Y(e.at),sort:e=>e.at},{header:k(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:D(),cell:e=>e.messageRole===`user`?O():ee(),sort:e=>e.messageRole},{header:q(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${g({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:p(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:E(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:w(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:m()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:o()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?x():te(),onSelect:()=>void u(e)},{label:h(),onSelect:()=>void _(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,RR as n}from"./api-CbVyaw6f.js";import{B as r,L as i,R as a,z as o}from"./index-EISUCtE9.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AL as r,AR as i,BL as a,Ba as ee,CL as o,DL as s,EL as c,FA as te,FL as ne,HL as re,IL as ie,LL as l,ML as u,NL as d,OL as f,PL as ae,RL as oe,SL as se,SR as ce,TL as le,UL as ue,VL as de,Va as p,_L as fe,bL as pe,cL as me,dL as he,fL as ge,gL as m,hL as _e,jL as h,jR as ve,kL as g,lL as ye,mL as be,pL as xe,t as _,uL as v,vL as y,wL as b,wR as x,xL as S,yL as C,zL as w}from"./api-CbVyaw6f.js";import{t as T}from"./button-B_rxV4Hv.js";import{$ as E,Dn as D,Dt as O,En as k,Lt as A,Mt as j,Nt as M,P as Se,Pt as N,_t as P,at as Ce,bt as F,cn as we,et as Te,in as Ee,it as De,nt as Oe,ot as ke,rt as Ae,tt as je,ut as I,vt as L,xt as R,yt as z}from"./index-EISUCtE9.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-C2BiIaq6.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return u();case`audio`:return h();case`video`:return r();case`pdf`:return g();case`document`:return f();case`archive`:return s();default:return c()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[s,c]=(0,U.useState)(G),[u,f]=(0,U.useState)(G),[h,g]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=i(_.files.softDelete),Y=O();function Ie(){t(G),r(G),c(G),f(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(_e())}catch(e){Y.error(be(),e)}}let X=ve(_.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:s===G?void 0:s,category:u===G?void 0:u,includeAutoGenerated:h||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(x(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||s!==G||u!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(P,{value:e,onValueChange:t,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":re(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:de()}),(0,W.jsx)(z,{value:`inbound`,children:a()}),(0,W.jsx)(z,{value:`outbound`,children:w()})]})]}),(0,W.jsxs)(P,{value:n,onValueChange:r,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":oe(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:l()}),Q.chats.map(e=>(0,W.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(P,{value:s,onValueChange:c,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":ie(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:ne()}),Q.instances.map(e=>(0,W.jsx)(z,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(P,{value:u,onValueChange:f,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":ae(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:d()}),Q.categories.map(e=>(0,W.jsx)(z,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Se,{checked:h,onCheckedChange:e=>g(e===!0),"aria-label":p()}),(0,W.jsx)(`span`,{children:p()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(we,{size:14,"aria-hidden":!0}),y()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ye():v()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:b()}),(0,W.jsx)(B,{children:o()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{children:S()}),(0,W.jsx)(B,{className:`text-right`,children:pe()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:ee()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?a():w()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(j,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":fe(),children:(0,W.jsx)(k,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(N,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(D,{size:14}),C()]})}):(0,W.jsxs)(N,{disabled:!0,children:[(0,W.jsx)(D,{size:14}),he()]}),(0,W.jsxs)(N,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),m()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:me({cap:Be})}):null]}),(0,W.jsx)(E,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Oe,{children:[(0,W.jsxs)(Ce,{children:[(0,W.jsx)(ke,{children:xe()}),(0,W.jsx)(Ae,{children:ge()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(je,{children:te()}),(0,W.jsx)(Te,{onClick:()=>void Le(),children:m()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Im as r,Lm as i}from"./api-CbVyaw6f.js";import{t as a}from"./button-B_rxV4Hv.js";import{cn as o,jt as s,sn as c}from"./index-EISUCtE9.js";import{t as l}from"./TimeRangePicker-CVMLr89E.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,AR as i,Af as a,Bd as o,Bf as s,Cf as c,D as l,Df as u,Ef as d,Ff as f,Gd as p,Gf as m,Hd as h,Hf as g,Id as _,If as v,Jd as y,Kd as b,Ld as x,Lf as ee,Mf as S,Nf as C,Of as te,Pf as w,Qd as T,Rd as E,Rf as ne,Sf as D,Tf as re,Ud as O,Uf as k,Vd as A,Vf as j,Wd as M,Wf as ie,Xd as N,Yd as P,Zd as F,_f as ae,af as oe,bf as se,cf as I,df as ce,ef as le,ff as ue,gf as L,hf as de,if as fe,jR as R,jf as pe,kf as me,lf as he,mf as ge,nf as _e,of as ve,pf as ye,qd as be,rf as xe,sf as z,t as B,tf as Se,uf as Ce,vf as we,wf as Te,xf as Ee,yf as De,zd as Oe,zf as ke}from"./api-CbVyaw6f.js";import{t as Ae}from"./x-DniS1cpm.js";import{i as V,n as H,r as je,t as Me}from"./tabs-CJVl3r7X.js";import{t as U}from"./button-B_rxV4Hv.js";import{Dt as W,Mn as Ne,P as G,Z as Pe,_ as Fe,_t as Ie,an as K,bt as Le,dt as Re,ft as ze,gt as Be,ht as Ve,jn as He,jt as q,on as J,pt as Ue,ut as Y,vt as We,wt as Ge,xt as Ke,yt as qe}from"./index-EISUCtE9.js";import{t as Je}from"./FilterBar-I6E15DsP.js";import{t as Ye}from"./DataTableShell-CgSphYFu.js";import{t as X}from"./DetailChips-D3CrYO3c.js";var Xe=l(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=l(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=l(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(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 $e(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 et(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 tt(e){switch(e){case`admin`:return ue();case`user`:return ce();case`pending`:return Ce();default:return e}}function nt(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 rt(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 $=n(),it={name:``,description:``};function at(){let e=R(B.groups.listGroups,{}),t=R(B.me.getMe,{host:Ge})?.role===`admin`,n=i(B.groups.createGroup),r=i(B.groups.updateGroup),o=i(B.groups.deleteGroup),c=Pe(),l=W(),[p,h]=(0,Q.useState)(!1),[_,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(it),[T,D]=(0,Q.useState)(null),[O,A]=(0,Q.useState)(``),M=(0,Q.useMemo)(()=>{if(!e)return e;let t=O.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,O]);function N(){y(null),x(it),h(!0)}function P(e){y(e),x({name:e.name,description:e.description??``}),h(!0)}async function F(){try{_?await r({groupId:_._id,name:b.name,description:b.description}):await n({name:b.name,description:b.description||void 0}),x(it),y(null),h(!1)}catch(e){l.error(Oe(),e)}}async function ae(e){if(await c({title:d({name:e.name}),description:re(),confirmWord:e.name,confirmLabel:Te(),cancelLabel:S(),destructive:!0}))try{await o({groupId:e._id})}catch(e){l.error(E(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,$.jsx)(Je,{q:O,onQChange:A,onReset:()=>A(``),canReset:O!==``,searchPlaceholder:ee()}),(0,$.jsx)(Ye,{title:m(),rows:M,addLabel:k(),onAdd:t?N:void 0,emptyHint:g(),columns:[{header:j(),cell:e=>e.name,sort:e=>e.name},{header:s(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ke(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ne(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:v(),onSelect:()=>D({groupId:e._id,name:e.name})},...t?[{label:f(),onSelect:()=>P(e)},{label:w(),variant:`destructive`,onSelect:()=>void ae(e)}]:[]]}),(0,$.jsx)(Fe,{open:p,onOpenChange:h,title:_?a():pe(),description:me(),canSubmit:!!b.name.trim(),onSubmit:F,submitLabel:C(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,$.jsx)(q,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,$.jsx)(q,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||D(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Ne,{size:14,"aria-hidden":!0}),de()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ye({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ge(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=R(B.groups.getGroup,n&&e?{groupId:e}:`skip`),o=R(B.groups.listAssignableInstances,n?{}:`skip`),s=R(B.groups.listAssignableUsers,n?{}:`skip`),l=i(B.groups.addMember),u=i(B.groups.removeMember),d=i(B.groups.bulkSetMembers),f=i(B.groups.setGroupManager),p=W(),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`members`),[ee,S]=(0,Q.useState)(1),[C,te]=(0,Q.useState)(new Set),w=(0,Q.useRef)(null),E=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),ne=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),re=a?.viewerIsAdmin===!0,k=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{g(``),v(``),b(`members`),S(1),w.current=null},[n,e]),(0,Q.useEffect)(()=>{S(1)},[m]),(0,Q.useEffect)(()=>{n&&a&&e&&w.current!==e&&(w.current=e,te(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Q.useMemo)(()=>s?Qe(s,m,C):[],[s,m,C]);async function ie(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(x(),e)}}async function N(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(A(),e)}}let P=nt(j,e=>E.has(e.userId)),F=j.filter(e=>E.has(e.userId)).length,I=rt(j,ee,ot);async function ce(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){p.error(x(),e)}}return(0,$.jsx)(Re,{open:n,onOpenChange:r,children:(0,$.jsxs)(ze,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Be,{children:c({name:t})}),(0,$.jsx)(Ue,{children:D()})]}),(0,$.jsxs)(Me,{value:y,onValueChange:b,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),Ee(),a?(0,$.jsx)(Y,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),De(),a?(0,$.jsx)(Y,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),T(),a?(0,$.jsx)(Y,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:m,onChange:e=>g(e.target.value),placeholder:se(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(G,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":L()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:L()}),(0,$.jsxs)(Y,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=E.has(e.userId),n=et(e),r=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(G,{checked:t,onCheckedChange:()=>void ie(e.userId,t),"aria-label":he({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(Y,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?h():O(),title:r?h():O(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":M(),title:M(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:S})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:_,onChange:e=>v(e.target.value),placeholder:we(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:_},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:a,query:o}){let s=R(B.groups.listAssignableAgents,{instanceName:t}),c=i(B.groups.assignAgentToGroup),l=i(B.groups.removeAgentFromGroup),u=i(B.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[o]),!e)return null;let m=$e(s?.agents??[],o),h=s?.discovery&&!s.discovery.lastPollOk;if(o.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=nt(g,e=>a.has(`${t}/${e.agentId}`)),y=rt(m,f,ot);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(_(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(_(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(Y,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(Y,{variant:`outline`,className:`oc-access__stale`,children:Se()}):null]}),s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?_e():xe()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(G,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":L()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:L()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=a.has(n),o=e.presentInLastOk===!1,s=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,$.jsx)(G,{checked:i,disabled:(o||s)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":I({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":r(),title:r(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,o?(0,$.jsx)(Y,{variant:`outline`,className:`oc-access__gone`,children:le()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=R(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=i(B.charts.assignChartToGroup),r=i(B.charts.removeChartFromGroup),a=i(B.charts.setGroupDefaultChart),s=i(B.charts.addChartToGroupPool),c=i(B.charts.removeChartFromGroupPool),l=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}async function g(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}async function _(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(G,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":be({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":b(),title:b(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:p()}):null,f?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":y({name:e.name}),title:y({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,$.jsxs)(Ie,{value:``,onValueChange:e=>void g(e),children:[(0,$.jsx)(Le,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ke,{placeholder:P()})}),(0,$.jsx)(We,{children:d.map(e=>(0,$.jsx)(qe,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:N()}):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{$T as r,$w as i,AR as a,AT as o,Aw as s,BT as c,Bw as l,CT as u,Cw as d,DT as f,Dw as p,ET as m,Ew as h,FT as g,Fw as _,GT as v,Gw as y,HT as b,Hw as x,IT as S,Iw as C,JT as ee,Jo as w,Jw as T,KT as te,Ko as ne,Kw as re,LT as ie,Lw as ae,MT as oe,Mw as se,NT as ce,Nj as E,Nw as le,OR as D,OT as ue,Ow as de,PT as fe,Pj as O,Pw as pe,QT as me,Qw as he,RT as ge,Rw as _e,ST as k,Sw as ve,TT as ye,Tw as be,UT as xe,Uw as A,VT as Se,Vw as Ce,WT as we,Ww as Te,XT as Ee,Xw as De,YT as Oe,Yo as ke,Yw as Ae,ZT as je,Zw as Me,_T as Ne,_r as Pe,_w as Fe,aE as Ie,aT as Le,ab as Re,bT as ze,bw as Be,cT as Ve,dT as He,eE as Ue,eT as We,fT as Ge,gT as Ke,gw as qe,hT as Je,iE as Ye,iT as Xe,ib as Ze,jR as j,jT as Qe,jw as $e,kT as et,kw as tt,lT as nt,mT as rt,nE as it,nT as at,oT as ot,pT as st,qT as ct,qo as lt,qw as ut,rE as dt,rT as ft,sT as pt,t as M,tE as mt,tT as ht,uT as gt,vT as _t,vr as vt,vw as yt,wT as bt,ww as xt,xT as N,xw as St,yT as Ct,yr as wt,yw as Tt,zT as Et}from"./api-CbVyaw6f.js";import{a as Dt,c as Ot}from"./FieldLabel-Dt5eJKiD.js";import{t as P}from"./button-B_rxV4Hv.js";import{Bt as kt,Dt as F,P as I,Rt as At,Z as jt,_ as Mt,_t as L,bt as R,dt as z,ft as B,gt as V,ht as H,jt as U,pt as W,ut as G,vt as K,xt as q,yt as J,zt as Nt}from"./index-EISUCtE9.js";import{t as Pt}from"./DataTableShell-CgSphYFu.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-DnIaX4fN.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:Dt},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=j(M.admin.listInstances,{}),t=j(M.agents.listAllInstanceAgents,{}),n=a(M.admin.upsertInstance),i=a(M.admin.deleteInstance),s=F(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function T(){try{await n({instanceId:C??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,streamTransport:d.streamTransport}),f(Q),w(null),u(!1)}catch(e){s.error(dt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[it(),(0,Z.jsx)(`strong`,{children:mt()}),Ue()]}),(0,Z.jsx)(Pt,{title:r(),rows:e,addLabel:me(),onAdd:()=>{w(null),f(Q),u(!0)},emptyHint:je(),columns:[{header:Ee(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ee(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ct(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ie(),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)?Fe():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:xe(),onSelect:()=>{w(e._id),f(Bt(e)),u(!0)}},{label:Ye(),onSelect:()=>m(e.name)},{label:ue(),onSelect:()=>x(e)},{label:te(),onSelect:()=>_(e)},{label:v(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:v(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Mt,{open:l,onOpenChange:u,title:C?b():we(),description:c(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:T,submitLabel:Et(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ge(),children:[(0,Z.jsx)(U,{value:d.name,disabled:C!==null,onChange:e=>f({...d,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Se()}):null]}),(0,Z.jsx)($,{label:ie(),children:(0,Z.jsxs)(L,{value:d.kind,onValueChange:e=>f({...d,kind:e}),children:[(0,Z.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,Z.jsx)($,{label:wt(),children:(0,Z.jsxs)(L,{value:d.transport,onValueChange:e=>f({...d,transport:e}),children:[(0,Z.jsx)(R,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`ws`,children:vt()}),(0,Z.jsx)(J,{value:`rest`,children:Pe()})]})]})}):null,(0,Z.jsx)($,{label:S(),children:(0,Z.jsx)(U,{value:d.gatewayUrl,onChange:e=>f({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:g(),children:(0,Z.jsx)(U,{value:d.bridgeUrl,placeholder:fe(),onChange:e=>f({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ce(),children:(0,Z.jsx)(U,{value:d.displayName,onChange:e=>f({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Re(),children:[(0,Z.jsxs)(L,{value:d.streamTransport,onValueChange:e=>f({...d,streamTransport:e}),children:[(0,Z.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(K,{children:Ot.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ze()})]}),(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(U,{value:d.gatewayVersion,placeholder:Qe(),onChange:e=>f({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:o(),children:(0,Z.jsx)(U,{value:d.gatewayHttpUrl,placeholder:et(),onChange:e=>f({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>_(null)},h._id):null,y?(0,Z.jsx)(Ht,{instance:y,onClose:()=>x(null)},y._id):null]})}function Ht({instance:e,onClose:t}){let n=j(M.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)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(B,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:f({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:m()})]}),(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=D(M.instanceSync.forceInstanceSync),n=F(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ot());break;case`no_agents`:n.success(Xe());break;case`no_bridge_url`:n.error(ft());break;case`deploy_misconfigured`:n.error(at());break;case`unauthorized`:n.error(We());break;case`not_served`:n.error(i());break;default:n.error(ht());break}}catch(e){n.error(Le(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?pt():Ve()})})]})}function Wt({instance:e}){let t=j(M.bridgeAuth.listBridgeAuthStatus,{}),n=D(M.bridgeAuth.mintBridgeSecret),r=a(M.bridgeAuth.revokeBridgeSecret),i=F(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(y(),e)}finally{s(!1)}}}async function h(){if(!o){s(!0);try{await r({instanceId:e._id}),l(null),i.success(re())}catch(e){i.error(y(),e)}finally{s(!1)}}}async function g(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:p?`outline`:`secondary`,children:p?`${k()} · ${f.prefix}…${f.lastFour}`:N()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void m(),disabled:o,children:p?T():Ae()}),p?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:o,children:ut()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Te()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?O():E()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:A()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=D(M.instanceSecrets.setInstanceSecret),i=a(M.instanceSecrets.clearInstanceSecret),o=D(M.deviceIdentity.generateDeviceIdentity),s=F(),[c,l]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?ye():t===`deviceIdentity`?bt():u();async function b(){if(!(!c.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),m(null),g(!1),s.success(Ke())}catch(e){s.error(Je(),e)}finally{f(!1)}}}async function x(){if(!d){f(!0);try{await i({instanceId:e,field:t}),m(null),g(!1),s.success(rt())}catch(e){s.error(Je(),e)}finally{f(!1)}}}async function S(){if(!d){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(He())}catch(e){s.error(nt(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function ee(){if(C)try{await navigator.clipboard.writeText(C),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:_?`outline`:`secondary`,children:_?k():N()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?Ct():ze(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void b(),disabled:d||c.trim().length===0,children:_t()}),v?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:d,children:st()}):null,_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:d,children:Ne()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:He()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:gt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void ee(),children:h?O():E()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:A()})]}):null]})}var Kt={conversational:se,documentary:s,summarizer:ke,curator:lt},qt={conversational:$e,documentary:tt,summarizer:w,curator:ne},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:C()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(At,{children:[(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:_()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:pe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:le()}),(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)(I,{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=j(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=a(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=a(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=a(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=a(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),u=a(M.agents.removeInstanceAgent),f=jt(),m=F();async function g(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(l(),e)}}async function _(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(l(),e)}}async function v(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){m.error(l(),e)}}async function y(t,n){if(e&&await f({title:h({name:n}),description:be(),confirmLabel:xt(),destructive:!0}))try{await u({instanceName:e,agentId:t}),m.success(d())}catch(e){m.error(l(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(B,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:x({name:e??``})}),(0,Z.jsx)(W,{children:Ce()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?St():r.discovery.lastPollOk?Be():Tt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:yt()}):(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)(I,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void g(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:qe()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void y(t.agentId,a),children:p()})]}):i?(0,Z.jsx)(G,{variant:`default`,children:Fe()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void _(t.agentId),children:de()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void v(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){m.error(l(),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:_e(),"aria-label":ae(),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{AR as r,BD as i,GD as a,HD as o,JD as s,KD as c,LD as l,OR as u,RD as d,UD as f,VD as p,WD as m,XD as h,YD as g,cc as _,dc as v,fc as y,gc as b,hc as x,jR as S,lc as C,mc as w,pc as T,qD as E,t as D,uc as O,zD as k}from"./api-CbVyaw6f.js";import{t as A}from"./button-B_rxV4Hv.js";import{P as j,jt as M,ut as N}from"./index-EISUCtE9.js";var P=t(e(),1),F=n();function I(){let e=S(D.integrations.status.status,{}),t=r(D.admin.setIntegrationConfig),[n,u]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&u(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:h()});let _=n,v=(e,t,n)=>u({..._,[e]:{..._[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,F.jsx)(`strong`,{children:s()}),` `,E()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:c()}):(0,F.jsx)(N,{variant:`outline`,children:a()}):(0,F.jsx)(N,{variant:`outline`,children:m()}),note:f(),children:[(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:_.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>v(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:_.langfuse.host??``})})}),(0,F.jsx)(z,{label:l(),checked:_.langfuse.enabled??!0,onChange:e=>{v(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:c()}):(0,F.jsx)(N,{variant:`outline`,children:a()}):(0,F.jsx)(N,{variant:`outline`,children:m()}),note:o(),children:[(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(M,{value:_.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>v(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:_.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:_.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>v(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:_.opik.workspace??``})})}),(0,F.jsx)(z,{label:l(),checked:_.opik.enabled??!0,onChange:e=>{v(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:c()}):(0,F.jsx)(N,{variant:`outline`,children:a()}):(0,F.jsx)(N,{variant:`outline`,children:b()}),note:x(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:_.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>v(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:_.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:l(),checked:_.otlp.enabled??!0,onChange:e=>{v(`otlp`,`enabled`,e),y(`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=u(D.integrations.otlpSecret.setOtlpHeaders),n=r(D.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),d=async()=>{l(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:T(),children:[(0,F.jsx)(M,{value:i,placeholder:e?y():v(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||i.trim().length===0,onClick:()=>void d(),children:O()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:C()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:_()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,MO as a,NO as o,SO as s,Sv as c,_v as l,bv as u,dv as d,fv as f,gv as p,hv as m,ik as h,jO as g,jR as _,lv as v,mv as y,pv as b,t as x,uv as S,vv as C,xv as w,yv as T}from"./api-CbVyaw6f.js";import{Fn as ee,Pn as te,i as ne,o as re,r as E,wt as D}from"./index-EISUCtE9.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-1R1vH3Wp.js";import{n as N,t as P}from"./TimeRangePicker-CVMLr89E.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=_(x.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=_(x.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:h()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:o()}),(0,I.jsx)(j,{children:g()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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),c=t=>6+t*468/(e.length-1),l=e=>74-e*68/r,u=e=>e.map((e,t)=>`${t===0?`M`:`L`}${c(t).toFixed(1)},${l(e).toFixed(1)}`).join(` `),d=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:[s(),` p50 `,R(d.cP50),` `,a()]}),(0,I.jsxs)(`span`,{children:[i(),` p50 `,R(d.aP50),` `,a()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":o(),children:[(0,I.jsx)(`path`,{d:u(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:u(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:c(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:w(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:u(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:T(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:C(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),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=ee({from:`/settings/kpi`}),t=te({from:`/settings/kpi`}),n=ne(e.from,e.to,E,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=K(i,a),c=_(x.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),l=(0,F.useMemo)(()=>{let e=new Map;for(let t of c??[]){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>s&&e.set(t,n.slice(n.length-s));return e},[c,s]),u=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return c===void 0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}):c.length===0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]}):(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(l.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:l.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:f({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:d()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:S({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":v({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,$M as i,AN as a,AR as o,CN as s,Ct as c,DN as l,EN as u,GL as d,It as f,JL as ee,JM as p,KL as m,KM as h,Lt as te,ON as ne,QL as re,QM as ie,SN as ae,SR as oe,St as se,TN as ce,XL as le,XM as ue,YL as de,YM as fe,ZL as pe,ZM as me,_N as he,_R as ge,_t as g,aN as _,aR as v,bN as y,bt as b,cN as x,cR as S,dN as C,dR as w,eN as T,eR as E,fN as D,fR as O,gN as k,gt as A,hN as j,iN as M,iR as N,jN as P,jR as F,jt as I,kN as L,lN as _e,lR as ve,mN as ye,mR as be,nN as xe,nR as Se,oN as Ce,oR as we,pN as Te,pR as Ee,qL as De,qM as Oe,r as R,rN as ke,rR as Ae,sN as je,sR as Me,t as z,tN as B,tR as Ne,uN as Pe,uR as Fe,vN as Ie,vt as Le,wN as Re,xN as ze,xt as Be,yN as Ve,yt as He,zT as Ue}from"./api-CbVyaw6f.js";import{t as V}from"./button-B_rxV4Hv.js";import{At as We,Dt as Ge,Ot as Ke,P as H,_t as qe,bt as Je,jt as U,kt as Ye,q as Xe,t as Ze,ut as W,vt as Qe,wt as G,xt as $e,yt as K}from"./index-EISUCtE9.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-ko6S60ZX.js";var q=t(e(),1),J=n();function nt({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:R(`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:R(`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:()=>P()},{id:`composer`,label:()=>a()},{id:`sidebar`,label:()=>L()},{id:`notifications`,label:()=>D()},{id:`other`,label:()=>ne()}],X={showSource:{category:`messages`,label:()=>l(),help:()=>u()},showReport:{category:`messages`,label:()=>ce(),help:()=>Re()},copyAssistant:{category:`messages`,label:()=>s()},copyUser:{category:`messages`,label:()=>ae()},showDelete:{category:`messages`,label:()=>ze()},showTools:{category:`messages`,label:()=>y(),help:()=>Ve()},voiceInput:{category:`composer`,label:()=>Ie(),help:()=>he()},showUsage:{category:`composer`,label:()=>k(),help:()=>j()},autoReadAloud:{category:`composer`,label:()=>te(),help:()=>f()},showChatAge:{category:`sidebar`,label:()=>ye(),help:()=>Te()},notifSound:{category:`notifications`,label:()=>C(),help:()=>Pe()},notifSystem:{category:`notifications`,label:()=>_e(),help:()=>x()},replySound:{category:`notifications`,label:()=>je(),help:()=>Ce()}};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 rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>ue()};function ut({prefKey:e,ui:t}){let n=o(z.admin.setUiPrefDefault),r=o(z.admin.setFeatureEnabled),a=ct(e),s=a?lt[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:T()}),(0,J.jsxs)(qe,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Je,{size:`sm`,className:`w-36`,children:(0,J.jsx)($e,{})}),(0,J.jsxs)(Qe,{children:[(0,J.jsx)(K,{value:`on`,children:p()}),(0,J.jsx)(K,{value:`off`,children:Oe()}),(0,J.jsx)(K,{value:`inherit`,children:h()})]})]}),a?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(H,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void r({key:a,enabled:e===!0}),"aria-label":i()}),i()]}):null]}),s?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:s}):null]})}function dt({current:e,enabled:t}){let n=o(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,s]=(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=Ye(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!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:[c(),e?(0,J.jsx)(W,{variant:`secondary`,children:We(e,Ke())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?b():r?Be():se()})]}),(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:A()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?g():e?Le():He()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=F(z.me.getMe,{host:G}),a=i?.ui,s=$(i?.role)&&n,c=o(z.me.setUiPref).withOptimisticUpdate(Xe),l=(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)(H,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":B()}),B()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ie()}),(0,J.jsx)(`p`,{children:me()}),(0,J.jsx)(`p`,{children:fe()})]}):null,(0,J.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:M()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],l=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)(W,{variant:`outline`,children:ke()}):l?(0,J.jsx)(W,{variant:`secondary`,children:I()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:xe()}):null,(0,J.jsx)(nt,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:oe()})}var pt={sm:()=>Se(),md:()=>Ne(),lg:()=>E(),xl:()=>r(),"2xl":()=>re(),"3xl":()=>pe()};function mt(){let e=F(z.me.getMe,{host:G}),t=o(z.me.setLocale),n=o(z.me.setTimezone),r=o(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=o(z.me.setMyName),a=Ge(),s=e?.locale??`default`,c=e?.name??``,[l,u]=(0,q.useState)(null),f=l??c,p=f.trim()!==c.trim();async function h(){try{await i({name:f}),u(null),a.success(Fe())}catch(e){a.error(ve(),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:be()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(U,{className:`max-w-xs`,value:f,maxLength:120,placeholder:O(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void h(),children:Ue()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(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:S()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ge()})]}),(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:le()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(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:v()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Ze.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(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:m()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,AR as i,A_ as a,B_ as o,Bg as s,C_ as c,D as l,D_ as u,G_ as d,Hg as f,I_ as p,Ig as ee,Jg as m,K_ as h,Kg as g,L_ as _,N_ as v,O_ as te,Qg as ne,Qm as re,Rg as y,SR as b,S_ as x,T_ as S,Ug as C,Vg as w,W_ as ie,Wg as T,__ as E,a_ as ae,c_ as D,d_ as O,e_ as oe,f_ as k,g_ as A,h_ as se,i_ as ce,jR as j,j_ as le,k_ as ue,l_ as de,m_ as fe,o_ as pe,p_ as me,qg as he,r_ as ge,s_ as _e,t as M,t_ as ve,u_ as ye,v_ as N,w_ as P,x_ as be,y_ as xe,z_ as F,zg as Se}from"./api-CbVyaw6f.js";import{r as Ce}from"./dist-mHgdDBUV.js";import{t as we}from"./list-CJldmRo5.js";import{t as I}from"./button-B_rxV4Hv.js";import{A as Te,C as Ee,Cn as De,D as L,Dt as Oe,E as ke,En as Ae,Et as je,F as Me,Fn as Ne,Ft as Pe,In as Fe,It as Ie,Lt as Le,Mt as Re,Nt as ze,O as R,Pn as z,Pt as B,Q as Be,S as Ve,Sn as V,T as He,Tt as Ue,Z as We,_ as Ge,_n as Ke,b as H,d as qe,dn as Je,f as Ye,fn as U,g as W,h as G,hn as Xe,in as Ze,j as K,jn as Qe,jt as $e,k as et,m as tt,p as nt,pn as rt,v as q,vn as it,w as at,wn as J,x as Y,y as ot}from"./index-EISUCtE9.js";var st=l(`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=l(`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=l(`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=l(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function Q({className:e}){return(0,Z.jsx)(Le,{asChild:!0,children:(0,Z.jsx)(I,{variant:`ghost`,size:`icon-xs`,"aria-label":T(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ae,{})})})}function dt({folderId:e,name:t,color:n,currentParentId:r,className:o,onOpen:c}){let l=i(M.projects.renameProject),f=i(M.projects.setProjectColor),ee=i(M.projects.moveProject),m=i(M.projects.deleteProject),_=i(M.projects.createProject),v=We(),re=Be(),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(t),[w,T]=(0,X.useState)(!1),[E,ae]=(0,X.useState)(!1),D=j(M.projects.projectTreeCount,E?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Re,{onOpenChange:e=>e&&ae(!0),children:[(0,Z.jsx)(Q,{className:o}),(0,Z.jsxs)(ze,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(B,{onSelect:()=>c(),children:[(0,Z.jsx)(J,{}),` `,u()]}),(0,Z.jsxs)(B,{onSelect:()=>{S(t),b(!0)},children:[(0,Z.jsx)(rt,{}),` `,C()]}),(0,Z.jsxs)(B,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await re({title:N(),label:h(),placeholder:d(),confirmLabel:ie()});t&&await _({name:t,parentId:e})})},children:[(0,Z.jsx)(De,{}),` `,N()]}),(0,Z.jsxs)(B,{onSelect:()=>T(!0),children:[(0,Z.jsx)(ct,{}),` `,oe()]}),(0,Z.jsx)(Pe,{children:s()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e,color:null}),"aria-label":Se(),children:`✕`}),tt.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void f({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=D?.folders??0,r=D?.chats??0;await v({title:a({name:t}),description:n>0?te({folders:n,chats:r}):r>0?ue({count:r}):he(),confirmWord:g(),confirmLabel:le(),destructive:!0})&&await m({projectId:e})})},children:[(0,Z.jsx)(Ze,{}),` `,g()]})]})]}),(0,Z.jsx)(Ge,{open:y,onOpenChange:b,title:p(),canSubmit:x.trim().length>0,onSubmit:async()=>{await l({projectId:e,name:x.trim()}),b(!1)},submitLabel:C(),children:(0,Z.jsx)($e,{value:x,onChange:e=>S(e.target.value),autoFocus:!0})}),w?(0,Z.jsx)(nt,{open:w,onOpenChange:T,title:ne(),movingFolderId:e,currentId:r,onPick:t=>void ee({projectId:e,parentId:t})}):null]})}function $({chat:e,currentFolderId:t,className:n}){let a=i(M.chats.pinChat),o=i(M.chats.deleteChat),s=i(M.chats.renameChat),c=i(M.chats.setChatSidebar),l=i(M.chats.moveChatToProject),u=We(),[d,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(e.title??``),[_,v]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Re,{children:[(0,Z.jsx)(Q,{className:n}),(0,Z.jsxs)(ze,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(B,{onSelect:()=>{h(e.title??``),p(!0)},children:[(0,Z.jsx)(rt,{}),` `,C()]}),(0,Z.jsxs)(B,{onSelect:()=>void a({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(Je,{}):(0,Z.jsx)(U,{}),e.pinned?f():w()]}),(0,Z.jsxs)(B,{onSelect:()=>v(!0),children:[(0,Z.jsx)(ct,{}),` `,ve()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(B,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Xe,{}):(0,Z.jsx)(ut,{}),e.inSidebar?P():S()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:y(),description:he(),confirmLabel:g(),destructive:!0})&&await o({chatId:e._id})})},children:[(0,Z.jsx)(Ze,{}),` `,g()]})]})]}),(0,Z.jsx)(Ge,{open:d,onOpenChange:p,title:ee(),canSubmit:m.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:m.trim()}),p(!1)},submitLabel:C(),children:(0,Z.jsx)($e,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),_?(0,Z.jsx)(nt,{open:_,onOpenChange:v,title:r(),currentId:t,onPick:t=>void l({chatId:e._id,projectId:t})}):null]})}function ft(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function pt(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 mt(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 ht=`oc.projpage.view`;function gt(){let e=localStorage.getItem(ht);return e===`cards`||e===`list`?e:`columns`}var _t=e=>`into:${e}`,vt=e=>`col:${e??`null`}`,yt=e=>`crumb:${e}`;function bt(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 xt(){let{projectId:e}=Fe({from:`/project/$projectId`}),t=z(),n=j(M.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:pe()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ae()}),(0,Z.jsx)(I,{variant:`outline`,onClick:()=>void t({to:`/`}),children:ce()})]}):(0,Z.jsx)(St,{page:n})})}function St({page:e}){let t=z(),n=We(),r=Be(),l=Oe(),u=i(M.projects.renameProject),f=i(M.projects.setProjectColor),ee=i(M.projects.deleteProject),v=i(M.projects.createProject),y=i(M.projects.moveProject),b=i(M.chats.moveChatToProject),S=i(M.chats.reorderChat),w=i(M.projects.reorderProject),T=j(M.projects.projectTreeCount,{projectId:e.project._id}),[E,ae]=(0,X.useState)(gt),O=e=>{localStorage.setItem(ht,e),ae(e)},k=j(M.projects.folderColumns,E===`columns`?{projectId:e.project._id}:`skip`),A=j(M.projects.projectTreeList,E===`list`?{projectId:e.project._id}:`skip`),{c:ce}=Ne({from:`/project/$projectId`}),pe=j(M.projects.listProjects,{}),ve=j(M.chatReads.myBusyChats,{}),P=(0,X.useMemo)(()=>new Set(ve??[]),[ve]),F=j(M.chatReads.myChatReads,{}),Ce=(0,X.useMemo)(()=>mt(e.chats,F??[]),[e.chats,F]),{startNewChat:Fe,picker:R}=qe(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[H,Je]=(0,X.useState)(``),[Ye,U]=(0,X.useState)(!1),[G,Xe]=(0,X.useState)(e.project.name),[K,Qe]=(0,X.useState)(!1),[J,ut]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ut(H.trim()),180);return()=>clearTimeout(e)},[H]);let Q=j(M.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),dt=Te(et(at,{activationConstraint:{distance:4}}),et(He,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),_t=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[vt,yt]=(0,X.useState)(null),xt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=k?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||o()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(pe??[]).find(t=>t._id===e)?.name??``}}return null},St=e=>yt(xt(String(e.active.id))),Tt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=L(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=L(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=L(n(`crumb:`));if(a.length>0)return a;let o=L(n(`col:`));return o.length>0?o:ke(n(t?`folder:`:`chat:`))},[]),Dt=t=>{if(E===`columns`){for(let e of k?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(E===`list`){let e=A?.chats.find(e=>e._id===t);return e?{list:A.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(E===`columns`){for(let e of k?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(E===`list`){let e=A?.folders.find(e=>e._id===t);if(!e||!A)return null;let n=e.parentId??A.rootId;return{list:je(A.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},At=async e=>{yt(null),_t();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=bt(r);if(e!==void 0){if(a)await b({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Ue(pe??[],t,e)){l.error(xe());return}await y({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=Dt(t);if(!n)return;n.list.some(t=>t._id===e)||await b({chatId:e,projectId:n.folderId});let a=pt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await S({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(!Ue(pe??[],e,n.parentId)){l.error(xe());return}await y({projectId:e,parentId:n.parentId})}let a=pt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await w({projectId:e,...a});return}}catch{l.error(xe())}},[,Mt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Mt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Nt=Date.now(),Pt=W(e.project),Ft=ft(e.chats,H),It=e.breadcrumb.slice(0,-1),Lt=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ve,{sensors:dt,collisionDetection:Tt,onDragStart:St,onDragEnd:At,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Pt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":ge(),children:[It.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Ct,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Lt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":c(),children:[(0,Z.jsx)(I,{variant:E===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":c(),title:c(),"aria-pressed":E===`cards`,onClick:()=>O(`cards`),children:(0,Z.jsx)(lt,{})}),(0,Z.jsx)(I,{variant:E===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":x(),title:x(),"aria-pressed":E===`columns`,onClick:()=>O(`columns`),children:(0,Z.jsx)(st,{})}),(0,Z.jsx)(I,{variant:E===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":be(),title:be(),"aria-pressed":E===`list`,onClick:()=>O(`list`),children:(0,Z.jsx)(we,{})})]}),(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,onClick:()=>void Fe({projectId:e.project._id}),children:[(0,Z.jsx)(it,{}),me()]}),(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:N(),label:h(),placeholder:d(),confirmLabel:ie()});t&&await v({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(De,{}),N()]}),(0,Z.jsxs)(Re,{children:[(0,Z.jsx)(Le,{asChild:!0,children:(0,Z.jsx)(I,{variant:`ghost`,size:`icon-sm`,"aria-label":_(),children:(0,Z.jsx)(Ae,{})})}),(0,Z.jsxs)(ze,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(B,{onSelect:()=>{Xe(e.project.name),U(!0)},children:[(0,Z.jsx)(rt,{}),` `,C()]}),(0,Z.jsxs)(B,{onSelect:()=>Qe(!0),children:[(0,Z.jsx)(ct,{}),` `,oe()]}),(0,Z.jsx)(Pe,{children:s()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e.project._id,color:null}),"aria-label":Se(),children:`✕`}),tt.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void f({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=T?.folders??0,o=T?.chats??0;await n({title:a({name:e.project.name}),description:i>0?te({folders:i,chats:o}):o>0?ue({count:o}):he(),confirmWord:g(),confirmLabel:le(),destructive:!0})&&(await ee({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(Ze,{}),` `,g()]})]})]})]})]}),E===`columns`?(0,Z.jsx)(jt,{data:k,currentId:e.project._id,busyIds:P,suppressClick:$,locateChatId:ce??null}):E===`list`?(0,Z.jsx)(Ot,{data:A,busyIds:P,suppressClick:$,locateChatId:ce??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:se()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:ot,children:e.children.map(t=>(0,Z.jsx)(wt,{child:t,parentId:e.project._id,now:Nt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:fe()}),e.chats.length>0?(0,Z.jsx)($e,{value:H,onChange:e=>Je(e.target.value),placeholder:ye(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?D():_e()}):Ft.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:de({term:H.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(q,{items:Ft.map(e=>`chat:${e._id}`),strategy:Y,children:Ft.map(t=>(0,Z.jsx)(Et,{chat:t,currentFolderId:e.project._id,now:Nt,busy:P.has(t._id),unread:Ce.has(t._id),locate:t._id===ce,suppressClick:$},t._id))})})]}),J.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:m()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:de({term:J})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Me(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Ke,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||re()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)(Ge,{open:Ye,onOpenChange:U,title:p(),canSubmit:G.trim().length>0,onSubmit:async()=>{await u({projectId:e.project._id,name:G.trim()}),U(!1)},submitLabel:C(),children:(0,Z.jsx)($e,{value:G,onChange:e=>Xe(e.target.value),autoFocus:!0})}),K?(0,Z.jsx)(nt,{open:K,onOpenChange:Qe,title:ne(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void y({projectId:e.project._id,parentId:t})}):null,R]}),(0,Z.jsx)(Ee,{children:vt?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[vt.kind===`folder`?(0,Z.jsx)(V,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Ke,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:vt.label})]}):null})]})}function Ct({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=R({id:yt(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function wt({child:e,parentId:t,now:n,suppressClick:r}){let i=z(),a=H({id:`folder:${e._id}`}),o=R({id:_t(e._id)});return(0,Z.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":W(e),transform:K.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,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(V,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(dt,{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,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?k({count:e.folderCount})+` · `:``,O({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:Ye(e.lastActivityAt,n)})]})}function Tt({chat:e}){let t=i(M.chats.setChatSidebar),n=e.inSidebar?P():S();return(0,Z.jsx)(I,{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,Z.jsx)(Xe,{}):(0,Z.jsx)(ut,{})})}function Et({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:s}){let c=z(),l=G(e.color),u=H({id:`chat:${e._id}`}),d=Dt(a);return(0,Z.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:K.Transform.toString(u.transform),transition:u.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{s.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||o()}),e.pinned?(0,Z.jsx)(U,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:Ye(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:F(),"aria-label":F()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:v(),"aria-label":v()}):null]}),(0,Z.jsx)(Tt,{chat:e}),(0,Z.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Dt(e){let t=(0,X.useRef)(null);return(0,X.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,X.useState)(new Set),o=(0,X.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,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b()});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=je(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:Y,children:u.map(e=>(0,Z.jsx)(At,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:Y,children:d.map(t=>(0,Z.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,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&je(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:D()}):c(null,0)})}function kt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=z(),c=H({id:`folder:${e._id}`}),l=R({id:_t(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.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":W(e),transform:K.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,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?E():A(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Qe,{size:13}):(0,Z.jsx)(Ce,{size:13})}),(0,Z.jsx)(V,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(dt,{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=z(),s=H({id:`chat:${e._id}`}),c=Dt(r),l=G(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:K.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||o()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)($,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(Tt,{chat:e})]})}function jt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.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:r,suppressClick:i,locateChatId:a}){let o=z(),s=R({id:vt(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:Y,children:e.folders.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:Y,children:e.chats.map(t=>(0,Z.jsx)(Pt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:_e()}):null]})}function Nt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=H({id:`folder:${e._id}`}),o=R({id:_t(e._id)});return(0,Z.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":W(e),transform:K.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,Z.jsx)(V,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(dt,{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 s=H({id:`chat:${e._id}`}),c=Dt(r),l=G(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:K.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||o()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(Tt,{chat:e})]})}export{xt as ProjectPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,$o as i,$y as a,AR as o,By as s,Gy as c,Hy as l,Iy as u,Jy as d,Ky as f,Ly as p,Qi as m,Qo as h,Qy as g,Ry as ee,Sr as _,Uy as v,Vy as y,Wy as b,Xi as x,Xo as te,Xy as ne,Yy as re,Zi as ie,Zo as ae,Zy as oe,br as se,ca as ce,cb as S,ea as le,eb as C,es as w,jR as T,la as E,lb as D,qy as O,sa as k,t as A,tb as j,ua as M,xr as N,zy as P}from"./api-CbVyaw6f.js";import{d as F,f as I,i as L,l as R,n as z,r as B,t as V,u as H}from"./FieldLabel-Dt5eJKiD.js";import{t as U}from"./button-B_rxV4Hv.js";import{Dt as W,P as ue,_t as G,bt as K,vt as q,wt as de,xt as J,yt as Y}from"./index-EISUCtE9.js";import{r as X,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Z=t(e(),1),Q=n(),$={media_delivery:{label:ne,help:re},documentary_fetch:{label:d,help:O},inbound_files:{label:f,help:c},history_summary:{label:w,help:i},file_curation:{label:M,help:le},quote_reply:{label:E,help:ce}},me={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`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},he={outboundDir:ee,references:p,files:u,previous_summary:h,new_messages:ae,max_chars:te,file_name:r,budget_chars:m,feedback:ie,content:x,excerpt:k};function ge(){let e=T(A.admin.listInstances,{}),[t,n]=(0,Z.useState)(null);if(e===void 0)return(0,Q.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Q.jsx)(`div`,{className:`oc-injtab`,children:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()})});let r=e.find(e=>e._id===t)??e[0];return(0,Q.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Q.jsx)(z,{label:j(),help:C()}),(0,Q.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Q.jsx)(`span`,{children:b()}),(0,Q.jsxs)(G,{value:r._id,onValueChange:e=>n(e),children:[(0,Q.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(J,{})}),(0,Q.jsx)(q,{children:e.map(e=>(0,Q.jsx)(Y,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Q.jsx)(_e,{instance:r},r._id)]})}function _e({instance:e}){let t=o(A.admin.upsertInstanceConfig),n=W(),r=T(A.me.getMe,{host:de}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Z.useState)(()=>L(i,a));(0,Z.useEffect)(()=>{c(L(i,a))},[a,e._id]);let[l,u]=(0,Z.useState)(!1),d=s.promptInjections,f=(e,t)=>c({...s,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:B(s,i,a)})}catch(e){n.error(S(),e)}finally{u(!1)}}async function m(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(S(),e)}}let h=e.config?.contentLocale??`default`,g=fe[X(void 0,r?.defaultLocale??void 0)];return(0,Q.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,Q.jsx)(`span`,{children:_()}),(0,Q.jsxs)(G,{value:h,onValueChange:e=>void m(e),children:[(0,Q.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(J,{})}),(0,Q.jsxs)(q,{children:[(0,Q.jsx)(Y,{value:`default`,children:se({locale:g})}),pe().map(e=>(0,Q.jsx)(Y,{value:e.value,children:e.label},e.value))]})]}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:N()})]}),H.map(e=>(0,Q.jsx)(ve,{injKey:e,def:R[e],i18n:$[e],row:d[e]??{enabled:!0,template:R[e].defaultTemplate[a]},contentLocale:a,onChange:t=>f(e,t)},e)),(0,Q.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Q.jsx)(U,{size:`sm`,onClick:()=>void p(),disabled:l,children:D()})})]})}function ve({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:o}){let[c,u]=(0,Z.useState)(!1),d=r.template.trim()!==t.defaultTemplate[i],f=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,me[e]??`{${e}}`])),m=F(e,r,i),h=m?I(m,p):``;return(0,Q.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(ue,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,Q.jsx)(z,{label:n.label(),help:n.help()})]}):(0,Q.jsx)(z,{label:n.label(),help:n.help()}),d&&(0,Q.jsx)(`span`,{className:`oc-injection__badge`,children:g()})]}),(0,Q.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,Q.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:oe()}),t.placeholders.map(e=>(0,Q.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Q.jsx)(`code`,{children:`{${e}}`}),(0,Q.jsx)(V,{text:(he[e]??(()=>e))()})]},e))]}),(0,Q.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>!e),children:c?y():l()}),d&&(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[i]}),children:a()})]})]}),c&&(0,Q.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:s()})]}):(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:P()})})]})}export{ge as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,AR as a,BC as ee,DC as te,EC as o,FC as ne,GC as s,HC as c,IC as l,JC as u,KC as d,LC as f,MC as re,NC as p,OC as m,PC as h,Pa as g,QC as _,RC as ie,TC as v,UC as y,VC as b,WC as x,XC as S,YC as C,ZC as w,_C as T,dC as E,ew as D,fC as O,gC as k,hC as A,jC as j,jR as M,kC as N,mC as P,pC as F,qC as I,t as L,vC as R,yC as ae,zC as z}from"./api-CbVyaw6f.js";import{t as B}from"./button-B_rxV4Hv.js";import{Dt as V,P as H,Z as U,_ as W,jt as G,ut as K,yn as q}from"./index-EISUCtE9.js";import{t as J}from"./roleDescriptions-B4jROh9m.js";var Y=t(e(),1),X=n(),Z=[{group:()=>D(),keys:[{key:`traces.read`,label:()=>C()},{key:`traces.read.content`,label:()=>u(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>r(),keys:[{key:`kpi.read`,label:()=>C()},{key:`kpi.write`,label:()=>I()}]},{group:()=>_(),keys:[{key:`openclaw.query`,label:()=>d()},{key:`anomalies.read`,label:()=>s()},{key:`anomalies.report`,label:()=>x()}]},{group:()=>w(),keys:[{key:`chats.read`,label:()=>C()},{key:`selfheal`,label:()=>c()},{key:`feedback.respond`,label:()=>g()}]},{group:()=>S(),keys:[{key:`admin.manage`,label:()=>y()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=M(L.apiKeys.listRoles,{}),t=a(L.apiKeys.createRole),n=a(L.apiKeys.ensureRolesSeeded),r=a(L.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(L.apiKeys.listRoles,{});r&&e.setQuery(L.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=U(),c=V(),[u,d]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)($),[y,x]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(ee(),e)})},[n,c]);let S=e??[];async function C(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:z({name:e.name}),description:ie(),confirmLabel:f()});return}if(y.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];x(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){c.error(l(),e)}finally{x(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function w(){try{await t({key:g.key,name:g.name,description:g.description||void 0,permissions:[]}),_($),d(!1)}catch(e){c.error(ne(),e)}}let D=e===void 0,I=!D&&S.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,p(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,re()]}),(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:j()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{_($),d(!0)},children:i()})})]}),D?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):I?(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:te()}),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?b({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:S.map(e=>{let t=Q(e.permissions),n=y.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)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,o()]}):(0,X.jsx)(K,{variant:`secondary`,children:v()})]}),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)(H,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ae():n?R():r,onCheckedChange:()=>void C(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:u,onOpenChange:d,title:T(),description:k(),canSubmit:!!(g.key&&g.name),onSubmit:w,submitLabel:A(),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:P()}),(0,X.jsx)(G,{value:g.key,placeholder:F(),onChange:e=>_({...g,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,X.jsx)(G,{value:g.name,onChange:e=>_({...g,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:E()}),(0,X.jsx)(G,{value:g.description,onChange:e=>_({...g,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|