@lacneu/atrium 0.89.0 → 0.89.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-Df_4AcFD.js +1 -0
- package/dist/assets/{AdvancedFilter-DEwJUkfT.js → AdvancedFilter-CAL1iuFs.js} +1 -1
- package/dist/assets/AgentFilesTab-DoyeqSY4.js +3 -0
- package/dist/assets/AnomaliesTab-B1DKCsjj.js +1 -0
- package/dist/assets/AuditTab-BGkoc1Zj.js +1 -0
- package/dist/assets/BridgeTab-BcgKRRyE.js +1 -0
- package/dist/assets/{ChatDefaultsTab-CgTm4WMx.js → ChatDefaultsTab-CcgqB2Tr.js} +1 -1
- package/dist/assets/{DataTableShell-REGK6Dqj.js → DataTableShell-B2tSklkW.js} +1 -1
- package/dist/assets/{DetailChips-Dhiulk-F.js → DetailChips-CNvtDPh2.js} +1 -1
- package/dist/assets/FeedbacksTab-C1bsMFQ5.js +1 -0
- package/dist/assets/{FieldLabel-CFBfL_GK.js → FieldLabel-DJKixX2U.js} +1 -1
- package/dist/assets/FilesTab-CkUGEsAi.js +1 -0
- package/dist/assets/{FilterBar-CJwP10CI.js → FilterBar-Dahwcfzm.js} +1 -1
- package/dist/assets/GroupsTab-DeIEpP6E.js +1 -0
- package/dist/assets/InstancesTab-CmfzovcI.js +1 -0
- package/dist/assets/IntegrationsTab-CdKpRxdY.js +1 -0
- package/dist/assets/KpiTab-IYXf7JHH.js +1 -0
- package/dist/assets/PreferencesTab-CyFruzIy.js +1 -0
- package/dist/assets/ProjectPage-UScCO4tj.js +1 -0
- package/dist/assets/PromptInjectionsTab-Brjk8vQF.js +4 -0
- package/dist/assets/RolesTab-DJ-2Osh-.js +1 -0
- package/dist/assets/ScheduledTab-B2rVKQ7m.js +1 -0
- package/dist/assets/ServiceAccountsTab-DUrq3SPH.js +1 -0
- package/dist/assets/SubAgentReportsTab-CDSTI73R.js +1 -0
- package/dist/assets/ThemeShowroom-DQhGWSd1.js +1 -0
- package/dist/assets/{TimeRangePicker-es8qiYT0.js → TimeRangePicker-BL1yFs8W.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DSIM9YOb.js → TimezoneCombobox-CnH4Mhn1.js} +1 -1
- package/dist/assets/TracesTab-CeOiGwXc.js +1 -0
- package/dist/assets/TrashPage-B2LE1xUV.js +1 -0
- package/dist/assets/TrashTab-BM-SWYcq.js +1 -0
- package/dist/assets/UsersTab-BPRn3sgi.js +1 -0
- package/dist/assets/VoiceTab-IfrYaKiC.js +1 -0
- package/dist/assets/{api-DfVtzU1G.js → api-DqQFqhQd.js} +5 -5
- package/dist/assets/{button-BWdRKrS3.js → button-zBL1A3Z_.js} +1 -1
- package/dist/assets/{card-CdvSrnID.js → card-BnvlypuJ.js} +1 -1
- package/dist/assets/chevrons-up-down-B_6bOX8v.js +1 -0
- package/dist/assets/{compatView-ChkOVx0F.js → compatView-CG_NDskG.js} +1 -1
- package/dist/assets/dispatchErrorInfo-Df5HgCnN.js +1 -0
- package/dist/assets/{dist-D8270q9m.js → dist-DOeV8fIc.js} +1 -1
- package/dist/assets/{dist-cnxPdTGN.js → dist-DawSOQGU.js} +1 -1
- package/dist/assets/{dist-CGHNQwsf.js → dist-DzCn4zAa.js} +1 -1
- package/dist/assets/{dist-CdViHsIv.js → dist-SxrQHF8N.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CrlMHfOs.js → highlighted-body-OFNGDK62-PEadU5BG.js} +1 -1
- package/dist/assets/index-C6dZsLkz.js +327 -0
- package/dist/assets/{list-CR2YIdia.js → list-CnEuXouq.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BlVUigGe.js +1 -0
- package/dist/assets/{pdf-D1bMzEYl.js → pdf-BMMRdiOC.js} +1 -1
- package/dist/assets/roleDescriptions-CCaZxKCB.js +1 -0
- package/dist/assets/{table-CVSQWo7b.js → table-Btkc8kMw.js} +1 -1
- package/dist/assets/{use_paginated_query-DSw-EOJL.js → use_paginated_query-BfugHiht.js} +1 -1
- package/dist/assets/x-BVM46c6P.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-D82x_380.js +0 -1
- package/dist/assets/AgentFilesTab-CEqQ02fZ.js +0 -3
- package/dist/assets/AnomaliesTab-Cl2630PU.js +0 -1
- package/dist/assets/AuditTab-DYryQjmJ.js +0 -1
- package/dist/assets/BridgeTab-rI4MFNcQ.js +0 -1
- package/dist/assets/FeedbacksTab-DpWIlp9R.js +0 -1
- package/dist/assets/FilesTab-VZuW17oP.js +0 -1
- package/dist/assets/GroupsTab-BjJmfc7f.js +0 -1
- package/dist/assets/InstancesTab-Ofqk-EZR.js +0 -1
- package/dist/assets/IntegrationsTab-Cey3WV3E.js +0 -1
- package/dist/assets/KpiTab-DIRKI4qa.js +0 -1
- package/dist/assets/PreferencesTab-BfHNBONO.js +0 -1
- package/dist/assets/ProjectPage-BsJB0GCv.js +0 -1
- package/dist/assets/PromptInjectionsTab-KdBPVl-W.js +0 -4
- package/dist/assets/RolesTab-DdooYgwg.js +0 -1
- package/dist/assets/ScheduledTab-AArpRKQU.js +0 -1
- package/dist/assets/ServiceAccountsTab-ByKfn9jX.js +0 -1
- package/dist/assets/SubAgentReportsTab-BMxqMtk1.js +0 -1
- package/dist/assets/ThemeShowroom-Ctv3Ktd3.js +0 -1
- package/dist/assets/TracesTab-CXdVaFxl.js +0 -1
- package/dist/assets/TrashPage-DwgS7gln.js +0 -1
- package/dist/assets/TrashTab-CAfRYG_t.js +0 -1
- package/dist/assets/UsersTab-B29t4KCa.js +0 -1
- package/dist/assets/VoiceTab-BaN-J1s2.js +0 -1
- package/dist/assets/chevrons-up-down-RHDK4dlM.js +0 -1
- package/dist/assets/dispatchErrorInfo-CpWqaJBx.js +0 -1
- package/dist/assets/index-B0MXmi3m.js +0 -327
- package/dist/assets/mermaid-GHXKKRXX-n8ziFmjV.js +0 -1
- package/dist/assets/roleDescriptions-DBqNfMhe.js +0 -1
- package/dist/assets/x-CrZwGtLz.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cq as r,ay as i,cy as a,dy as o,fy as s,gy as c,hy as l,iy as u,ly as d,my as f,ny as p,oy as m,pq as h,py as g,ry as _,sy as v,t as y,uy as b}from"./api-DqQFqhQd.js";import{Lt as x,ct as S,dt as C,lt as w,st as T,ut as E}from"./index-C6dZsLkz.js";var D=t(e(),1);function O(e){return e===`user`?m():e===`all`?i():u({group:e.group})}function k(e){return e===`common`?_():e===`owner`?p():u({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=r(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=r(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(E,{size:`sm`,"aria-label":l(),children:(0,A.jsx)(C,{placeholder:l()})}),(0,A.jsx)(S,{children:(e??[]).map(e=>(0,A.jsx)(w,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(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:g()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(x,{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:o()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(x,{variant:`default`,children:v()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{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:b()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(x,{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:d()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(x,{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{Ax as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ax as r,Fx as i,Mx as a,Nx as o,Px as s,jx as c,kx as l}from"./api-DqQFqhQd.js";import{r as u}from"./dist-DOeV8fIc.js";import{t as d}from"./x-BVM46c6P.js";import{t as f}from"./button-zBL1A3Z_.js";import{Ht as p,ct as m,dt as h,lt as g,st as _,ut as v,wn as y}from"./index-C6dZsLkz.js";import{r as b}from"./TimeRangePicker-BL1yFs8W.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{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 i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.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}),s(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-40`,children:(0,S.jsx)(h,{placeholder:a()})}),(0,S.jsx)(m,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-28`,children:(0,S.jsx)(h,{})}),(0,S.jsx)(m,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(p,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(y,{}),l()]})]}):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{Ad as r,Ag as i,Bg as a,Cd as o,Cg as s,Cq as c,Dd as l,Dg as u,Ed as d,Eg as f,Fg as p,Gg as m,Gu as h,Hg as g,Ig as _,Jg as v,Ju as y,Kg as b,Ku as x,Lg as S,M_ as C,Md as w,Mg as T,Ng as E,Od as ee,Og as te,P_ as D,Pg as O,Rg as k,Sd as A,Sg as j,So as M,Sq as N,Td as P,Tg as ne,Ug as re,Vg as F,Wg as ie,Wu as I,Xu as L,Yu as R,_d as z,bd as B,bg as V,bq as H,fd as ae,gd as oe,hd as U,hq as W,jd as G,jg as se,kd as ce,kg as le,md as ue,pd as de,pq as K,qg as fe,qu as pe,t as q,vd as me,wR as he,wd as ge,wg as _e,xd as ve,xg as ye,yd as be,yg as xe,zg as Se}from"./api-DqQFqhQd.js";import{t as J}from"./button-zBL1A3Z_.js";import{At as Ce,Ft as we,G as Te,It as Ee,Lt as De,Mt as Oe,Nt as ke,Pt as Ae,Rt as Y,_n as je,_t as Me,ct as Ne,dt as Pe,ft as Fe,gt as Ie,jt as Le,kt as Re,lt as ze,mt as Be,pt as Ve,st as He,tt as Ue,ut as We}from"./index-C6dZsLkz.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-CG_NDskG.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=c(q.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=c(q.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=c(q.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),u=c(q.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),d=(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(u!==void 0)return u.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,s,r,u]),[f,p]=(0,X.useState)(null);(0,X.useEffect)(()=>{!d||d.length===0||(!f||!d.some(e=>$(e)===f))&&p($(d[0]))},[d,f]);let h=d?.find(e=>$(e)===f)??null,y=H(q.agentFiles.listAgentFiles),[x,w]=(0,X.useState)({status:`idle`}),T=h?.instanceName??null,E=h?.agentId??null,te=c(q.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),D=n&&T!==null?Te(te,`agentFiles`):null,O=D===null?!1:D===`loading`?null:D.blocked,A=(0,X.useCallback)(async()=>{if(!(T===null||E===null)){w({status:`loading`});try{w({status:`done`,files:(await y({instanceName:T,agentId:E})).files})}catch(e){w({status:`error`,dashboardAbsent:tt(e)})}}},[y,T,E]);(0,X.useEffect)(()=>{O===!1&&A()},[A,O]);let[j,N]=(0,X.useState)(null),P=c(q.agentFileCuration.listCurations,t&&T!==null&&E!==null?{instanceName:T,agentId:E}:`skip`),ne=c(q.agentFileCuration.curationSettings,t&&T!==null?{instanceName:T}:`skip`),I=H(q.agentFileCuration.requestCuration),[L,R]=(0,X.useState)(null),[z,B]=(0,X.useState)(null),{toast:V}=Y(),ae=(0,X.useMemo)(()=>{let e=new Map;for(let t of P??[])e.has(t.name)||e.set(t.name,t);return e},[P]),oe=(0,X.useCallback)(async e=>{if(!(T===null||E===null)){R(e);try{let t=await I({instanceName:T,agentId:E,name:e,trigger:`manual`});t.ok?V({title:ce(),variant:`success`}):V({title:ee({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:l(),variant:`error`})}finally{R(null)}}},[I,T,E,V]),U=W(),G=(0,X.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||d===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:K()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(He,{value:i??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":fe(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(Ne,{children:(r??[]).map(e=>(0,Q.jsx)(ze,{value:e.name,children:e.name},e.name))})]}):null,d.length>0?(0,Q.jsxs)(He,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":b(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(Ne,{children:d.map(e=>(0,Q.jsx)(ze,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}),h===null?null:D===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:K()}):D!==null&&D.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(je,{size:14,"aria-hidden":!0}),` `,qe(D.gatewayVersion,D.provider)]}):x.status===`loading`||x.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:K()}):x.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x.dashboardAbsent?M():re(),` `,!x.dashboardAbsent&&(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:C()})]}):x.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:x.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)(De,{variant:`outline`,children:g()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:F({size:Z(e.size,U)})}),(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:G.format(n)})}),r?(0,Q.jsx)(je,{size:14,className:`oc-afiles__warn`,"aria-label":Se()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?S():_()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:ne?.budgetChars??null,enabled:ne?.enabled??!1,curation:ae.get(e.name)??null,inFlight:L===e.name,onCurate:()=>void oe(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:k({used:Z(Qe(x.files),U),total:Z(Ye,U),pct:G.format(Ze(Qe(x.files)))})})]}),j&&h?(0,Q.jsx)(at,{instanceName:h.instanceName,agentId:h.agentId,name:j.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void A()}):null,z?(0,Q.jsx)(ot,{curationId:z,onClose:()=>B(null),onApplied:()=>{B(null),A()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:i,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(J,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:G()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:r()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:w()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let c=H(q.agentFiles.getAgentFile),l=H(q.agentFiles.setAgentFile),d=Y(),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(!1),[S,w]=(0,X.useState)(!1),[ee,k]=(0,X.useState)(!1),[A,M]=(0,X.useState)(!1),N=(0,X.useCallback)(async r=>{_(!1);try{let i=await c({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||y(i.content),k(!1)}catch{_(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{N(!1)},[N]);async function P(){if(m!==null){w(!0),M(!1);try{await l({instanceName:e,agentId:t,name:n,content:v,baseUpdatedAtMs:m.updatedAtMs??void 0}),d.success(le({name:n})),o(),await N(!1)}catch(e){nt(e)?k(!0):M(!0)}finally{w(!1)}}}let re=m!==null&&v!==m.content,F=(0,X.useMemo)(()=>m===null?null:et(m.content,v),[m,v]),ie=v.length>Je,I=W(),L=(0,X.useMemo)(()=>new Intl.NumberFormat(I),[I]);return(0,Q.jsx)(Fe,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(Me,{children:p({name:n})}),(0,Q.jsxs)(Be,{children:[O({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,E()]})]})]}),g?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[u(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void N(!1),children:C()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:K()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:v,readOnly:!r,spellCheck:!1,onChange:e=>y(e.target.value),"aria-label":p({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:T()}),ee?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void N(!0),children:ne()})]}):null,A?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:te()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:se({count:L.format(v.length),max:L.format(Je)})}),r?(0,Q.jsx)(J,{size:`sm`,disabled:!re||S||ee,onClick:()=>x(!0),children:S?D():i()}):null]})]}),(0,Q.jsx)(Re,{open:b,onOpenChange:x,children:(0,Q.jsxs)(Oe,{children:[(0,Q.jsxs)(we,{children:[(0,Q.jsx)(Ee,{children:_e({name:n})}),(0,Q.jsx)(ke,{children:s({agent:t})})]}),F?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:j({added:F.added,removed:F.removed})}),F.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ye()}),F.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,F.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:V()}),F.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Le,{children:he()}),(0,Q.jsx)(Ce,{onClick:()=>void P(),children:xe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=c(q.agentFileCuration.getProposal,{curationId:e}),i=H(q.agentFileCuration.approveCuration),a=N(q.agentFileCuration.rejectCuration),{toast:s}=Y(),[u,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),[g,_]=(0,X.useState)(``),v=W(),b=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function S(){f(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:d(),variant:`success`}),n()):s({title:t.reason===`conflict`?ge():o({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:l(),variant:`error`})}finally{f(null)}}async function C(n){f(`reject`);try{let r=g.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?h():P(),variant:`success`}):s({title:B(),variant:`error`}),t()}catch{s({title:l(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Fe,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(Me,{children:r?A({name:r.name}):K()}),(0,Q.jsx)(Be,{children:ve()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:K()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[be({before:Z(r.beforeSize,v),after:Z(r.proposedSize,v)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(je,{size:13,"aria-hidden":!0}),` `,me()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:z({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:I({feedback:r.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:de()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:oe()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:L()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:R(),value:g,onChange:e=>_(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>m(!1),disabled:u!==null,children:y()}),(0,Q.jsx)(J,{variant:`outline`,onClick:()=>void C(!1),disabled:u!==null,children:u===`reject`?D():pe()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void C(!0),disabled:u!==null,children:u===`reject`?D():x()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>m(!0),disabled:u!==null||r==null,children:U()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void S(),disabled:u!==null||r==null,children:u===`approve`?D():ue()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,Bk as i,CA as a,Cq as o,DA as s,EA as c,Fk as l,Gk as u,Hk as ee,Ik as d,Jk as te,Kk as ne,Lk as f,Nk as p,OA as m,Pk as h,Qk as g,Rk as _,SA as re,Sq as ie,TA as ae,Uk as oe,Vk as se,Wk as ce,Xk as le,Yk as ue,Zk as de,_A as fe,aA as v,bA as pe,cA as me,dA as he,eA as y,fA as ge,gA as _e,hA as ve,iA as ye,lA as be,mA as xe,nA as Se,oA as Ce,pA as b,qk as x,rA as S,sA as C,t as w,tA as T,uA as E,vA as D,wA as O,xA as k,yA as A,zk as j}from"./api-DqQFqhQd.js";import{$n as we,Lt as M,Qn as N,Rt as Te,Z as Ee,_t as P,ct as F,dt as I,ft as L,gt as R,i as z,lt as B,o as De,pt as V,st as H,tt as Oe,ut as U,yt as W}from"./index-C6dZsLkz.js";import{n as ke}from"./TimeRangePicker-BL1yFs8W.js";import{t as Ae}from"./FilterBar-Dahwcfzm.js";import{t as je}from"./DataTableShell-B2tSklkW.js";import{t as G}from"./dispatchErrorInfo-Df5HgCnN.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?m():e===`acknowledged`?s():c()}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??``,i=e.status===Y?J:e.status,s=e.severity??J,c=e.kind??J,[l,d]=(0,K.useState)(J),f=z(e.from,e.to),{from:p,to:m}=ke(f),h=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),_=e=>void t({search:t=>({...t,status:e===J?Y:e})}),j=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),P=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),L=e=>void t({search:t=>({...t,...De(e)})}),R=Ee(),V=Te(),G=ie(w.anomalies.resolveAnomaly),X=(o(w.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=o(w.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:p,to:m,anomalyStatus:i===J?void 0:i,severity:s===J?void 0:s,source:l===J?void 0:l,kind:c===J?void 0:c}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||i!==`open`||s!==J||l!==J||c!==J||f.kind!==`relative`||f.from!==Ie.from;function Ue(){d(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await R({title:ae(),description:(0,q.jsxs)(q.Fragment,{children:[O(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,a(),` `,(0,q.jsx)(`strong`,{children:re()}),`.`,` `,k()]}),confirmLabel:pe()}))try{await G({anomalyId:e._id,status:`resolved`}),V.success(A(),e.kind)}catch(e){V.error(D(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),V.success(fe(),e.kind)}catch(e){V.error(_e(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ve(),` `,(0,q.jsx)(`strong`,{children:xe()}),` `,b(),` `,(0,q.jsx)(`strong`,{children:ge()}),` `,he(),` `,(0,q.jsx)(`strong`,{children:E()}),` `,be(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:me()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:h,searchPlaceholder:C(),timeRange:f,onTimeRangeChange:L,onReset:Ue,canReset:$,children:[(0,q.jsxs)(H,{value:i,onValueChange:_,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(B,{value:J,children:Ce()}),Me.map(e=>(0,q.jsx)(B,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(H,{value:s,onValueChange:j,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:v()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(B,{value:J,children:T()}),Pe.map(e=>(0,q.jsx)(B,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:l,onValueChange:d,children:[(0,q.jsx)(U,{size:`sm`,className:`w-32`,children:(0,q.jsx)(I,{placeholder:y()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(B,{value:J,children:r()}),Fe.map(e=>(0,q.jsx)(B,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:c,onValueChange:P,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:g()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(B,{value:J,children:de()}),Q.map(e=>(0,q.jsx)(B,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:le(),rows:Z,emptyHint:i===`open`?ue():te(),rowActions:e=>X&&e.status===`open`?[{label:x(),onSelect:()=>void We(e)},{label:ne(),onSelect:()=>void Ge(e)}]:[],columns:[{header:u(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:W(e.at)}),sort:e=>e.at},{header:g(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ye(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Se({when:W(e.firstAt)}),children:S({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:v(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ce(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:y(),cell:e=>(0,q.jsx)(M,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:oe(),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)(ze,{row:e})]}),sort:e=>e.message},{header:ee(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:se(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=N();if(e.kind===`subagent.failure`){let n=$(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:[`↗ `,i()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,i()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),a=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}),a?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:a,limit:100}}),children:[`↗ `,i()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=o(w.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)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(P,{children:_()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):(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 Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(M,{variant:`destructive`,children:l()}):e===`acknowledged`?(0,q.jsx)(M,{variant:`secondary`,children:h()}):(0,q.jsx)(M,{variant:`outline`,children:p()})}function He(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{Aj as r,Cj as i,Cq as a,Dj as o,Ej as s,Gl as c,Hl as l,Kl as u,Mj as d,Nj as f,Oj as p,Pj as m,Sj as h,Tj as g,Ul as _,Vl as v,Wl as y,bj as b,jj as x,kj as S,t as C,wj as w,xj as T}from"./api-DqQFqhQd.js";import{$n as E,Qn as D,a as O,ct as k,dt as A,i as j,lt as M,n as N,o as P,s as F,st as I,ut as L,yt as R}from"./index-C6dZsLkz.js";import{n as ee}from"./TimeRangePicker-BL1yFs8W.js";import{t as z}from"./FilterBar-Dahwcfzm.js";import{t as B}from"./AdvancedFilter-CAL1iuFs.js";import{t as V}from"./DataTableShell-B2tSklkW.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:u()},{value:`realLabel`,label:c()},{value:`targetLabel`,label:y()},{value:`impersonated`,label:_()},{value:`resource`,label:l()},{value:`resourceId`,label:v()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,c=e.action??G,l=e.impersonated??G,u=e.resource??G,_=j(e.from,e.to),v=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:y,to:N}=ee(_),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:O(e)}),replace:!0}),$=a(C.admin.listAudit,{filter:{q:n||void 0,from:y,to:N,action:c===G?void 0:c,resource:u===G?void 0:u,impersonated:l===G?void 0:l===`yes`,advanced:v.length>0?v:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||c!==G||l!==G||u!==G||v.length>0||_.kind!==`relative`||_.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:d(),timeRange:_,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(I,{value:c,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(A,{placeholder:x()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(M,{value:G,children:r()}),te.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:l,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(A,{})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(M,{value:G,children:S()}),(0,U.jsx)(M,{value:`yes`,children:p()}),(0,U.jsx)(M,{value:`no`,children:o()})]})]}),(0,U.jsxs)(I,{value:u,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(A,{placeholder:s()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(M,{value:G,children:g()}),ne.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:v,onChange:Q}),(0,U.jsx)(V,{title:w(),rows:$,emptyHint:i(),columns:[{header:h(),cell:e=>R(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:T(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:b(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,$h as i,AD as a,AE as o,BE as s,CD as c,CE as l,Co as u,Cq as d,DD as f,DE as p,E as m,ED as ee,EE as h,FE as g,GE as te,Gh as _,HE as ne,IE as v,JE as re,KE as ie,LE as y,MD as ae,ME as oe,ND as se,NE as ce,OD as le,OE as ue,PE as de,Qh as fe,RE as pe,SE as me,Sq as he,TD as ge,TE as _e,UE as ve,VE as ye,WE as be,XE as xe,Xh as Se,YE as Ce,ZE as we,Zh as Te,_E as Ee,aE as De,ag as Oe,bD as ke,bE as Ae,bq as je,cE as Me,cg as Ne,cl as Pe,dE as Fe,dl as Ie,eE as b,eg as Le,fE as Re,fl as ze,gE as Be,hE as Ve,hl as He,iE as Ue,ig as We,jE as Ge,kD as Ke,kE as qe,lE as Je,ll as Ye,mE as Xe,nE as Ze,na as Qe,ng as $e,oE as et,og as tt,pE as x,qE as nt,rE as rt,rg as S,sE as it,sg as at,t as C,tE as ot,tg as st,uE as ct,ul as lt,vE as ut,wD as dt,wE as ft,xE as pt,yD as mt,yE as ht,zE as gt}from"./api-DqQFqhQd.js";import{r as w}from"./dist-DOeV8fIc.js";import{t as _t}from"./chevrons-up-down-B_6bOX8v.js";import{i as vt,n as T,o as yt,r as bt,s as xt}from"./FieldLabel-DJKixX2U.js";import{t as St}from"./button-zBL1A3Z_.js";import{$n as Ct,Fn as wt,Ht as E,J as Tt,Jn as D,Kn as O,L as Et,Lt as k,Qn as Dt,Rt as Ot,X as kt,Xt as At,Y as jt,Yt as Mt,Zt as Nt,_n as A,_t as Pt,bt as j,ct as M,dt as N,ft as Ft,gt as It,lt as P,mt as Lt,pt as Rt,q as zt,qn as Bt,st as F,tt as Vt,ut as I,xn as L,xt as Ht,yt as R}from"./index-C6dZsLkz.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as z,i as B,n as V,o as H,r as U,t as Wt}from"./table-Btkc8kMw.js";import{t as Gt}from"./FilterBar-Dahwcfzm.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-CG_NDskG.js";import{t as W}from"./dispatchErrorInfo-Df5HgCnN.js";var $t=m(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=m(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[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)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),s=(0,G.useMemo)(()=>_n(o),[o]),c=(0,G.useMemo)(()=>vn(o),[o]),l=(0,G.useMemo)(()=>yn(o),[o]),u=(0,G.useMemo)(()=>gn(pn(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Xe(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(F,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(N,{placeholder:Re()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(P,{value:J,children:x()}),s.map(e=>(0,Z.jsx)(P,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(F,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(N,{placeholder:Fe()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(P,{value:J,children:x()}),c.map(e=>(0,Z.jsx)(P,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(F,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(N,{placeholder:ct()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(P,{value:J,children:x()}),l.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:Me(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:it(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:et(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:De(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ue(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(B,{children:rt()}),(0,Z.jsx)(Q,{label:Ze(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(V,{children:u.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Bt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(_t,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Be({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:j(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${j(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Qe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${j(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ve({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${j(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?ot():e===`error`?b():r()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:ot()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:b()}):(0,Z.jsx)(k,{variant:`outline`,children:r()})}function wn(){return d(C.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=d(C.compat.getBridgeCompat,{}),n=d(C.me.getMe,{host:Vt})?.role===`admin`,r=d(C.admin.listInstances,n?{}:`skip`),i=d(C.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ct({from:`/settings/bridge`}),l=Dt({from:`/settings/bridge`}),u=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:y()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:v()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:ze()}),(0,Z.jsx)(B,{children:Ie()}),(0,Z.jsx)(B,{children:lt()}),(0,Z.jsx)(B,{children:Ye()}),(0,Z.jsx)(B,{children:Pe()})]})}),(0,Z.jsx)(V,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(zt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(jt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(Tt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:tt(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Oe({build:t.buildVersion??`?`})]}):null,` · `,We(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:p()});let o=tn(e.targets),s=!e.reachable,c=rn(e),u=e.unreachableInstances??[],d=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=R(e.checkedAt),m=e.startedAt==null?null:R(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(O,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(A,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?h():c===`gateways_unreachable`?me({count:u.length}):s?_e():ft({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,l({time:f})]}),m?(0,Z.jsx)(`span`,{children:Ae({time:m})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:pt({names:u.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ht()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(L,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ne()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}),ut({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[g(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:ce({count:i.length})}):a>0?(0,Z.jsx)(k,{variant:`destructive`,children:oe()}):(0,Z.jsx)(k,{variant:`secondary`,children:de()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ge({version:e.vendoredVersion}),r?` · `+o({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}),qe({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:He({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Le({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:S()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(It,{children:[(0,Z.jsx)(Pt,{children:se({instance:e.displayName??e.name})}),(0,Z.jsx)(Lt,{children:ae()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(O,{"aria-hidden":!0}):(0,Z.jsx)(A,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?ye():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,s()]}):null}function jn({instance:e,onClose:t}){let n=he(C.admin.upsertInstanceConfig),r=je(C.bridge.validateMediaPaths),i=Ot(),o=Ut(e.config?.contentLocale,void 0),[s,l]=(0,G.useState)(()=>vt(e.config??{},o)),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function ae(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(te(),e)}finally{m(!1)}}async function oe(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:bt(s,r,o)}),t()}catch(e){i.error(ge(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:a(),help:dt()}),(0,Z.jsxs)(F,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(M,{children:xt.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Ke(),help:c()}),(0,Z.jsxs)(F,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(M,{children:yt.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:le(),help:ke()}),(0,Z.jsx)(E,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:we(),help:xe()}),(0,Z.jsx)(E,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Ce(),help:re()}),(0,Z.jsx)(E,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Ht,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Z.jsx)(T,{label:f(),help:mt()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),pe({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ve(),result:h.inbound}),(0,Z.jsx)($,{label:ne(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),gt()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(St,{variant:`outline`,size:`sm`,onClick:()=>void ae(),disabled:p,children:[p?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ie():nt()]}),(0,Z.jsx)(St,{size:`sm`,onClick:()=>void oe(),disabled:u,children:ee()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Mt,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?i():fe({count:e.length}),(0,Z.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(At,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Te()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,Af as i,B as a,D as o,D_ as s,Df as c,E_ as l,Ef as u,F as d,G as f,H as p,I as m,J as h,K as g,Kg as _,L as v,M as y,Mf as b,N as ee,N_ as x,Nf as te,O as ne,OD as re,Of as ie,P as ae,Pf as oe,Q as S,R as se,Tf as ce,U as le,V as C,W as ue,X as de,Y as fe,Z as pe,_q as w,bq as T,cg as E,dg as me,fg as he,gg as ge,hg as D,j as O,j_ as _e,jf as k,k as ve,kf as A,lg as j,mg as ye,ml as be,pg as M,q as xe,t as N,ug as P,uq as F,yq as I,z as Se}from"./api-DfVtzU1G.js";import{t as Ce}from"./use_paginated_query-DSw-EOJL.js";import{t as L}from"./button-BWdRKrS3.js";import{G as we,Ht as R,K as Te,W as z,_n as Ee,ct as B,dt as V,lt as H,st as U,ut as W,xt as G}from"./index-B0MXmi3m.js";import{a as De}from"./compatView-ChkOVx0F.js";/* empty css */var K=t(e(),1),Oe=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ke(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 q=[`auto`,`hybrid`,`tool`,`off`];function Ae(e){switch(e){case`auto`:return fe();case`hybrid`:return h();case`tool`:return xe();default:return g()}}function J(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function Y(e){return typeof e==`string`&&q.includes(e)}function X(e){return{injection:Y(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function Z(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function je(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?C():Me(e)?O():null:p(),i=X(e),a=t.injection!==i.injection||!Z(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:ue()}}function Me(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Ne(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Q(e){return e.ok?null:e.code===`scope_refused`?C():e.code===`stale_default`?a():e.code===`write_unknown`||e.code===`not_confirmed`?v():e.code===`not_applied`?m():e.code===`default_too_large`?ve():e.code===`allowlist_too_large`?r():e.code===`plugin_too_old`?O():e.code===`source_not_allowed`?y():e.code===`plugin_config_lag`?ee():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?le():Se({code:e.code})}function Pe(e,t){let n=J(e),r=J(t);if(n.injection!==r.injection||!Z(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let r=w(N.knowledge.setAgentKnowledgeDefault),[i,a]=(0,K.useState)(t),[s,c]=(0,K.useState)(()=>X(t)),[l,u]=(0,K.useState)(`idle`),[d,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1),g=e=>{a(e),c(X(e)),p(null)},_=Pe(i,t);(0,K.useEffect)(()=>{m&&_&&(h(!1),g(t))},[m,_]);let v=je(i,s,n),y=v.readOnlyReason===null;async function b(){u(`saving`),p(null);try{let n=Q(await r({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:J(i)}));p(n),u(n===null?`done`:`idle`),n===null&&h(!0)}catch(e){p(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(U,{value:s.injection,onValueChange:e=>{Y(e)&&c({...s,injection:e})},disabled:!y,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":de(),children:(0,$.jsx)(V,{})}),(0,$.jsx)(B,{children:q.map(e=>(0,$.jsx)(H,{value:e,children:Ae(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(G,{checked:s.sources.includes(e.id),onCheckedChange:()=>c(Ne(t,s,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),_&&!m?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>g(t),children:o()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()}),y?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!v.dirty||!v.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?x():P()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:v.readOnlyReason}),y&&v.dirty&&v.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v.invalidReason}):null,l===`done`&&d===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,d===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function Ie({instanceName:e}){let t=T(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":S(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:p()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:d({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:ae()})]}):null]})}function Le({instance:e}){let t=I(N.admin.upsertInstanceConfig),n=T(N.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,K.useState)(r),[s,c]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=a!==r;async function d(){c(`saving`);try{let n={...e.config??{}};a===``||a===l?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let f=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:a===``?l:a,onValueChange:e=>o(e===l?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":k(),children:(0,$.jsx)(V,{placeholder:A()})}),(0,$.jsxs)(B,{children:[(0,$.jsx)(H,{value:l,children:A()}),f.map(e=>(0,$.jsx)(H,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(L,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?x():P()})]}),s===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,s===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null]})}function Re({instance:e}){let t=I(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,K.useState)(n),[o,s]=(0,K.useState)(r===null?``:String(r)),[l,d]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(n),s(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=o.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,m=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,h=i!==n||(p??null)!==r;async function g(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(G,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":b()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":ie(),disabled:!i}),(0,$.jsx)(L,{size:`sm`,disabled:!h||!m||l===`saving`,onClick:()=>void g(),children:l===`saving`?x():P()})]}),m?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:c()}),l===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,l===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]})}function ze({instance:e}){let t=I(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,K.useState)(n===null?``:String(n)),[a,o]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:oe()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,$.jsx)(L,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?x():P()})]}),l?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ce()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()})]})}function Be(){let e=w(N.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),r=T(N.admin.listInstances,{}),[i,a]=(0,K.useState)(null);(0,K.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let o=(r?.length??0)>1,c=r!==void 0&&r.length===0,u=T(N.compat.forInstance,i?{instanceName:i}:`skip`),d=i?we(u,`configDefaults`):`loading`,f=d===`loading`?null:d.blocked,p=(0,K.useMemo)(()=>o&&i?{instanceName:i}:{},[o,i]),m=(0,K.useRef)(0),h=(0,K.useCallback)(async()=>{let t=++m.current;n({status:`loading`});try{let r=ke(await e(p));if(m.current!==t)return;n({status:`done`,current:r})}catch{if(m.current!==t)return;n({status:`error`})}},[e,p]);(0,K.useEffect)(()=>{f===!1&&(o&&!i||h())},[h,f,o,i]);let g=t.status===`done`?t.current:null,v=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Te(e)})),[]),y=(0,K.useMemo)(()=>[{id:`fast`,label:s()},{id:`standard`,label:l()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}),o&&i?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,$.jsxs)(U,{value:i,onValueChange:e=>a(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":_(),children:(0,$.jsx)(V,{})}),(0,$.jsx)(B,{children:(r??[]).map(e=>(0,$.jsx)(H,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:re()}):d===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):d.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Ee,{size:14,"aria-hidden":!0}),` `,De(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[me(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:_e()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,$.jsx)(z,{field:`thinkingLevel`,options:v,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:D()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ye()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,$.jsx)(z,{field:`fastMode`,options:y,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:M()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:be()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,Af as i,B as a,Cq as o,D as s,D_ as c,Df as l,Ef as u,F as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,M_ as y,Mf as b,N as ee,Nf as te,O as ne,O_ as re,Of as ie,P as ae,P_ as x,Pf as oe,Q as S,R as se,Sq as C,Tf as ce,U as le,V as w,W as ue,X as de,Y as fe,Z as pe,_g as me,bq as T,dg as E,fg as he,gg as D,hg as ge,j as O,jD as _e,jf as k,k as ve,kf as A,lg as j,mg as M,ml as ye,pg as be,pq as N,q as xe,qg as P,t as F,ug as I,z as Se}from"./api-DqQFqhQd.js";import{t as Ce}from"./use_paginated_query-BfugHiht.js";import{t as L}from"./button-zBL1A3Z_.js";import{G as we,Ht as R,K as Te,W as z,_n as Ee,ct as B,dt as V,lt as H,st as U,ut as W,xt as G}from"./index-C6dZsLkz.js";import{a as De}from"./compatView-CG_NDskG.js";/* empty css */var K=t(e(),1),Oe=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ke(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 q=[`auto`,`hybrid`,`tool`,`off`];function Ae(e){switch(e){case`auto`:return fe();case`hybrid`:return h();case`tool`:return xe();default:return g()}}function J(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function Y(e){return typeof e==`string`&&q.includes(e)}function X(e){return{injection:Y(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function Z(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function je(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?w():Me(e)?O():null:p(),i=X(e),a=t.injection!==i.injection||!Z(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:ue()}}function Me(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Ne(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Q(e){return e.ok?null:e.code===`scope_refused`?w():e.code===`stale_default`?a():e.code===`write_unknown`||e.code===`not_confirmed`?_():e.code===`not_applied`?m():e.code===`default_too_large`?ve():e.code===`allowlist_too_large`?r():e.code===`plugin_too_old`?O():e.code===`source_not_allowed`?v():e.code===`plugin_config_lag`?ee():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?le():Se({code:e.code})}function Pe(e,t){let n=J(e),r=J(t);if(n.injection!==r.injection||!Z(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let r=T(F.knowledge.setAgentKnowledgeDefault),[i,a]=(0,K.useState)(t),[o,c]=(0,K.useState)(()=>X(t)),[l,u]=(0,K.useState)(`idle`),[d,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1),g=e=>{a(e),c(X(e)),p(null)},_=Pe(i,t);(0,K.useEffect)(()=>{m&&_&&(h(!1),g(t))},[m,_]);let v=je(i,o,n),y=v.readOnlyReason===null;async function b(){u(`saving`),p(null);try{let n=Q(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:J(i)}));p(n),u(n===null?`done`:`idle`),n===null&&h(!0)}catch(e){p(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(U,{value:o.injection,onValueChange:e=>{Y(e)&&c({...o,injection:e})},disabled:!y,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":de(),children:(0,$.jsx)(V,{})}),(0,$.jsx)(B,{children:q.map(e=>(0,$.jsx)(H,{value:e,children:Ae(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(G,{checked:o.sources.includes(e.id),onCheckedChange:()=>c(Ne(t,o,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),_&&!m?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>g(t),children:s()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()}),y?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!v.dirty||!v.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?x():E()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:v.readOnlyReason}),y&&v.dirty&&v.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v.invalidReason}):null,l===`done`&&d===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:I()}):null,d===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function Ie({instanceName:e}){let t=o(F.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(F.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":S(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:p()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:d({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:ae()})]}):null]})}function Le({instance:e}){let t=C(F.admin.upsertInstanceConfig),n=o(F.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,s]=(0,K.useState)(r),[c,l]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{s(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=a!==r;async function f(){l(`saving`);try{let n={...e.config??{}};a===``||a===u?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let p=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:a===``?u:a,onValueChange:e=>s(e===u?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":k(),children:(0,$.jsx)(V,{placeholder:A()})}),(0,$.jsxs)(B,{children:[(0,$.jsx)(H,{value:u,children:A()}),p.map(e=>(0,$.jsx)(H,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(L,{size:`sm`,disabled:!d||c===`saving`,onClick:()=>void f(),children:c===`saving`?x():E()})]}),c===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:I()}):null,c===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null]})}function Re({instance:e}){let t=C(F.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,K.useState)(n),[o,s]=(0,K.useState)(r===null?``:String(r)),[c,d]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(n),s(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=o.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,m=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,h=i!==n||(p??null)!==r;async function g(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(G,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":b()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":ie(),disabled:!i}),(0,$.jsx)(L,{size:`sm`,disabled:!h||!m||c===`saving`,onClick:()=>void g(),children:c===`saving`?x():E()})]}),m?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}),c===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:I()}):null,c===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]})}function ze({instance:e}){let t=C(F.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,K.useState)(n===null?``:String(n)),[a,o]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:oe()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,$.jsx)(L,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?x():E()})]}),l?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ce()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:I()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()})]})}function Be(){let e=T(F.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),r=o(F.admin.listInstances,{}),[i,a]=(0,K.useState)(null);(0,K.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let s=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=o(F.compat.forInstance,i?{instanceName:i}:`skip`),d=i?we(u,`configDefaults`):`loading`,f=d===`loading`?null:d.blocked,p=(0,K.useMemo)(()=>s&&i?{instanceName:i}:{},[s,i]),m=(0,K.useRef)(0),h=(0,K.useCallback)(async()=>{let t=++m.current;n({status:`loading`});try{let r=ke(await e(p));if(m.current!==t)return;n({status:`done`,current:r})}catch{if(m.current!==t)return;n({status:`error`})}},[e,p]);(0,K.useEffect)(()=>{f===!1&&(s&&!i||h())},[h,f,s,i]);let g=t.status===`done`?t.current:null,_=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Te(e)})),[]),v=(0,K.useMemo)(()=>[{id:`fast`,label:re()},{id:`standard`,label:c()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),s&&i?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:P()}),(0,$.jsxs)(U,{value:i,onValueChange:e=>a(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":P(),children:(0,$.jsx)(V,{})}),(0,$.jsx)(B,{children:(r??[]).map(e=>(0,$.jsx)(H,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:_e()}):d===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):d.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Ee,{size:14,"aria-hidden":!0}),` `,De(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[he(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:y()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,$.jsx)(z,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:D()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ge()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,$.jsx)(z,{field:`fastMode`,options:v,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:M()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:be()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:ye()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be 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{Gb as r,Hb as i,Kb as a,Ub as o,Vb as s,Wb as c,qb as l}from"./api-DqQFqhQd.js";import{r as u}from"./dist-DOeV8fIc.js";import{t as d}from"./chevrons-up-down-B_6bOX8v.js";import{t as f}from"./button-zBL1A3Z_.js";import{Gt as p,Hn as m,Jt as h,Ut as g,Wt as _,qn as v,qt as y,vn as b,wn as x,xt as S}from"./index-C6dZsLkz.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-Btkc8kMw.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=l(),bulkActions:F,emptyHint:I=a(),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)(f,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(f,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):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)(S,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":s({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(v,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(d,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(S,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(g,{children:[(0,M.jsx)(h,{asChild:!0,children:(0,M.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),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)(_,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(y,{}):null,(0,M.jsx)(p,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Lt as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Lt as t}from"./index-C6dZsLkz.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{$N as r,$P as i,AP as a,BP as o,CP as s,Cq as c,DP as l,EP as u,FP as d,GP as f,HP as ee,IP as te,Id as p,JP as m,KP as h,LP as ne,MP as g,NP as re,OP as ie,PP as _,QN as v,QP as y,RP as ae,Rd as b,SP as x,Sq as S,TP as C,UP as w,VP as T,WP as E,XP as D,YP as O,ZP as k,_P as A,aP as j,bP as M,cP as N,dP as P,eF as F,eP as I,fP as L,gP as R,hP as z,iP as B,jP as V,kP as H,lP as U,mP as oe,nP as W,oP as G,pP as K,qP as q,rP as se,sP as ce,t as J,tP as le,uP as ue,vP as de,wP as fe,xP as pe,yP as me,zP as he}from"./api-DqQFqhQd.js";import{t as ge}from"./button-zBL1A3Z_.js";import{Z as _e,yt as Y}from"./index-C6dZsLkz.js";import{t as ve}from"./DataTableShell-B2tSklkW.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>F(),incorrect:()=>i(),incoherence:()=>y(),formatting:()=>k(),latency:()=>D(),api_error:()=>O(),other:()=>m()},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:h()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:q()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=S(J.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(!1);async function v(){let t=f.trim();if(!(!t||m)){h(!0);try{await i({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),p(``)}finally{h(!1)}}}let y=[];try{y=r.contextJson?JSON.parse(r.contextJson):[]}catch{y=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${E()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:de(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(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:B()}),(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:ee()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.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`?T():e.authorRole===`agent`?e.authorLabel??b():o()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:he()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ae(),value:f,maxLength:2e3,rows:3,onChange:e=>p(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 v(),disabled:!f.trim()||m,children:m?ne():te()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||_()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||_()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,y.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V({count:r.contextCount??y.length,truncated:r.contextTruncated?a():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.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,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.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:l()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?u({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[C(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,fe()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=c(J.feedback.listForAdmin,{}),t=S(J.feedback.readSnapshot),n=S(J.feedback.deleteFeedback),i=_e(),[a,o]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function d(e){if(a===e._id){o(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}o(e._id)}async function f(e){await i({title:I(),description:r(),confirmLabel:v(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,Z.jsx)(`strong`,{children:x()}),` `,pe()]}),(0,Z.jsx)(ve,{title:M(),rows:e,emptyHint:me(),isExpanded:e=>a===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:A(),cell:e=>Y(e.at),sort:e=>e.at},{header:R(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:z(),cell:e=>e.messageRole===`user`?oe():K(),sort:e=>e.messageRole},{header:L(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${P({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ue(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:U(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:N(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ce()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:G()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:p()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:j()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?se():W(),onSelect:()=>void d(e)},{label:le(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Aq as t,E as n}from"./api-DqQFqhQd.js";import{B as r,R as i,V as a,nn as o,rn as s,z as c}from"./index-C6dZsLkz.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=n(`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`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;t.object({mediaMode:t.optional(t.union(t.literal(`gateway-http`),t.literal(`shared-fs`),t.literal(`off`))),inboundMediaMode:t.optional(t.union(t.literal(`inline`),t.literal(`shared-fs`))),rehydration:t.optional(t.boolean()),mediaMaxMb:t.optional(t.number()),attachmentFixAttested:t.optional(t.boolean()),summarizeThresholdChars:t.optional(t.number()),curationEnabled:t.optional(t.boolean()),curationBudgetChars:t.optional(t.number()),converterAgentId:t.optional(t.string()),voiceEnabled:t.optional(t.boolean()),talkEnabled:t.optional(t.boolean()),voiceEngine:t.optional(t.union(t.literal(`browser`),t.literal(`gateway`))),voiceLang:t.optional(t.string()),voiceRate:t.optional(t.number()),voiceAutoRead:t.optional(t.boolean()),contentLocale:t.optional(t.string()),inboundAgentMount:t.optional(t.string()),outboundAgentMount:t.optional(t.string()),promptInjections:t.optional(t.record(t.string(),t.object({enabled:t.optional(t.boolean()),template:t.optional(t.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of s){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:o[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of s){let i=o[r],a=e[r];if(!a)continue;let s={};i.togglable&&a.enabled===!1&&(s.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[r]=s)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(r,{delayDuration:150,children:(0,b.jsxs)(i,{children:[(0,b.jsx)(a,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(c,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as ee,AK as r,CK as i,Cq as a,DK as te,EK as ne,Hd as o,MK as re,NK as ie,OK as s,PK as c,SK as l,Sq as u,TK as d,Vd as ae,_K as f,aK as oe,bK as p,cK as se,dK as ce,eK as le,fK as ue,gK as de,hK as fe,hq as pe,iK as me,jK as m,kK as he,lK as ge,mK as _e,nK as ve,oK as ye,pK as be,pq as xe,rK as Se,sK as h,t as g,tK as _,uK as v,vK as y,wK as b,wR as x,xK as S,yK as C}from"./api-DqQFqhQd.js";import{t as w}from"./button-zBL1A3Z_.js";import{At as T,Cn as E,Ft as D,Gt as O,Hn as k,It as A,Jt as j,Lt as M,Mt as Ce,Nt as we,Pt as Te,Rt as Ee,Un as N,Ut as De,Wt as Oe,ct as P,dt as F,jt as ke,kt as Ae,lt as I,st as L,ut as R,vn as je,xt as Me}from"./index-C6dZsLkz.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-Btkc8kMw.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return i();case`audio`:return l();case`video`:return S();case`pdf`:return p();case`document`:return C();case`archive`:return y();default:return f()}}function K(){let[e,t]=(0,H.useState)(W),[n,i]=(0,H.useState)(W),[l,f]=(0,H.useState)(W),[p,y]=(0,H.useState)(W),[S,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=u(g.files.softDelete),Y=Ee();function Ie(){t(W),i(W),f(W),y(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ye())}catch(e){Y.error(oe(),e)}}let X=a(g.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:l===W?void 0:l,category:p===W?void 0:p,includeAutoGenerated:S||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(pe(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||l!==W||p!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(L,{value:e,onValueChange:t,children:[(0,U.jsx)(R,{size:`sm`,"aria-label":ie(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(I,{value:W,children:re()}),(0,U.jsx)(I,{value:`inbound`,children:m()}),(0,U.jsx)(I,{value:`outbound`,children:r()})]})]}),(0,U.jsxs)(L,{value:n,onValueChange:i,children:[(0,U.jsx)(R,{size:`sm`,"aria-label":he(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(I,{value:W,children:s()}),Q.chats.map(e=>(0,U.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(L,{value:l,onValueChange:f,children:[(0,U.jsx)(R,{size:`sm`,"aria-label":te(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(I,{value:W,children:ne()}),Q.instances.map(e=>(0,U.jsx)(I,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(L,{value:p,onValueChange:y,children:[(0,U.jsx)(R,{size:`sm`,"aria-label":d(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(I,{value:W,children:b()}),Q.categories.map(e=>(0,U.jsx)(I,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Me,{checked:S,onCheckedChange:e=>C(e===!0),"aria-label":o()}),(0,U.jsx)(`span`,{children:o()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(E,{size:14,"aria-hidden":!0}),ge()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?le():_()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:fe()}),(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{children:be()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{className:`text-right`,children:ce()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(M,{variant:`outline`,style:{marginLeft:6},children:ae()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(M,{variant:`secondary`,children:e.direction===`inbound`?m():r()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(De,{children:[(0,U.jsx)(j,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":se(),children:(0,U.jsx)(k,{size:16})})}),(0,U.jsxs)(Oe,{align:`end`,children:[e.url?(0,U.jsx)(O,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(N,{size:14}),v()]})}):(0,U.jsxs)(O,{disabled:!0,children:[(0,U.jsx)(N,{size:14}),ve()]}),(0,U.jsxs)(O,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(je,{size:14}),h()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ee({cap:Be})}):null]}),(0,U.jsx)(Ae,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(Ce,{children:[(0,U.jsxs)(D,{children:[(0,U.jsx)(A,{children:me()}),(0,U.jsx)(we,{children:Se()})]}),(0,U.jsxs)(Te,{children:[(0,U.jsx)(ke,{children:x()}),(0,U.jsx)(T,{onClick:()=>void Le(),children:h()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Jb as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Jb as r,Yb as i}from"./api-DqQFqhQd.js";import{t as a}from"./button-zBL1A3Z_.js";import{Cn as o,Ht as s,Sn as c}from"./index-C6dZsLkz.js";import{t as l}from"./TimeRangePicker-BL1yFs8W.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{$_ as r,$v as i,Av as a,Bv as o,Cq as s,Cv as c,Dv as l,E as u,Ev as d,Fv as f,Gv as p,Hv as m,Iv as h,J_ as g,Jv as _,K_ as v,Kv as y,Lv as b,Mv as x,Nv as S,Ov as C,Pv as ee,Q_ as w,Qv as T,Rv as te,Sq as E,Sv as D,Tv as O,Uv as ne,Vv as k,Wv as A,X_ as j,Xv as re,Y_ as M,Yv as N,Z_ as ie,Zv as ae,_v as P,av as F,bv as I,cv as oe,dv as se,ev as L,ey as R,fv as ce,gv as le,hv as ue,iv as de,jv as fe,kv as pe,lv as me,mv as he,nv as ge,ov as _e,pv as ve,q_ as ye,qv as be,rv as xe,sv as Se,t as z,tv as Ce,ty as we,uv as Te,vv as Ee,wv as De,xv as Oe,yv as ke,zv as Ae}from"./api-DqQFqhQd.js";import{t as je}from"./x-BVM46c6P.js";import{t as B}from"./button-zBL1A3Z_.js";import{Ht as V,J as H,Jn as Me,Lt as U,Rt as W,X as G,Y as Ne,Yn as Pe,Z as Fe,_t as Ie,b as Le,bn as K,ct as Re,dt as ze,ft as Be,gt as Ve,hn as He,lt as Ue,mt as We,pt as Ge,q as Ke,st as qe,tt as Je,ut as Ye,xn as q,xt as J,yn as Y}from"./index-C6dZsLkz.js";import{t as Xe}from"./FilterBar-Dahwcfzm.js";import{t as Ze}from"./DataTableShell-B2tSklkW.js";import{t as X}from"./DetailChips-CNvtDPh2.js";var Qe=u(`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=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return D();case`user`:return Oe();case`pending`:return I();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=s(z.groups.listGroups,{}),t=s(z.me.getMe,{host:Je})?.role===`admin`,n=E(z.groups.createGroup),r=E(z.groups.updateGroup),a=E(z.groups.deleteGroup),c=Fe(),l=W(),[u,d]=(0,Z.useState)(!1),[v,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)($),[w,D]=(0,Z.useState)(null),[O,j]=(0,Z.useState)(``),ie=(0,Z.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 P(){x(null),C($),d(!0)}function F(e){x(e),C({name:e.name,description:e.description??``}),d(!0)}async function I(){try{v?await r({groupId:v._id,name:S.name,description:S.description}):await n({name:S.name,description:S.description||void 0}),C($),x(null),d(!1)}catch(e){l.error(M(),e)}}async function oe(e){if(await c({title:h({name:e.name}),description:f(),confirmWord:e.name,confirmLabel:ee(),cancelLabel:m(),destructive:!0}))try{await a({groupId:e._id})}catch(e){l.error(g(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}),(0,Q.jsx)(Xe,{q:O,onQChange:j,onReset:()=>j(``),canReset:O!==``,searchPlaceholder:be()}),(0,Q.jsx)(Ze,{title:we(),rows:ie,addLabel:i(),onAdd:t?P:void 0,emptyHint:T(),columns:[{header:ae(),cell:e=>e.name,sort:e=>e.name},{header:re(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(He,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(K,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:N(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:_(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:y(),onSelect:()=>D({groupId:e._id,name:e.name})},...t?[{label:p(),onSelect:()=>F(e)},{label:A(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,Q.jsx)(Le,{open:u,onOpenChange:d,title:v?o():k(),description:Ae(),canSubmit:!!S.name.trim(),onSubmit:I,submitLabel:ne(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,Q.jsx)(V,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,Q.jsx)(V,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:w?.groupId??null,groupName:w?.name??``,open:w!==null,onOpenChange:e=>{e||D(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Pe,{size:14,"aria-hidden":!0}),O()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":c({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[De(),(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=s(z.groups.getGroup,n&&e?{groupId:e}:`skip`),c=s(z.groups.listAssignableInstances,n?{}:`skip`),u=s(z.groups.listAssignableUsers,n?{}:`skip`),f=E(z.groups.addMember),p=E(z.groups.removeMember),m=E(z.groups.bulkSetMembers),h=E(z.groups.setGroupManager),g=W(),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[ee,T]=(0,Z.useState)(`members`),[te,D]=(0,Z.useState)(1),[O,ne]=(0,Z.useState)(new Set),k=(0,Z.useRef)(null),A=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),j=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),re=o?.viewerIsAdmin===!0,M=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Z.useEffect)(()=>{v(``),b(``),T(`members`),D(1),k.current=null},[n,e]),(0,Z.useEffect)(()=>{D(1)},[_]),(0,Z.useEffect)(()=>{n&&o&&e&&k.current!==e&&(k.current=e,ne(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let N=(0,Z.useMemo)(()=>u?$e(u,_,O):[],[u,_,O]);async function ae(t,n){if(e)try{n?await p({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){g.error(ye(),e)}}async function F(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(ie(),e)}}let I=rt(N,e=>A.has(e.userId)),se=N.filter(e=>A.has(e.userId)).length,R=it(N,te,ot);async function ce(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:I!==`all`})}catch(e){g.error(ye(),e)}}return(0,Q.jsx)(Be,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ge,{className:`oc-access`,children:[(0,Q.jsxs)(Ve,{children:[(0,Q.jsx)(Ie,{children:S({name:t})}),(0,Q.jsx)(We,{children:x()})]}),(0,Q.jsxs)(Ke,{value:ee,onValueChange:T,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(G,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(He,{size:13,"aria-hidden":!0}),fe(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(G,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),pe(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(G,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),oe(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(H,{value:`members`,children:u===void 0||o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V,{value:_,onChange:e=>v(e.target.value),placeholder:a(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[se,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=A.has(e.userId),n=tt(e),i=j.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":ke({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(0,Q.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?w():r(),title:i?w():r(),onClick:()=>void F(e.userId,i),children:(0,Q.jsx)(K,{size:15,"aria-hidden":!0})}):t&&i?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":L(),title:L(),children:(0,Q.jsx)(K,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:D})]})]})}),(0,Q.jsx)(H,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V,{value:y,onChange:e=>b(e.target.value),placeholder:C(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:y},`${e}-${t._id}`))})]})}),(0,Q.jsx)(H,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=s(z.groups.listAssignableAgents,{instanceName:t}),o=E(z.groups.assignAgentToGroup),c=E(z.groups.removeAgentFromGroup),l=E(z.groups.bulkSetGroupAgents),u=W(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[i]),!e)return null;let m=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=rt(g,e=>r.has(`${t}/${e.agentId}`)),y=it(m,f,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(v(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){u.error(v(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:se()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:le()}):m.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?ce():ve()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(J,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":Ee({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":me(),title:me(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:Te()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=s(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=E(z.charts.assignChartToGroup),r=E(z.charts.removeChartFromGroup),i=E(z.charts.setGroupDefaultChart),a=E(z.charts.addChartToGroupPool),o=E(z.charts.removeChartFromGroupPool),c=W();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Se()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(j(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(j(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(j(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(j(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":xe({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":ge(),title:ge(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:Ce()}):null,d?(0,Q.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":de({name:e.name}),title:de({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Ye,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(ze,{placeholder:F()})}),(0,Q.jsx)(Re,{children:u.map(e=>(0,Q.jsx)(Ue,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):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{$M as r,$j as i,AM as a,BM as o,Bj as s,Bt as c,CM as l,CN as u,Ca as d,Cq as f,DM as p,Da as m,EM as h,Ea as g,FM as _,Fj as v,Ft as y,GM as b,Gj as x,HM as S,Hj as C,Ht as ee,IM as w,Ij as T,It as te,JM as ne,Jj as re,KM as ie,Kj as ae,LM as oe,Lj as se,Lt as ce,MM as le,NM as ue,OM as de,Oa as fe,PM as E,Pt as pe,QM as me,Qf as he,Qj as ge,RM as _e,Rj as ve,Rt as ye,SD as be,SM as xe,SN as Se,Sa as Ce,Sq as D,TM as we,Ta as Te,UM as Ee,Uj as De,Ut as Oe,VM as ke,Vj as Ae,Vt as je,WM as Me,Wj as Ne,XM as Pe,Xf as Fe,Xj as Ie,YM as Le,Yf as Re,Yj as ze,ZM as Be,Zf as Ve,Zj as He,_M as Ue,_N as We,_a as Ge,_l as Ke,aM as O,aN as qe,bM as Je,bN as Ye,ba as Xe,bq as k,cM as Ze,cN as Qe,dM as $e,dN as et,eM as tt,eN as nt,fM as rt,fN as it,fa as at,gM as ot,gN as st,ga as ct,hM as lt,hN as ut,ha as dt,iN as ft,jM as pt,kM as mt,lM as ht,lN as gt,mM as _t,mN as vt,ma as yt,nM as bt,nN as xt,oM as St,oN as Ct,pM as wt,pN as Tt,pa as Et,qM as Dt,qj as Ot,rM as kt,rN as At,sM as jt,sN as Mt,t as A,tM as Nt,tN as Pt,uM as j,uN as M,vB as N,vM as Ft,vN as It,va as Lt,vl as Rt,wM as zt,wN as Bt,wa as Vt,xD as Ht,xM as Ut,xN as Wt,xa as Gt,yB as P,yM as Kt,yN as qt,ya as Jt,yl as Yt,zM as Xt,zj as Zt,zt as Qt}from"./api-DqQFqhQd.js";import{a as $t,c as en}from"./FieldLabel-DJKixX2U.js";import{t as F}from"./button-zBL1A3Z_.js";import{Ht as I,Lt as L,Rt as R,Xt as tn,Yt as nn,Z as rn,Zt as an,_t as on,b as sn,ct as z,dt as B,ft as V,gt as H,lt as U,mt as W,pt as G,st as K,ut as q,xt as J}from"./index-C6dZsLkz.js";import{t as cn}from"./DataTableShell-B2tSklkW.js";import{InstanceConfigDialog as ln}from"./BridgeTab-BcgKRRyE.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],un=new Set(X),dn=`conversational`;function fn(e){let t=new Set((e??[]).filter(e=>un.has(e)));return t.size===0?[dn]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:$t},pn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function mn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function hn(){let e=f(A.admin.listInstances,{}),t=f(A.agents.listAllInstanceAgents,{}),n=D(A.admin.upsertInstance),i=D(A.admin.deleteInstance),a=R(),[o,s]=(0,Y.useState)(!1),[l,p]=(0,Y.useState)(Q),[h,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function re(){try{await n({instanceId:C??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,transport:l.kind===`hermes`?l.transport:void 0,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,...l.kind===`openclaw`?{authMode:l.authMode,personScopes:l.personScopes,identitySource:l.identitySource,participantIdentity:l.participantIdentity,managePermissionModes:l.managePermissionModes,systemIdentity:l.systemIdentity||void 0}:{},streamTransport:l.streamTransport}),p(Q),w(null),s(!1)}catch(e){a.error(Se(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Wt(),(0,Z.jsx)(`strong`,{children:Ye()}),qt()]}),(0,Z.jsx)(cn,{title:It(),rows:e,addLabel:We(),onAdd:()=>{w(null),p(Q),s(!0)},emptyHint:st(),columns:[{header:ut(),cell:e=>e.name,sort:e=>e.name},{header:vt(),cell:e=>(0,Z.jsx)(L,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Tt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:it(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Bt(),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)(L,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?T():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Qe(),onSelect:()=>{w(e._id),p(mn(e)),s(!0)}},{label:u(),onSelect:()=>_(e.name)},{label:Dt(),onSelect:()=>S(e)},{label:et(),onSelect:()=>b(e)},{label:M(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:M(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(sn,{open:o,onOpenChange:s,title:C?Mt():gt(),description:qe(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:re,submitLabel:ft(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:At(),children:[(0,Z.jsx)(I,{value:l.name,disabled:C!==null,onChange:e=>p({...l,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ct()}):null]}),(0,Z.jsx)($,{label:xt(),children:(0,Z.jsxs)(K,{value:l.kind,onValueChange:e=>p({...l,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(U,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(U,{value:`hermes`,children:`Hermes`})]})]})}),l.kind===`hermes`?(0,Z.jsx)($,{label:Yt(),children:(0,Z.jsxs)(K,{value:l.transport,onValueChange:e=>p({...l,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(U,{value:`ws`,children:Rt()}),(0,Z.jsx)(U,{value:`rest`,children:Ke()})]})]})}):null,(0,Z.jsx)($,{label:Pt(),children:(0,Z.jsx)(I,{value:l.gatewayUrl,onChange:e=>p({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:nt(),children:(0,Z.jsx)(I,{value:l.bridgeUrl,placeholder:r(),onChange:e=>p({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:me(),children:(0,Z.jsx)(I,{value:l.displayName,onChange:e=>p({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:be(),children:[(0,Z.jsxs)(K,{value:l.streamTransport,onValueChange:e=>p({...l,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(z,{children:en.map(e=>(0,Z.jsx)(U,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ht()})]}),(0,Z.jsx)($,{label:Be(),children:(0,Z.jsx)(I,{value:l.gatewayVersion,placeholder:Pe(),onChange:e=>p({...l,gatewayVersion:e.target.value})})}),l.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Lt(),children:[(0,Z.jsxs)(K,{value:l.authMode,onValueChange:e=>p({...l,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(U,{value:`token`,children:Ge()}),(0,Z.jsx)(U,{value:`trusted-proxy`,children:ct()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:l.authMode===`trusted-proxy`?yt():dt()})]}),l.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:fe(),children:[(0,Z.jsxs)(K,{value:l.personScopes,onValueChange:e=>p({...l,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(U,{value:`capped`,children:m()}),(0,Z.jsx)(U,{value:`full`,children:g()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:l.personScopes===`full`?Vt():Te()})]}):null,l.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:d(),children:[(0,Z.jsxs)(K,{value:l.identitySource,onValueChange:e=>p({...l,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(U,{value:`canonical`,children:Ce()}),(0,Z.jsx)(U,{value:`email`,children:Gt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:l.identitySource===`email`?Jt():Xe()})]}):null,l.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Oe(),children:[(0,Z.jsxs)(K,{value:l.participantIdentity,onValueChange:e=>p({...l,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(U,{value:`owner`,children:ee()}),(0,Z.jsx)(U,{value:`self`,children:je()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:l.participantIdentity===`self`?pe():c()})]}):null,l.kind===`openclaw`?(0,Z.jsxs)($,{label:Qt(),children:[(0,Z.jsxs)(K,{value:l.managePermissionModes?`on`:`off`,onValueChange:e=>p({...l,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(U,{value:`off`,children:ye()}),(0,Z.jsx)(U,{value:`on`,children:ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:l.managePermissionModes?y():te()})]}):null,l.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:Et(),children:(0,Z.jsx)(I,{value:l.systemIdentity,placeholder:at(),onChange:e=>p({...l,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Le(),children:(0,Z.jsx)(I,{value:l.gatewayHttpUrl,placeholder:ne(),onChange:e=>p({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Tn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),v?(0,Z.jsx)(ln,{instance:v,onClose:()=>b(null)},v._id):null,x?(0,Z.jsx)(gn,{instance:x,onClose:()=>S(null)},x._id):null]})}function gn({instance:e,onClose:t}){let n=f(A.instanceSecrets.listInstanceSecretStatus,{}),r=pn[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)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(G,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(on,{children:ie({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:b()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(yn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(vn,{instance:e})}),(0,Z.jsx)(_n,{instance:e})]})})}function _n({instance:e}){let t=k(A.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(we());break;case`no_agents`:n.success(l());break;case`no_bridge_url`:n.error(xe());break;case`deploy_misconfigured`:n.error(Ut());break;case`unauthorized`:n.error(Kt());break;case`not_served`:n.error(Ft());break;default:n.error(Je());break}}catch(e){n.error(zt(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?h():p()})})]})}function vn({instance:e}){let t=f(A.bridgeAuth.listBridgeAuthStatus,{}),n=k(A.bridgeAuth.mintBridgeSecret),r=D(A.bridgeAuth.revokeBridgeSecret),i=R(),[a,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){s(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(j(),e)}finally{s(!1)}}}async function g(){if(!a){s(!0);try{await r({instanceId:e._id}),l(null),i.success($e())}catch(e){i.error(j(),e)}finally{s(!1)}}}async function _(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:ot(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:m?`outline`:`secondary`,children:m?`${ke()} · ${p.prefix}…${p.lastFour}`:o()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?wt():_t()}),m?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:rt()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ht()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?P():N()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:Ze()})]}):null]})}function yn({instanceId:e,field:t,updatedAt:n}){let r=k(A.instanceSecrets.setInstanceSecret),i=D(A.instanceSecrets.clearInstanceSecret),s=k(A.deviceIdentity.generateDeviceIdentity),c=R(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),v=n!==null,y=t===`deviceIdentity`,b=t===`token`?Me():t===`deviceIdentity`?Ee():S();async function x(){if(!(!l.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),m(null),g(!1),c.success(_())}catch(e){c.error(E(),e)}finally{f(!1)}}}async function C(){if(!d){f(!0);try{await i({instanceId:e,field:t}),m(null),g(!1),c.success(ue())}catch(e){c.error(E(),e)}finally{f(!1)}}}async function ee(){if(!d){f(!0);try{m(await s({instanceId:e})),g(!1),c.success(a())}catch(e){c.error(de(),e)}finally{f(!1)}}}let T=p?`openclaw devices approve ${p.id}`:``;async function te(){if(T)try{await navigator.clipboard.writeText(T),g(!0)}catch{}}return(0,Z.jsxs)($,{label:b,children:[y?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:v?`outline`:`secondary`,children:v?ke():o()}),(0,Z.jsx)(I,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:v?_e():Xt(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void x(),disabled:d||l.trim().length===0,children:oe()}),y?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:d,children:le()}):null,v?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:d,children:w()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:a()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:mt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:h?P():N()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:Ze()})]}):null]})}var bn={conversational:He,documentary:ze,summarizer:he,curator:Fe},xn={conversational:Ie,documentary:re,summarizer:Ve,curator:Re},Sn=e=>(bn[e]??(()=>e))(),Cn=e=>(xn[e]??(()=>``))();function wn({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:Nt()}),t.map(e=>(0,Z.jsx)(L,{variant:`secondary`,className:`oc-agenttype__chip`,title:Cn(e),children:Sn(e)},e)),(0,Z.jsxs)(nn,{children:[(0,Z.jsx)(an,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:tt()})}),(0,Z.jsxs)(tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:i()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ge()}),(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)(J,{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:Sn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Cn(r)})]})]},r)})})]})]})]})}function Tn({instanceName:e,open:t,onOpenChange:n}){let r=f(A.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=D(A.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=D(A.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=D(A.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=fn(r);e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=D(A.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=D(A.agents.removeInstanceAgent),u=rn(),d=R();async function p(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(O(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(O(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){d.error(O(),e)}}async function g(t,n){if(e&&await u({title:x({name:n}),description:Ne(),confirmLabel:De(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(C())}catch(e){d.error(O(),e)}}return(0,Z.jsx)(V,{open:t,onOpenChange:n,children:(0,Z.jsxs)(G,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(on,{children:jt({name:e??``})}),(0,Z.jsx)(W,{children:St()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?s():r.discovery.lastPollOk?Zt():ve({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(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)(J,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void p(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)(L,{variant:`outline`,className:`oc-access__gone`,children:v()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:ae()})]}):i?(0,Z.jsx)(L,{variant:`default`,children:T()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:Ot()})]}),t.enabled?(0,Z.jsx)(wn,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(En,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(O(),e)}}}):null]},t.agentId)})})]})]})})}function En({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)(I,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:kt(),"aria-label":bt(),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{hn as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cq as r,Sq as i,_m as a,aF as o,bq as s,cF as c,dF as l,dm as u,fF as d,fm as f,gm as p,hF as m,hm as h,iF as g,lF as _,mF as v,mm as y,nF as b,oF as x,pF as S,pm as C,rF as w,sF as T,t as E,uF as D,vm as O,ym as k}from"./api-DqQFqhQd.js";import{t as A}from"./button-zBL1A3Z_.js";import{Ht as j,Lt as M,xt as N}from"./index-C6dZsLkz.js";var P=t(e(),1),F=n();function I(){let e=r(E.integrations.status.status,{}),t=i(E.admin.setIntegrationConfig),[n,s]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:m()});let u=n,f=(e,t,n)=>s({...u,[e]:{...u[e],[t]:n}}),p=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,F.jsx)(`strong`,{children:S()}),` `,d()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:l()}):(0,F.jsx)(M,{variant:`outline`,children:D()}):(0,F.jsx)(M,{variant:`outline`,children:_()}),note:c(),children:[(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(j,{value:u.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>p(`langfuse`,{host:u.langfuse.host??``})})}),(0,F.jsx)(z,{label:b(),checked:u.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),p(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:l()}):(0,F.jsx)(M,{variant:`outline`,children:D()}):(0,F.jsx)(M,{variant:`outline`,children:_()}),note:T(),children:[(0,F.jsx)(R,{label:o(),children:(0,F.jsx)(j,{value:u.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>p(`opik`,{baseUrl:u.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:u.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||w(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>p(`opik`,{workspace:u.opik.workspace??``})})}),(0,F.jsx)(z,{label:b(),checked:u.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),p(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:l()}):(0,F.jsx)(M,{variant:`outline`,children:D()}):(0,F.jsx)(M,{variant:`outline`,children:k()}),note:O(),children:[(0,F.jsx)(R,{label:a(),children:(0,F.jsx)(j,{value:u.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>p(`otlp`,{endpoint:u.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:b(),checked:u.otlp.enabled??!0,onChange:e=>{f(`otlp`,`enabled`,e),p(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=s(E.integrations.otlpSecret.setOtlpHeaders),n=i(E.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,c]=(0,P.useState)(null),[l,d]=(0,P.useState)(!1),m=async()=>{d(!0),c(null);try{await t({headersJson:r}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:p(),children:[(0,F.jsx)(j,{value:r,placeholder:e?h():y(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void m(),children:C()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:f()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:u()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,AT as i,Cq as a,DT as o,ET as s,FT as c,HF as l,IT as u,LT as d,MT as f,NT as p,OT as m,PT as h,QF as g,RT as _,TT as ee,UF as te,XF as ne,ZF as v,jT as y,kT as b,t as x,wI as S,zT as C}from"./api-DqQFqhQd.js";import{$n as w,Qn as T,i as E,o as re,r as ie,tt as D}from"./index-C6dZsLkz.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BnvlypuJ.js";import{n as N,t as P}from"./TimeRangePicker-BL1yFs8W.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=a(x.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=a(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,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:S()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:r()}),(0,R.jsx)(j,{children:v()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),o=e=>74-e*68/i,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[l(),` p50 `,B(c.cP50),` `,g()]}),(0,R.jsxs)(`span`,{children:[te(),` p50 `,B(c.aP50),` `,g()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":r(),children:[(0,R.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:_(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:c(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:h(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:p(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=w({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=E(e.from,e.to,ie,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:o,to:s}=N(n),{rowLimit:c,buckets:l}=J(o,s),u=a(x.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),p=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:y()})]}),(0,R.jsx)(Y,{value:n,onChange:r})]});return u===void 0?(0,R.jsxs)(R.Fragment,{children:[p,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}):u.length===0?(0,R.jsxs)(R.Fragment,{children:[p,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]}):(0,R.jsxs)(R.Fragment,{children:[p,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:m({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:o()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:s({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":ee({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,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.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{ae as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$V as i,BK as a,BV as o,Cq as s,Ds as c,FV as l,GK as u,GV as d,HK as f,HV as p,IK as ee,IV as m,JK as te,JV as h,KK as g,KV as ne,LK as re,LV as ie,MV as ae,Ms as oe,NV as se,Ns as ce,PV as le,QK as ue,QV as de,RK as fe,RV as _,Sq as v,UK as pe,UV as me,VK as he,VV as y,WK as b,WV as x,XK as S,XV as C,YK as w,YV as T,ZK as E,ZV as D,_s as O,aH as k,aq as A,cH as j,cq as M,dH as N,eH as P,eq as F,fH as I,fs as L,gH as R,gs as ge,hH as _e,hs as ve,iH as ye,iN as be,iq as xe,jV as Se,lH as Ce,mH as we,ms as Te,nH as Ee,nq as De,oH as Oe,pH as ke,pq as Ae,ps as je,qK as Me,qV as Ne,r as z,rH as Pe,rq as Fe,sH as Ie,t as B,tH as Le,tq as Re,uH as ze,vs as Be,ys as Ve,zK as He,zV as Ue}from"./api-DqQFqhQd.js";import{t as V}from"./button-zBL1A3Z_.js";import{Bt as We,H as Ge,Ht as H,Lt as U,Rt as Ke,Vt as qe,ct as Je,dt as Ye,lt as W,st as Xe,t as Ze,tt as G,ut as Qe,xt as K,zt as $e}from"./index-C6dZsLkz.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-CnH4Mhn1.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:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>R()},{id:`composer`,label:()=>_e()},{id:`sidebar`,label:()=>we()},{id:`notifications`,label:()=>D()},{id:`other`,label:()=>ke()}],X={showSource:{category:`messages`,label:()=>I(),help:()=>N()},showReport:{category:`messages`,label:()=>ze(),help:()=>Ce()},copyAssistant:{category:`messages`,label:()=>j()},copyUser:{category:`messages`,label:()=>Ie()},showDelete:{category:`messages`,label:()=>Oe()},showTools:{category:`messages`,label:()=>k(),help:()=>ye()},voiceInput:{category:`composer`,label:()=>Pe(),help:()=>Ee()},showUsage:{category:`composer`,label:()=>Le(),help:()=>P()},autoReadAloud:{category:`composer`,label:()=>ce(),help:()=>oe()},showChatAge:{category:`sidebar`,label:()=>i(),help:()=>de()},notifSound:{category:`notifications`,label:()=>C(),help:()=>T()},notifSystem:{category:`notifications`,label:()=>h(),help:()=>Ne()},replySound:{category:`notifications`,label:()=>ne(),help:()=>d()}};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:()=>l()};function ut({prefKey:e,ui:t}){let n=v(B.admin.setUiPrefDefault),r=v(B.admin.setFeatureEnabled),i=ct(e),a=i?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:Ue()}),(0,J.jsxs)(Xe,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Qe,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ye,{})}),(0,J.jsxs)(Je,{children:[(0,J.jsx)(W,{value:`on`,children:se()}),(0,J.jsx)(W,{value:`off`,children:ae()}),(0,J.jsx)(W,{value:`inherit`,children:Se()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":_()}),_()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=v(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=We(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Ve(),e?(0,J.jsx)(U,{variant:`secondary`,children:qe(e,$e())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?ge():r?O():Be()})]}),(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:L()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?je():e?Te():ve()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=s(B.me.getMe,{host:G}),a=i?.ui,l=$(i?.role)&&n,u=v(B.me.setUiPref).withOptimisticUpdate(Ge),d=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":o()}),o()]}):null,l?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ie()}),(0,J.jsx)(`p`,{children:m()}),(0,J.jsx)(`p`,{children:le()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:x(),"aria-label":x(),className:`mb-2`}),d.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:me()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:d.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],s=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(U,{variant:`outline`,children:p()}):s?(0,J.jsx)(U,{variant:`secondary`,children:c()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void u({key:e,value:null}),children:y()}):null,(0,J.jsx)(nt,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),u({key:e,value:t})},"aria-label":n})]}),l?(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:Ae()})}var pt={sm:()=>Me(),md:()=>g(),lg:()=>u(),xl:()=>b(),"2xl":()=>pe(),"3xl":()=>f()};function mt(){let e=s(B.me.getMe,{host:G}),t=v(B.me.setLocale),n=v(B.me.setTimezone),i=v(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:G});n&&e.setQuery(B.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),o=v(B.me.setMyName),c=Ke(),l=e?.locale??`default`,u=e?.name??``,[d,f]=(0,q.useState)(null),p=d??u,m=p.trim()!==u.trim();async function h(){try{await o({name:p}),f(null),c.success(Re())}catch(e){c.error(F(),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:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:p,maxLength:120,placeholder:Fe(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!m,onClick:()=>void h(),children:be()})]}),(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:r()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:l==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:M()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(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:he()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(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:He()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:S()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(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 i({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(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:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(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{$C as r,$w as i,Aw as a,Ba as o,Bw as s,Cq as c,Cw as l,Dw as u,E as d,Ew as ee,Fw as f,Kw as p,Lw as m,Mw as h,Nw as g,Ow as _,Pw as te,Qw as ne,Rw as re,Sq as v,Sw as y,Tw as b,Uw as ie,Vw as x,Yw as ae,_w as oe,aw as S,bw as se,cT as ce,cw as C,ew as w,gw as le,hw as ue,iw as T,jw as de,kw as fe,mw as pe,nT as me,nw as he,oT as ge,ow as E,pq as D,qw as _e,rw as O,sT as ve,t as k,tT as A,tw as ye,uw as be,ux as xe,ww as Se,xw as Ce,yC as we,yw as Te,za as Ee,zw as De}from"./api-DqQFqhQd.js";import{r as Oe}from"./dist-DOeV8fIc.js";import{t as ke}from"./list-CnEuXouq.js";import{t as j}from"./button-zBL1A3Z_.js";import{$n as Ae,A as M,An as N,Bn as je,C as P,D as Me,Dn as Ne,E as Pe,En as Fe,Gt as F,Hn as Ie,Ht as Le,I as Re,Jn as I,Jt as ze,Kt as Be,Ln as L,M as Ve,Mn as He,N as Ue,Nn as We,O as Ge,On as Ke,P as R,Q as qe,Qn as z,Rn as Je,Rt as Ye,S as Xe,T as Ze,Ut as Qe,Vn as $e,Wt as et,Z as tt,_ as nt,at as B,b as rt,d as it,er as V,f as H,g as at,h as ot,it as U,j as W,k as st,nt as ct,ot as lt,p as ut,qt as dt,rt as ft,v as G,vn as pt,w as K,x as q,y as mt,zn as ht}from"./index-C6dZsLkz.js";var gt=d(`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`}]]),_t=d(`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`}]]),vt=d(`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`}]]),J=d(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function yt({className:e}){return(0,X.jsx)(ze,{asChild:!0,children:(0,X.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":E(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(Ie,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=v(k.projects.renameProject),s=v(k.projects.setProjectColor),l=v(k.projects.moveProject),u=v(k.projects.deleteProject),d=v(k.projects.createProject),ee=tt(),f=ot(),m=qe(),[h,g]=(0,Y.useState)(!1),[_,re]=(0,Y.useState)(t),[y,b]=(0,Y.useState)(!1),[x,ae]=(0,Y.useState)(!1),oe=c(k.projects.projectTreeCount,x?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Qe,{onOpenChange:e=>e&&ae(!0),children:[(0,X.jsx)(yt,{className:i}),(0,X.jsxs)(et,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(F,{onSelect:()=>a(),children:[(0,X.jsx)(ht,{}),` `,ie()]}),(0,X.jsxs)(F,{onSelect:()=>{re(t),g(!0)},children:[(0,X.jsx)(Ke,{}),` `,S()]}),(0,X.jsxs)(F,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:te(),label:ce(),placeholder:ve(),confirmLabel:ge()});t&&await d({name:t,parentId:e})})},children:[(0,X.jsx)(Je,{}),` `,te()]}),(0,X.jsxs)(F,{onSelect:()=>b(!0),children:[(0,X.jsx)(_t,{}),` `,le()]}),(0,X.jsx)(Be,{children:he()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e,color:null}),"aria-label":ye(),children:`✕`}),nt.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void s({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(dt,{}),(0,X.jsxs)(F,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=oe?.folders??0,r=oe?.chats??0;await ee({title:p({name:t}),description:ut({folders:n,chats:r,days:f}),confirmWord:C(),confirmLabel:_e(),destructive:!0})&&await u({projectId:e})})},children:[(0,X.jsx)(pt,{}),` `,C()]})]})]}),(0,X.jsx)(rt,{open:h,onOpenChange:g,title:ne(),canSubmit:_.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:_.trim()}),g(!1)},submitLabel:S(),children:(0,X.jsx)(Le,{value:_,onChange:e=>re(e.target.value),autoFocus:!0})}),y?(0,X.jsx)(at,{open:y,onOpenChange:b,title:pe(),movingFolderId:e,currentId:r,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function bt({chat:e,currentFolderId:t,className:n}){let i=v(k.chats.pinChat),a=v(k.chats.deleteChat),o=v(k.chats.renameChat),c=v(k.chats.setChatSidebar),l=v(k.chats.moveChatToProject),u=tt(),d=ot(),[ee,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(e.title??``),[h,g]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Qe,{children:[(0,X.jsx)(yt,{className:n}),(0,X.jsxs)(et,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(F,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,X.jsx)(Ke,{}),` `,S()]}),(0,X.jsxs)(F,{onSelect:()=>void i({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(Fe,{}):(0,X.jsx)(Ne,{}),e.pinned?T():O()]}),(0,X.jsxs)(F,{onSelect:()=>g(!0),children:[(0,X.jsx)(_t,{}),` `,oe()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(F,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(N,{}):(0,X.jsx)(J,{}),e.inSidebar?s():x()]}),(0,X.jsx)(dt,{}),(0,X.jsxs)(F,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:w(),description:r({days:d}),confirmLabel:C(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,X.jsx)(pt,{}),` `,C()]})]})]}),(0,X.jsx)(rt,{open:ee,onOpenChange:f,title:we(),canSubmit:p.trim().length>0,onSubmit:async()=>{await o({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:S(),children:(0,X.jsx)(Le,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),h?(0,X.jsx)(at,{open:h,onOpenChange:g,title:ue(),currentId:t,onPick:t=>void l({chatId:e._id,projectId:t})}):null]})}function xt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function St(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 Ct(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 wt=`oc.projpage.view`;function Tt(){let e=localStorage.getItem(wt);return e===`cards`||e===`list`?e:`columns`}var Q=e=>`into:${e}`,Et=e=>`col:${e??`null`}`,$=e=>`crumb:${e}`;function Dt(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 Ot(){let{projectId:e}=V({from:`/project/$projectId`}),t=z(),n=c(k.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:D()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:y()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:Ce()}),(0,X.jsx)(j,{variant:`outline`,onClick:()=>void t({to:`/`}),children:se()})]}):(0,X.jsx)(kt,{page:n})})}function kt({page:e}){let t=z(),n=tt(),r=ot(),s=qe(),u=Ye(),d=v(k.projects.renameProject),h=v(k.projects.setProjectColor),g=v(k.projects.deleteProject),_=v(k.projects.createProject),y=v(k.projects.moveProject),ie=v(k.projects.setProjectSidebar),x=v(k.chats.moveChatToProject),ae=v(k.chats.reorderChat),oe=v(k.projects.reorderProject),se=c(k.projects.projectTreeCount,{projectId:e.project._id}),[w,ue]=(0,Y.useState)(Tt),T=e=>{localStorage.setItem(wt,e),ue(e)},E=c(k.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),D=c(k.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:O}=Ae({from:`/project/$projectId`}),A=c(k.projects.listProjects,{}),Ce=c(k.chatReads.myBusyChats,{}),we=(0,Y.useMemo)(()=>new Set(Ce??[]),[Ce]),{byChat:Oe}=lt(Ce??null),N=c(k.chatReads.myChatReads,{}),P=(0,Y.useMemo)(()=>Ct(e.chats,N??[]),[e.chats,N]),{startNewChat:Ne,picker:Fe}=it(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[I,R]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(!1),[H,W]=(0,Y.useState)(e.project.name),[G,ht]=(0,Y.useState)(!1),[J,yt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>yt(I.trim()),180);return()=>clearTimeout(e)},[I]);let Z=c(k.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),bt=Ue(Ve(Me,{activationConstraint:{distance:4}}),Ve(Ge,{activationConstraint:{delay:250,tolerance:8}})),Q=(0,Y.useRef)(!1),Et=()=>{Q.current=!0,setTimeout(()=>{Q.current=!1},0)},[$,Ot]=(0,Y.useState)(null),kt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=E?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||me()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).find(t=>t._id===e)?.name??``}}return null},Mt=e=>Ot(kt(String(e.active.id))),Pt=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=M(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=M(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=M(n(`crumb:`));if(a.length>0)return a;let o=M(n(`col:`));return o.length>0?o:st(n(t?`folder:`:`chat:`))},[]),It=t=>{if(w===`columns`){for(let e of E?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=D?.chats.find(e=>e._id===t);return e?{list:D.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},Lt=t=>{if(w===`columns`){for(let e of E?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=D?.folders.find(e=>e._id===t);if(!e||!D)return null;let n=e.parentId??D.rootId;return{list:ft(D.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{Ot(null),Et();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=Dt(r);if(e!==void 0){if(a)await x({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ct(A??[],t,e)){u.error(f());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=It(t);if(!n)return;n.list.some(t=>t._id===e)||await x({chatId:e,projectId:n.folderId});let a=St(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ae({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!ct(A??[],e,n.parentId)){u.error(f());return}await y({projectId:e,parentId:n.parentId})}let a=St(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await oe({projectId:e,...a});return}}catch{u.error(f())}},[,Bt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=mt(e.project),Ut=xt(e.chats,I),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{Q.current||e()};return(0,X.jsx)(U.Provider,{value:Oe,children:(0,X.jsxs)(Ze,{sensors:bt,collisionDetection:Pt,onDragStart:Mt,onDragEnd:zt,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":Te(),children:[Wt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(At,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(j,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:o(),onClick:()=>{ie({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)($e,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Ee()}),(0,X.jsx)(je,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":De(),children:[(0,X.jsx)(j,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":De(),title:De(),"aria-pressed":w===`cards`,onClick:()=>T(`cards`),children:(0,X.jsx)(vt,{})}),(0,X.jsx)(j,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":re(),title:re(),"aria-pressed":w===`columns`,onClick:()=>T(`columns`),children:(0,X.jsx)(gt,{})}),(0,X.jsx)(j,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":m(),title:m(),"aria-pressed":w===`list`,onClick:()=>T(`list`),children:(0,X.jsx)(ke,{})})]}),(0,X.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void Ne({projectId:e.project._id}),children:[(0,X.jsx)(We,{}),fe()]}),(0,X.jsxs)(j,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await s({title:te(),label:ce(),placeholder:ve(),confirmLabel:ge()});t&&await _({name:t,parentId:e.project._id})},children:[(0,X.jsx)(Je,{}),te()]}),(0,X.jsxs)(Qe,{children:[(0,X.jsx)(ze,{asChild:!0,children:(0,X.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),children:(0,X.jsx)(Ie,{})})}),(0,X.jsxs)(et,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(F,{onSelect:()=>{W(e.project.name),V(!0)},children:[(0,X.jsx)(Ke,{}),` `,S()]}),(0,X.jsxs)(F,{onSelect:()=>ht(!0),children:[(0,X.jsx)(_t,{}),` `,le()]}),(0,X.jsx)(Be,{children:he()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void h({projectId:e.project._id,color:null}),"aria-label":ye(),children:`✕`}),nt.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void h({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(dt,{}),(0,X.jsxs)(F,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=se?.folders??0,o=se?.chats??0;await n({title:p({name:e.project.name}),description:ut({folders:a,chats:o,days:r}),confirmWord:C(),confirmLabel:_e(),destructive:!0})&&(await g({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,X.jsx)(pt,{}),` `,C()]})]})]})]})]}),w===`columns`?(0,X.jsx)(Rt,{data:E,currentId:e.project._id,busyIds:we,suppressClick:Q,locateChatId:O??null}):w===`list`?(0,X.jsx)(Ft,{data:D,busyIds:we,suppressClick:Q,locateChatId:O??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:de()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:Xe,children:e.children.map(t=>(0,X.jsx)(jt,{child:t,parentId:e.project._id,now:Vt,suppressClick:Q},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:a()}),e.chats.length>0?(0,X.jsx)(Le,{value:I,onChange:e=>R(e.target.value),placeholder:ee(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?Se():l()}):Ut.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b({term:I.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(q,{items:Ut.map(e=>`chat:${e._id}`),strategy:K,children:Ut.map(t=>(0,X.jsx)(Nt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:we.has(t._id),unread:P.has(t._id),locate:t._id===O,suppressClick:Q},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:be()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Re(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(He,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||xe()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(rt,{open:B,onOpenChange:V,title:ne(),canSubmit:H.trim().length>0,onSubmit:async()=>{await d({projectId:e.project._id,name:H.trim()}),V(!1)},submitLabel:S(),children:(0,X.jsx)(Le,{value:H,onChange:e=>W(e.target.value),autoFocus:!0})}),G?(0,X.jsx)(at,{open:G,onOpenChange:ht,title:pe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void y({projectId:e.project._id,parentId:t})}):null,Fe]}),(0,X.jsx)(Pe,{children:$?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[$.kind===`folder`?(0,X.jsx)(L,{size:13,"aria-hidden":!0}):(0,X.jsx)(He,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:$.label})]}):null})]})})}function At({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=W({id:$(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function jt({child:e,parentId:t,now:n,suppressClick:r}){let i=z(),a=P({id:`folder:${e._id}`}),o=W({id:Q(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":mt(e),transform:R.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(L,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?_({count:e.folderCount})+` · `:``,u({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:H(e.lastActivityAt,n)})]})}function Mt({chat:e}){let t=v(k.chats.setChatSidebar),n=e.inSidebar?s():x();return(0,X.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(N,{}):(0,X.jsx)(J,{})})}function Nt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,Y.useContext)(U).get(e._id),c=z(),l=G(e.color),u=P({id:`chat:${e._id}`}),d=Pt(a);return(0,X.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:R.Transform.toString(u.transform),transition:u.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||me()}),e.pinned?(0,X.jsx)(Ne,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:H(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:B(s,A()).className,title:B(s,A()).label,"aria-label":B(s,A()).label}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:ae(),"aria-label":ae()}):null]}),(0,X.jsx)(Mt,{chat:e}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Pt(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ft({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:D()});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=ft(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:K,children:u.map(e=>(0,X.jsx)(Lt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:K,children:d.map(t=>(0,X.jsx)(It,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&ft(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:Se()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=z(),c=P({id:`folder:${e._id}`}),l=W({id:Q(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":mt(e),transform:R.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?g():h(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(I,{size:13}):(0,X.jsx)(Oe,{size:13})}),(0,X.jsx)(L,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{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 Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,Y.useContext)(U).get(e._id),o=z(),s=P({id:`chat:${e._id}`}),c=Pt(r),l=G(e.color);return(0,X.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:R.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||me()}),n?(0,X.jsx)(`span`,{className:B(a,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Mt,{chat:e})]})}function Rt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:D()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(zt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function zt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=z(),s=W({id:Et(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:K,children:e.folders.map(t=>(0,X.jsx)(Bt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:K,children:e.chats.map(t=>(0,X.jsx)(Vt,{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,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:l()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=P({id:`folder:${e._id}`}),o=W({id:Q(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":mt(e),transform:R.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(L,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,Y.useContext)(U).get(e._id),s=P({id:`chat:${e._id}`}),c=Pt(r),l=G(e.color);return(0,X.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:R.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||me()}),n?(0,X.jsx)(`span`,{className:B(o,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(Mt,{chat:e})]})}export{Ot as ProjectPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$f as i,$u as a,Cq as o,ED as s,Ia as c,Qu as l,Sl as u,Sq as d,TD as f,Zu as p,_D as m,aD as h,bl as g,cD as _,cd as v,dD as y,dd as b,eD as x,ed as S,ep as C,fD as w,gD as T,hD as E,iD as D,lD as ee,ld as te,mD as ne,nD as re,np as ie,oD as ae,pD as oe,rD as O,rp as k,sD as A,t as j,tD as M,td as N,tp as P,uD as F,ud as I,vD as L,xl as R}from"./api-DqQFqhQd.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-DJKixX2U.js";import{t as U}from"./button-zBL1A3Z_.js";import{Rt as se,an as W,ct as G,dt as K,in as ce,lt as q,nn as J,rn as le,st as Y,tt as ue,ut as X,xt as de}from"./index-C6dZsLkz.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:oe,help:w},documentary_fetch:{label:y,help:F},inbound_files:{label:ee,help:_},history_summary:{label:k,help:ie},file_curation:{label:b,help:N},quote_reply:{label:I,help:te}},he={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.`},ge={outboundDir:M,references:x,files:r,previous_summary:P,new_messages:C,max_chars:i,file_name:S,budget_chars:a,feedback:l,content:p,excerpt:v};function _e(){let e=o(j.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:L(),help:m()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:A()}),(0,$.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(X,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(K,{})}),(0,$.jsx)(G,{children:e.map(e=>(0,$.jsx)(q,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=d(j.admin.upsertInstanceConfig),n=se(),r=o(j.me.getMe,{host:ue}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[c,l]=(0,Q.useState)(()=>z(i,a));(0,Q.useEffect)(()=>{l(z(i,a))},[a,e._id]);let[p,m]=(0,Q.useState)(!1),h=c.promptInjections,_=(e,t)=>l({...c,promptInjections:{...h,[e]:{...h[e],...t}}});async function v(){m(!0);try{await t({instanceId:e._id,config:V(c,i,a)})}catch(e){n.error(f(),e)}finally{m(!1)}}async function y(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(f(),e)}}let b=e.config?.contentLocale??`default`,x=fe[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:u()}),(0,$.jsxs)(Y,{value:b,onValueChange:e=>void y(e),children:[(0,$.jsx)(X,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(K,{})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(q,{value:`default`,children:g({locale:x})}),pe().map(e=>(0,$.jsx)(q,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:R()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:h[e]??{enabled:!0,template:J[e].defaultTemplate[a]},contentLocale:a,onChange:t=>_(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void v(),disabled:p,children:s()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=ce(e,r,i),p=f?W(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:E()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ne()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?D():h()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:T()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:O()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:c()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:re()})})]})}export{_e as PromptInjectionsTab};
|