@lacneu/atrium 0.91.4 → 0.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-CtjTuJS1.js → AccessTab-e1oO1Kpt.js} +1 -1
- package/dist/assets/{AdvancedFilter-BFXkHS7k.js → AdvancedFilter-C5uNd2Bh.js} +1 -1
- package/dist/assets/AgentFilesTab-CVPwLabk.js +3 -0
- package/dist/assets/AnomaliesTab-CMpr27cm.js +1 -0
- package/dist/assets/AuditTab-DnmCZyK0.js +1 -0
- package/dist/assets/BridgeTab-jBNctrlU.js +1 -0
- package/dist/assets/ChatDefaultsTab-B1R8mNGT.js +1 -0
- package/dist/assets/{DataTableShell-7VOYauXM.js → DataTableShell-DwnJt663.js} +1 -1
- package/dist/assets/DeletedChatsTab-CUYou45F.js +1 -0
- package/dist/assets/{DetailChips-DxxeU-mf.js → DetailChips-Bqvq37y3.js} +1 -1
- package/dist/assets/FeedbacksTab-kXnXbbVP.js +1 -0
- package/dist/assets/FieldLabel-By4I98vO.js +1 -0
- package/dist/assets/FilesTab-KT8K2maS.js +1 -0
- package/dist/assets/{FilterBar-B0W1nP3i.js → FilterBar-CF8kYMRM.js} +1 -1
- package/dist/assets/GroupsTab-DSSQpFHq.js +1 -0
- package/dist/assets/InstancesTab-B1Y94Uie.js +1 -0
- package/dist/assets/IntegrationsTab-TSHIMAL3.js +1 -0
- package/dist/assets/KpiTab-togCNUmK.js +1 -0
- package/dist/assets/PreferencesTab-1S_si1gy.js +1 -0
- package/dist/assets/ProjectPage-B9JozdRF.js +1 -0
- package/dist/assets/PromptInjectionsTab-CghQSVr3.js +4 -0
- package/dist/assets/RolesTab-3XteVLq6.js +1 -0
- package/dist/assets/ScheduledTab-DrVTzZOx.js +1 -0
- package/dist/assets/ServiceAccountsTab-D05m7KHe.js +1 -0
- package/dist/assets/{SubAgentReportsTab-Jf1zcgs0.js → SubAgentReportsTab-CVjHV3k3.js} +1 -1
- package/dist/assets/ThemeShowroom-ClbTxkxV.js +1 -0
- package/dist/assets/{TimeRangePicker-BgJKavXM.js → TimeRangePicker-CJYL4VHt.js} +1 -1
- package/dist/assets/{TimezoneCombobox-BkDGMdB2.js → TimezoneCombobox-aXaP7rD1.js} +1 -1
- package/dist/assets/TracesTab-BK8h5goK.js +1 -0
- package/dist/assets/TrashTab-DGhhw1nk.js +1 -0
- package/dist/assets/UsersTab-DTJ_fACy.js +1 -0
- package/dist/assets/VoiceTab-3l8kseDh.js +1 -0
- package/dist/assets/api-Da6_RPKW.js +44 -0
- package/dist/assets/{button-DgaBsJDX.js → button-DezjmYbu.js} +1 -1
- package/dist/assets/{card-DnOLp6jN.js → card-BAJ3t3W_.js} +1 -1
- package/dist/assets/chevrons-up-down-BJ8yWoBT.js +1 -0
- package/dist/assets/compatView-Dvj8v6B1.js +1 -0
- package/dist/assets/dispatchErrorInfo-CMB-D8cW.js +1 -0
- package/dist/assets/{dist-BFXL2p5c.js → dist-Bc12EMPB.js} +1 -1
- package/dist/assets/{dist-DHnmL-lz.js → dist-ByQjzb4c.js} +1 -1
- package/dist/assets/{dist-D96qX4Zd.js → dist-C5rZMbyx.js} +1 -1
- package/dist/assets/{dist-CYBhnY4b.js → dist-Dr_uf2Zj.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CJ8J6p8l.js → highlighted-body-OFNGDK62-VwnHPenC.js} +1 -1
- package/dist/assets/index-BcCFgPG0.js +446 -0
- package/dist/assets/index-FQ76yiuA.css +1 -0
- package/dist/assets/{list-CKshqcfm.js → list-ZFvO2UcJ.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-D9U6tQ7N.js +1 -0
- package/dist/assets/{pdf-DeAT0bfe.js → pdf-Bd95xs3Y.js} +1 -1
- package/dist/assets/roleDescriptions-m4nebceN.js +1 -0
- package/dist/assets/{table-A3AeBsY1.js → table-CFBr2AAN.js} +1 -1
- package/dist/assets/trashPage-BqqZxj7Y.js +1 -0
- package/dist/assets/trashPage-DfKyy5ga.css +1 -0
- package/dist/assets/{use_paginated_query-Dc9YWxua.js → use_paginated_query-DudXPi-Q.js} +1 -1
- package/dist/assets/x-jEbKIC4W.js +1 -0
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-EIaok7Cs.js +0 -3
- package/dist/assets/AnomaliesTab-D1h-Tspq.js +0 -1
- package/dist/assets/AuditTab-CEji-XO8.js +0 -1
- package/dist/assets/BridgeTab-Bs8cvrzB.js +0 -1
- package/dist/assets/ChatDefaultsTab-B76_pV-a.js +0 -1
- package/dist/assets/FeedbacksTab-CQJddboV.js +0 -1
- package/dist/assets/FieldLabel-CZ-m3Yh8.js +0 -1
- package/dist/assets/FilesTab-BLVuhYUu.js +0 -1
- package/dist/assets/GroupsTab-eCgjhSeI.js +0 -1
- package/dist/assets/InstancesTab-C9knJ9ku.js +0 -1
- package/dist/assets/IntegrationsTab-GG79wWrt.js +0 -1
- package/dist/assets/KpiTab-BVMR3rMZ.js +0 -1
- package/dist/assets/PreferencesTab-DOEuFzay.js +0 -1
- package/dist/assets/ProjectPage-CVpssY-3.js +0 -1
- package/dist/assets/PromptInjectionsTab-Dbp3yLMc.js +0 -4
- package/dist/assets/RolesTab-CFa0qonh.js +0 -1
- package/dist/assets/ScheduledTab-QgcyWf16.js +0 -1
- package/dist/assets/ServiceAccountsTab-X_bQzXIS.js +0 -1
- package/dist/assets/ThemeShowroom-DCxA68bn.js +0 -1
- package/dist/assets/TracesTab-Bzw8y55N.js +0 -1
- package/dist/assets/TrashPage-DBE3OVMc.css +0 -1
- package/dist/assets/TrashPage-YhpHdmVr.js +0 -1
- package/dist/assets/TrashTab-BuQ50Qu2.js +0 -1
- package/dist/assets/UsersTab-zHZZ8QUo.js +0 -1
- package/dist/assets/VoiceTab-IEStNr9Y.js +0 -1
- package/dist/assets/api-DcB3BxUc.js +0 -44
- package/dist/assets/chevrons-up-down-R0Y7ndDn.js +0 -1
- package/dist/assets/compatView-Cyz2oaDo.js +0 -1
- package/dist/assets/dispatchErrorInfo-ALhveHh9.js +0 -1
- package/dist/assets/index-Ds-ybIOh.js +0 -446
- package/dist/assets/index-qA0SteHp.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-lChj9izi.js +0 -1
- package/dist/assets/roleDescriptions-DHMAPGYx.js +0 -1
- package/dist/assets/x-DJcI0sFP.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$M as e,QM as t,ZM as n,eN as r,tN as i}from"./api-Da6_RPKW.js";var a={pending:i,user:r,admin:e,observer:t,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-Da6_RPKW.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{aE as t,cE as n,eE as r,hD as i,iE as a,lE as o,oE as s,sE as c}from"./api-Da6_RPKW.js";import{t as l}from"./button-DezjmYbu.js";import{An as u,In as d,ct as f,kt as p,m}from"./index-BcCFgPG0.js";var h=e();function g({status:e,loadMore:t}){return e!==`CanLoadMore`&&e!==`LoadingMore`?null:(0,h.jsx)(l,{variant:`outline`,size:`sm`,className:`self-start`,disabled:e===`LoadingMore`,onClick:()=>t(50),children:r()})}function _({items:e,onRestore:r,onPurge:g}){let _=f();return(0,h.jsx)(`ul`,{className:`oc-trash__list`,children:e.map(e=>(0,h.jsxs)(`li`,{className:`oc-trash__item`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__meta`,children:[(0,h.jsx)(`span`,{className:`oc-trash__title`,children:e.title||i()}),(0,h.jsxs)(`span`,{className:`oc-trash__dates`,children:[e.owner===void 0?null:(0,h.jsxs)(`span`,{className:`oc-trash__owner`,children:[e.owner,` · `]}),o({date:p(e.trashedAt)}),e.purgeAfter===null?null:` · ${n({date:m(e.purgeAfter)})}`]})]}),(0,h.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,h.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>void r(e._id),children:[(0,h.jsx)(d,{}),` `,c()]}),(0,h.jsxs)(l,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:async()=>{await _({title:t(),description:a(),confirmLabel:s(),destructive:!0})&&await g(e._id)},children:[(0,h.jsx)(u,{}),` `,s()]})]})]},e._id))})}export{g as n,_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.oc-trash__body{flex-direction:column;gap:16px;max-width:860px;margin:0 auto;display:flex}.oc-trash__head{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;display:flex}.oc-trash__hint,.oc-trash__empty{color:var(--muted-foreground);margin:0;font-size:.85rem}.oc-trash__list{border:1px solid var(--border);border-radius:var(--radius-lg,.75rem);flex-direction:column;margin:0;padding:0;list-style:none;display:flex;overflow:hidden}.oc-trash__item{border-bottom:1px solid var(--border);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;display:flex}.oc-trash__item:last-child{border-bottom:0}.oc-trash__meta{flex-direction:column;flex:240px;gap:2px;min-width:0;display:flex}.oc-trash__title{text-overflow:ellipsis;white-space:nowrap;font-weight:500;overflow:hidden}.oc-trash__dates{color:var(--muted-foreground);font-size:.8rem}.oc-trash__owner{color:var(--foreground)}.oc-trash__actions{flex-shrink:0;gap:6px;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t}from"./bundle-mjs-C73ZY4La.js";import{LY as n,VY as r,WY as i,YY as a,ZY as o}from"./api-Da6_RPKW.js";var s=t(e(),1),c=(e,t,n)=>r=>{let i={...r.queries},a=r.nextPageKey,o=r.nextPageKey+1,s=r.nextPageKey+2;i[a]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,endCursor:t}}},i[o]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,cursor:t,endCursor:n}}};let c={...r.ongoingSplits};return c[e]=[a,o],{...r,nextPageKey:s,queries:i,ongoingSplits:c}},l=e=>t=>{let n=t.ongoingSplits[e];if(n===void 0)return t;let r={...t.queries};delete r[e];let i={...t.ongoingSplits};delete i[e];let a=t.pageKeys.slice(),o=t.pageKeys.findIndex(t=>t===e);return o>=0&&(a=[...t.pageKeys.slice(0,o),...n,...t.pageKeys.slice(o+1)]),{...t,queries:r,pageKeys:a,ongoingSplits:i}};function u(e,t,n){let{user:r}=p(e,t,n,!0);return r}var d=Symbol(`includePageKeys`),f=Symbol(`page`);function p(e,t,u,p=!0){if(typeof u?.initialNumItems!=`number`||u.initialNumItems<0)throw Error(`\`options.initialNumItems\` must be a positive number. Received \`${u?.initialNumItems}\`.`);let m=t===`skip`,g=m?{}:t,_=i(e),v=(0,s.useMemo)(()=>()=>{let t=h();return{query:e,args:g,id:t,nextPageKey:1,pageKeys:m?[]:[0],queries:m?{}:{0:{query:e,args:{...g,paginationOpts:{numItems:u.initialNumItems,cursor:null,id:t}}}},ongoingSplits:{},skip:m}},[JSON.stringify(o(g)),_,u.initialNumItems,m]),[y,b]=(0,s.useState)(v),x=y;(i(e)!==i(y.query)||JSON.stringify(o(g))!==JSON.stringify(o(y.args))||m!==y.skip)&&(x=v(),b(x));let S=r().logger,C=n(x.queries),w=u[d]??!1,[T,E,D]=(0,s.useMemo)(()=>{let e,t=[];for(let n of x.pageKeys){if(e=C[n],e===void 0)break;if(e instanceof Error){if(e.message.includes(`InvalidCursor`)||e instanceof a&&typeof e.data==`object`&&e.data?.isConvexSystemError===!0&&e.data?.paginationError===`InvalidCursor`)return S.warn(`usePaginatedQuery hit error, resetting pagination state: `+e.message),b(v),[[],void 0,void 0];if(p)throw e;return[t,void 0,e]}let r=x.ongoingSplits[n];if(r===void 0?e.splitCursor&&(e.pageStatus===`SplitRecommended`||e.pageStatus===`SplitRequired`||e.page.length>u.initialNumItems*2)&&b(c(n,e.splitCursor,e.continueCursor)):C[r[0]]!==void 0&&C[r[1]]!==void 0&&b(l(n)),e.pageStatus===`SplitRequired`)return[t,void 0,void 0];t.push(...w?e.page.map(e=>({...e,[f]:n.toString()})):e.page)}return[t,e,void 0]},[C,x.pageKeys,x.ongoingSplits,u.initialNumItems,v,S,w,p]);return{user:{results:T,...(0,s.useMemo)(()=>{if(D!==void 0)return{status:`Error`,isLoading:!1,error:D,loadMore:()=>{}};if(E===void 0)return x.nextPageKey===1?{status:`LoadingFirstPage`,isLoading:!0,loadMore:()=>{}}:{status:`LoadingMore`,isLoading:!0,loadMore:e=>{}};if(E.isDone)return{status:`Exhausted`,isLoading:!1,loadMore:e=>{}};let e=E.continueCursor,t=!1;return{status:`CanLoadMore`,isLoading:!1,loadMore:n=>{t||(t=!0,b(t=>{let r=[...t.pageKeys,t.nextPageKey],i={...t.queries};return i[t.nextPageKey]={query:t.query,args:{...t.args,paginationOpts:{numItems:n,cursor:e,id:t.id}}},{...t,nextPageKey:t.nextPageKey+1,pageKeys:r,queries:i}}))}}},[D,E,x.nextPageKey])},internal:{state:x}}}var m=0;function h(){return m++,m}export{u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e}from"./api-Da6_RPKW.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,16 +62,16 @@
|
|
|
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-BcCFgPG0.js"></script>
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
74
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-Da6_RPKW.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-ByQjzb4c.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Bc12EMPB.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-C5rZMbyx.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Dr_uf2Zj.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/x-jEbKIC4W.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/button-DezjmYbu.js">
|
|
74
|
+
<link rel="stylesheet" crossorigin href="/assets/index-FQ76yiuA.css">
|
|
75
75
|
</head>
|
|
76
76
|
<body>
|
|
77
77
|
<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.93.0",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,A_ as i,Ad as a,BY as o,C_ as s,D_ as c,E_ as l,F_ as u,Fd as d,HB as f,M_ as p,Md as m,NY as ee,N_ as h,Nd as g,O_ as _,P_ as v,Pd as y,Qd as b,RY as x,S_ as S,T_ as C,VY as w,Zd as T,__ as E,_f as D,af as O,b_ as te,c_ as k,cf as A,d_ as j,df as M,ef as N,f_ as P,ff as F,g_ as I,gf as L,h_ as ne,hf as R,if as z,jY as B,j_ as re,jd as V,k_ as ie,kd as H,l_ as ae,lf as oe,m_ as U,mf as se,nf as W,o_ as ce,of as le,p_ as ue,pf as de,rf as fe,s_ as pe,sf as me,ss as he,t as G,tf as ge,u_ as _e,uf as ve,v_ as ye,w_ as be,x_ as xe,xv as K,y_ as Se,yv as Ce}from"./api-DcB3BxUc.js";import{t as q}from"./button-DgaBsJDX.js";import{Bt as we,Ct as Te,Dt as Ee,Gt as De,Ht as Oe,Jt as ke,Kt as Ae,Ot as je,St as Me,Tt as Ne,Ut as Pe,Vt as Fe,Wt as Ie,Yt as J,bt as Le,ft as Re,kn as Y,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-Ds-ybIOh.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-Cyz2oaDo.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
-
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
-
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=w(G.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=w(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[t,r,a]);let d=w(G.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),f=w(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||d===void 0?r!==void 0&&r.length===0?[]:void 0:d.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,d,r,f]),[g,y]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!g||!m.some(e=>$(e)===g))&&y($(m[0]))},[m,g]);let b=m?.find(e=>$(e)===g)??null,S=x(G.agentFiles.listAgentFiles),[T,E]=(0,X.useState)({status:`idle`}),D=b?.instanceName??null,O=b?.agentId??null,te=w(G.compat.forInstance,n&&D!==null?{instanceName:D}:`skip`),k=n&&D!==null?ze(te,`agentFiles`):null,A=k===null?!1:k===`loading`?null:k.blocked,j=(0,X.useCallback)(async()=>{if(!(D===null||O===null)){E({status:`loading`});try{E({status:`done`,files:(await S({instanceName:D,agentId:O})).files})}catch(e){E({status:`error`,dashboardAbsent:tt(e)})}}},[S,D,O]);(0,X.useEffect)(()=>{A===!1&&j()},[j,A]);let[M,N]=(0,X.useState)(null),P=w(G.agentFileCuration.listCurations,t&&D!==null&&O!==null?{instanceName:D,agentId:O}:`skip`),I=w(G.agentFileCuration.curationSettings,t&&D!==null?{instanceName:D}:`skip`),L=x(G.agentFileCuration.requestCuration),[ne,R]=(0,X.useState)(null),[z,V]=(0,X.useState)(null),{toast:H}=J(),ae=(0,X.useMemo)(()=>{let e=new Map;for(let t of P??[])e.has(t.name)||e.set(t.name,t);return e},[P]),oe=(0,X.useCallback)(async e=>{if(!(D===null||O===null)){R(e);try{let t=await L({instanceName:D,agentId:O,name:e,trigger:`manual`});t.ok?H({title:se(),variant:`success`}):H({title:de({reason:t.reason??`unknown`}),variant:`error`})}catch{H({title:F(),variant:`error`})}finally{R(null)}}},[L,D,O,H]),U=ee(),W=(0,X.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ve,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":v(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:(r??[]).map(e=>(0,Q.jsx)(Le,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(Ve,{value:g??``,onValueChange:e=>y(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":h(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:m.map(e=>(0,Q.jsx)(Le,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}),b===null?null:k===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):k!==null&&k.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(k.gatewayVersion,k.provider)]}):T.status===`loading`||T.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):T.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[T.dashboardAbsent?he():i(),` `,!T.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:Ce()})]}):T.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:T.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)(ke,{variant:`outline`,children:ie()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:_({size:Z(e.size,U)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:c({pct:W.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":l()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?be():s()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:I?.budgetChars??null,enabled:I?.enabled??!1,curation:ae.get(e.name)??null,inFlight:ne===e.name,onCurate:()=>void oe(e.name),onReview:e=>V(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:C({used:Z(Qe(T.files),U),total:Z(Ye,U),pct:W.format(Ze(Qe(T.files)))})})]}),M&&b?(0,Q.jsx)(at,{instanceName:b.instanceName,agentId:b.agentId,name:M.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void j()}):null,z?(0,Q.jsx)(ot,{curationId:z,onClose:()=>V(null),onApplied:()=>{V(null),j()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:L()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:R()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:D()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=x(G.agentFiles.getAgentFile),s=x(G.agentFiles.setAgentFile),c=J(),[l,u]=(0,X.useState)(null),[d,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(!1),[b,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!1),D=(0,X.useCallback)(async r=>{p(!1);try{let i=await o({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||h(i.content),C(!1)}catch{p(!0)}},[o,e,t,n]);(0,X.useEffect)(()=>{D(!1)},[D]);async function O(){if(l!==null){y(!0),T(!1);try{await s({instanceName:e,agentId:t,name:n,content:m,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(I({name:n})),a(),await D(!1)}catch(e){nt(e)?C(!0):T(!0)}finally{y(!1)}}}let A=l!==null&&m!==l.content,M=(0,X.useMemo)(()=>l===null?null:et(l.content,m),[l,m]),N=m.length>Je,F=ee(),L=(0,X.useMemo)(()=>new Intl.NumberFormat(F),[F]);return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(He,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:S({name:n})}),(0,Q.jsxs)(Ne,{children:[xe({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,te()]})]})]}),d?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[U(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:Ce()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:m,readOnly:!r,spellCheck:!1,onChange:e=>h(e.target.value),"aria-label":S({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:Se()}),b?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ue(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:P()})]}):null,w?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:ne()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:ye({count:L.format(m.length),max:L.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!A||v||b,onClick:()=>_(!0),children:v?K():E()}):null]})]}),(0,Q.jsx)(we,{open:g,onOpenChange:_,children:(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Be,{children:j({name:n})}),(0,Q.jsx)(Ie,{children:_e({agent:t})})]}),M?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ae({added:M.added,removed:M.removed})}),M.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:k()}),M.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,M.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:pe()}),M.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)(Oe,{children:f()}),(0,Q.jsx)(Fe,{onClick:()=>void O(),children:ce()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=w(G.agentFileCuration.getProposal,{curationId:e}),s=x(G.agentFileCuration.approveCuration),c=o(G.agentFileCuration.rejectCuration),{toast:l}=J(),[u,f]=(0,X.useState)(null),[p,h]=(0,X.useState)(!1),[_,v]=(0,X.useState)(``),S=ee(),C=(0,X.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function E(){f(`approve`);try{let t=await s({curationId:e});t.ok?(l({title:M(),variant:`success`}),n()):l({title:t.reason===`conflict`?oe():A({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:F(),variant:`error`})}finally{f(null)}}async function D(n){f(`reject`);try{let r=_.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?a():ve(),variant:`success`}):l({title:O(),variant:`error`}),t()}catch{l({title:F(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(He,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:i?me({name:i.name}):B()}),(0,Q.jsx)(Ne,{children:le()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[z({before:Z(i.beforeSize,S),after:Z(i.proposedSize,S)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,fe()]}):null]}),C?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:W({added:C.added,removed:C.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:H({feedback:i.feedback})}):null,C&&C.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:T()}),(0,Q.jsx)(`ul`,{children:C.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:b()}),(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:ge()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:d()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:y(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>h(!1),disabled:u!==null,children:g()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void D(!1),disabled:u!==null,children:u===`reject`?K():m()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void D(!0),disabled:u!==null,children:u===`reject`?K():V()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>h(!0),disabled:u!==null||i==null,children:N()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void E(),disabled:u!==null||i==null,children:u===`approve`?K():r()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,AM as i,BY as ee,CM as te,DM as a,EM as ne,FM as re,Gj as o,IM as ie,Jj as s,Kj as c,LM as l,MM as ae,NM as oe,OM as se,PM as ce,Qj as le,RM as u,SM as ue,TM as de,VY as d,Wj as f,Xj as p,Yj as m,Zj as h,_M as fe,aM as g,bM as pe,cM as me,dM as _,eM as he,fM as ge,gM as v,hM as _e,iM as ve,jM as ye,kM as be,lM as y,mM as xe,nM as Se,oM as Ce,pM as we,qj as b,rM as x,sM as S,t as C,tM as w,uM as T,vM as E,wM as D,xM as O,yM as k,zM as A}from"./api-DcB3BxUc.js";import{At as j,Ct as M,Dt as N,Jt as P,Ot as F,St as I,Yt as Te,bt as L,ct as Ee,dr as R,fr as De,ft as z,i as Oe,o as ke,vt as B,wt as V,xt as H,yt as U}from"./index-Ds-ybIOh.js";import{n as Ae}from"./TimeRangePicker-BgJKavXM.js";import{t as je}from"./FilterBar-B0W1nP3i.js";import{t as Me}from"./DataTableShell-7VOYauXM.js";import{t as W}from"./dispatchErrorInfo-ALhveHh9.js";var G=t(e(),1),K=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),q=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function J(e){let t=q.has(e.kind);if(!K.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var Y=n(),X=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?A():e===`acknowledged`?u():l()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=De({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,o=e.status===Z?X:e.status,s=e.severity??X,c=e.kind??X,[l,u]=(0,G.useState)(X),f=Oe(e.from,e.to),{from:p,to:m}=Ae(f),h=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),b=e=>void t({search:t=>({...t,status:e===X?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===X?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===X?void 0:e})}),N=e=>void t({search:t=>({...t,...ke(e)})}),F=Ee(),V=Te(),W=ee(C.anomalies.resolveAnomaly),K=(d(C.me.getMe,{host:z})?.permissions??[]).includes(`admin.manage`),q=d(C.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:p,to:m,anomalyStatus:o===X?void 0:o,severity:s===X?void 0:s,source:l===X?void 0:l,kind:c===X?void 0:c}}),J=(0,G.useMemo)(()=>{let e=new Set;for(let t of q??[])e.add(t.kind);return[...e].sort()},[q]),Q=n!==``||o!==`open`||s!==X||l!==X||c!==X||f.kind!==`relative`||f.from!==Le.from;function $(){u(X),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:ie(),description:(0,Y.jsxs)(Y.Fragment,{children:[re(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ce(),` `,(0,Y.jsx)(`strong`,{children:oe()}),`.`,` `,ae()]}),confirmLabel:ye()}))try{await W({anomalyId:e._id,status:`resolved`}),V.success(i(),e.kind)}catch(e){V.error(be(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),V.success(se(),e.kind)}catch(e){V.error(a(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,Y.jsx)(`strong`,{children:de()}),` `,D(),` `,(0,Y.jsx)(`strong`,{children:te()}),` `,ue(),` `,(0,Y.jsx)(`strong`,{children:O()}),` `,pe(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:k()})]}),(0,Y.jsxs)(je,{q:n,onQChange:h,searchPlaceholder:E(),timeRange:f,onTimeRangeChange:N,onReset:$,canReset:Q,children:[(0,Y.jsxs)(B,{value:o,onValueChange:b,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:fe()}),Ne.map(e=>(0,Y.jsx)(L,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,Y.jsxs)(B,{value:s,onValueChange:A,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{placeholder:v()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:ge()}),Fe.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]}),(0,Y.jsxs)(B,{value:l,onValueChange:u,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(I,{placeholder:_()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:T()}),Ie.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]}),(0,Y.jsxs)(B,{value:c,onValueChange:M,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{placeholder:y()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:me()}),J.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]})]}),(0,Y.jsx)(Me,{title:S(),rows:q,emptyHint:o===`open`?Ce():g(),rowActions:e=>K&&e.status===`open`?[{label:ve(),onSelect:()=>void We(e)},{label:x(),onSelect:()=>void Ge(e)}]:[],columns:[{header:Se(),cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:y(),cell:e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:_e(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,Y.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:we({when:j(e.firstAt)}),children:xe({count:String(e.occurrenceCount)})}):(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:v(),cell:e=>(0,Y.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:w(),cell:e=>(0,Y.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,Y.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:he(),cell:e=>(0,Y.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,Y.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:r(),cell:e=>(0,Y.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:le(),cell:e=>e.correlationId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}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 ze({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=$(e);return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,h()]}):null]})}let n=J(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,Y.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,h()]})}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,Y.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,h()]}):null]})}function Be({row:e}){let[t,n]=(0,G.useState)(!1),r=d(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[p(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,Y.jsx)(M,{open:t,onOpenChange:n,children:(0,Y.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,Y.jsx)(N,{children:(0,Y.jsx)(F,{children:m()})}),r===void 0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:s()}):r.length===0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:b()}):(0,Y.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,Y.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,Y.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,Y.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,Y.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,Y.jsx)(P,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,Y.jsx)(P,{variant:`secondary`,children:o()}):(0,Y.jsx)(P,{variant:`outline`,children:f()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,BN as i,Du as a,Eu as o,FN as s,GN as c,HN as l,IN as u,LN as d,MN as f,NN as p,Ou as m,PN as h,RN as g,UN as _,VN as v,VY as y,WN as b,jN as x,ju as S,ku as C,t as w,zN as T}from"./api-DcB3BxUc.js";import{At as E,St as D,a as O,bt as k,dr as A,fr as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-Ds-ybIOh.js";import{n as ee}from"./TimeRangePicker-BgJKavXM.js";import{t as z}from"./FilterBar-B0W1nP3i.js";import{t as B}from"./AdvancedFilter-BFXkHS7k.js";import{t as V}from"./DataTableShell-7VOYauXM.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:S()},{value:`realLabel`,label:r()},{value:`targetLabel`,label:C()},{value:`impersonated`,label:m()},{value:`resource`,label:a()},{value:`resourceId`,label:o()}];function q(){let e=j({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,r=e.action??G,a=e.impersonated??G,o=e.resource??G,m=M(e.from,e.to),S=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:C,to:N}=ee(m),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:O(e)}),replace:!0}),$=y(w.admin.listAudit,{filter:{q:n||void 0,from:C,to:N,action:r===G?void 0:r,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:S.length>0?S: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||a!==G||o!==G||S.length>0||m.kind!==`relative`||m.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:_(),timeRange:m,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(I,{value:r,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:l()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:v()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:a,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:i()}),(0,U.jsx)(k,{value:`yes`,children:T()}),(0,U.jsx)(k,{value:`no`,children:g()})]})]}),(0,U.jsxs)(I,{value:o,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:d()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:u()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:S,onChange:Q}),(0,U.jsx)(V,{title:s(),rows:$,emptyHint:h(),columns:[{header:p(),cell:e=>E(e.at),sort:e=>e.at},{header:l(),cell:e=>e.action,sort:e=>e.action},{header:f(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:x(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:d(),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{$O as r,AO as i,Ak as a,BO as o,BY as s,Bg as c,Bk as l,CO as u,DO as d,E as f,EO as p,FO as m,Fk as ee,GO as h,Gg as g,HO as _,Hg as v,IO as y,Ik as te,JO as b,Jg as ne,Jl as re,KO as ie,Kg as ae,LO as oe,Lg as se,Lk as ce,MO as le,Mg as ue,NO as de,OO as fe,PO as pe,Pk as me,QO as he,RO as ge,RY as _e,Rg as ve,Rk as ye,SO as be,TO as xe,UO as Se,Ug as Ce,Uk as we,VO as Te,VY as x,Va as Ee,Vg as De,Vk as Oe,WO as ke,Wg as S,Wk as Ae,XO as je,Xl as Me,YO as Ne,Yg as Pe,Yl as Fe,ZO as Ie,Zl as Le,_O as Re,ak as ze,bO as Be,ck as Ve,cs as He,dO as Ue,ek as We,eu as Ge,fO as C,gO as Ke,hO as qe,ik as Je,jO as Ye,jk as Xe,kO as Ze,mO as Qe,nk as $e,ok as et,pO as tt,qO as nt,qg as rt,ql as it,rk as at,sk as ot,t as w,tk as st,uO as T,vO as ct,wO as E,xO as lt,yO as ut,zO as dt,zg as ft,zk as pt}from"./api-DcB3BxUc.js";import{r as D}from"./dist-D96qX4Zd.js";import{t as mt}from"./chevrons-up-down-R0Y7ndDn.js";import{i as ht,n as O,o as gt,r as _t,s as vt}from"./FieldLabel-CZ-m3Yh8.js";import{t as k}from"./button-DgaBsJDX.js";import{$t as A,At as yt,Ct as bt,Dt as xt,Jn as St,Jt as j,L as Ct,Mt as wt,Ot as Tt,Pn as Et,St as M,Tt as Dt,Yt as Ot,ar as N,at as kt,bt as P,cn as At,dr as F,fr as jt,ft as Mt,it as Nt,jt as I,kn as L,on as Pt,or as Ft,ot as It,sn as Lt,sr as Rt,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-Ds-ybIOh.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-A3AeBsY1.js";import{t as Gt}from"./FilterBar-B0W1nP3i.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-Cyz2oaDo.js";import{t as W}from"./dispatchErrorInfo-ALhveHh9.js";var $t=f(`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=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function K(e){return!!e.lastLocalRefusalCode}function sn(e){return an(e)||on(e)||K(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function vn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(un),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),s=(0,G.useMemo)(()=>gn(o),[o]),c=(0,G.useMemo)(()=>_n(o),[o]),l=(0,G.useMemo)(()=>vn(o),[o]),d=(0,G.useMemo)(()=>hn(fn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:xe(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:u()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(P,{value:Y,children:E()}),s.map(e=>(0,Q.jsx)(P,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:be()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(P,{value:Y,children:E()}),c.map(e=>(0,Q.jsx)(P,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:lt()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(P,{value:Y,children:E()}),l.map(e=>(0,Q.jsx)(P,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:ut(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ct(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Re(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Ke(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:qe(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(V,{children:Qe()}),(0,Q.jsx)($,{label:tt(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Ut,{children:d.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(Ft,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=K(e)?W(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:d({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:I(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${I(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ee({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${I(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[p({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${I(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?C():e===`error`?Ue():T()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:C()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:Ue()}):(0,Q.jsx)(j,{variant:`outline`,children:T()})}function Cn(){return x(w.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=x(w.compat.getBridgeCompat,{}),n=x(w.me.getMe,{host:Mt})?.role===`admin`,r=x(w.admin.listInstances,n?{}:`skip`),i=x(w.agents.usageForInstances,n?{}:`skip`),a=F(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=jt({from:`/settings/bridge`}),l=F({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:b()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:nt()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Le()}),(0,Q.jsx)(V,{children:Me()}),(0,Q.jsx)(V,{children:Fe()}),(0,Q.jsx)(V,{children:re()}),(0,Q.jsx)(V,{children:it()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Ct(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Nt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(It,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Et,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(kt,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:rt(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ae({build:t.buildVersion??`?`})]}):null,` · `,g(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ge()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=yt(e.checkedAt),p=e.startedAt==null?null:yt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(N,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(L,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?oe():l===`gateways_unreachable`?de({count:u.length}):c?y():m({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)($t,{size:12,"aria-hidden":!0}),` `,pe({time:f})]}),p?(0,Q.jsx)(`span`,{children:Ye({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:le({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:i()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(Et,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(j,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Pe()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Rt,{size:13,"aria-hidden":!0}),Ze({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[ie(),i.length>0?(0,Q.jsx)(j,{variant:`destructive`,children:ke({count:i.length})}):a>0?(0,Q.jsx)(j,{variant:`destructive`,children:Se()}):(0,Q.jsx)(j,{variant:`secondary`,children:h()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[_({version:e.vendoredVersion}),r?` · `+Te({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Rt,{size:13,"aria-hidden":!0}),o({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ge({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:De({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:S()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(bt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsx)(Tt,{children:Ae({instance:e.displayName??e.name})}),(0,Q.jsx)(Dt,{children:we()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(N,{"aria-hidden":!0}):(0,Q.jsx)(L,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?he():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ie()]}):null}function jn({instance:e,onClose:t}){let n=s(w.admin.upsertInstanceConfig),i=_e(w.bridge.validateMediaPaths),o=Ot(),c=Vt(e.config?.contentLocale,void 0),[u,d]=(0,G.useState)(()=>ht(e.config??{},c)),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(null),v=u.inboundMediaMode===`shared-fs`,y=u.mediaMode===`shared-fs`,b=v||y;async function ne(){h(!0),_(null);try{_(await i({instanceName:e.name,inboundMediaMode:u.inboundMediaMode,mediaMode:u.mediaMode}))}catch(e){o.error($e(),e)}finally{h(!1)}}async function re(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(u,r,c)}),t()}catch(e){o.error(te(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Oe(),help:ee()}),(0,Q.jsxs)(R,{value:u.mediaMode,onValueChange:e=>d({...u,mediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(B,{children:vt.map(e=>(0,Q.jsx)(P,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:l(),help:me()}),(0,Q.jsxs)(R,{value:u.inboundMediaMode,onValueChange:e=>d({...u,inboundMediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(B,{children:gt.map(e=>(0,Q.jsx)(P,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:pt(),help:Xe()}),(0,Q.jsx)(A,{type:`number`,min:1,max:4096,className:`w-full`,value:u.mediaMaxMb,onChange:e=>d({...u,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Ve(),help:ot()}),(0,Q.jsx)(A,{className:`w-full`,spellCheck:!1,value:u.inboundAgentMount,onChange:e=>d({...u,inboundAgentMount:e.target.value})})]}),y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:et(),help:ze()}),(0,Q.jsx)(A,{className:`w-full`,spellCheck:!1,value:u.outboundAgentMount,onChange:e=>d({...u,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(wt,{checked:u.rehydration,onCheckedChange:e=>d({...u,rehydration:e===!0})}),(0,Q.jsx)(O,{label:ye(),help:a()})]}),b&&g!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),Ne({reason:g.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:We(),result:g.inbound}),(0,Q.jsx)(An,{label:r(),result:g.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:st()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),je()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void ne(),disabled:m,children:[m?(0,Q.jsx)(St,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?at():Je()]}),(0,Q.jsx)(k,{size:`sm`,onClick:()=>void re(),disabled:f,children:ce()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(At,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?c():ft({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Lt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ve()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$l as i,BY as a,Ct as o,Hk as s,P_ as c,Qg as l,RY as u,St as d,Tt as f,VY as p,Xg as m,Zg as h,_p as g,_t as _,at as v,bt as y,ct as b,dp as x,dt as S,e_ as C,et as ee,fp as te,ft as ne,gp as w,gt as re,hp as ie,ht as T,hv as ae,i_ as oe,it as E,jY as D,lt as se,mp as O,mt as k,mv as ce,n_ as le,nt as ue,ot as de,pp as fe,pt as pe,r_ as A,rt as me,st as he,t as j,t_ as M,tt as ge,up as _e,ut as ve,vp as ye,vt as N,wt as P,xt as be,xv as F,yp as xe,yt as Se,yv as Ce}from"./api-DcB3BxUc.js";import{t as we}from"./use_paginated_query-Dc9YWxua.js";import{t as I}from"./button-DgaBsJDX.js";import{$t as L,Mt as R,St as z,bt as B,kn as Te,nt as Ee,rt as De,tt as V,vt as H,xt as U,yt as W}from"./index-Ds-ybIOh.js";import{a as Oe}from"./compatView-Cyz2oaDo.js";/* empty css */var G=t(e(),1),ke=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Ae(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 K=[`auto`,`hybrid`,`tool`,`off`];function je(e){switch(e){case`auto`:return d();case`hybrid`:return be();case`tool`:return y();default:return Se()}}function q(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function J(e){return typeof e==`string`&&K.includes(e)}function Y(e){return{injection:J(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function X(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function Me(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?k():Z(e)?E():null:T(),i=Y(e),a=t.injection!==i.injection||!X(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:_()}}function Z(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Ne(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Q(e){return e.ok?null:e.code===`scope_refused`?k():e.code===`stale_default`?pe():e.code===`write_unknown`||e.code===`not_confirmed`?ve():e.code===`not_applied`?se():e.code===`default_too_large`?ue():e.code===`allowlist_too_large`?me():e.code===`plugin_too_old`?E():e.code===`source_not_allowed`?v():e.code===`plugin_config_lag`?de():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?re():ne({code:e.code})}function Pe(e,t){let n=q(e),r=q(t);if(n.injection!==r.injection||!X(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let r=u(j.knowledge.setAgentKnowledgeDefault),[i,a]=(0,G.useState)(t),[s,c]=(0,G.useState)(()=>Y(t)),[d,f]=(0,G.useState)(`idle`),[p,m]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),v=e=>{a(e),c(Y(e)),m(null)},y=Pe(i,t);(0,G.useEffect)(()=>{g&&y&&(_(!1),v(t))},[g,y]);let b=Me(i,s,n),x=b.readOnlyReason===null;async function C(){f(`saving`),m(null);try{let n=Q(await r({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:q(i)}));m(n),f(n===null?`done`:`idle`),n===null&&_(!0)}catch(e){m(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),f(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(H,{value:s.injection,onValueChange:e=>{J(e)&&c({...s,injection:e})},disabled:!x,children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":o(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:K.map(e=>(0,$.jsx)(B,{value:e,children:je(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:x?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(R,{checked:s.sources.includes(e.id),onCheckedChange:()=>c(Ne(t,s,e.id)),disabled:!x,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!g?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ge(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:ee()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()}),x?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(I,{size:`sm`,disabled:!b.dirty||!b.valid||d===`saving`,onClick:()=>void C(),children:d===`saving`?F():l()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:b.readOnlyReason}),x&&b.dirty&&b.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b.invalidReason}):null,d===`done`&&p===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):null,p===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p})]})]})}function Ie({instanceName:e}){let t=p(j.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(j.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":f(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:P()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:T()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b({shown:n.length})}),(0,$.jsx)(I,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:he()})]}):null]})}function Le({instance:e}){let t=a(j.admin.upsertInstanceConfig),n=p(j.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,o]=(0,G.useState)(r),[s,c]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(r),c(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function f(){c(`saving`);try{let n={...e.config??{}};i===``||i===u?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let g=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(H,{value:i===``?u:i,onValueChange:e=>o(e===u?``:e),children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":w(),children:(0,$.jsx)(z,{placeholder:O()})}),(0,$.jsxs)(W,{children:[(0,$.jsx)(B,{value:u,children:O()}),g.map(e=>(0,$.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(I,{size:`sm`,disabled:!d||s===`saving`,onClick:()=>void f(),children:s===`saving`?F():l()})]}),s===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):null,s===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}):null]})}function Re({instance:e}){let t=a(j.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,G.useState)(n),[s,c]=(0,G.useState)(r===null?``:String(r)),[u,d]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(n),c(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=s.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,_=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,v=i!==n||(p??null)!==r;async function y(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(R,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":g()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":fe(),disabled:!i}),(0,$.jsx)(I,{size:`sm`,disabled:!v||!_||u===`saving`,onClick:()=>void y(),children:u===`saving`?F():l()})]}),_?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:te()}),u===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):null,u===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]})}function ze({instance:e}){let t=a(j.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,G.useState)(n===null?``:String(n)),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),u=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function p(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:xe()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,$.jsx)(I,{size:`sm`,disabled:!f||!d||o===`saving`,onClick:()=>void p(),children:o===`saving`?F():l()})]}),d?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_e()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ye()})]})}function Be(){let e=u(j.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),a=p(j.admin.listInstances,{}),[o,l]=(0,G.useState)(null);(0,G.useEffect)(()=>{!a||a.length===0||(!o||!a.some(e=>e.name===o))&&l(a[0].name)},[a,o]);let d=(a?.length??0)>1,f=a!==void 0&&a.length===0,m=p(j.compat.forInstance,o?{instanceName:o}:`skip`),h=o?Ee(m,`configDefaults`):`loading`,g=h===`loading`?null:h.blocked,_=(0,G.useMemo)(()=>d&&o?{instanceName:o}:{},[d,o]),v=(0,G.useRef)(0),y=(0,G.useCallback)(async()=>{let t=++v.current;n({status:`loading`});try{let r=Ae(await e(_));if(v.current!==t)return;n({status:`done`,current:r})}catch{if(v.current!==t)return;n({status:`error`})}},[e,_]);(0,G.useEffect)(()=>{g===!1&&(d&&!o||y())},[y,g,d,o]);let b=t.status===`done`?t.current:null,x=(0,G.useMemo)(()=>ke.map(e=>({id:e,label:De(e)})),[]),S=(0,G.useMemo)(()=>[{id:`fast`,label:ae()},{id:`standard`,label:ce()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),d&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,$.jsxs)(H,{value:o,onValueChange:e=>l(e),children:[(0,$.jsx)(U,{size:`sm`,"aria-label":c(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:(a??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,f?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):h===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):h.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,Oe(h.gatewayVersion,h.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[r(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:Ce()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,$.jsx)(V,{field:`thinkingLevel`,options:x,value:b?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:A()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:le()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,$.jsx)(V,{field:`fastMode`,options:S,value:b===null||b.fastModeDefault===null?null:b.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:M()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=a?.find(e=>e.name===(o??a[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,BY as o,CI as s,Cf as c,DI as l,EI as u,FI as d,GI as f,HI as p,II as m,JI as h,KI as g,LI as _,MI as v,NI as y,OI as b,PI as x,QI as ee,RI as te,SI as ne,TI as re,UI as ie,VI as ae,VY as S,WI as C,XI as w,YI as T,ZI as E,_I as D,_L as O,aL as k,bI as A,cL as j,dL as M,eL as N,fL as P,gI as F,gL as I,hI as L,hL as R,iL as z,jI as B,kI as V,lL as H,mL as U,nL as W,oL as G,pL as oe,qI as K,rL as q,sL as se,t as J,tL as ce,uL as le,vI as ue,wI as de,xI as fe,xf as pe,yI as me,zI as he}from"./api-DcB3BxUc.js";import{t as ge}from"./button-DgaBsJDX.js";import{At as _e,ct as Y}from"./index-Ds-ybIOh.js";import{t as ve}from"./DataTableShell-7VOYauXM.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>O(),incorrect:()=>I(),incoherence:()=>R(),formatting:()=>U(),latency:()=>oe(),api_error:()=>P(),other:()=>M()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:H()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:j()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:le()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=o(J.feedback.respondToFeedback),[s,l]=(0,X.useState)(e.thread),[u,m]=(0,X.useState)(``),[_,v]=(0,X.useState)(!1);async function y(){let t=u.trim();if(!(!t||_)){v(!0);try{await a({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{v(!1)}}}let b=[];try{b=i.contextJson?JSON.parse(i.contextJson):[]}catch{b=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${se()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:d(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G()}),(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:fe()}),(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:k()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?z():e.authorRole===`agent`?e.authorLabel??c():q()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:W()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ce(),value:u,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 y(),disabled:!u.trim()||_,children:_?N():r()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||E()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||E()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,b.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h({count:i.contextCount??b.length,truncated:i.contextTruncated?K():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:b.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?ie({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[p(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ae()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=S(J.feedback.listForAdmin,{}),t=o(J.feedback.readSnapshot),n=o(J.feedback.deleteFeedback),r=Y(),[c,d]=(0,X.useState)(null),[f,p]=(0,X.useState)({});async function h(e){if(c===e._id){d(null);return}if(!f[e._id]){let n=await t({feedbackId:e._id});p(t=>({...t,[e._id]:n}))}d(e._id)}async function g(e){await r({title:D(),description:F(),confirmLabel:L(),destructive:!0})&&(await n({feedbackId:e._id}),c===e._id&&d(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),` `,(0,Z.jsx)(`strong`,{children:he()}),` `,te()]}),(0,Z.jsx)(ve,{title:_(),rows:e,emptyHint:m(),isExpanded:e=>c===e._id&&!!f[e._id],renderExpanded:e=>f[e._id]?(0,Z.jsx)(be,{data:f[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:x(),cell:e=>_e(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:v(),cell:e=>e.messageRole===`user`?B():i(),sort:e=>e.messageRole},{header:V(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${b({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:l(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:u(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:re(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:s()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ne()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:c===e._id?A():me(),onSelect:()=>void h(e)},{label:ue(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,JY as n}from"./api-DcB3BxUc.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-Ds-ybIOh.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),widgetsEnabled:n.optional(n.boolean()),widgetPromptConfirm:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(r,{delayDuration:150,children:(0,b.jsxs)(i,{children:[(0,b.jsx)(a,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(c,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AJ as ee,BJ as r,BY as te,CJ as i,DJ as a,Df as o,EJ as ne,Ef as re,FJ as s,GJ as ie,HB as c,HJ as l,IJ as u,JJ as d,KJ as ae,LJ as f,MJ as oe,NJ as se,NY as ce,OJ as le,PJ as ue,QJ as de,RJ as p,SJ as fe,TJ as m,UJ as pe,VJ as h,VY as me,WJ as he,XJ as ge,YJ as g,ZJ as _e,_J as ve,bJ as ye,jJ as be,jY as xe,kJ as Se,qJ as _,t as v,vJ as y,wJ as b,xJ as x,yJ as S,zJ as C}from"./api-DcB3BxUc.js";import{t as w}from"./button-DgaBsJDX.js";import{An as T,Bt as E,Gt as D,Ht as O,In as k,Jt as A,Kt as j,Mt as Ce,St as M,Ut as we,Vt as Te,Wt as Ee,Yt as De,an as Oe,bt as N,en as ke,nn as P,nr as F,qt as Ae,tn as je,tr as Me,vt as I,xt as L,yt as R}from"./index-Ds-ybIOh.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-A3AeBsY1.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return h();case`audio`:return r();case`video`:return C();case`pdf`:return p();case`document`:return f();case`archive`:return u();default:return s()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[s,u]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[h,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=te(v.files.softDelete),Y=De();function Ie(){t(W),r(W),u(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(b())}catch(e){Y.error(i(),e)}}let X=me(v.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:s===W?void 0:s,category:f===W?void 0:f,includeAutoGenerated:h||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ce(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||s!==W||f!==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)(L,{size:`sm`,"aria-label":_e(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ge()}),(0,U.jsx)(N,{value:`inbound`,children:g()}),(0,U.jsx)(N,{value:`outbound`,children:d()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:r,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":_(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ae()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:s,onValueChange:u,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ie(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:he()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:f,onValueChange:p,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":pe(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:l()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ce,{checked:h,onCheckedChange:e=>C(e===!0),"aria-label":o()}),(0,U.jsx)(`span`,{children:o()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(k,{size:14,"aria-hidden":!0}),a()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?y():S()}):(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:ue()}),(0,U.jsx)(z,{children:se()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:be()}),(0,U.jsx)(z,{children:ee()}),(0,U.jsx)(z,{className:`text-right`,children:Se()})]})}),(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:re()}):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`?g():d()})}),(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)(ke,{children:[(0,U.jsx)(Oe,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":ne(),children:(0,U.jsx)(Me,{size:16})})}),(0,U.jsxs)(je,{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)(F,{size:14}),le()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(F,{size:14}),ye()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(T,{size:14}),m()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ve({cap:Be})}):null]}),(0,U.jsx)(E,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(we,{children:[(0,U.jsxs)(j,{children:[(0,U.jsx)(Ae,{children:fe()}),(0,U.jsx)(Ee,{children:x()})]}),(0,U.jsxs)(D,{children:[(0,U.jsx)(O,{children:c()}),(0,U.jsx)(Te,{onClick:()=>void Le(),children:m()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,$y as i,Ab as a,BY as o,Bb as s,By as c,Cb as l,Cy as u,Db as d,Dy as f,E as p,Eb as m,Ey as h,Fb as g,Fy as _,Gb as v,Gv as y,Gy as b,Hb as x,Hy as S,Ib as C,Iv as w,Iy as T,Jb as E,Jv as D,Jy as O,Kb as k,Kv as A,Ky as ee,Lb as te,Lv as ne,Ly as j,Mb as M,My as re,Nb as ie,Ny as N,Ob as ae,Oy as P,Pb as oe,Py as se,Qv as F,Qy as ce,Rb as I,Rv as le,Ry as ue,Sb as de,Sy as fe,Tb as pe,Ty as me,Ub as he,Uy as ge,VY as L,Vb as _e,Vy as ve,Wb as ye,Wy as be,Xv as xe,Xy as Se,Yb as Ce,Yv as we,Yy as Te,Zv as Ee,Zy as De,_b as Oe,_y as ke,ab as Ae,ay as je,bb as R,by as Me,cb as Ne,cy as Pe,db as z,dy as Fe,eb as Ie,ey as Le,fb as Re,fy as ze,gy as Be,hy as Ve,ib as He,iy as Ue,jb as We,kb as Ge,lb as Ke,ly as qe,my as Je,nb as Ye,ny as Xe,ob as Ze,oy as Qe,pb as $e,py as et,qb as tt,qv as nt,qy as rt,rb as it,ry as at,sb as ot,sy as st,t as B,tb as ct,ty as lt,ub as ut,uy as dt,vb as ft,vy as pt,wb as mt,wy as ht,xb as gt,xy as _t,yb as vt,yy as yt,zb as bt,zv as xt,zy as St}from"./api-DcB3BxUc.js";import{t as Ct}from"./x-DJcI0sFP.js";import{t as V}from"./button-DgaBsJDX.js";import{$ as wt,$t as H,Ct as Tt,Dn as Et,Dt,En as Ot,G as kt,J as U,Jt as W,K as At,Mn as jt,Mt as G,Nn as K,Ot as Mt,Pn as q,Q as Nt,St as Pt,Tt as Ft,W as J,X as It,Y as Lt,Yt as Y,Z as Rt,at as zt,b as Bt,bt as Vt,cr as Ht,ct as Ut,et as Wt,ft as Gt,it as Kt,jn as X,ot as qt,q as Jt,sr as Yt,st as Xt,vt as Zt,wt as Qt,xt as $t,yt as en}from"./index-Ds-ybIOh.js";import{t as tn}from"./FilterBar-B0W1nP3i.js";import{t as nn}from"./DataTableShell-7VOYauXM.js";import{t as Z}from"./DetailChips-DxxeU-mf.js";var rn=p(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Q=t(e(),1),$=n(),an={name:``,description:``};function on(){let e=L(B.groups.listGroups,{}),t=L(B.me.getMe,{host:Gt})?.role===`admin`,n=o(B.groups.createGroup),r=o(B.groups.updateGroup),i=o(B.groups.deleteGroup),c=Ut(),l=Y(),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(an),[_,y]=(0,Q.useState)(null),[b,S]=(0,Q.useState)(``),w=(0,Q.useMemo)(()=>{if(!e)return e;let t=b.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,b]);function T(){p(null),h(an),d(!0)}function D(e){p(e),h({name:e.name,description:e.description??``}),d(!0)}async function O(){try{f?await r({groupId:f._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),h(an),p(null),d(!1)}catch(e){l.error(be(),e)}}async function A(e){if(await c({title:a({name:e.name}),description:Ge(),confirmWord:e.name,confirmLabel:ae(),cancelLabel:C(),destructive:!0}))try{await i({groupId:e._id})}catch(e){l.error(ge(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:E()}),t?(0,$.jsx)(pn,{}):null,(0,$.jsx)(tn,{q:b,onQChange:S,onReset:()=>S(``),canReset:b!==``,searchPlaceholder:_e()}),(0,$.jsx)(nn,{title:Ce(),rows:w,addLabel:tt(),onAdd:t?T:void 0,emptyHint:k(),columns:[{header:v(),cell:e=>e.name,sort:e=>e.name},{header:ye(),cell:e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:(0,$.jsx)(Ot,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(K,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,$.jsx)(W,{variant:`secondary`,children:re({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:he(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:x(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(rn,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(X,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:s(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:bt(),onSelect:()=>D(e)},{label:I(),variant:`destructive`,onSelect:()=>void A(e)}]:[]]}),(0,$.jsx)(Bt,{open:u,onOpenChange:d,title:f?oe():g(),description:ie(),canSubmit:!!m.name.trim(),onSubmit:O,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:M()}),(0,$.jsx)(H,{value:m.name,onChange:e=>h({...m,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,$.jsx)(H,{value:m.description,onChange:e=>h({...m,description:e.target.value})})]})]})}),(0,$.jsx)(ln,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||y(null)}})]})}var sn=8;function cn({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Ht,{size:14,"aria-hidden":!0}),vt()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Oe({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ft(),(0,$.jsx)(Yt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=L(B.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,s=L(B.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),f=L(B.groups.listAssignableUsers,n&&a?{}:`skip`),p=o(B.groups.addMember),h=o(B.groups.removeMember),g=o(B.groups.bulkSetMembers),_=o(B.groups.setGroupManager),v=Y(),[y,b]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(`members`),[E,D]=(0,Q.useState)(1),[k,A]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(new Set),j=(0,Q.useRef)(null),M=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ie=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),N=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>J(e.instanceName,e.agentId))),[i]),ae=(0,Q.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?J(e.instanceName,e.agentId):null},[i]);(0,Q.useEffect)(()=>{b(``),C(``),T(`members`),D(1),A(null),j.current=null},[n,e]),(0,Q.useEffect)(()=>{D(1)},[y]),(0,Q.useEffect)(()=>{n&&i&&e&&j.current!==e&&(j.current=e,ne(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let P=(0,Q.useMemo)(()=>f?Jt(f,y,te):[],[f,y,te]);async function oe(t,n){if(e)try{n?await h({groupId:e,userId:t}):await p({groupId:e,userId:t})}catch(e){v.error(S(),U(e))}}async function se(t,n){if(e)try{await _({groupId:e,userId:t,manager:!n})}catch(e){v.error(ee(),e)}}let F=wt(P,e=>M.has(e.userId)),ce=P.filter(e=>M.has(e.userId)).length,I=Rt(P,E,sn);async function le(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await g({groupId:e,userIds:t,member:F!==`all`})}catch(e){v.error(S(),U(e))}}let ue=(e,t)=>(0,$.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":u({user:t}),title:u({user:t}),onClick:()=>A({userId:e,label:t}),children:[(0,$.jsx)(jt,{size:13,"aria-hidden":!0}),ht()]});return(0,$.jsx)(Tt,{open:n,onOpenChange:r,children:(0,$.jsxs)(Qt,{className:`oc-access`,children:[(0,$.jsxs)(Dt,{children:[(0,$.jsx)(Mt,{children:d({name:t})}),(0,$.jsx)(Ft,{children:i&&!a?c():m()})]}),(0,$.jsxs)(Kt,{value:w,onValueChange:T,className:`oc-access__tabs`,children:[(0,$.jsxs)(qt,{className:`w-full`,children:[(0,$.jsxs)(Xt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ot,{size:13,"aria-hidden":!0}),pe(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(Xt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),l(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,$.jsxs)(Xt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(rn,{size:13,"aria-hidden":!0}),it(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(zt,{value:`members`,children:i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):a?f===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):f.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ke()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{value:y,onChange:e=>b(e.target.value),placeholder:mt(),className:`oc-access__search`}),P.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:gt()}):(0,$.jsxs)($.Fragment,{children:[P.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(G,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void le(),"aria-label":R()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,$.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[ce,` / `,P.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=M.has(e.userId),n=Wt(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(G,{checked:t,onCheckedChange:()=>void oe(e.userId,t),"aria-label":$e({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]}),t&&ie.has(e.userId)?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:fe()}):null,(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:Nt(e.role)}),t?ue(e.userId,n.primary):null,(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?rt():O(),title:r?rt():O(),onClick:()=>void se(e.userId,r),children:(0,$.jsx)(K,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(cn,{page:I.page,pageCount:I.pageCount,onPage:D})]})]}):e?(0,$.jsx)(un,{groupId:e,members:i.members,agentsButton:ue}):null}),(0,$.jsxs)(zt,{value:`agents`,children:[i&&!a?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:et()}):null,s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ne()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{value:x,onChange:e=>C(e.target.value),placeholder:de(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,defaultKey:ae,viewerIsAdmin:a,query:x},`${e}-${t._id}`))})]})]}),(0,$.jsx)(zt,{value:`charts`,children:(0,$.jsx)(mn,{groupId:e})})]}),(0,$.jsx)(dn,{groupId:e,member:k,onOpenChange:e=>{e||A(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=L(B.groupInvites.listGroupInviteRequests,{groupId:e}),i=o(B.groupInvites.requestGroupInvite),a=o(B.groups.removeMember),s=Ut(),c=Y(),[l,u]=(0,Q.useState)(``),[d,p]=(0,Q.useState)(1),m=Rt(t,d,sn);async function g(t){t.preventDefault();let n=l.trim();if(n)try{await i({groupId:e,email:n}),u(``),c.success(_())}catch(e){c.error(se(),e)}}async function v(t,n){if(await s({title:P({user:n}),description:h({user:n}),confirmLabel:me(),cancelLabel:C(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){c.error(S(),U(e))}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void g(e),children:[(0,$.jsx)(H,{type:`email`,value:l,onChange:e=>u(e.target.value),placeholder:j(),"aria-label":St()}),(0,$.jsxs)(V,{type:`submit`,size:`sm`,disabled:!l.trim(),children:[(0,$.jsx)(Et,{size:14,"aria-hidden":!0}),T()]})]}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ue()}),t.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_t()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:m.pageItems.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:fe()}):null,n(e.userId,e.label),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Te(),title:Te(),children:(0,$.jsx)(K,{size:15,"aria-hidden":!0})}):null}),(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":P({user:e.label}),title:e.manager?f():e.lastGroup?y():P({user:e.label}),onClick:()=>void v(e.userId,e.label),children:(0,$.jsx)(Ct,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,$.jsx)(cn,{page:m.page,pageCount:m.pageCount,onPage:p})]}),r!==void 0&&r.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:N()}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsx)(W,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Lt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let i=L(B.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),a=o(B.groups.setMemberAgents),s=o(B.groups.setMemberDefaultAgent),c=Y();async function l(e){try{await e()}catch(e){c.error(A(),e)}}let u=i?.agents??[],d=new Map(u.map(e=>[J(e.instanceName,e.agentId),e])),f=[...d.keys()],p=new Set(u.filter(e=>e.allowed).map(e=>J(e.instanceName,e.agentId)));function m(n){if(!e||!t||!i)return;let r=It(f,p,i.restricted,n).map(e=>{let t=d.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>a({groupId:e,userId:t.userId,agents:r}))}return(0,$.jsx)(Tt,{open:t!==null,onOpenChange:n,children:(0,$.jsxs)(Qt,{className:`oc-access`,children:[(0,$.jsxs)(Dt,{children:[(0,$.jsx)(Mt,{children:lt({user:t?.label??``})}),(0,$.jsx)(Ft,{children:Le()})]}),i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):i===null||u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:nt()}):(0,$.jsxs)($.Fragment,{children:[i.settable?null:(0,$.jsx)(`p`,{className:`oc-access__hint`,children:w()}),i.adminNarrowed?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:xt()}):null,i.restrictedByAdmin&&!i.viewerIsAdmin?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):null,(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,children:i.restricted?F():r()}),i.restricted?(0,$.jsx)(V,{type:`button`,size:`sm`,variant:`outline`,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin,onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agents:null})):void 0,children:Ee()}):null]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let r=J(n.instanceName,n.agentId),a=n.displayName??n.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(G,{checked:n.allowed,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>m(r),"aria-label":xe({name:a})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:a,children:a}),n.limitedByAdmin?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:le()}):null,n.state===`deleted`?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:He()}):null,n.allowed?n.isMemberDefault?(0,$.jsx)(V,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!i.settable,"aria-label":we(),title:we(),onClick:()=>e&&t?void l(()=>s({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,$.jsx)(X,{size:14,fill:`currentColor`})}):(0,$.jsx)(V,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!i.settable,"aria-label":D(),title:D(),onClick:()=>e&&t?void l(()=>s({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,$.jsx)(X,{size:14})}):null]},r)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:s}){let c=L(B.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=o(B.groups.assignAgentToGroup),u=o(B.groups.removeAgentFromGroup),d=o(B.groups.bulkSetGroupAgents),f=o(B.groups.claimAgentForGroup),p=o(B.groups.setGroupDefaultAgent),m=Y(),[h,g]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{g(1)},[s]),!e)return null;let _=At(c?.agents??[],s),v=c?.discovery&&!c.discovery.lastPollOk,y=e=>kt({assigned:r.has(J(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),b=_.filter(e=>y(e)!==`claim`),x=_.filter(e=>y(e)===`claim`);if(s.trim()&&_.length===0)return null;let S=b.filter(e=>y(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=wt(S,e=>r.has(J(t,e.agentId))),w=Rt(b,h,sn);async function T(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(ve(),U(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){m.error(ve(),U(e))}}async function D(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(Pe(),e)}}async function O(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(Xe(),e)}}let k=e=>e.reservedForGroup?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:st()}):e.reserved?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?je():Qe({group:e.reservedGroupName})}):null;return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),v?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:Ae()}):null]}),c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ut()}):_.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:v?Ze():ot()}):(0,$.jsxs)($.Fragment,{children:[S.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(G,{checked:C===`all`?!0:C===`some`?`indeterminate`:!1,onCheckedChange:()=>void E(),"aria-label":R()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,w.pageItems.map(e=>{let n=J(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=y(e)===`locked`;return(0,$.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,$.jsx)(G,{checked:a,disabled:s&&!a,onCheckedChange:()=>void T(e.agentId,a),"aria-label":Re({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,k(e),o?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:He()}):null,a?i===n?(0,$.jsx)(V,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":Ue(),title:Ue(),onClick:()=>void O(null),children:(0,$.jsx)(X,{size:14,fill:`currentColor`})}):(0,$.jsx)(V,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":at(),title:at(),onClick:()=>void O(e.agentId),children:(0,$.jsx)(X,{size:14})}):null]},e.agentId)}),(0,$.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:g}),x.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:ze()}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Fe()}),x.map(e=>{let t=e.displayName??e.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,$.jsx)(V,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":qe({name:t}),onClick:()=>void D(e.agentId),children:dt()})]},e.agentId)})]}):null]})]})}function pn(){let e=L(B.groupInvites.listPendingInviteRequests,{}),t=o(B.groupInvites.decideGroupInvite),n=Y();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(Je(),e)}}return(0,$.jsxs)(`section`,{className:`oc-invites`,"aria-label":Me(),children:[(0,$.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,$.jsx)(Et,{size:14,"aria-hidden":!0}),Me(),(0,$.jsx)(W,{variant:`secondary`,children:e.length})]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,yt({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?Be():Ve()}),(0,$.jsx)(V,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:pt()}),(0,$.jsx)(V,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:ke()})]},e._id))})]})}function mn({groupId:e}){let t=L(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=o(B.charts.assignChartToGroup),r=o(B.charts.removeChartFromGroup),a=o(B.charts.setGroupDefaultChart),s=o(B.charts.addChartToGroupPool),c=o(B.charts.removeChartFromGroupPool),l=Y();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ye()});async function p(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(b(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(b(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(b(),e)}}async function g(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(b(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(G,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":ce({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":De(),title:De(),children:(0,$.jsx)(X,{size:14,fill:`currentColor`})}):(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:Se()}):null,f?(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":i({name:e.name}),title:i({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,$.jsx)(Ct,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,$.jsxs)(Zt,{value:``,onValueChange:e=>void h(e),children:[(0,$.jsx)($t,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Pt,{placeholder:Ie()})}),(0,$.jsx)(en,{children:d.map(e=>(0,$.jsx)(Vt,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ct()}):null:null]})}export{on as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,$a as a,A as o,AF as s,AP as c,BF as l,BP as u,BY as d,CF as f,CP as p,D as m,DF as h,DP as g,EF as _,EP as v,F as y,FF as b,FP as x,Fp as S,Fv as C,GP as w,HP as T,IF as ee,IH as E,IP as D,Ip as O,JN as k,JP as te,KN as ne,KP as re,LF as ie,LH as ae,LP as oe,Lp as se,M as ce,MF as le,MP as ue,Mk as de,N as fe,NF as pe,NP as me,Nk as he,Nv as ge,O as _e,OF as ve,OP as ye,P as be,PF as xe,PP as Se,Pp as Ce,Pv as we,QN as Te,QP as Ee,Qa as De,RF as Oe,RP as ke,RY as A,SF as Ae,SP as j,TF as je,TP as M,UP as Me,VF as Ne,VP as Pe,VY as N,WP as Fe,XN as P,XP as Ie,YN as Le,YP as Re,ZN as ze,ZP as Be,Za as Ve,_F as He,_P as Ue,aF as We,aP as Ge,ao as Ke,bF as qe,bP as Je,cF as Ye,cP as Xe,cn as Ze,co as Qe,dF as $e,dP as et,dn as tt,do as nt,eF as rt,eP as it,eo as at,fF as ot,fP as st,fn as ct,fo as lt,gF as ut,gP as dt,gn as ft,hF as pt,hP as mt,hn as ht,iF as gt,iP as _t,io as vt,iu as yt,j as bt,jF as xt,jP as St,k as Ct,kF as wt,kP as Tt,lF as Et,lP as Dt,ln as Ot,lo as kt,mF as At,mP as jt,mn as Mt,nF as Nt,nP as Pt,no as Ft,nu as It,oF as Lt,oP as Rt,oo as zt,pF as Bt,pP as Vt,pn as Ht,po as Ut,qN as Wt,qP as Gt,rF as F,rP as Kt,ro as qt,ru as Jt,sF as Yt,sP as Xt,sn as Zt,so as Qt,t as I,tF as $t,tP as en,to as tn,uF as nn,uP as rn,un as an,uo as on,vF as sn,vP as cn,wF as ln,wP as un,xF as dn,yF as fn,yP as pn,zF as mn,zP as hn}from"./api-DcB3BxUc.js";import{a as gn,c as _n}from"./FieldLabel-CZ-m3Yh8.js";import{t as L}from"./button-DgaBsJDX.js";import{$t as R,Ct as z,Dt as B,J as V,Jt as H,Mt as vn,Ot as yn,St as U,Tt as bn,Yt as W,b as xn,bt as G,cn as Sn,ct as Cn,on as wn,sn as Tn,vt as K,wt as En,xt as q,yt as J}from"./index-Ds-ybIOh.js";import{t as Dn}from"./DataTableShell-7VOYauXM.js";import{InstanceConfigDialog as On}from"./BridgeTab-Bs8cvrzB.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:gn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=N(I.admin.listInstances,{}),t=N(I.agents.listAllInstanceAgents,{}),n=d(I.admin.upsertInstance),i=d(I.widgets.setInstanceWidgets),c=d(I.admin.deleteInstance),u=W(),[p,g]=(0,Y.useState)(!1),[v,x]=(0,Y.useState)(Q),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null);async function te(){try{let t=await n({instanceId:O??void 0,name:v.name,gatewayUrl:v.gatewayUrl,bridgeUrl:v.bridgeUrl||void 0,displayName:v.displayName||void 0,kind:v.kind,transport:v.kind===`hermes`?v.transport:void 0,gatewayVersion:v.gatewayVersion||void 0,gatewayHttpUrl:v.gatewayHttpUrl||void 0,...v.kind===`openclaw`?{authMode:v.authMode,personScopes:v.personScopes,identitySource:v.identitySource,participantIdentity:v.participantIdentity,managePermissionModes:v.managePermissionModes,systemIdentity:v.systemIdentity||void 0}:{},streamTransport:v.streamTransport}),r=O===null?null:e?.find(e=>e._id===O),a=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;v.kind===`openclaw`&&(v.widgetsEnabled!==a||v.widgetPromptConfirm!==o)&&await i({instanceId:t,enabled:v.widgetsEnabled,promptConfirm:v.widgetPromptConfirm}),x(Q),k(null),g(!1)}catch(e){u.error(mn(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Oe(),(0,Z.jsx)(`strong`,{children:ie()}),ee()]}),(0,Z.jsx)(Dn,{title:b(),rows:e,addLabel:xe(),onAdd:()=>{k(null),x(Q),g(!0)},emptyHint:pe(),columns:[{header:le(),cell:e=>e.name,sort:e=>e.name},{header:xt(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:s(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:wt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ne(),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 i=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(i(t.agentId))-Number(i(e.agentId))).map(e=>(0,Z.jsxs)(H,{variant:i(e.agentId)?`default`:`outline`,title:i(e.agentId)?r():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:je(),onSelect:()=>{k(e._id),x(Nn(e)),g(!0)}},{label:l(),onSelect:()=>C(e.name)},{label:nn(),onSelect:()=>D(e)},{label:ve(),onSelect:()=>T(e)},{label:h(),variant:`destructive`,onSelect:()=>void c({instanceId:e._id})}],bulkActions:[{label:h(),variant:`destructive`,onSelect:e=>e.forEach(e=>void c({instanceId:e}))}]}),(0,Z.jsx)(xn,{open:p,onOpenChange:g,title:O?ln():_(),description:Ae(),canSubmit:!!(v.name&&v.gatewayUrl),onSubmit:te,submitLabel:dn(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:qe(),children:[(0,Z.jsx)(R,{value:v.name,disabled:O!==null,onChange:e=>x({...v,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f()}):null]}),(0,Z.jsx)($,{label:fn(),children:(0,Z.jsxs)(K,{value:v.kind,onValueChange:e=>x({...v,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(G,{value:`hermes`,children:`Hermes`})]})]})}),v.kind===`hermes`?(0,Z.jsx)($,{label:yt(),children:(0,Z.jsxs)(K,{value:v.transport,onValueChange:e=>x({...v,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`ws`,children:Jt()}),(0,Z.jsx)(G,{value:`rest`,children:It()})]})]})}):null,(0,Z.jsx)($,{label:sn(),children:(0,Z.jsx)(R,{value:v.gatewayUrl,onChange:e=>x({...v,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:He(),children:(0,Z.jsx)(R,{value:v.bridgeUrl,placeholder:ut(),onChange:e=>x({...v,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:pt(),children:(0,Z.jsx)(R,{value:v.displayName,onChange:e=>x({...v,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:he(),children:[(0,Z.jsxs)(K,{value:v.streamTransport,onValueChange:e=>x({...v,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(J,{children:_n.map(e=>(0,Z.jsx)(G,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:de()})]}),(0,Z.jsx)($,{label:At(),children:(0,Z.jsx)(R,{value:v.gatewayVersion,placeholder:Bt(),onChange:e=>x({...v,gatewayVersion:e.target.value})})}),v.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:qt(),children:[(0,Z.jsxs)(K,{value:v.authMode,onValueChange:e=>x({...v,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`token`,children:Ft()}),(0,Z.jsx)(G,{value:`trusted-proxy`,children:tn()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:v.authMode===`trusted-proxy`?a():at()})]}),v.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Ut(),children:[(0,Z.jsxs)(K,{value:v.personScopes,onValueChange:e=>x({...v,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`capped`,children:lt()}),(0,Z.jsx)(G,{value:`full`,children:nt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:v.personScopes===`full`?kt():on()})]}):null,v.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Qe(),children:[(0,Z.jsxs)(K,{value:v.identitySource,onValueChange:e=>x({...v,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`canonical`,children:Qt()}),(0,Z.jsx)(G,{value:`email`,children:zt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:v.identitySource===`email`?vt():Ke()})]}):null,v.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ft(),children:[(0,Z.jsxs)(K,{value:v.participantIdentity,onValueChange:e=>x({...v,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`owner`,children:ht()}),(0,Z.jsx)(G,{value:`self`,children:Mt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:v.participantIdentity===`self`?Zt():Ht()})]}):null,v.kind===`openclaw`?(0,Z.jsxs)($,{label:ct(),children:[(0,Z.jsxs)(K,{value:v.managePermissionModes?`on`:`off`,onValueChange:e=>x({...v,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:tt()}),(0,Z.jsx)(G,{value:`on`,children:an()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:v.managePermissionModes?Ze():Ot()})]}):null,v.kind===`openclaw`?(0,Z.jsxs)($,{label:y(),children:[(0,Z.jsxs)(K,{value:v.widgetsEnabled?`on`:`off`,onValueChange:e=>x({...v,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`on`,children:be()}),(0,Z.jsx)(G,{value:`off`,children:fe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:v.widgetsEnabled?ce():bt()})]}):null,v.kind===`openclaw`&&v.widgetsEnabled?(0,Z.jsxs)($,{label:o(),children:[(0,Z.jsxs)(K,{value:v.widgetPromptConfirm?`on`:`off`,onValueChange:e=>x({...v,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:Ct()}),(0,Z.jsx)(G,{value:`on`,children:_e()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:m()})]}):null,v.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:De(),children:(0,Z.jsx)(R,{value:v.systemIdentity,placeholder:Ve(),onChange:e=>x({...v,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:ot(),children:(0,Z.jsx)(R,{value:v.gatewayHttpUrl,placeholder:$e(),onChange:e=>x({...v,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:S,open:S!==null,onOpenChange:e=>{e||C(null)}}),w?(0,Z.jsx)(On,{instance:w,onClose:()=>T(null)},w._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=N(I.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[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)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(En,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:Et({instance:e.displayName??e.name})}),(0,Z.jsx)(bn,{children:Ye()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=A(I.instanceSync.forceInstanceSync),n=W(),[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(T());break;case`no_agents`:n.success(u());break;case`no_bridge_url`:n.error(hn());break;case`deploy_misconfigured`:n.error(ke());break;case`unauthorized`:n.error(D());break;case`not_served`:n.error(x());break;default:n.error(oe());break}}catch(e){n.error(Pe(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Me():Fe()})})]})}function Ln({instance:e}){let t=N(I.bridgeAuth.listBridgeAuthStatus,{}),n=A(I.bridgeAuth.mintBridgeSecret),r=d(I.bridgeAuth.revokeBridgeSecret),i=W(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(g(),e)}finally{o(!1)}}}async function _(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(ye())}catch(e){i.error(g(),e)}finally{o(!1)}}}async function y(){if(s)try{await navigator.clipboard.writeText(s),f(!0)}catch{}}return(0,Z.jsxs)($,{label:me(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:m?`outline`:`secondary`,children:m?`${gt()} · ${p.prefix}…${p.lastFour}`:F()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?c():St()}),m?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:a,children:Tt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:v()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:u?ae():E()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),f(!1)},children:M()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=A(I.instanceSecrets.setInstanceSecret),a=d(I.instanceSecrets.clearInstanceSecret),o=A(I.deviceIdentity.generateDeviceIdentity),s=W(),[c,l]=(0,Y.useState)(``),[u,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?Yt():t===`deviceIdentity`?Lt():We();async function b(){if(!(!c.trim()||u)){f(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),m(null),g(!1),s.success(Ee())}catch(e){s.error(Be(),e)}finally{f(!1)}}}async function x(){if(!u){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(Ie())}catch(e){s.error(Be(),e)}finally{f(!1)}}}async function S(){if(!u){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(Gt())}catch(e){s.error(w(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function T(){if(C)try{await navigator.clipboard.writeText(C),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:_?`outline`:`secondary`,children:_?gt():F()}),(0,Z.jsx)(R,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?$t():Nt(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void b(),disabled:u||c.trim().length===0,children:rt()}),v?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:u,children:Re()}):null,_?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:u,children:i()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Gt()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:h?ae():E()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:M()})]}):null]})}var zn={conversational:jt,documentary:st,summarizer:se,curator:S},Bn={conversational:Vt,documentary:et,summarizer:O,curator:Ce},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({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:cn()}),t.map(e=>(0,Z.jsx)(H,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(wn,{children:[(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ue()})}),(0,Z.jsxs)(Tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:dt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:mt()}),(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)(vn,{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:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let i=N(I.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=d(I.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=d(I.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=d(I.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=d(I.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=d(I.agents.removeInstanceAgent),u=d(I.agents.setAgentReservation),f=N(I.groups.listGroupLabels,t?{}:`skip`),m=Cn(),h=W();async function g(t,n){if(e&&await m({title:Le({name:n}),description:k(),confirmLabel:P()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){h.error(j(),V(e))}}async function _(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await m({title:C({name:n,group:i}),description:we({group:i}),confirmLabel:ge()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){h.error(j(),V(e))}}async function v(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){h.error(j(),e)}}async function y(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){h.error(j(),e)}}async function b(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){h.error(j(),e)}}async function x(t,n){if(e&&await m({title:Xe({name:n}),description:Xt(),confirmLabel:Rt(),destructive:!0}))try{await l({instanceName:e,agentId:t}),h.success(Ge())}catch(e){h.error(j(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(En,{className:`oc-access`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:un({name:e??``})}),(0,Z.jsx)(bn,{children:p()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:_t()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?Kt():i.discovery.lastPollOk?Pt():en({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:it()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(t=>{let n=t.presentInLastOk===!1,a=i.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(vn,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void v(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(H,{variant:`outline`,children:t.reserved.groupName===null?ze():Te({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:ne()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void x(t.agentId,o),children:Dt()})]}):a?(0,Z.jsx)(H,{variant:`default`,children:r()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void y(t.agentId),children:rn()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void g(t.agentId,o),children:P()}),(0,Z.jsxs)(K,{value:``,onValueChange:e=>void _(t.agentId,o,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(U,{placeholder:Wt()})}),(0,Z.jsx)(J,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(G,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:s,onToggle:e=>void b(t.agentId,e,s)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){h.error(j(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(R,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Je(),"aria-label":pn(),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{Pn as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,AL as i,BY as a,CL as o,DL as s,EL as c,ML as l,OL as u,Qm as d,RY as f,SL as p,TL as m,VY as h,Xm as g,Zm as _,bL as v,eh as y,ih as b,jL as x,kL as S,nh as C,rh as w,t as T,th as E,wL as D,xL as O,yL as k}from"./api-DcB3BxUc.js";import{t as A}from"./button-DgaBsJDX.js";import{$t as j,Jt as M,Mt as N}from"./index-Ds-ybIOh.js";var P=t(e(),1),F=n();function I(){let e=h(T.integrations.status.status,{}),t=a(T.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let d=n,f=(e,t,n)=>r({...d,[e]:{...d[e],[t]:n}}),g=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,S()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:u()}):(0,F.jsx)(M,{variant:`outline`,children:s()}):(0,F.jsx)(M,{variant:`outline`,children:c()}),note:m(),children:[(0,F.jsx)(R,{label:o(),children:(0,F.jsx)(j,{value:d.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>g(`langfuse`,{host:d.langfuse.host??``})})}),(0,F.jsx)(z,{label:k(),checked:d.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),g(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:u()}):(0,F.jsx)(M,{variant:`outline`,children:s()}):(0,F.jsx)(M,{variant:`outline`,children:c()}),note:D(),children:[(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(j,{value:d.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>g(`opik`,{baseUrl:d.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:O(),children:(0,F.jsx)(j,{value:d.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||v(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>g(`opik`,{workspace:d.opik.workspace??``})})}),(0,F.jsx)(z,{label:k(),checked:d.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),g(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:u()}):(0,F.jsx)(M,{variant:`outline`,children:s()}):(0,F.jsx)(M,{variant:`outline`,children:b()}),note:w(),children:[(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(j,{value:d.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>g(`otlp`,{endpoint:d.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:k(),checked:d.otlp.enabled??!0,onChange:e=>{f(`otlp`,`enabled`,e),g(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=f(T.integrations.otlpSecret.setOtlpHeaders),n=a(T.integrations.otlpSecret.clearOtlpHeaders),[i,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),p=async()=>{u(!0),c(null);try{await t({headersJson:i}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:E(),children:[(0,F.jsx)(j,{value:i,placeholder:e?y():r(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||i.trim().length===0,onClick:()=>void p(),children:d()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:_()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:g()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BD as r,GD as i,HD as a,HR as o,ID as s,JD as c,KD as l,LD as u,RD as d,UD as f,VD as p,VY as m,WD as h,XD as g,YD as _,_R as v,gR as y,hR as ee,mR as b,oR as x,qD as te,sR as S,t as C,zD as w}from"./api-DcB3BxUc.js";import{dr as T,fr as E,ft as D,i as O,o as ne,r as re}from"./index-Ds-ybIOh.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-DnOLp6jN.js";import{n as P,t as F}from"./TimeRangePicker-BgJKavXM.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=m(C.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=m(C.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:o()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:v()}),(0,z.jsx)(M,{children:ee()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[x(),` p50 `,V(s.cP50),` `,y()]}),(0,z.jsxs)(`span`,{children:[S(),` p50 `,V(s.aP50),` `,y()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":v(),children:[(0,z.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:g(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:_(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:te(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:l(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:i(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:h(),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=O(e.from,e.to,re,`now`),i=e=>void t({search:t=>({...t,...ne(e)})}),{from:o,to:s}=P(n),{rowLimit:c,buckets:l}=Y(o,s),u=m(C.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]),h=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,z.jsx)(ae,{value:n,onChange:i})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:r()})]}):(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(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:w({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:d()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:u({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":s({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,$s as i,AW as a,BY as o,CW as s,CY as c,DW as l,EW as u,EY as ee,MW as d,NW as f,OW as p,PW as m,QU as te,Qs as h,SW as ne,SY as re,TW as ie,VY as g,XU as ae,YU as oe,ZU as se,Zs as ce,_W as le,_Y as ue,_c as de,aW as fe,aY as pe,bW as me,bY as he,cW as _,cY as ge,dW as v,dY as y,eW as b,eY as x,ec as S,fW as C,fY as w,fc as T,gW as E,gY as D,hW as O,hY as k,iW as A,iY as j,ic as M,jW as N,jY as P,kW as F,lW as I,lY as L,mW as _e,mY as ve,nW as R,nY as ye,nc as be,oW as xe,oY as Se,pW as Ce,pY as we,r as z,rW as Te,rY as Ee,rc as De,sW as Oe,sY as ke,t as B,tW as Ae,tY as je,tc as Me,uW as Ne,uY as Pe,vW as Fe,vY as Ie,vc as Le,wW as Re,xF as ze,xW as Be,xY as Ve,yW as He,yY as Ue}from"./api-DcB3BxUc.js";import{t as V}from"./button-DgaBsJDX.js";import{$t as H,H as We,Jt as U,Mt as W,Qt as Ge,St as Ke,Xt as qe,Yt as Je,Zt as Ye,bt as G,ft as K,t as Xe,vt as Ze,xt as Qe,yt as $e}from"./index-Ds-ybIOh.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-BkDGMdB2.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>m()},{id:`composer`,label:()=>f()},{id:`sidebar`,label:()=>d()},{id:`notifications`,label:()=>O()},{id:`other`,label:()=>N()}],X={showSource:{category:`messages`,label:()=>a(),help:()=>F()},showReport:{category:`messages`,label:()=>p(),help:()=>l()},copyAssistant:{category:`messages`,label:()=>u()},copyUser:{category:`messages`,label:()=>ie()},showDelete:{category:`messages`,label:()=>Re()},showTools:{category:`messages`,label:()=>s(),help:()=>ne()},voiceInput:{category:`composer`,label:()=>Be(),help:()=>me()},showUsage:{category:`composer`,label:()=>He(),help:()=>Fe()},autoReadAloud:{category:`composer`,label:()=>Le(),help:()=>de()},showChatAge:{category:`sidebar`,label:()=>le(),help:()=>E()},notifSound:{category:`notifications`,label:()=>_e(),help:()=>Ce()},notifSystem:{category:`notifications`,label:()=>C(),help:()=>v()},replySound:{category:`notifications`,label:()=>Ne(),help:()=>I()}};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:()=>r()};function ut({prefKey:e,ui:t}){let n=o(B.admin.setUiPrefDefault),r=o(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Te()}),(0,J.jsxs)(Ze,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Qe,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ke,{})}),(0,J.jsxs)($e,{children:[(0,J.jsx)(G,{value:`on`,children:se()}),(0,J.jsx)(G,{value:`off`,children:ae()}),(0,J.jsx)(G,{value:`inherit`,children:oe()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":R()}),R()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=o(B.me.setDictationShortcut),[r,a]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ye(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(c(!0),window.setTimeout(()=>c(!1),1800));return}a(!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:[M(),e?(0,J.jsx)(U,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:s?Me():r?be():De()})]}),(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:ce()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?h():e?i():S()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=g(B.me.getMe,{host:K}),a=i?.ui,s=$(i?.role)&&n,c=o(B.me.setUiPref).withOptimisticUpdate(We),l=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":A()}),A()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Ae()}),(0,J.jsx)(`p`,{children:b()}),(0,J.jsx)(`p`,{children:te()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Oe()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=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)(U,{variant:`outline`,children:xe()}):l?(0,J.jsx)(U,{variant:`secondary`,children:T()}):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 c({key:e,value:null}),children:fe()}):null,(0,J.jsx)(nt,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui: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:P()})}var pt={sm:()=>y(),md:()=>Pe(),lg:()=>L(),xl:()=>ge(),"2xl":()=>ke(),"3xl":()=>Se()};function mt(){let e=g(B.me.getMe,{host:K}),t=o(B.me.setLocale),n=o(B.me.setTimezone),r=o(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:K});n&&e.setQuery(B.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=o(B.me.setMyName),a=Je(),s=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await i({name:f}),d(null),a.success(Ue())}catch(e){a.error(Ie(),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:c()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:f,maxLength:120,placeholder:Ve(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:ze()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(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:ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(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:ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(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:pe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:j()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:Ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(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:ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Xe.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:je()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(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{AE as r,AT as i,BE as a,BY as o,DE as s,E as c,EE as l,FE as u,GE as d,HE as ee,IE as te,JE as f,KE as p,LE as ne,ME as m,NE as h,OE as g,PE as _,QE as v,RE as y,TE as re,To as ie,UE as ae,VE as oe,VY as b,WE as se,XE as ce,YE as le,ZE as ue,_D as de,_E as fe,dE as pe,eD as x,fD as S,fE as me,gE as C,hE as w,iD as he,jE as T,jY as E,lD as ge,mE as D,oD as O,pD as _e,pE as ve,rD as ye,t as k,uC as be,uD as xe,uE as Se,vD as Ce,wo as we,xE as Te,yD as Ee,yE as A,zE as De}from"./api-DcB3BxUc.js";import{r as Oe}from"./dist-D96qX4Zd.js";import{t as ke}from"./list-CKshqcfm.js";import{t as j}from"./button-DgaBsJDX.js";import{$n as Ae,$t as je,A as M,An as Me,Bn as N,C as P,D as Ne,E as Pe,Gn as Fe,I as Ie,Kn as Le,M as Re,N as ze,O as Be,P as F,Qn as Ve,S as He,T as Ue,Un as I,Vn as We,Xn as L,Yt as Ge,Zn as Ke,_ as qe,_t as Je,an as Ye,b as Xe,ct as Ze,d as Qe,dr as R,en as $e,er as et,f as tt,fr as nt,g as rt,gt as z,h as it,ht as B,in as at,j as V,k as ot,lt as st,mt as ct,nn as H,p as lt,pr as U,pt as ut,rn as dt,sr as ft,tn as pt,tr as mt,v as W,w as G,x as K,y as ht,zn as gt}from"./index-Ds-ybIOh.js";var _t=c(`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`}]]),vt=c(`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`}]]),yt=c(`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`}]]),q=c(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),J=t(e(),1),Y=n();function bt({className:e}){return(0,Y.jsx)(Ye,{asChild:!0,children:(0,Y.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":fe(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(mt,{})})})}function X({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let c=o(k.projects.renameProject),l=o(k.projects.setProjectColor),u=o(k.projects.moveProject),ee=o(k.projects.deleteProject),te=o(k.projects.createProject),f=Ze(),p=it(),ne=st(),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(t),[v,y]=(0,J.useState)(!1),[ie,ae]=(0,J.useState)(!1),oe=b(k.projects.projectTreeCount,ie?{projectId:e}:`skip`);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)($e,{onOpenChange:e=>e&&ae(!0),children:[(0,Y.jsx)(bt,{className:i}),(0,Y.jsxs)(pt,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(H,{onSelect:()=>a(),children:[(0,Y.jsx)(Ve,{}),` `,x()]}),(0,Y.jsxs)(H,{onSelect:()=>{_(t),h(!0)},children:[(0,Y.jsx)(We,{}),` `,C()]}),(0,Y.jsxs)(H,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await ne({title:d(),label:Ee(),placeholder:Ce(),confirmLabel:de()});t&&await te({name:t,parentId:e})})},children:[(0,Y.jsx)(Ke,{}),` `,d()]}),(0,Y.jsxs)(H,{onSelect:()=>y(!0),children:[(0,Y.jsx)(vt,{}),` `,s()]}),(0,Y.jsx)(dt,{children:ve()}),(0,Y.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":me(),children:`✕`}),qe.map(t=>(0,Y.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e,color:t.value})},t.value))]}),(0,Y.jsx)(at,{}),(0,Y.jsxs)(H,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=oe?.folders??0,r=oe?.chats??0;await f({title:ye({name:t}),description:lt({folders:n,chats:r,days:p}),confirmWord:A(),confirmLabel:he(),destructive:!0})&&await ee({projectId:e})})},children:[(0,Y.jsx)(Me,{}),` `,A()]})]})]}),(0,Y.jsx)(Xe,{open:m,onOpenChange:h,title:ge(),canSubmit:g.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:g.trim()}),h(!1)},submitLabel:C(),children:(0,Y.jsx)(je,{value:g,onChange:e=>_(e.target.value),autoFocus:!0})}),v?(0,Y.jsx)(rt,{open:v,onOpenChange:y,title:re(),movingFolderId:e,currentId:r,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function xt({chat:e,currentFolderId:t,className:n}){let r=o(k.chats.pinChat),a=o(k.chats.deleteChat),s=o(k.chats.renameChat),c=o(k.chats.setChatSidebar),u=o(k.chats.moveChatToProject),d=Ze(),ee=it(),[te,f]=(0,J.useState)(!1),[p,ne]=(0,J.useState)(e.title??``),[m,h]=(0,J.useState)(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)($e,{children:[(0,Y.jsx)(bt,{className:n}),(0,Y.jsxs)(pt,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(H,{onSelect:()=>{ne(e.title??``),f(!0)},children:[(0,Y.jsx)(We,{}),` `,C()]}),(0,Y.jsxs)(H,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Y.jsx)(gt,{}):(0,Y.jsx)(N,{}),e.pinned?w():D()]}),(0,Y.jsxs)(H,{onSelect:()=>h(!0),children:[(0,Y.jsx)(vt,{}),` `,g()]}),e.pinned&&e.inSidebar?null:(0,Y.jsxs)(H,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Y.jsx)(I,{}):(0,Y.jsx)(q,{}),e.inSidebar?ue():v()]}),(0,Y.jsx)(at,{}),(0,Y.jsxs)(H,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await d({title:pe(),description:Se({days:ee}),confirmLabel:A(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,Y.jsx)(Me,{}),` `,A()]})]})]}),(0,Y.jsx)(Xe,{open:te,onOpenChange:f,title:i(),canSubmit:p.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:C(),children:(0,Y.jsx)(je,{value:p,onChange:e=>ne(e.target.value),autoFocus:!0})}),m?(0,Y.jsx)(rt,{open:m,onOpenChange:h,title:l(),currentId:t,onPick:t=>void u({chatId:e._id,projectId:t})}):null]})}function St(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function Ct(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 wt(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 Tt=`oc.projpage.view`;function Et(){let e=localStorage.getItem(Tt);return e===`cards`||e===`list`?e:`columns`}var Z=e=>`into:${e}`,Dt=e=>`col:${e??`null`}`,Ot=e=>`crumb:${e}`;function kt(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 At(){let{projectId:e}=U({from:`/project/$projectId`}),t=R(),n=b(k.projects.projectPage,{projectId:e});return(0,Y.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:E()}):n===null?(0,Y.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Y.jsx)(`h2`,{children:h()}),(0,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:m()}),(0,Y.jsx)(j,{variant:`outline`,onClick:()=>void t({to:`/`}),children:T()})]}):(0,Y.jsx)(jt,{page:n})})}function jt({page:e}){let t=R(),n=Ze(),i=it(),c=st(),l=Ge(),m=o(k.projects.renameProject),h=o(k.projects.setProjectColor),g=o(k.projects.deleteProject),v=o(k.projects.createProject),y=o(k.projects.moveProject),ae=o(k.projects.setProjectSidebar),se=o(k.chats.moveChatToProject),ue=o(k.chats.reorderChat),fe=o(k.projects.reorderProject),pe=b(k.projects.projectTreeCount,{projectId:e.project._id}),[x,S]=(0,J.useState)(Et),w=e=>{localStorage.setItem(Tt,e),S(e)},T=b(k.projects.folderColumns,x===`columns`?{projectId:e.project._id}:`skip`),E=b(k.projects.projectTreeList,x===`list`?{projectId:e.project._id}:`skip`),{c:D}=nt({from:`/project/$projectId`}),O=b(k.projects.listProjects,{}),Se=b(k.chatReads.myBusyChats,{}),De=(0,J.useMemo)(()=>new Set(Se??[]),[Se]),{byChat:Oe}=Je(Se??null),N=b(k.chatReads.myChatReads,{}),P=(0,J.useMemo)(()=>wt(e.chats,N??[]),[e.chats,N]),{startNewChat:F,picker:Ve}=Qe(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[I,tt]=(0,J.useState)(``),[z,V]=(0,J.useState)(!1),[U,ft]=(0,J.useState)(e.project.name),[W,gt]=(0,J.useState)(!1),[q,bt]=(0,J.useState)(``);(0,J.useEffect)(()=>{let e=setTimeout(()=>bt(I.trim()),180);return()=>clearTimeout(e)},[I]);let X=b(k.search.searchConversations,q.length>=2?{query:q,projectId:e.project._id}:`skip`),xt=ze(Re(Ne,{activationConstraint:{distance:4}}),Re(Be,{activationConstraint:{delay:250,tolerance:8}})),Z=(0,J.useRef)(!1),Dt=()=>{Z.current=!0,setTimeout(()=>{Z.current=!1},0)},[Ot,At]=(0,J.useState)(null),jt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=T?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||_e()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(O??[]).find(t=>t._id===e)?.name??``}}return null},Q=e=>At(jt(String(e.active.id))),$=(0,J.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=M(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=M(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=M(n(`crumb:`));if(a.length>0)return a;let o=M(n(`col:`));return o.length>0?o:ot(n(t?`folder:`:`chat:`))},[]),It=t=>{if(x===`columns`){for(let e of T?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(x===`list`){let e=E?.chats.find(e=>e._id===t);return e?{list:E.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Lt=t=>{if(x===`columns`){for(let e of T?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(x===`list`){let e=E?.folders.find(e=>e._id===t);if(!e||!E)return null;let n=e.parentId??E.rootId;return{list:ct(E.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{At(null),Dt();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=kt(r);if(e!==void 0){if(a)await se({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ut(O??[],t,e)){l.error(p());return}await y({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=It(t);if(!n)return;n.list.some(t=>t._id===e)||await se({chatId:e,projectId:n.folderId});let a=Ct(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ue({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!ut(O??[],e,n.parentId)){l.error(p());return}await y({projectId:e,parentId:n.parentId})}let a=Ct(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await fe({projectId:e,...a});return}}catch{l.error(p())}},[,Bt]=(0,J.useState)(0);(0,J.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=ht(e.project),Ut=St(e.chats,I),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{Z.current||e()};return(0,Y.jsx)(B.Provider,{value:Oe,children:(0,Y.jsxs)(Ue,{sensors:xt,collisionDetection:$,onDragStart:Q,onDragEnd:zt,children:[(0,Y.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,Y.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":r(),children:[Wt.map(e=>(0,Y.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Y.jsx)(Mt,{folderId:e._id,children:(0,Y.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Y.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Y.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Y.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Y.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Y.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Y.jsxs)(j,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:ie(),onClick:()=>{ae({projectId:e.project._id,hidden:!1})},children:[(0,Y.jsx)(et,{"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:we()}),(0,Y.jsx)(Ae,{"aria-hidden":!0})]}):null,(0,Y.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Y.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":ce(),children:[(0,Y.jsx)(j,{variant:x===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ce(),title:ce(),"aria-pressed":x===`cards`,onClick:()=>w(`cards`),children:(0,Y.jsx)(yt,{})}),(0,Y.jsx)(j,{variant:x===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":le(),title:le(),"aria-pressed":x===`columns`,onClick:()=>w(`columns`),children:(0,Y.jsx)(_t,{})}),(0,Y.jsx)(j,{variant:x===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":f(),title:f(),"aria-pressed":x===`list`,onClick:()=>w(`list`),children:(0,Y.jsx)(ke,{})})]}),(0,Y.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void F({projectId:e.project._id}),children:[(0,Y.jsx)(Le,{}),a()]}),(0,Y.jsxs)(j,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await c({title:d(),label:Ee(),placeholder:Ce(),confirmLabel:de()});t&&await v({name:t,parentId:e.project._id})},children:[(0,Y.jsx)(Ke,{}),d()]}),(0,Y.jsxs)($e,{children:[(0,Y.jsx)(Ye,{asChild:!0,children:(0,Y.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":xe(),children:(0,Y.jsx)(mt,{})})}),(0,Y.jsxs)(pt,{align:`end`,className:`w-48`,children:[(0,Y.jsxs)(H,{onSelect:()=>{ft(e.project.name),V(!0)},children:[(0,Y.jsx)(We,{}),` `,C()]}),(0,Y.jsxs)(H,{onSelect:()=>gt(!0),children:[(0,Y.jsx)(vt,{}),` `,s()]}),(0,Y.jsx)(dt,{children:ve()}),(0,Y.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Y.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void h({projectId:e.project._id,color:null}),"aria-label":me(),children:`✕`}),qe.map(t=>(0,Y.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void h({projectId:e.project._id,color:t.value})},t.value))]}),(0,Y.jsx)(at,{}),(0,Y.jsxs)(H,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let a=pe?.folders??0,o=pe?.chats??0;await n({title:ye({name:e.project.name}),description:lt({folders:a,chats:o,days:i}),confirmWord:A(),confirmLabel:he(),destructive:!0})&&(await g({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Y.jsx)(Me,{}),` `,A()]})]})]})]})]}),x===`columns`?(0,Y.jsx)(Rt,{data:T,currentId:e.project._id,busyIds:De,suppressClick:Z,locateChatId:D??null}):x===`list`?(0,Y.jsx)(Ft,{data:E,busyIds:De,suppressClick:Z,locateChatId:D??null}):(0,Y.jsxs)(Y.Fragment,{children:[e.children.length>0?(0,Y.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Y.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),(0,Y.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Y.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:He,children:e.children.map(t=>(0,Y.jsx)(Nt,{child:t,parentId:e.project._id,now:Vt,suppressClick:Z},t._id))})})]}):null,(0,Y.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Y.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:oe()}),e.chats.length>0?(0,Y.jsx)(je,{value:I,onChange:e=>tt(e.target.value),placeholder:ne(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?u():_()}):Ut.length===0&&(X??[]).length===0?(0,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:te({term:I.trim()})}):(0,Y.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Y.jsx)(K,{items:Ut.map(e=>`chat:${e._id}`),strategy:G,children:Ut.map(t=>(0,Y.jsx)(Pt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:De.has(t._id),unread:P.has(t._id),locate:t._id===D,suppressClick:Z},t._id))})})]}),q.length>=2&&X!==void 0?(0,Y.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Y.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:Te()}),X.length===0?(0,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:te({term:q})}):(0,Y.jsx)(`ul`,{className:`oc-projpage__chats`,children:X.map(e=>(0,Y.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&q&&Ie(e.messageId,q),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Y.jsx)(Fe,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Y.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Y.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||be()}),e.projectPath&&e.projectPath.length>1?(0,Y.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Y.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Y.jsx)(Xe,{open:z,onOpenChange:V,title:ge(),canSubmit:U.trim().length>0,onSubmit:async()=>{await m({projectId:e.project._id,name:U.trim()}),V(!1)},submitLabel:C(),children:(0,Y.jsx)(je,{value:U,onChange:e=>ft(e.target.value),autoFocus:!0})}),W?(0,Y.jsx)(rt,{open:W,onOpenChange:gt,title:re(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void y({projectId:e.project._id,parentId:t})}):null,Ve]}),(0,Y.jsx)(Pe,{children:Ot?(0,Y.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ot.kind===`folder`?(0,Y.jsx)(L,{size:13,"aria-hidden":!0}):(0,Y.jsx)(Fe,{size:13,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:Ot.label})]}):null})]})})}function Mt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=V({id:Ot(e)});return(0,Y.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Nt({child:e,parentId:t,now:n,suppressClick:r}){let i=R(),a=P({id:`folder:${e._id}`}),o=V({id:Z(e._id)});return(0,Y.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":ht(e),transform:F.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,Y.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Y.jsx)(L,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Y.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Y.jsx)(X,{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,Y.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?De({count:e.folderCount})+` · `:``,y({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Y.jsx)(`span`,{className:`oc-projpage__cardage`,children:tt(e.lastActivityAt,n)})]})}function Q({chat:e}){let t=o(k.chats.setChatSidebar),n=e.inSidebar?ue():v();return(0,Y.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Y.jsx)(I,{}):(0,Y.jsx)(q,{})})}function Pt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,J.useContext)(B).get(e._id),c=R(),l=W(e.color),u=P({id:`chat:${e._id}`}),d=$(a);return(0,Y.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:F.Transform.toString(u.transform),transition:u.transition},children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,Y.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Y.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Y.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||_e()}),e.pinned?(0,Y.jsx)(N,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Y.jsx)(`span`,{className:`oc-projpage__chatage`,children:tt(e.updatedAt,n)}),r?(0,Y.jsx)(`span`,{className:z(s,S()).className,title:z(s,S()).label,"aria-label":z(s,S()).label}):null,i&&!r?(0,Y.jsx)(`span`,{className:`oc-chatitem__unread`,title:O(),"aria-label":O()}):null]}),(0,Y.jsx)(Q,{chat:e}),(0,Y.jsx)(xt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function $(e){let t=(0,J.useRef)(null);return(0,J.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ft({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,J.useState)(new Set),o=(0,J.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,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:E()});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=ct(e.folders,a);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:G,children:u.map(e=>(0,Y.jsx)(Lt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Y.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:G,children:d.map(t=>(0,Y.jsx)(It,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Y.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&ct(e.folders,null).length===0?(0,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:u()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=R(),c=P({id:`folder:${e._id}`}),l=V({id:Z(e._id)});return(0,Y.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Y.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":ht(e),transform:F.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Y.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?se():ae(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Y.jsx)(ft,{size:13}):(0,Y.jsx)(Oe,{size:13})}),(0,Y.jsx)(L,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Y.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Y.jsx)(X,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,J.useContext)(B).get(e._id),o=R(),s=P({id:`chat:${e._id}`}),c=$(r),l=W(e.color);return(0,Y.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:F.Transform.toString(s.transform),transition:s.transition},children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,Y.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Y.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Y.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||_e()}),n?(0,Y.jsx)(`span`,{className:z(a,``).className,"aria-hidden":!0}):null]}),(0,Y.jsx)(xt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Y.jsx)(Q,{chat:e})]})}function Rt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,J.useRef)(null);return(0,J.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Y.jsx)(`p`,{className:`oc-projpage__hint`,children:E()}):(0,Y.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Y.jsx)(zt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function zt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=R(),s=V({id:Dt(e.folderId)});return(0,Y.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Y.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:G,children:e.folders.map(t=>(0,Y.jsx)(Bt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Y.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:G,children:e.chats.map(t=>(0,Y.jsx)(Vt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Y.jsx)(`p`,{className:`oc-projpage__colempty`,children:_()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=P({id:`folder:${e._id}`}),o=V({id:Z(e._id)});return(0,Y.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":ht(e),transform:F.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,Y.jsx)(L,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Y.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Y.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Y.jsx)(X,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,J.useContext)(B).get(e._id),s=P({id:`chat:${e._id}`}),c=$(r),l=W(e.color);return(0,Y.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:F.Transform.toString(s.transform),transition:s.transition},children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,Y.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Y.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Y.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||_e()}),n?(0,Y.jsx)(`span`,{className:z(o,``).className,"aria-hidden":!0}):null]}),(0,Y.jsx)(xt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Y.jsx)(Q,{chat:e})]})}export{At as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BY as r,Bd as i,Bp as a,Ck as o,Dk as s,Ek as c,Hp as l,Id as u,Ik as d,Jd as f,Ld as p,Lk as m,Ok as h,Rd as g,Rp as _,Sk as v,Tk as ee,VY as y,Vp as te,Xd as ne,Yd as b,_k as x,au as S,bk as C,dk as w,fk as T,gk as re,hk as ie,kk as ae,mk as oe,ou as se,pk as ce,qd as E,su as D,t as O,uk as k,vk as A,wk as j,xk as M,xo as N,yk as P,zd as F,zp as I}from"./api-DcB3BxUc.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-CZ-m3Yh8.js";import{t as V}from"./button-DgaBsJDX.js";import{Mt as H,St as U,Yt as W,bt as G,ft as le,gn as ue,hn as de,mn as fe,pn as K,vt as q,xt as J,yt as Y}from"./index-Ds-ybIOh.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:j,help:o},documentary_fetch:{label:v,help:M},inbound_files:{label:C,help:P},history_summary:{label:l,help:te},file_curation:{label:ne,help:i},quote_reply:{label:b,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:T,references:w,files:k,previous_summary:a,new_messages:I,max_chars:_,file_name:F,budget_chars:g,feedback:p,content:u,excerpt:E};function _e(){let e=y(O.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:x()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(R,{label:ae(),help:h()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:A()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(U,{})}),(0,$.jsx)(Y,{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=r(O.admin.upsertInstanceConfig),n=W(),i=y(O.me.getMe,{host:le}),a=e.config??{},o=X(e.config?.contentLocale,i?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>L(a,o));(0,Q.useEffect)(()=>{c(L(a,o))},[o,e._id]);let[l,u]=(0,Q.useState)(!1),f=s.promptInjections,p=(e,t)=>c({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function h(){u(!0);try{await t({instanceId:e._id,config:z(s,a,o)})}catch(e){n.error(d(),e)}finally{u(!1)}}async function g(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(d(),e)}}let _=e.config?.contentLocale??`default`,v=Z[X(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:D()}),(0,$.jsxs)(q,{value:_,onValueChange:e=>void g(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(U,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:S({locale:v})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()})]}),fe.map(e=>(0,$.jsx)(ye,{injKey:e,def:K[e],i18n:me[e],row:f[e]??{enabled:!0,template:K[e].defaultTemplate[o]},contentLocale:o,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(V,{size:`sm`,onClick:()=>void h(),disabled:l,children:m()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,l]=(0,Q.useState)(!1),u=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=de(e,r,i),m=p?ue(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(H,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:c()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,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:ee()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:o?ie():re()}),u&&(0,$.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:s()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:oe()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:N()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ce()})})]})}export{_e as PromptInjectionsTab};
|