@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{BA as e,HA as t,RA as n,VA as r,zA as i}from"./api-DqQFqhQd.js";var a={pending:t,user:r,admin:e,observer:i,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-DqQFqhQd.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t}from"./bundle-mjs-C73ZY4La.js";import{_q as n,jq as r,kq as i,wq as a,xq as o}from"./api-DqQFqhQd.js";var s=t(e(),1),c=(e,t,n)=>r=>{let i={...r.queries},a=r.nextPageKey,o=r.nextPageKey+1,s=r.nextPageKey+2;i[a]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,endCursor:t}}},i[o]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,cursor:t,endCursor:n}}};let c={...r.ongoingSplits};return c[e]=[a,o],{...r,nextPageKey:s,queries:i,ongoingSplits:c}},l=e=>t=>{let n=t.ongoingSplits[e];if(n===void 0)return t;let r={...t.queries};delete r[e];let i={...t.ongoingSplits};delete i[e];let a=t.pageKeys.slice(),o=t.pageKeys.findIndex(t=>t===e);return o>=0&&(a=[...t.pageKeys.slice(0,o),...n,...t.pageKeys.slice(o+1)]),{...t,queries:r,pageKeys:a,ongoingSplits:i}};function u(e,t,n){let{user:r}=p(e,t,n,!0);return r}var d=Symbol(`includePageKeys`),f=Symbol(`page`);function p(e,t,u,p=!0){if(typeof u?.initialNumItems!=`number`||u.initialNumItems<0)throw Error(`\`options.initialNumItems\` must be a positive number. Received \`${u?.initialNumItems}\`.`);let m=t===`skip`,g=m?{}:t,_=a(e),v=(0,s.useMemo)(()=>()=>{let t=h();return{query:e,args:g,id:t,nextPageKey:1,pageKeys:m?[]:[0],queries:m?{}:{0:{query:e,args:{...g,paginationOpts:{numItems:u.initialNumItems,cursor:null,id:t}}}},ongoingSplits:{},skip:m}},[JSON.stringify(r(g)),_,u.initialNumItems,m]),[y,b]=(0,s.useState)(v),x=y;(a(e)!==a(y.query)||JSON.stringify(r(g))!==JSON.stringify(r(y.args))||m!==y.skip)&&(x=v(),b(x));let S=o().logger,C=n(x.queries),w=u[d]??!1,[T,E,D]=(0,s.useMemo)(()=>{let e,t=[];for(let n of x.pageKeys){if(e=C[n],e===void 0)break;if(e instanceof Error){if(e.message.includes(`InvalidCursor`)||e instanceof i&&typeof e.data==`object`&&e.data?.isConvexSystemError===!0&&e.data?.paginationError===`InvalidCursor`)return S.warn(`usePaginatedQuery hit error, resetting pagination state: `+e.message),b(v),[[],void 0,void 0];if(p)throw e;return[t,void 0,e]}let r=x.ongoingSplits[n];if(r===void 0?e.splitCursor&&(e.pageStatus===`SplitRecommended`||e.pageStatus===`SplitRequired`||e.page.length>u.initialNumItems*2)&&b(c(n,e.splitCursor,e.continueCursor)):C[r[0]]!==void 0&&C[r[1]]!==void 0&&b(l(n)),e.pageStatus===`SplitRequired`)return[t,void 0,void 0];t.push(...w?e.page.map(e=>({...e,[f]:n.toString()})):e.page)}return[t,e,void 0]},[C,x.pageKeys,x.ongoingSplits,u.initialNumItems,v,S,w,p]);return{user:{results:T,...(0,s.useMemo)(()=>{if(D!==void 0)return{status:`Error`,isLoading:!1,error:D,loadMore:()=>{}};if(E===void 0)return x.nextPageKey===1?{status:`LoadingFirstPage`,isLoading:!0,loadMore:()=>{}}:{status:`LoadingMore`,isLoading:!0,loadMore:e=>{}};if(E.isDone)return{status:`Exhausted`,isLoading:!1,loadMore:e=>{}};let e=E.continueCursor,t=!1;return{status:`CanLoadMore`,isLoading:!1,loadMore:n=>{t||(t=!0,b(t=>{let r=[...t.pageKeys,t.nextPageKey],i={...t.queries};return i[t.nextPageKey]={query:t.query,args:{...t.args,paginationOpts:{numItems:n,cursor:e,id:t.id}}},{...t,nextPageKey:t.nextPageKey+1,pageKeys:r,queries:i}}))}}},[D,E,x.nextPageKey])},internal:{state:x}}}var m=0;function h(){return m++,m}export{u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e}from"./api-DqQFqhQd.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|
package/dist/index.html
CHANGED
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
document.documentElement.dataset.motion = "static";
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
|
-
<script type="module" crossorigin src="/assets/index-
|
|
65
|
+
<script type="module" crossorigin src="/assets/index-C6dZsLkz.js"></script>
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-DqQFqhQd.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DzCn4zAa.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-SxrQHF8N.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DOeV8fIc.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DawSOQGU.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/x-BVM46c6P.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/button-zBL1A3Z_.js">
|
|
74
74
|
<link rel="stylesheet" crossorigin href="/assets/index-Dwpglqo3.css">
|
|
75
75
|
</head>
|
|
76
76
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.89.
|
|
3
|
+
"version": "0.89.1",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ay as r,bq as i,cy as a,dy as o,fy as s,hy as c,iy as l,ly as u,my as d,ny as f,oy as p,py as m,ry as h,sy as g,t as _,ty as v,uq as y,uy as b}from"./api-DfVtzU1G.js";import{Lt as x,ct as S,dt as C,lt as w,st as T,ut as E}from"./index-B0MXmi3m.js";var D=t(e(),1);function O(e){return e===`user`?r():e===`all`?l():h({group:e.group})}function k(e){return e===`common`?f():e===`owner`?v():h({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(_.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=i(_.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":d(),children:(0,A.jsx)(C,{placeholder:d()})}),(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:m()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(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:s()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.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:b()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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:p()}):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:u()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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:a()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1,3 +0,0 @@
|
|
|
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,Dd as c,Dg as l,Ed as u,Eg as d,Fg as f,Gg as p,Gu as m,Hg as h,Ig as g,Ju as _,Kg as v,Ku as y,Lg as b,Md as x,Mg as S,N_ as C,Ng as w,Od as ee,Og as te,Pg as T,Rg as E,Sd as D,Sg as O,So as ne,Td as k,Tg as A,Ug as j,Vg as re,Wg as ie,Wu as M,Xu as N,Yu as P,_d as F,_q as I,bd as L,bg as R,bq as z,fd as B,fq as V,gd as H,hd as ae,j_ as oe,jd as se,jg as U,kd as ce,kg as W,md as le,pd as ue,qg as de,qu as fe,t as G,uq as K,vd as pe,vg as me,wd as he,wg as ge,xR as _e,xd as ve,xg as ye,yd as be,yg as xe,yq as Se,zg as Ce}from"./api-DfVtzU1G.js";import{t as q}from"./button-BWdRKrS3.js";import{At as we,Ft as Te,G as Ee,It as De,Lt as Oe,Mt as ke,Nt as Ae,Pt as je,Rt as J,_n as Y,_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-B0MXmi3m.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-ChkOVx0F.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=z(G.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=z(G.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=z(G.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),l=z(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(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(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,s,r,l]),[d,m]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&m($(u[0]))},[u,d]);let _=u?.find(e=>$(e)===d)??null,y=I(G.agentFiles.listAgentFiles),[x,S]=(0,X.useState)({status:`idle`}),C=_?.instanceName??null,w=_?.agentId??null,te=z(G.compat.forInstance,n&&C!==null?{instanceName:C}:`skip`),T=n&&C!==null?Ee(te,`agentFiles`):null,D=T===null?!1:T===`loading`?null:T.blocked,O=(0,X.useCallback)(async()=>{if(!(C===null||w===null)){S({status:`loading`});try{S({status:`done`,files:(await y({instanceName:C,agentId:w})).files})}catch(e){S({status:`error`,dashboardAbsent:tt(e)})}}},[y,C,w]);(0,X.useEffect)(()=>{D===!1&&O()},[O,D]);let[k,A]=(0,X.useState)(null),M=z(G.agentFileCuration.listCurations,t&&C!==null&&w!==null?{instanceName:C,agentId:w}:`skip`),N=z(G.agentFileCuration.curationSettings,t&&C!==null?{instanceName:C}:`skip`),P=I(G.agentFileCuration.requestCuration),[F,L]=(0,X.useState)(null),[R,B]=(0,X.useState)(null),{toast:H}=J(),ae=(0,X.useMemo)(()=>{let e=new Map;for(let t of M??[])e.has(t.name)||e.set(t.name,t);return e},[M]),se=(0,X.useCallback)(async e=>{if(!(C===null||w===null)){L(e);try{let t=await P({instanceName:C,agentId:w,name:e,trigger:`manual`});t.ok?H({title:ce(),variant:`success`}):H({title:ee({reason:t.reason??`unknown`}),variant:`error`})}catch{H({title:c(),variant:`error`})}finally{L(null)}}},[P,C,w,H]),U=V(),W=(0,X.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||u===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:de()}),(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":v(),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,u.length>0?(0,Q.jsxs)(He,{value:d??``,onValueChange:e=>m(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":p(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(Ne,{children:u.map(e=>(0,Q.jsx)(ze,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]}),_===null?null:T===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:K()}):T!==null&&T.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(T.gatewayVersion,T.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?ne():h(),` `,!x.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:oe()})]}):x.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children: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)(Oe,{variant:`outline`,children:re()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:a({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:Ce({pct:W.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":E()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>A(e),children:t?g():f()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:N?.budgetChars??null,enabled:N?.enabled??!1,curation:ae.get(e.name)??null,inFlight:F===e.name,onCurate:()=>void se(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:b({used:Z(Qe(x.files),U),total:Z(Ye,U),pct:W.format(Ze(Qe(x.files)))})})]}),k&&_?(0,Q.jsx)(at,{instanceName:_.instanceName,agentId:_.agentId,name:k.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void O()}):null,R?(0,Q.jsx)(ot,{curationId:R,onClose:()=>B(null),onApplied:()=>{B(null),O()}}):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)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:se()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Oe,{variant:`outline`,className:`oc-afiles__curate-status`,children:r()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:x()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let c=I(G.agentFiles.getAgentFile),u=I(G.agentFiles.setAgentFile),f=J(),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1),[x,ee]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),[ne,k]=(0,X.useState)(!1),j=(0,X.useCallback)(async r=>{g(!1);try{let i=await c({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||v(i.content),D(!1)}catch{g(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{j(!1)},[j]);async function re(){if(p!==null){ee(!0),k(!1);try{await u({instanceName:e,agentId:t,name:n,content:_,baseUpdatedAtMs:p.updatedAtMs??void 0}),f.success(te({name:n})),o(),await j(!1)}catch(e){nt(e)?D(!0):k(!0)}finally{ee(!1)}}}let ie=p!==null&&_!==p.content,M=(0,X.useMemo)(()=>p===null?null:et(p.content,_),[p,_]),N=_.length>Je,P=V(),F=(0,X.useMemo)(()=>new Intl.NumberFormat(P),[P]);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:T({name:n})}),(0,Q.jsxs)(Be,{children:[w({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,S()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[d(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void j(!1),children:oe()})]}):p===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:_,readOnly:!r,spellCheck:!1,onChange:e=>v(e.target.value),"aria-label":T({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:U()}),E?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[A(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void j(!0),children:ge()})]}):null,ne?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:l()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:i({count:F.format(_.length),max:F.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!ie||x||E,onClick:()=>b(!0),children:x?C():W()}):null]})]}),(0,Q.jsx)(Re,{open:y,onOpenChange:b,children:(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(De,{children:s({name:n})}),(0,Q.jsx)(Ae,{children:O({agent:t})})]}),M?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ye({added:M.added,removed:M.removed})}),M.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:R()}),M.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,M.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:xe()}),M.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Le,{children:_e()}),(0,Q.jsx)(we,{onClick:()=>void re(),children:me()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=z(G.agentFileCuration.getProposal,{curationId:e}),i=I(G.agentFileCuration.approveCuration),a=Se(G.agentFileCuration.rejectCuration),{toast:s}=J(),[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),v=V(),b=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function x(){d(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:u(),variant:`success`}),n()):s({title:t.reason===`conflict`?he():o({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:c(),variant:`error`})}finally{d(null)}}async function S(n){d(`reject`);try{let r=h.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?m():k(),variant:`success`}):s({title:L(),variant:`error`}),t()}catch{s({title:c(),variant:`error`})}finally{d(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?D({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:L()}):(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)(Y,{size:13,"aria-hidden":!0}),` `,pe()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:F({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:M({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:B()}),(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:ue()}),(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:H()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),f?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:N()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:P(),value:h,onChange:e=>g(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>p(!1),disabled:l!==null,children:_()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void S(!1),disabled:l!==null,children:l===`reject`?C():fe()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void S(!0),disabled:l!==null,children:l===`reject`?C():y()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>p(!0),disabled:l!==null||r==null,children:ae()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void x(),disabled:l!==null||r==null,children:l===`approve`?C():le()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,Ak as i,Bk as ee,CA as a,Fk as o,Gk as te,Hk as ne,Ik as s,Jk as c,Kk as re,Lk as l,Mk as u,Nk as d,Pk as f,Qk as ie,Rk as ae,SA as oe,TA as p,Uk as se,Vk as ce,Wk as le,Xk as ue,Yk as m,Zk as h,_A as de,aA as fe,bA as g,bq as _,cA as pe,dA as me,eA as he,fA as ge,gA as _e,hA as ve,iA as ye,jk as v,lA as be,mA as xe,nA as y,oA as Se,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,yq as j,zk as Ce}from"./api-DfVtzU1G.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 De,lt as z,o as Oe,pt as B,st as V,tt as ke,ut as H,yt as U}from"./index-B0MXmi3m.js";import{n as Ae}from"./TimeRangePicker-es8qiYT0.js";import{t as je}from"./FilterBar-CJwP10CI.js";import{t as Me}from"./DataTableShell-REGK6Dqj.js";import{t as W}from"./dispatchErrorInfo-CpWqaJBx.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?p():e===`acknowledged`?O():a()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,J=`all`;function Y(){let e=we({from:`/settings/anomalies`}),t=N({from:`/settings/anomalies`}),n=e.q??``,i=e.status===J?q:e.status,a=e.severity??q,o=e.kind??q,[s,l]=(0,G.useState)(q),u=De(e.from,e.to),{from:d,to:f}=Ae(u),p=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),v=e=>void t({search:t=>({...t,status:e===q?J:e})}),O=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),P=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),L=e=>void t({search:t=>({...t,...Oe(e)})}),R=Ee(),B=Te(),W=j(w.anomalies.resolveAnomaly),Y=(_(w.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=_(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:d,to:f,anomalyStatus:i===q?void 0:i,severity:a===q?void 0:a,source:s===q?void 0:s,kind:o===q?void 0:o}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||i!==`open`||a!==q||s!==q||o!==q||u.kind!==`relative`||u.from!==Le.from;function Ue(){l(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await R({title:oe(),description:(0,K.jsxs)(K.Fragment,{children:[k(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,g(),` `,(0,K.jsx)(`strong`,{children:A()}),`.`,` `,D()]}),confirmLabel:de()}))try{await W({anomalyId:e._id,status:`resolved`}),B.success(_e(),e.kind)}catch(e){B.error(ve(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),B.success(xe(),e.kind)}catch(e){B.error(b(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[ge(),` `,(0,K.jsx)(`strong`,{children:me()}),` `,E(),` `,(0,K.jsx)(`strong`,{children:be()}),` `,pe(),` `,(0,K.jsx)(`strong`,{children:C()}),` `,Se(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:fe()})]}),(0,K.jsxs)(je,{q:n,onQChange:p,searchPlaceholder:ye(),timeRange:u,onTimeRangeChange:L,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(V,{value:i,onValueChange:v,children:[(0,K.jsx)(H,{size:`sm`,className:`w-36`,children:(0,K.jsx)(I,{})}),(0,K.jsxs)(F,{children:[(0,K.jsx)(z,{value:q,children:S()}),Ne.map(e=>(0,K.jsx)(z,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(V,{value:a,onValueChange:O,children:[(0,K.jsx)(H,{size:`sm`,className:`w-36`,children:(0,K.jsx)(I,{placeholder:y()})}),(0,K.jsxs)(F,{children:[(0,K.jsx)(z,{value:q,children:ie()}),Fe.map(e=>(0,K.jsx)(z,{value:e,children:e},e))]})]}),(0,K.jsxs)(V,{value:s,onValueChange:l,children:[(0,K.jsx)(H,{size:`sm`,className:`w-32`,children:(0,K.jsx)(I,{placeholder:h()})}),(0,K.jsxs)(F,{children:[(0,K.jsx)(z,{value:q,children:ue()}),Ie.map(e=>(0,K.jsx)(z,{value:e,children:e},e))]})]}),(0,K.jsxs)(V,{value:o,onValueChange:P,children:[(0,K.jsx)(H,{size:`sm`,className:`w-36`,children:(0,K.jsx)(I,{placeholder:m()})}),(0,K.jsxs)(F,{children:[(0,K.jsx)(z,{value:q,children:c()}),Z.map(e=>(0,K.jsx)(z,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:x(),rows:X,emptyHint:i===`open`?re():te(),rowActions:e=>Y&&e.status===`open`?[{label:le(),onSelect:()=>void We(e)},{label:se(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ne(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:U(e.at)}),sort:e=>e.at},{header:m(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:T(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:r({when:U(e.firstAt)}),children:he({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:y(),cell:e=>(0,K.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ce(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:h(),cell:e=>(0,K.jsx)(M,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ee(),cell:e=>(0,K.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,K.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:Ce(),cell:e=>(0,K.jsx)($,{row:e}),sort:e=>e.evidence??null},{header:ae(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var X=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Z(e){if(!X.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function $({row:e}){let t=N();if(e.kind===`subagent.failure`){let n=Q(e);return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,l()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,l()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,l()]}):null]})}function ze({row:e}){let[t,n]=(0,G.useState)(!1),r=_(w.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[s(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(L,{open:t,onOpenChange:n,children:(0,K.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(P,{children:o()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,K.jsx)(M,{variant:`destructive`,children:u()}):e===`acknowledged`?(0,K.jsx)(M,{variant:`secondary`,children:v()}):(0,K.jsx)(M,{variant:`outline`,children:i()})}function He(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aj as r,Cj as i,Dj as a,Ej as o,Gl as s,Hl as c,Kl as l,Oj as u,Sj as d,Tj as f,Ul as p,Vl as m,Wl as h,_j as g,bj as _,bq as v,jj as y,kj as b,t as x,vj as S,wj as C,xj as w,yj as T}from"./api-DfVtzU1G.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-B0MXmi3m.js";import{n as ee}from"./TimeRangePicker-es8qiYT0.js";import{t as z}from"./FilterBar-CJwP10CI.js";import{t as B}from"./AdvancedFilter-DEwJUkfT.js";import{t as V}from"./DataTableShell-REGK6Dqj.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:l()},{value:`realLabel`,label:s()},{value:`targetLabel`,label:h()},{value:`impersonated`,label:p()},{value:`resource`,label:c()},{value:`resourceId`,label:m()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,s=e.action??G,c=e.impersonated??G,l=e.resource??G,p=j(e.from,e.to),m=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:h,to:N}=ee(p),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}),$=v(x.admin.listAudit,{filter:{q:n||void 0,from:h,to:N,action:s===G?void 0:s,resource:l===G?void 0:l,impersonated:c===G?void 0:c===`yes`,advanced:m.length>0?m: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!==``||s!==G||c!==G||l!==G||m.length>0||p.kind!==`relative`||p.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:[y(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:b(),timeRange:p,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(I,{value:s,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(A,{placeholder:u()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(M,{value:G,children:a()}),te.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:c,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:o()}),(0,U.jsx)(M,{value:`yes`,children:f()}),(0,U.jsx)(M,{value:`no`,children:C()})]})]}),(0,U.jsxs)(I,{value:l,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(A,{placeholder:i()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(M,{value:G,children:d()}),ne.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:m,onChange:Q}),(0,U.jsx)(V,{title:w(),rows:$,emptyHint:_(),columns:[{header:T(),cell:e=>R(e.at),sort:e=>e.at},{header:u(),cell:e=>e.action,sort:e=>e.action},{header:S(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:i(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,DD as d,DE as f,E as p,ED as ee,EE as m,FE as te,GE as ne,HE as re,IE as ie,JE as ae,KE as oe,LE as h,ME as g,NE as _,OE as v,PE as y,QT as b,Qh as se,RE as ce,SD as le,SE as ue,TD as de,TE as fe,UE as pe,VE as me,WE as he,Wh as ge,XT as x,Xh as _e,Yh as ve,ZT as ye,Zh as be,_D as xe,_E as Se,_q as Ce,aE as we,ag as Te,bD as Ee,bE as De,bq as S,cE as Oe,cl as ke,dE as Ae,dl as je,eE as Me,eg as Ne,fE as Pe,fl as Fe,gD as Ie,gE as Le,hE as Re,hl as ze,iE as Be,ig as Ve,jE as He,kD as Ue,kE as We,lE as Ge,ll as Ke,mE as qe,nE as Je,na as Ye,ng as Xe,oE as Ze,og as Qe,pE as $e,qE as et,rE as tt,rg as nt,sE as rt,sg as it,t as C,tE as at,tg as ot,uE as w,ul as st,vE as ct,wD as lt,wE as ut,xD as dt,xE as ft,yE as pt,yq as mt,zE as ht}from"./api-DfVtzU1G.js";import{r as T}from"./dist-D8270q9m.js";import{t as gt}from"./chevrons-up-down-RHDK4dlM.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-CFBfL_GK.js";import{t as xt}from"./button-BWdRKrS3.js";import{$n as St,Fn as Ct,Ht as D,J as wt,Jn as O,Kn as k,L as Tt,Lt as A,Qn as Et,Rt as Dt,X as Ot,Xt as kt,Y as At,Yt as jt,Zt as Mt,_n as j,_t as Nt,bt as M,ct as N,dt as P,ft as Pt,gt as Ft,lt as F,mt as It,pt as Lt,q as Rt,qn as zt,st as I,tt as Bt,ut as L,xn as Vt,xt as Ht,yt as R}from"./index-B0MXmi3m.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-CVSQWo7b.js";import{t as Gt}from"./FilterBar-CJwP10CI.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-ChkOVx0F.js";import{t as W}from"./dispatchErrorInfo-CpWqaJBx.js";var $t=p(`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=p(`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,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(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]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:Ae(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(P,{placeholder:Ge()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(F,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(F,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(P,{placeholder:Oe()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(F,{value:J,children:w()}),l.map(e=>(0,Z.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(P,{placeholder:rt()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(F,{value:J,children:w()}),u.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:we(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Be(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:tt(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Je(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:at(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(B,{children:Me()}),(0,Z.jsx)(Q,{label:r(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(V,{children:d.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)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(gt,{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:$e({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:M(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?` · ${M(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:[Ye({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${M(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:[Pe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${M(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?b():e===`error`?ye():x()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(A,{variant:`secondary`,children:b()}):e===`error`?(0,Z.jsx)(A,{variant:`destructive`,children:ye()}):(0,Z.jsx)(A,{variant:`outline`,children:x()})}function wn(){return S(C.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=S(C.compat.getBridgeCompat,{}),n=S(C.me.getMe,{host:Bt})?.role===`admin`,r=S(C.admin.listInstances,n?{}:`skip`),i=S(C.agents.usageForInstances,n?{}:`skip`),a=Et(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=St({from:`/settings/bridge`}),l=Et({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=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:_()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:Fe()}),(0,Z.jsx)(B,{children:je()}),(0,Z.jsx)(B,{children:st()}),(0,Z.jsx)(B,{children:Ke()}),(0,Z.jsx)(B,{children:ke()})]})}),(0,Z.jsx)(V,{children:i.flatMap(e=>{let t=Tt(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)(A,{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)(Rt,{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)(At,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(Ot,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Vt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(wt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):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:Te(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Ve({build:t.buildVersion??`?`})]}):null,` · `,nt(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?Xe():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ut()});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),p=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)(k,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(j,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?l():c===`gateways_unreachable`?pt({count:u.length}):s?ue():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}),` `,De({time:f})]}),p?(0,Z.jsx)(`span`,{children:Se({time:p})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ct({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:Le()})]})}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)(Vt,{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)(A,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:it()}),(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)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),Re({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)(A,{variant:`destructive`,children:o({count:i.length})}):a>0?(0,Z.jsx)(A,{variant:`destructive`,children:We()}):(0,Z.jsx)(A,{variant:`secondary`,children:He()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[v({version:e.vendoredVersion}),r?` · `+f({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)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),m({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:a,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ze({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:i({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:Xe()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.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)(A,{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)(Pt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Nt,{children:a({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:Ue()})]}),(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)(k,{"aria-hidden":!0}):(0,Z.jsx)(j,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?ce():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,h()]}):null}function jn({instance:e,onClose:t}){let n=mt(C.admin.upsertInstanceConfig),r=Ce(C.bridge.validateMediaPaths),i=Dt(),a=Ut(e.config?.contentLocale,void 0),[o,l]=(0,G.useState)(()=>_t(e.config??{},a)),[u,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(re(),e)}finally{m(!1)}}async function se(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(le(),e)}finally{f(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:d(),help:dt()}),(0,Z.jsxs)(I,{value:o.mediaMode,onValueChange:e=>l({...o,mediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(P,{})}),(0,Z.jsx)(N,{children:bt.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ee(),help:Ee()}),(0,Z.jsxs)(I,{value:o.inboundMediaMode,onValueChange:e=>l({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(P,{})}),(0,Z.jsx)(N,{children:vt.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:de(),help:xe()}),(0,Z.jsx)(D,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>l({...o,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)(E,{label:ae(),help:et()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>l({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:oe(),help:ne()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>l({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Ht,{checked:o.rehydration,onCheckedChange:e=>l({...o,rehydration:e===!0})}),(0,Z.jsx)(E,{label:lt(),help:Ie()})]}),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)(j,{"aria-hidden":!0}),te({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:s(),result:h.inbound}),(0,Z.jsx)($,{label:ht(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:me()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),ie()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?pe():he()]}),(0,Z.jsx)(xt,{size:`sm`,onClick:()=>void se(),disabled:u,children:c()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(Mt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?se():be({count:e.length}),(0,Z.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(kt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:_e()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(A,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AP as i,BP as a,CP as o,DP as s,EP as c,FP as l,GP as u,HP as d,IP as ee,Id as f,JP as p,KP as m,LP as te,MP as ne,NP as re,OP as ie,PP as h,QN as g,RP as _,Rd as v,SP as y,TP as ae,UP as b,VP as x,WP as S,XN as C,XP as w,YN as T,YP as E,ZN as D,ZP as O,_P as k,aP as A,bP as j,bq as M,cP as N,dP as P,eP as F,fP as I,gP as L,hP as R,iP as z,jP as B,kP as V,lP as H,mP as U,nP as W,oP as oe,pP as G,qP as K,rP as q,sP as se,t as J,tP as ce,uP as le,vP as ue,wP as de,xP as fe,yP as pe,yq as Y,zP as me}from"./api-DfVtzU1G.js";import{t as he}from"./button-BWdRKrS3.js";import{Z as ge,yt as _e}from"./index-B0MXmi3m.js";import{t as ve}from"./DataTableShell-REGK6Dqj.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>O(),incorrect:()=>w(),incoherence:()=>E(),formatting:()=>p(),latency:()=>K(),api_error:()=>m(),other:()=>u()},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:b()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:d()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:S()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,u=Y(J.feedback.respondToFeedback),[d,f]=(0,X.useState)(e.thread),[p,m]=(0,X.useState)(``),[g,b]=(0,X.useState)(!1);async function S(){let t=p.trim();if(!(!t||g)){b(!0);try{await u({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{b(!1)}}}let C=[];try{C=r.contextJson?JSON.parse(r.contextJson):[]}catch{C=[]}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?` · ${x()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:R(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(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:ce()}),(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:me()}),d.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:d.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`?_():e.authorRole===`agent`?e.authorLabel??v():te()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ee()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:p,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void S(),disabled:!p.trim()||g,children:g?h():re()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||B()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||B()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,C.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie({count:r.contextCount??C.length,truncated:r.contextTruncated?s():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:C.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:c()}),(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:ae()}),(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:de()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?o({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:[y(),` `,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=M(J.feedback.listForAdmin,{}),t=Y(J.feedback.readSnapshot),n=Y(J.feedback.deleteFeedback),i=ge(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function u(e){await i({title:D(),description:C(),confirmLabel:T(),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:[j(),` `,(0,Z.jsx)(`strong`,{children:pe()}),` `,ue()]}),(0,Z.jsx)(ve,{title:k(),rows:e,emptyHint:L(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:U(),cell:e=>_e(e.at),sort:e=>e.at},{header:G(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:I(),cell:e=>e.messageRole===`user`?P():le(),sort:e=>e.messageRole},{header:H(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${N({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:se(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:oe(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:q()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:W()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?F():r(),onSelect:()=>void l(e)},{label:g(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,AK as ee,CK as te,DK as i,EK as ne,Hd as a,OK as o,QG as re,SK as ie,TK as ae,Vd as s,XG as c,ZG as l,_K as u,aK as d,bK as f,bq as oe,cK as se,dK as ce,eK as le,fK as ue,fq as de,gK as p,hK as m,iK as h,jK as fe,kK as pe,lK as me,mK as g,nK as he,oK as ge,pK as _e,rK as ve,sK as ye,t as _,tK as be,uK as xe,uq as v,vK as y,wK as b,xK as x,xR as S,yK as C,yq as w}from"./api-DfVtzU1G.js";import{t as T}from"./button-BWdRKrS3.js";import{At as E,Cn as D,Ft as O,Gt as k,Hn as A,It as j,Jt as M,Lt as N,Mt as Se,Nt as Ce,Pt as we,Rt as Te,Un as P,Ut as Ee,Wt as De,ct as F,dt as I,jt as Oe,kt as ke,lt as L,st as R,ut as z,vn as Ae,xt as je}from"./index-B0MXmi3m.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CVSQWo7b.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return f();case`audio`:return C();case`video`:return y();case`pdf`:return u();case`document`:return p();case`archive`:return m();default:return g()}}function q(){let[e,t]=(0,U.useState)(G),[n,u]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[m,g]=(0,U.useState)(G),[y,C]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=w(_.files.softDelete),Y=Te();function Ie(){t(G),u(G),p(G),g(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(ve())}catch(e){Y.error(he(),e)}}let X=oe(_.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:f===G?void 0:f,category:m===G?void 0:m,includeAutoGenerated:y||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(de(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:v()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||f!==G||m!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(R,{value:e,onValueChange:t,children:[(0,W.jsx)(z,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(I,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(L,{value:G,children:pe()}),(0,W.jsx)(L,{value:`inbound`,children:o()}),(0,W.jsx)(L,{value:`outbound`,children:i()})]})]}),(0,W.jsxs)(R,{value:n,onValueChange:u,children:[(0,W.jsx)(z,{size:`sm`,"aria-label":ne(),children:(0,W.jsx)(I,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(L,{value:G,children:ae()}),Q.chats.map(e=>(0,W.jsx)(L,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(R,{value:f,onValueChange:p,children:[(0,W.jsx)(z,{size:`sm`,"aria-label":b(),children:(0,W.jsx)(I,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(L,{value:G,children:te()}),Q.instances.map(e=>(0,W.jsx)(L,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(R,{value:m,onValueChange:g,children:[(0,W.jsx)(z,{size:`sm`,"aria-label":ie(),children:(0,W.jsx)(I,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(L,{value:G,children:x()}),Q.categories.map(e=>(0,W.jsx)(L,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(je,{checked:y,onCheckedChange:e=>C(e===!0),"aria-label":a()}),(0,W.jsx)(`span`,{children:a()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(D,{size:14,"aria-hidden":!0}),ge()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?l():re()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:_e()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{children:xe()}),(0,W.jsx)(B,{children:me()}),(0,W.jsx)(B,{className:`text-right`,children:se()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(N,{variant:`outline`,style:{marginLeft:6},children:s()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(N,{variant:`secondary`,children:e.direction===`inbound`?o():i()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ee,{children:[(0,W.jsx)(M,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":d(),children:(0,W.jsx)(A,{size:16})})}),(0,W.jsxs)(De,{align:`end`,children:[e.url?(0,W.jsx)(k,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(P,{size:14}),ye()]})}):(0,W.jsxs)(k,{disabled:!0,children:[(0,W.jsx)(P,{size:14}),r()]}),(0,W.jsxs)(k,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ae,{size:14}),h()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:c({cap:Be})}):null]}),(0,W.jsx)(ke,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Se,{children:[(0,W.jsxs)(O,{children:[(0,W.jsx)(j,{children:be()}),(0,W.jsx)(Ce,{children:le()})]}),(0,W.jsxs)(we,{children:[(0,W.jsx)(Oe,{children:S()}),(0,W.jsx)(E,{onClick:()=>void Le(),children:h()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,Cv as s,Dv as c,E as l,Ev as u,Fv as d,G_ 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 ee,Ov as S,Pv as C,Q_ as w,Qv as te,Rv as T,Sv as E,Tv as D,Uv as ne,Vv as O,Wv as k,X_ as A,Xv as re,Y_ as j,Yv as M,Z_ as N,Zv as P,_v as ie,av as ae,bq as F,bv as I,cv as L,dv as R,ev as oe,ey as se,fv as ce,gv as z,hv as le,iv as ue,jv as de,kv as fe,lv as pe,mv as me,nv as he,ov as ge,pv as _e,q_ as ve,qv as ye,rv as be,sv as xe,t as B,tv as Se,uv as Ce,vv as we,wv as Te,xv as Ee,yq as V,yv as De,zv as Oe}from"./api-DfVtzU1G.js";import{t as ke}from"./x-CrZwGtLz.js";import{t as H}from"./button-BWdRKrS3.js";import{Ht as U,J as W,Jn as Ae,Lt as G,Rt as K,X as q,Y as je,Yn as Me,Z as Ne,_t as Pe,b as Fe,bn as J,ct as Ie,dt as Le,ft as Re,gt as ze,hn as Be,lt as Ve,mt as He,pt as Ue,q as We,st as Ge,tt as Ke,ut as qe,xn as Y,xt as X,yn as Je}from"./index-B0MXmi3m.js";import{t as Ye}from"./FilterBar-CJwP10CI.js";import{t as Xe}from"./DataTableShell-REGK6Dqj.js";import{t as Z}from"./DetailChips-Dhiulk-F.js";var Ze=l(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return Ee();case`user`:return I();case`pending`:return De();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=F(B.groups.listGroups,{}),t=F(B.me.getMe,{host:Ke})?.role===`admin`,n=V(B.groups.createGroup),r=V(B.groups.updateGroup),a=V(B.groups.deleteGroup),s=Ne(),c=K(),[l,u]=(0,Q.useState)(!1),[f,v]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(it),[w,E]=(0,Q.useState)(null),[D,A]=(0,Q.useState)(``),j=(0,Q.useMemo)(()=>{if(!e)return e;let t=D.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,D]);function N(){v(null),S(it),u(!0)}function ie(e){v(e),S({name:e.name,description:e.description??``}),u(!0)}async function ae(){try{f?await r({groupId:f._id,name:x.name,description:x.description}):await n({name:x.name,description:x.description||void 0}),S(it),v(null),u(!1)}catch(e){c.error(g(),e)}}async function I(e){if(await s({title:d({name:e.name}),description:C(),confirmWord:e.name,confirmLabel:ee(),cancelLabel:O(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(ve(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,$.jsx)(Ye,{q:D,onQChange:A,onReset:()=>A(``),canReset:D!==``,searchPlaceholder:y()}),(0,$.jsx)(Xe,{title:se(),rows:j,addLabel:te(),onAdd:t?N:void 0,emptyHint:P(),columns:[{header:re(),cell:e=>e.name,sort:e=>e.name},{header:M(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Be,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(J,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:_(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Y,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ye(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(Je,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:p(),onSelect:()=>E({groupId:e._id,name:e.name})},...t?[{label:k(),onSelect:()=>ie(e)},{label:ne(),variant:`destructive`,onSelect:()=>void I(e)}]:[]]}),(0,$.jsx)(Fe,{open:l,onOpenChange:u,title:f?Oe():o(),description:T(),canSubmit:!!x.name.trim(),onSubmit:ae,submitLabel:m(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,$.jsx)(U,{value:x.name,onChange:e=>S({...x,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,$.jsx)(U,{value:x.description,onChange:e=>S({...x,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:w?.groupId??null,groupName:w?.name??``,open:w!==null,onOpenChange:e=>{e||E(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Me,{size:14,"aria-hidden":!0}),Te()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":E({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[s(),(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=F(B.groups.getGroup,n&&e?{groupId:e}:`skip`),s=F(B.groups.listAssignableInstances,n?{}:`skip`),l=F(B.groups.listAssignableUsers,n?{}:`skip`),d=V(B.groups.addMember),f=V(B.groups.removeMember),p=V(B.groups.bulkSetMembers),m=V(B.groups.setGroupManager),h=K(),[g,_]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[ee,C]=(0,Q.useState)(`members`),[te,T]=(0,Q.useState)(1),[E,ne]=(0,Q.useState)(new Set),O=(0,Q.useRef)(null),k=(0,Q.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),re=(0,Q.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),j=o?.viewerIsAdmin===!0,M=(0,Q.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Q.useEffect)(()=>{_(``),b(``),C(`members`),T(1),O.current=null},[n,e]),(0,Q.useEffect)(()=>{T(1)},[g]),(0,Q.useEffect)(()=>{n&&o&&e&&O.current!==e&&(O.current=e,ne(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let P=(0,Q.useMemo)(()=>l?Qe(l,g,E):[],[l,g,E]);async function ie(t,n){if(e)try{n?await f({groupId:e,userId:t}):await d({groupId:e,userId:t})}catch(e){h.error(v(),e)}}async function ae(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(A(),e)}}let I=nt(P,e=>k.has(e.userId)),L=P.filter(e=>k.has(e.userId)).length,R=rt(P,te,ot);async function oe(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:I!==`all`})}catch(e){h.error(v(),e)}}return(0,$.jsx)(Re,{open:n,onOpenChange:i,children:(0,$.jsxs)(Ue,{className:`oc-access`,children:[(0,$.jsxs)(ze,{children:[(0,$.jsx)(Pe,{children:x({name:t})}),(0,$.jsx)(He,{children:de()})]}),(0,$.jsxs)(We,{value:ee,onValueChange:C,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(q,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Be,{size:13,"aria-hidden":!0}),a(),o?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(q,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Y,{size:13,"aria-hidden":!0}),S(),o?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(q,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),xe(),o?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,$.jsx)(W,{value:`members`,children:l===void 0||o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:me()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{value:g,onChange:e=>_(e.target.value),placeholder:fe(),className:`oc-access__search`}),P.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:u()}):(0,$.jsxs)($.Fragment,{children:[P.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(X,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void oe(),"aria-label":D()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:D()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[L,` / `,P.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=k.has(e.userId),n=et(e),i=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(X,{checked:t,onCheckedChange:()=>void ie(e.userId,t),"aria-label":we({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&j?(0,$.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?N():w(),title:i?N():w(),onClick:()=>void ae(e.userId,i),children:(0,$.jsx)(J,{size:15,"aria-hidden":!0})}):t&&i?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":r(),title:r(),children:(0,$.jsx)(J,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:T})]})]})}),(0,$.jsx)(W,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{value:y,onChange:e=>b(e.target.value),placeholder:c(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:y},`${e}-${t._id}`))})]})}),(0,$.jsx)(W,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=F(B.groups.listAssignableAgents,{instanceName:t}),o=V(B.groups.assignAgentToGroup),s=V(B.groups.removeAgentFromGroup),c=V(B.groups.bulkSetGroupAgents),l=K(),[u,d]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{d(1)},[i]),!e)return null;let p=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(p,u,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(f(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(f(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(Y,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:Ce()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:le()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?R():ce()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(X,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":D()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:D()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(X,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":ie({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":L(),title:L(),children:(0,$.jsx)(Je,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:pe()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=F(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=V(B.charts.assignChartToGroup),r=V(B.charts.removeChartFromGroup),i=V(B.charts.setGroupDefaultChart),a=V(B.charts.addChartToGroupPool),o=V(B.charts.removeChartFromGroupPool),s=K();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ge()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(X,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":he({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Se(),title:Se(),children:(0,$.jsx)(Je,{size:14,fill:`currentColor`})}):(0,$.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:oe()}):null,u?(0,$.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":be({name:e.name}),title:be({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,$.jsx)(ke,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Ge,{value:``,onValueChange:e=>void p(e),children:[(0,$.jsx)(qe,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Le,{placeholder:ue()})}),(0,$.jsx)(Ie,{children:l.map(e=>(0,$.jsx)(Ve,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,Ca as u,DM as d,Da as f,EM as p,Ea as m,FM as h,Fj as g,Ft as _,GM as ee,Gj as v,HM as y,Hj as b,Ht as x,IM as S,Ij as C,It as w,JM as te,Jj as T,KM as ne,Kj as re,LM as ie,Lj as ae,Lt as oe,MM as se,Mj as ce,NM as le,Nj as ue,OM as de,Oa as fe,PM as pe,Pj as me,Pt as he,QM as ge,Qf as _e,Qj as ve,RM as E,Rj as ye,Rt as be,SM as xe,Sa as Se,TM as Ce,Ta as we,UM as Te,Uj as Ee,Ut as De,VM as Oe,Vj as ke,Vt as Ae,WM as je,Wj as Me,XM as Ne,Xf as Pe,Xj as Fe,YM as Ie,Yf as Le,Yj as Re,ZM as ze,Zf as Be,Zj as Ve,_M as He,_N as Ue,_a as We,_l as Ge,_q as D,aM as O,aN as Ke,bM as qe,bN as Je,ba as Ye,bq as k,cM as Xe,cN as Ze,dM as Qe,dN as $e,eM as et,eN as tt,fM as nt,fN as rt,fa as it,gB as A,gM as at,gN as ot,ga as st,hB as ct,hM as lt,hN as ut,ha as dt,iM as ft,iN as pt,jM as mt,kM as ht,lM as gt,lN as _t,mM as vt,mN as yt,ma as bt,nM as j,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 M,tN as Nt,uM as Pt,uN as Ft,vD as It,vM as Lt,vN as Rt,va as zt,vl as Bt,wM as Vt,wa as Ht,xM as Ut,xN as Wt,xa as Gt,yD as Kt,yM as qt,yN as Jt,ya as Yt,yl as Xt,yq as N,zM as Zt,zj as Qt,zt as $t}from"./api-DfVtzU1G.js";import{a as en,c as tn}from"./FieldLabel-CFBfL_GK.js";import{t as P}from"./button-BWdRKrS3.js";import{Ht as F,Lt as I,Rt as L,Xt as nn,Yt as rn,Z as an,Zt as on,_t as R,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 cn}from"./index-B0MXmi3m.js";import{t as ln}from"./DataTableShell-REGK6Dqj.js";import{InstanceConfigDialog as un}from"./BridgeTab-rI4MFNcQ.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],dn=new Set(Y),fn=`conversational`;function pn(e){let t=new Set((e??[]).filter(e=>dn.has(e)));return t.size===0?[fn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:en},mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function hn(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 gn(){let e=k(M.admin.listInstances,{}),t=k(M.agents.listAllInstanceAgents,{}),n=N(M.admin.upsertInstance),i=N(M.admin.deleteInstance),a=L(),[o,s]=(0,J.useState)(!1),[l,d]=(0,J.useState)(Z),[p,h]=(0,J.useState)(null),[g,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(null),[S,C]=(0,J.useState)(null);async function T(){try{await n({instanceId:S??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}),d(Z),C(null),s(!1)}catch(e){a.error(Jt(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[Rt(),(0,X.jsx)(`strong`,{children:Ue()}),ot()]}),(0,X.jsx)(ln,{title:ut(),rows:e,addLabel:yt(),onAdd:()=>{C(null),d(Z),s(!0)},emptyHint:Tt(),columns:[{header:rt(),cell:e=>e.name,sort:e=>e.name},{header:$e(),cell:e=>(0,X.jsx)(I,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ft(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:_t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Wt(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(I,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ue():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ke(),onSelect:()=>{C(e._id),d(hn(e)),s(!0)}},{label:Je(),onSelect:()=>h(e.name)},{label:je(),onSelect:()=>b(e)},{label:Ze(),onSelect:()=>v(e)},{label:Mt(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:Mt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,X.jsx)(sn,{open:o,onOpenChange:s,title:S?pt():Ct(),description:xt(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:T,submitLabel:Nt(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:tt(),children:[(0,X.jsx)(F,{value:l.name,disabled:S!==null,onChange:e=>d({...l,name:e.target.value})}),S?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:At()}):null]}),(0,X.jsx)($,{label:r(),children:(0,X.jsxs)(K,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(U,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(U,{value:`hermes`,children:`Hermes`})]})]})}),l.kind===`hermes`?(0,X.jsx)($,{label:Xt(),children:(0,X.jsxs)(K,{value:l.transport,onValueChange:e=>d({...l,transport:e}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(U,{value:`ws`,children:Bt()}),(0,X.jsx)(U,{value:`rest`,children:Ge()})]})]})}):null,(0,X.jsx)($,{label:ge(),children:(0,X.jsx)(F,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:ze(),children:(0,X.jsx)(F,{value:l.bridgeUrl,placeholder:Ne(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:Ie(),children:(0,X.jsx)(F,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,X.jsxs)($,{label:Kt(),children:[(0,X.jsxs)(K,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsx)(z,{children:tn.map(e=>(0,X.jsx)(U,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:It()})]}),(0,X.jsx)($,{label:te(),children:(0,X.jsx)(F,{value:l.gatewayVersion,placeholder:Dt(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),l.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:zt(),children:[(0,X.jsxs)(K,{value:l.authMode,onValueChange:e=>d({...l,authMode:e}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(U,{value:`token`,children:We()}),(0,X.jsx)(U,{value:`trusted-proxy`,children:st()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:l.authMode===`trusted-proxy`?bt():dt()})]}),l.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:fe(),children:[(0,X.jsxs)(K,{value:l.personScopes,onValueChange:e=>d({...l,personScopes:e}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(U,{value:`capped`,children:f()}),(0,X.jsx)(U,{value:`full`,children:m()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:l.personScopes===`full`?Ht():we()})]}):null,l.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:u(),children:[(0,X.jsxs)(K,{value:l.identitySource,onValueChange:e=>d({...l,identitySource:e}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(U,{value:`canonical`,children:Se()}),(0,X.jsx)(U,{value:`email`,children:Gt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:l.identitySource===`email`?Yt():Ye()})]}):null,l.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:De(),children:[(0,X.jsxs)(K,{value:l.participantIdentity,onValueChange:e=>d({...l,participantIdentity:e}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(U,{value:`owner`,children:x()}),(0,X.jsx)(U,{value:`self`,children:Ae()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:l.participantIdentity===`self`?he():c()})]}):null,l.kind===`openclaw`?(0,X.jsxs)($,{label:$t(),children:[(0,X.jsxs)(K,{value:l.managePermissionModes?`on`:`off`,onValueChange:e=>d({...l,managePermissionModes:e===`on`}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-full`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(U,{value:`off`,children:be()}),(0,X.jsx)(U,{value:`on`,children:oe()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:l.managePermissionModes?_():w()})]}):null,l.authMode===`trusted-proxy`?(0,X.jsx)($,{label:Et(),children:(0,X.jsx)(F,{value:l.systemIdentity,placeholder:it(),onChange:e=>d({...l,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:ne(),children:(0,X.jsx)(F,{value:l.gatewayHttpUrl,placeholder:ee(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(Tn,{instanceName:p,open:p!==null,onOpenChange:e=>{e||h(null)}}),g?(0,X.jsx)(un,{instance:g,onClose:()=>v(null)},g._id):null,y?(0,X.jsx)(_n,{instance:y,onClose:()=>b(null)},y._id):null]})}function _n({instance:e,onClose:t}){let n=k(M.instanceSecrets.listInstanceSecretStatus,{}),r=mn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(G,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(H,{children:[(0,X.jsx)(R,{children:Te({instance:e.displayName??e.name})}),(0,X.jsx)(W,{children:y()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(bn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(yn,{instance:e})}),(0,X.jsx)(vn,{instance:e})]})})}function vn({instance:e}){let t=D(M.instanceSync.forceInstanceSync),n=L(),[r,i]=(0,J.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(xe());break;case`no_agents`:n.success(qe());break;case`no_bridge_url`:n.error(qt());break;case`deploy_misconfigured`:n.error(Lt());break;case`unauthorized`:n.error(at());break;case`not_served`:n.error(lt());break;default:n.error(He());break}}catch(e){n.error(Ut(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:vt()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?l():Vt()})})]})}function yn({instance:e}){let t=k(M.bridgeAuth.listBridgeAuthStatus,{}),n=D(M.bridgeAuth.mintBridgeSecret),r=N(M.bridgeAuth.revokeBridgeSecret),i=L(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(jt(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Xe())}catch(e){i.error(jt(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:wt(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(I,{variant:f?`outline`:`secondary`,children:f?`${E()} · ${d.prefix}…${d.lastFour}`:ie()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(P,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Pt():Qe()}),f?(0,X.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:gt()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:St()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?A():ct()})]}),(0,X.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:O()})]}):null]})}function bn({instanceId:e,field:t,updatedAt:n}){let r=D(M.instanceSecrets.setInstanceSecret),i=N(M.instanceSecrets.clearInstanceSecret),s=D(M.deviceIdentity.generateDeviceIdentity),c=L(),[l,u]=(0,J.useState)(``),[f,m]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[ee,v]=(0,J.useState)(!1),y=n!==null,b=t===`deviceIdentity`,x=t===`token`?Oe():t===`deviceIdentity`?o():Zt();async function C(){if(!(!l.trim()||f)){m(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),_(null),v(!1),c.success(se())}catch(e){c.error(mt(),e)}finally{m(!1)}}}async function w(){if(!f){m(!0);try{await i({instanceId:e,field:t}),_(null),v(!1),c.success(a())}catch(e){c.error(mt(),e)}finally{m(!1)}}}async function te(){if(!f){m(!0);try{_(await s({instanceId:e})),v(!1),c.success(d())}catch(e){c.error(Ce(),e)}finally{m(!1)}}}let T=g?`openclaw devices approve ${g.id}`:``;async function ne(){if(T)try{await navigator.clipboard.writeText(T),v(!0)}catch{}}return(0,X.jsxs)($,{label:x,children:[b?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(I,{variant:y?`outline`:`secondary`,children:y?E():ie()}),(0,X.jsx)(F,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:y?h():S(),onChange:e=>u(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(P,{size:`sm`,onClick:()=>void C(),disabled:f||l.trim().length===0,children:pe()}),b?(0,X.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:f,children:ht()}):null,y?(0,X.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void w(),disabled:f,children:le()}):null]})]}),g?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:d()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:ee?A():ct()})]}),(0,X.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{_(null),v(!1)},children:O()})]}):null]})}var xn={conversational:T,documentary:re,summarizer:_e,curator:Pe},Sn={conversational:Ot,documentary:v,summarizer:Be,curator:Le},Cn=e=>(xn[e]??(()=>e))(),Q=e=>(Sn[e]??(()=>``))();function wn({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ve()}),t.map(e=>(0,X.jsx)(I,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:Cn(e)},e)),(0,X.jsxs)(rn,{children:[(0,X.jsx)(on,{asChild:!0,children:(0,X.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ve()})}),(0,X.jsxs)(nn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Fe()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Re()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(cn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Cn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function Tn({instanceName:e,open:t,onOpenChange:n}){let r=k(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=N(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=N(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=N(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=pn(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=N(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=N(M.agents.removeInstanceAgent),u=an(),d=L();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(j(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(j(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){d.error(j(),e)}}async function h(t,n){if(e&&await u({title:b({name:n}),description:ke(),confirmLabel:s(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(Qt())}catch(e){d.error(j(),e)}}return(0,X.jsx)(V,{open:t,onOpenChange:n,children:(0,X.jsxs)(G,{className:`oc-access`,children:[(0,X.jsxs)(H,{children:[(0,X.jsx)(R,{children:ft({name:e??``})}),(0,X.jsx)(W,{children:kt()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:ye()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ae():r.discovery.lastPollOk?C():g({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:me()}):(0,X.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,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(cn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I,{variant:`outline`,className:`oc-access__gone`,children:ce()}),(0,X.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:Ee()})]}):i?(0,X.jsx)(I,{variant:`default`,children:ue()}):(0,X.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:Me()})]}),t.enabled?(0,X.jsx)(wn,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(En,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(j(),e)}}}):null]},t.agentId)})})]})]})})}function En({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let a=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(F,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:et(),"aria-label":i(),onChange:e=>r(e.target.value),onBlur:a,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{gn as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,_m as i,_q as a,aF as o,bq as s,cF as c,dF as l,dm as u,eF as d,fF as f,fm as p,gm as m,hm as h,iF as g,lF as _,mm as v,nF as y,oF as b,pm as x,rF as S,sF as C,t as w,tF as T,uF as E,vm as D,ym as O,yq as k}from"./api-DfVtzU1G.js";import{t as A}from"./button-BWdRKrS3.js";import{Ht as j,Lt as M,xt as N}from"./index-B0MXmi3m.js";var P=t(e(),1),F=n();function I(){let e=s(w.integrations.status.status,{}),t=k(w.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:f()});let u=n,p=(e,t,n)=>a({...u,[e]:{...u[e],[t]:n}}),m=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,F.jsx)(`strong`,{children:E()}),` `,_()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:c()}):(0,F.jsx)(M,{variant:`outline`,children:C()}):(0,F.jsx)(M,{variant:`outline`,children:b()}),note:o(),children:[(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(j,{value:u.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>p(`langfuse`,`host`,e.target.value),onBlur:()=>m(`langfuse`,{host:u.langfuse.host??``})})}),(0,F.jsx)(z,{label:r(),checked:u.langfuse.enabled??!0,onChange:e=>{p(`langfuse`,`enabled`,e),m(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:c()}):(0,F.jsx)(M,{variant:`outline`,children:C()}):(0,F.jsx)(M,{variant:`outline`,children:b()}),note:g(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(j,{value:u.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>p(`opik`,`baseUrl`,e.target.value),onBlur:()=>m(`opik`,{baseUrl:u.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(j,{value:u.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>p(`opik`,`workspace`,e.target.value),onBlur:()=>m(`opik`,{workspace:u.opik.workspace??``})})}),(0,F.jsx)(z,{label:r(),checked:u.opik.enabled??!0,onChange:e=>{p(`opik`,`enabled`,e),m(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:c()}):(0,F.jsx)(M,{variant:`outline`,children:C()}):(0,F.jsx)(M,{variant:`outline`,children:O()}),note:D(),children:[(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(j,{value:u.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>p(`otlp`,`endpoint`,e.target.value),onBlur:()=>m(`otlp`,{endpoint:u.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:r(),checked:u.otlp.enabled??!0,onChange:e=>{p(`otlp`,`enabled`,e),m(`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=a(w.integrations.otlpSecret.setOtlpHeaders),n=k(w.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),d=async()=>{l(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:m(),children:[(0,F.jsx)(j,{value:r,placeholder:e?h():v(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:x()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:p()}):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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BF as i,CT as a,DT as o,ET as s,FT as c,IT as l,JF as u,MT as d,NT as f,OT as ee,PT as te,ST as p,TT as m,XF as h,YF as g,bq as _,jT as ne,kT as v,qF as y,t as b,wT as x,xI as S,zF as C}from"./api-DfVtzU1G.js";import{$n as w,Qn as T,i as E,o as D,r as O,tt as re}from"./index-B0MXmi3m.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-CdvSrnID.js";import{n as P,t as F}from"./TimeRangePicker-es8qiYT0.js";var I=t(e(),1),L={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`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=_(b.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=_(b.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:S()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:h()}),(0,z.jsx)(M,{children:u()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),o=e=>74-e*68/r,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,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[C(),` p50 `,V(c.cP50),` `,g()]}),(0,z.jsxs)(`span`,{children:[i(),` p50 `,V(c.aP50),` `,g()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":h(),children:[(0,z.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:l(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:c(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:te(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:f(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:d(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:ne(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:r(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=w({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=E(e.from,e.to,O,`now`),r=e=>void t({search:t=>({...t,...D(e)})}),{from:i,to:a}=P(n),{rowLimit:c,buckets:l}=Y(i,a),u=_(b.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),d=(0,I.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]),f=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:ee()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{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,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:m({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:x()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:a({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.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,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":p({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,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.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{ie as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$V as i,AV as a,BK as o,BV as s,Ds as c,FK as l,FV as u,GK as d,GV as f,HK as p,HV as m,IK as ee,IV as h,JK as g,JV as te,KK as ne,KV as re,LK as ie,LV as _,MV as ae,Ms as oe,NK as se,NV as ce,Ns as le,OV as ue,PK as de,PV as fe,QK as pe,QV as me,RK as he,RV as ge,UK as v,UV as y,VK as b,VV as x,WK as S,WV as C,XK as w,XV as T,YK as E,YV as D,ZK as O,ZV as k,_s as A,aH as j,aq as M,bq as N,cH as P,dH as F,eH as I,eq as L,fH as _e,fs as ve,gs as ye,hs as be,iH as xe,jV as Se,kV as Ce,lH as we,ms as Te,nH as Ee,nq as De,oH as Oe,pH as ke,ps as Ae,qK as je,qV as Me,r as R,rH as Ne,sH as Pe,t as z,tH as Fe,tN as Ie,tq as Le,uH as Re,uq as ze,vs as Be,yq as B,ys as Ve,zK as He,zV as Ue}from"./api-DfVtzU1G.js";import{t as V}from"./button-BWdRKrS3.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-B0MXmi3m.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-DSIM9YOb.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>ke()},{id:`composer`,label:()=>_e()},{id:`sidebar`,label:()=>F()},{id:`notifications`,label:()=>te()},{id:`other`,label:()=>Re()}],X={showSource:{category:`messages`,label:()=>we(),help:()=>P()},showReport:{category:`messages`,label:()=>Pe(),help:()=>Oe()},copyAssistant:{category:`messages`,label:()=>j()},copyUser:{category:`messages`,label:()=>xe()},showDelete:{category:`messages`,label:()=>Ne()},showTools:{category:`messages`,label:()=>Ee(),help:()=>Fe()},voiceInput:{category:`composer`,label:()=>I(),help:()=>i()},showUsage:{category:`composer`,label:()=>me(),help:()=>k()},autoReadAloud:{category:`composer`,label:()=>le(),help:()=>oe()},showChatAge:{category:`sidebar`,label:()=>T(),help:()=>D()},notifSound:{category:`notifications`,label:()=>Me(),help:()=>re()},notifSystem:{category:`notifications`,label:()=>f(),help:()=>C()},replySound:{category:`notifications`,label:()=>y(),help:()=>m()}};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:()=>ae()};function ut({prefKey:e,ui:t}){let n=B(z.admin.setUiPrefDefault),r=B(z.admin.setFeatureEnabled),i=ct(e),o=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:h()}),(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:a()}),(0,J.jsx)(W,{value:`off`,children:Ce()}),(0,J.jsx)(W,{value:`inherit`,children:ue()})]})]}),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":u()}),u()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function dt({current:e,enabled:t}){let n=B(z.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?ye():r?A():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:ve()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?Ae():e?Te():be()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=N(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,l=B(z.me.setUiPref).withOptimisticUpdate(Ge),u=(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":_()}),_()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:fe()}),(0,J.jsx)(`p`,{children:ce()}),(0,J.jsx)(`p`,{children:Se()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:x(),"aria-label":x(),className:`mb-2`}),u.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:s()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],s=a.effective[e],u=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:Ue()}):u?(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&&u?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:ge()}):null,(0,J.jsx)(nt,{checked:s,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),o?(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:ze()})}var pt={sm:()=>S(),md:()=>v(),lg:()=>p(),xl:()=>b(),"2xl":()=>o(),"3xl":()=>He()};function mt(){let e=N(z.me.getMe,{host:G}),t=B(z.me.setLocale),n=B(z.me.setTimezone),i=B(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=B(z.me.setMyName),o=Ke(),s=e?.locale??`default`,c=e?.name??``,[u,f]=(0,q.useState)(null),p=u??c,m=p.trim()!==c.trim();async function h(){try{await a({name:p}),f(null),o.success(pe())}catch(e){o.error(O(),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:De()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:p,maxLength:120,placeholder:L(),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:Ie()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:w()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:M()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(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:ie()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(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:je()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(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:d()})]}),(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:de()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,Cw as c,Dw as l,E as u,Ew as d,Fw as f,Iw as p,Kw as m,Lw as h,Mw as g,Ow as ee,Pw as _,QC as te,Qw as v,Rw as y,Sw as ne,Tw as b,Uw as re,Ww as ie,XC as ae,Xw as oe,Yw as se,ZC as ce,_w as le,aT as ue,aw as x,bq as S,bw as de,dw as fe,ew as pe,fw as me,gC as C,gw as he,iT as ge,jw as w,kw as _e,lx as ve,mw as ye,nw as T,pw as be,rT as xe,rw as E,sw as Se,t as D,tw as O,uq as k,vw as A,ww as Ce,xw as we,yq as j,yw as M,za as Te}from"./api-DfVtzU1G.js";import{r as Ee}from"./dist-D8270q9m.js";import{t as De}from"./list-CR2YIdia.js";import{t as N}from"./button-BWdRKrS3.js";import{$n as Oe,A as P,An as ke,Bn as Ae,C as F,D as je,Dn as Me,E as Ne,En as Pe,Gt as I,Hn as Fe,Ht as Ie,I as Le,Jn as L,Jt as Re,Kt as ze,Ln as Be,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-B0MXmi3m.js";var gt=u(`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=u(`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=u(`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=u(`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)(Re,{asChild:!0,children:(0,X.jsx)(N,{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)(Fe,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:i,className:a,onOpen:o}){let c=j(D.projects.renameProject),l=j(D.projects.setProjectColor),u=j(D.projects.moveProject),d=j(D.projects.deleteProject),f=j(D.projects.createProject),p=tt(),m=ot(),h=qe(),[g,ee]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(t),[y,ne]=(0,Y.useState)(!1),[b,ae]=(0,Y.useState)(!1),oe=S(D.projects.projectTreeCount,b?{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:a}),(0,X.jsxs)(et,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(I,{onSelect:()=>o(),children:[(0,X.jsx)(ht,{}),` `,s()]}),(0,X.jsxs)(I,{onSelect:()=>{v(t),ee(!0)},children:[(0,X.jsx)(Ke,{}),` `,T()]}),(0,X.jsxs)(I,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:w(),label:ue(),placeholder:ge(),confirmLabel:xe()});t&&await f({name:t,parentId:e})})},children:[(0,X.jsx)(Je,{}),` `,w()]}),(0,X.jsxs)(I,{onSelect:()=>ne(!0),children:[(0,X.jsx)(_t,{}),` `,be()]}),(0,X.jsx)(ze,{children:r()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":te(),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 l({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(dt,{}),(0,X.jsxs)(I,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=oe?.folders??0,r=oe?.chats??0;await p({title:re({name:t}),description:ut({folders:n,chats:r,days:m}),confirmWord:x(),confirmLabel:ie(),destructive:!0})&&await d({projectId:e})})},children:[(0,X.jsx)(pt,{}),` `,x()]})]})]}),(0,X.jsx)(rt,{open:g,onOpenChange:ee,title:se(),canSubmit:_.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:_.trim()}),ee(!1)},submitLabel:T(),children:(0,X.jsx)(Ie,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),y?(0,X.jsx)(at,{open:y,onOpenChange:ne,title:fe(),movingFolderId:e,currentId:i,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function bt({chat:e,currentFolderId:t,className:n}){let r=j(D.chats.pinChat),i=j(D.chats.deleteChat),a=j(D.chats.renameChat),o=j(D.chats.setChatSidebar),s=j(D.chats.moveChatToProject),c=tt(),l=ot(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(e.title??``),[m,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)(I,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,X.jsx)(Ke,{}),` `,T()]}),(0,X.jsxs)(I,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(Pe,{}):(0,X.jsx)(Me,{}),e.pinned?O():pe()]}),(0,X.jsxs)(I,{onSelect:()=>g(!0),children:[(0,X.jsx)(_t,{}),` `,ye()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(I,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(ke,{}):(0,X.jsx)(J,{}),e.inSidebar?h():y()]}),(0,X.jsx)(dt,{}),(0,X.jsxs)(I,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:ce(),description:ae({days:l}),confirmLabel:x(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,X.jsx)(pt,{}),` `,x()]})]})]}),(0,X.jsx)(rt,{open:u,onOpenChange:d,title:C(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:T(),children:(0,X.jsx)(Ie,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,X.jsx)(at,{open:m,onOpenChange:g,title:me(),currentId:t,onPick:t=>void s({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`}`,Dt=e=>`crumb:${e}`;function Ot(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 kt(){let{projectId:e}=V({from:`/project/$projectId`}),t=z(),n=S(D.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:k()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:M()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:A()}),(0,X.jsx)(N,{variant:`outline`,onClick:()=>void t({to:`/`}),children:le()})]}):(0,X.jsx)(At,{page:n})})}function At({page:e}){let t=z(),n=tt(),a=ot(),s=qe(),u=Ye(),m=j(D.projects.renameProject),h=j(D.projects.setProjectColor),v=j(D.projects.deleteProject),y=j(D.projects.createProject),b=j(D.projects.moveProject),ae=j(D.projects.setProjectSidebar),ce=j(D.chats.moveChatToProject),le=j(D.chats.reorderChat),pe=j(D.projects.reorderProject),me=S(D.projects.projectTreeCount,{projectId:e.project._id}),[C,_e]=(0,Y.useState)(Tt),ye=e=>{localStorage.setItem(wt,e),_e(e)},E=S(D.projects.folderColumns,C===`columns`?{projectId:e.project._id}:`skip`),O=S(D.projects.projectTreeList,C===`list`?{projectId:e.project._id}:`skip`),{c:k}=Oe({from:`/project/$projectId`}),A=S(D.projects.listProjects,{}),Ce=S(D.chatReads.myBusyChats,{}),M=(0,Y.useMemo)(()=>new Set(Ce??[]),[Ce]),{byChat:Ee}=lt(Ce??null),ke=S(D.chatReads.myChatReads,{}),F=(0,Y.useMemo)(()=>Ct(e.chats,ke??[]),[e.chats,ke]),{startNewChat:Me,picker:Pe}=it(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[L,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(L.trim()),180);return()=>clearTimeout(e)},[L]);let Z=S(D.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),bt=Ue(Ve(je,{activationConstraint:{distance:4}}),Ve(Ge,{activationConstraint:{delay:250,tolerance:8}})),Q=(0,Y.useRef)(!1),Et=()=>{Q.current=!0,setTimeout(()=>{Q.current=!1},0)},[Dt,kt]=(0,Y.useState)(null),At=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),a=E?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??a)?.title||i()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).find(t=>t._id===e)?.name??``}}return null},Nt=e=>kt(At(String(e.active.id))),$=(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=P(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=P(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=P(n(`crumb:`));if(a.length>0)return a;let o=P(n(`col:`));return o.length>0?o:st(n(t?`folder:`:`chat:`))},[]),It=t=>{if(C===`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(C===`list`){let e=O?.chats.find(e=>e._id===t);return e?{list:O.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(C===`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(C===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:ft(O.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{kt(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=Ot(r);if(e!==void 0){if(a)await ce({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ct(A??[],t,e)){u.error(g());return}await b({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=It(t);if(!n)return;n.list.some(t=>t._id===e)||await ce({chatId:e,projectId:n.folderId});let a=St(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await le({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(g());return}await b({projectId:e,parentId:n.parentId})}let a=St(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await pe({projectId:e,...a});return}}catch{u.error(g())}},[,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,L),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{Q.current||e()};return(0,X.jsx)(U.Provider,{value:Ee,children:(0,X.jsxs)(Ze,{sensors:bt,collisionDetection:$,onDragStart:Nt,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":he(),children:[Wt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(jt,{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)(N,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:o(),onClick:()=>{ae({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)($e,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Te()}),(0,X.jsx)(Ae,{"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":p(),children:[(0,X.jsx)(N,{variant:C===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":p(),title:p(),"aria-pressed":C===`cards`,onClick:()=>ye(`cards`),children:(0,X.jsx)(vt,{})}),(0,X.jsx)(N,{variant:C===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":f(),title:f(),"aria-pressed":C===`columns`,onClick:()=>ye(`columns`),children:(0,X.jsx)(gt,{})}),(0,X.jsx)(N,{variant:C===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":_(),title:_(),"aria-pressed":C===`list`,onClick:()=>ye(`list`),children:(0,X.jsx)(De,{})})]}),(0,X.jsxs)(N,{variant:`outline`,size:`sm`,onClick:()=>void Me({projectId:e.project._id}),children:[(0,X.jsx)(We,{}),d()]}),(0,X.jsxs)(N,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await s({title:w(),label:ue(),placeholder:ge(),confirmLabel:xe()});t&&await y({name:t,parentId:e.project._id})},children:[(0,X.jsx)(Je,{}),w()]}),(0,X.jsxs)(Qe,{children:[(0,X.jsx)(Re,{asChild:!0,children:(0,X.jsx)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":oe(),children:(0,X.jsx)(Fe,{})})}),(0,X.jsxs)(et,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(I,{onSelect:()=>{W(e.project.name),V(!0)},children:[(0,X.jsx)(Ke,{}),` `,T()]}),(0,X.jsxs)(I,{onSelect:()=>ht(!0),children:[(0,X.jsx)(_t,{}),` `,be()]}),(0,X.jsx)(ze,{children:r()}),(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":te(),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)(I,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=me?.folders??0,o=me?.chats??0;await n({title:re({name:e.project.name}),description:ut({folders:i,chats:o,days:a}),confirmWord:x(),confirmLabel:ie(),destructive:!0})&&(await v({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(pt,{}),` `,x()]})]})]})]})]}),C===`columns`?(0,X.jsx)(Rt,{data:E,currentId:e.project._id,busyIds:M,suppressClick:Q,locateChatId:k??null}):C===`list`?(0,X.jsx)(Ft,{data:O,busyIds:M,suppressClick:Q,locateChatId:k??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:Xe,children:e.children.map(t=>(0,X.jsx)(Mt,{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:l()}),e.chats.length>0?(0,X.jsx)(Ie,{value:L,onChange:e=>R(e.target.value),placeholder:c(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?we():de()}):Ut.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:ne({term:L.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)(Pt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:M.has(t._id),unread:F.has(t._id),locate:t._id===k,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:Se()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:ne({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&&Le(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||ve()}),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:se(),canSubmit:H.trim().length>0,onSubmit:async()=>{await m({projectId:e.project._id,name:H.trim()}),V(!1)},submitLabel:T(),children:(0,X.jsx)(Ie,{value:H,onChange:e=>W(e.target.value),autoFocus:!0})}),G?(0,X.jsx)(at,{open:G,onOpenChange:ht,title:fe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void b({projectId:e.project._id,parentId:t})}):null,Pe]}),(0,X.jsx)(Ne,{children:Dt?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Dt.kind===`folder`?(0,X.jsx)(Be,{size:13,"aria-hidden":!0}):(0,X.jsx)(He,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Dt.label})]}):null})]})})}function jt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=W({id:Dt(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Mt({child:e,parentId:t,now:n,suppressClick:r}){let i=z(),a=F({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)(Be,{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?b({count:e.folderCount})+` · `:``,Ce({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:H(e.lastActivityAt,n)})]})}function Nt({chat:e}){let t=j(D.chats.setChatSidebar),n=e.inSidebar?h():y();return(0,X.jsx)(N,{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)(ke,{}):(0,X.jsx)(J,{})})}function Pt({chat:e,currentFolderId:t,now:n,busy:r,unread:a,locate:o,suppressClick:s}){let c=(0,Y.useContext)(U).get(e._id),l=z(),u=G(e.color),d=F({id:`chat:${e._id}`}),f=$(o);return(0,X.jsxs)(`li`,{ref:e=>{d.setNodeRef(e),f.current=e},className:`oc-projpage__chatrow`+(d.isDragging?` is-dragging`:``)+(o?` is-locate`:``),style:{transform:R.Transform.toString(d.transform),transition:d.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{s.current||l({to:`/chat/$chatId`,params:{chatId:e._id}})},...d.listeners,...d.attributes,children:[u?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||i()}),e.pinned?(0,X.jsx)(Me,{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(c,v()).className,title:B(c,v()).label,"aria-label":B(c,v()).label}):null,a&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:m(),"aria-label":m()}):null]}),(0,X.jsx)(Nt,{chat:e}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function $(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function 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:k()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=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:we()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:o,children:s}){let c=z(),l=F({id:`folder:${e._id}`}),u=W({id:Q(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{l.setNodeRef(e),u.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(u.isOver?` is-over`:``)+(l.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":mt(e),transform:R.Transform.toString(l.transform),transition:l.transition},...l.listeners,...l.attributes,role:`button`,tabIndex:0,onClick:()=>{o.current||c({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&c({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?a():_e(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!o.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(L,{size:13}):(0,X.jsx)(Ee,{size:13})}),(0,X.jsx)(Be,{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 c({to:`/project/$projectId`,params:{projectId:e._id}})})]}),s]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:a}){let o=(0,Y.useContext)(U).get(e._id),s=z(),c=F({id:`chat:${e._id}`}),l=$(r),u=G(e.color);return(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(c.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:R.Transform.toString(c.transform),transition:c.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{a.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...c.listeners,...c.attributes,children:[u?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||i()}),n?(0,X.jsx)(`span`,{className:B(o,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Nt,{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:k()}):(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:de()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=F({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)(Be,{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:a,onOpen:o}){let s=(0,Y.useContext)(U).get(e._id),c=F({id:`chat:${e._id}`}),l=$(r),u=G(e.color);return(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(c.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:R.Transform.toString(c.transform),transition:c.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{a.current||o()},...c.listeners,...c.attributes,children:[u?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||i()}),n?(0,X.jsx)(`span`,{className:B(s,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(Nt,{chat:e})]})}export{kt as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
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,CD as o,Ia as s,QE as c,Qu as l,SD as u,Sl as d,XE as f,ZE as p,Zu as m,aD as h,bl as g,bq as _,cD as v,cd as y,dD as b,dd as ee,eD as te,ed as x,ep as S,fD as C,hD as w,iD as T,lD as ne,ld as re,mD as ie,nD as ae,np as oe,oD as se,pD as ce,rD as E,rp as D,sD as O,t as k,tD as A,td as j,tp as M,uD as N,ud as P,xl as F,yq as I}from"./api-DfVtzU1G.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-CFBfL_GK.js";import{t as V}from"./button-BWdRKrS3.js";import{Rt as H,an as U,ct as W,dt as G,in as le,lt as K,nn as q,rn as ue,st as J,tt as de,ut as Y,xt as fe}from"./index-B0MXmi3m.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:N,help:ne},documentary_fetch:{label:v,help:O},inbound_files:{label:se,help:h},history_summary:{label:D,help:oe},file_curation:{label:ee,help:j},quote_reply:{label:P,help:re}},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:c,references:p,files:f,previous_summary:M,new_messages:S,max_chars:i,file_name:x,budget_chars:a,feedback:l,content:m,excerpt:y};function _e(){let e=_(k.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:E()})});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)(R,{label:w(),help:ie()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:T()}),(0,$.jsxs)(J,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsx)(W,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=I(k.admin.upsertInstanceConfig),n=H(),r=_(k.me.getMe,{host:de}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>L(i,a));(0,Q.useEffect)(()=>{c(L(i,a))},[a,e._id]);let[l,f]=(0,Q.useState)(!1),p=s.promptInjections,m=(e,t)=>c({...s,promptInjections:{...p,[e]:{...p[e],...t}}});async function h(){f(!0);try{await t({instanceId:e._id,config:z(s,i,a)})}catch(e){n.error(u(),e)}finally{f(!1)}}async function v(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(u(),e)}}let y=e.config?.contentLocale??`default`,b=Z[X(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:d()}),(0,$.jsxs)(J,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsxs)(W,{children:[(0,$.jsx)(K,{value:`default`,children:g({locale:b})}),pe().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()})]}),ue.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:p[e]??{enabled:!0,template:q[e].defaultTemplate[a]},contentLocale:a,onChange:t=>m(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(V,{size:`sm`,onClick:()=>void h(),disabled:l,children:o()})})]})}function ye({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[c,l]=(0,Q.useState)(!1),u=i.template.trim()!==t.defaultTemplate[a],d=t.togglable&&!i.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=le(e,i,a),m=p?U(p,f):``;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)(fe,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:C()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:b()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?A():ae()}),u&&(0,$.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:ce()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:te()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:r()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AA as i,BA as a,DA as ee,EA as o,Fd as s,GA as c,HA as l,JA as u,KA as d,MA as f,NA as p,OA as m,PA as h,QA as te,UA as ne,VA as re,WA as ie,XA as g,YA as _,ZA as v,aj as y,bq as b,cj as x,dj as S,ej as ae,fj as C,gj as w,hj as T,ij as E,jA as D,kA as O,lj as k,mj as A,nj as j,oj as M,pj as N,qA as P,rj as F,sj as I,t as L,tj as R,uj as oe,yq as z}from"./api-DfVtzU1G.js";import{t as B}from"./button-BWdRKrS3.js";import{Ht as V,Lt as H,Pn as U,Rt as W,Z as G,b as K,xt as q}from"./index-B0MXmi3m.js";import{t as J}from"./roleDescriptions-DBqNfMhe.js";var Y=t(e(),1),X=n(),Z=[{group:()=>w(),keys:[{key:`traces.read`,label:()=>S()},{key:`traces.read.content`,label:()=>oe(),phi:!0},{key:`traces.write`,label:()=>k()}]},{group:()=>T(),keys:[{key:`kpi.read`,label:()=>S()},{key:`kpi.write`,label:()=>k()}]},{group:()=>A(),keys:[{key:`openclaw.query`,label:()=>x()},{key:`anomalies.read`,label:()=>I()},{key:`anomalies.report`,label:()=>M()}]},{group:()=>N(),keys:[{key:`chats.read`,label:()=>S()},{key:`selfheal`,label:()=>E()},{key:`media.repair`,label:()=>F()},{key:`feedback.respond`,label:()=>s()}]},{group:()=>C(),keys:[{key:`admin.manage`,label:()=>y()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=b(L.apiKeys.listRoles,{}),t=z(L.apiKeys.createRole),n=z(L.apiKeys.ensureRolesSeeded),s=z(L.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(L.apiKeys.listRoles,{});r&&e.setQuery(L.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),y=G(),x=W(),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)($),[E,k]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{x.error(R(),e)})},[n,x]);let A=e??[];async function M(e,t){if(Q(e.permissions))return;if(e.builtin){await y({title:ae({name:e.name}),description:r(),confirmLabel:te()});return}if(E.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];k(t=>new Set(t).add(e._id));try{await s({roleId:e._id,permissions:n})}catch(e){x.error(v(),e)}finally{k(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function N(){try{await t({key:w.key,name:w.name,description:w.description||void 0,permissions:[]}),T($),C(!1)}catch(e){x.error(g(),e)}}let F=e===void 0,I=!F&&A.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,u(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,P()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:d()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{T($),C(!0)},children:c()})})]}),F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):I?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:l()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?j({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:A.map(e=>{let t=Q(e.permissions),n=E.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(U,{}),` `,re()]}):(0,X.jsx)(H,{variant:`secondary`,children:a()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?h():n?p():r,onCheckedChange:()=>void M(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:S,onOpenChange:C,title:f(),description:D(),canSubmit:!!(w.key&&w.name),onSubmit:N,submitLabel:i(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,X.jsx)(V,{value:w.key,placeholder:m(),onChange:e=>T({...w,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(V,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,X.jsx)(V,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,$W as i,AW as a,BG as o,BU as s,BW as c,CW as l,DW as u,E as d,EW as ee,FG as f,GG as p,GW as m,HG as te,HW as ne,IG as re,JG as ie,JU as ae,JW as oe,KG as se,KU as ce,KW as le,LG as ue,MW as h,NG as de,NW as fe,OW as pe,PG as me,PW as g,QU as he,RG as ge,SW as _e,TW as ve,UG as ye,UW as be,VG as xe,VW as Se,WG as Ce,WW as we,XU as Te,XW as Ee,YU as De,ZU as Oe,_q as _,aG as ke,aW as Ae,bW as je,bq as Me,cW as Ne,dG as Pe,eG as Fe,eW as Ie,fG as Le,fq as v,iG as Re,iW as ze,jW as y,kW as Be,lG as Ve,lW as He,mG as Ue,nG as We,nW as Ge,oG as Ke,oW as qe,pG as Je,qG as Ye,qU as Xe,qW as Ze,rG as Qe,rW as $e,sG as b,sW as et,t as x,tG as tt,tW as nt,uG as rt,uq as it,wW as S,xW as at,yW as ot,zG as st,zW as ct}from"./api-DfVtzU1G.js";import{t as lt}from"./list-CR2YIdia.js";import{t as C}from"./button-BWdRKrS3.js";import{At as ut,Cn as dt,Dt as ft,Fn as pt,Ft as mt,Ht as ht,It as gt,Jn as w,Lt as T,Mt as _t,Nt as vt,On as yt,Ot as bt,Pt as xt,Rt as St,Tn as Ct,Xt as E,Yn as D,Yt as O,Zt as k,_t as wt,ct as A,dt as j,ft as Tt,gt as Et,ht as Dt,jt as Ot,kn as kt,kt as At,lt as M,mt as jt,pn as Mt,pt as Nt,st as N,tt as Pt,ut as P,vn as Ft}from"./index-B0MXmi3m.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-CVSQWo7b.js";import{t as Bt}from"./FilterBar-CJwP10CI.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt,u as z}from"./TimezoneCombobox-DSIM9YOb.js";var Jt=d(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Yt=d(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),B=t(e(),1),V=n();function H(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt({value:e,onChange:t}){let n=Ht(e),r=(0,B.useMemo)(()=>new Date,[]),[i,o]=(0,B.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,B.useState)(!1),l=(0,B.useMemo)(()=>H(v()),[]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{month:`long`,year:`numeric`}),[]),d=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=L(i.year,i.month),f=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(z(e,n,r,i,a)),te=(e,t,n)=>{o({year:e,month:t}),m(e,t,n,f,p)},ne=e=>{let t=new Date(i.year,i.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},re=n===null?fe():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,V.jsxs)(O,{modal:!0,open:s,onOpenChange:c,children:[(0,V.jsx)(k,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":g(),children:[(0,V.jsx)(Jt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,V.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,V.jsxs)(E,{align:`start`,className:`oc-dtp__pop`,children:[(0,V.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":h(),onClick:()=>ne(-1),children:(0,V.jsx)(D,{size:15,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":y(),onClick:()=>ne(1),children:(0,V.jsx)(w,{size:15,"aria-hidden":!0})})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,V.jsxs)(N,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,V.jsx)(P,{size:`sm`,"aria-label":a(),children:(0,V.jsx)(j,{})}),(0,V.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,V.jsx)(M,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,V.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,V.jsxs)(N,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,V.jsx)(P,{size:`sm`,"aria-label":Be(),children:(0,V.jsx)(j,{})}),(0,V.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,V.jsx)(M,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function U(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Zt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Qt(e){let t=new Map;for(let n of e){let e=U(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function $t(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Zt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function tn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=v(),c=(0,B.useMemo)(()=>Qt(e),[e]),u=(0,B.useMemo)(()=>en(s),[s]),d=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),f=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),p=new Date,m=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},te=t===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,V.jsxs)(`div`,{className:`oc-cal`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":_e(),onClick:()=>m(-1),children:(0,V.jsx)(D,{})}),(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":at(),onClick:()=>m(1),children:(0,V.jsx)(w,{})}),(0,V.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:p.getFullYear(),month:p.getMonth()}),children:l()})]}),(0,V.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,V.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,V.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:ve()}),(0,V.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:S()})]})]}),t===`month`?(0,V.jsx)(an,{cursor:n,byDay:c,weekdays:u,timeFmt:f,now:p,onEventClick:a}):(0,V.jsx)(on,{year:n.year,byDay:c,monthShortFmt:ee,now:p,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,V.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,V.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Zt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,V.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,V.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,V.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,V.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,V.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,V.jsx)(`span`,{className:`oc-cal__more`,children:je({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,V.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=$t(t,e,o),c=L(e,o);return(0,V.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,V.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,V.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,V.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var sn={h:36e5,min:6e4,s:1e3,ms:1};function cn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*sn[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var ln=new Map;function q(e){let t=ln.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return ln.set(e,n),n}function J(e,t){if(t!==null){let n=q(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function Y(e,t,n,r,i,a){if(a===null||q(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=J(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function X(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=J(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=Y(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=Y(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Z=`crons`;function un(e,t){return`${e}\u0000${t}`}function dn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=un(a.instanceName,e.id);i.set(o,a);let s=Wt(e)!==`active`,c=X(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Z,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var Q={minutes:6e4,hours:36e5,days:864e5};function $(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Kt(e)){case`ok`:return(0,V.jsx)(T,{variant:`secondary`,children:Ze()});case`error`:return(0,V.jsx)(T,{variant:`destructive`,children:m()});case`running`:return(0,V.jsx)(T,{variant:`outline`,children:we()});case`other`:return(0,V.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=_(x.scheduled.listMyCrons),t=_(x.scheduled.getCronDetail),n=_(x.scheduled.listCronRuns),a=_(x.scheduled.updateCron),l=_(x.scheduled.removeCron),d=_(x.scheduled.runCronNow),h=St(),fe=Me(x.me.getMe,{host:Pt})?.timezone,[g,_e]=(0,B.useState)(null),[ve,je]=(0,B.useState)(!1),[y,Be]=(0,B.useState)(!1),[S,at]=(0,B.useState)(null),[w,E]=(0,B.useState)(null),[D,O]=(0,B.useState)(null),[k,L]=(0,B.useState)(null),[Ht,Kt]=(0,B.useState)(!1),[z,H]=(0,B.useState)(Ut),[U,Zt]=(0,B.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Qt=e=>{localStorage.setItem(`oc.sched.view`,e),Zt(e)},[$t,en]=(0,B.useState)(`month`),[W,an]=(0,B.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,B.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,z)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,z]),sn=(0,B.useMemo)(()=>$t===`year`?nn(W.year):tn(W.year,W.month),[$t,W]),cn=(0,B.useMemo)(()=>dn(on,sn.startMs,sn.endMs),[on,sn]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,B.useCallback)(async()=>{je(!0),Be(!1);try{_e(await e({}))}catch{Be(!0)}finally{je(!1)}},[e]);(0,B.useEffect)(()=>{K()},[K]);let ln=(0,B.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),q=(0,B.useRef)(null);(0,B.useEffect)(()=>{g!==null&&q.current!==null&&q.current.scrollIntoView({block:`center`})},[g]);let J=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),Y=async(e,t,n)=>{at(e);try{await t(),h.success(n),await K()}catch(e){h.toast({variant:`error`,title:b({code:$(e)})})}finally{at(null)}},X=(0,B.useRef)(0),Z=(0,B.useRef)(0),un=async(e,t)=>{if(t.id===null)return;let r=++X.current;O({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==X.current)return;O({name:t.name??t.id,entries:i})}catch(e){if(r!==X.current)return;O(null),h.toast({variant:`error`,title:b({code:$(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Z.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%Q.days===0?(s=String(e/Q.days),c=`days`):e%Q.hours===0?(s=String(e/Q.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/Q.minutes))),c=`minutes`))}if(r!==Z.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Z.current)return;L(null),h.toast({variant:`error`,title:b({code:$(e)})})}},mn=async()=>{if(k===null)return;let e={};if(k.nameDirty&&k.name.trim()===``||k.messageDirty&&k.hasMessage&&k.message.trim()===``){h.toast({variant:`error`,title:ce()});return}if(k.nameDirty&&k.name.trim()!==``&&(e.name=k.name.trim()),k.scheduleDirty){if(k.scheduleKind===`cron`&&k.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:k.cronExpr.trim(),...k.tz.trim()===``?{}:{tz:k.tz.trim()}};else if(k.scheduleKind===`every`){let t=Number(k.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*Q[k.everyUnit])})}else if(k.scheduleKind===`at`&&k.at!==``){let t=Date.parse(k.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(k.scheduleDirty&&e.schedule===void 0){h.toast({variant:`error`,title:Xe()});return}if(k.messageDirty&&k.hasMessage&&k.message.trim()!==``&&(e.message=k.message.trim()),Object.keys(e).length===0){L(null);return}let t=Z.current;Kt(!0);try{await a({instanceName:k.instanceName,jobId:k.jobId,patch:e}),h.success(qe()),t===Z.current&&L(null),await K()}catch(e){h.toast({variant:`error`,title:b({code:$(e)})})}finally{Kt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:ie()}),(0,V.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":pe(),children:[(0,V.jsx)(C,{variant:U===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":u(),title:u(),"aria-pressed":U===`list`,onClick:()=>Qt(`list`),children:(0,V.jsx)(lt,{})}),(0,V.jsx)(C,{variant:U===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ee(),title:ee(),"aria-pressed":U===`calendar`,onClick:()=>Qt(`calendar`),children:(0,V.jsx)(Jt,{})})]}),(0,V.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:ve,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,V.jsx)(dt,{size:14,"aria-hidden":!0}),Ye()]})]}),g!==null&&hn>0?(0,V.jsxs)(Bt,{q:z.q,onQChange:e=>H(t=>({...t,q:e})),searchPlaceholder:ne(),onReset:()=>H(Ut),canReset:Gt(z),children:[(0,V.jsxs)(N,{value:z.state,onValueChange:e=>H(t=>({...t,state:e})),children:[(0,V.jsx)(P,{size:`sm`,className:`w-40`,children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`all`,children:Se()}),(0,V.jsx)(M,{value:`active`,children:me()}),(0,V.jsx)(M,{value:`paused`,children:f()}),(0,V.jsx)(M,{value:`auto-disabled`,children:de()})]})]}),(0,V.jsxs)(N,{value:z.result,onValueChange:e=>H(t=>({...t,result:e})),children:[(0,V.jsx)(P,{size:`sm`,className:`w-40`,children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`all`,children:c()}),(0,V.jsx)(M,{value:`ok`,children:Ze()}),(0,V.jsx)(M,{value:`error`,children:m()}),(0,V.jsx)(M,{value:`running`,children:we()}),(0,V.jsx)(M,{value:`none`,children:be()})]})]})]}):null,g===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ve,children:y?se():it()}):U===`calendar`?(0,V.jsxs)(V.Fragment,{children:[y?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,V.jsx)(rn,{events:cn.events,mode:$t,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:G,footnote:ot()})]}):(0,V.jsxs)(V.Fragment,{children:[y?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,g.map(e=>{let t=e.jobs.filter(e=>Vt(e,z)),n=Gt(z)&&e.jobs.length>0&&t.length===0;return(0,V.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,V.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,V.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ye({code:e.error})}):e.jobs.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):n?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}):(0,V.jsxs)(zt,{children:[(0,V.jsx)(It,{children:(0,V.jsxs)(Rt,{children:[(0,V.jsx)(F,{children:xe()}),(0,V.jsx)(F,{children:o()}),(0,V.jsx)(F,{children:st()}),(0,V.jsx)(F,{children:ge()}),(0,V.jsx)(F,{children:ue()}),(0,V.jsx)(F,{children:oe()}),(0,V.jsx)(F,{children:He()})]})}),(0,V.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=S===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,V.jsxs)(Rt,{ref:t.id!==null&&t.id===ln?q:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,V.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??re()}),(0,V.jsx)(I,{children:(0,V.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,V.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,V.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ft(t.schedule),n=e===null?null:bt(e);return n===null?null:(0,V.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,V.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:J.format(t.nextRunAtMs)}),(0,V.jsx)(I,{children:Wt(t)===`auto-disabled`?(0,V.jsx)(T,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${J.format(t.autoDisabledAtMs)}`}`,children:de()}):Wt(t)===`active`?(0,V.jsx)(T,{variant:`secondary`,children:me()}):Wt(t)===`paused`?(0,V.jsx)(T,{variant:`outline`,children:f()}):(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,V.jsxs)(I,{children:[(0,V.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,V.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??Ue(),children:le()}):null]}),(0,V.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,V.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:S!==null,onClick:()=>void Y(r,async()=>{let n=await d({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Ke()),children:(0,V.jsx)(Mt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?Pe():rt(),"aria-label":R(t)===`pause`?Pe():rt(),disabled:S!==null,onClick:()=>void Y(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?ke():Re()),children:R(t)===`pause`?(0,V.jsx)(kt,{size:14,"aria-hidden":!0}):(0,V.jsx)(Ct,{size:14,"aria-hidden":!0})}):null,s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ne(),"aria-label":Ne(),disabled:S!==null,onClick:()=>void pn(e.instanceName,t),children:(0,V.jsx)(yt,{size:14,"aria-hidden":!0})}):null,s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:et(),"aria-label":et(),disabled:S!==null,onClick:()=>void un(e.instanceName,t),children:(0,V.jsx)(Yt,{size:14,"aria-hidden":!0})}):null,o?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ve(),"aria-label":Ve(),disabled:S!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,V.jsx)(Ft,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()})]},e.instanceName)}),hn>0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:s()}):null]}),(0,V.jsx)(At,{open:w!==null,onOpenChange:e=>{e||E(null)},children:(0,V.jsxs)(_t,{children:[(0,V.jsxs)(mt,{children:[(0,V.jsx)(gt,{children:We()}),(0,V.jsx)(vt,{children:tt({name:w?.name??``})})]}),(0,V.jsxs)(xt,{children:[(0,V.jsx)(Ot,{children:Fe()}),(0,V.jsx)(ut,{onClick:()=>{let e=w;E(null),e!==null&&Y(`${e.instanceName}:${e.jobId}`,()=>l({instanceName:e.instanceName,jobId:e.jobId}),Qe())},children:i()})]})]})}),(0,V.jsx)(Tt,{open:D!==null,onOpenChange:e=>{e||(X.current++,O(null))},children:(0,V.jsxs)(Nt,{style:{maxWidth:640},children:[(0,V.jsx)(Et,{children:(0,V.jsx)(wt,{children:Ae({name:D?.name??``})})}),D?.entries===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):D!==null&&D.entries.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):D===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:D.entries.map((e,t)=>(0,V.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,V.jsx)(fn,{status:e.status}),(0,V.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?J.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,V.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Ee({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,V.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,V.jsx)(Tt,{open:k!==null,onOpenChange:e=>{e||(Z.current++,L(null))},children:(0,V.jsxs)(Nt,{className:`oc-cronedit`,children:[(0,V.jsxs)(Et,{children:[(0,V.jsx)(wt,{children:$e()}),(0,V.jsx)(jt,{children:Ge()})]}),k===null?null:k.loading?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:xe()}),(0,V.jsx)(ht,{value:k.name,maxLength:200,onChange:e=>L({...k,name:e.target.value,nameDirty:!0})})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:nt()}),(0,V.jsxs)(N,{value:k.scheduleKind,onValueChange:e=>L({...k,scheduleKind:e,scheduleDirty:!0}),children:[(0,V.jsx)(P,{children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`cron`,children:Ie()}),(0,V.jsx)(M,{value:`every`,children:r()}),(0,V.jsx)(M,{value:`at`,children:he()})]})]}),k.scheduleKind===`cron`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(ht,{value:k.cronExpr,onChange:e=>L({...k,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,V.jsx)(qt,{value:k.tz,onChange:e=>L({...k,tz:e,scheduleDirty:!0}),fallbackTz:fe??void 0})]}):k.scheduleKind===`every`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(ht,{type:`number`,min:1,value:k.everyValue,onChange:e=>L({...k,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,V.jsxs)(N,{value:k.everyUnit,onValueChange:e=>L({...k,everyUnit:e,scheduleDirty:!0}),children:[(0,V.jsx)(P,{style:{maxWidth:160},children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`minutes`,children:Oe()}),(0,V.jsx)(M,{value:`hours`,children:Te()}),(0,V.jsx)(M,{value:`days`,children:De()})]})]})]}):(0,V.jsx)(Xt,{value:k.at,onChange:e=>L({...k,at:e,scheduleDirty:!0})})]}),k.hasMessage?(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Je()}),(0,V.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:k.message,onChange:e=>L({...k,message:e.target.value,messageDirty:!0})})]}):null]}),(0,V.jsxs)(Dt,{children:[(0,V.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:Fe()}),(0,V.jsxs)(C,{onClick:()=>void mn(),disabled:k===null||k.loading||Ht,children:[Ht?(0,V.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ae()]})]})]})})]})}export{pn as ScheduledTab};
|