@lacneu/atrium 0.80.1 → 0.81.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-OP6MT853.js +1 -0
- package/dist/assets/{AdvancedFilter-Ddd7TM1I.js → AdvancedFilter-CYKmk_LK.js} +1 -1
- package/dist/assets/AgentFilesTab-Bzj4n4RS.js +3 -0
- package/dist/assets/AnomaliesTab-DIOsMkIt.js +1 -0
- package/dist/assets/AuditTab-B-v9HjgO.js +1 -0
- package/dist/assets/BridgeTab-D7jnblPV.js +1 -0
- package/dist/assets/ChatDefaultsTab-DE7qape9.js +1 -0
- package/dist/assets/{DataTableShell-D2srrwu0.js → DataTableShell-CR2Pxo32.js} +1 -1
- package/dist/assets/{DetailChips-WUMzjman.js → DetailChips-BttzOfap.js} +1 -1
- package/dist/assets/FeedbacksTab-BPxuXa49.js +1 -0
- package/dist/assets/{FieldLabel-BNwSIo5u.js → FieldLabel-DvlvfpGK.js} +1 -1
- package/dist/assets/FilesTab-Da5f-Q53.js +1 -0
- package/dist/assets/{FilterBar-BS4HsrlJ.js → FilterBar-D8d3TG3L.js} +1 -1
- package/dist/assets/GroupsTab-02Klvfu1.js +1 -0
- package/dist/assets/InstancesTab-CvcFYqzZ.js +1 -0
- package/dist/assets/IntegrationsTab-C3v_UYdO.js +1 -0
- package/dist/assets/KpiTab-NBnWW7mn.js +1 -0
- package/dist/assets/PreferencesTab-Dtc4NXr7.js +1 -0
- package/dist/assets/ProjectPage-3M9H_seP.js +1 -0
- package/dist/assets/PromptInjectionsTab-ydfl3LIa.js +4 -0
- package/dist/assets/RolesTab-rtjEoRka.js +1 -0
- package/dist/assets/ScheduledTab-1Z--saSr.js +1 -0
- package/dist/assets/ServiceAccountsTab-BDQcZy4S.js +1 -0
- package/dist/assets/SubAgentReportsTab-BlttiEor.js +1 -0
- package/dist/assets/ThemeShowroom-D1Av-z7w.js +1 -0
- package/dist/assets/{TimeRangePicker-Dx50b9Tc.js → TimeRangePicker-CdzW5P7l.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DH_5qFyU.js → TimezoneCombobox-Byz56evB.js} +1 -1
- package/dist/assets/TracesTab-DuT8lvo4.js +1 -0
- package/dist/assets/UsersTab-6m5HSxal.js +1 -0
- package/dist/assets/VoiceTab-DFVKbQpO.js +1 -0
- package/dist/assets/{api-CyG2Kb2E.js → api-Borb_oKz.js} +5 -5
- package/dist/assets/{button-SxU4iS5M.js → button-Bcf40mKN.js} +1 -1
- package/dist/assets/{card-vJtS-_yl.js → card-BVQ_SWDd.js} +1 -1
- package/dist/assets/chevrons-up-down-DQp99IbP.js +1 -0
- package/dist/assets/{compatView-JE5RFigb.js → compatView-CowuHUom.js} +1 -1
- package/dist/assets/dispatchErrorInfo-DwvABR74.js +1 -0
- package/dist/assets/{dist-CPSxRyhy.js → dist-BCOYDeQS.js} +1 -1
- package/dist/assets/{dist-bgyYeQqP.js → dist-Bq0h0jBi.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BakvA9z8.js → highlighted-body-OFNGDK62-DSC5jaxG.js} +1 -1
- package/dist/assets/index-DEMhzN6j.css +1 -0
- package/dist/assets/index-lMzb_P_p.js +324 -0
- package/dist/assets/{list-JGKvhNdi.js → list-DfIPa6Dk.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BoodyZnM.js +1 -0
- package/dist/assets/{pdf-BkJsigVn.js → pdf-CO5wvqSF.js} +1 -1
- package/dist/assets/roleDescriptions-xzqDDCcp.js +1 -0
- package/dist/assets/{table-jvClq47d.js → table-B5YoMU9b.js} +1 -1
- package/dist/assets/{tabs-D_DuLEpU.js → tabs-D7icC_cj.js} +1 -1
- package/dist/assets/x-XSJ8VGVc.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AccessTab-Bg7AJltl.js +0 -1
- package/dist/assets/AgentFilesTab-BRmbz8_w.js +0 -3
- package/dist/assets/AnomaliesTab-m5WLIYl2.js +0 -1
- package/dist/assets/AuditTab-1gyBuFew.js +0 -1
- package/dist/assets/BridgeTab-DlU50D2z.js +0 -1
- package/dist/assets/ChatDefaultsTab-CN8cDKMU.js +0 -1
- package/dist/assets/FeedbacksTab-CcE_6zZR.js +0 -1
- package/dist/assets/FilesTab-CfDSdvOR.js +0 -1
- package/dist/assets/GroupsTab-BN8czt3O.js +0 -1
- package/dist/assets/InstancesTab-Mw3vQGZr.js +0 -1
- package/dist/assets/IntegrationsTab-HnFrohTq.js +0 -1
- package/dist/assets/KpiTab-Bt81LKar.js +0 -1
- package/dist/assets/PreferencesTab-DNxJMl_1.js +0 -1
- package/dist/assets/ProjectPage-BNEr-qVc.js +0 -1
- package/dist/assets/PromptInjectionsTab-DaLlUnez.js +0 -4
- package/dist/assets/RolesTab-DjKUmoAu.js +0 -1
- package/dist/assets/ScheduledTab-BTuR5Igi.js +0 -1
- package/dist/assets/ServiceAccountsTab-3PR98Iqq.js +0 -1
- package/dist/assets/SubAgentReportsTab-kiNltjSe.js +0 -1
- package/dist/assets/ThemeShowroom-DGuXtdJT.js +0 -1
- package/dist/assets/TracesTab-zOMYT0Ye.js +0 -1
- package/dist/assets/UsersTab-DVhM7px6.js +0 -1
- package/dist/assets/VoiceTab-l-Tr6bly.js +0 -1
- package/dist/assets/chevrons-up-down-ChvoKzuN.js +0 -1
- package/dist/assets/dispatchErrorInfo-BKhXLGGN.js +0 -1
- package/dist/assets/index-Cv1UBVbk.css +0 -1
- package/dist/assets/index-DWkl2h55.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-CgrVl_4r.js +0 -1
- package/dist/assets/roleDescriptions-B9SjwOYY.js +0 -1
- package/dist/assets/x-CHe0mcCM.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fw as e,Iw as t,Lw as n,Rw as r,zw as i}from"./api-Borb_oKz.js";var a={pending:i,user:r,admin:n,observer:t,agent:e};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-Borb_oKz.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,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-
|
|
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-Borb_oKz.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-lMzb_P_p.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-Borb_oKz.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,14 +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-lMzb_P_p.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/x-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
72
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-Borb_oKz.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BCOYDeQS.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Bq0h0jBi.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/x-XSJ8VGVc.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/button-Bcf40mKN.js">
|
|
72
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DEMhzN6j.css">
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
|
75
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.81.1",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Xz as r,_m as i,aB as a,am as o,cm as s,dm as c,fm as l,gm as u,hm as d,im as f,lm as p,mm as m,om as h,pm as g,rm as _,sm as v,t as y,um as b}from"./api-CyG2Kb2E.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-DWkl2h55.js";var D=t(e(),1);function O(e){return e===`user`?v():e===`all`?h():o({group:e.group})}function k(e){return e===`common`?f():e===`owner`?_():o({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=a(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),o=a(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":u(),children:(0,A.jsx)(E,{placeholder:u()})}),(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:d()}):o===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:m()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:o.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:o.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),o.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.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:l()}),o.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.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:s()}):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:c()}),o.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.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:b()}),o.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Ad as i,Ao as a,Bd as o,Bo as s,Cd as c,Co as l,Dd as u,Do as d,Ed as f,Eo as p,Fd as m,Ff as h,Fo as g,Gd as _,Hd as v,Id as y,Io as b,Jd as x,Kd as S,Ld as C,Lo as w,Lt as T,Md as ee,Mo as E,Nd as D,Nf as te,No as O,Od as ne,Oo as k,Pd as A,Po as j,Qz as M,Rd as N,Ro as re,Sd as ie,So as P,Td as F,To as I,Ud as ae,Vd as L,Vo as R,Wd as oe,Xz as z,Yd as se,aB as B,ao as V,bd as ce,eo as le,iB as H,io as U,jd as ue,jo as de,kd as fe,ko as pe,nB as W,no as me,qd as he,ro as ge,t as G,tM as _e,to as ve,wd as ye,wo as be,xd as xe,xo as Se,zd as Ce,zo as we}from"./api-CyG2Kb2E.js";import{t as K}from"./button-SxU4iS5M.js";import{$ as Te,B as Ee,Ct as De,Dt as q,Et as Oe,Q as ke,St as Ae,Tt as je,X as Me,Z as Ne,at as Pe,bt as Fe,et as Ie,nt as Le,ot as Re,q as ze,rt as Be,tt as Ve,un as J,vt as He,wt as Ue,xt as We,yt as Ge}from"./index-DWkl2h55.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-JE5RFigb.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
-
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
-
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=B(G.me.getMe,{host:ze}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=B(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let s=B(G.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),c=B(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||s===void 0?r!==void 0&&r.length===0?[]:void 0:s.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,s,r,c]),[u,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,p=W(G.agentFiles.listAgentFiles),[m,h]=(0,Y.useState)({status:`idle`}),g=f?.instanceName??null,y=f?.agentId??null,ee=B(G.compat.forInstance,n&&g!==null?{instanceName:g}:`skip`),E=n&&g!==null?Ee(ee,`agentFiles`):null,D=E===null?!1:E===`loading`?null:E.blocked,O=(0,Y.useCallback)(async()=>{if(!(g===null||y===null)){h({status:`loading`});try{h({status:`done`,files:(await p({instanceName:g,agentId:y})).files})}catch(e){h({status:`error`,dashboardAbsent:tt(e)})}}},[p,g,y]);(0,Y.useEffect)(()=>{D===!1&&O()},[O,D]);let[ne,k]=(0,Y.useState)(null),A=B(G.agentFileCuration.listCurations,t&&g!==null&&y!==null?{instanceName:g,agentId:y}:`skip`),j=B(G.agentFileCuration.curationSettings,t&&g!==null?{instanceName:g}:`skip`),ie=W(G.agentFileCuration.requestCuration),[P,F]=(0,Y.useState)(null),[I,R]=(0,Y.useState)(null),{toast:V}=q(),ce=(0,Y.useMemo)(()=>{let e=new Map;for(let t of A??[])e.has(t.name)||e.set(t.name,t);return e},[A]),le=(0,Y.useCallback)(async e=>{if(!(g===null||y===null)){F(e);try{let t=await ie({instanceName:g,agentId:y,name:e,trigger:`manual`});t.ok?V({title:re(),variant:`success`}):V({title:w({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:b(),variant:`error`})}finally{F(null)}}},[ie,g,y,V]),H=M(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||l===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:se()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Me,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":x(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:(r??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Me,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":he(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:l.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}),f===null?null:E===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):E!==null&&E.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(E.gatewayVersion,E.provider)]}):m.status===`loading`||m.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):m.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[m.dashboardAbsent?T():oe(),` `,!m.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:te()})]}):m.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:m.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Oe,{variant:`outline`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:v({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:L({pct:U.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":o()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>k(e),children:t?N():C()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:j?.budgetChars??null,enabled:j?.enabled??!1,curation:ce.get(e.name)??null,inFlight:P===e.name,onCurate:()=>void le(e.name),onReview:e=>R(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:Ce({used:Z(Qe(m.files),H),total:Z(Ye,H),pct:U.format(Ze(Qe(m.files)))})})]}),ne&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:ne.name,isAdmin:t,onClose:()=>k(null),onSaved:()=>void O()}):null,I?(0,Q.jsx)(ot,{curationId:I,onClose:()=>R(null),onApplied:()=>{R(null),O()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:s()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Oe,{variant:`outline`,className:`oc-afiles__curate-status`,children:we()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:R()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let s=W(G.agentFiles.getAgentFile),l=W(G.agentFiles.setAgentFile),d=q(),[p,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[E,O]=(0,Y.useState)(!1),[k,j]=(0,Y.useState)(!1),N=(0,Y.useCallback)(async r=>{v(!1);try{let i=await s({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),O(!1)}catch{v(!0)}},[s,e,t,n]);(0,Y.useEffect)(()=>{N(!1)},[N]);async function re(){if(p!==null){T(!0),j(!1);try{await l({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(i({name:n})),o(),await N(!1)}catch(e){nt(e)?O(!0):j(!0)}finally{T(!1)}}}let P=p!==null&&b!==p.content,I=(0,Y.useMemo)(()=>p===null?null:et(p.content,b),[p,b]),ae=b.length>X,L=M(),R=(0,Y.useMemo)(()=>new Intl.NumberFormat(L),[L]);return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:y({name:n})}),(0,Q.jsxs)(Be,{children:[m({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,A()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ne(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void N(!1),children:te()})]}):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:b,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":y({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:D()}),E?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[u(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void N(!0),children:f()})]}):null,k?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:fe()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ae?` is-over`:``}`,children:ee({count:R.format(b.length),max:R.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!P||w||E,onClick:()=>C(!0),children:w?h():ue()}):null]})]}),(0,Q.jsx)(He,{open:S,onOpenChange:C,children:(0,Q.jsxs)(We,{children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(je,{children:F({name:n})}),(0,Q.jsx)(Ae,{children:ye({agent:t})})]}),I?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:c({added:I.added,removed:I.removed})}),I.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ie()}),I.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,I.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:xe()}),I.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Fe,{children:_e()}),(0,Q.jsx)(Ge,{onClick:()=>void re(),children:ce()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=B(G.agentFileCuration.getProposal,{curationId:e}),o=W(G.agentFileCuration.approveCuration),s=H(G.agentFileCuration.rejectCuration),{toast:c}=q(),[u,f]=(0,Y.useState)(null),[m,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),x=M(),S=(0,Y.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function C(){f(`approve`);try{let t=await o({curationId:e});t.ok?(c({title:g(),variant:`success`}),n()):c({title:t.reason===`conflict`?O():E({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:b(),variant:`error`})}finally{f(null)}}async function w(n){f(`reject`);try{let r=v.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?le():j(),variant:`success`}):c({title:pe(),variant:`error`}),t()}catch{c({title:b(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:i?de({name:i.name}):z()}),(0,Q.jsx)(Be,{children:a()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[k({before:Z(i.beforeSize,x),after:Z(i.proposedSize,x)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,d()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:p({added:S.added,removed:S.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:r({feedback:i.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:Se()}),(0,Q.jsx)(`ul`,{children:S.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:P()}),(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:I()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:V()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:U(),value:v,onChange:e=>y(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>_(!1),disabled:u!==null,children:ge()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void w(!1),disabled:u!==null,children:u===`reject`?h():me()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(!0),disabled:u!==null,children:u===`reject`?h():ve()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>_(!0),disabled:u!==null||i==null,children:be()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void C(),disabled:u!==null||i==null,children:u===`approve`?h():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{$C as r,AC as i,BC as ee,Cw as a,FC as o,GC as te,HC as ne,IC as s,JC as c,KC as re,LC as ie,MC as l,NC as u,PC as d,QC as ae,RC as oe,Sw as f,UC as se,VC as ce,WC as le,XC as p,YC as ue,ZC as de,_w as fe,aB as m,aw as pe,bw as h,cw as g,dw as _,ew as me,fw as he,gw as ge,hw as _e,iB as ve,iw as ye,jC as v,kC as y,lw as be,mw as xe,nw as Se,ow as b,pw as x,qC as S,rw as C,sw as w,t as T,tw as E,uw as D,vw as O,ww as k,xw as A,yw as j,zC as Ce}from"./api-CyG2Kb2E.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn 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 V,nt as H,o as De,ot as U,q as Oe,tt as W}from"./index-DWkl2h55.js";import{n as ke}from"./TimeRangePicker-Dx50b9Tc.js";import{t as Ae}from"./FilterBar-BS4HsrlJ.js";import{t as je}from"./DataTableShell-D2srrwu0.js";import{t as G}from"./dispatchErrorInfo-BKhXLGGN.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?k():e===`acknowledged`?a():f()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,i=e.status===Y?J:e.status,a=e.severity??J,o=e.kind??J,[s,l]=(0,K.useState)(J),u=V(e.from,e.to),{from:d,to:f}=ke(u),v=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),y=e=>void t({search:t=>({...t,status:e===J?Y:e})}),k=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),H=e=>void t({search:t=>({...t,...De(e)})}),U=Ee(),W=we(),G=ve(T.anomalies.resolveAnomaly),X=(m(T.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=m(T.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:d,to:f,anomalyStatus:i===J?void 0:i,severity:a===J?void 0:a,source:s===J?void 0:s,kind:o===J?void 0:o}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||i!==`open`||a!==J||s!==J||o!==J||u.kind!==`relative`||u.from!==Ie.from;function Ue(){l(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:A(),description:(0,q.jsxs)(q.Fragment,{children:[h(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,j(),` `,(0,q.jsx)(`strong`,{children:O()}),`.`,` `,fe()]}),confirmLabel:ge()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(_e(),e.kind)}catch(e){W.error(xe(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(x(),e.kind)}catch(e){W.error(he(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,q.jsx)(`strong`,{children:D()}),` `,be(),` `,(0,q.jsx)(`strong`,{children:g()}),` `,w(),` `,(0,q.jsx)(`strong`,{children:b()}),` `,pe(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:ye()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:v,searchPlaceholder:C(),timeRange:u,onTimeRangeChange:H,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:i,onValueChange:y,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:Se()}),Me.map(e=>(0,q.jsx)(F,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:a,onValueChange:k,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:E()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:de()}),Pe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:s,onValueChange:l,children:[(0,q.jsx)(M,{size:`sm`,className:`w-32`,children:(0,q.jsx)(B,{placeholder:p()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:ue()}),Fe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:o,onValueChange:R,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:c()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:S()}),Q.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:re(),rows:Z,emptyHint:i===`open`?te():le(),rowActions:e=>X&&e.status===`open`?[{label:se(),onSelect:()=>void We(e)},{label:ne(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ce(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:c(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:me(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:ae({when:z(e.firstAt)}),children:r({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:E(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ee(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:p(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:Ce(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:oe(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:ie(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,s()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,s()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,s()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=m(T.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[o(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(H,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(U,{children:d()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:u()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:l()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:v()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:i()}):(0,q.jsx)(N,{variant:`outline`,children:y()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,CT as i,DT as a,ET as o,OT as s,Qi as c,ST as l,TT as u,Xi as d,Zi as f,_T as p,aB as m,bT as h,ea as g,gT as _,hT as v,kT as y,t as b,ta as x,vT as S,wT as C,xT as w,yT as T}from"./api-CyG2Kb2E.js";import{$ as E,Gn as D,Kn 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-DWkl2h55.js";import{n as ee}from"./TimeRangePicker-Dx50b9Tc.js";import{t as z}from"./FilterBar-BS4HsrlJ.js";import{t as B}from"./AdvancedFilter-Ddd7TM1I.js";import{t as V}from"./DataTableShell-D2srrwu0.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:x()},{value:`realLabel`,label:g()},{value:`targetLabel`,label:r()},{value:`impersonated`,label:c()},{value:`resource`,label:f()},{value:`resourceId`,label:d()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,c=e.impersonated??G,d=e.resource??G,f=F(e.from,e.to),g=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:x,to:I}=ee(f),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}),$=m(b.admin.listAudit,{filter:{q:n||void 0,from:x,to:I,action:r===G?void 0:r,resource:d===G?void 0:d,impersonated:c===G?void 0:c===`yes`,advanced:g.length>0?g:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||c!==G||d!==G||g.length>0||f.kind!==`relative`||f.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:s()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:a(),timeRange:f,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:r,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:o()})}),(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:c,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:C()}),(0,U.jsx)(k,{value:`yes`,children:i()}),(0,U.jsx)(k,{value:`no`,children:l()})]})]}),(0,U.jsxs)(A,{value:d,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:w()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:h()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:g,onChange:Q}),(0,U.jsx)(V,{title:T(),rows:$,emptyHint:S(),columns:[{header:p(),cell:e=>N(e.at),sort:e=>e.at},{header:o(),cell:e=>e.action,sort:e=>e.action},{header:_(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:w(),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{$u as r,$y as i,Ab as a,Ax as o,Bb as s,Cb as c,Cx as l,D as u,Db as d,Dx as f,Eb as p,Ex as m,Fb as h,Gb as ee,Hb as te,Ib as ne,Jb as re,Kb as ie,Ku as g,Lb as ae,Mb as _,Nb as v,Ob as y,Ox as oe,Pb as b,Qu as se,Qy as x,Rb as ce,Rt as le,Sb as ue,Si as de,Sx as fe,Tb as pe,Ti as me,Tx as he,Ub as ge,Vb as _e,Wb as ve,Yb as ye,Zu as be,Zy as xe,_b as Se,_x as Ce,aB as S,ab as we,ad as Te,bb as Ee,bi as De,cb as Oe,cd as ke,db as C,eb as Ae,ed as je,fb as Me,gb as Ne,hb as Pe,iB as Fe,ib as Ie,id as w,jb as Le,jx as Re,kb as ze,lb as Be,ld as Ve,mb as He,nB as Ue,nb as We,nd as Ge,ob as Ke,od as qe,pb as Je,qb as Ye,rb as Xe,rd as Ze,sb as Qe,sd as $e,t as T,tb as et,td as tt,ub as nt,vb as rt,vi as it,vx as at,wb as ot,wx as st,xb as ct,xi as lt,xx as ut,yb as dt,yi as ft,zb as pt}from"./api-CyG2Kb2E.js";import{t as mt}from"./chevrons-up-down-ChvoKzuN.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-BNwSIo5u.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-D_DuLEpU.js";import{t as D}from"./button-SxU4iS5M.js";import{$ as O,Bn as k,Bt as Ct,Dn as wt,Dt as Tt,Et as A,F as Et,Gn as j,Hn as M,Kn as Dt,Q as N,Rn as Ot,Rt as kt,X as P,Z as F,at as At,ct as jt,et as I,jt as L,lt as R,nt as Mt,ot as Nt,pn as Pt,q as Ft,rt as It,tt as Lt,un as z,ut as Rt,zn as zt,zt as Bt}from"./index-DWkl2h55.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-jvClq47d.js";import{t as Gt}from"./FilterBar-BS4HsrlJ.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-JE5RFigb.js";import{t as U}from"./dispatchErrorInfo-BKhXLGGN.js";var $t=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=u(`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`}]]),W=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(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,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(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 Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(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)=>Y(e.label,t.label))}function gn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[i,a]=(0,W.useState)(null),o=(0,W.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]),s=(0,W.useMemo)(()=>mn(o),[o]),c=(0,W.useMemo)(()=>hn(o),[o]),l=(0,W.useMemo)(()=>gn(o),[o]),u=(0,W.useMemo)(()=>pn(dn(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Me(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:nt()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:C()}),s.map(e=>(0,Z.jsx)(N,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:Be()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:C()}),c.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Oe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:C()}),l.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:Ke(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:we(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ie(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Xe(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:We(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(B,{children:et()}),(0,Z.jsx)(Q,{label:Ae(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(Ut,{children:u.map(e=>(0,Z.jsx)(vn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:He({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Je({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?i():e===`error`?x():xe()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(A,{variant:`secondary`,children:i()}):e===`error`?(0,Z.jsx)(A,{variant:`destructive`,children:x()}):(0,Z.jsx)(A,{variant:`outline`,children:xe()})}function xn(){return S(T.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=S(T.compat.getBridgeCompat,{}),n=S(T.me.getMe,{host:Ft})?.role===`admin`,r=S(T.admin.listInstances,n?{}:`skip`),i=S(T.agents.usageForInstances,n?{}:`skip`),a=j(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Dt({from:`/settings/bridge`}),l=j({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:h()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:b()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(B,{children:de()}),(0,Z.jsx)(B,{children:lt()}),(0,Z.jsx)(B,{children:De()}),(0,Z.jsx)(B,{children:ft()}),(0,Z.jsx)(B,{children:it()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(A,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(St,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(xt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Pt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(bt,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):null]})}function Cn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:$e(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,qe({build:t.buildVersion??`?`})]}):null,` · `,Te(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:pe()});let o=tn(e.targets),s=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=jt(e.checkedAt),m=e.startedAt==null?null:jt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(Ot,{size:22}):s||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(z,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ot():l===`gateways_unreachable`?Ee({count:u.length}):s?c():ue({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,ct({time:f})]}),m?(0,Z.jsx)(`span`,{children:rt({time:m})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:dt({names:u.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Se()})]})}function wn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(A,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ve()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),Ne({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[v(),i.length>0?(0,Z.jsx)(A,{variant:`destructive`,children:Le({count:i.length})}):o>0?(0,Z.jsx)(A,{variant:`destructive`,children:a()}):(0,Z.jsx)(A,{variant:`secondary`,children:_()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ze({version:e.vendoredVersion}),r?` · `+y({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),o>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:le({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),d({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:me({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:tt({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(A,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Nt,{children:Re({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:o()})]}),(0,Z.jsx)(On,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ot,{"aria-hidden":!0}):(0,Z.jsx)(z,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?pt():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ce()]}):null}function On({instance:e,onClose:t}){let n=Fe(T.admin.upsertInstanceConfig),r=Ue(T.bridge.validateMediaPaths),i=Tt(),a=Vt(e.config?.contentLocale,void 0),[o,c]=(0,W.useState)(()=>ht(e.config??{},a)),[u,d]=(0,W.useState)(!1),[p,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(null),v=o.inboundMediaMode===`shared-fs`,y=o.mediaMode===`shared-fs`,b=v||y;async function se(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(ge(),e)}finally{h(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(o,r,a)}),t()}catch(e){i.error(l(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:oe(),help:fe()}),(0,Z.jsxs)(P,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:vt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:f(),help:ut()}),(0,Z.jsxs)(P,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:gt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:m(),help:at()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ye(),help:re()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ye(),help:ie()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(E,{label:he(),help:Ce()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),ne({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:_e(),result:g.inbound}),(0,Z.jsx)($,{label:s(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),ae()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:p,children:[p?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ve():ee()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void x(),disabled:u,children:st()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?je():r({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:se()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(A,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bs as r,Ff as i,Fs as a,Is as o,Jd as s,Ls as c,Ms as l,Nf as u,Ns as d,Of as f,Ps as p,Rs as m,Vs as h,Xz as g,_d as _,aB as v,dd as y,fd as b,gd as x,hd as S,iB as C,kf as w,kx as T,md as E,nB as D,pd as O,t as k,ud as A,vd as j,wi as M,zs as N}from"./api-CyG2Kb2E.js";import{t as P}from"./button-SxU4iS5M.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,jt as U,un as W,ut as G}from"./index-DWkl2h55.js";import{a as K}from"./compatView-JE5RFigb.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=C(k.admin.upsertInstanceConfig),n=v(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,s]=(0,q.useState)(r),[l,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(r),u(`idle`)},[e._id,r]);let d=`__none__`,f=a!==r;async function p(){u(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,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:m()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:a===``?d:a,onValueChange:e=>s(e===d?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":m(),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||l===`saving`,onClick:()=>void p(),children:l===`saving`?i():b()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:y()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:A()}):null]})}function Q({instance:e}){let t=C(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[o,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(r===null?``:String(r)),[u,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let m=c.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!o||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=o!==n||(h??null)!==r;async function v(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=o,!o||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,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:o,onCheckedChange:e=>s(e===!0),"aria-label":N()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":a(),disabled:!o}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?i():b()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:y()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:A()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]})}function $({instance:e}){let t=C(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[a,o]=(0,q.useState)(n===null?``:String(n)),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=a.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:h()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:a,onChange:e=>o(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||s===`saving`,onClick:()=>void m(),children:s===`saving`?i():b()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:y()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:A()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()})]})}function ee(){let e=D(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=v(k.admin.listInstances,{}),[i,a]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let o=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=v(k.compat.forInstance,i?{instanceName:i}:`skip`),d=i?I(l,`configDefaults`):`loading`,p=d===`loading`?null:d.blocked,m=(0,q.useMemo)(()=>o&&i?{instanceName:i}:{},[o,i]),h=(0,q.useRef)(0),y=(0,q.useCallback)(async()=>{let t=++h.current;n({status:`loading`});try{let r=Y(await e(m));if(h.current!==t)return;n({status:`done`,current:r})}catch{if(h.current!==t)return;n({status:`error`})}},[e,m]);(0,q.useEffect)(()=>{p===!1&&(o&&!i||y())},[y,p,o,i]);let b=t.status===`done`?t.current:null,C=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),A=(0,q.useMemo)(()=>[{id:`fast`,label:w()},{id:`standard`,label:f()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),o&&i?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,X.jsxs)(B,{value:i,onValueChange:e=>a(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":s(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(r??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:T()}):d===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):d.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[O(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:u()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:C,value:b?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:_()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,X.jsx)(L,{field:`fastMode`,options:A,value:b===null||b.fastModeDefault===null?null:b.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:S()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:M()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AO as i,BO as a,CO as o,DO as s,EO as c,FO as l,GO as u,Go as d,HO as f,IO as ee,JD as p,JO as m,KO as h,LO as te,MO as g,NO as _,OO as v,PO as ne,QD as y,RO as re,SO as ie,TO as ae,UO as b,VO as x,WO as S,XD as C,YD as w,YO as T,ZD as E,_O as D,aB as O,aO as k,bO as A,cO as j,dO as M,eO as N,fO as P,gO as F,hO as I,iB as L,iO as R,jO as z,kO as B,lO as V,mO as H,nO as U,oO as W,pO as oe,qD as G,qO as K,qo as q,rO as se,sO as ce,t as J,tO as le,uO as ue,vO as de,wO as fe,xO as pe,yO as me,zO as he}from"./api-CyG2Kb2E.js";import{t as ge}from"./button-SxU4iS5M.js";import{U as _e,ct as Y}from"./index-DWkl2h55.js";import{t as ve}from"./DataTableShell-D2srrwu0.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>T(),incorrect:()=>m(),incoherence:()=>K(),formatting:()=>h(),latency:()=>u(),api_error:()=>S(),other:()=>b()},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:x()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:a()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:f()})}function be({data:e,reference:t,closeReason:n}){let a=e.snapshot,u=L(J.feedback.respondToFeedback),[d,f]=(0,X.useState)(e.thread),[p,m]=(0,X.useState)(``),[h,y]=(0,X.useState)(!1);async function b(){let t=p.trim();if(!(!t||h)){y(!0);try{await u({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{y(!1)}}}let x=[];try{x=a.contextJson?JSON.parse(a.contextJson):[]}catch{x=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:a.displayedMatchesStored,sourceWasOpen:a.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,a.messageRole,a.isRegeneration?` · ${he()}`:``,a.openclawModel?` · ${a.openclawModel}`:``,a.openclawRuntime?` (${a.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:oe(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(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:r()}),(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:te()}),d.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:d.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ee():e.authorRole===`agent`?e.authorLabel??q():l()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ne()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:_(),value:p,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void b(),disabled:!p.trim()||h,children:h?g():z()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.messageText||B()})]}),a.clientInfo?.sourceWasOpen&&a.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.displayedText||B()})]}):null,a.promptText?(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:a.promptText})]}):null,x.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c({count:a.contextCount??x.length,truncated:a.contextTruncated?ae():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:x.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,a.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[a.outboxText??``,a.outboxStatus?`\n[status: ${a.outboxStatus}]`:``]})]}):null,a.clientInfo?.extensionsDetected&&a.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:a.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:[[a.clientInfo?.language,a.clientInfo?.timezone,a.clientInfo?.theme?pe({theme:a.clientInfo.theme}):null,a.runId?`run ${a.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,a.clientInfo?.plugins&&a.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[A(),` `,a.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,me()]})]}):null,a.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:a.clientInfo.userAgent}):null]})]})]})}function xe(){let e=O(J.feedback.listForAdmin,{}),t=L(J.feedback.readSnapshot),n=L(J.feedback.deleteFeedback),r=_e(),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)({});async function c(e){if(i===e._id){a(null);return}if(!o[e._id]){let n=await t({feedbackId:e._id});s(t=>({...t,[e._id]:n}))}a(e._id)}async function l(e){await r({title:w(),description:p(),confirmLabel:G(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[de(),` `,(0,Z.jsx)(`strong`,{children:D()}),` `,F()]}),(0,Z.jsx)(ve,{title:I(),rows:e,emptyHint:H(),isExpanded:e=>i===e._id&&!!o[e._id],renderExpanded:e=>o[e._id]?(0,Z.jsx)(be,{data:o[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:P(),cell:e=>Y(e.at),sort:e=>e.at},{header:M(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ue(),cell:e=>e.messageRole===`user`?V():j(),sort:e=>e.messageRole},{header:ce(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${W({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:k(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:R(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:se(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:U()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:le()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:d()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:N()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?y():E(),onSelect:()=>void c(e)},{label:C(),onSelect:()=>void l(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,BR as ee,GR as te,HR as ne,IR as re,JR as ie,KR as ae,LR as oe,QR as se,Qz as i,RR as a,UR as o,VR as s,WR as c,XR as l,Xo as u,Xz as ce,YR as le,ZR as ue,Zo as d,_z as de,aB as fe,az as f,cz as pe,dz as me,ez as p,fz as he,gz as ge,hz as _e,iB as ve,iz as m,lz as ye,mz as h,nz as g,oz as _,pz as v,qR as be,rz as y,sz as b,t as x,tM as S,tz as C,uz as w,zR as T}from"./api-CyG2Kb2E.js";import{t as E}from"./button-SxU4iS5M.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-DWkl2h55.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-jvClq47d.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return _();case`audio`:return f();case`video`:return m();case`pdf`:return y();case`document`:return g();case`archive`:return C();default:return p()}}function K(){let[e,t]=(0,H.useState)(W),[n,f]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[g,_]=(0,H.useState)(W),[y,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=ve(x.files.softDelete),Y=k();function Ie(){t(W),f(W),m(W),_(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(o())}catch(e){Y.error(ne(),e)}}let X=fe(x.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:p===W?void 0:p,category:g===W?void 0:g,includeAutoGenerated:y||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(i(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||p!==W||g!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:_e()}),(0,U.jsx)(F,{value:`inbound`,children:h()}),(0,U.jsx)(F,{value:`outbound`,children:v()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:f,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":he(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:me()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:p,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":w(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ye()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:g,onValueChange:_,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":pe(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:b()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:y,onCheckedChange:e=>C(e===!0),"aria-label":d()}),(0,U.jsx)(`span`,{children:d()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),ae()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?oe():a()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:r()}),(0,U.jsx)(z,{children:se()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{children:l()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{className:`text-right`,children:ie()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:u()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?h():v()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":te(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),be()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),T()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),c()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:re({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:s()}),(0,U.jsx)(Ce,{children:ee()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:S()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:c()})]})]})})]})}export{K 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,$p as i,Ap as a,Bp as o,Cp as s,D as c,Dp as l,Ep as u,Fp as d,Gp as f,Hp as p,Ip as m,Jf as h,Jp as g,Kp as _,Lp as v,Mp as y,Np as b,Op as x,Pp as S,Qf as C,Qp as w,Rp as ee,Sp as T,Tp as E,Up as D,Vp as O,Wp as te,Xf as k,Xp as A,Yf as ne,Yp as re,Zf as j,Zp as M,_p as N,aB as P,ap as F,bp as ie,cp as I,dp as ae,em as L,ep as oe,fp as se,gp as ce,hp as le,iB as R,ip as ue,jp as de,kp as fe,lp as pe,mp as me,nm as he,np as ge,op as _e,pp as ve,qf as ye,qp as be,rp as xe,sp as Se,t as z,tm as Ce,tp as we,up as Te,vp as B,wp as Ee,xp as De,yp as Oe,zp as ke}from"./api-CyG2Kb2E.js";import{t as Ae}from"./x-CHe0mcCM.js";import{i as V,n as H,r as je,t as Me}from"./tabs-D_DuLEpU.js";import{t as U}from"./button-SxU4iS5M.js";import{$ as Ne,Bn as Pe,Dt as W,Et as G,Q as Fe,U as Ie,Vn as Le,X as Re,Z as ze,_ as Be,at as Ve,cn as He,et as Ue,fn as K,jt as q,nt as We,ot as Ge,pn as J,q as Ke,rt as qe,tt as Je,ut as Y}from"./index-DWkl2h55.js";import{t as Ye}from"./FilterBar-BS4HsrlJ.js";import{t as Xe}from"./DataTableShell-D2srrwu0.js";import{t as X}from"./DetailChips-WUMzjman.js";var Ze=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`}]]),Z=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`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return s();case`user`:return T();case`pending`:return De();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=P(z.groups.listGroups,{}),t=P(z.me.getMe,{host:Ke})?.role===`admin`,n=R(z.groups.createGroup),r=R(z.groups.updateGroup),a=R(z.groups.deleteGroup),s=Ie(),c=W(),[l,u]=(0,Q.useState)(!1),[h,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(it),[S,C]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(``),j=(0,Q.useMemo)(()=>{if(!e)return e;let t=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,T]);function N(){y(null),x(it),u(!0)}function F(e){y(e),x({name:e.name,description:e.description??``}),u(!0)}async function ie(){try{h?await r({groupId:h._id,name:b.name,description:b.description}):await n({name:b.name,description:b.description||void 0}),x(it),y(null),u(!1)}catch(e){c.error(k(),e)}}async function I(e){if(await s({title:v({name:e.name}),description:m(),confirmWord:e.name,confirmLabel:d(),cancelLabel:D(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(ne(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,$.jsx)(Ye,{q:T,onQChange:E,onReset:()=>E(``),canReset:T!==``,searchPlaceholder:g()}),(0,$.jsx)(Xe,{title:he(),rows:j,addLabel:L(),onAdd:t?N:void 0,emptyHint:i(),columns:[{header:w(),cell:e=>e.name,sort:e=>e.name},{header:M(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(He,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:A(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:re(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:be(),onSelect:()=>C({groupId:e._id,name:e.name})},...t?[{label:_(),onSelect:()=>F(e)},{label:f(),variant:`destructive`,onSelect:()=>void I(e)}]:[]]}),(0,$.jsx)(Be,{open:l,onOpenChange:u,title:h?O():p(),description:o(),canSubmit:!!b.name.trim(),onSubmit:ie,submitLabel:te(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ke()}),(0,$.jsx)(q,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,$.jsx)(q,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:S?.groupId??null,groupName:S?.name??``,open:S!==null,onOpenChange:e=>{e||C(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Le,{size:14,"aria-hidden":!0}),u()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ee({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[E(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=P(z.groups.getGroup,n&&e?{groupId:e}:`skip`),s=P(z.groups.listAssignableInstances,n?{}:`skip`),c=P(z.groups.listAssignableUsers,n?{}:`skip`),u=R(z.groups.addMember),d=R(z.groups.removeMember),f=R(z.groups.bulkSetMembers),p=R(z.groups.setGroupManager),m=W(),[g,_]=(0,Q.useState)(``),[v,w]=(0,Q.useState)(``),[ee,T]=(0,Q.useState)(`members`),[E,D]=(0,Q.useState)(1),[O,te]=(0,Q.useState)(new Set),k=(0,Q.useRef)(null),A=(0,Q.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ne=(0,Q.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),re=o?.viewerIsAdmin===!0,j=(0,Q.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Q.useEffect)(()=>{_(``),w(``),T(`members`),D(1),k.current=null},[n,e]),(0,Q.useEffect)(()=>{D(1)},[g]),(0,Q.useEffect)(()=>{n&&o&&e&&k.current!==e&&(k.current=e,te(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let M=(0,Q.useMemo)(()=>c?Qe(c,g,O):[],[c,g,O]);async function N(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){m.error(h(),e)}}async function F(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(C(),e)}}let I=nt(M,e=>A.has(e.userId)),ae=M.filter(e=>A.has(e.userId)).length,L=rt(M,E,ot);async function se(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:I!==`all`})}catch(e){m.error(h(),e)}}return(0,$.jsx)(Je,{open:n,onOpenChange:i,children:(0,$.jsxs)(We,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Ge,{children:S({name:t})}),(0,$.jsx)(qe,{children:b()})]}),(0,$.jsxs)(Me,{value:ee,onValueChange:T,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(He,{size:13,"aria-hidden":!0}),y(),o?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),a(),o?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),pe(),o?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:g,onChange:e=>_(e.target.value),placeholder:de(),className:`oc-access__search`}),M.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,$.jsxs)($.Fragment,{children:[M.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":l()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:l()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,M.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=A.has(e.userId),n=et(e),i=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void N(e.userId,t),"aria-label":ie({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?r():oe(),title:i?r():oe(),onClick:()=>void F(e.userId,i),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&i?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":we(),title:we(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:D})]})]})}),(0,$.jsx)(H,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:v,onChange:e=>w(e.target.value),placeholder:fe(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:v},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=P(z.groups.listAssignableAgents,{instanceName:t}),o=R(z.groups.assignAgentToGroup),s=R(z.groups.removeAgentFromGroup),c=R(z.groups.bulkSetGroupAgents),u=W(),[d,f]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{f(1)},[i]),!e)return null;let p=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(p,d,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(ye(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(ye(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:se()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:N()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?ve():me()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":l()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:l()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":Oe({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Te(),title:Te(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:ae()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=P(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(z.charts.assignChartToGroup),r=R(z.charts.removeChartFromGroup),i=R(z.charts.setGroupDefaultChart),a=R(z.charts.addChartToGroupPool),o=R(z.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":ue({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":xe(),title:xe(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:ge()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":F({name:e.name}),title:F({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Re,{value:``,onValueChange:e=>void p(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ue,{placeholder:_e()})}),(0,$.jsx)(ze,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Se()}):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{$E as r,A as i,AE as a,AT as o,BE as s,BT as c,CE as l,DE as u,Di as d,EE as f,F as p,FE as m,FT as h,GE as g,GT as _,HE as v,HT as y,I as b,IE as x,IT as S,JE as ee,JT as C,KE as te,KT as w,LE as ne,LT as T,M as E,ME as re,MT as ie,N as ae,NE as oe,NT as se,OE as ce,Oi as le,P as ue,PE as de,PT as fe,QE as pe,QT as me,RE as he,RT as ge,SE as _e,TE as ve,UE as ye,UT as be,VE as xe,VT as Se,WE as Ce,WT as we,XE as Te,XT as Ee,YE as De,YT as Oe,ZE as ke,ZT as Ae,_D as je,_E as Me,aB as D,aD as Ne,aE as Pe,ac as Fe,bE as Ie,bx as Le,cD as Re,cE as ze,dD as Be,dE as Ve,eD as He,eE as O,fD as Ue,fE as We,gD as Ge,gE as Ke,hD as qe,hE as Je,iB as k,iD as Ye,iE as Xe,ic as Ze,j as Qe,jE as $e,jT as A,kE as j,ki as et,lD as tt,lE as nt,mD as rt,mE as it,nB as M,nD as at,nE as ot,nN as N,nc as st,oD as ct,oE as lt,pD as ut,pE as dt,qE as ft,qT as pt,rD as mt,rE as P,rN as ht,rc as gt,sD as _t,sE as vt,t as F,tD as yt,tE as bt,uD as xt,uE as St,vD as Ct,vE as wt,wE as Tt,xE as Et,yD as Dt,yE as Ot,yx as kt,zE as At,zT as jt}from"./api-CyG2Kb2E.js";import{a as Mt,c as Nt}from"./FieldLabel-BNwSIo5u.js";import{t as I}from"./button-SxU4iS5M.js";import{$ as L,Bt as Pt,Dt as R,Et as z,Q as B,Rt as Ft,U as It,X as V,Z as H,_ as Lt,at as U,et as W,jt as G,nt as K,ot as q,rt as J,tt as Rt,ut as zt,zt as Bt}from"./index-DWkl2h55.js";import{t as Vt}from"./DataTableShell-D2srrwu0.js";import{InstanceConfigDialog as Ht}from"./BridgeTab-DlU50D2z.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Ut=new Set(X),Wt=`conversational`;function Gt(e){let t=new Set((e??[]).filter(e=>Ut.has(e)));return t.size===0?[Wt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,systemIdentity:``,streamTransport:Mt},Kt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function qt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function Jt(){let e=D(F.admin.listInstances,{}),t=D(F.agents.listAllInstanceAgents,{}),n=k(F.admin.upsertInstance),a=k(F.admin.deleteInstance),o=R(),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(Q),[f,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null);async function w(){try{await n({instanceId:S??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,transport:l.kind===`hermes`?l.transport:void 0,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,...l.kind===`openclaw`?{authMode:l.authMode,systemIdentity:l.systemIdentity||void 0}:{},streamTransport:l.streamTransport}),u(Q),C(null),c(!1)}catch(e){o.error(je(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ge(),(0,Z.jsx)(`strong`,{children:qe()}),rt()]}),(0,Z.jsx)(Vt,{title:ut(),rows:e,addLabel:Ue(),onAdd:()=>{C(null),u(Q),c(!0)},emptyHint:Be(),columns:[{header:xt(),cell:e=>e.name,sort:e=>e.name},{header:tt(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Re(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:_t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Dt(),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)?A():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:mt(),onSelect:()=>{C(e._id),u(qt(e)),c(!0)}},{label:Ct(),onSelect:()=>m(e.name)},{label:v(),onSelect:()=>x(e)},{label:ct(),onSelect:()=>_(e)},{label:Ne(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:Ne(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,Z.jsx)(Lt,{open:s,onOpenChange:c,title:S?at():Ye(),description:He(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:w,submitLabel:r(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:pe(),children:[(0,Z.jsx)(G,{value:l.name,disabled:S!==null,onChange:e=>u({...l,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:yt()}):null]}),(0,Z.jsx)($,{label:ke(),children:(0,Z.jsxs)(V,{value:l.kind,onValueChange:e=>u({...l,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`})]})]})}),l.kind===`hermes`?(0,Z.jsx)($,{label:et(),children:(0,Z.jsxs)(V,{value:l.transport,onValueChange:e=>u({...l,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:le()}),(0,Z.jsx)(B,{value:`rest`,children:d()})]})]})}):null,(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(G,{value:l.gatewayUrl,onChange:e=>u({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:De(),children:(0,Z.jsx)(G,{value:l.bridgeUrl,placeholder:ee(),onChange:e=>u({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ft(),children:(0,Z.jsx)(G,{value:l.displayName,onChange:e=>u({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Le(),children:[(0,Z.jsxs)(V,{value:l.streamTransport,onValueChange:e=>u({...l,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(H,{children:Nt.map(e=>(0,Z.jsx)(B,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:kt()})]}),(0,Z.jsx)($,{label:te(),children:(0,Z.jsx)(G,{value:l.gatewayVersion,placeholder:g(),onChange:e=>u({...l,gatewayVersion:e.target.value})})}),l.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:b(),children:[(0,Z.jsxs)(V,{value:l.authMode,onValueChange:e=>u({...l,authMode: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:`token`,children:p()}),(0,Z.jsx)(B,{value:`trusted-proxy`,children:ue()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:l.authMode===`trusted-proxy`?E():ae()})]}),l.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:Qe(),children:(0,Z.jsx)(G,{value:l.systemIdentity,placeholder:i(),onChange:e=>u({...l,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Ce(),children:(0,Z.jsx)(G,{value:l.gatewayHttpUrl,placeholder:ye(),onChange:e=>u({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(an,{instanceName:f,open:f!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ht,{instance:h,onClose:()=>_(null)},h._id):null,y?(0,Z.jsx)(Yt,{instance:y,onClose:()=>x(null)},y._id):null]})}function Yt({instance:e,onClose:t}){let n=D(F.instanceSecrets.listInstanceSecretStatus,{}),r=Kt[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)(Rt,{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:xe({instance:e.displayName??e.name})}),(0,Z.jsx)(J,{children:s()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Qt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Zt,{instance:e})}),(0,Z.jsx)(Xt,{instance:e})]})})}function Xt({instance:e}){let t=M(F.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(Ie());break;case`no_agents`:n.success(wt());break;case`no_bridge_url`:n.error(Me());break;case`deploy_misconfigured`:n.error(Ke());break;case`unauthorized`:n.error(it());break;case`not_served`:n.error(dt());break;default:n.error(Je());break}}catch(e){n.error(Ot(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:We()}),(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?Et():_e()})})]})}function Zt({instance:e}){let t=D(F.bridgeAuth.listBridgeAuthStatus,{}),n=M(F.bridgeAuth.mintBridgeSecret),r=k(F.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(Pe(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(lt())}catch(e){i.error(Pe(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Ve(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:St()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:f?`outline`:`secondary`,children:f?`${x()} · ${d.prefix}…${d.lastFour}`:m()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?ze():nt()}),f?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:vt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Xe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:l?ht():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:P()})]}):null]})}function Qt({instanceId:e,field:t,updatedAt:n}){let r=M(F.instanceSecrets.setInstanceSecret),i=k(F.instanceSecrets.clearInstanceSecret),o=M(F.deviceIdentity.generateDeviceIdentity),s=R(),[c,d]=(0,Y.useState)(``),[p,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),b=n!==null,S=t===`deviceIdentity`,ee=t===`token`?At():t===`deviceIdentity`?he():ne();async function C(){if(!(!c.trim()||p)){h(!0);try{await r({instanceId:e,field:t,plaintext:c}),d(``),_(null),y(!1),s.success(a())}catch(e){s.error(j(),e)}finally{h(!1)}}}async function te(){if(!p){h(!0);try{await i({instanceId:e,field:t}),_(null),y(!1),s.success(ce())}catch(e){s.error(j(),e)}finally{h(!1)}}}async function w(){if(!p){h(!0);try{_(await o({instanceId:e})),y(!1),s.success(ve())}catch(e){s.error(l(),e)}finally{h(!1)}}}let T=g?`openclaw devices approve ${g.id}`:``;async function E(){if(T)try{await navigator.clipboard.writeText(T),y(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:b?`outline`:`secondary`,children:b?x():m()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:b?oe():de(),onChange:e=>d(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void C(),disabled:p||c.trim().length===0,children:re()}),S?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:p,children:u()}):null,b?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:p,children:$e()}):null]})]}),g?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:ve()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Tt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:v?ht():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{_(null),y(!1)},children:P()})]}):null]})}var $t={conversational:w,documentary:we,summarizer:Fe,curator:gt},en={conversational:_,documentary:be,summarizer:Ze,curator:st},tn=e=>($t[e]??(()=>e))(),nn=e=>(en[e]??(()=>``))();function rn({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:Ee()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:nn(e),children:tn(e)},e)),(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Pt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Oe()})}),(0,Z.jsxs)(Bt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:C()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:pt()}),(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)(zt,{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:tn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:nn(r)})]})]},r)})})]})]})]})}function an({instanceName:e,open:t,onOpenChange:n}){let r=D(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=k(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=k(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Gt(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=k(F.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),u=k(F.agents.removeInstanceAgent),d=It(),f=R();async function p(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(O(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(O(),e)}}async function g(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){f.error(O(),e)}}async function _(t,n){if(e&&await d({title:c({name:n}),description:jt(),confirmLabel:ge(),destructive:!0}))try{await u({instanceName:e,agentId:t}),f.success(T())}catch(e){f.error(O(),e)}}return(0,Z.jsx)(Rt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{children:ot({name:e??``})}),(0,Z.jsx)(J,{children:bt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:S()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?h():r.discovery.lastPollOk?fe():se({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(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,s=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(zt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void p(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:o()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void _(t.agentId,a),children:Se()})]}):i?(0,Z.jsx)(z,{variant:`default`,children:A()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:y()})]}),t.enabled?(0,Z.jsx)(rn,{agentId:t.agentId,types:s,onToggle:e=>void g(t.agentId,e,s)}):null,t.enabled?(0,Z.jsx)(on,{value:t.description??``,onSave:async n=>{if(e)try{await l({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(O(),e)}}}):null]},t.agentId)})})]})]})})}function on({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:me(),"aria-label":Ae(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Jt as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,Cl as i,El as a,QO as o,Sl as s,Tl as c,ZO as l,aB as u,ak as d,bl as f,ck as p,ek as m,iB as h,ik as g,lk as _,nB as v,nk as y,ok as b,rk as x,sk as S,t as C,tk as w,uk as T,vl as E,wl as D,xl as O,yl as k}from"./api-CyG2Kb2E.js";import{t as A}from"./button-SxU4iS5M.js";import{Et as j,jt as M,ut as N}from"./index-DWkl2h55.js";var P=t(e(),1),F=n();function I(){let e=u(C.integrations.status.status,{}),t=h(C.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:T()});let s=n,f=(e,t,n)=>i({...s,[e]:{...s[e],[t]:n}}),v=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,F.jsx)(`strong`,{children:p()}),` `,S()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:d()}):(0,F.jsx)(j,{variant:`outline`,children:g()}),note:x(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>v(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:l(),checked:s.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),v(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:d()}):(0,F.jsx)(j,{variant:`outline`,children:g()}),note:y(),children:[(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(M,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>v(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||o(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>v(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:l(),checked:s.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),v(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:d()}):(0,F.jsx)(j,{variant:`outline`,children:a()}),note:c(),children:[(0,F.jsx)(R,{label:D(),children:(0,F.jsx)(M,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>v(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:l(),checked:s.otlp.enabled??!0,onChange:e=>{f(`otlp`,`enabled`,e),v(`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=v(C.integrations.otlpSecret.setOtlpHeaders),n=h(C.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),d=async()=>{u(!0),c(null);try{await t({headersJson:r}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:i(),children:[(0,F.jsx)(M,{value:r,placeholder:e?s():O(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void d(),children:f()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:k()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:E()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ay as r,Cy as i,Dy as a,Ey as o,Fy as s,Gk as c,Ik as l,Iy as u,Kk as d,Lk as f,Ly as ee,My as p,Ny as m,Oy as h,Py as g,Ty as _,Wk as te,aB as v,jy as y,ky as b,qk as x,t as S,vA as C,wy as w}from"./api-CyG2Kb2E.js";import{Gn as T,Kn as E,i as D,o as O,q as ne,r as re}from"./index-DWkl2h55.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-vJtS-_yl.js";import{n as P,t as F}from"./TimeRangePicker-Dx50b9Tc.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=v(S.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=v(S.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:C()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:x()}),(0,z.jsx)(M,{children:c()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[l(),` p50 `,V(s.cP50),` `,d()]}),(0,z.jsxs)(`span`,{children:[f(),` p50 `,V(s.aP50),` `,d()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":x(),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:ee(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:u(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:s(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:g(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:m(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:p(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:y(),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=E({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),i=e=>void t({search:t=>({...t,...O(e)})}),{from:o,to:s}=P(n),{rowLimit:c,buckets:l}=Y(o,s),u=v(S.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,z.jsx)(ae,{value:n,onChange:i})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:o({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:_()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:w({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),a=X/e.length,o=Math.max(a-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":i({max:Q(r),unit:n}),children:e.map((e,i)=>{let s=r>0?e.value/r*(Z-1):0,c=i*a,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:o,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{$E as r,$P as i,AP as a,An as o,Az as s,BP as c,Bz as l,CP as u,Cz as d,DP as f,Dn as p,Dz as m,EP as h,En as g,Ez as ee,FP as te,Fz as ne,GP as re,Gz as ie,HP as ae,Hz as oe,IP as se,Iz as ce,JP as le,KP as ue,Kn as de,LP as fe,Lz as pe,MP as me,Mn as he,Mz as ge,NP as _e,Nn as ve,Nz as _,OP as v,On as y,Oz as b,PP as x,Pz as S,QP as C,RP as w,Rz as T,SP as E,Sz as D,TP as O,Tz as k,UP as A,VP as j,Vn as M,Vz as N,WP as P,XP as F,Xz as ye,YP as be,ZP as xe,_P as Se,aB as I,bP as Ce,bz as we,eF as Te,gP as Ee,hP as De,iB as L,jP as Oe,jn as ke,jz as Ae,kP as je,kn as Me,kz as Ne,qP as Pe,qn as Fe,r as R,t as z,vP as Ie,wP as B,wz as Le,xP as Re,xz as ze,yP as Be,yz as Ve,zP as He,zz as Ue}from"./api-CyG2Kb2E.js";import{t as V}from"./button-SxU4iS5M.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-DWkl2h55.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-DH_5qFyU.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:()=>Te()},{id:`composer`,label:()=>i()},{id:`sidebar`,label:()=>C()},{id:`notifications`,label:()=>te()},{id:`other`,label:()=>xe()}],X={showSource:{category:`messages`,label:()=>F(),help:()=>be()},showReport:{category:`messages`,label:()=>le(),help:()=>Pe()},copyAssistant:{category:`messages`,label:()=>ue()},copyUser:{category:`messages`,label:()=>re()},showDelete:{category:`messages`,label:()=>P()},showTools:{category:`messages`,label:()=>A(),help:()=>ae()},voiceInput:{category:`composer`,label:()=>j(),help:()=>c()},showUsage:{category:`composer`,label:()=>He(),help:()=>w()},autoReadAloud:{category:`composer`,label:()=>Fe(),help:()=>de()},showChatAge:{category:`sidebar`,label:()=>fe(),help:()=>se()},notifSound:{category:`notifications`,label:()=>x(),help:()=>_e()},notifSystem:{category:`notifications`,label:()=>me(),help:()=>Oe()},replySound:{category:`notifications`,label:()=>a(),help:()=>je()}};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:()=>Be()};function ut({prefKey:e,ui:t}){let n=L(z.admin.setUiPrefDefault),r=L(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:u()}),(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:Se()}),(0,J.jsx)(U,{value:`off`,children:Ee()}),(0,J.jsx)(U,{value:`inherit`,children:De()})]})]}),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":E()}),E()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=L(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=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:[ve(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?o():r?ke():he()})]}),(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:g()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?p():e?y():Me()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=I(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=L(z.me.setUiPref).withOptimisticUpdate(Je),c=(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":B()}),B()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Re()}),(0,J.jsx)(`p`,{children:Ce()}),(0,J.jsx)(`p`,{children:Ie()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:v(),"aria-label":v(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:f()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.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:h()}):l?(0,J.jsx)(H,{variant:`secondary`,children:M()}):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:O()}):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:ye()})}var pt={sm:()=>s(),md:()=>Ne(),lg:()=>b(),xl:()=>m(),"2xl":()=>ee(),"3xl":()=>k()};function mt(){let e=I(z.me.getMe,{host:G}),t=L(z.me.setLocale),n=L(z.me.setTimezone),i=L(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=L(z.me.setMyName),o=Ke(),s=e?.locale??`default`,c=e?.name??``,[u,f]=(0,q.useState)(null),p=u??c,m=p.trim()!==c.trim();async function h(){try{await a({name:p}),f(null),o.success(T())}catch(e){o.error(pe(),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:oe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:p,maxLength:120,placeholder:l(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!m,onClick:()=>void h(),children:r()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(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:ne()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ie()})]}),(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:Le()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(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:D()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(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:_()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(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 i({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:we()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$v as i,Av as a,Cv as o,D as s,Dv as c,Ev as l,Fv as u,Gv as d,Hv as f,Iv as p,Lv as m,Mv as h,Nv as g,Ov as ee,Q_ as _,Rv as v,Sv as y,Tv as b,Uv as te,Vv as ne,Wv as re,X_ as x,Xv as ie,Xz as S,Zv as ae,_v as oe,aB as C,ay as se,bv as ce,cv as le,dg as ue,et as de,ev as fe,ey as w,fv as pe,hv as me,iB as T,iv as E,iy as he,jv as ge,kv as _e,mv as ve,nv as D,ov as O,oy as ye,pv as k,qv as A,rv as j,sv as be,t as M,tt as xe,tv as Se,vv as Ce,wv as we,xv as Te,yv as Ee,zv as N}from"./api-CyG2Kb2E.js";import{t as De}from"./list-JGKvhNdi.js";import{t as P}from"./button-SxU4iS5M.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as F,Dt as Me,E as Ne,Ft as Pe,Gn as I,Hn as Fe,It as Ie,J as Le,Kn as Re,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as L,P as We,Pn as Ge,Pt as R,S as Ke,Sn as qe,T as Je,Tn as Ye,U as Xe,W as Ze,Y as Qe,_ as $e,b as z,bn as et,d as tt,dn as nt,f as rt,g as B,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-DWkl2h55.js";var ft=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Y=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":E(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ge,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:i,className:a,onOpen:o}){let s=T(M.projects.renameProject),c=T(M.projects.setProjectColor),l=T(M.projects.moveProject),u=T(M.projects.deleteProject),p=T(M.projects.createProject),m=Xe(),g=Ze(),[ee,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(t),[b,x]=(0,X.useState)(!1),[S,ae]=(0,X.useState)(!1),oe=C(M.projects.projectTreeCount,S?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&ae(!0),children:[(0,Z.jsx)(ht,{className:a}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>o(),children:[(0,Z.jsx)(U,{}),` `,ne()]}),(0,Z.jsxs)(R,{onSelect:()=>{y(t),_(!0)},children:[(0,Z.jsx)(et,{}),` `,j()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await g({title:h(),label:ye(),placeholder:se(),confirmLabel:he()});t&&await p({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,h()]}),(0,Z.jsxs)(R,{onSelect:()=>x(!0),children:[(0,Z.jsx)(pt,{}),` `,ve()]}),(0,Z.jsx)(Pe,{children:fe()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":r(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=oe?.folders??0,r=oe?.chats??0;await m({title:re({name:t}),description:n>0?f({folders:n,chats:r}):r>0?te({count:r}):be(),confirmWord:O(),confirmLabel:d(),destructive:!0})&&await u({projectId:e})})},children:[(0,Z.jsx)(nt,{}),` `,O()]})]})]}),(0,Z.jsx)($e,{open:ee,onOpenChange:_,title:ie(),canSubmit:v.trim().length>0,onSubmit:async()=>{await s({projectId:e,name:v.trim()}),_(!1)},submitLabel:j(),children:(0,Z.jsx)(W,{value:v,onChange:e=>y(e.target.value),autoFocus:!0})}),b?(0,Z.jsx)(ot,{open:b,onOpenChange:x,title:pe(),movingFolderId:e,currentId:i,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=T(M.chats.pinChat),i=T(M.chats.deleteChat),a=T(M.chats.renameChat),o=T(M.chats.setChatSidebar),s=T(M.chats.moveChatToProject),c=Xe(),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(e.title??``),[p,m]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{f(e.title??``),u(!0)},children:[(0,Z.jsx)(et,{}),` `,j()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?D():Se()]}),(0,Z.jsxs)(R,{onSelect:()=>m(!0),children:[(0,Z.jsx)(pt,{}),` `,me()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{}),e.inSidebar?v():N()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:_(),description:be(),confirmLabel:O(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(nt,{}),` `,O()]})]})]}),(0,Z.jsx)($e,{open:l,onOpenChange:u,title:x(),canSubmit:d.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:d.trim()}),u(!1)},submitLabel:j(),children:(0,Z.jsx)(W,{value:d,onChange:e=>f(e.target.value),autoFocus:!0})}),p?(0,Z.jsx)(ot,{open:p,onOpenChange:m,title:k(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=st({from:`/project/$projectId`}),t=I(),n=C(M.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:ce()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:Ee()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:Ce()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=I(),n=Xe(),i=Ze(),a=Me(),s=T(M.projects.renameProject),l=T(M.projects.setProjectColor),_=T(M.projects.deleteProject),v=T(M.projects.createProject),b=T(M.projects.moveProject),ne=T(M.projects.setProjectSidebar),x=T(M.chats.moveChatToProject),S=T(M.chats.reorderChat),ce=T(M.projects.reorderProject),me=C(M.projects.projectTreeCount,{projectId:e.project._id}),[E,ge]=(0,X.useState)(xt),D=e=>{localStorage.setItem(bt,e),ge(e)},k=C(M.projects.folderColumns,E===`columns`?{projectId:e.project._id}:`skip`),A=C(M.projects.projectTreeList,E===`list`?{projectId:e.project._id}:`skip`),{c:Se}=Re({from:`/project/$projectId`}),Ce=C(M.projects.listProjects,{}),Ee=C(M.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(Ee??[]),[Ee]),Ae=C(M.chatReads.myChatReads,{}),Fe=(0,X.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:L,picker:qe}=tt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,rt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=C(M.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Oe(it(lt,{activationConstraint:{distance:4}}),it(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=k?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||w()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(Ce??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:Ne(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(E===`columns`){for(let e of k?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(E===`list`){let e=A?.chats.find(e=>e._id===t);return e?{list:A.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(E===`columns`){for(let e of k?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(E===`list`){let e=A?.folders.find(e=>e._id===t);if(!e||!A)return null;let n=e.parentId??A.rootId;return{list:Qe(A.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),o=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(o)await x({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(Ce??[],t,e)){a.error(g());return}await b({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await x({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await S({chatId:e,...a});return}if(!o&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Le(Ce??[],e,n.parentId)){a.error(g());return}await b({projectId:e,parentId:n.parentId})}let o=vt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await ce({projectId:e,...o});return}}catch{a.error(g())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=B(e.project),Bt=_t(e.chats,z),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":oe(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:xe(),onClick:()=>{ne({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(He,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:de()}),(0,Z.jsx)(Be,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":m(),children:[(0,Z.jsx)(P,{variant:E===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":m(),title:m(),"aria-pressed":E===`cards`,onClick:()=>D(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:E===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":p(),title:p(),"aria-pressed":E===`columns`,onClick:()=>D(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:E===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":u(),title:u(),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:(0,Z.jsx)(De,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Ye,{}),c()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:h(),label:ye(),placeholder:se(),confirmLabel:he()});t&&await v({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),h()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":ae(),children:(0,Z.jsx)(Ge,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)(et,{}),` `,j()]}),(0,Z.jsxs)(R,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,ve()]}),(0,Z.jsx)(Pe,{children:fe()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e.project._id,color:null}),"aria-label":r(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=me?.folders??0,a=me?.chats??0;await n({title:re({name:e.project.name}),description:i>0?f({folders:i,chats:a}):a>0?te({count:a}):be(),confirmWord:O(),confirmLabel:d(),destructive:!0})&&(await _({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(nt,{}),` `,O()]})]})]})]})]}),E===`columns`?(0,Z.jsx)(Ft,{data:k,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:Se??null}):E===`list`?(0,Z.jsx)(Mt,{data:A,busyIds:N,suppressClick:$,locateChatId:Se??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:_e()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),e.chats.length>0?(0,Z.jsx)(W,{value:z,onChange:e=>rt(e.target.value),placeholder:we(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?y():Te()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:o({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:N.has(t._id),unread:Fe.has(t._id),locate:t._id===Se,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:le()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:o({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ue()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:ie(),canSubmit:U.trim().length>0,onSubmit:async()=>{await s({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:j(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:pe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void b({projectId:e.project._id,parentId:t})}):null,qe]}),(0,Z.jsx)(je,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=I(),a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?l({count:e.folderCount})+` · `:``,b({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:rt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=T(M.chats.setChatSidebar),n=e.inSidebar?v():N();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:a,locate:o,suppressClick:s}){let c=I(),l=V(e.color),u=z({id:`chat:${e._id}`}),d=jt(o);return(0,Z.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(o?` is-locate`:``),style:{transform:H.Transform.toString(u.transform),transition:u.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{s.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||w()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:rt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:i(),"aria-label":i()}):null,a&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:A(),"aria-label":A()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:S()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=Qe(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:y()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:o,children:s}){let c=I(),l=z({id:`folder:${e._id}`}),u=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{l.setNodeRef(e),u.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(u.isOver?` is-over`:``)+(l.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":B(e),transform:H.Transform.toString(l.transform),transition:l.transition},...l.listeners,...l.attributes,role:`button`,tabIndex:0,onClick:()=>{o.current||c({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&c({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?ge():a(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!o.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Ae,{size:13}):(0,Z.jsx)(Fe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void c({to:`/project/$projectId`,params:{projectId:e._id}})})]}),s]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=I(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||w()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=I(),s=L({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:Te()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||w()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ai as i,Cx as a,Mi as o,Qb as s,Z as c,Zb as l,_o as u,aB as d,ax as f,bo as p,cc as m,co as h,cx as g,dx as _,ex as v,fx as y,gx as ee,hx as te,iB as ne,ix as b,ji as x,lc as S,lo as C,lx as w,mx as T,nx as E,oc as re,oo as ie,ox as ae,px as oe,rx as se,sc as D,so as O,sx as k,t as A,tx as j,uc as M,uo as N,ux as P,vo as F,wx as I,yo as L}from"./api-CyG2Kb2E.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-BNwSIo5u.js";import{t as H}from"./button-SxU4iS5M.js";import{$ as U,Dt as W,Q as G,Qt as ce,X as K,Xt as le,Yt as q,Z as J,Zt as ue,et as Y,q as de,ut as fe}from"./index-DWkl2h55.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:_,help:P},documentary_fetch:{label:w,help:g},inbound_files:{label:k,help:ae},history_summary:{label:M,help:S},file_curation:{label:p,help:N},quote_reply:{label:L,help:F}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
-
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
-
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
-
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:r,references:s,files:l,previous_summary:m,new_messages:D,max_chars:re,file_name:C,budget_chars:h,feedback:O,content:ie,excerpt:u};function _e(){let e=d(A.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(z,{label:ee(),help:te()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:f()}),(0,$.jsxs)(K,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(J,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=ne(A.admin.upsertInstanceConfig),n=W(),r=d(A.me.getMe,{host:de}),s=e.config??{},c=X(e.config?.contentLocale,r?.defaultLocale??void 0),[l,u]=(0,Q.useState)(()=>R(s,c));(0,Q.useEffect)(()=>{u(R(s,c))},[c,e._id]);let[f,p]=(0,Q.useState)(!1),m=l.promptInjections,h=(e,t)=>u({...l,promptInjections:{...m,[e]:{...m[e],...t}}});async function g(){p(!0);try{await t({instanceId:e._id,config:B(l,s,c)})}catch(e){n.error(a(),e)}finally{p(!1)}}async function _(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(a(),e)}}let v=e.config?.contentLocale??`default`,y=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:o()}),(0,$.jsxs)(K,{value:v,onValueChange:e=>void _(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(J,{children:[(0,$.jsx)(G,{value:`default`,children:i({locale:y})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:m[e]??{enabled:!0,template:q[e].defaultTemplate[c]},contentLocale:c,onChange:t=>h(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void g(),disabled:f,children:I()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=ue(e,r,i),p=f?ce(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(fe,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:oe()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:y()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?E():se()}),l&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:T()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:j()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:c()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:v()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as ee,Dw as a,Ew as o,Gw as s,Hw as c,Jw as l,Kw as u,Mw as d,Nw as f,Ow as p,Qw as m,Tw as h,Uw as te,Vw as ne,Wo as g,Ww as re,Xw as _,Yw as v,Zw as y,aB as b,aT as x,cT as S,dT as C,eT as ie,fT as w,iB as T,iT as E,jw as D,kw as O,lT as k,mT as A,nT as j,oT as M,pT as N,qw as P,rT as F,sT as I,t as L,tT as R,uT as z,zw as ae}from"./api-CyG2Kb2E.js";import{t as B}from"./button-SxU4iS5M.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-DWkl2h55.js";import{t as J}from"./roleDescriptions-B9SjwOYY.js";var Y=t(e(),1),X=n(),Z=[{group:()=>A(),keys:[{key:`traces.read`,label:()=>k()},{key:`traces.read.content`,label:()=>S(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>N(),keys:[{key:`kpi.read`,label:()=>k()},{key:`kpi.write`,label:()=>I()}]},{group:()=>w(),keys:[{key:`openclaw.query`,label:()=>M()},{key:`anomalies.read`,label:()=>x()},{key:`anomalies.report`,label:()=>E()}]},{group:()=>C(),keys:[{key:`chats.read`,label:()=>k()},{key:`selfheal`,label:()=>j()},{key:`feedback.respond`,label:()=>g()}]},{group:()=>z(),keys:[{key:`admin.manage`,label:()=>F()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=b(L.apiKeys.listRoles,{}),t=T(L.apiKeys.createRole),n=T(L.apiKeys.ensureRolesSeeded),g=T(L.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(L.apiKeys.listRoles,{});r&&e.setQuery(L.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),x=W(),S=V(),[C,w]=(0,Y.useState)(!1),[E,k]=(0,Y.useState)($),[A,j]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{S.error(ie(),e)})},[n,S]);let M=e??[];async function N(e,t){if(Q(e.permissions))return;if(e.builtin){await x({title:r({name:e.name}),description:m(),confirmLabel:y()});return}if(A.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];j(t=>new Set(t).add(e._id));try{await g({roleId:e._id,permissions:n})}catch(e){S.error(_(),e)}finally{j(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function F(){try{await t({key:E.key,name:E.name,description:E.description||void 0,permissions:[]}),k($),w(!1)}catch(e){S.error(v(),e)}}let I=e===void 0,z=!I&&M.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,P(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,u()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:s()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{k($),w(!0)},children:re()})})]}),I?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ne()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?R({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:M.map(e=>{let t=Q(e.permissions),n=A.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,ee()]}):(0,X.jsx)(U,{variant:`secondary`,children:ae()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?f():n?d():r,onCheckedChange:()=>void N(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:C,onOpenChange:w,title:D(),description:i(),canSubmit:!!(E.key&&E.name),onSubmit:F,submitLabel:O(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,X.jsx)(K,{value:E.key,placeholder:a(),onChange:e=>k({...E,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,X.jsx)(K,{value:E.name,onChange:e=>k({...E,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,X.jsx)(K,{value:E.description,onChange:e=>k({...E,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|