@lacneu/atrium 0.87.0 → 0.87.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-BjWb2utN.js +1 -0
- package/dist/assets/{AdvancedFilter-DHhZAptC.js → AdvancedFilter-ksMf6bcD.js} +1 -1
- package/dist/assets/AgentFilesTab-DAHA88Tu.js +3 -0
- package/dist/assets/AnomaliesTab-CVua97lJ.js +1 -0
- package/dist/assets/AuditTab-hTs6iFsI.js +1 -0
- package/dist/assets/BridgeTab-DPbj0zcY.js +1 -0
- package/dist/assets/ChatDefaultsTab-CdYRaOgV.js +1 -0
- package/dist/assets/{DataTableShell-DoTsQFjZ.js → DataTableShell-K5cImuMP.js} +1 -1
- package/dist/assets/{DetailChips-B3snpzri.js → DetailChips-Xge7xE-L.js} +1 -1
- package/dist/assets/FeedbacksTab-CvTz752R.js +1 -0
- package/dist/assets/{FieldLabel-CL1-4y9n.js → FieldLabel-DVWzsIR3.js} +1 -1
- package/dist/assets/FilesTab-BOw97zky.js +1 -0
- package/dist/assets/{FilterBar-X_wz_owJ.js → FilterBar-DLMcpn_E.js} +1 -1
- package/dist/assets/GroupsTab-D5ycprxr.js +1 -0
- package/dist/assets/InstancesTab-TaKSA8bY.js +1 -0
- package/dist/assets/IntegrationsTab-D59mPoaZ.js +1 -0
- package/dist/assets/KpiTab-1Hx_0Uao.js +1 -0
- package/dist/assets/PreferencesTab-3cXC4S1l.js +1 -0
- package/dist/assets/ProjectPage-nBPDSUUX.js +1 -0
- package/dist/assets/PromptInjectionsTab-BHhqTYDk.js +4 -0
- package/dist/assets/RolesTab-DWR9sNW0.js +1 -0
- package/dist/assets/ScheduledTab-R_UJhAFC.js +1 -0
- package/dist/assets/ServiceAccountsTab-CJoq437S.js +1 -0
- package/dist/assets/{SubAgentReportsTab-CA10l1S0.js → SubAgentReportsTab-DCrEW3GB.js} +1 -1
- package/dist/assets/ThemeShowroom-BePky4K4.js +1 -0
- package/dist/assets/{TimeRangePicker-BlFrDLB9.js → TimeRangePicker-BIobKXvm.js} +1 -1
- package/dist/assets/{TimezoneCombobox-BA3O6eZs.js → TimezoneCombobox-C_pawxor.js} +1 -1
- package/dist/assets/TracesTab-l-lueZac.js +1 -0
- package/dist/assets/UsersTab-CNvCzpBh.js +1 -0
- package/dist/assets/VoiceTab-LihfD0So.js +1 -0
- package/dist/assets/{api-D2Ea_rY6.js → api-CnXjOprV.js} +5 -5
- package/dist/assets/{button-C9c-3Njl.js → button-C7mIcWuE.js} +1 -1
- package/dist/assets/{card-COkNbPw9.js → card-D96d_4Et.js} +1 -1
- package/dist/assets/chevrons-up-down-CPB13Hhb.js +1 -0
- package/dist/assets/{compatView-0pkLFCNc.js → compatView-D2UZENK3.js} +1 -1
- package/dist/assets/dispatchErrorInfo-Ct8igIIE.js +1 -0
- package/dist/assets/{dist-BZt5yEXf.js → dist-CLt4MJ3r.js} +1 -1
- package/dist/assets/{dist-Chlu3Bel.js → dist-CNXx0sNo.js} +1 -1
- package/dist/assets/{dist-BSFr9rqq.js → dist-CU23SxxP.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CFhvI6xT.js → highlighted-body-OFNGDK62-CO9Mn_bf.js} +1 -1
- package/dist/assets/index-0t8eOneo.js +327 -0
- package/dist/assets/{index-CGoAo2H9.css → index-CURSwr6F.css} +1 -1
- package/dist/assets/{list-s8ElIDmd.js → list-PsjK33SL.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BxbNoi0T.js +1 -0
- package/dist/assets/{pdf-vrIUMkQk.js → pdf-jxqL4Jk_.js} +1 -1
- package/dist/assets/roleDescriptions-Bm8ptI3N.js +1 -0
- package/dist/assets/{table-D53vcOfn.js → table-CXJLU3m_.js} +1 -1
- package/dist/assets/x-Cd7Svlfj.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-Cet_7r4V.js +0 -1
- package/dist/assets/AgentFilesTab-CTVR-pkS.js +0 -3
- package/dist/assets/AnomaliesTab-D7G9MCKb.js +0 -1
- package/dist/assets/AuditTab-CvwLRlTd.js +0 -1
- package/dist/assets/BridgeTab-CHIycJYg.js +0 -1
- package/dist/assets/ChatDefaultsTab-CWn54thx.js +0 -1
- package/dist/assets/FeedbacksTab-CGi92YyC.js +0 -1
- package/dist/assets/FilesTab-C1tAhkG0.js +0 -1
- package/dist/assets/GroupsTab-94Iw4jm-.js +0 -1
- package/dist/assets/InstancesTab-BNLNA4nb.js +0 -1
- package/dist/assets/IntegrationsTab-B3XCA4gw.js +0 -1
- package/dist/assets/KpiTab-BsOfR6tT.js +0 -1
- package/dist/assets/PreferencesTab-DKNZOBCb.js +0 -1
- package/dist/assets/ProjectPage-tdnC61Ri.js +0 -1
- package/dist/assets/PromptInjectionsTab-DpKasFs0.js +0 -4
- package/dist/assets/RolesTab-khMDI9wl.js +0 -1
- package/dist/assets/ScheduledTab-BYaln2ef.js +0 -1
- package/dist/assets/ServiceAccountsTab-D05azDp2.js +0 -1
- package/dist/assets/ThemeShowroom-CO51flds.js +0 -1
- package/dist/assets/TracesTab-C2UAlrlk.js +0 -1
- package/dist/assets/UsersTab-CFQ3xcc2.js +0 -1
- package/dist/assets/VoiceTab-CwEPSCNl.js +0 -1
- package/dist/assets/chevrons-up-down-Dwka889E.js +0 -1
- package/dist/assets/dispatchErrorInfo-dLN4uvIx.js +0 -1
- package/dist/assets/index-BzSSRi03.js +0 -327
- package/dist/assets/mermaid-GHXKKRXX-BC4jheGw.js +0 -1
- package/dist/assets/roleDescriptions-CzH2X2DX.js +0 -1
- package/dist/assets/x-CkieWYrV.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{JO as e,XO as t,YO as n,ZO as r,qO as i}from"./api-CnXjOprV.js";var a={pending:r,user:t,admin:n,observer:e,agent:i};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-CnXjOprV.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./api-CnXjOprV.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-0t8eOneo.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/x-
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
73
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-CnXjOprV.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CLt4MJ3r.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CU23SxxP.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CNXx0sNo.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/x-Cd7Svlfj.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/button-C7mIcWuE.js">
|
|
73
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CURSwr6F.css">
|
|
74
74
|
</head>
|
|
75
75
|
<body>
|
|
76
76
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.2",
|
|
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{$_ as r,Q_ as i,av as a,bG as o,cv as s,dv as c,ev as l,fv as u,iv as d,kG as f,lv as p,nv as m,ov as h,rv as g,sv as _,t as v,tv as y,uv as b}from"./api-D2Ea_rY6.js";import{At as x,et as S,it as C,nt as w,rt as T,tt as E}from"./index-BzSSRi03.js";var D=t(e(),1);function O(e){return e===`user`?m():e===`all`?y():l({group:e.group})}function k(e){return e===`common`?r():e===`owner`?i():l({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=f(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=f(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,A.jsxs)(S,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":c(),children:(0,A.jsx)(C,{placeholder:c()})}),(0,A.jsx)(E,{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:b()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:p()}),(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:s()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(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:_()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(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:g()}):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:h()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(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:d()}):(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{$l as r,Ag as i,Ah as a,Au as o,Bh as s,Ch as c,Cu as l,Dh as u,Du as d,EG as f,Eh as p,Eu as m,Fh as h,Fu as g,Hh as _,Ih as v,Jl as y,Lh as b,Mh as x,Mu as S,Nh as C,Nu as w,OG as T,Og as ee,Oh as E,Ou as D,Ph as te,Pu as O,Ql as k,Rh as ne,SG as A,Sh as j,Su as M,Ta as N,Th as P,Tu as F,Uh as re,Vh as ie,Wh as ae,Xl as oe,Yl as I,Zl as se,_h as L,_u as R,bG as z,bh as B,bu as V,gh as ce,gu as le,hh as H,hu as U,jI as ue,jh as de,ju as fe,kG as W,kh as pe,ku as me,ql as he,t as G,vh as ge,vu as _e,wh as ve,wu as ye,xh as be,xu as xe,yh as Se,yu as Ce,zh as we}from"./api-D2Ea_rY6.js";import{t as K}from"./button-C9c-3Njl.js";import{At as Te,Ct as Ee,Dt as De,Et as Oe,Ot as ke,St as Ae,Tt as je,V as Me,Z as Ne,at as Pe,et as Fe,it as Ie,jt as q,kt as Le,lt as Re,nt as ze,ot as Be,rt as Ve,st as He,tt as Ue,un as J,ut as We,wt as Ge}from"./index-BzSSRi03.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-0pkLFCNc.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*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=W(G.me.getMe,{host:Ne}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=W(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let c=W(G.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),l=W(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||c===void 0?r!==void 0&&r.length===0?[]:void 0:c.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,c,r,l]),[d,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&p($(u[0]))},[u,d]);let m=u?.find(e=>$(e)===d)??null,g=f(G.agentFiles.listAgentFiles),[y,w]=(0,Y.useState)({status:`idle`}),T=m?.instanceName??null,E=m?.agentId??null,D=W(G.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),O=n&&T!==null?Me(D,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,j=(0,Y.useCallback)(async()=>{if(!(T===null||E===null)){w({status:`loading`});try{w({status:`done`,files:(await g({instanceName:T,agentId:E})).files})}catch(e){w({status:`error`,dashboardAbsent:tt(e)})}}},[g,T,E]);(0,Y.useEffect)(()=>{k===!1&&j()},[j,k]);let[M,P]=(0,Y.useState)(null),F=W(G.agentFileCuration.listCurations,t&&T!==null&&E!==null?{instanceName:T,agentId:E}:`skip`),oe=W(G.agentFileCuration.curationSettings,t&&T!==null?{instanceName:T}:`skip`),I=f(G.agentFileCuration.requestCuration),[se,L]=(0,Y.useState)(null),[R,B]=(0,Y.useState)(null),{toast:V}=q(),ce=(0,Y.useMemo)(()=>{let e=new Map;for(let t of F??[])e.has(t.name)||e.set(t.name,t);return e},[F]),le=(0,Y.useCallback)(async e=>{if(!(T===null||E===null)){L(e);try{let t=await I({instanceName:T,agentId:E,name:e,trigger:`manual`});t.ok?V({title:S(),variant:`success`}):V({title:fe({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:o(),variant:`error`})}finally{L(null)}}},[I,T,E,V]),H=A(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Fe,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Ve,{size:`sm`,"aria-label":re(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ue,{children:(r??[]).map(e=>(0,Q.jsx)(ze,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Fe,{value:d??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(Ve,{size:`sm`,"aria-label":_(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ue,{children:u.map(e=>(0,Q.jsx)(ze,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]}),m===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(O.gatewayVersion,O.provider)]}):y.status===`loading`||y.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):y.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[y.dashboardAbsent?N():we(),` `,!y.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:ee()})]}):y.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:y.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)(Te,{variant:`outline`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:b({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:v({pct:U.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":h()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?C():x()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:oe?.budgetChars??null,enabled:oe?.enabled??!1,curation:ce.get(e.name)??null,inFlight:se===e.name,onCurate:()=>void le(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:te({used:Z(Qe(y.files),H),total:Z(Ye,H),pct:U.format(Ze(Qe(y.files)))})})]}),M&&m?(0,Q.jsx)(at,{instanceName:m.instanceName,agentId:m.agentId,name:M.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void j()}):null,R?(0,Q.jsx)(ot,{curationId:R,onClose:()=>B(null),onApplied:()=>{B(null),j()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:O()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Te,{variant:`outline`,className:`oc-afiles__curate-status`,children:w()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:g()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:o,onSaved:s}){let l=f(G.agentFiles.getAgentFile),d=f(G.agentFiles.setAgentFile),m=q(),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),[T,D]=(0,Y.useState)(!1),[te,O]=(0,Y.useState)(!1),k=(0,Y.useCallback)(async r=>{v(!1);try{let i=await l({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||b(i.content),D(!1)}catch{v(!0)}},[l,e,t,n]);(0,Y.useEffect)(()=>{k(!1)},[k]);async function ne(){if(h!==null){w(!0),O(!1);try{await d({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:h.updatedAtMs??void 0}),m.success(P({name:n})),s(),await k(!1)}catch(e){nt(e)?D(!0):O(!0)}finally{w(!1)}}}let M=h!==null&&y!==h.content,N=(0,Y.useMemo)(()=>h===null?null:et(h.content,y),[h,y]),F=y.length>X,re=A(),ie=(0,Y.useMemo)(()=>new Intl.NumberFormat(re),[re]);return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(We,{children:de({name:n})}),(0,Q.jsxs)(He,{children:[a({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,pe()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[c(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void k(!1),children:ee()})]}):h===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>b(e.target.value),"aria-label":de({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:E()}),T?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void k(!0),children:be()})]}):null,te?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:ve()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${F?` is-over`:``}`,children:u({count:ie.format(y.length),max:ie.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!M||C||T,onClick:()=>S(!0),children:C?i():p()}):null]})]}),(0,Q.jsx)(Ae,{open:x,onOpenChange:S,children:(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Le,{children:B({name:n})}),(0,Q.jsx)(Oe,{children:Se({agent:t})})]}),N?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ge({added:N.added,removed:N.removed})}),N.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:L()}),N.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,N.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ce()}),N.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Ge,{children:ue()}),(0,Q.jsx)(Ee,{onClick:()=>void ne(),children:H()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let a=W(G.agentFileCuration.getProposal,{curationId:e}),s=f(G.agentFileCuration.approveCuration),c=T(G.agentFileCuration.rejectCuration),{toast:u}=q(),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,b]=(0,Y.useState)(``),x=A(),S=(0,Y.useMemo)(()=>a?et(a.beforeContent,a.proposedContent):null,[a]);async function C(){h(`approve`);try{let t=await s({curationId:e});t.ok?(u({title:me(),variant:`success`}),n()):u({title:t.reason===`conflict`?d():m({reason:t.reason??`unknown`}),variant:`error`})}catch{u({title:o(),variant:`error`})}finally{h(null)}}async function w(n){h(`reject`);try{let r=v.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?u({title:n?y():D(),variant:`success`}):u({title:l(),variant:`error`}),t()}catch{u({title:o(),variant:`error`})}finally{h(null)}}return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(We,{children:a?F({name:a.name}):z()}),(0,Q.jsx)(He,{children:ye()})]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):a===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:[M({before:Z(a.beforeSize,x),after:Z(a.proposedSize,x)}),a.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,xe()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:V({added:S.added,removed:S.removed})}):null,a.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:he({feedback:a.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:U()}),(0,Q.jsx)(`ul`,{children:S.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:le()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:Ce()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.proposedContent})]})]})]}),g?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:r()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:k(),value:v,onChange:e=>b(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>_(!1),disabled:p!==null,children:se()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void w(!1),disabled:p!==null,children:p===`reject`?i():oe()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(!0),disabled:p!==null,children:p===`reject`?i():I()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>_(!0),disabled:p!==null||a==null,children:_e()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void C(),disabled:p!==null||a==null,children:p===`approve`?i():R()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AO as i,BD as a,CO as ee,DO as te,EO as o,GD as s,HD as c,JD as ne,KD as l,MO as u,NO as d,OG as re,OO as ie,PO as f,QD as ae,SO as oe,TO as se,UD as p,VD as m,WD as h,XD as ce,YD as le,ZD as ue,_O as de,aO as fe,bO as pe,cO as me,dO as g,eO as he,fO as ge,gO as _e,hO as ve,iO as _,jO as ye,kG as v,kO as be,lO as xe,mO as Se,nO as Ce,oO as y,pO as b,qD as x,rO as S,sO as C,t as w,tO as T,uO as E,vO as D,wO as O,xO as k,yO as A,zD as j}from"./api-D2Ea_rY6.js";import{At as M,Gn as N,Kn as we,Z as Te,at as P,et as F,ft as I,i as Ee,it as L,jt as De,lt as R,nt as z,o as Oe,ot as B,q as ke,rt as V,tt as H,ut as U}from"./index-BzSSRi03.js";import{n as Ae}from"./TimeRangePicker-BlFrDLB9.js";import{t as je}from"./FilterBar-X_wz_owJ.js";import{t as Me}from"./DataTableShell-DoTsQFjZ.js";import{t as W}from"./dispatchErrorInfo-dLN4uvIx.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?f():e===`acknowledged`?d():u()}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??``,a=e.status===J?q:e.status,s=e.severity??q,c=e.kind??q,[l,u]=(0,G.useState)(q),d=Ee(e.from,e.to),{from:f,to:p}=Ae(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,status:e===q?J:e})}),j=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})}),R=e=>void t({search:t=>({...t,...Oe(e)})}),B=ke(),U=De(),W=re(w.anomalies.resolveAnomaly),Y=(v(w.me.getMe,{host:Te})?.permissions??[]).includes(`admin.manage`),X=v(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:f,to:p,anomalyStatus:a===q?void 0:a,severity:s===q?void 0:s,source:l===q?void 0:l,kind:c===q?void 0:c}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||a!==`open`||s!==q||l!==q||c!==q||d.kind!==`relative`||d.from!==Le.from;function Ue(){u(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await B({title:ye(),description:(0,K.jsxs)(K.Fragment,{children:[i(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,be(),` `,(0,K.jsx)(`strong`,{children:ie()}),`.`,` `,te()]}),confirmLabel:o()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(se(),e.kind)}catch(e){U.error(O(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(ee(),e.kind)}catch(e){U.error(oe(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,K.jsx)(`strong`,{children:pe()}),` `,A(),` `,(0,K.jsx)(`strong`,{children:D()}),` `,de(),` `,(0,K.jsx)(`strong`,{children:_e()}),` `,ve(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:Se()})]}),(0,K.jsxs)(je,{q:n,onQChange:m,searchPlaceholder:b(),timeRange:d,onTimeRangeChange:R,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(F,{value:a,onValueChange:h,children:[(0,K.jsx)(V,{size:`sm`,className:`w-36`,children:(0,K.jsx)(L,{})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(z,{value:q,children:ge()}),Ne.map(e=>(0,K.jsx)(z,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(F,{value:s,onValueChange:j,children:[(0,K.jsx)(V,{size:`sm`,className:`w-36`,children:(0,K.jsx)(L,{placeholder:g()})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(z,{value:q,children:C()}),Fe.map(e=>(0,K.jsx)(z,{value:e,children:e},e))]})]}),(0,K.jsxs)(F,{value:l,onValueChange:u,children:[(0,K.jsx)(V,{size:`sm`,className:`w-32`,children:(0,K.jsx)(L,{placeholder:y()})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(z,{value:q,children:fe()}),Ie.map(e=>(0,K.jsx)(z,{value:e,children:e},e))]})]}),(0,K.jsxs)(F,{value:c,onValueChange:P,children:[(0,K.jsx)(V,{size:`sm`,className:`w-36`,children:(0,K.jsx)(L,{placeholder:_()})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(z,{value:q,children:S()}),Z.map(e=>(0,K.jsx)(z,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:Ce(),rows:X,emptyHint:a===`open`?T():he(),rowActions:e=>Y&&e.status===`open`?[{label:r(),onSelect:()=>void We(e)},{label:ae(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ue(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:I(e.at)}),sort:e=>e.at},{header:_(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:E(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:me({when:I(e.firstAt)}),children:xe({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:g(),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:y(),cell:e=>(0,K.jsx)(M,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:le(),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)($,{row:e})]}),sort:e=>e.message},{header:ne(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:x(),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 ze({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 $({row:e}){let[t,n]=(0,G.useState)(!1),r=v(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)(P,{open:t,onOpenChange:n,children:(0,K.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(U,{children:h()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:p()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:c()}):(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:m()}):e===`acknowledged`?(0,K.jsx)(M,{variant:`secondary`,children:a()}):(0,K.jsx)(M,{variant:`outline`,children:j()})}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{Ak as r,Bk as i,Dk as a,Ek as o,Fk as s,Gc as c,Ik as l,Jc as u,Kc as d,Lk as f,Mk as p,Nk as m,Ok as h,Pk as g,Rk as _,Wc as v,Yc as y,jk as b,kG as x,kk as S,qc as C,t as w,zk as T}from"./api-D2Ea_rY6.js";import{Gn as E,Kn as D,a as O,et as k,ft as A,i as j,it as M,n as N,nt as P,o as F,rt as I,s as L,tt as R}from"./index-BzSSRi03.js";import{n as ee}from"./TimeRangePicker-BlFrDLB9.js";import{t as z}from"./FilterBar-X_wz_owJ.js";import{t as B}from"./AdvancedFilter-DHhZAptC.js";import{t as V}from"./DataTableShell-DoTsQFjZ.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:y()},{value:`realLabel`,label:u()},{value:`targetLabel`,label:C()},{value:`impersonated`,label:d()},{value:`resource`,label:c()},{value:`resourceId`,label:v()}];function q(){let e=D({from:`/settings/audit`}),t=E({from:`/settings/audit`}),n=e.q??``,c=e.action??G,u=e.impersonated??G,d=e.resource??G,v=j(e.from,e.to),y=(0,H.useMemo)(()=>L(e.adv),[e.adv]),{from:C,to:N}=ee(v),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,...F(e)})}),Q=e=>void t({search:t=>({...t,adv:O(e)}),replace:!0}),$=x(w.admin.listAudit,{filter:{q:n||void 0,from:C,to:N,action:c===G?void 0:c,resource:d===G?void 0:d,impersonated:u===G?void 0:u===`yes`,advanced:y.length>0?y:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||c!==G||u!==G||d!==G||y.length>0||v.kind!==`relative`||v.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:[i(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:T()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:_(),timeRange:v,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(k,{value:c,onValueChange:J,children:[(0,U.jsx)(I,{size:`sm`,className:`w-40`,children:(0,U.jsx)(M,{placeholder:f()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{value:G,children:l()}),te.map(e=>(0,U.jsx)(P,{value:e,children:e},e))]})]}),(0,U.jsxs)(k,{value:u,onValueChange:Y,children:[(0,U.jsx)(I,{size:`sm`,className:`w-40`,children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{value:G,children:s()}),(0,U.jsx)(P,{value:`yes`,children:g()}),(0,U.jsx)(P,{value:`no`,children:m()})]})]}),(0,U.jsxs)(k,{value:d,onValueChange:X,children:[(0,U.jsx)(I,{size:`sm`,className:`w-40`,children:(0,U.jsx)(M,{placeholder:p()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{value:G,children:b()}),ne.map(e=>(0,U.jsx)(P,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:y,onChange:Q}),(0,U.jsx)(V,{title:r(),rows:$,emptyHint:S(),columns:[{header:h(),cell:e=>A(e.at),sort:e=>e.at},{header:f(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:o(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:p(),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{$m as r,$w as i,AT as a,Aw as o,Bw as s,Cw as c,D as l,Dw as u,EG as d,ET as f,Ea as p,Ew as m,FT as ee,Fw as h,Gw as te,Hw as g,IT as ne,Iw as _,Jm as v,Jw as re,Km as y,Kw as b,Lw as ie,MT as ae,Mw as oe,NT as se,Nw as ce,OG as le,Ow as ue,PT as de,Pw as fe,Qm as pe,Qw as me,RT as he,Rw as ge,Sw as _e,TT as ve,Tw as ye,Uw as be,Vm as xe,Vw as Se,Ww as Ce,Xm as we,Xw as Te,Ym as Ee,Yw as De,Zm as Oe,Zw as ke,_w as Ae,ai as je,aw as x,bw as Me,cw as Ne,dc as Pe,dw as Fe,eT as Ie,eh as Le,fc as Re,fw as ze,gw as Be,hc as Ve,hw as He,ih as Ue,jT as We,jw as Ge,kG as S,kT as Ke,kw as qe,lw as Je,mc as Ye,mw as Xe,nT as Ze,nh as Qe,ow as C,pc as $e,pw as et,qm as tt,qw as nt,rT as rt,rh as it,sw as at,t as w,tT as ot,th as st,uw as ct,vc as lt,vw as ut,ww as dt,xw as ft,yw as T,zT as pt,zw as mt}from"./api-D2Ea_rY6.js";import{r as E}from"./dist-BSFr9rqq.js";import{t as ht}from"./chevrons-up-down-Dwka889E.js";import{i as gt,n as D,o as _t,r as vt,s as yt}from"./FieldLabel-CL1-4y9n.js";import{t as O}from"./button-C9c-3Njl.js";import{At as k,Bn as bt,Ft as A,G as xt,Gn as j,Ht as St,K as Ct,Kn as wt,N as Tt,On as Et,U as Dt,Ut as Ot,Vn as M,W as kt,Wt as At,Z as jt,at as Mt,et as N,ft as Nt,it as P,jt as Pt,lt as Ft,mn as F,mt as It,nt as I,ot as Lt,pt as L,rt as R,st as Rt,tt as z,un as B,ut as zt,zn as Bt}from"./index-BzSSRi03.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-D53vcOfn.js";import{t as Gt}from"./FilterBar-X_wz_owJ.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as W,t as Zt}from"./compatView-0pkLFCNc.js";import{t as G}from"./dispatchErrorInfo-dLN4uvIx.js";var Qt=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$t=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function en(e){return e.filter(e=>e.state===`error`)}function tn(e){return e.reachable&&en(e.targets).length===0}function nn(e){return tn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function rn(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return rn(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return W(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function vn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(un),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),s=(0,K.useMemo)(()=>gn(o),[o]),l=(0,K.useMemo)(()=>_n(o),[o]),u=(0,K.useMemo)(()=>vn(o),[o]),d=(0,K.useMemo)(()=>hn(fn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Me(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(N,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:ut()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(I,{value:Y,children:T()}),s.map(e=>(0,Q.jsx)(I,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(N,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:Ae()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(I,{value:Y,children:T()}),l.map(e=>(0,Q.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(N,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:Be()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(I,{value:Y,children:T()}),u.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:Xe(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:et(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ze(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Fe(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ct(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(V,{children:Je()}),(0,Q.jsx)($,{label:Ne(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Ut,{children:d.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(bt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=rn(e)?G(e.lastErrorCode):null,n=an(e)?G(e.lastDownstreamRejectCode):null,r=on(e)?G(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:_e({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:L(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${L(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[je({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${L(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ft({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${L(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?at():e===`error`?C():x()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(k,{variant:`secondary`,children:at()}):e===`error`?(0,Q.jsx)(k,{variant:`destructive`,children:C()}):(0,Q.jsx)(k,{variant:`outline`,children:x()})}function Cn(){return S(w.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=S(w.compat.getBridgeCompat,{}),n=S(w.me.getMe,{host:jt})?.role===`admin`,r=S(w.admin.listInstances,n?{}:`skip`),i=S(w.agents.usageForInstances,n?{}:`skip`),a=j(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=wt({from:`/settings/bridge`}),l=j({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,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:be()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:g()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Ve()}),(0,Q.jsx)(V,{children:Ye()}),(0,Q.jsx)(V,{children:$e()}),(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)(V,{children:Pe()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Dt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(xt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(Ct,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(F,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(kt,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,s=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Qe(),children:[`(`,a,`)`]})]}):null,i?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,st({build:t.buildVersion??`?`})]}):null,` · `,Le(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?r():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ce()});let c=en(e.targets),l=!e.reachable,d=nn(e),f=e.unreachableInstances??[],p=d===`ok`?`ok`:d===`gateways_unreachable`?`warn`:`error`,ee=Nt(e.checkedAt),h=e.startedAt==null?null:Nt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${p}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:d===`ok`?(0,Q.jsx)(Bt,{size:22}):l||d===`gateways_unreachable`?(0,Q.jsx)($t,{size:22}):(0,Q.jsx)(B,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:d===`ok`?oe():d===`gateways_unreachable`?ue({count:f.length}):l?Ge():o({count:c.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Qt,{size:12,"aria-hidden":!0}),` `,qe({time:ee})]}),h?(0,Q.jsx)(`span`,{children:m({time:h})}):null,s]}),d===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:u({names:f.join(`, `)})}):null,l?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ye()})]})}function En({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=Zt(l.map(e=>e.state)),[f,p]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(F,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(k,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ue()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(M,{size:13,"aria-hidden":!0}),dt({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Se(),i.length>0?(0,Q.jsx)(k,{variant:`destructive`,children:mt({count:i.length})}):a>0?(0,Q.jsx)(k,{variant:`destructive`,children:ge()}):(0,Q.jsx)(k,{variant:`secondary`,children:s()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie({version:e.vendoredVersion}),r?` · `+_({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(M,{size:13,"aria-hidden":!0}),h({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:i,instanceRows:a,providerName:o}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:lt({provider:o})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:we({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:r()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(Mt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(zt,{children:pt({instance:e.displayName??e.name})}),(0,Q.jsx)(Rt,{children:he()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Bt,{"aria-hidden":!0}):(0,Q.jsx)(B,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?nt():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,b()]}):null}function jn({instance:e,onClose:t}){let n=le(w.admin.upsertInstanceConfig),r=d(w.bridge.validateMediaPaths),o=Pt(),s=Vt(e.config?.contentLocale,void 0),[c,l]=(0,K.useState)(()=>gt(e.config??{},s)),[u,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),v=c.inboundMediaMode===`shared-fs`,y=c.mediaMode===`shared-fs`,b=v||y;async function ie(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){o.error(ke(),e)}finally{h(!1)}}async function oe(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(c,r,s)}),t()}catch(e){o.error(We(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ne(),help:a()}),(0,Q.jsxs)(N,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(z,{children:yt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ee(),help:Ke()}),(0,Q.jsxs)(N,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(z,{children:_t.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:de(),help:f()}),(0,Q.jsx)(A,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:rt(),help:Ze()}),(0,Q.jsx)(A,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ot(),help:Ie()}),(0,Q.jsx)(A,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(It,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(D,{label:se(),help:ve()})]}),b&&g!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),Ce({reason:g.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:De(),result:g.inbound}),(0,Q.jsx)(An,{label:re(),result:g.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),te()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Q.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void ie(),disabled:m,children:[m?(0,Q.jsx)(Et,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?me():i()]}),(0,Q.jsx)(O,{size:`sm`,onClick:()=>void oe(),disabled:u,children:ae()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(St,{children:[(0,Q.jsx)(At,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ee():v({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ot,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:tt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -1 +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,Cg as a,Dd as o,EG as s,Ed as c,Fd as l,LT as u,Md as d,Nd as f,OG as p,Od as m,Og as h,Pd as g,Uh as _,_c as v,ah as y,bG as b,ch as x,dh as S,fh as C,jd as w,kG as T,kd as E,lh as D,oh as O,ph as k,sh as A,t as j,uh as M,wg as N}from"./api-D2Ea_rY6.js";import{t as P}from"./button-C9c-3Njl.js";import{B as F,Ft as I,H as L,V as R,et as z,it as B,mt as V,nt as H,rt as U,tt as W,un as G}from"./index-BzSSRi03.js";import{a as K}from"./compatView-0pkLFCNc.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=p(j.admin.upsertInstanceConfig),n=T(j.agents.listAgentsForInstance,{instanceName:e.name}),a=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[o,s]=(0,q.useState)(a),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(a),l(`idle`)},[e._id,a]);let u=`__none__`,f=o!==a;async function m(){l(`saving`);try{let n={...e.config??{}};o===``||o===u?delete n.converterAgentId:n.converterAgentId=o,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(z,{value:o===``?u:o,onValueChange:e=>s(e===u?``:e),children:[(0,X.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":d(),children:(0,X.jsx)(B,{placeholder:r()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(H,{value:u,children:r()}),h.map(e=>(0,X.jsx)(H,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?i():A()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null]})}function Q({instance:e}){let t=p(j.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let h=c.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=a!==n||(g??null)!==r;async function b(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(V,{checked:a,onCheckedChange:e=>s(e===!0),"aria-label":f()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(I,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":E(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!_||u===`saving`,onClick:()=>void b(),children:u===`saving`?i():A()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()})]})}function $({instance:e}){let t=p(j.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let u=r.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(I,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!f||o===`saving`,onClick:()=>void h(),children:o===`saving`?i():A()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:c()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()})]})}function ee(){let e=s(j.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=T(j.admin.listInstances,{}),[i,o]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[r,i]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,d=T(j.compat.forInstance,i?{instanceName:i}:`skip`),f=i?R(d,`configDefaults`):`loading`,p=f===`loading`?null:f.blocked,m=(0,q.useMemo)(()=>c&&i?{instanceName:i}:{},[c,i]),g=(0,q.useRef)(0),y=(0,q.useCallback)(async()=>{let t=++g.current;n({status:`loading`});try{let r=Y(await e(m));if(g.current!==t)return;n({status:`done`,current:r})}catch{if(g.current!==t)return;n({status:`error`})}},[e,m]);(0,q.useEffect)(()=>{p===!1&&(c&&!i||y())},[y,p,c,i]);let w=t.status===`done`?t.current:null,E=(0,q.useMemo)(()=>J.map(e=>({id:e,label:L(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:N()},{id:`standard`,label:a()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),c&&i?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsxs)(z,{value:i,onValueChange:e=>o(e),children:[(0,X.jsx)(U,{size:`sm`,"aria-label":_(),children:(0,X.jsx)(B,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(H,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):f===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):f.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(G,{size:14,"aria-hidden":!0}),` `,K(f.gatewayVersion,f.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[x(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:h()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,X.jsx)(F,{field:`thinkingLevel`,options:E,value:w?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:C()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,X.jsx)(F,{field:`fastMode`,options:O,value:w===null||w.fastModeDefault===null?null:w.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:M()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:D()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:v()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AM as i,BM as a,CM as o,DM as s,EM as c,FM as l,GM as u,HM as d,IM as f,JM as p,KM as m,LM as ee,MM as te,NM as ne,OG as h,OM as g,PM as re,QM as _,RM as ie,SM as v,TM as y,UM as ae,VM as b,Vu as x,WM as S,XM as C,YM as w,ZM as T,_M as E,aM as D,aN as O,bM as k,cM as A,dM as j,eN as M,fM as N,gM as P,hM as F,iM as I,iN as L,jM as R,kG as z,kM as B,lM as V,mM as H,nN as U,oM as oe,oN as W,pM as G,qM as K,rN as q,sM as se,t as J,tN as ce,uM as le,vM as ue,wM as de,xM as fe,yM as pe,zM as me,zu as he}from"./api-D2Ea_rY6.js";import{t as ge}from"./button-C9c-3Njl.js";import{ft as _e,q as Y}from"./index-BzSSRi03.js";import{t as ve}from"./DataTableShell-DoTsQFjZ.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>W(),incorrect:()=>O(),incoherence:()=>L(),formatting:()=>q(),latency:()=>U(),api_error:()=>ce(),other:()=>M()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:_()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:r()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,o=h(J.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1);async function T(){let t=g.trim();if(!(!t||v)){y(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),_(``)}finally{y(!1)}}}let E=[];try{E=r.contextJson?JSON.parse(r.contextJson):[]}catch{E=[]}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?` · ${C()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:de(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(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:p()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?K():e.authorRole===`agent`?e.authorLabel??x():m()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:u()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:S(),value:g,maxLength:2e3,rows:3,onChange:e=>_(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void T(),disabled:!g.trim()||v,children:v?ae():d()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||a()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:me()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||a()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,E.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee({count:r.contextCount??E.length,truncated:r.contextTruncated?f():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:E.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:l()}),(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:re()}),(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:ne()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?te({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:[R(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,i()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=z(J.feedback.listForAdmin,{}),t=h(J.feedback.readSnapshot),n=h(J.feedback.deleteFeedback),r=Y(),[i,a]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function d(e){if(i===e._id){a(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}a(e._id)}async function f(e){await r({title:oe(),description:D(),confirmLabel:I(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[B(),` `,(0,Z.jsx)(`strong`,{children:g()}),` `,s()]}),(0,Z.jsx)(ve,{title:c(),rows:e,emptyHint:y(),isExpanded:e=>i===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:o(),cell:e=>_e(e.at),sort:e=>e.at},{header:v(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:fe(),cell:e=>e.messageRole===`user`?k():pe(),sort:e=>e.messageRole},{header:ue(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${E({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:P(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:F(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:N()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:he()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:j()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?V():A(),onSelect:()=>void d(e)},{label:se(),onSelect:()=>void f(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{AW as r,BW as i,CW as ee,DW as a,EW as o,FW as s,Gu as c,IW as te,LW as l,MW as ne,NW as u,OG as d,OW as f,PW as p,RW as m,SG as re,SW as ie,TW as h,VW as ae,Wu as oe,_W as se,bG as ce,bW as le,cW as ue,dW as de,fW as fe,gW as pe,hW as me,jI as he,jW as ge,kG as _e,kW as g,lW as ve,mW as _,oW as ye,pW as be,sW as xe,t as v,uW as y,vW as b,wW as x,xW as S,yW as C,zW as w}from"./api-D2Ea_rY6.js";import{t as T}from"./button-C9c-3Njl.js";import{At as E,Ct as D,Dt as O,Et as k,Fn as A,In as j,It as M,Lt as Se,Ot as Ce,Rt as N,St as we,Tt as Te,Vt as Ee,dn as De,et as P,gn as Oe,it as F,jt as ke,kt as Ae,mt as je,nt as I,rt as L,tt as R,wt as Me}from"./index-BzSSRi03.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-D53vcOfn.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return r();case`audio`:return g();case`video`:return f();case`pdf`:return a();case`document`:return o();case`archive`:return h();default:return x()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[a,o]=(0,H.useState)(W),[f,h]=(0,H.useState)(W),[g,x]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=d(v.files.softDelete),Y=ke();function Ie(){t(W),r(W),o(W),h(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(be())}catch(e){Y.error(fe(),e)}}let X=_e(v.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:a===W?void 0:a,category:f===W?void 0:f,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(re(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||a!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":i(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:w()}),(0,U.jsx)(I,{value:`inbound`,children:m()}),(0,U.jsx)(I,{value:`outbound`,children:l()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:r,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":te(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:s()}),Q.chats.map(e=>(0,U.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:a,onValueChange:o,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":p(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:u()}),Q.instances.map(e=>(0,U.jsx)(I,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:f,onValueChange:h,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ne(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:ge()}),Q.categories.map(e=>(0,U.jsx)(I,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(je,{checked:g,onCheckedChange:e=>x(e===!0),"aria-label":c()}),(0,U.jsx)(`span`,{children:c()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Oe,{size:14,"aria-hidden":!0}),pe()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?xe():ue()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:ee()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:S()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:C()}),(0,U.jsx)(z,{className:`text-right`,children:b()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(E,{variant:`outline`,style:{marginLeft:6},children:oe()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(E,{variant:`secondary`,children:e.direction===`inbound`?m():l()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(M,{children:[(0,U.jsx)(Ee,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":me(),children:(0,U.jsx)(A,{size:16})})}),(0,U.jsxs)(Se,{align:`end`,children:[e.url?(0,U.jsx)(N,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),se()]})}):(0,U.jsxs)(N,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),ve()]}),(0,U.jsxs)(N,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(De,{size:14}),_()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ye({cap:Be})}):null]}),(0,U.jsx)(we,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(Te,{children:[(0,U.jsxs)(Ce,{children:[(0,U.jsx)(Ae,{children:de()}),(0,U.jsx)(k,{children:y()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Me,{children:he()}),(0,U.jsx)(D,{onClick:()=>void Le(),children:_()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,A_ as i,B_ as a,C_ as o,D as s,D_ as c,E_ as l,F_ as u,G_ as d,Gg as f,H_ as p,Hg as m,I_ as h,J_ as g,Jg as _,K_ as v,Kg as y,L_ as ee,M_ as b,N_ as te,OG as x,O_ as S,P_ as C,Qg as w,R_ as ne,S_ as T,T_ as E,U_ as D,Ug as O,V_ as k,W_ as re,Wg as ie,X_ as A,Xg as j,Y_ as M,Yg as N,Z_ as ae,Zg as P,__ as F,a_ as I,b_ as L,c_ as oe,d_ as se,e_ as ce,f_ as le,g_ as ue,h_ as de,i_ as fe,j_ as pe,kG as R,k_ as me,l_ as he,m_ as ge,n_ as _e,o_ as ve,p_ as z,q_ as ye,qg as be,r_ as xe,s_ as Se,t as B,t_ as Ce,u_ as we,v_ as Te,w_ as Ee,x_ as De,y_ as Oe,z_ as ke}from"./api-D2Ea_rY6.js";import{t as Ae}from"./x-CkieWYrV.js";import{t as V}from"./button-C9c-3Njl.js";import{At as H,Ft as U,G as je,Hn as Me,K as W,U as Ne,Vn as Pe,W as G,Z as Fe,_ as Ie,at as Le,cn as Re,et as ze,fn as K,it as Be,jt as q,lt as Ve,mn as J,mt as Y,nt as He,ot as Ue,pn as X,q as We,rt as Ge,st as Ke,tt as qe,ut as Je}from"./index-BzSSRi03.js";import{t as Ye}from"./FilterBar-X_wz_owJ.js";import{t as Xe}from"./DataTableShell-DoTsQFjZ.js";import{t as Z}from"./DetailChips-B3snpzri.js";var Ze=s(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),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 Te();case`user`:return F();case`pending`:return ue();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=R(B.groups.listGroups,{}),t=R(B.me.getMe,{host:Fe})?.role===`admin`,n=x(B.groups.createGroup),r=x(B.groups.updateGroup),o=x(B.groups.deleteGroup),s=We(),c=q(),[l,m]=(0,Q.useState)(!1),[_,y]=(0,Q.useState)(null),[S,w]=(0,Q.useState)(it),[T,E]=(0,Q.useState)(null),[O,j]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=O.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,O]);function P(){y(null),w(it),m(!0)}function F(e){y(e),w({name:e.name,description:e.description??``}),m(!0)}async function I(){try{_?await r({groupId:_._id,name:S.name,description:S.description}):await n({name:S.name,description:S.description||void 0}),w(it),y(null),m(!1)}catch(e){c.error(f(),e)}}async function L(e){if(await s({title:b({name:e.name}),description:pe(),confirmWord:e.name,confirmLabel:i(),cancelLabel:ne(),destructive:!0}))try{await o({groupId:e._id})}catch(e){c.error(ie(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),(0,$.jsx)(Ye,{q:O,onQChange:j,onReset:()=>j(``),canReset:O!==``,searchPlaceholder:D()}),(0,$.jsx)(Xe,{title:ae(),rows:N,addLabel:M(),onAdd:t?P:void 0,emptyHint:g(),columns:[{header:ye(),cell:e=>e.name,sort:e=>e.name},{header:v(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Re,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:d(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:re(),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)(K,{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:()=>F(e)},{label:a(),variant:`destructive`,onSelect:()=>void L(e)}]:[]]}),(0,$.jsx)(Ie,{open:l,onOpenChange:m,title:_?h():ee(),description:u(),canSubmit:!!S.name.trim(),onSubmit:I,submitLabel:ke(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:C()}),(0,$.jsx)(U,{value:S.name,onChange:e=>w({...S,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,$.jsx)(U,{value:S.description,onChange:e=>w({...S,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==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)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Me,{size:14,"aria-hidden":!0}),De()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Oe({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[L(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=R(B.groups.getGroup,n&&e?{groupId:e}:`skip`),a=R(B.groups.listAssignableInstances,n?{}:`skip`),s=R(B.groups.listAssignableUsers,n?{}:`skip`),u=x(B.groups.addMember),d=x(B.groups.removeMember),f=x(B.groups.bulkSetMembers),p=x(B.groups.setGroupManager),m=q(),[h,g]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[ee,b]=(0,Q.useState)(`members`),[te,C]=(0,Q.useState)(1),[w,ne]=(0,Q.useState)(new Set),D=(0,Q.useRef)(null),k=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ie=i?.viewerIsAdmin===!0,A=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{g(``),y(``),b(`members`),C(1),D.current=null},[n,e]),(0,Q.useEffect)(()=>{C(1)},[h]),(0,Q.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,ne(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let M=(0,Q.useMemo)(()=>s?Qe(s,h,w):[],[s,h,w]);async function ae(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){m.error(O(),e)}}async function P(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(be(),e)}}let F=nt(M,e=>k.has(e.userId)),I=M.filter(e=>k.has(e.userId)).length,L=rt(M,te,ot);async function oe(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:F!==`all`})}catch(e){m.error(O(),e)}}return(0,$.jsx)(Le,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ue,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Je,{children:me({name:t})}),(0,$.jsx)(Ke,{children:S()})]}),(0,$.jsxs)(Ne,{value:ee,onValueChange:b,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(W,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Re,{size:13,"aria-hidden":!0}),c(),i?(0,$.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(W,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),E(),i?(0,$.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(W,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),fe(),i?(0,$.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(G,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{value:h,onChange:e=>g(e.target.value),placeholder:l(),className:`oc-access__search`}),M.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(0,$.jsxs)($.Fragment,{children:[M.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void oe(),"aria-label":T()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:T()}),(0,$.jsxs)(H,{variant:`outline`,className:`oc-access__count`,children:[I,` / `,M.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=k.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":de({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)(H,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?_():N(),title:r?_():N(),onClick:()=>void P(e.userId,r),children:(0,$.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":j(),title:j(),children:(0,$.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:C})]})]})}),(0,$.jsx)(G,{value:`agents`,children:a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):a.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{value:v,onChange:e=>y(e.target.value),placeholder:Ee(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:A,query:v},`${e}-${t._id}`))})]})}),(0,$.jsx)(G,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=R(B.groups.listAssignableAgents,{instanceName:t}),o=x(B.groups.assignAgentToGroup),s=x(B.groups.removeAgentFromGroup),c=x(B.groups.bulkSetGroupAgents),l=q(),[u,d]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{d(1)},[i]),!e)return null;let f=$e(a?.agents??[],i),p=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let h=f.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(f,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(m(),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(m(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n}),p?(0,$.jsx)(H,{variant:`outline`,className:`oc-access__stale`,children:Se()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:le()}):f.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:p?oe():he()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":T()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:T()})]}):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)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":ge({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":I(),title:I(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:ve()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=R(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=x(B.charts.assignChartToGroup),i=x(B.charts.removeChartFromGroup),a=x(B.charts.setGroupDefaultChart),o=x(B.charts.addChartToGroupPool),s=x(B.charts.removeChartFromGroupPool),c=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:xe()});async function f(t,r){try{r?await i({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(y(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(y(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(y(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(y(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":r({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":w(),title:w(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:P()}):null,d?(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":ce({name:e.name}),title:ce({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,$.jsxs)(ze,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(Ge,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Be,{placeholder:Ce()})}),(0,$.jsx)(qe,{children:u.map(e=>(0,$.jsx)(He,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):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{$A as r,$d as i,$k as a,AA as o,Ai as s,Aj as c,B as l,BA as u,CA as d,Ci as f,Cj as p,DA as m,DT as h,Di as g,Dj as _,EA as v,EG as y,ER as b,Ei as x,Ej as ee,FA as S,G as C,GA as w,Gk as T,H as E,HA as D,Hk as te,IA as O,JA as ne,Jk as re,K as ie,KA as ae,Kk as oe,L as se,LA as ce,MA as le,NA as ue,OA as de,OG as k,OT as fe,Oi as pe,Oj as me,PA as he,QA as ge,Qd as _e,Qk as ve,R as ye,RA as be,SA as xe,Sc as Se,Si as Ce,Sj as we,TA as Te,TR as A,Ti as Ee,Tj as De,U as Oe,UA as ke,Uk as Ae,V as je,VA as Me,Vk as Ne,W as Pe,WA as Fe,Wk as Ie,XA as Le,Xd as Re,Xk as ze,YA as Be,Yk as Ve,ZA as He,Zd as Ue,Zk as We,_A as Ge,_i as Ke,_j as qe,aA as Je,aj as Ye,bA as Xe,bc as Ze,bi as Qe,bj as $e,cA as et,cj as tt,dA as j,dj as nt,eA as rt,ej as it,fA as at,fj as ot,gA as M,gi as st,gj as N,hA as ct,hi as lt,hj as ut,iA as dt,ij as ft,jA as pt,ji as mt,kA as ht,kG as P,ki as gt,kj as _t,lA as vt,lj as yt,mA as bt,mj as xt,nA as St,nj as Ct,oA as wt,oj as Tt,pA as Et,pj as Dt,qA as Ot,qk as kt,rA as At,rj as jt,sA as Mt,sj as Nt,t as F,tA as Pt,tj as Ft,uj as It,vA as Lt,vi as Rt,vj as zt,wA as Bt,wi as Vt,wj as Ht,xA as Ut,xc as Wt,xi as Gt,xj as Kt,yA as qt,yi as Jt,yj as Yt,z as Xt,zA as Zt}from"./api-D2Ea_rY6.js";import{a as Qt,c as $t}from"./FieldLabel-CL1-4y9n.js";import{t as I}from"./button-C9c-3Njl.js";import{At as L,Ft as R,Ht as en,Ut as tn,Wt as nn,_ as rn,at as an,et as z,it as B,jt as V,lt as H,mt as U,nt as W,ot as G,q as on,rt as K,st as q,tt as J,ut as sn}from"./index-BzSSRi03.js";import{t as cn}from"./DataTableShell-DoTsQFjZ.js";import{InstanceConfigDialog as ln}from"./BridgeTab-CHIycJYg.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],un=new Set(X),dn=`conversational`;function fn(e){let t=new Set((e??[]).filter(e=>un.has(e)));return t.size===0?[dn]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:Qt},pn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function mn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function hn(){let e=P(F.admin.listInstances,{}),t=P(F.agents.listAllInstanceAgents,{}),n=k(F.admin.upsertInstance),i=k(F.admin.deleteInstance),a=V(),[o,u]=(0,Y.useState)(!1),[d,m]=(0,Y.useState)(Q),[v,y]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(null);async function ne(){try{await n({instanceId:D??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,...d.kind===`openclaw`?{authMode:d.authMode,personScopes:d.personScopes,identitySource:d.identitySource,participantIdentity:d.participantIdentity,managePermissionModes:d.managePermissionModes,systemIdentity:d.systemIdentity||void 0}:{},streamTransport:d.streamTransport}),m(Q),O(null),u(!1)}catch(e){a.error(me(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),(0,Z.jsx)(`strong`,{children:ee()}),De()]}),(0,Z.jsx)(cn,{title:Ht(),rows:e,addLabel:p(),onAdd:()=>{O(null),m(Q),u(!0)},emptyHint:we(),columns:[{header:Kt(),cell:e=>e.name,sort:e=>e.name},{header:$e(),cell:e=>(0,Z.jsx)(L,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Yt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:zt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:c(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(L,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?te():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:xt(),onSelect:()=>{O(e._id),m(mn(e)),u(!0)}},{label:_t(),onSelect:()=>y(e.name)},{label:r(),onSelect:()=>T(e)},{label:qe(),onSelect:()=>S(e)},{label:N(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:N(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(rn,{open:o,onOpenChange:u,title:D?Dt():ut(),description:nt(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:ne,submitLabel:It(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:yt(),children:[(0,Z.jsx)(R,{value:d.name,disabled:D!==null,onChange:e=>m({...d,name:e.target.value})}),D?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ot()}):null]}),(0,Z.jsx)($,{label:tt(),children:(0,Z.jsxs)(z,{value:d.kind,onValueChange:e=>m({...d,kind:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(W,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,Z.jsx)($,{label:Se(),children:(0,Z.jsxs)(z,{value:d.transport,onValueChange:e=>m({...d,transport:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`ws`,children:Wt()}),(0,Z.jsx)(W,{value:`rest`,children:Ze()})]})]})}):null,(0,Z.jsx)($,{label:Nt(),children:(0,Z.jsx)(R,{value:d.gatewayUrl,onChange:e=>m({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Tt(),children:(0,Z.jsx)(R,{value:d.bridgeUrl,placeholder:Ye(),onChange:e=>m({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ft(),children:(0,Z.jsx)(R,{value:d.displayName,onChange:e=>m({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:fe(),children:[(0,Z.jsxs)(z,{value:d.streamTransport,onValueChange:e=>m({...d,streamTransport:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(J,{children:$t.map(e=>(0,Z.jsx)(W,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:h()})]}),(0,Z.jsx)($,{label:jt(),children:(0,Z.jsx)(R,{value:d.gatewayVersion,placeholder:Ct(),onChange:e=>m({...d,gatewayVersion:e.target.value})})}),d.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Gt(),children:[(0,Z.jsxs)(z,{value:d.authMode,onValueChange:e=>m({...d,authMode:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`token`,children:Qe()}),(0,Z.jsx)(W,{value:`trusted-proxy`,children:Jt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.authMode===`trusted-proxy`?Ke():Rt()})]}),d.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:mt(),children:[(0,Z.jsxs)(z,{value:d.personScopes,onValueChange:e=>m({...d,personScopes:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`capped`,children:s()}),(0,Z.jsx)(W,{value:`full`,children:gt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.personScopes===`full`?g():pe()})]}):null,d.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:x(),children:[(0,Z.jsxs)(z,{value:d.identitySource,onValueChange:e=>m({...d,identitySource:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`canonical`,children:Ee()}),(0,Z.jsx)(W,{value:`email`,children:Vt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.identitySource===`email`?Ce():f()})]}):null,d.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ie(),children:[(0,Z.jsxs)(z,{value:d.participantIdentity,onValueChange:e=>m({...d,participantIdentity:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`owner`,children:C()}),(0,Z.jsx)(W,{value:`self`,children:Pe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.participantIdentity===`self`?se():Oe()})]}):null,d.kind===`openclaw`?(0,Z.jsxs)($,{label:E(),children:[(0,Z.jsxs)(z,{value:d.managePermissionModes?`on`:`off`,onValueChange:e=>m({...d,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`off`,children:je()}),(0,Z.jsx)(W,{value:`on`,children:l()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.managePermissionModes?ye():Xt()})]}):null,d.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(R,{value:d.systemIdentity,placeholder:lt(),onChange:e=>m({...d,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Ft(),children:(0,Z.jsx)(R,{value:d.gatewayHttpUrl,placeholder:it(),onChange:e=>m({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Tn,{instanceName:v,open:v!==null,onOpenChange:e=>{e||y(null)}}),b?(0,Z.jsx)(ln,{instance:b,onClose:()=>S(null)},b._id):null,w?(0,Z.jsx)(gn,{instance:w,onClose:()=>T(null)},w._id):null]})}function gn({instance:e,onClose:t}){let n=P(F.instanceSecrets.listInstanceSecretStatus,{}),r=pn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(an,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(G,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(sn,{children:ge({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:He()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(yn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(vn,{instance:e})}),(0,Z.jsx)(_n,{instance:e})]})})}function _n({instance:e}){let t=y(F.instanceSync.forceInstanceSync),n=V(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(pt());break;case`no_agents`:n.success(ht());break;case`no_bridge_url`:n.error(de());break;case`deploy_misconfigured`:n.error(m());break;case`unauthorized`:n.error(Te());break;case`not_served`:n.error(Bt());break;default:n.error(v());break}}catch(e){n.error(o(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?le():ue()})})]})}function vn({instance:e}){let t=P(F.bridgeAuth.listBridgeAuthStatus,{}),n=y(F.bridgeAuth.mintBridgeSecret),r=k(F.bridgeAuth.revokeBridgeSecret),i=V(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.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(M(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Ge())}catch(e){i.error(M(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:xe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ut()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:f?`outline`:`secondary`,children:f?`${Ot()} · ${d.prefix}…${d.lastFour}`:ae()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?qt():Xe()}),f?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Lt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ct()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?b():A()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:bt()})]}):null]})}function yn({instanceId:e,field:t,updatedAt:n}){let r=y(F.instanceSecrets.setInstanceSecret),i=k(F.instanceSecrets.clearInstanceSecret),a=y(F.deviceIdentity.generateDeviceIdentity),o=V(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Le():t===`deviceIdentity`?Be():ne();async function x(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Me())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function ee(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Zt())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function C(){if(!l){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(O())}catch(e){o.error(he(),e)}finally{d(!1)}}}let T=f?`openclaw devices approve ${f.id}`:``;async function E(){if(T)try{await navigator.clipboard.writeText(T),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:g?`outline`:`secondary`,children:g?Ot():ae()}),(0,Z.jsx)(R,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Fe():w(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void x(),disabled:l||s.trim().length===0,children:ke()}),_?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void C(),disabled:l,children:be()}):null,g?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:l,children:D()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:m?b():A()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:bt()})]}):null]})}var bn={conversational:At,documentary:Pt,summarizer:i,curator:Ue},xn={conversational:St,documentary:rt,summarizer:_e,curator:Re},Sn=e=>(bn[e]??(()=>e))(),Cn=e=>(xn[e]??(()=>``))();function wn({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Mt()}),t.map(e=>(0,Z.jsx)(L,{variant:`secondary`,className:`oc-agenttype__chip`,title:Cn(e),children:Sn(e)},e)),(0,Z.jsxs)(en,{children:[(0,Z.jsx)(nn,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:wt()})}),(0,Z.jsxs)(tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Je()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:dt()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(U,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Sn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Cn(r)})]})]},r)})})]})]})]})}function Tn({instanceName:e,open:t,onOpenChange:n}){let r=P(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=k(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=k(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=fn(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=k(F.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=k(F.agents.removeInstanceAgent),u=on(),d=V();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 o({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 s({instanceName:e,agentId:t,types:i})}catch(e){d.error(j(),e)}}async function h(t,n){if(e&&await u({title:We({name:n}),description:ze(),confirmLabel:Ve(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(re())}catch(e){d.error(j(),e)}}return(0,Z.jsx)(an,{open:t,onOpenChange:n,children:(0,Z.jsxs)(G,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(sn,{children:Et({name:e??``})}),(0,Z.jsx)(q,{children:at()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:kt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?oe():r.discovery.lastPollOk?T():Ie({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(U,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:Ne()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,o),children:ve()})]}):i?(0,Z.jsx)(L,{variant:`default`,children:te()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:a()})]}),t.enabled?(0,Z.jsx)(wn,{agentId:t.agentId,types:s,onToggle:e=>void m(t.agentId,e,s)}):null,t.enabled?(0,Z.jsx)(En,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(j(),e)}}}):null]},t.agentId)})})]})]})})}function En({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(R,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:vt(),"aria-label":et(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{hn as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{EG as r,OG as i,_N as a,_p as o,bN as s,bp as c,cN as l,dN as u,fN as d,fp as f,gN as p,gp as m,hN as h,hp as g,kG as _,lN as v,mN as y,mp as b,pN as x,pp as S,t as C,uN as w,vN as T,vp as E,xN as D,yN as O,yp as k}from"./api-D2Ea_rY6.js";import{t as A}from"./button-C9c-3Njl.js";import{At as j,Ft as M,mt as N}from"./index-BzSSRi03.js";var P=t(e(),1),F=n();function I(){let e=_(C.integrations.status.status,{}),t=i(C.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:D()});let o=n,f=(e,t,n)=>r({...o,[e]:{...o[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:[s(),` `,(0,F.jsx)(`strong`,{children:O()}),` `,T()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:p()}):(0,F.jsx)(j,{variant:`outline`,children:h()}),note:y(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(M,{value:o.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>m(`langfuse`,{host:o.langfuse.host??``})})}),(0,F.jsx)(z,{label:l(),checked:o.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),m(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:p()}):(0,F.jsx)(j,{variant:`outline`,children:h()}),note:x(),children:[(0,F.jsx)(R,{label:u(),children:(0,F.jsx)(M,{value:o.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>m(`opik`,{baseUrl:o.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:o.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||v(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>m(`opik`,{workspace:o.opik.workspace??``})})}),(0,F.jsx)(z,{label:l(),checked:o.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),m(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:p()}):(0,F.jsx)(j,{variant:`outline`,children:c()}),note:k(),children:[(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(M,{value:o.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>m(`otlp`,{endpoint:o.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:l(),checked:o.otlp.enabled??!0,onChange:e=>{f(`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=r(C.integrations.otlpSecret.setOtlpHeaders),n=i(C.integrations.otlpSecret.clearOtlpHeaders),[a,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),p=async()=>{d(!0),l(null);try{await t({headersJson:a}),s(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:o(),children:[(0,F.jsx)(M,{value:a,placeholder:e?m():g(),onChange:e=>s(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:u||a.trim().length===0,onClick:()=>void p(),children:b()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:u,onClick:()=>void n({}),children:S()}):null]}),c?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:c}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:f()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AP as r,BC as i,FC as a,GC as o,HC as s,IC as c,JN as l,LC as u,MC as d,NC as f,PC as p,RC as m,UC as h,VC as g,WC as _,YN as ee,aP as v,iP as y,jC as b,kG as x,nP as S,rP as C,t as w,zC as T}from"./api-D2Ea_rY6.js";import{Gn as E,Kn as D,Z as O,i as te,o as ne,r as re}from"./index-BzSSRi03.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-COkNbPw9.js";import{n as P,t as F}from"./TimeRangePicker-BlFrDLB9.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=x(w.me.getMe,{host:O})?.permissions?.includes(`traces.read`)??!1,t=x(w.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:r()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:v()}),(0,z.jsx)(M,{children:C()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(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),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,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:[l(),` p50 `,V(s.cP50),` `,y()]}),(0,z.jsxs)(`span`,{children:[ee(),` p50 `,V(s.aP50),` `,y()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":v(),children:[(0,z.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:o(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:_(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:h(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:s(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:g(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:i(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:T(),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=D({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=te(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:i,to:o}=P(n),{rowLimit:s,buckets:l}=Y(i,o),d=x(w.kpi.listKpis,{limit:s,filter:{from:i,to:o}}),f=(0,I.useMemo)(()=>{let e=new Map;for(let t of d??[]){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},[d,l]),p=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return d===void 0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):d.length===0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(f.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:f.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:p({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:f()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:d({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":b({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{$W as r,$z as i,Ao as a,Bz as o,CB as s,Fo as c,GW as l,Gz as u,Hz as d,Io as f,JW as ee,Jz as p,KW as te,Kz as ne,OG as m,QW as re,Qz as ie,Rz as ae,SB as oe,So as se,UW as ce,Uz as le,Vz as ue,WW as de,Wz as fe,XW as pe,Xz as me,YW as he,Yz as ge,ZW as _e,Zz as h,_B as g,_o as _,aB as v,aG as y,bB as b,bG as x,bo as S,cB as C,cG as w,dB as T,dG as E,eB as D,eG as O,fB as k,fG as A,gB as j,go as M,hB as N,hG as P,ho as F,iB as I,iG as ve,kG as L,lB as ye,lG as be,mB as xe,nB as Se,nG as Ce,oB as we,oG as Te,pB as Ee,qW as De,qz as R,r as z,rB as Oe,rG as ke,sB as Ae,sG as je,t as B,tB as Me,tG as Ne,uB as Pe,uG as Fe,uj as Ie,vB as Le,vo as Re,xB as ze,xo as Be,yB as Ve,yo as He,zz as Ue}from"./api-D2Ea_rY6.js";import{t as V}from"./button-C9c-3Njl.js";import{At as H,Ft as U,Mt as We,Nt as Ge,Pt as Ke,R as qe,Z as W,et as Je,it as Ye,jt as Xe,mt as G,nt as K,rt as Ze,t as Qe,tt as $e}from"./index-BzSSRi03.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-BA3O6eZs.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>s()},{id:`composer`,label:()=>oe()},{id:`sidebar`,label:()=>ze()},{id:`notifications`,label:()=>I()},{id:`other`,label:()=>b()}],X={showSource:{category:`messages`,label:()=>Ve(),help:()=>Le()},showReport:{category:`messages`,label:()=>g(),help:()=>j()},copyAssistant:{category:`messages`,label:()=>N()},copyUser:{category:`messages`,label:()=>xe()},showDelete:{category:`messages`,label:()=>Ee()},showTools:{category:`messages`,label:()=>k(),help:()=>T()},voiceInput:{category:`composer`,label:()=>Pe(),help:()=>ye()},showUsage:{category:`composer`,label:()=>C(),help:()=>Ae()},autoReadAloud:{category:`composer`,label:()=>f(),help:()=>c()},showChatAge:{category:`sidebar`,label:()=>we(),help:()=>v()},notifSound:{category:`notifications`,label:()=>Oe(),help:()=>Se()},notifSystem:{category:`notifications`,label:()=>Me(),help:()=>D()},replySound:{category:`notifications`,label:()=>i(),help:()=>ie()}};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:()=>d()};function ut({prefKey:e,ui:t}){let n=m(B.admin.setUiPrefDefault),r=m(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ne()}),(0,J.jsxs)(Je,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Ze,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ye,{})}),(0,J.jsxs)($e,{children:[(0,J.jsx)(K,{value:`on`,children:o()}),(0,J.jsx)(K,{value:`off`,children:Ue()}),(0,J.jsx)(K,{value:`inherit`,children:ae()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(G,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":u()}),u()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=m(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ge(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:[se(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ke(e,We())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?He():r?S():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:F()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?M():e?_():Re()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=L(B.me.getMe,{host:W}),o=i?.ui,s=$(i?.role)&&n,c=m(B.me.setUiPref).withOptimisticUpdate(qe),l=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(G,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":R()}),R()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:fe()}),(0,J.jsx)(`p`,{children:le()}),(0,J.jsx)(`p`,{children:ue()})]}):null,(0,J.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:h(),"aria-label":h(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:me()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],l=o.effective[e],u=o.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)(H,{variant:`outline`,children:ge()}):u?(0,J.jsx)(H,{variant:`secondary`,children:a()}):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 c({key:e,value:null}),children:p()}):null,(0,J.jsx)(nt,{checked:l,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:x()})}var pt={sm:()=>O(),md:()=>r(),lg:()=>re(),xl:()=>_e(),"2xl":()=>pe(),"3xl":()=>he()};function mt(){let e=L(B.me.getMe,{host:W}),t=m(B.me.setLocale),n=m(B.me.setTimezone),r=m(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:W});n&&e.setQuery(B.me.getMe,{host:W},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=m(B.me.setMyName),a=Xe(),o=e?.locale??`default`,s=e?.name??``,[c,u]=(0,q.useState)(null),d=c??s,f=d.trim()!==s.trim();async function p(){try{await i({name:d}),u(null),a.success(w())}catch(e){a.error(je(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(U,{className:`max-w-xs`,value:d,maxLength:120,placeholder:Fe(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,J.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void p(),children:Ie()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(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:Te()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:P()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(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:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:te()})]}),(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:ke()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Qe.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(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:ce()})]}),(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{$S as r,AS as i,BS as a,CS as o,D as s,DS as c,ES as l,FS as u,GS as d,Hi as f,IS as p,KS as m,LS as ee,MS as h,NS as g,OG as _,OS as v,PS as y,QS as te,RS as b,SS as ne,TS as re,US as ie,Ui as ae,VS as oe,WS as se,XS as ce,YS as le,ZS as ue,aC as de,bG as x,bS as fe,cC as S,cS as pe,dS as C,fC as me,fS as he,gS as ge,hS as _e,iC as ve,iS as w,jS as ye,kG as T,kS as be,lS as xe,mC as Se,mS as E,oS as D,ob as Ce,pC as we,qS as O,sC as k,sS as Te,t as A,tC as j,uS as M,xS as Ee,zS as N}from"./api-D2Ea_rY6.js";import{r as De}from"./dist-BSFr9rqq.js";import{t as Oe}from"./list-s8ElIDmd.js";import{t as P}from"./button-C9c-3Njl.js";import{$ as ke,A as Ae,An as F,Bt as je,C as Me,Cn as Ne,D as I,E as Pe,En as Fe,Fn as Ie,Ft as L,Gn as R,It as Le,J as Re,Kn as ze,Lt as Be,M as Ve,Mn as He,Nn as Ue,O as z,Pn as We,Q as Ge,Rt as B,S as Ke,T as qe,Tn as Je,Vn as V,Vt as Ye,_ as Xe,b as H,bn as Ze,d as Qe,dn as $e,f as U,g as W,h as G,j as K,jn as et,jt as tt,k as nt,m as rt,p as it,q as at,qn as ot,v as q,w as st,x as J,xn as ct,y as lt,yn as ut,zt as dt}from"./index-BzSSRi03.js";var ft=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Y=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(Ye,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":he(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ie,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:i,className:o,onOpen:s}){let c=_(A.projects.renameProject),l=_(A.projects.setProjectColor),u=_(A.projects.moveProject),d=_(A.projects.deleteProject),f=_(A.projects.createProject),p=at(),m=Re(),[ee,h]=(0,X.useState)(!1),[g,v]=(0,X.useState)(t),[y,b]=(0,X.useState)(!1),[re,ie]=(0,X.useState)(!1),ae=T(A.projects.projectTreeCount,re?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Le,{onOpenChange:e=>e&&ie(!0),children:[(0,Z.jsx)(ht,{className:o}),(0,Z.jsxs)(Be,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(B,{onSelect:()=>s(),children:[(0,Z.jsx)(He,{}),` `,le()]}),(0,Z.jsxs)(B,{onSelect:()=>{v(t),h(!0)},children:[(0,Z.jsx)(ct,{}),` `,C()]}),(0,Z.jsxs)(B,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:a(),label:Se(),placeholder:we(),confirmLabel:me()});t&&await f({name:t,parentId:e})})},children:[(0,Z.jsx)(et,{}),` `,a()]}),(0,Z.jsxs)(B,{onSelect:()=>b(!0),children:[(0,Z.jsx)(pt,{}),` `,ne()]}),(0,Z.jsx)(dt,{children:pe()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":Te(),children:`✕`}),rt.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(je,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ae?.folders??0,i=ae?.chats??0;await p({title:te({name:t}),description:n>0?ce({folders:n,chats:i}):i>0?ue({count:i}):_e(),confirmWord:E(),confirmLabel:r(),destructive:!0})&&await d({projectId:e})})},children:[(0,Z.jsx)($e,{}),` `,E()]})]})]}),(0,Z.jsx)(Xe,{open:ee,onOpenChange:h,title:ve(),canSubmit:g.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:g.trim()}),h(!1)},submitLabel:C(),children:(0,Z.jsx)(L,{value:g,onChange:e=>v(e.target.value),autoFocus:!0})}),y?(0,Z.jsx)(it,{open:y,onOpenChange:b,title:fe(),movingFolderId:e,currentId:i,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=_(A.chats.pinChat),i=_(A.chats.deleteChat),a=_(A.chats.renameChat),s=_(A.chats.setChatSidebar),c=_(A.chats.moveChatToProject),l=at(),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(e.title??``),[ee,h]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Le,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Be,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(B,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)(ct,{}),` `,C()]}),(0,Z.jsxs)(B,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ut,{}):(0,Z.jsx)(Ze,{}),e.pinned?M():xe()]}),(0,Z.jsxs)(B,{onSelect:()=>h(!0),children:[(0,Z.jsx)(pt,{}),` `,o()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(B,{onSelect:()=>void s({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Ne,{}):(0,Z.jsx)(Y,{}),e.inSidebar?m():O()]}),(0,Z.jsx)(je,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:D(),description:_e(),confirmLabel:E(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)($e,{}),` `,E()]})]})]}),(0,Z.jsx)(Xe,{open:u,onOpenChange:d,title:w(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:C(),children:(0,Z.jsx)(L,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),ee?(0,Z.jsx)(it,{open:ee,onOpenChange:h,title:Ee(),currentId:t,onPick:t=>void c({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(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 yt(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 bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(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 Tt(){let{projectId:e}=ot({from:`/project/$projectId`}),t=R(),n=T(A.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:v()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:c()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:l()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=R(),n=at(),o=Re(),s=tt(),c=_(A.projects.renameProject),l=_(A.projects.setProjectColor),m=_(A.projects.deleteProject),g=_(A.projects.createProject),v=_(A.projects.moveProject),y=_(A.projects.setProjectSidebar),b=_(A.chats.moveChatToProject),le=_(A.chats.reorderChat),x=_(A.projects.reorderProject),he=T(A.projects.projectTreeCount,{projectId:e.project._id}),[w,xe]=(0,X.useState)(xt),D=e=>{localStorage.setItem(bt,e),xe(e)},O=T(A.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),k=T(A.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:j}=ze({from:`/project/$projectId`}),M=T(A.projects.listProjects,{}),Ee=T(A.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(Ee??[]),[Ee]),De=T(A.chatReads.myChatReads,{}),Ne=(0,X.useMemo)(()=>yt(e.chats,De??[]),[e.chats,De]),{startNewChat:He,picker:z}=Qe(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[V,H]=(0,X.useState)(``),[Ze,U]=(0,X.useState)(!1),[G,K]=(0,X.useState)(e.project.name),[ot,ut]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(V.trim()),180);return()=>clearTimeout(e)},[V]);let Q=T(A.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Ae(nt(st,{activationConstraint:{distance:4}}),nt(qe,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=O?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||S()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(M??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=I(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Pe(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`columns`){for(let e of O?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=k?.chats.find(e=>e._id===t);return e?{list:k.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(w===`columns`){for(let e of O?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=k?.folders.find(e=>e._id===t);if(!e||!k)return null;let n=e.parentId??k.rootId;return{list:ke(k.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();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=wt(r);if(e!==void 0){if(a)await b({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Ge(M??[],t,e)){s.error(oe());return}await v({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=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await b({chatId:e,projectId:n.folderId});let a=vt(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=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Ge(M??[],e,n.parentId)){s.error(oe());return}await v({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await x({projectId:e,...a});return}}catch{s.error(oe())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=W(e.project),Bt=_t(e.chats,V),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":re(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:ae(),onClick:()=>{y({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(We,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:f()}),(0,Z.jsx)(Ue,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":d(),children:[(0,Z.jsx)(P,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":d(),title:d(),"aria-pressed":w===`cards`,onClick:()=>D(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":se(),title:se(),"aria-pressed":w===`columns`,onClick:()=>D(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ie(),title:ie(),"aria-pressed":w===`list`,onClick:()=>D(`list`),children:(0,Z.jsx)(Oe,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void He({projectId:e.project._id}),children:[(0,Z.jsx)(Fe,{}),u()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:a(),label:Se(),placeholder:we(),confirmLabel:me()});t&&await g({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(et,{}),a()]}),(0,Z.jsxs)(Le,{children:[(0,Z.jsx)(Ye,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":de(),children:(0,Z.jsx)(Ie,{})})}),(0,Z.jsxs)(Be,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(B,{onSelect:()=>{K(e.project.name),U(!0)},children:[(0,Z.jsx)(ct,{}),` `,C()]}),(0,Z.jsxs)(B,{onSelect:()=>ut(!0),children:[(0,Z.jsx)(pt,{}),` `,ne()]}),(0,Z.jsx)(dt,{children:pe()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e.project._id,color:null}),"aria-label":Te(),children:`✕`}),rt.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(je,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=he?.folders??0,o=he?.chats??0;await n({title:te({name:e.project.name}),description:a>0?ce({folders:a,chats:o}):o>0?ue({count:o}):_e(),confirmWord:E(),confirmLabel:r(),destructive:!0})&&(await m({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,Z.jsx)($e,{}),` `,E()]})]})]})]})]}),w===`columns`?(0,Z.jsx)(Ft,{data:O,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:j??null}):w===`list`?(0,Z.jsx)(Mt,{data:k,busyIds:N,suppressClick:$,locateChatId:j??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:lt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:p()}),e.chats.length>0?(0,Z.jsx)(L,{value:V,onChange:e=>H(e.target.value),placeholder:h(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?i():be()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ye({term:V.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(q,{items:Bt.map(e=>`chat:${e._id}`),strategy:J,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:N.has(t._id),unread:Ne.has(t._id),locate:t._id===j,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ge()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ye({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&Ve(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Je,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||Ce()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)(Xe,{open:Ze,onOpenChange:U,title:ve(),canSubmit:G.trim().length>0,onSubmit:async()=>{await c({projectId:e.project._id,name:G.trim()}),U(!1)},submitLabel:C(),children:(0,Z.jsx)(L,{value:G,onChange:e=>K(e.target.value),autoFocus:!0})}),ot?(0,Z.jsx)(it,{open:ot,onOpenChange:ut,title:fe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void v({projectId:e.project._id,parentId:t})}):null,z]}),(0,Z.jsx)(Me,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(F,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Je,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=z({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=R(),a=H({id:`folder:${e._id}`}),o=z({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":W(e),transform:K.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(F,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?y({count:e.folderCount})+` · `:``,g({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:U(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=_(A.chats.setChatSidebar),n=e.inSidebar?m():O();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(Ne,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=R(),c=G(e.color),l=H({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:K.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||S()}),e.pinned?(0,Z.jsx)(Ze,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:U(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:k(),"aria-label":k()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:j(),"aria-label":j()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[a,o]=(0,X.useState)(new Set),s=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x()});if(e===null)return null;let c=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=(i,o)=>{let u=s.get(i??e.rootId)??[],d=ke(e.folders,i);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:J,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:o,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:J,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:i??e.rootId,depth:o,folded:a.has(t._id),onToggle:()=>c(t._id),suppressClick:n,children:a.has(t._id)?null:l(t._id,o+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(s.get(e.rootId)??[]).length===0&&ke(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:i()}):l(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=R(),c=H({id:`folder:${e._id}`}),l=z({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":W(e),transform:K.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?N():b(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(V,{size:13}):(0,Z.jsx)(De,{size:13})}),(0,Z.jsx)(F,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=R(),o=H({id:`chat:${e._id}`}),s=jt(r),c=G(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:K.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||S()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=R(),s=z({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:J,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:J,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:be()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=H({id:`folder:${e._id}`}),o=z({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":W(e),transform:K.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(F,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=H({id:`chat:${e._id}`}),s=jt(r),c=G(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:K.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||S()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CT as r,Cc as i,MT as a,OG as o,ST as s,Tc as c,_T as l,aT as u,bT as d,cT as f,dT as p,du as m,ef as h,eu as g,fT as _,fu as v,gT as y,hT as ee,if as te,iu as ne,jT as b,kG as x,lT as S,mT as C,mu as w,nf as T,nu as E,oT as re,pT as ie,pu as ae,rf as oe,ru as se,sT as ce,t as D,tf as O,tu as k,uT as A,vT as j,wT as M,wc as N,xT as P,yT as F,zi as I}from"./api-D2Ea_rY6.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-CL1-4y9n.js";import{t as V}from"./button-C9c-3Njl.js";import{Qt as H,Xt as le,Yt as U,Z as W,Zt as ue,et as G,it as K,jt as de,mt as fe,nt as q,rt as J,tt as Y}from"./index-BzSSRi03.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:F,help:j},documentary_fetch:{label:l,help:y},inbound_files:{label:ee,help:C},history_summary:{label:te,help:oe},file_curation:{label:w,help:ne},quote_reply:{label:ae,help:v}},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:ce,references:re,files:u,previous_summary:T,new_messages:O,max_chars:h,file_name:se,budget_chars:E,feedback:k,content:g,excerpt:m};function _e(){let e=x(D.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:_()})});let i=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:M(),help:r()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:ie()}),(0,$.jsxs)(G,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(K,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(q,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:i},i._id)]})}function ve({instance:e}){let t=o(D.admin.upsertInstanceConfig),n=de(),r=x(D.me.getMe,{host:W}),s=e.config??{},l=X(e.config?.contentLocale,r?.defaultLocale??void 0),[u,d]=(0,Q.useState)(()=>L(s,l));(0,Q.useEffect)(()=>{d(L(s,l))},[l,e._id]);let[f,p]=(0,Q.useState)(!1),m=u.promptInjections,h=(e,t)=>d({...u,promptInjections:{...m,[e]:{...m[e],...t}}});async function g(){p(!0);try{await t({instanceId:e._id,config:z(u,s,l)})}catch(e){n.error(b(),e)}finally{p(!1)}}async function _(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(b(),e)}}let v=e.config?.contentLocale??`default`,y=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:c()}),(0,$.jsxs)(G,{value:v,onValueChange:e=>void _(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(K,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{value:`default`,children:i({locale:y})}),pe().map(e=>(0,$.jsx)(q,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:N()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:U[e],i18n:me[e],row:m[e]??{enabled:!0,template:U[e].defaultTemplate[l]},contentLocale:l,onChange:t=>h(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(V,{size:`sm`,onClick:()=>void g(),disabled:f,children:a()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,m=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),h=ue(e,r,i),g=h?H(h,m):``;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:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:P()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:d()}),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:()=>c(e=>!e),children:o?A():p()}),l&&(0,$.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:s()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:g}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:S()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:I()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:f()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,BO as i,Ck as a,FO as o,HO as ee,IO as te,LO as s,OG as c,QO as ne,RO as l,Ru as u,Sk as d,Tk as f,UO as p,VO as m,XO as h,YO as g,ZO as _,_k as v,ak as y,bk as b,ck as re,dk as ie,ek as ae,fk as x,gk as S,hk as C,ik as w,kG as T,lk as E,mk as D,nk as O,ok as k,pk as A,rk as j,sk as M,t as N,tk as P,uk as F,vk as I,wk as L,xk as R,yk as oe,zO as z}from"./api-D2Ea_rY6.js";import{t as B}from"./button-C9c-3Njl.js";import{At as V,Dn as H,Ft as U,_ as W,jt as G,mt as K,q}from"./index-BzSSRi03.js";import{t as J}from"./roleDescriptions-CzH2X2DX.js";var Y=t(e(),1),X=n(),Z=[{group:()=>f(),keys:[{key:`traces.read`,label:()=>b()},{key:`traces.read.content`,label:()=>oe(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>L(),keys:[{key:`kpi.read`,label:()=>b()},{key:`kpi.write`,label:()=>I()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>v()},{key:`anomalies.read`,label:()=>S()},{key:`anomalies.report`,label:()=>C()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>b()},{key:`selfheal`,label:()=>A()},{key:`media.repair`,label:()=>x()},{key:`feedback.respond`,label:()=>u()}]},{group:()=>R(),keys:[{key:`admin.manage`,label:()=>D()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=T(N.apiKeys.listRoles,{}),t=c(N.apiKeys.createRole),n=c(N.apiKeys.ensureRolesSeeded),a=c(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),u=q(),d=G(),[f,v]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)($),[S,C]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{d.error(F(),e)})},[n,d]);let D=e??[];async function A(e,t){if(Q(e.permissions))return;if(e.builtin){await u({title:E({name:e.name}),description:re(),confirmLabel:M()});return}if(S.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];C(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){d.error(k(),e)}finally{C(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function I(){try{await t({key:b.key,name:b.name,description:b.description||void 0,permissions:[]}),x($),v(!1)}catch(e){d.error(y(),e)}}let L=e===void 0,R=!L&&D.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[w(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,j(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,O()]}),(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:P()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{x($),v(!0)},children:ae()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):R?(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:_()}),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?ie({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:D.map(e=>{let t=Q(e.permissions),n=S.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)(V,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,h()]}):(0,X.jsx)(V,{variant:`secondary`,children:g()})]}),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)(K,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?p():n?ee():r,onCheckedChange:()=>void A(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:f,onOpenChange:v,title:m(),description:i(),canSubmit:!!(b.key&&b.name),onSubmit:I,submitLabel:z(),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:l()}),(0,X.jsx)(U,{value:b.key,placeholder:s(),onChange:e=>x({...b,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(U,{value:b.name,onChange:e=>x({...b,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)(U,{value:b.description,onChange:e=>x({...b,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{$H as r,$U as i,AH as a,BH as o,CU as s,D as c,EG as l,FH as u,GU as d,HH as ee,IH as f,JU as p,KU as m,LH as h,MH as g,NH as _,PH as v,QH as te,QU as ne,RH as re,SG as y,SU as ie,UH as ae,UU as oe,VH as se,WH as ce,WU as le,XH as ue,XU as de,XV as fe,YH as pe,YU as me,ZH as he,ZU as ge,_H as _e,_U as b,aH as ve,bG as ye,bU as be,cH as xe,dH as Se,dU as Ce,eU as we,eW as Te,fH as Ee,fU as De,gH as Oe,gU as ke,hH as Ae,hU as je,iH as Me,iU as Ne,iW as Pe,jH as x,kG as Fe,kH as Ie,lH as Le,lU as Re,mH as ze,mU as Be,nH as Ve,nU as He,nW as Ue,oH as We,oU as Ge,pH as Ke,pU as qe,qU as Je,rH as Ye,rU as Xe,rW as Ze,sH as Qe,t as S,tU as $e,tW as et,uH as tt,uU as nt,vH as rt,wU as it,xU as at,yH as ot,yU as st,zH as ct}from"./api-D2Ea_rY6.js";import{t as lt}from"./list-s8ElIDmd.js";import{t as C}from"./button-C9c-3Njl.js";import{At as w,Ct as ut,Dt as dt,Et as ft,Ft as pt,Hn as T,Ht as mt,On as ht,Ot as gt,Sn as _t,St as vt,Tt as yt,Ut as E,Vn as D,Wt as O,Z as bt,at as xt,bt as St,ct as Ct,dn as wt,et as k,gn as Tt,it as A,jt as Et,kt as Dt,lt as Ot,nt as j,on as kt,ot as At,rt as M,st as jt,tt as N,ut as Mt,vn as Nt,wt as Pt,xn as Ft,xt as It}from"./index-BzSSRi03.js";import{a as Lt,i as P,n as Rt,o as zt,r as F,t as Bt}from"./table-D53vcOfn.js";import{t as Vt}from"./FilterBar-X_wz_owJ.js";/* empty css */import{a as Ht,c as I,i as L,l as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt,u as R}from"./TimezoneCombobox-BA3O6eZs.js";var Yt=c(`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`}]]),Xt=c(`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`}]]),z=t(e(),1),B=n();function V(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 Zt({value:e,onChange:t}){let n=Ut(e),r=(0,z.useMemo)(()=>new Date,[]),[i,a]=(0,z.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,z.useState)(!1),l=(0,z.useMemo)(()=>V(y()),[]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(y(),{month:`long`,year:`numeric`}),[]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),f=I(i.year,i.month),p=n?.hour??9,m=n?.minute??0,h=(e,n,r,i,a)=>t(R(e,n,r,i,a)),g=(e,t,n)=>{a({year:e,month:t}),h(e,t,n,p,m)},_=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},v=n===null?ae():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,B.jsxs)(mt,{modal:!0,open:s,onOpenChange:c,children:[(0,B.jsx)(O,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":ce(),children:[(0,B.jsx)(Yt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,B.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:v})]})}),(0,B.jsxs)(E,{align:`start`,className:`oc-dtp__pop`,children:[(0,B.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ee(),onClick:()=>_(-1),children:(0,B.jsx)(T,{size:15,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":se(),onClick:()=>_(1),children:(0,B.jsx)(D,{size:15,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),f.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,B.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:()=>g(e.year,e.month,e.day),children:e.day},t)})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,B.jsxs)(k,{value:String(p),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),Number(e),m),children:[(0,B.jsx)(M,{size:`sm`,"aria-label":o(),children:(0,B.jsx)(A,{})}),(0,B.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,B.jsx)(j,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,B.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,B.jsxs)(k,{value:String(m),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),p,Number(e)),children:[(0,B.jsx)(M,{size:`sm`,"aria-label":ct(),children:(0,B.jsx)(A,{})}),(0,B.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,B.jsx)(j,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function H(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Qt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function $t(e){let t=new Map;for(let n of e){let e=H(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 U(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(Qt(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=y(),c=(0,z.useMemo)(()=>$t(e),[e]),l=(0,z.useMemo)(()=>en(s),[s]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),f=(0,z.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()})},h=t===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,B.jsxs)(`div`,{className:`oc-cal`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":g(),onClick:()=>m(-1),children:(0,B.jsx)(T,{})}),(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":x(),onClick:()=>m(1),children:(0,B.jsx)(D,{})}),(0,B.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:p.getFullYear(),month:p.getMonth()}),children:_()})]}),(0,B.jsx)(`span`,{className:`oc-cal__title`,children:h}),(0,B.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,B.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:u()}),(0,B.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:v()})]})]}),t===`month`?(0,B.jsx)(an,{cursor:n,byDay:c,weekdays:l,timeFmt:f,now:p,onEventClick:a}):(0,B.jsx)(on,{year:n.year,byDay:c,monthShortFmt:ee,now:p,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,B.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:o}){let s=I(e.year,e.month);return(0,B.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),s.map((e,n)=>{let s=t.get(Qt(e.year,e.month,e.day))??[],c=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(c?` oc-cal__day--today`:``),children:[(0,B.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),s.slice(0,W).map(e=>(0,B.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:o?()=>o(e):void 0,children:[(0,B.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,B.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),s.length>W?(0,B.jsx)(`span`,{className:`oc-cal__more`,children:a({count:s.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,B.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=U(t,e,o),c=I(e,o);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,B.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,B.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,B.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var G={h:36e5,min:6e4,s:1e3,ms:1};function sn(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])*G[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 K(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 q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(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 cn=new Map;function J(e){let t=cn.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 cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(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 X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(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 Z(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=q(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=Y(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=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(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 Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=Gt(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(qt(e)){case`ok`:return(0,B.jsx)(w,{variant:`secondary`,children:Xe()});case`error`:return(0,B.jsx)(w,{variant:`destructive`,children:$e()});case`running`:return(0,B.jsx)(w,{variant:`outline`,children:we()});case`other`:return(0,B.jsx)(w,{variant:`outline`,children:e});case`none`:return(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=l(S.scheduled.listMyCrons),t=l(S.scheduled.getCronDetail),n=l(S.scheduled.listCronRuns),a=l(S.scheduled.updateCron),o=l(S.scheduled.removeCron),c=l(S.scheduled.runCronNow),u=Et(),ee=Fe(S.me.getMe,{host:bt})?.timezone,[g,_]=(0,z.useState)(null),[v,ae]=(0,z.useState)(!1),[se,ce]=(0,z.useState)(!1),[x,ct]=(0,z.useState)(null),[T,mt]=(0,z.useState)(null),[E,D]=(0,z.useState)(null),[O,I]=(0,z.useState)(null),[Ut,qt]=(0,z.useState)(!1),[R,V]=(0,z.useState)(Wt),[H,Qt]=(0,z.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),$t=e=>{localStorage.setItem(`oc.sched.view`,e),Qt(e)},[U,en]=(0,z.useState)(`month`),[W,an]=(0,z.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,z.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)Ht(r,R)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,R]),G=(0,z.useMemo)(()=>U===`year`?nn(W.year):tn(W.year,W.month),[U,W]),sn=(0,z.useMemo)(()=>un(on,G.startMs,G.endMs),[on,G]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,z.useCallback)(async()=>{ae(!0),ce(!1);try{_(await e({}))}catch{ce(!0)}finally{ae(!1)}},[e]);(0,z.useEffect)(()=>{q()},[q]);let cn=(0,z.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,z.useRef)(null);(0,z.useEffect)(()=>{g!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[g]);let Y=(0,z.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ct(e);try{await t(),u.success(n),await q()}catch(e){u.toast({variant:`error`,title:b({code:dn(e)})})}finally{ct(null)}},Z=(0,z.useRef)(0),Q=(0,z.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;D({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;D({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;D(null),u.toast({variant:`error`,title:b({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;I({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%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;I(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!==Q.current)return;I(null),u.toast({variant:`error`,title:b({code:dn(e)})})}},mn=async()=>{if(O===null)return;let e={};if(O.nameDirty&&O.name.trim()===``||O.messageDirty&&O.hasMessage&&O.message.trim()===``){u.toast({variant:`error`,title:Ve()});return}if(O.nameDirty&&O.name.trim()!==``&&(e.name=O.name.trim()),O.scheduleDirty){if(O.scheduleKind===`cron`&&O.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:O.cronExpr.trim(),...O.tz.trim()===``?{}:{tz:O.tz.trim()}};else if(O.scheduleKind===`every`){let t=Number(O.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[O.everyUnit])})}else if(O.scheduleKind===`at`&&O.at!==``){let t=Date.parse(O.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(O.scheduleDirty&&e.schedule===void 0){u.toast({variant:`error`,title:Ye()});return}if(O.messageDirty&&O.hasMessage&&O.message.trim()!==``&&(e.message=O.message.trim()),Object.keys(e).length===0){I(null);return}let t=Q.current;qt(!0);try{await a({instanceName:O.instanceName,jobId:O.jobId,patch:e}),u.success(Oe()),t===Q.current&&I(null),await q()}catch(e){u.toast({variant:`error`,title:b({code:dn(e)})})}finally{qt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Pe()}),(0,B.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":re(),children:[(0,B.jsx)(C,{variant:H===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":h(),title:h(),"aria-pressed":H===`list`,onClick:()=>$t(`list`),children:(0,B.jsx)(lt,{})}),(0,B.jsx)(C,{variant:H===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":f(),title:f(),"aria-pressed":H===`calendar`,onClick:()=>$t(`calendar`),children:(0,B.jsx)(Yt,{})})]}),(0,B.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:v,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(Tt,{size:14,"aria-hidden":!0}),Ze()]})]}),g!==null&&hn>0?(0,B.jsxs)(Vt,{q:R.q,onQChange:e=>V(t=>({...t,q:e})),searchPlaceholder:te(),onReset:()=>V(Wt),canReset:Kt(R),children:[(0,B.jsxs)(k,{value:R.state,onValueChange:e=>V(t=>({...t,state:e})),children:[(0,B.jsx)(M,{size:`sm`,className:`w-40`,children:(0,B.jsx)(A,{})}),(0,B.jsxs)(N,{children:[(0,B.jsx)(j,{value:`all`,children:he()}),(0,B.jsx)(j,{value:`active`,children:le()}),(0,B.jsx)(j,{value:`paused`,children:d()}),(0,B.jsx)(j,{value:`auto-disabled`,children:oe()})]})]}),(0,B.jsxs)(k,{value:R.result,onValueChange:e=>V(t=>({...t,result:e})),children:[(0,B.jsx)(M,{size:`sm`,className:`w-40`,children:(0,B.jsx)(A,{})}),(0,B.jsxs)(N,{children:[(0,B.jsx)(j,{value:`all`,children:ue()}),(0,B.jsx)(j,{value:`ok`,children:Xe()}),(0,B.jsx)(j,{value:`error`,children:$e()}),(0,B.jsx)(j,{value:`running`,children:we()}),(0,B.jsx)(j,{value:`none`,children:r()})]})]})]}):null,g===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":v,children:se?Ue():ye()}):H===`calendar`?(0,B.jsxs)(B.Fragment,{children:[se?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):(0,B.jsx)(rn,{events:sn.events,mode:U,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:K,footnote:Ie()})]}):(0,B.jsxs)(B.Fragment,{children:[se?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):null,g.map(e=>{let t=e.jobs.filter(e=>Ht(e,R)),n=Kt(R)&&e.jobs.length>0&&t.length===0;return(0,B.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,B.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,B.jsx)(w,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:i({code:e.error})}):e.jobs.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):n?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,B.jsxs)(Bt,{children:[(0,B.jsx)(Lt,{children:(0,B.jsxs)(zt,{children:[(0,B.jsx)(P,{children:ge()}),(0,B.jsx)(P,{children:de()}),(0,B.jsx)(P,{children:me()}),(0,B.jsx)(P,{children:p()}),(0,B.jsx)(P,{children:Je()}),(0,B.jsx)(P,{children:Ne()}),(0,B.jsx)(P,{children:ot()})]})}),(0,B.jsx)(Rt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=x===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,B.jsxs)(zt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,B.jsx)(F,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??m()}),(0,B.jsx)(F,{children:(0,B.jsx)(w,{variant:`secondary`,children:t.agentId})}),(0,B.jsxs)(F,{className:`whitespace-nowrap`,children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=St(t.schedule),n=e===null?null:It(e);return n===null?null:(0,B.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,B.jsx)(F,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,B.jsx)(F,{children:Gt(t)===`auto-disabled`?(0,B.jsx)(w,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:oe()}):Gt(t)===`active`?(0,B.jsx)(w,{variant:`secondary`,children:le()}):Gt(t)===`paused`?(0,B.jsx)(w,{variant:`outline`,children:d()}):(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,B.jsxs)(F,{children:[(0,B.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,B.jsx)(w,{variant:`destructive`,title:t.lastDeliveryError??it(),children:He()}):null]}),(0,B.jsx)(F,{className:`whitespace-nowrap`,children:t.id===null?(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,B.jsx)(ht,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:ie(),"aria-label":ie(),disabled:x!==null,onClick:()=>void X(r,async()=>{let n=await c({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ke()),children:(0,B.jsx)(kt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:L(t)===`pause`?at():be(),"aria-label":L(t)===`pause`?at():be(),disabled:x!==null,onClick:()=>void X(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:L(t)===`resume`}}),L(t)===`pause`?je():Be()),children:L(t)===`pause`?(0,B.jsx)(_t,{size:14,"aria-hidden":!0}):(0,B.jsx)(Nt,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:rt(),"aria-label":rt(),disabled:x!==null,onClick:()=>void pn(e.instanceName,t),children:(0,B.jsx)(Ft,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:_e(),"aria-label":_e(),disabled:x!==null,onClick:()=>void ln(e.instanceName,t),children:(0,B.jsx)(Xt,{size:14,"aria-hidden":!0})}):null,o?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:st(),"aria-label":st(),disabled:x!==null,onClick:()=>mt({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,B.jsx)(wt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]},e.instanceName)}),hn>0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:fe()}):null]}),(0,B.jsx)(vt,{open:T!==null,onOpenChange:e=>{e||mt(null)},children:(0,B.jsxs)(yt,{children:[(0,B.jsxs)(gt,{children:[(0,B.jsx)(Dt,{children:De()}),(0,B.jsx)(ft,{children:Ce({name:T?.name??``})})]}),(0,B.jsxs)(dt,{children:[(0,B.jsx)(Pt,{children:nt()}),(0,B.jsx)(ut,{onClick:()=>{let e=T;mt(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>o({instanceName:e.instanceName,jobId:e.jobId}),qe())},children:Re()})]})]})}),(0,B.jsx)(xt,{open:E!==null,onOpenChange:e=>{e||(Z.current++,D(null))},children:(0,B.jsxs)(At,{style:{maxWidth:640},children:[(0,B.jsx)(Ot,{children:(0,B.jsx)(Mt,{children:Ae({name:E?.name??``})})}),E?.entries===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):E!==null&&E.entries.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):E===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:E.entries.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,B.jsx)(fn,{status:e.status}),(0,B.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Ge({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,B.jsx)(xt,{open:O!==null,onOpenChange:e=>{e||(Q.current++,I(null))},children:(0,B.jsxs)(At,{className:`oc-cronedit`,children:[(0,B.jsxs)(Ot,{children:[(0,B.jsx)(Mt,{children:Ke()}),(0,B.jsx)(jt,{children:Ee()})]}),O===null?null:O.loading?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ge()}),(0,B.jsx)(pt,{value:O.name,maxLength:200,onChange:e=>I({...O,name:e.target.value,nameDirty:!0})})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Se()}),(0,B.jsxs)(k,{value:O.scheduleKind,onValueChange:e=>I({...O,scheduleKind:e,scheduleDirty:!0}),children:[(0,B.jsx)(M,{children:(0,B.jsx)(A,{})}),(0,B.jsxs)(N,{children:[(0,B.jsx)(j,{value:`cron`,children:tt()}),(0,B.jsx)(j,{value:`every`,children:Le()}),(0,B.jsx)(j,{value:`at`,children:xe()})]})]}),O.scheduleKind===`cron`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(pt,{value:O.cronExpr,onChange:e=>I({...O,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,B.jsx)(Jt,{value:O.tz,onChange:e=>I({...O,tz:e,scheduleDirty:!0}),fallbackTz:ee??void 0})]}):O.scheduleKind===`every`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(pt,{type:`number`,min:1,value:O.everyValue,onChange:e=>I({...O,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,B.jsxs)(k,{value:O.everyUnit,onValueChange:e=>I({...O,everyUnit:e,scheduleDirty:!0}),children:[(0,B.jsx)(M,{style:{maxWidth:160},children:(0,B.jsx)(A,{})}),(0,B.jsxs)(N,{children:[(0,B.jsx)(j,{value:`minutes`,children:Qe()}),(0,B.jsx)(j,{value:`hours`,children:We()}),(0,B.jsx)(j,{value:`days`,children:ve()})]})]})]}):(0,B.jsx)(Zt,{value:O.at,onChange:e=>I({...O,at:e,scheduleDirty:!0})})]}),O.hasMessage?(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:s()}),(0,B.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:O.message,onChange:e=>I({...O,message:e.target.value,messageDirty:!0})})]}):null]}),(0,B.jsxs)(Ct,{children:[(0,B.jsx)(C,{variant:`ghost`,onClick:()=>I(null),children:nt()}),(0,B.jsxs)(C,{onClick:()=>void mn(),disabled:O===null||O.loading||Ut,children:[Ut?(0,B.jsx)(ht,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Me()]})]})]})})]})}export{pn as ScheduledTab};
|