@lacneu/atrium 0.75.2 → 0.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-CvennLZY.js +1 -0
- package/dist/assets/AdvancedFilter-BhtomjOR.js +1 -0
- package/dist/assets/AgentFilesTab-Cxl01-Ai.js +3 -0
- package/dist/assets/AnomaliesTab-fdxX14pi.js +1 -0
- package/dist/assets/AuditTab-CTbBbxeq.js +1 -0
- package/dist/assets/BridgeTab-CZSFpGCy.js +1 -0
- package/dist/assets/ChatDefaultsTab-Ds6KJoPI.js +1 -0
- package/dist/assets/DataTableShell-Cqy89YR_.js +1 -0
- package/dist/assets/{DetailChips-Lo0Kvu7k.js → DetailChips-FjHhAofU.js} +1 -1
- package/dist/assets/FeedbacksTab-Dabgccl5.js +1 -0
- package/dist/assets/FieldLabel-DK93YUC8.js +1 -0
- package/dist/assets/FilesTab-DpdpCRjg.js +1 -0
- package/dist/assets/{FilterBar-CnjTuIOw.js → FilterBar-DSMg3ZU9.js} +1 -1
- package/dist/assets/GroupsTab-CH8QCy4j.js +1 -0
- package/dist/assets/InstancesTab-BN2QEHuC.js +1 -0
- package/dist/assets/IntegrationsTab-Cji4AFDZ.js +1 -0
- package/dist/assets/KpiTab-Cmz2kQg_.js +1 -0
- package/dist/assets/PreferencesTab-CJRl2a1t.js +1 -0
- package/dist/assets/{ProjectPage-LzMKBi2V.css → ProjectPage-BXsrYrrF.css} +1 -1
- package/dist/assets/ProjectPage-Cj_VBnz0.js +1 -0
- package/dist/assets/PromptInjectionsTab-URavZk7V.js +4 -0
- package/dist/assets/RolesTab-CFRaPLL_.js +1 -0
- package/dist/assets/ScheduledTab-BFUIiyW4.js +1 -0
- package/dist/assets/ServiceAccountsTab-CfVem6Qr.js +1 -0
- package/dist/assets/SubAgentReportsTab-BKE4z_wO.js +1 -0
- package/dist/assets/ThemeShowroom-9TEVKzL5.js +1 -0
- package/dist/assets/{TimeRangePicker-DLQwf08l.js → TimeRangePicker-D2DOA7Ue.js} +1 -1
- package/dist/assets/TimezoneCombobox-DBZErd9-.js +1 -0
- package/dist/assets/TracesTab-D5G56hxo.js +1 -0
- package/dist/assets/UsersTab-TYF0NG-e.js +1 -0
- package/dist/assets/VoiceTab-BMFyc4v0.js +1 -0
- package/dist/assets/{api-CMppRsht.js → api-6pZGS4Dp.js} +5 -5
- package/dist/assets/{button-IhgT55aN.js → button-D-5ueVCd.js} +1 -1
- package/dist/assets/{card-ClDtGwk1.js → card-BGf8kBDa.js} +1 -1
- package/dist/assets/chevrons-up-down-BB83Ko2B.js +1 -0
- package/dist/assets/{compatView-ok0H4ab7.js → compatView-CrdwEqYG.js} +1 -1
- package/dist/assets/dispatchErrorInfo-CtOA6PvF.js +1 -0
- package/dist/assets/{dist-BkRhMuSu.js → dist-BOmZ13fI.js} +1 -1
- package/dist/assets/{dist-1Lc_y6Gf.js → dist-D_KJFUY3.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-__Py8DCh.js → highlighted-body-OFNGDK62-DRUUpIgA.js} +1 -1
- package/dist/assets/{index-DIPoQZi2.css → index-BeCBdUIg.css} +1 -1
- package/dist/assets/index-CGjQ2eS7.js +324 -0
- package/dist/assets/{list-B4i6cI-4.js → list-CJW1tnnv.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-C5fOHsAw.js +1 -0
- package/dist/assets/{pdf-CZxpuHbO.js → pdf-DJBOM64C.js} +1 -1
- package/dist/assets/roleDescriptions-B5YpxuQ5.js +1 -0
- package/dist/assets/{table-E4WVxNnB.js → table-CenHt_bu.js} +1 -1
- package/dist/assets/tabs--EBTCh_O.js +1 -0
- package/dist/assets/x-C51XT3xK.js +1 -0
- package/dist/index.html +7 -10
- package/package.json +1 -1
- package/dist/assets/AccessTab-DuyiTRVr.js +0 -1
- package/dist/assets/AdvancedFilter-BzF0GRUD.js +0 -1
- package/dist/assets/AgentFilesTab-BzZ4iNiw.js +0 -3
- package/dist/assets/AnomaliesTab-Aksn6eYz.js +0 -1
- package/dist/assets/AuditTab-BqKVttX3.js +0 -1
- package/dist/assets/BridgeTab-BxMufTiI.js +0 -1
- package/dist/assets/ChatDefaultsTab-6xoE3T9G.js +0 -1
- package/dist/assets/DataTableShell-BInsTzwk.js +0 -1
- package/dist/assets/FeedbacksTab-ZNCSDc3k.js +0 -1
- package/dist/assets/FieldLabel-8IB11dM6.js +0 -81
- package/dist/assets/FilesTab-B3bm4Kq2.js +0 -1
- package/dist/assets/GroupsTab-B-8I0P6D.js +0 -1
- package/dist/assets/InstancesTab-DvyrJSBO.js +0 -1
- package/dist/assets/IntegrationsTab-DYG99wtP.js +0 -1
- package/dist/assets/KpiTab-C1rebj1v.js +0 -1
- package/dist/assets/PreferencesTab-mg8QORuA.js +0 -1
- package/dist/assets/ProjectPage-CNYuUcd2.js +0 -1
- package/dist/assets/PromptInjectionsTab-j_2hboca.js +0 -4
- package/dist/assets/RolesTab-CY_nK9vi.js +0 -1
- package/dist/assets/ScheduledTab-DCUrDndB.js +0 -1
- package/dist/assets/ServiceAccountsTab-BNL5015A.js +0 -1
- package/dist/assets/SubAgentReportsTab-B5VH_bLL.js +0 -1
- package/dist/assets/ThemeShowroom-CN3wPvKh.js +0 -1
- package/dist/assets/TimezoneCombobox-PqzYbV3J.js +0 -1
- package/dist/assets/TracesTab-CESxAkKQ.js +0 -1
- package/dist/assets/UsersTab-N5fFzUTq.js +0 -1
- package/dist/assets/VoiceTab-CfcROoO4.js +0 -1
- package/dist/assets/check-7d2-JR5i.js +0 -1
- package/dist/assets/chevron-up-Od7h9avP.js +0 -1
- package/dist/assets/chevrons-up-down-DJIIcTyy.js +0 -1
- package/dist/assets/dispatchErrorInfo-BvZIc7oP.js +0 -1
- package/dist/assets/dist-CNchpxsr.js +0 -1
- package/dist/assets/index-C3dl90Xw.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-CFE134PH.js +0 -1
- package/dist/assets/roleDescriptions-YEECob2A.js +0 -1
- package/dist/assets/tabs-BPsz_527.js +0 -1
- package/dist/assets/x-CdHbCgxq.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{dw as e,fw as t,lw as n,pw as r,uw as i}from"./api-6pZGS4Dp.js";var a={pending:r,user:t,admin:e,observer:i,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-6pZGS4Dp.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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-6pZGS4Dp.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-CGjQ2eS7.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...p}=e,m=f(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:d,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./api-6pZGS4Dp.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,17 +62,14 @@
|
|
|
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-CGjQ2eS7.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/
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
72
|
-
<link rel="
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/x-CdHbCgxq.js">
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/button-IhgT55aN.js">
|
|
75
|
-
<link rel="stylesheet" crossorigin href="/assets/index-DIPoQZi2.css">
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-6pZGS4Dp.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-D_KJFUY3.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BOmZ13fI.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/x-C51XT3xK.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/button-D-5ueVCd.js">
|
|
72
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BeCBdUIg.css">
|
|
76
73
|
</head>
|
|
77
74
|
<body>
|
|
78
75
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
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{Ap as r,Bp as i,Dp as a,Fp as o,Ip as s,Lp as c,Mp as l,Np as u,Op as d,Pp as f,Rp as p,Tz as m,Vp as h,gz as g,jp as _,kp as v,t as y,zp as b}from"./api-CMppRsht.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-C3dl90Xw.js";var D=t(e(),1);function O(e){return e===`user`?_():e===`all`?r():v({group:e.group})}function k(e){return e===`common`?d():e===`owner`?a():v({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=m(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":i(),children:(0,A.jsx)(E,{placeholder:i()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{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:g()}):(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)(S,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(S,{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:s()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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)(S,{variant:`default`,children:l()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{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:o()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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)(S,{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:f()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Qh as i,eg as a,ig as o,ng as s,rg as c,tg as l}from"./api-CMppRsht.js";import{r as u}from"./dist-CNchpxsr.js";import{t as d}from"./x-CdHbCgxq.js";import{t as f}from"./button-IhgT55aN.js";import{$ as p,Q as m,X as h,Z as g,et as _,jt as v,un as y}from"./index-C3dl90Xw.js";import{r as b}from"./TimeRangePicker-DLQwf08l.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:l()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(v,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(y,{}),i()]})]}):null]})}export{D as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,$u as i,Aa as a,Da as o,Ea as s,Gu as c,Ja as l,Ju as u,Ka as d,Ku as f,Oa as p,Qa as m,Qu as h,Sj as g,Sz as _,Ta as v,Tz as y,Wu as b,Xa as x,Xu as S,Ya as C,Yu as w,Za as T,Zu as E,_d as D,ad as O,af as k,ao as A,cd as j,co as M,ct as N,dd as ee,do as P,ed as F,eo as I,fd as te,fo as L,gd as R,gz as z,hd as ne,id as re,io as B,ka as V,ld as ie,lo as ae,md as oe,nd as se,no as ce,od as le,oo as ue,pd as de,qa as fe,qu as pe,rd as me,rf as he,ro as ge,sd as _e,so as H,t as U,td as ve,to as ye,ud as be,uo as xe,vd as Se,vz as W,wa as Ce,wz as we,yd as Te}from"./api-CMppRsht.js";import{t as G}from"./button-IhgT55aN.js";import{$ as Ee,B as De,Ct as Oe,Dt as K,Et as ke,Q as Ae,St as je,Tt as Me,X as Ne,Z as Pe,at as Fe,bt as Ie,et as Le,in as q,nt as Re,ot as ze,q as Be,rt as Ve,tt as He,vt as Ue,wt as We,xt as Ge,yt as Ke}from"./index-C3dl90Xw.js";import{n as qe,t as Je}from"./curation-CQksaIbm.js";import{i as Ye}from"./compatView-ok0H4ab7.js";/* empty css */var J=t(e(),1),Y=2e4,Xe=6e4;function Ze(e){return typeof e!=`number`||e<=0?0:Math.round(e/Y*100)}function Qe(e){return e<=0?0:Math.round(e/Xe*100)}function X(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function $e(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Z=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<Z&&a.push(e)):t>0&&(i+=t,o.length<Z&&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=y(U.me.getMe,{host:Be}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=y(U.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=y(U.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=y(U.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),c=(0,J.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[l,u]=(0,J.useState)(null);(0,J.useEffect)(()=>{!c||c.length===0||(!l||!c.some(e=>$(e)===l))&&u($(c[0]))},[c,l]);let d=c?.find(e=>$(e)===l)??null,f=_(U.agentFiles.listAgentFiles),[p,m]=(0,J.useState)({status:`idle`}),h=d?.instanceName??null,g=d?.agentId??null,v=y(U.compat.forInstance,n&&h!==null?{instanceName:h}:`skip`),b=n&&h!==null?De(v,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,S=(0,J.useCallback)(async()=>{if(!(h===null||g===null)){m({status:`loading`});try{m({status:`done`,files:(await f({instanceName:h,agentId:g})).files})}catch(e){m({status:`error`,dashboardAbsent:tt(e)})}}},[f,h,g]);(0,J.useEffect)(()=>{x===!1&&S()},[S,x]);let[C,w]=(0,J.useState)(null),T=y(U.agentFileCuration.listCurations,t&&h!==null&&g!==null?{instanceName:h,agentId:g}:`skip`),E=y(U.agentFileCuration.curationSettings,t&&h!==null?{instanceName:h}:`skip`),O=_(U.agentFileCuration.requestCuration),[k,A]=(0,J.useState)(null),[P,F]=(0,J.useState)(null),{toast:I}=K(),L=(0,J.useMemo)(()=>{let e=new Map;for(let t of T??[])e.has(t.name)||e.set(t.name,t);return e},[T]),re=(0,J.useCallback)(async e=>{if(!(h===null||g===null)){A(e);try{let t=await O({instanceName:h,agentId:g,name:e,trigger:`manual`});t.ok?I({title:ae(),variant:`success`}):I({title:M({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:H(),variant:`error`})}finally{A(null)}}},[O,h,g,I]),B=W(),V=(0,J.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||c===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:Te()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ne,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":Se(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:(r??[]).map(e=>(0,Q.jsx)(Ae,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,Q.jsxs)(Ne,{value:l??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:c.map(e=>(0,Q.jsx)(Ae,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()})]}),d===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,Ye(b.gatewayVersion,b.provider)]}):p.status===`loading`||p.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):p.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[p.dashboardAbsent?N():oe(),` `,!p.dashboardAbsent&&(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:he()})]}):p.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:p.files.map(e=>{let n=Ze(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)(ke,{variant:`outline`,children:de()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:te({size:X(e.size,B)})}),(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:ee({pct:V.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":be()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>w(e),children:t?j():_e()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Je.includes(e.name),size:e.size??0,budget:E?.budgetChars??null,enabled:E?.enabled??!1,curation:L.get(e.name)??null,inFlight:k===e.name,onCurate:()=>void re(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:X($e(p.files),B),total:X(Xe,B),pct:V.format(Qe($e(p.files)))})})]}),C&&d?(0,Q.jsx)(at,{instanceName:d.instanceName,agentId:d.agentId,name:C.name,isAdmin:t,onClose:()=>w(null),onSaved:()=>void S()}):null,P?(0,Q.jsx)(ot,{curationId:P,onClose:()=>F(null),onApplied:()=>{F(null),S()}}):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)(G,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:P()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:xe()}):e&&r&&n!==null&&qe(t,n)?(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:L()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let s=_(U.agentFiles.getAgentFile),l=_(U.agentFiles.setAgentFile),d=K(),[p,m]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),[x,C]=(0,J.useState)(``),[T,D]=(0,J.useState)(!1),[A,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(!1),[ee,P]=(0,J.useState)(!1),I=(0,J.useCallback)(async r=>{y(!1);try{let i=await s({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||C(i.content),N(!1)}catch{y(!0)}},[s,e,t,n]);(0,J.useEffect)(()=>{I(!1)},[I]);async function te(){if(p!==null){j(!0),P(!1);try{await l({instanceName:e,agentId:t,name:n,content:x,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(F({name:n})),o(),await I(!1)}catch(e){nt(e)?N(!0):P(!0)}finally{j(!1)}}}let L=p!==null&&x!==p.content,R=(0,J.useMemo)(()=>p===null?null:et(p.content,x),[p,x]),ne=x.length>Y,B=W(),V=(0,J.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:le({name:n})}),(0,Q.jsxs)(Ve,{children:[O({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,re()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void I(!1),children:he()})]}):p===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:x,readOnly:!r,spellCheck:!1,onChange:e=>C(e.target.value),"aria-label":le({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:me()}),M?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[E(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void I(!0),children:S()})]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:i()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:se({count:V.format(x.length),max:V.format(Y)})}),r?(0,Q.jsx)(G,{size:`sm`,disabled:!L||A||M,onClick:()=>D(!0),children:A?k():ve()}):null]})]}),(0,Q.jsx)(Ue,{open:T,onOpenChange:D,children:(0,Q.jsxs)(Ge,{children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Me,{children:w({name:n})}),(0,Q.jsx)(je,{children:u({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:pe({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:f()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(Ie,{children:g()}),(0,Q.jsx)(Ke,{onClick:()=>void te(),children:b()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=y(U.agentFileCuration.getProposal,{curationId:e}),c=_(U.agentFileCuration.approveCuration),u=we(U.agentFileCuration.rejectCuration),{toast:f}=K(),[h,g]=(0,J.useState)(null),[b,S]=(0,J.useState)(!1),[w,E]=(0,J.useState)(``),D=W(),O=(0,J.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function j(){g(`approve`);try{let t=await c({curationId:e});t.ok?(f({title:ue(),variant:`success`}),n()):f({title:t.reason===`conflict`?B():ge({reason:t.reason??`unknown`}),variant:`error`})}catch{f({title:H(),variant:`error`})}finally{g(null)}}async function M(n){g(`reject`);try{let r=w.trim();(await u({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?f({title:n?v():A(),variant:`success`}):f({title:I(),variant:`error`}),t()}catch{f({title:H(),variant:`error`})}finally{g(null)}}return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:i?ce({name:i.name}):z()}),(0,Q.jsx)(Ve,{children:ye()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:I()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[r({before:X(i.beforeSize,D),after:X(i.proposedSize,D)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,m()]}):null]}),O?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:T({added:O.added,removed:O.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:Ce({feedback:i.feedback})}):null,O&&O.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:d()}),(0,Q.jsx)(`ul`,{children:O.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:fe()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:x()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),b?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:a()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:V(),value:w,onChange:e=>E(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`ghost`,onClick:()=>S(!1),disabled:h!==null,children:p()}),(0,Q.jsx)(G,{variant:`outline`,onClick:()=>void M(!1),disabled:h!==null,children:h===`reject`?k():o()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void M(!0),disabled:h!==null,children:h===`reject`?k():s()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`outline`,onClick:()=>S(!0),disabled:h!==null||i==null,children:C()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void j(),disabled:h!==null||i==null,children:h===`approve`?k():l()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AC as i,BC as ee,CC as te,DC as ne,EC as re,FC as ie,GC as a,HC as o,IC as s,LC as ae,MC as oe,NC as se,OC as ce,PC as le,QS as c,RC as ue,SC as l,TC as de,Tz as u,UC as d,VC as fe,WC as f,XS as p,ZS as m,_C as h,aC as pe,bC as me,cC as he,dC as g,eC as _,fC as ge,gC as _e,hC as v,iC as ve,jC as ye,kC as be,lC as xe,mC as Se,nC as y,oC as b,pC as x,rC as S,sC as C,t as w,tC as T,uC as E,vC as D,wC as O,wz as k,xC as A,yC as j,zC as Ce}from"./api-CMppRsht.js";import{$ as M,Dt as we,Et as N,Fn as P,In as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-C3dl90Xw.js";import{n as Ae}from"./TimeRangePicker-DLQwf08l.js";import{t as je}from"./FilterBar-CnjTuIOw.js";import{t as Me}from"./DataTableShell-BInsTzwk.js";import{t as W}from"./dispatchErrorInfo-BvZIc7oP.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?a():e===`acknowledged`?f():d()}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=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,r=e.status===J?q:e.status,a=e.severity??q,c=e.kind??q,[d,f]=(0,G.useState)(q),p=De(e.from,e.to),{from:m,to:_}=Ae(p),y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),S=e=>void t({search:t=>({...t,status:e===q?J:e})}),T=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=k(w.anomalies.resolveAnomaly),Y=(u(w.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=u(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:m,to:_,anomalyStatus:r===q?void 0:r,severity:a===q?void 0:a,source:d===q?void 0:d,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!==``||r!==`open`||a!==q||d!==q||c!==q||p.kind!==`relative`||p.from!==Le.from;function Ue(){f(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:o(),description:(0,K.jsxs)(K.Fragment,{children:[fe(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ee(),` `,(0,K.jsx)(`strong`,{children:Ce()}),`.`,` `,ue()]}),confirmLabel:ae()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(s(),e.kind)}catch(e){U.error(ie(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(le(),e.kind)}catch(e){U.error(se(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,K.jsx)(`strong`,{children:ye()}),` `,i(),` `,(0,K.jsx)(`strong`,{children:be()}),` `,ce(),` `,(0,K.jsx)(`strong`,{children:ne()}),` `,re(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:de()})]}),(0,K.jsxs)(je,{q:n,onQChange:y,searchPlaceholder:O(),timeRange:p,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:r,onValueChange:S,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:te()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:a,onValueChange:T,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:l()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:D()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:d,onValueChange:f,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:h()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:_e()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:c,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:v()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:Se()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:x(),rows:X,emptyHint:r===`open`?ge():g(),rowActions:e=>Y&&e.status===`open`?[{label:E(),onSelect:()=>void We(e)},{label:xe(),onSelect:()=>void Ge(e)}]:[],columns:[{header:he(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:A(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:j({when:z(e.firstAt)}),children:me({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:l(),cell:e=>(0,K.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:C(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:h(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:b(),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:pe(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ve(),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=P();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:[`↗ `,S()]}):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:[`↗ `,S()]})}):(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:[`↗ `,S()]}):null]})}function $({row:e}){let[t,n]=(0,G.useState)(!1),i=u(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:[y(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(U,{open:t,onOpenChange:n,children:(0,K.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(H,{children:T()})}),i===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):i.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:r()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:i.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)(N,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:m()}):(0,K.jsx)(N,{variant:`outline`,children:p()})}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{Bw as r,Ci as i,Ei as a,Gw as o,Hw as s,Iw as c,Jw as l,Kw as u,Lw as d,Rw as f,Si as p,Ti as m,Tz as h,Uw as g,Vw as _,Ww as v,Xw as y,Yw as b,qw as x,t as S,wi as C,xi as w,zw as T}from"./api-CMppRsht.js";import{$ as E,Fn as D,In as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-C3dl90Xw.js";import{n as ee}from"./TimeRangePicker-DLQwf08l.js";import{t as z}from"./FilterBar-CnjTuIOw.js";import{t as B}from"./AdvancedFilter-BzF0GRUD.js";import{t as V}from"./DataTableShell-BInsTzwk.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:m()},{value:`targetLabel`,label:C()},{value:`impersonated`,label:i()},{value:`resource`,label:p()},{value:`resourceId`,label:w()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,p=e.resource??G,m=F(e.from,e.to),C=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:w,to:I}=ee(m),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=h(S.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:i===G?void 0:i,resource:p===G?void 0:p,impersonated:a===G?void 0:a===`yes`,advanced:C.length>0?C: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!==``||i!==G||a!==G||p!==G||C.length>0||m.kind!==`relative`||m.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:l(),timeRange:m,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:x()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:u()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:a,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:o()}),(0,U.jsx)(k,{value:`yes`,children:v()}),(0,U.jsx)(k,{value:`no`,children:g()})]})]}),(0,U.jsxs)(A,{value:p,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:s()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:_()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:r(),rows:$,emptyHint:T(),columns:[{header:f(),cell:e=>N(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:c(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Au as i,Ay as a,By as o,Cu as s,Cy as c,D as l,Du as u,Dy as d,Eu as f,Ey as p,Fy as m,Gb as h,Gr as g,Gy as _,Hb as ee,Hy as te,Iy as ne,Jb as re,Jy as ie,Kb as ae,Kr as oe,Ky as se,Ly as ce,Mu as le,My as v,Nu as ue,Ny as de,Ou as y,Oy as fe,Py as pe,Qb as me,Qy as he,Rb as ge,Ry as _e,Su as ve,Sy as ye,Sz as be,Tu as xe,Ty as Se,Tz as b,Ub as Ce,Ur as we,Uy as Te,Vy as Ee,Wb as De,Wr as Oe,Wy as ke,Xr as Ae,Xy as je,Yb as Me,Yy as Ne,Zb as Pe,Zy as Fe,_u as Ie,ab as Le,by as x,cb as Re,db as ze,eb as Be,fb as Ve,gb as He,hb as Ue,ib as We,ju as Ge,jy as Ke,ku as qe,ky as Je,lb as Ye,lt as Xe,mb as Ze,nb as Qe,ob as $e,pb as et,qb as tt,qr as nt,qy as rt,rb as it,sb as at,t as S,tb as ot,ub as st,vy as C,wu as ct,wy as lt,wz as ut,xu as dt,xy as ft,yy as w,zb as pt,zy as mt}from"./api-CMppRsht.js";import{r as T}from"./dist-CNchpxsr.js";import{t as ht}from"./chevron-up-Od7h9avP.js";import{t as gt}from"./chevrons-up-down-DJIIcTyy.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-8IB11dM6.js";import{i as xt,n as St,r as Ct,t as wt}from"./tabs-BPsz_527.js";import{t as Tt}from"./button-IhgT55aN.js";import{$ as D,Bt as Et,Dt,Et as O,F as Ot,Fn as kt,In as At,Mn as jt,Q as k,Rt as Mt,X as A,Z as j,at as Nt,ct as Pt,et as M,in as N,jn as P,jt as F,lt as I,nt as Ft,ot as It,q as Lt,rt as Rt,sn as zt,tt as Bt,ut as Vt,xn as Ht,zt as Ut}from"./index-C3dl90Xw.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as Gt,i as L,n as R,o as z,r as B,t as V}from"./table-E4WVxNnB.js";import{t as Kt}from"./FilterBar-CnjTuIOw.js";import{a as H,n as qt,o as U,r as W,s as Jt,t as Yt}from"./compatView-ok0H4ab7.js";import{t as G}from"./dispatchErrorInfo-BvZIc7oP.js";var Xt=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`}]]),Zt=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 Qt(e){return e.filter(e=>e.state===`error`)}function $t(e){return e.reachable&&Qt(e.targets).length===0}function en(e){return $t(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function tn(e){return e.state===`error`&&e.lastErrorCode!==null}function nn(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function rn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function an(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 rn(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__`,on={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function pn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(on),[i,o]=(0,K.useState)(null),s=(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),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),l=(0,K.useMemo)(()=>fn(s),[s]),u=(0,K.useMemo)(()=>pn(s),[s]),f=(0,K.useMemo)(()=>mn(s),[s]),m=(0,K.useMemo)(()=>dn(cn(s,n),i),[s,n,i]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Kt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:Ke()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),l.map(e=>(0,Q.jsx)(k,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:a()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),u.map(e=>(0,Q.jsx)(k,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:Je()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),f.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:d(),sortKey:`target`,sort:i,onSort:h}),(0,Q.jsx)($,{label:p(),sortKey:`state`,sort:i,onSort:h}),(0,Q.jsx)($,{label:Se(),sortKey:`instance`,sort:i,onSort:h}),(0,Q.jsx)($,{label:lt(),sortKey:`host`,sort:i,onSort:h}),(0,Q.jsx)($,{label:c(),sortKey:`version`,sort:i,onSort:h}),(0,Q.jsx)(L,{children:ye()}),(0,Q.jsx)($,{label:ft(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Q.jsx)(R,{children:m.map(e=>(0,Q.jsx)(gn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(L,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(ht,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=tn(e)?G(e.lastErrorCode):null,n=nn(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(vn,{state:e.state})}),(0,Q.jsx)(B,{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)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{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)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:m({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:I(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{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?` · ${I(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[pe({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${I(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?x():e===`error`?w():C()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:x()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:w()}):(0,Q.jsx)(O,{variant:`outline`,children:C()})}function yn(){return b(S.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=b(S.compat.getBridgeCompat,{}),n=b(S.me.getMe,{host:Lt})?.role===`admin`,r=b(S.admin.listInstances,n?{}:`skip`),i=b(S.agents.usageForInstances,n?{}:`skip`),a=kt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=an(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=At({from:`/settings/bridge`}),l=kt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&qt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Qe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ot()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:nt()}),(0,Q.jsx)(L,{children:oe()}),(0,Q.jsx)(L,{children:g()}),(0,Q.jsx)(L,{children:Oe()}),(0,Q.jsx)(L,{children:we()})]})}),(0,Q.jsx)(R,{children:i.flatMap(e=>{let t=Ot(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(O,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(wt,{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)(Ct,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(xt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(zt,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(St,{value:e.key,children:(0,Q.jsx)(Sn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}):null]})}function xn({health:e,compat:t,onSeeAnomalies:n}){let r=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:H(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Ge(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,i({build:t.buildVersion??`?`})]}):null,` · `,qe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:rt()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:se()});let c=Qt(e.targets),l=!e.reachable,u=en(e),d=e.unreachableInstances??[],f=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,p=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Q.jsx)(P,{size:22}):l||u===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(N,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?_():u===`gateways_unreachable`?Ee({count:d.length}):l?ke():Te({count:c.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Xt,{size:12,"aria-hidden":!0}),` `,te({time:p})]}),m?(0,Q.jsx)(`span`,{children:mt({time:m})}):null,s]}),u===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:o({names:d.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:_e()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Jt(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:Yt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,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)(zt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(O,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ue()}),(0,Q.jsx)(wn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Cn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(jt,{size:13,"aria-hidden":!0}),ce({count:t.length})]}),p?(0,Q.jsx)(hn,{connections:t,displayByInstance:c}):null]})}function Cn({protocol:e}){let[t,n]=(0,K.useState)(!1),i=e.coverage,a=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Be(),a.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:he({count:a.length})}):o>0?(0,Q.jsx)(O,{variant:`destructive`,children:Fe()}):(0,Q.jsx)(O,{variant:`secondary`,children:r()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[je({version:e.vendoredVersion}),i?` · `+Ne({handled:i.handled,ignored:i.ignored,gaps:i.gaps}):null]}),o>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,a.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:a.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,i&&i.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)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(jt,{size:13,"aria-hidden":!0}),ie({count:i.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function wn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:rt()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ae({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:xe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(O,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Bt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ft,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Nt,{children:[(0,Q.jsx)(It,{children:me({instance:e.displayName??e.name})}),(0,Q.jsx)(Rt,{children:Pe()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(P,{"aria-hidden":!0}):(0,Q.jsx)(N,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?$e():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Le()]}):null}function Dn({instance:e,onClose:t}){let n=ut(S.admin.upsertInstanceConfig),r=be(S.bridge.validateMediaPaths),i=Dt(),a=Wt(e.config?.contentLocale,void 0),[o,s]=(0,K.useState)(()=>_t(e.config??{},a)),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),m=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=m||g;async function te(){d(!0),p(null);try{p(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(st(),e)}finally{d(!1)}}async function ne(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(De(),e)}finally{l(!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)(E,{label:Me(),help:Ce()}),(0,Q.jsxs)(A,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:bt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:re(),help:ee()}),(0,Q.jsxs)(A,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:vt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:tt(),help:pt()}),(0,Q.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[m&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:He(),help:Ue()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ze(),help:et()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Vt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Q.jsx)(E,{label:ae(),help:ge()})]}),_&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),it({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:Re(),result:f.inbound}),(0,Q.jsx)(En,{label:at(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),We()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(Tt,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(Ht,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?ze():Ve()]}),(0,Q.jsx)(Tt,{size:`sm`,onClick:()=>void ne(),disabled:c,children:h()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Mt,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ct():s({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ve()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Bu as i,Fu as a,Hu as o,Iu as s,Lu as c,Pu as l,Qd as u,Ru as d,Sz as f,Tz as p,Vu as m,Xb as h,Yr as g,af as _,as as v,cs as y,ds as b,fs as x,gz as S,is as C,ls as w,os as T,rf as E,rs as D,ss as O,t as k,us as A,vd as j,wz as M,zu as N}from"./api-CMppRsht.js";import{t as P}from"./button-IhgT55aN.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,in as U,jt as W,ut as G}from"./index-C3dl90Xw.js";import{i as K}from"./compatView-ok0H4ab7.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=M(k.admin.upsertInstanceConfig),n=p(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,o]=(0,q.useState)(r),[c,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(r),u(`idle`)},[e._id,r]);let d=`__none__`,f=i!==r;async function m(){u(`saving`);try{let n={...e.config??{}};i===``||i===d?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?d:i,onValueChange:e=>o(e===d?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":w(),children:(0,X.jsx)(H,{placeholder:O()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:d,children:O()}),h.map(e=>(0,X.jsx)(z,{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`?_():s()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null]})}function Q({instance:e}){let t=M(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,q.useState)(n),[c,u]=(0,q.useState)(r===null?``:String(r)),[d,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),u(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let p=c.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,h=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,g=i!==n||(m??null)!==r;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":A()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(W,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":T(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!g||!h||d===`saving`,onClick:()=>void y(),children:d===`saving`?_():s()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function $({instance:e}){let t=M(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[o,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),c(`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,p=(d??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(W,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||o===`saving`,onClick:()=>void m(),children:o===`saving`?_():s()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function ee(){let e=f(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=p(k.admin.listInstances,{}),[s,l]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!s||!a.some(e=>e.name===s))&&l(a[0].name)},[a,s]);let _=(a?.length??0)>1,v=a!==void 0&&a.length===0,y=p(k.compat.forInstance,s?{instanceName:s}:`skip`),b=s?I(y,`configDefaults`):`loading`,x=b===`loading`?null:b.blocked,C=(0,q.useMemo)(()=>_&&s?{instanceName:s}:{},[_,s]),w=(0,q.useRef)(0),T=(0,q.useCallback)(async()=>{let t=++w.current;n({status:`loading`});try{let r=Y(await e(C));if(w.current!==t)return;n({status:`done`,current:r})}catch{if(w.current!==t)return;n({status:`error`})}},[e,C]);(0,q.useEffect)(()=>{x===!1&&(_&&!s||T())},[T,x,_,s]);let D=t.status===`done`?t.current:null,O=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),A=(0,q.useMemo)(()=>[{id:`fast`,label:r()},{id:`standard`,label:u()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),_&&s?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsxs)(B,{value:s,onValueChange:e=>l(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":j(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(a??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):b===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):b.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(U,{size:14,"aria-hidden":!0}),` `,K(b.gatewayVersion,b.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[c(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:E()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,X.jsx)(L,{options:O,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,X.jsx)(L,{options:A,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:g()})]}),(()=>{let e=a?.find(e=>e.name===(s??a[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{dh as r,fh as i,gh as a,hh as o,mh as s,ph as c,uh as l}from"./api-CMppRsht.js";import{r as u}from"./dist-CNchpxsr.js";import{t as d}from"./chevron-up-Od7h9avP.js";import{t as f}from"./chevrons-up-down-DJIIcTyy.js";import{t as p}from"./button-IhgT55aN.js";import{Dn as m,It as h,Lt as g,Mt as _,Nt as v,Pt as y,an as b,un as x,ut as S}from"./index-C3dl90Xw.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-E4WVxNnB.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=a(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(S,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],a=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(S,{"aria-label":i(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(y,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),a&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AD as i,BD as a,CD as o,DD as s,ED as c,FD as l,GD as u,HD as d,ID as f,JD as p,KD as m,LD as h,MD as g,ND as _,OD as v,PD as y,QD as b,RD as ee,SD as te,TD as ne,Tz as re,UD as ie,VD as ae,WD as oe,XD as x,YD as S,ZD as C,_D as w,aO as T,bD as E,cO as D,dO as O,eO as k,fO as A,gD as j,gO as M,go as N,hD as P,hO as F,iO as I,jD as L,kD as R,lO as z,mD as B,mO as V,nO as H,oO as U,pO as W,qD as se,rO as G,sO as K,t as q,tO as ce,uO as le,vD as ue,vo as de,wD as fe,wz as J,xD as pe,yD as me,zD as he}from"./api-CMppRsht.js";import{t as ge}from"./button-IhgT55aN.js";import{U as _e,ct as Y}from"./index-C3dl90Xw.js";import{t as ve}from"./DataTableShell-BInsTzwk.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>M(),incorrect:()=>F(),incoherence:()=>V(),formatting:()=>W(),latency:()=>A(),api_error:()=>O(),other:()=>le()},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:D()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:z()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=J(q.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[l,f]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);async function _(){let t=l.trim();if(!(!t||h)){g(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{g(!1)}}}let v=[];try{v=i.contextJson?JSON.parse(i.contextJson):[]}catch{v=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${U()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:y(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(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:E()}),(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:I()}),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`?G():e.authorRole===`agent`?e.authorLabel??de():H()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:k(),value:l,maxLength:2e3,rows:3,onChange:e=>f(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 _(),disabled:!l.trim()||h,children:h?r():b()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||x()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||x()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,v.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se({count:i.contextCount??v.length,truncated:i.contextTruncated?m():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:v.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?d({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ae(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,a()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=re(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=_e(),[a,u]=(0,X.useState)(null),[d,p]=(0,X.useState)({});async function m(e){if(a===e._id){u(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});p(t=>({...t,[e._id]:n}))}u(e._id)}async function y(e){await r({title:j(),description:P(),confirmLabel:B(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&u(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[he(),` `,(0,Z.jsx)(`strong`,{children:ee()}),` `,h()]}),(0,Z.jsx)(ve,{title:f(),rows:e,emptyHint:l(),isExpanded:e=>a===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Z.jsx)(be,{data:d[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:_(),cell:e=>Y(e.at),sort:e=>e.at},{header:g(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:L(),cell:e=>e.messageRole===`user`?i():R(),sort:e=>e.messageRole},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${s({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:c(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ne(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:fe(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:o()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:N()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:pe()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?me():ue(),onSelect:()=>void m(e)},{label:w(),onSelect:()=>void y(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,Mz as n}from"./api-CMppRsht.js";import{I as r,L as i,R as a,z as o}from"./index-C3dl90Xw.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
|
-
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
|
-
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
|
-
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
5
|
-
{references}`},disabledTemplate:{fr:`{references}`,en:`{references}`}},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:{fr:`[FICHIERS REÇUS]
|
|
6
|
-
{files}`,en:`[RECEIVED FILES]
|
|
7
|
-
{files}`}},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:{fr:`[SYNTHÈSE DE CONVERSATION]
|
|
8
|
-
Tu maintiens le résumé cumulatif d'une conversation entre un utilisateur et un assistant. Mets à jour le résumé existant en y intégrant les nouveaux messages. Conserve : décisions, faits, chiffres, engagements, préférences exprimées, questions ouvertes. Style : factuel, compact, même langue que la conversation. Réponds UNIQUEMENT avec le résumé mis à jour, sans commentaire, en {max_chars} caractères au maximum.
|
|
9
|
-
|
|
10
|
-
[RÉSUMÉ EXISTANT]
|
|
11
|
-
{previous_summary}
|
|
12
|
-
|
|
13
|
-
[NOUVEAUX MESSAGES]
|
|
14
|
-
{new_messages}`,en:`[CONVERSATION SUMMARY]
|
|
15
|
-
You maintain the cumulative summary of a conversation between a user and an assistant. Update the existing summary by folding in the new messages. Keep: decisions, facts, figures, commitments, stated preferences, open questions. Style: factual, compact, same language as the conversation. Reply ONLY with the updated summary, no commentary, in at most {max_chars} characters.
|
|
16
|
-
|
|
17
|
-
[EXISTING SUMMARY]
|
|
18
|
-
{previous_summary}
|
|
19
|
-
|
|
20
|
-
[NEW MESSAGES]
|
|
21
|
-
{new_messages}`},disabledTemplate:{fr:`[RÉSUMÉ EXISTANT]
|
|
22
|
-
{previous_summary}
|
|
23
|
-
|
|
24
|
-
[NOUVEAUX MESSAGES]
|
|
25
|
-
{new_messages}`,en:`[EXISTING SUMMARY]
|
|
26
|
-
{previous_summary}
|
|
27
|
-
|
|
28
|
-
[NEW MESSAGES]
|
|
29
|
-
{new_messages}`}},quote_reply:{key:`quote_reply`,appliedIn:`convex`,togglable:!0,placeholders:[`excerpt`],defaultTemplate:{fr:`[EN RÉPONSE À]
|
|
30
|
-
L'utilisateur répond à ce passage précis d'une réponse précédente de l'assistant :
|
|
31
|
-
> {excerpt}
|
|
32
|
-
Traite sa consigne comme portant spécifiquement sur ce passage.`,en:`[IN REPLY TO]
|
|
33
|
-
The user is replying to this specific passage of a previous assistant answer:
|
|
34
|
-
> {excerpt}
|
|
35
|
-
Treat their instruction as targeting that passage specifically.`},disabledTemplate:{fr:`> {excerpt}`,en:`> {excerpt}`}},file_curation:{key:`file_curation`,appliedIn:`convex`,togglable:!0,placeholders:[`file_name`,`budget_chars`,`feedback`,`content`],defaultTemplate:{fr:`[CURATION DE FICHIER D'AGENT]
|
|
36
|
-
Tu es le CURATEUR des fichiers d'agent de cette passerelle. Rationalise le fichier {file_name} ci-dessous pour le ramener SOUS {budget_chars} caractères en PRÉSERVANT toutes les informations pertinentes : supprime les redondances et les doublons, fusionne les entrées équivalentes, condense sans perdre un fait porteur, restructure pour la clarté. La QUALITÉ prime sur la quantité. N'invente rien, ne suppose rien.
|
|
37
|
-
|
|
38
|
-
Rôle du fichier (adapte la curation à ce rôle) :
|
|
39
|
-
- MEMORY.md : index de la mémoire durable de l'agent — chaque entrée pointe vers un souvenir ; conserve les références et leur sens, fusionne les doublons.
|
|
40
|
-
- AGENTS.md : règles et consignes de travail — conserve chaque règle distincte ; condense les explications, jamais les interdictions.
|
|
41
|
-
- SOUL.md : personnalité et ton — conserve l'intention, condense les exemples.
|
|
42
|
-
- IDENTITY.md : identité (nom, rôle, langue) — quasi incompressible, ne retire que les répétitions.
|
|
43
|
-
- TOOLS.md : notes d'usage des outils — conserve chaque outil et ses pièges connus.
|
|
44
|
-
- USER.md : contexte sur l'utilisateur — conserve les faits et préférences, fusionne les redites.
|
|
45
|
-
|
|
46
|
-
[RETOUR DE L'ADMINISTRATEUR SUR LA PROPOSITION PRÉCÉDENTE]
|
|
47
|
-
{feedback}
|
|
48
|
-
|
|
49
|
-
RÈGLES DE SORTIE STRICTES :
|
|
50
|
-
- Réponds UNIQUEMENT avec le contenu réécrit du fichier (markdown brut).
|
|
51
|
-
- AUCUN préambule, AUCUN commentaire, AUCUNE ligne MEDIA:, AUCUN bloc de code englobant.
|
|
52
|
-
|
|
53
|
-
--- CONTENU ACTUEL DE {file_name} ---
|
|
54
|
-
{content}`,en:`[AGENT-FILE CURATION]
|
|
55
|
-
You are the CURATOR of this gateway's agent files. Rationalize the file {file_name} below to bring it UNDER {budget_chars} characters while PRESERVING all relevant information: remove redundancies and duplicates, merge equivalent entries, condense without losing a load-bearing fact, restructure for clarity. QUALITY over quantity. Never invent, never assume.
|
|
56
|
-
|
|
57
|
-
Role of the file (adapt the curation to it):
|
|
58
|
-
- MEMORY.md: the agent's durable memory index — each entry points to a memory; keep the references and their meaning, merge duplicates.
|
|
59
|
-
- AGENTS.md: working rules and instructions — keep every distinct rule; condense explanations, never prohibitions.
|
|
60
|
-
- SOUL.md: personality and tone — keep the intent, condense the examples.
|
|
61
|
-
- IDENTITY.md: identity (name, role, language) — nearly incompressible, only remove repetitions.
|
|
62
|
-
- TOOLS.md: tool-usage notes — keep every tool and its known pitfalls.
|
|
63
|
-
- USER.md: context about the user — keep facts and preferences, merge restatements.
|
|
64
|
-
|
|
65
|
-
[ADMINISTRATOR FEEDBACK ON THE PREVIOUS PROPOSAL]
|
|
66
|
-
{feedback}
|
|
67
|
-
|
|
68
|
-
STRICT OUTPUT RULES:
|
|
69
|
-
- Reply ONLY with the rewritten file content (raw markdown).
|
|
70
|
-
- NO preamble, NO commentary, NO MEDIA: line, NO wrapping code fence.
|
|
71
|
-
|
|
72
|
-
--- CURRENT CONTENT OF {file_name} ---
|
|
73
|
-
{content}`},disabledTemplate:{fr:`[FICHIER {file_name} — budget {budget_chars} caractères]
|
|
74
|
-
[RETOUR ADMIN]
|
|
75
|
-
{feedback}
|
|
76
|
-
|
|
77
|
-
{content}`,en:`[FILE {file_name} — budget {budget_chars} characters]
|
|
78
|
-
[ADMIN FEEDBACK]
|
|
79
|
-
{feedback}
|
|
80
|
-
|
|
81
|
-
{content}`}}},l=Object.keys(c);function u(e,t,n){return t.enabled?t.template:c[e].disabledTemplate?.[n]??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e,t){let n={};for(let r of l){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:c[r].defaultTemplate[t]}}return n}function v(e,t){let n={};for(let r of l){let i=c[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let s=a.template.trim();s.length>0&&s!==i.defaultTemplate[t]&&(o.template=s),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function y(e,t){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections,t)}}var b=[`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function x(e,t,n){let r={},i=n=>{(e[n]!==g[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=v(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of b){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var S=e();function C({text:e}){return(0,S.jsx)(a,{delayDuration:150,children:(0,S.jsxs)(r,{children:[(0,S.jsx)(o,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,S.jsx)(s,{"aria-hidden":!0})})}),(0,S.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function w({label:e,help:t}){return(0,S.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,S.jsx)(C,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,w as n,p as o,x as r,f as s,C as t,l as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AR as ee,CR as r,DR as te,ER as i,FR as ne,IR as a,LR as o,MR as s,NR as c,OR as re,PR as l,SR as u,Sj as ie,So as d,TR as f,Tz as ae,_R as oe,aR as se,bR as p,cR as ce,dR as le,fR as ue,gR as de,gz as fe,hR as pe,iR as m,jR as h,kR as me,lR as he,mR as ge,nR as _e,oR as ve,pR as ye,rR as be,sR as xe,t as g,uR as _,vR as v,vz as y,wR as b,wz as x,xR as S,xo as C,yR as w}from"./api-CMppRsht.js";import{t as T}from"./button-IhgT55aN.js";import{$ as E,Ct as D,Dn as O,Dt as k,Et as A,Lt as j,Mt as M,Nt as Se,On as N,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,an as R,bt as Te,et as z,ln as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-C3dl90Xw.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-E4WVxNnB.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return i();case`audio`:return f();case`video`:return b();case`pdf`:return r();case`document`:return u();case`archive`:return S();default:return p()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[i,u]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[b,S]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=x(g.files.softDelete),Y=k();function Ie(){t(G),r(G),u(G),p(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(he())}catch(e){Y.error(ce(),e)}}let X=ae(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:i===G?void 0:i,category:f===G?void 0:f,includeAutoGenerated:b||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:fe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||i!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(I,{value:e,onValueChange:t,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":a(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:ne()}),(0,W.jsx)(F,{value:`inbound`,children:l()}),(0,W.jsx)(F,{value:`outbound`,children:c()})]})]}),(0,W.jsxs)(I,{value:n,onValueChange:r,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":s(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:h()}),Q.chats.map(e=>(0,W.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(I,{value:i,onValueChange:u,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:me()}),Q.instances.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(I,{value:f,onValueChange:p,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":re(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:te()}),Q.categories.map(e=>(0,W.jsx)(F,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:b,onCheckedChange:e=>S(e===!0),"aria-label":d()}),(0,W.jsx)(`span`,{children:d()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Ee,{size:14,"aria-hidden":!0}),ue()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():m()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{children:v()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:pe()}),(0,W.jsx)(B,{className:`text-right`,children:ge()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:C()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?l():c()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(M,{children:[(0,W.jsx)(j,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":le(),children:(0,W.jsx)(O,{size:16})})}),(0,W.jsxs)(Se,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(N,{size:14}),ye()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(N,{size:14}),se()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(R,{size:14}),_()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:_e({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:xe()}),(0,W.jsx)(Ce,{children:ve()})]}),(0,W.jsxs)(D,{children:[(0,W.jsx)(Te,{children:ie()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:_()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Af as i,Bf as a,Cf as o,Cp as s,D as c,Df as l,Ef as u,Ep as d,Ff as f,Gf as p,Hf as m,If as h,Jf as g,Kf as _,Lf as v,Mf as y,Nf as b,Of as x,Pf as S,Qf as C,Rf as ee,Sf as te,Sp as w,Tf as ne,Tp as T,Tz as E,Uf as re,Vf as D,Wf as ie,Xf as O,Yf as ae,Zf as k,_f as A,_p as j,ap as M,bf as oe,bp as se,cp as N,dp as ce,ep as le,fp as P,gp as F,hp as ue,ip as de,jf as fe,kf as pe,lp as me,mp as he,np as ge,op as _e,pp as ve,qf as ye,rp as be,sp as xe,t as I,tp as Se,up as Ce,vf as we,vp as Te,wf as Ee,wp as De,wz as L,xf as R,xp as Oe,yf as ke,yp as Ae,zf as je}from"./api-CMppRsht.js";import{t as Me}from"./x-CdHbCgxq.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-BPsz_527.js";import{t as V}from"./button-IhgT55aN.js";import{$ as Fe,Dt as H,Et as U,Mn as Ie,Nn as Le,Q as Re,U as ze,X as Be,Z as Ve,_ as He,at as Ue,et as We,jt as W,nt as Ge,on as G,ot as Ke,q as qe,rt as Je,sn as K,tt as Ye,ut as q}from"./index-C3dl90Xw.js";import{t as Xe}from"./FilterBar-CnjTuIOw.js";import{t as Ze}from"./DataTableShell-BInsTzwk.js";import{t as J}from"./DetailChips-Lo0Kvu7k.js";var Qe=c(`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`}]]),Y=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),$e=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),X=t(e(),1);function et(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 tt(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 nt(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 rt(e){switch(e){case`admin`:return ye();case`user`:return _();case`pending`:return p();default:return e}}function Z(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=E(I.groups.listGroups,{}),t=E(I.me.getMe,{host:qe})?.role===`admin`,n=L(I.groups.createGroup),r=L(I.groups.updateGroup),i=L(I.groups.deleteGroup),a=ze(),o=H(),[c,l]=(0,X.useState)(!1),[u,f]=(0,X.useState)(null),[p,m]=(0,X.useState)($),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(``),y=(0,X.useMemo)(()=>{if(!e)return e;let t=_.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,_]);function b(){f(null),m($),l(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),l(!0)}async function S(){try{u?await r({groupId:u._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m($),f(null),l(!1)}catch(e){o.error(oe(),e)}}async function C(e){if(await a({title:xe({name:e.name}),description:_e(),confirmWord:e.name,confirmLabel:M(),cancelLabel:ve(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(ke(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),(0,Q.jsx)(Xe,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:Te()}),(0,Q.jsx)(Ze,{title:d(),rows:y,addLabel:De(),onAdd:t?b:void 0,emptyHint:s(),columns:[{header:w(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:se(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ae(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:j(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:F(),onSelect:()=>x(e)},{label:ue(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(He,{open:c,onOpenChange:l,title:u?ce():P(),description:Ce(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:he(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,Q.jsx)(W,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,Q.jsx)(W,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Le,{size:14,"aria-hidden":!0}),O()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":g({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ae(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=E(I.groups.getGroup,n&&e?{groupId:e}:`skip`),c=E(I.groups.listAssignableInstances,n?{}:`skip`),l=E(I.groups.listAssignableUsers,n?{}:`skip`),u=L(I.groups.addMember),d=L(I.groups.removeMember),f=L(I.groups.bulkSetMembers),p=L(I.groups.setGroupManager),h=H(),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(``),[x,S]=(0,X.useState)(`members`),[ee,w]=(0,X.useState)(1),[T,re]=(0,X.useState)(new Set),D=(0,X.useRef)(null),O=(0,X.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ae=(0,X.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),A=s?.viewerIsAdmin===!0,j=(0,X.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,X.useEffect)(()=>{_(``),y(``),S(`members`),w(1),D.current=null},[n,e]),(0,X.useEffect)(()=>{w(1)},[g]),(0,X.useEffect)(()=>{n&&s&&e&&D.current!==e&&(D.current=e,re(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let M=(0,X.useMemo)(()=>l?et(l,g,T):[],[l,g,T]);async function oe(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(we(),e)}}async function se(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(te(),e)}}let N=Z(M,e=>O.has(e.userId)),ce=M.filter(e=>O.has(e.userId)).length,P=it(M,ee,ot);async function F(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:N!==`all`})}catch(e){h.error(we(),e)}}return(0,Q.jsx)(Ye,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ge,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ke,{children:de({name:t})}),(0,Q.jsx)(Je,{children:be()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),ge(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),le(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),b(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:g,onChange:e=>_(e.target.value),placeholder:Se(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void F(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[ce,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=O.has(e.userId),n=nt(e),r=ae.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void oe(e.userId,t),"aria-label":ie({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&A?(0,Q.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?o():Ee(),title:r?o():Ee(),onClick:()=>void se(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ne(),title:ne(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:w})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:je()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:v,onChange:e=>y(e.target.value),placeholder:r(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:v},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=E(I.groups.listAssignableAgents,{instanceName:t}),o=L(I.groups.assignAgentToGroup),s=L(I.groups.removeAgentFromGroup),c=L(I.groups.bulkSetGroupAgents),l=H(),[u,d]=(0,X.useState)(1);if((0,X.useEffect)(()=>{d(1)},[i]),!e)return null;let p=tt(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let g=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=Z(g,e=>r.has(`${t}/${e.agentId}`)),y=it(p,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(A(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){l.error(A(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:h()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?v():ee()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":re({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S(),title:S(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:f()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=E(I.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(I.charts.assignChartToGroup),r=L(I.charts.removeChartFromGroup),a=L(I.charts.setGroupDefaultChart),o=L(I.charts.addChartToGroupPool),s=L(I.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:d,addable:f,canManagePool:p}=t;if(d.length===0&&!p)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:d.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":x({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":l(),title:l(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:u()}):null,p?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":pe({name:e.name}),title:pe({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(We,{placeholder:i()})}),(0,Q.jsx)(Ve,{children:f.map(e=>(0,Q.jsx)(Re,{value:e.chartKey,children:e.name},e.chartKey))})]}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):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{$T as r,$r as i,$w as a,AE as o,AT as s,As as c,BE as l,BT as u,Bb as d,CE as f,CM as p,CT as m,DE as h,DT as g,Ds as _,EE as v,ET as y,FE as b,FT as x,GT as S,HT as C,IE as w,IT as T,JT as E,KT as D,LE as ee,LT as te,ME as ne,MT as re,NE as ie,NT as ae,OE as oe,OT as se,Os as ce,PE as le,PT as ue,QT as de,Qr as fe,Qw as O,RE as pe,RT as me,SE as he,ST as ge,Sz as k,TE as _e,TT as ve,Tz as A,UT as ye,VT as be,Vb as xe,WT as Se,XT as j,YT as Ce,ZT as we,Zw as Te,_E as Ee,_T as De,aE as Oe,aT as ke,bE as Ae,cE as je,cT as Me,dE as Ne,dT as Pe,eE as Fe,eT as Ie,ei as Le,fE as Re,fT as ze,gE as Be,gT as Ve,hE as He,hT as Ue,iE as We,iT as Ge,jE as Ke,jT as qe,kE as Je,kT as Ye,ks as Xe,lE as Ze,lT as Qe,mE as $e,mT as et,nE as tt,nT as nt,oE as rt,oT as it,pE as at,pT as ot,qT as st,rE as ct,rT as lt,sE as ut,sT as dt,t as M,tE as ft,tT as pt,uE as mt,uT as ht,vE as gt,vT as _t,wE as vt,wM as yt,wT as N,wz as P,xE as bt,xT as F,yE as xt,yT as St,zE as Ct,zT as wt}from"./api-CMppRsht.js";import{a as Tt,c as Et}from"./FieldLabel-8IB11dM6.js";import{t as I}from"./button-IhgT55aN.js";import{$ as L,Bt as Dt,Dt as R,Et as z,Q as B,Rt as Ot,U as kt,X as V,Z as H,_ as At,at as U,et as W,jt as G,nt as K,ot as q,rt as J,tt as jt,ut as Mt,zt as Nt}from"./index-C3dl90Xw.js";import{t as Pt}from"./DataTableShell-BInsTzwk.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-BxMufTiI.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=A(M.admin.listInstances,{}),t=A(M.agents.listAllInstanceAgents,{}),n=P(M.admin.upsertInstance),r=P(M.admin.deleteInstance),a=R(),[s,c]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)(Q),[m,g]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null),[C,T]=(0,Y.useState)(null);async function E(){try{await n({instanceId:C??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),p(Q),T(null),c(!1)}catch(e){a.error(pe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),(0,Z.jsx)(`strong`,{children:w()}),b()]}),(0,Z.jsx)(Pt,{title:le(),rows:e,addLabel:ie(),onAdd:()=>{T(null),p(Q),c(!0)},emptyHint:ne(),columns:[{header:Ke(),cell:e=>e.name,sort:e=>e.name},{header:o(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Je(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:oe(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:l(),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)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?O():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:vt(),onSelect:()=>{T(e._id),p(Bt(e)),c(!0)}},{label:Ct(),onSelect:()=>g(e.name)},{label:Ze(),onSelect:()=>S(e)},{label:h(),onSelect:()=>y(e)},{label:v(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:v(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(At,{open:s,onOpenChange:c,title:C?f():_e(),description:bt(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:Ae(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:xt(),children:[(0,Z.jsx)(G,{value:u.name,disabled:C!==null,onChange:e=>p({...u,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:he()}):null]}),(0,Z.jsx)($,{label:gt(),children:(0,Z.jsxs)(V,{value:u.kind,onValueChange:e=>p({...u,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(B,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:Le(),children:(0,Z.jsxs)(V,{value:u.transport,onValueChange:e=>p({...u,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`ws`,children:i()}),(0,Z.jsx)(B,{value:`rest`,children:fe()})]})]})}):null,(0,Z.jsx)($,{label:Ee(),children:(0,Z.jsx)(G,{value:u.gatewayUrl,onChange:e=>p({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Be(),children:(0,Z.jsx)(G,{value:u.bridgeUrl,placeholder:He(),onChange:e=>p({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:$e(),children:(0,Z.jsx)(G,{value:u.displayName,onChange:e=>p({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:xe(),children:[(0,Z.jsxs)(V,{value:u.streamTransport,onValueChange:e=>p({...u,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(H,{children:Et.map(e=>(0,Z.jsx)(B,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d()})]}),(0,Z.jsx)($,{label:at(),children:(0,Z.jsx)(G,{value:u.gatewayVersion,placeholder:Re(),onChange:e=>p({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ne(),children:(0,Z.jsx)(G,{value:u.gatewayHttpUrl,placeholder:mt(),onChange:e=>p({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:m,open:m!==null,onOpenChange:e=>{e||g(null)}}),_?(0,Z.jsx)(Ft,{instance:_,onClose:()=>y(null)},_._id):null,x?(0,Z.jsx)(Ht,{instance:x,onClose:()=>S(null)},x._id):null]})}function Ht({instance:e,onClose:t}){let n=A(M.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{children:je({instance:e.displayName??e.name})}),(0,Z.jsx)(J,{children:ut()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=k(M.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(be());break;case`no_agents`:n.success(wt());break;case`no_bridge_url`:n.error(me());break;case`deploy_misconfigured`:n.error(te());break;case`unauthorized`:n.error(x());break;case`not_served`:n.error(ue());break;default:n.error(T());break}}catch(e){n.error(u(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(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?C():ye()})})]})}function Wt({instance:e}){let t=A(M.bridgeAuth.listBridgeAuthStatus,{}),n=k(M.bridgeAuth.mintBridgeSecret),r=P(M.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),m=f!==void 0;async function h(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(y(),e)}finally{o(!1)}}}async function _(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(g())}catch(e){i.error(y(),e)}finally{o(!1)}}}async function v(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:m?`outline`:`secondary`,children:m?`${ct()} · ${f.prefix}…${f.lastFour}`:tt()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?Ye():s()}),m?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:a,children:se()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:u?yt():p()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:N()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let i=k(M.instanceSecrets.setInstanceSecret),a=P(M.instanceSecrets.clearInstanceSecret),o=k(M.deviceIdentity.generateDeviceIdentity),s=R(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?rt():t===`deviceIdentity`?Oe():We();async function b(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),m(null),g(!1),s.success(we())}catch(e){s.error(j(),e)}finally{d(!1)}}}async function x(){if(!u){d(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(Ce())}catch(e){s.error(j(),e)}finally{d(!1)}}}async function C(){if(!u){d(!0);try{m(await o({instanceId:e})),g(!1),s.success(D())}catch(e){s.error(Se(),e)}finally{d(!1)}}}let w=f?`openclaw devices approve ${f.id}`:``;async function T(){if(w)try{await navigator.clipboard.writeText(w),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:_?`outline`:`secondary`,children:_?ct():tt()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?Fe():ft(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void b(),disabled:u||c.trim().length===0,children:r()}),v?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void C(),disabled:u,children:E()}):null,_?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:u,children:de()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:D()}),(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:w}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:h?yt():p()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:N()})]}):null]})}var Kt={conversational:ot,documentary:Pe,summarizer:c,curator:ce},qt={conversational:ze,documentary:ht,summarizer:Xe,curator:_},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:De()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ve()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ue()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:et()}),(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)(Mt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=A(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=P(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=P(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=P(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=P(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=P(M.agents.removeInstanceAgent),u=kt(),d=R();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(F(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(F(),e)}}async function h(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(F(),e)}}async function g(t,n){if(e&&await u({title:dt({name:n}),description:it(),confirmLabel:ke(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(Ge())}catch(e){d.error(F(),e)}}return(0,Z.jsx)(jt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{children:m({name:e??``})}),(0,Z.jsx)(J,{children:ge()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:lt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?nt():r.discovery.lastPollOk?pt():Ie({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(Mt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:Te()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:Me()})]}):i?(0,Z.jsx)(z,{variant:`default`,children:O()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:Qe()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(F(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:St(),"aria-label":_t(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,DO as a,EO as o,Gc as s,Jc as c,Kc as l,OO as u,SO as d,Sz as f,TO as p,Tz as m,Uc as h,Wc as g,Xc as _,Yc as v,Zc as y,bO as b,jO as x,kO as S,qc as C,t as w,vO as T,wO as E,wz as D,xO as O,yO as k}from"./api-CMppRsht.js";import{t as A}from"./button-IhgT55aN.js";import{Et as j,jt as M,ut as N}from"./index-C3dl90Xw.js";var P=t(e(),1),F=n();function I(){let e=m(w.integrations.status.status,{}),t=D(w.admin.setIntegrationConfig),[n,s]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:x()});let c=n,l=(e,t,n)=>s({...c,[e]:{...c[e],[t]:n}}),f=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,F.jsx)(`strong`,{children:S()}),` `,u()]}),(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:o()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:E(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(M,{value:c.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>f(`langfuse`,{host:c.langfuse.host??``})})}),(0,F.jsx)(z,{label:T(),checked:c.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),f(`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:o()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:i(),children:[(0,F.jsx)(R,{label:O(),children:(0,F.jsx)(M,{value:c.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>f(`opik`,{baseUrl:c.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(M,{value:c.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||k(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>f(`opik`,{workspace:c.opik.workspace??``})})}),(0,F.jsx)(z,{label:T(),checked:c.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),f(`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:o()}):(0,F.jsx)(j,{variant:`outline`,children:y()}),note:_(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(M,{value:c.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>f(`otlp`,{endpoint:c.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:T(),checked:c.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),f(`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=f(w.integrations.otlpSecret.setOtlpHeaders),n=D(w.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),p=async()=>{d(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:c(),children:[(0,F.jsx)(M,{value:r,placeholder:e?C():l(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:u||r.trim().length===0,onClick:()=>void p(),children:s()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:u,onClick:()=>void n({}),children:g()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:h()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Gv as i,Jv as a,Kv as o,Qv as s,Tz as c,Wv as l,Xv as u,Yv as d,Zv as f,dk as p,ey as m,fk as h,ik as g,iy as _,mk as v,ny as ee,pk as y,qv as b,rk as x,ry as S,t as C,ty as w,zk as T}from"./api-CMppRsht.js";import{Fn as E,In as D,i as te,o as ne,q as re,r as O}from"./index-C3dl90Xw.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-ClDtGwk1.js";import{n as P,t as F}from"./TimeRangePicker-DLQwf08l.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=c(C.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=c(C.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:T()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:v()}),(0,z.jsx)(M,{children:h()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(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:[x(),` p50 `,V(s.cP50),` `,y()]}),(0,z.jsxs)(`span`,{children:[g(),` 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:_(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:S(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:ee(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:w(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:m(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:r(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:s(),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,O,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:i,to:o}=P(n),{rowLimit:s,buckets:l}=Y(i,o),p=c(C.kpi.listKpis,{limit:s,filter:{from:i,to:o}}),m=(0,I.useMemo)(()=>{let e=new Map;for(let t of p??[]){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},[p,l]),h=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return p===void 0?(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):p.length===0?(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(m.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:m.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:b({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:o()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:i({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":l({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{$N as r,$R as i,$t as a,BN as o,BR as s,GN as c,GR as l,HN as u,HR as ee,IN as d,JN as f,JR as p,KN as m,KR as te,LN as ne,QN as re,QR as ie,Qt as ae,RN as oe,Tz as h,UN as g,UR as se,VN as ce,VR as le,WN as ue,WR as de,XN as fe,XR as pe,YN as _,YR as me,ZN as he,ZR as ge,Zt as v,_P as y,_n as b,aP as x,az as S,bE as C,bP as w,cP as T,cz as E,dP as D,dz as O,eP as k,en as A,ez as j,fP as M,fn as N,gP as P,gz as F,hP as I,iP as L,in as _e,iz as ve,lP as ye,mP as be,nP as xe,nn as Se,nz as Ce,oP as we,oz as Te,pP as Ee,qN as De,qR as Oe,r as R,rP as ke,rn as Ae,rz as je,sP as Me,sz as Ne,t as z,tP as Pe,tn as Fe,tz as Ie,uP as Le,vP as Re,vn as ze,wz as B,xP as Be,yP as Ve,zN as He,zR as Ue}from"./api-CMppRsht.js";import{t as V}from"./button-IhgT55aN.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-C3dl90Xw.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-PqzYbV3J.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>Be()},{id:`composer`,label:()=>w()},{id:`sidebar`,label:()=>Ve()},{id:`notifications`,label:()=>xe()},{id:`other`,label:()=>Re()}],X={showSource:{category:`messages`,label:()=>y(),help:()=>P()},showReport:{category:`messages`,label:()=>I(),help:()=>be()},copyAssistant:{category:`messages`,label:()=>Ee()},copyUser:{category:`messages`,label:()=>M()},showDelete:{category:`messages`,label:()=>D()},showTools:{category:`messages`,label:()=>Le(),help:()=>ye()},voiceInput:{category:`composer`,label:()=>T(),help:()=>Me()},showUsage:{category:`composer`,label:()=>we(),help:()=>x()},autoReadAloud:{category:`composer`,label:()=>ze(),help:()=>b()},showChatAge:{category:`sidebar`,label:()=>L(),help:()=>ke()},notifSound:{category:`notifications`,label:()=>Pe(),help:()=>k()},notifSystem:{category:`notifications`,label:()=>r(),help:()=>re()},replySound:{category:`notifications`,label:()=>he(),help:()=>fe()}};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:()=>o()};function ut({prefKey:e,ui:t}){let n=B(z.admin.setUiPrefDefault),r=B(z.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ue()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:oe()}),(0,J.jsx)(U,{value:`off`,children:ne()}),(0,J.jsx)(U,{value:`inherit`,children:d()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":g()}),g()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=B(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[_e(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?Fe():r?Se():Ae()})]}),(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:v()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?ae():e?a():A()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=h(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=B(z.me.setUiPref).withOptimisticUpdate(Je),l=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":c()}),c()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:u()}),(0,J.jsx)(`p`,{children:ce()}),(0,J.jsx)(`p`,{children:He()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:f()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:De()}):l?(0,J.jsx)(H,{variant:`secondary`,children:N()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:m()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:F()})}var pt={sm:()=>pe(),md:()=>me(),lg:()=>p(),xl:()=>Oe(),"2xl":()=>te(),"3xl":()=>l()};function mt(){let e=h(z.me.getMe,{host:G}),t=B(z.me.setLocale),n=B(z.me.setTimezone),r=B(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=B(z.me.setMyName),o=Ke(),c=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await a({name:f}),d(null),o.success(ve())}catch(e){o.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:E()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:Te(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:C()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(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:Ce()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:O()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:j()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:de()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:i()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.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:ge()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:s()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|