@lacneu/atrium 0.94.0 → 0.95.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-e1oO1Kpt.js → AccessTab-rdS2LHXZ.js} +1 -1
- package/dist/assets/{AdvancedFilter-C5uNd2Bh.js → AdvancedFilter-CsTovdEV.js} +1 -1
- package/dist/assets/AgentFilesTab-EiYd8sjW.js +3 -0
- package/dist/assets/AnomaliesTab-p18K7yDf.js +1 -0
- package/dist/assets/{AuditTab-DnmCZyK0.js → AuditTab-5GcRAHVs.js} +1 -1
- package/dist/assets/BridgeTab-BxbQafxo.js +1 -0
- package/dist/assets/ChatDefaultsTab-DTrqvYQI.js +1 -0
- package/dist/assets/{DataTableShell-DwnJt663.js → DataTableShell-B1MSVaC4.js} +1 -1
- package/dist/assets/DeletedChatsTab-CjNUgEJg.js +1 -0
- package/dist/assets/{DetailChips-Bqvq37y3.js → DetailChips-DC3_vSvJ.js} +1 -1
- package/dist/assets/FeedbacksTab-B2FSw5a3.js +1 -0
- package/dist/assets/{FieldLabel-By4I98vO.js → FieldLabel-DqPoFgwl.js} +1 -1
- package/dist/assets/FilesTab-Bz5CxvQd.js +1 -0
- package/dist/assets/{FilterBar-CF8kYMRM.js → FilterBar-BTpxyiRB.js} +1 -1
- package/dist/assets/GroupsTab-BIg7zbLb.js +1 -0
- package/dist/assets/InstancesTab-7JRlmEtj.js +1 -0
- package/dist/assets/IntegrationsTab-ri9XV9Ja.js +1 -0
- package/dist/assets/KpiTab-Ducybaoz.js +1 -0
- package/dist/assets/PreferencesTab-CRKH1-vP.js +1 -0
- package/dist/assets/ProjectPage-Dz-lBZwU.js +1 -0
- package/dist/assets/PromptInjectionsTab-C9tVh14s.js +4 -0
- package/dist/assets/RolesTab-BkSk3dhm.js +1 -0
- package/dist/assets/ScheduledTab-DLqi_pHx.js +1 -0
- package/dist/assets/ServiceAccountsTab-xZmekdfT.js +1 -0
- package/dist/assets/{SubAgentReportsTab-CVjHV3k3.js → SubAgentReportsTab-BeCpOep_.js} +1 -1
- package/dist/assets/ThemeShowroom-CnfchF4y.js +1 -0
- package/dist/assets/{TimeRangePicker-CJYL4VHt.js → TimeRangePicker-BXoSfz3D.js} +1 -1
- package/dist/assets/{TimezoneCombobox-aXaP7rD1.js → TimezoneCombobox-DXjoNwGk.js} +1 -1
- package/dist/assets/TracesTab-apOnGu2I.js +1 -0
- package/dist/assets/{TrashTab-DGhhw1nk.js → TrashTab-Av3nukrj.js} +1 -1
- package/dist/assets/UsersTab-CQWnOuHY.js +1 -0
- package/dist/assets/VoiceTab-B5m_KO_S.js +1 -0
- package/dist/assets/api-ZghOy9gS.js +44 -0
- package/dist/assets/{button-DezjmYbu.js → button-kCamrfzR.js} +1 -1
- package/dist/assets/{card-BAJ3t3W_.js → card-CC1ag_mw.js} +1 -1
- package/dist/assets/chevrons-up-down-Btm4pQFN.js +1 -0
- package/dist/assets/{compatView-Dvj8v6B1.js → compatView-BC1dh2j7.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CMB-D8cW.js → dispatchErrorInfo-DBBnWn64.js} +1 -1
- package/dist/assets/{dist-Bc12EMPB.js → dist-Bz_kht3B.js} +1 -1
- package/dist/assets/{dist-C5rZMbyx.js → dist-CzXQ0eKG.js} +1 -1
- package/dist/assets/{dist-Dr_uf2Zj.js → dist-DZI3tM10.js} +1 -1
- package/dist/assets/{dist-ByQjzb4c.js → dist-Rn9r4nGi.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-VwnHPenC.js → highlighted-body-OFNGDK62-KyHtemyk.js} +1 -1
- package/dist/assets/index-B9R4HSNT.css +1 -0
- package/dist/assets/index-nxFP6zJZ.js +446 -0
- package/dist/assets/{list-ZFvO2UcJ.js → list-DcO3n-3W.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DLup0npw.js +1 -0
- package/dist/assets/{pdf-Bd95xs3Y.js → pdf-CkIYBhfa.js} +1 -1
- package/dist/assets/roleDescriptions-D9G4WSSN.js +1 -0
- package/dist/assets/{table-CFBr2AAN.js → table-BpXBaCrR.js} +1 -1
- package/dist/assets/{trashPage-BqqZxj7Y.js → trashPage-CIk8ugRC.js} +1 -1
- package/dist/assets/{use_paginated_query-DudXPi-Q.js → use_paginated_query-B_mVv9z5.js} +1 -1
- package/dist/assets/x-SeWtpTcs.js +1 -0
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-CVPwLabk.js +0 -3
- package/dist/assets/AnomaliesTab-CMpr27cm.js +0 -1
- package/dist/assets/BridgeTab-jBNctrlU.js +0 -1
- package/dist/assets/ChatDefaultsTab-B1R8mNGT.js +0 -1
- package/dist/assets/DeletedChatsTab-CUYou45F.js +0 -1
- package/dist/assets/FeedbacksTab-kXnXbbVP.js +0 -1
- package/dist/assets/FilesTab-KT8K2maS.js +0 -1
- package/dist/assets/GroupsTab-DSSQpFHq.js +0 -1
- package/dist/assets/InstancesTab-B1Y94Uie.js +0 -1
- package/dist/assets/IntegrationsTab-TSHIMAL3.js +0 -1
- package/dist/assets/KpiTab-togCNUmK.js +0 -1
- package/dist/assets/PreferencesTab-1S_si1gy.js +0 -1
- package/dist/assets/ProjectPage-B9JozdRF.js +0 -1
- package/dist/assets/PromptInjectionsTab-CghQSVr3.js +0 -4
- package/dist/assets/RolesTab-3XteVLq6.js +0 -1
- package/dist/assets/ScheduledTab-DrVTzZOx.js +0 -1
- package/dist/assets/ServiceAccountsTab-D05m7KHe.js +0 -1
- package/dist/assets/ThemeShowroom-ClbTxkxV.js +0 -1
- package/dist/assets/TracesTab-BK8h5goK.js +0 -1
- package/dist/assets/UsersTab-DTJ_fACy.js +0 -1
- package/dist/assets/VoiceTab-3l8kseDh.js +0 -1
- package/dist/assets/api-Da6_RPKW.js +0 -44
- package/dist/assets/chevrons-up-down-BJ8yWoBT.js +0 -1
- package/dist/assets/index-BcCFgPG0.js +0 -446
- package/dist/assets/index-FQ76yiuA.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-D9U6tQ7N.js +0 -1
- package/dist/assets/roleDescriptions-m4nebceN.js +0 -1
- package/dist/assets/x-jEbKIC4W.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-ZghOy9gS.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-ZghOy9gS.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{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-
|
|
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-ZghOy9gS.js";import{t as l}from"./button-kCamrfzR.js";import{An as u,In as d,ct as f,kt as p,m}from"./index-nxFP6zJZ.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};
|
|
@@ -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{aX as n,cX as r,hX as i,pX as a,tX as o}from"./api-ZghOy9gS.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,_=r(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(i(g)),_,u.initialNumItems,m]),[y,b]=(0,s.useState)(v),x=y;(r(e)!==r(y.query)||JSON.stringify(i(g))!==JSON.stringify(i(y.args))||m!==y.skip)&&(x=v(),b(x));let S=n().logger,C=o(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-ZghOy9gS.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-nxFP6zJZ.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-ZghOy9gS.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Rn9r4nGi.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Bz_kht3B.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CzXQ0eKG.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DZI3tM10.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/x-SeWtpTcs.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/button-kCamrfzR.js">
|
|
74
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B9R4HSNT.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.95.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,FY as u,F_ as d,Fd as f,HY as p,I_ as m,M_ as h,Md as g,NY as _,N_ as v,Nd as y,O_ as b,P_ as x,Pd as S,Qd as C,S_ as w,Sv as T,T_ as E,UY as D,WB as O,Zd as k,__ as A,_f as j,af as M,b_ as N,bv as ee,c_ as P,cf as F,d_ as I,df as L,ef as R,f_ as z,ff as B,g_ as te,gf as V,h_ as H,hf as U,if as W,j_ as ne,jd as re,k_ as ie,kd as ae,l_ as G,lf as K,m_ as oe,mf as se,nf 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 q,tf as ge,u_ as _e,uf as ve,v_ as ye,w_ as be,x_ as xe,y_ as Se}from"./api-Da6_RPKW.js";import{t as J}from"./button-DezjmYbu.js";import{Bt as Ce,Ct as we,Dt as Te,Gt as Ee,Ht as De,Jt as Oe,Kt as ke,Ot as Ae,St as je,Tt as Me,Ut as Ne,Vt as Pe,Wt as Fe,Yt as Y,bt as Ie,ft as Le,kn as Re,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-BcCFgPG0.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-Dvj8v6B1.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=D(q.me.getMe,{host:Le}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=D(q.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[t,r,a]);let f=D(q.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),p=D(q.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),g=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||f===void 0?r!==void 0&&r.length===0?[]:void 0:f.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(p!==void 0)return p.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,f,r,p]),[y,S]=(0,X.useState)(null);(0,X.useEffect)(()=>{!g||g.length===0||(!y||!g.some(e=>$(e)===y))&&S($(g[0]))},[g,y]);let C=g?.find(e=>$(e)===y)??null,w=o(q.agentFiles.listAgentFiles),[T,O]=(0,X.useState)({status:`idle`}),k=C?.instanceName??null,A=C?.agentId??null,j=D(q.compat.forInstance,n&&k!==null?{instanceName:k}:`skip`),M=n&&k!==null?ze(j,`agentFiles`):null,N=M===null?!1:M===`loading`?null:M.blocked,P=(0,X.useCallback)(async()=>{if(!(k===null||A===null)){O({status:`loading`});try{O({status:`done`,files:(await w({instanceName:k,agentId:A})).files})}catch(e){O({status:`error`,dashboardAbsent:tt(e)})}}},[w,k,A]);(0,X.useEffect)(()=>{N===!1&&P()},[P,N]);let[F,I]=(0,X.useState)(null),L=D(q.agentFileCuration.listCurations,t&&k!==null&&A!==null?{instanceName:k,agentId:A}:`skip`),R=D(q.agentFileCuration.curationSettings,t&&k!==null?{instanceName:k}:`skip`),z=o(q.agentFileCuration.requestCuration),[te,V]=(0,X.useState)(null),[H,U]=(0,X.useState)(null),{toast:W}=Y(),re=(0,X.useMemo)(()=>{let e=new Map;for(let t of L??[])e.has(t.name)||e.set(t.name,t);return e},[L]),ae=(0,X.useCallback)(async e=>{if(!(k===null||A===null)){V(e);try{let t=await z({instanceName:k,agentId:A,name:e,trigger:`manual`});t.ok?W({title:se(),variant:`success`}):W({title:de({reason:t.reason??`unknown`}),variant:`error`})}catch{W({title:B(),variant:`error`})}finally{V(null)}}},[z,k,A,W]),G=u(),K=(0,X.useMemo)(()=>new Intl.NumberFormat(G,{maximumFractionDigits:0}),[G]);return e===void 0||g===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ve,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":d(),children:(0,Q.jsx)(je,{})}),(0,Q.jsx)(We,{children:(r??[]).map(e=>(0,Q.jsx)(Ie,{value:e.name,children:e.name},e.name))})]}):null,g.length>0?(0,Q.jsxs)(Ve,{value:y??``,onValueChange:e=>S(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":x(),children:(0,Q.jsx)(je,{})}),(0,Q.jsx)(We,{children:g.map(e=>(0,Q.jsx)(Ie,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}),C===null?null:M===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):M!==null&&M.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Re,{size:14,"aria-hidden":!0}),` `,qe(M.gatewayVersion,M.provider)]}):T.status===`loading`||T.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):T.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[T.dashboardAbsent?he():ne(),` `,!T.dashboardAbsent&&(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void P(),children:ee()})]}):T.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(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)(Oe,{variant:`outline`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ie({size:Z(e.size,G)})}),(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:b({pct:K.format(n)})}),r?(0,Q.jsx)(Re,{size:14,className:`oc-afiles__warn`,"aria-label":c()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>I(e),children:t?E():be()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:R?.budgetChars??null,enabled:R?.enabled??!1,curation:re.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void ae(e.name),onReview:e=>U(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:l({used:Z(Qe(T.files),G),total:Z(Ye,G),pct:K.format(Ze(Qe(T.files)))})})]}),F&&C?(0,Q.jsx)(at,{instanceName:C.instanceName,agentId:C.agentId,name:F.name,isAdmin:t,onClose:()=>I(null),onSaved:()=>void P()}):null,H?(0,Q.jsx)(ot,{curationId:H,onClose:()=>U(null),onApplied:()=>{U(null),P()}}):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)(J,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:V()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Oe,{variant:`outline`,className:`oc-afiles__curate-status`,children:U()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:j()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=o(q.agentFiles.getAgentFile),l=o(q.agentFiles.setAgentFile),d=Y(),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[C,E]=(0,X.useState)(!1),[D,k]=(0,X.useState)(!1),j=(0,X.useCallback)(async r=>{h(!1);try{let i=await c({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||v(i.content),E(!1)}catch{h(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{j(!1)},[j]);async function M(){if(f!==null){S(!0),k(!1);try{await l({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:f.updatedAtMs??void 0}),d.success(A({name:n})),a(),await j(!1)}catch(e){nt(e)?E(!0):k(!0)}finally{S(!1)}}}let F=f!==null&&g!==f.content,L=(0,X.useMemo)(()=>f===null?null:et(f.content,g),[f,g]),R=g.length>Je,B=u(),V=(0,X.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(we,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(He,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ae,{children:s({name:n})}),(0,Q.jsxs)(Me,{children:[w({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,xe()]})]})]}),m?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[H(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void j(!1),children:ee()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!r,spellCheck:!1,onChange:e=>v(e.target.value),"aria-label":s({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:N()}),C?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[oe(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void j(!0),children:ue()})]}):null,D?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:te()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${R?` is-over`:``}`,children:Se({count:V.format(g.length),max:V.format(Je)})}),r?(0,Q.jsx)(J,{size:`sm`,disabled:!F||x||C,onClick:()=>b(!0),children:x?T():ye()}):null]})]}),(0,Q.jsx)(Ce,{open:y,onOpenChange:b,children:(0,Q.jsxs)(Ne,{children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Be,{children:z({name:n})}),(0,Q.jsx)(Fe,{children:I({agent:t})})]}),L?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:_e({added:L.added,removed:L.removed})}),L.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:G()}),L.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,L.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:P()}),L.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(De,{children:O()}),(0,Q.jsx)(Pe,{onClick:()=>void M(),children:pe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=D(q.agentFileCuration.getProposal,{curationId:e}),s=o(q.agentFileCuration.approveCuration),c=p(q.agentFileCuration.rejectCuration),{toast:l}=Y(),[d,m]=(0,X.useState)(null),[h,v]=(0,X.useState)(!1),[b,x]=(0,X.useState)(``),w=u(),E=(0,X.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function O(){m(`approve`);try{let t=await s({curationId:e});t.ok?(l({title:L(),variant:`success`}),n()):l({title:t.reason===`conflict`?K():F({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:B(),variant:`error`})}finally{m(null)}}async function A(n){m(`reject`);try{let r=b.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?a():ve(),variant:`success`}):l({title:M(),variant:`error`}),t()}catch{l({title:B(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(we,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(He,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ae,{children:i?me({name:i.name}):_()}),(0,Q.jsx)(Me,{children:le()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[W({before:Z(i.beforeSize,w),after:Z(i.proposedSize,w)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Re,{size:13,"aria-hidden":!0}),` `,fe()]}):null]}),E?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ce({added:E.added,removed:E.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ae({feedback:i.feedback})}):null,E&&E.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:k()}),(0,Q.jsx)(`ul`,{children:E.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:C()}),(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})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:f()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:S(),value:b,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>v(!1),disabled:d!==null,children:y()}),(0,Q.jsx)(J,{variant:`outline`,onClick:()=>void A(!1),disabled:d!==null,children:d===`reject`?T():g()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void A(!0),disabled:d!==null,children:d===`reject`?T():re()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>v(!0),disabled:d!==null||i==null,children:R()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void O(),disabled:d!==null||i==null,children:d===`approve`?T():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,BM as a,CM as ee,DM as te,EM as ne,FM as re,HY as ie,IM as o,Jj as s,Kj as c,LM as ae,MM as oe,NM as se,OM as ce,PM as le,Qj as l,RM as ue,SM as de,TM as fe,UY as u,VM as d,Xj as f,Yj as p,Zj as m,_M as pe,aM as h,bM as g,cM as _,dM as v,eM as me,fM as he,gM as ge,hM as _e,iM as ve,jM as ye,kM as be,lM as xe,mM as Se,nM as Ce,oM as we,pM as y,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-Da6_RPKW.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 Oe,i as ke,o as Ae,vt as z,wt as B,xt as V,yt as H}from"./index-BcCFgPG0.js";import{n as je}from"./TimeRangePicker-CJYL4VHt.js";import{t as Me}from"./FilterBar-CF8kYMRM.js";import{t as Ne}from"./DataTableShell-DwnJt663.js";import{t as U}from"./dispatchErrorInfo-CMB-D8cW.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.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 J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?d():e===`acknowledged`?a():A()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],Re={kind:`relative`,from:`now-30d`,to:`now`},ze=200,X=`all`;function Z(){let e=De({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,r=e.status===X?Y:e.status,a=e.severity??Y,s=e.kind??Y,[c,l]=(0,W.useState)(Y),d=ke(e.from,e.to),{from:f,to:p}=je(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),b=e=>void t({search:t=>({...t,status:e===Y?X:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),N=e=>void t({search:t=>({...t,...Ae(e)})}),F=Ee(),B=Te(),U=ie(C.anomalies.resolveAnomaly),G=(u(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),K=u(C.anomalies.listAnomalies,{limit:ze,filter:{q:n||void 0,from:f,to:p,anomalyStatus:r===Y?void 0:r,severity:a===Y?void 0:a,source:c===Y?void 0:c,kind:s===Y?void 0:s}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Z=n!==``||r!==`open`||a!==Y||c!==Y||s!==Y||d.kind!==`relative`||d.from!==Re.from;function Q(){l(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:ue(),description:(0,J.jsxs)(J.Fragment,{children:[ae(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,o(),` `,(0,J.jsx)(`strong`,{children:re()}),`.`,` `,le()]}),confirmLabel:se()}))try{await U({anomalyId:e._id,status:`resolved`}),B.success(oe(),e.kind)}catch(e){B.error(ye(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),B.success(i(),e.kind)}catch(e){B.error(be(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ce(),` `,(0,J.jsx)(`strong`,{children:te()}),` `,ne(),` `,(0,J.jsx)(`strong`,{children:fe()}),` `,D(),` `,(0,J.jsx)(`strong`,{children:ee()}),` `,de(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:O()})]}),(0,J.jsxs)(Me,{q:n,onQChange:m,searchPlaceholder:g(),timeRange:d,onTimeRangeChange:N,onReset:Q,canReset:Z,children:[(0,J.jsxs)(z,{value:r,onValueChange:b,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:k()}),Pe.map(e=>(0,J.jsx)(L,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(z,{value:a,onValueChange:A,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:E()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:Se()}),Ie.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:c,onValueChange:l,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:y()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:he()}),Le.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:s,onValueChange:M,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:v()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:T()}),q.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:xe(),rows:K,emptyHint:r===`open`?_():S(),rowActions:e=>G&&e.status===`open`?[{label:we(),onSelect:()=>void We(e)},{label:h(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ve(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:pe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:_e({when:j(e.firstAt)}),children:ge({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:E(),cell:e=>(0,J.jsx)($,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:x(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:y(),cell:e=>(0,J.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:Ce(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Ve,{row:e})]}),sort:e=>e.message},{header:w(),cell:e=>(0,J.jsx)(Be,{row:e}),sort:e=>e.evidence??null},{header:me(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Be({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=Q(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,r()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,r()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let i=U(n.dominantCode,n.context),a=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:i.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:i.hint}),a?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:a,limit:100}}),children:[`↗ `,r()]}):null]})}function Ve({row:e}){let[t,n]=(0,W.useState)(!1),r=u(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[l(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(M,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(N,{children:(0,J.jsx)(F,{children:m()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:p()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function $({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(P,{variant:`destructive`,children:s()}):e===`acknowledged`?(0,J.jsx)(P,{variant:`secondary`,children:b()}):(0,J.jsx)(P,{variant:`outline`,children:c()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -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,BO as a,BY as o,Bg as s,Bk as c,CO as l,DO as u,E as d,EO as f,FO as p,GO as m,Gg as h,Gk as g,HO as _,HY as ee,Hg as v,Hk as te,IO as y,Ik as ne,JO as b,Jg as re,Jl as ie,KO as ae,Kg as oe,Kk as se,LO as ce,Lk as le,MO as ue,Mg as de,Mk as fe,NO as pe,Nk as me,OO as he,PO as ge,QO as _e,RO as ve,Rg as ye,Rk as be,SO as xe,TO as Se,UO as Ce,UY as x,Ug as we,Uk as Te,VO as S,Va as Ee,Vg as De,Vk as Oe,WO as ke,Wg as Ae,XO as je,Xg as Me,Xl as Ne,YO as Pe,Yg as Fe,Yl as Ie,ZO as Le,Zl as Re,_O as ze,ak as Be,bO as Ve,ck as He,cs as Ue,ek as We,eu as Ge,fO as C,gO as Ke,hO as qe,ik as Je,jO as Ye,kO as Xe,lk as Ze,mO as Qe,nk as $e,ok as et,pO as w,qO as tt,qg as nt,ql as rt,rk as it,sk as at,t as T,tk as ot,uk as st,vO as ct,wO as lt,xO as ut,yO as dt,zO as ft,zg as pt,zk as mt}from"./api-Da6_RPKW.js";import{r as E}from"./dist-C5rZMbyx.js";import{t as ht}from"./chevrons-up-down-BJ8yWoBT.js";import{i as gt,n as D,o as _t,r as vt,s as yt}from"./FieldLabel-By4I98vO.js";import{t as bt}from"./button-DezjmYbu.js";import{$t as O,At as xt,Ct as St,Dt as Ct,Jn as wt,Jt as k,L as Tt,Mt as Et,Ot as Dt,Pn as A,St as j,Tt as Ot,Yt as kt,ar as M,at as At,bt as N,cn as jt,dr as P,fr as Mt,ft as Nt,it as Pt,jt as F,kn as I,on as Ft,or as It,ot as Lt,sn as Rt,sr as L,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-BcCFgPG0.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-CFBr2AAN.js";import{t as Gt}from"./FilterBar-CF8kYMRM.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-Dvj8v6B1.js";import{t as W}from"./dispatchErrorInfo-CMB-D8cW.js";var $t=d(`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=d(`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 K(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return K(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return 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),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>gn(s),[s]),d=(0,G.useMemo)(()=>_n(s),[s]),p=(0,G.useMemo)(()=>vn(s),[s]),m=(0,G.useMemo)(()=>hn(fn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:u(),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)(j,{placeholder:Se()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),c.map(e=>(0,Q.jsx)(N,{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)(j,{placeholder:lt()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),d.map(e=>(0,Q.jsx)(N,{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)(j,{placeholder:l()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),p.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(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:a,onSort:h}),(0,Q.jsx)($,{label:Ve(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:dt(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ct(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ze(),sortKey:`version`,sort:a,onSort:h}),(0,Q.jsx)(V,{children:Ke()}),(0,Q.jsx)($,{label:qe(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Q.jsx)(Ut,{children:m.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)(It,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=K(e)?W(e.lastErrorCode):null,n=an(e)?W(e.lastDownstreamRejectCode):null,r=on(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:Xe({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:F(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?` · ${F(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?` · ${F(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:[he({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?Qe():e===`error`?w():C()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(k,{variant:`secondary`,children:Qe()}):e===`error`?(0,Q.jsx)(k,{variant:`destructive`,children:w()}):(0,Q.jsx)(k,{variant:`outline`,children:C()})}function Cn(){return x(T.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=x(T.compat.getBridgeCompat,{}),n=x(T.me.getMe,{host:Nt})?.role===`admin`,r=x(T.admin.listInstances,n?{}:`skip`),i=x(T.agents.usageForInstances,n?{}:`skip`),a=P(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=P({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:je()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Pe()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)(V,{children:Ne()}),(0,Q.jsx)(V,{children:Ie()}),(0,Q.jsx)(V,{children:ie()}),(0,Q.jsx)(V,{children:rt()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Pt,{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)(Lt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(A,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(At,{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:de()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,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)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:re(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,nt({build:t.buildVersion??`?`})]}):null,` · `,oe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?h():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:a()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=xt(e.checkedAt),m=e.startedAt==null?null:xt(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)(M,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(I,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ft():l===`gateways_unreachable`?p({count:u.length}):c?ve():ce({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}),` `,y({time:f})]}),m?(0,Q.jsx)(`span`,{children:pe({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ge({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:ue()})]})}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)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(k,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Me()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),Ye({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:[b(),i.length>0?(0,Q.jsx)(k,{variant:`destructive`,children:ae({count:i.length})}):a>0?(0,Q.jsx)(k,{variant:`destructive`,children:m()}):(0,Q.jsx)(k,{variant:`secondary`,children:tt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ke({version:e.vendoredVersion}),r?` · `+Ce({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ue({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),_({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:S()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(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:v({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:h()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(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)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(St,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(Dt,{children:se({instance:e.displayName??e.name})}),(0,Q.jsx)(Ot,{children:g()})]}),(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)(M,{"aria-hidden":!0}):(0,Q.jsx)(I,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?We():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,r()]}):null}function jn({instance:e,onClose:t}){let n=ee(T.admin.upsertInstanceConfig),r=o(T.bridge.validateMediaPaths),i=kt(),a=Vt(e.config?.contentLocale,void 0),[s,l]=(0,G.useState)(()=>gt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(Je(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(s,r,a)}),t()}catch(e){i.error(be(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Te(),help:le()}),(0,Q.jsxs)(R,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:yt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:te(),help:ne()}),(0,Q.jsxs)(R,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:_t.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Oe(),help:me()}),(0,Q.jsx)(O,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:st(),help:Ze()}),(0,Q.jsx)(O,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:He(),help:at()}),(0,Q.jsx)(O,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(D,{label:c(),help:fe()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),Le({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:$e(),result:m.inbound}),(0,Q.jsx)(An,{label:ot(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),_e()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(bt,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Q.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Be():et()]}),(0,Q.jsx)(bt,{size:`sm`,onClick:()=>void b(),disabled:u,children:mt()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(jt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?De():s({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:pt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$l as i,BY as a,Ct as o,F_ as s,HY as c,NY as l,Qg as u,St as d,Sv as f,Tt as p,UY as m,Wk as h,Zg as g,_p as _,_t as v,a_ as y,at as b,bt as x,bv as S,ct as C,dp as w,dt as ee,e_ as te,et as ne,fp as re,ft as ie,gp as T,gt as ae,gv as oe,hp as se,ht as E,hv as ce,i_ as D,it as O,lt as le,mp as k,mt as A,n_ as j,nt as ue,ot as de,pp as fe,pt as pe,r_ as me,rt as he,st as ge,t as M,t_ as _e,tt as ve,up as N,ut as P,vp as F,vt as ye,wt as be,xt as xe,yp as Se,yt as Ce}from"./api-Da6_RPKW.js";import{t as we}from"./use_paginated_query-DudXPi-Q.js";import{t as I}from"./button-DezjmYbu.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-BcCFgPG0.js";import{a as Oe}from"./compatView-Dvj8v6B1.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 xe();case`tool`:return x();default:return Ce()}}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`?A():Ne(e)?O():null:E(),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:v()}}function Ne(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Z(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`?A():e.code===`stale_default`?pe():e.code===`write_unknown`||e.code===`not_confirmed`?P():e.code===`not_applied`?le():e.code===`default_too_large`?ue():e.code===`allowlist_too_large`?he():e.code===`plugin_too_old`?O():e.code===`source_not_allowed`?b():e.code===`plugin_config_lag`?de():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?ae():ie({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 i=a(M.knowledge.setAgentKnowledgeDefault),[s,c]=(0,G.useState)(t),[l,d]=(0,G.useState)(()=>Y(t)),[p,m]=(0,G.useState)(`idle`),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(!1),y=e=>{c(e),d(Y(e)),g(null)},b=Pe(s,t);(0,G.useEffect)(()=>{_&&b&&(v(!1),y(t))},[_,b]);let x=Me(s,l,n),S=x.readOnlyReason===null;async function C(){m(`saving`),g(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:l.injection,sources:l.sources,expected:q(s)}));g(n),m(n===null?`done`:`idle`),n===null&&v(!0)}catch(e){g(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),m(`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:l.injection,onValueChange:e=>{J(e)&&d({...l,injection:e})},disabled:!S,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:ye()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:S?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(R,{checked:l.sources.includes(e.id),onCheckedChange:()=>d(Z(t,l,e.id)),disabled:!S,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),b&&!_?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ve(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>y(t),children:ne()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()}),S?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(I,{size:`sm`,disabled:!x.dirty||!x.valid||p===`saving`,onClick:()=>void C(),children:p===`saving`?f():r()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:x.readOnlyReason}),S&&x.dirty&&x.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x.invalidReason}):null,p===`done`&&h===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,h===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h})]})]})}function Ie({instanceName:e}){let t=m(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(M.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":p(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:E()}),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:C({shown:n.length})}),(0,$.jsx)(I,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:ge()})]}):null]})}function Le({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=m(M.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,G.useState)(i),[s,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(i),l(`idle`)},[e._id,i]);let d=`__none__`,p=a!==i;async function h(){l(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let _=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(H,{value:a===``?d:a,onValueChange:e=>o(e===d?``:e),children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":T(),children:(0,$.jsx)(z,{placeholder:k()})}),(0,$.jsxs)(W,{children:[(0,$.jsx)(B,{value:d,children:k()}),_.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:!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?f():r()})]}),s===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,s===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null]})}function Re({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,G.useState)(n),[s,l]=(0,G.useState)(i===null?``:String(i)),[d,p]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(n),l(i===null?``:String(i)),p(`idle`)},[e._id,n,i]);let m=s.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,v=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,y=a!==n||(h??null)!==i;async function b(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`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:a,onCheckedChange:e=>o(e===!0),"aria-label":_()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(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=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!v,"aria-label":fe(),disabled:!a}),(0,$.jsx)(I,{size:`sm`,disabled:!y||!v||d===`saving`,onClick:()=>void b(),children:d===`saving`?f():r()})]}),v?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:re()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]})}function ze({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,G.useState)(n===null?``:String(n)),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=i.trim(),d=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:Se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,$.jsx)(I,{size:`sm`,disabled:!m||!p||o===`saving`,onClick:()=>void h(),children:o===`saving`?f():r()})]}),p?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]})}function Be(){let e=a(M.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=m(M.admin.listInstances,{}),[o,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&c(r[0].name)},[r,o]);let u=(r?.length??0)>1,d=r!==void 0&&r.length===0,f=m(M.compat.forInstance,o?{instanceName:o}:`skip`),p=o?Ee(f,`configDefaults`):`loading`,g=p===`loading`?null:p.blocked,_=(0,G.useMemo)(()=>u&&o?{instanceName:o}:{},[u,o]),v=(0,G.useRef)(0),b=(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&&(u&&!o||b())},[b,g,u,o]);let x=t.status===`done`?t.current:null,C=(0,G.useMemo)(()=>ke.map(e=>({id:e,label:De(e)})),[]),w=(0,G.useMemo)(()=>[{id:`fast`,label:oe()},{id:`standard`,label:ce()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),u&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,$.jsxs)(H,{value:o,onValueChange:e=>c(e),children:[(0,$.jsx)(U,{size:`sm`,"aria-label":s(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:(r??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,d?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):p===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):p.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,Oe(p.gatewayVersion,p.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[te(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:S()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,$.jsx)(V,{field:`thinkingLevel`,options:C,value:x?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:D()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,$.jsx)(V,{field:`fastMode`,options:w,value:x===null||x.fastModeDefault===null?null:x.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:j()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:_e()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(o??r[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{r as e}from"./bundle-mjs-C73ZY4La.js";import{HY as t,PA as n,dE as r,nE as i,rE as a,t as o,tE as s,uE as c}from"./api-Da6_RPKW.js";import{t as l}from"./use_paginated_query-DudXPi-Q.js";import{t as u}from"./button-DezjmYbu.js";import{ct as d,h as f}from"./index-BcCFgPG0.js";import{n as p,t as m}from"./trashPage-BqqZxj7Y.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(o.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=t(o.trash.restoreChat),b=t(o.trash.purgeChat),x=t(o.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:r({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:i(),description:s(),confirmLabel:a(),destructive:!0})&&await x({})},children:a()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:n()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:c()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
|
|
@@ -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,CI as o,Cf as s,DI as c,EI as l,FI as u,GI as d,HI as f,HY 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,UY as S,VI as C,WI as w,XI as T,YI as E,ZI as D,_I as O,_L as k,aL as A,bI as j,cL as M,dL as N,eL as P,fL as F,gL as I,hL as L,iL as R,jI as z,kI as B,lL as V,mL as H,nL as U,oL as W,pL as G,qI as ae,rL as K,sL as q,t as J,tL as oe,uL as se,vI as ce,vL as le,wI as ue,xI as de,xf as fe,yI as pe,yL as me,zI as he}from"./api-Da6_RPKW.js";import{t as ge}from"./button-DezjmYbu.js";import{At as _e,ct as Y}from"./index-BcCFgPG0.js";import{t as ve}from"./DataTableShell-DwnJt663.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>me(),incorrect:()=>le(),incoherence:()=>k(),formatting:()=>I(),latency:()=>L(),api_error:()=>H(),other:()=>G()},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:N()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:se()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:F()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=p(J.feedback.respondToFeedback),[c,l]=(0,X.useState)(e.thread),[u,f]=(0,X.useState)(``),[m,v]=(0,X.useState)(!1);async function y(){let t=u.trim();if(!(!t||m)){v(!0);try{await a({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}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?` · ${V()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:_(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(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:o()}),(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:q()}),c.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:c.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`?W():e.authorRole===`agent`?e.authorLabel??s():A()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:R()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:K(),value:u,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void y(),disabled:!u.trim()||m,children:m?U():oe()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||r()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(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.displayedText||r()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(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:T({count:i.contextCount??b.length,truncated:i.contextTruncated?E():``})}),(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:h()}),(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:ae()}),(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:g()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?d({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[w(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ie()]})]}):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=p(J.feedback.readSnapshot),n=p(J.feedback.deleteFeedback),r=Y(),[o,s]=(0,X.useState)(null),[d,h]=(0,X.useState)({});async function g(e){if(o===e._id){s(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await r({title:pe(),description:ce(),confirmLabel:O(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,a()]}),(0,Z.jsx)(ve,{title:he(),rows:e,emptyHint:te(),isExpanded:e=>o===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Z.jsx)(be,{data:d[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:m(),cell:e=>_e(e.at),sort:e=>e.at},{header:u(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:x(),cell:e=>e.messageRole===`user`?y():v(),sort:e=>e.messageRole},{header:z(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${i({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:B(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:b(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:c(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:l()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:re()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:fe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ue()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?ne():de(),onSelect:()=>void g(e)},{label:j(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$J as ee,AJ as te,BJ as r,CJ as i,DJ as a,Df as o,EJ as ne,Ef as re,FJ as ie,FY as ae,GJ as s,HJ as c,HY as l,IJ as u,JJ as oe,KJ as se,LJ as d,MJ as ce,NJ as le,NY as ue,OJ as de,PJ as fe,QJ as pe,RJ as f,SJ as me,TJ as he,UJ as p,UY as ge,VJ as m,WB as _e,WJ as ve,XJ as h,YJ as ye,ZJ as g,bJ as be,eY as xe,jJ as Se,kJ as _,qJ as v,t as y,wJ as b,xJ as x,yJ as S,zJ as C}from"./api-Da6_RPKW.js";import{t as w}from"./button-DezjmYbu.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-BcCFgPG0.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CFBr2AAN.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return p();case`audio`:return c();case`video`:return m();case`pdf`:return r();case`document`:return C();case`archive`:return f();default:return d()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[c,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[m,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=l(y.files.softDelete),Y=De();function Ie(){t(W),r(W),d(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ne())}catch(e){Y.error(he(),e)}}let X=ge(y.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:c===W?void 0:c,category:f===W?void 0:f,includeAutoGenerated:m||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ae(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||c!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(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":ee(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:pe()}),(0,U.jsx)(N,{value:`inbound`,children:g()}),(0,U.jsx)(N,{value:`outbound`,children:h()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:r,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ye(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:oe()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:c,onValueChange:d,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":v(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:se()}),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":s(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ve()}),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:m,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}),_()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():x()}):(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:u()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:fe()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:ce()}),(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():h()})}),(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":de(),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}),te()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(F,{size:14}),me()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(T,{size:14}),a()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:S({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:b()}),(0,U.jsx)(Ee,{children:i()})]}),(0,U.jsxs)(D,{children:[(0,U.jsx)(O,{children:_e()}),(0,U.jsx)(Te,{onClick:()=>void Le(),children:a()})]})]})})]})}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,Bb as o,Bv 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,Gy as y,HY as b,Hb as x,Hy as S,Ib as C,Iy as w,Jb as T,Jv as E,Jy as D,Kb as O,Kv as k,Ky as A,Lb as j,Lv as M,Ly as ee,Mb as te,Nb as ne,Ny as re,Ob as ie,Oy as N,Pb as ae,Py as oe,Qv as P,Qy as F,Rb as I,Rv as se,Ry as ce,Sb as le,Sy as ue,Tb as de,Ty as fe,UY as L,Ub as pe,Uy as me,Vb as he,Vy as ge,Wb as _e,Wy as ve,Xb as ye,Xv as be,Xy as xe,Yb as Se,Yv as Ce,Yy as we,Zv as Te,Zy as Ee,_y as De,ab as Oe,ay as ke,bb as Ae,by as je,cb as Me,cy as Ne,db as Pe,dy as Fe,eb as Ie,ey as Le,fb as R,fy as Re,gy as ze,hy as Be,ib as Ve,iy as He,jb as Ue,kb as We,ky as z,lb as Ge,ly as Ke,mb 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 V,xy as gt,yb as _t,yy as vt,zb as yt,zv as bt,zy as xt}from"./api-Da6_RPKW.js";import{t as St}from"./x-jEbKIC4W.js";import{t as H}from"./button-DezjmYbu.js";import{$ as Ct,$t as U,Ct as wt,Dn as Tt,Dt as Et,En as Dt,G as Ot,J as W,Jt as G,K as kt,Mn as At,Mt as K,Nn as jt,Ot as Mt,Pn as Nt,Q as Pt,St as Ft,Tt as It,W as q,X as Lt,Y as Rt,Yt as J,Z as zt,at as Bt,b as Vt,bt as Ht,cr as Ut,ct as Wt,et as Gt,ft as Kt,it as qt,jn as Y,ot as Jt,q as Yt,sr as Xt,st as Zt,vt as Qt,wt as $t,xt as en,yt as tn}from"./index-BcCFgPG0.js";import{t as nn}from"./FilterBar-CF8kYMRM.js";import{t as rn}from"./DataTableShell-DwnJt663.js";import{t as X}from"./DetailChips-Bqvq37y3.js";var an=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`}]]),Z=t(e(),1),Q=n(),on={name:``,description:``};function sn(){let e=L(B.groups.listGroups,{}),t=L(B.me.getMe,{host:Kt})?.role===`admin`,n=b(B.groups.createGroup),r=b(B.groups.updateGroup),i=b(B.groups.deleteGroup),s=Wt(),c=J(),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(on),[h,_]=(0,Z.useState)(null),[S,w]=(0,Z.useState)(``),E=(0,Z.useMemo)(()=>{if(!e)return e;let t=S.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,S]);function D(){f(null),m(on),u(!0)}function k(e){f(e),m({name:e.name,description:e.description??``}),u(!0)}async function A(){try{d?await r({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m(on),f(null),u(!1)}catch(e){c.error(y(),e)}}async function M(e){if(await s({title:Ue({name:e.name}),description:a(),confirmWord:e.name,confirmLabel:We(),cancelLabel:j(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(ve(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:S,onQChange:w,onReset:()=>w(``),canReset:S!==``,searchPlaceholder:x()}),(0,Q.jsx)(rn,{title:ye(),rows:E,addLabel:T(),onAdd:t?D:void 0,emptyHint:tt(),columns:[{header:O(),cell:e=>e.name,sort:e=>e.name},{header:v(),cell:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{icon:(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(jt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,Q.jsx)(G,{variant:`secondary`,children:re({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:_e(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Nt,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:pe(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(an,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:he(),onSelect:()=>_({groupId:e._id,name:e.name})},...t?[{label:o(),onSelect:()=>k(e)},{label:yt(),variant:`destructive`,onSelect:()=>void M(e)}]:[]]}),(0,Q.jsx)(Vt,{open:l,onOpenChange:u,title:d?g():C(),description:ae(),canSubmit:!!p.name.trim(),onSubmit:A,submitLabel:I(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,Q.jsx)(U,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,Q.jsx)(U,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||_(null)}})]})}var cn=8;function $({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ut,{size:14,"aria-hidden":!0}),Ae()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ft({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[_t(),(0,Q.jsx)(Xt,{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,o=L(B.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),s=L(B.groups.listAssignableUsers,n&&a?{}:`skip`),c=b(B.groups.addMember),f=b(B.groups.removeMember),p=b(B.groups.bulkSetMembers),h=b(B.groups.setGroupManager),g=J(),[_,v]=(0,Z.useState)(``),[y,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(`members`),[w,T]=(0,Z.useState)(1),[E,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ee=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),te=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),ne=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>q(e.instanceName,e.agentId))),[i]),re=(0,Z.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?q(e.instanceName,e.agentId):null},[i]);(0,Z.useEffect)(()=>{v(``),x(``),C(`members`),T(1),O(null),j.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&j.current!==e&&(j.current=e,A(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,Z.useMemo)(()=>s?Yt(s,_,k):[],[s,_,k]);async function ae(t,n){if(e)try{n?await f({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){g.error(me(),W(e))}}async function oe(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(rt(),e)}}let P=Ct(N,e=>M.has(e.userId)),F=N.filter(e=>M.has(e.userId)).length,I=zt(N,w,cn);async function se(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:P!==`all`})}catch(e){g.error(me(),W(e))}}let ce=(e,t)=>(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":ht({user:t}),title:ht({user:t}),onClick:()=>O({userId:e,label:t}),children:[(0,Q.jsx)(At,{size:13,"aria-hidden":!0}),fe()]});return(0,Q.jsx)(wt,{open:n,onOpenChange:r,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:ie({name:t})}),(0,Q.jsx)(It,{children:i&&!a?ge():d()})]}),(0,Q.jsxs)(qt,{value:S,onValueChange:C,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Jt,{className:`w-full`,children:[(0,Q.jsxs)(Zt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),m(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(Zt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),mt(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:ne.size}):null]}),(0,Q.jsxs)(Zt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),Ve(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(Bt,{value:`members`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()}):a?s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ut()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:_,onChange:e=>v(e.target.value),placeholder:de(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":V()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:V()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=M.has(e.userId),n=Gt(e),r=ee.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":qe({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&te.has(e.userId)?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:u()}):null,(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Pt(e.role)}),t?ce(e.userId,n.primary):null,(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?D():we(),title:r?D():we(),onClick:()=>void oe(e.userId,r),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)($,{page:I.page,pageCount:I.pageCount,onPage:T})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:i.members,agentsButton:ce}):null}),(0,Q.jsxs)(Bt,{value:`agents`,children:[i&&!a?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Je()}):null,o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:y,onChange:e=>x(e.target.value),placeholder:l(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:ne,defaultKey:re,viewerIsAdmin:a,query:y},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(Bt,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:E,onOpenChange:e=>{e||O(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=L(B.groupInvites.listGroupInviteRequests,{groupId:e}),i=b(B.groupInvites.requestGroupInvite),a=b(B.groups.removeMember),o=Wt(),s=J(),[l,d]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(1),g=zt(t,p,cn);async function v(t){t.preventDefault();let n=l.trim();if(n)try{await i({groupId:e,email:n}),d(``),s.success(w())}catch(e){s.error(_(),e)}}async function y(t,n){if(await o({title:z({user:n}),description:f({user:n}),confirmLabel:h(),cancelLabel:j(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(me(),W(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void v(e),children:[(0,Q.jsx)(U,{type:`email`,value:l,onChange:e=>d(e.target.value),placeholder:ce(),"aria-label":c()}),(0,Q.jsxs)(H,{type:`submit`,size:`sm`,disabled:!l.trim(),children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),ee()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xt()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:g.pageItems.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:u()}):null,n(e.userId,e.label),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":xe(),title:xe(),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":z({user:e.label}),title:e.manager?N():e.lastGroup?k():z({user:e.label}),onClick:()=>void y(e.userId,e.label),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)($,{page:g.page,pageCount:g.pageCount,onPage:m})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:oe()}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsx)(G,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Rt(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=b(B.groups.setMemberAgents),o=b(B.groups.setMemberDefaultAgent),c=J();async function l(e){try{await e()}catch(e){c.error(nt(),e)}}let u=i?.agents??[],d=new Map(u.map(e=>[q(e.instanceName,e.agentId),e])),f=[...d.keys()],p=new Set(u.filter(e=>e.allowed).map(e=>q(e.instanceName,e.agentId)));function m(n){if(!e||!t||!i)return;let r=Lt(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,Q.jsx)(wt,{open:t!==null,onOpenChange:n,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:Xe({user:t?.label??``})}),(0,Q.jsx)(It,{children:lt()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()}):i===null||u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()}):(0,Q.jsxs)(Q.Fragment,{children:[i.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:M()}),i.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):null,i.restrictedByAdmin&&!i.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:i.restricted?r():Le()}),i.restricted?(0,Q.jsx)(H,{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:P()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let r=q(n.instanceName,n.agentId),a=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:n.allowed,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>m(r),"aria-label":Te({name:a})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:a,children:a}),n.limitedByAdmin?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:bt()}):null,n.state===`deleted`?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Oe()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!i.settable,"aria-label":be(),title:be(),onClick:()=>e&&t?void l(()=>o({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!i.settable,"aria-label":Ce(),title:Ce(),onClick:()=>e&&t?void l(()=>o({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(Y,{size:14})}):null]},r)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=L(B.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),c=b(B.groups.assignAgentToGroup),l=b(B.groups.removeAgentFromGroup),u=b(B.groups.bulkSetGroupAgents),d=b(B.groups.claimAgentForGroup),f=b(B.groups.setGroupDefaultAgent),p=J(),[m,h]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{h(1)},[o]),!e)return null;let g=kt(s?.agents??[],o),_=s?.discovery&&!s.discovery.lastPollOk,v=e=>Ot({assigned:r.has(q(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),y=g.filter(e=>v(e)!==`claim`),x=g.filter(e=>v(e)===`claim`);if(o.trim()&&g.length===0)return null;let C=y.filter(e=>v(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),w=Ct(C,e=>r.has(q(t,e.agentId))),T=zt(y,m,cn);async function E(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(S(),W(e))}}async function D(){if(C.length===0)return;let n=C.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:w!==`all`})}catch(e){p.error(S(),W(e))}}async function O(n){try{await d({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(Ke(),e)}}async function k(n){try{await f({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){p.error(at(),e)}}let A=e=>e.reservedForGroup?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Ne()}):e.reserved?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?Qe():st({group:e.reservedGroupName})}):null;return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),_?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:Ze()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Pe()}):g.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_?ot():Me()}):(0,Q.jsxs)(Q.Fragment,{children:[C.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:w===`all`?!0:w===`some`?`indeterminate`:!1,onCheckedChange:()=>void D(),"aria-label":V()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:V()})]}):null,T.pageItems.map(e=>{let n=q(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=v(e)===`locked`;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(K,{checked:a,disabled:s&&!a,onCheckedChange:()=>void E(e.agentId,a),"aria-label":$e({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,A(e),o?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Oe()}):null,a?i===n?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":ke(),title:ke(),onClick:()=>void k(null),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":He(),title:He(),onClick:()=>void k(e.agentId),children:(0,Q.jsx)(Y,{size:14})}):null]},e.agentId)}),(0,Q.jsx)($,{page:T.page,pageCount:T.pageCount,onPage:h}),x.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:et()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Re()}),x.map(e=>{let t=e.displayName??e.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":dt({name:t}),onClick:()=>void O(e.agentId),children:Fe()})]},e.agentId)})]}):null]})]})}function pn(){let e=L(B.groupInvites.listPendingInviteRequests,{}),t=b(B.groupInvites.decideGroupInvite),n=J();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(Be(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":gt(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),gt(),(0,Q.jsx)(G,{variant:`secondary`,children:e.length})]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,je({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?De():ze()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:vt()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:pt()})]},e._id))})]})}function mn({groupId:e}){let t=L(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=b(B.charts.assignChartToGroup),r=b(B.charts.removeChartFromGroup),a=b(B.charts.setGroupDefaultChart),o=b(B.charts.addChartToGroupPool),s=b(B.charts.removeChartFromGroupPool),c=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:it()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(A(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(A(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(A(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(A(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":i({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":F(),title:F(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:Ee()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":Ie({name:e.name}),title:Ie({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Qt,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(en,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ft,{placeholder:ct()})}),(0,Q.jsx)(tn,{children:u.map(e=>(0,Q.jsx)(Ht,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ye()}):null:null]})}export{sn 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,D as p,DF as m,DP as h,EF as g,EP as _,F as v,FF as y,FP as b,Fk as ee,Fp as x,Fv as S,GP as C,HF as te,HP as w,HY as T,IF as ne,IP as E,Ip as D,Iv as O,JN as re,JP as ie,KP as ae,LF as oe,LP as se,Lp as ce,M as le,MF as ue,MP as de,N as fe,NF as pe,NP as me,O as he,OF as ge,OP as _e,P as ve,PF as ye,PP as be,Pk as xe,Pp as Se,Pv as Ce,QN as k,QP as we,Qa as Te,RF as Ee,RH as A,RP as De,SF as Oe,SP as ke,TF as Ae,TP as je,UF as Me,UP as Ne,UY as j,VF as Pe,VP as Fe,WP as Ie,XN as Le,XP as Re,YN as ze,YP as Be,ZN as Ve,ZP as He,Za as Ue,_F as We,_P as Ge,aF as Ke,aP as qe,ao as Je,bF as Ye,bP as Xe,cF as Ze,cP as Qe,cn as $e,co as et,dF as tt,dP as nt,dn as rt,do as it,eF as at,eP as ot,eo as st,fF as ct,fP as lt,fn as ut,fo as dt,gF as ft,gP as pt,gn as mt,hF as ht,hP as gt,hn as _t,iF as vt,iP as yt,io as bt,iu as xt,j as St,jF as Ct,jP as wt,k as Tt,kF as Et,kP as Dt,lF as Ot,lP as kt,ln as At,lo as jt,mF as Mt,mP as Nt,mn as Pt,nF as Ft,nP as It,no as Lt,nu as Rt,oF as zt,oP as Bt,oo as Vt,pF as Ht,pP as Ut,pn as Wt,po as Gt,qP as Kt,rF as qt,rP as Jt,ro as Yt,ru as Xt,sF as Zt,sP as Qt,sn as $t,so as en,t as M,tF as tn,tP as nn,to as rn,uF as an,uP as on,un as sn,uo as cn,vF as ln,vP as un,wF as dn,wP as N,xF as fn,xP as pn,yF as mn,yP as hn,zF as gn,zH as _n,zP as vn}from"./api-Da6_RPKW.js";import{a as yn,c as bn}from"./FieldLabel-By4I98vO.js";import{t as P}from"./button-DezjmYbu.js";import{$t as F,Ct as I,Dt as L,J as R,Jt as z,Mt as B,Ot as V,St as H,Tt as U,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-BcCFgPG0.js";import{t as Dn}from"./DataTableShell-DwnJt663.js";import{InstanceConfigDialog as On}from"./BridgeTab-jBNctrlU.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:yn,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=j(M.admin.listInstances,{}),t=j(M.agents.listAllInstanceAgents,{}),n=T(M.admin.upsertInstance),r=T(M.widgets.setInstanceWidgets),i=T(M.admin.deleteInstance),c=W(),[u,d]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(Q),[b,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null),[w,E]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(null);async function re(){try{let t=await n({instanceId:D??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),i=D===null?null:e?.find(e=>e._id===D),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==a||h.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),_(Q),O(null),d(!1)}catch(e){c.error(Pe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),(0,Z.jsx)(`strong`,{children:gn()}),Ee()]}),(0,Z.jsx)(Dn,{title:oe(),rows:e,addLabel:ne(),onAdd:()=>{O(null),_(Q),d(!0)},emptyHint:y(),columns:[{header:ye(),cell:e=>e.name,sort:e=>e.name},{header:pe(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ue(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ct(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Me(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?nn():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:m(),onSelect:()=>{O(e._id),_(Nn(e)),d(!0)}},{label:te(),onSelect:()=>x(e.name)},{label:ct(),onSelect:()=>E(e)},{label:s(),onSelect:()=>C(e)},{label:Et(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:Et(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(xn,{open:u,onOpenChange:d,title:D?g():ge(),description:dn(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:re,submitLabel:f(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Oe(),children:[(0,Z.jsx)(F,{value:h.name,disabled:D!==null,onChange:e=>_({...h,name:e.target.value})}),D?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ae()}):null]}),(0,Z.jsx)($,{label:fn(),children:(0,Z.jsxs)(K,{value:h.kind,onValueChange:e=>_({...h,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(G,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:xt(),children:(0,Z.jsxs)(K,{value:h.transport,onValueChange:e=>_({...h,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`ws`,children:Xt()}),(0,Z.jsx)(G,{value:`rest`,children:Rt()})]})]})}):null,(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(F,{value:h.gatewayUrl,onChange:e=>_({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:mn(),children:(0,Z.jsx)(F,{value:h.bridgeUrl,placeholder:ln(),onChange:e=>_({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(F,{value:h.displayName,onChange:e=>_({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ee(),children:[(0,Z.jsxs)(K,{value:h.streamTransport,onValueChange:e=>_({...h,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(J,{children:bn.map(e=>(0,Z.jsx)(G,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:xe()})]}),(0,Z.jsx)($,{label:ft(),children:(0,Z.jsx)(F,{value:h.gatewayVersion,placeholder:ht(),onChange:e=>_({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Yt(),children:[(0,Z.jsxs)(K,{value:h.authMode,onValueChange:e=>_({...h,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`token`,children:Lt()}),(0,Z.jsx)(G,{value:`trusted-proxy`,children:rn()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?a():st()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Gt(),children:[(0,Z.jsxs)(K,{value:h.personScopes,onValueChange:e=>_({...h,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`capped`,children:dt()}),(0,Z.jsx)(G,{value:`full`,children:it()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?jt():cn()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:et(),children:[(0,Z.jsxs)(K,{value:h.identitySource,onValueChange:e=>_({...h,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`canonical`,children:en()}),(0,Z.jsx)(G,{value:`email`,children:Vt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?bt():Je()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:mt(),children:[(0,Z.jsxs)(K,{value:h.participantIdentity,onValueChange:e=>_({...h,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`owner`,children:_t()}),(0,Z.jsx)(G,{value:`self`,children:Pt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?$t():Wt()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:ut(),children:[(0,Z.jsxs)(K,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>_({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:rt()}),(0,Z.jsx)(G,{value:`on`,children:sn()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?$e():At()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:v(),children:[(0,Z.jsxs)(K,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>_({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`on`,children:ve()}),(0,Z.jsx)(G,{value:`off`,children:fe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?le():St()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:o(),children:[(0,Z.jsxs)(K,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>_({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:Tt()}),(0,Z.jsx)(G,{value:`on`,children:he()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:p()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(F,{value:h.systemIdentity,placeholder:Ue(),onChange:e=>_({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Mt(),children:(0,Z.jsx)(F,{value:h.gatewayHttpUrl,placeholder:Ht(),onChange:e=>_({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:b,open:b!==null,onOpenChange:e=>{e||x(null)}}),S?(0,Z.jsx)(On,{instance:S,onClose:()=>C(null)},S._id):null,w?(0,Z.jsx)(Fn,{instance:w,onClose:()=>E(null)},w._id):null]})}function Fn({instance:e,onClose:t}){let n=j(M.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)(I,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(En,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(L,{children:[(0,Z.jsx)(V,{children:tt({instance:e.displayName??e.name})}),(0,Z.jsx)(U,{children:an()})]}),(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=d(M.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(Ie());break;case`no_agents`:n.success(w());break;case`no_bridge_url`:n.error(Fe());break;case`deploy_misconfigured`:n.error(u());break;case`unauthorized`:n.error(De());break;case`not_served`:n.error(se());break;default:n.error(vn());break}}catch(e){n.error(Ne(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?C():ae()})})]})}function Ln({instance:e}){let t=j(M.bridgeAuth.listBridgeAuthStatus,{}),n=d(M.bridgeAuth.mintBridgeSecret),r=T(M.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 g(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(Dt(),e)}finally{o(!1)}}}async function _(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(c())}catch(e){i.error(Dt(),e)}finally{o(!1)}}}async function v(){if(s)try{await navigator.clipboard.writeText(s),f(!0)}catch{}}return(0,Z.jsxs)($,{label:b(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:m?`outline`:`secondary`,children:m?`${zt()} · ${p.prefix}…${p.lastFour}`:Ke()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void g(),disabled:a,children:m?de():me()}),m?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:a,children:wt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:u?_n():A()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),f(!1)},children:h()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=d(M.instanceSecrets.setInstanceSecret),a=T(M.instanceSecrets.clearInstanceSecret),o=d(M.deviceIdentity.generateDeviceIdentity),s=W(),[c,l]=(0,Y.useState)(``),[u,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),v=n!==null,y=t===`deviceIdentity`,b=t===`token`?Ot():t===`deviceIdentity`?Ze():Zt();async function ee(){if(!(!c.trim()||u)){f(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),m(null),_(!1),s.success(at())}catch(e){s.error(i(),e)}finally{f(!1)}}}async function x(){if(!u){f(!0);try{await a({instanceId:e,field:t}),m(null),_(!1),s.success(we())}catch(e){s.error(i(),e)}finally{f(!1)}}}async function S(){if(!u){f(!0);try{m(await o({instanceId:e})),_(!1),s.success(Be())}catch(e){s.error(Kt(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function te(){if(C)try{await navigator.clipboard.writeText(C),_(!0)}catch{}}return(0,Z.jsxs)($,{label:b,children:[y?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:v?`outline`:`secondary`,children:v?zt():Ke()}),(0,Z.jsx)(F,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:v?qt():vt(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void ee(),disabled:u||c.trim().length===0,children:Ft()}),y?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:u,children:He()}):null,v?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:u,children:tn()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Be()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:g?_n():A()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),_(!1)},children:h()})]}):null]})}var zn={conversational:pt,documentary:Nt,summarizer:ce,curator:x},Bn={conversational:gt,documentary:Ut,summarizer:D,curator:Se},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:Xe()}),t.map(e=>(0,Z.jsx)(z,{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)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:hn()})}),(0,Z.jsxs)(Tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:un()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ge()}),(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)(B,{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=j(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=T(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=T(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=T(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=T(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=T(M.agents.removeInstanceAgent),u=T(M.agents.setAgentReservation),d=j(M.groups.listGroupLabels,t?{}:`skip`),f=Cn(),p=W();async function m(t,n){if(e&&await f({title:Ve({name:n}),description:Le(),confirmLabel:k()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){p.error(N(),R(e))}}async function h(t,n,r){if(!e)return;let i=(d??[]).find(e=>e._id===r)?.name??`?`;if(await f({title:O({name:n,group:i}),description:S({group:i}),confirmLabel:Ce()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){p.error(N(),R(e))}}async function g(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){p.error(N(),e)}}async function v(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){p.error(N(),e)}}async function y(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){p.error(N(),e)}}async function b(t,n){if(e&&await f({title:on({name:n}),description:kt(),confirmLabel:Qe(),destructive:!0}))try{await l({instanceName:e,agentId:t}),p.success(Qt())}catch(e){p.error(N(),e)}}return(0,Z.jsx)(I,{open:t,onOpenChange:n,children:(0,Z.jsxs)(En,{className:`oc-access`,children:[(0,Z.jsxs)(L,{children:[(0,Z.jsx)(V,{children:_({name:e??``})}),(0,Z.jsx)(U,{children:je()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Bt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?qe():i.discovery.lastPollOk?yt():Jt({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)(B,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void g(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)(z,{variant:`outline`,children:t.reserved.groupName===null?r():ot({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:re()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,o),children:nt()})]}):a?(0,Z.jsx)(z,{variant:`default`,children:nn()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:lt()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void m(t.agentId,o),children:k()}),(0,Z.jsxs)(K,{value:``,onValueChange:e=>void h(t.agentId,o,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(H,{placeholder:ze()})}),(0,Z.jsx)(J,{children:(d??[]).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 y(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){p.error(N(),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)(F,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:ke(),"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,HY as l,ML as u,NL as d,OL as f,PL as p,Qm as m,SL as h,TL as g,UY as _,Xm as v,Zm as y,eh as b,ih as x,jL as S,kL as C,nh as w,rh as T,t as E,th as D,wL as O,xL as k}from"./api-Da6_RPKW.js";import{t as A}from"./button-DezjmYbu.js";import{$t as j,Jt as M,Mt as N}from"./index-BcCFgPG0.js";var P=t(e(),1),F=n();function I(){let e=_(E.integrations.status.status,{}),t=l(E.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:p()});let a=n,m=(e,t,n)=>r({...a,[e]:{...a[e],[t]:n}}),v=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,F.jsx)(`strong`,{children:u()}),` `,S()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:i()}):(0,F.jsx)(M,{variant:`outline`,children:C()}):(0,F.jsx)(M,{variant:`outline`,children:f()}),note:s(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>v(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:k(),checked:a.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),v(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:i()}):(0,F.jsx)(M,{variant:`outline`,children:C()}):(0,F.jsx)(M,{variant:`outline`,children:f()}),note:c(),children:[(0,F.jsx)(R,{label:O(),children:(0,F.jsx)(j,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>v(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:o(),children:(0,F.jsx)(j,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||h(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>v(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:k(),checked:a.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),v(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:i()}):(0,F.jsx)(M,{variant:`outline`,children:C()}):(0,F.jsx)(M,{variant:`outline`,children:x()}),note:T(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(j,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>v(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:k(),checked:a.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),v(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=a(E.integrations.otlpSecret.setOtlpHeaders),n=l(E.integrations.otlpSecret.clearOtlpHeaders),[i,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),f=async()=>{d(!0),c(null);try{await t({headersJson:i}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:D(),children:[(0,F.jsx)(j,{value:i,placeholder:e?b():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:u||i.trim().length===0,onClick:()=>void f(),children:m()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:u,onClick:()=>void n({}),children:y()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:v()})]})}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,JD as o,KD as s,QD as c,RD as l,UD as ee,UY as u,VD as d,WD as f,WR as p,XD as m,YD as h,ZD as g,_R as _,cR as te,gR as ne,lR as v,qD as y,t as b,vR as x,yR as S,zD as C}from"./api-Da6_RPKW.js";import{dr as w,fr as T,ft as E,i as D,o as O,r as re}from"./index-BcCFgPG0.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-BAJ3t3W_.js";import{n as P,t as F}from"./TimeRangePicker-CJYL4VHt.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=u(b.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=u(b.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:p()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:S()}),(0,z.jsx)(M,{children:_()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(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:[te(),` p50 `,V(s.cP50),` `,x()]}),(0,z.jsxs)(`span`,{children:[v(),` p50 `,V(s.aP50),` `,x()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":S(),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:c(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:g(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:m(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:h(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:o(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:y(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:s(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...O(e)})}),{from:o,to:s}=P(n),{rowLimit:c,buckets:l}=Y(o,s),d=u(b.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),p=(0,I.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[d,l]),m=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return d===void 0?(0,z.jsxs)(z.Fragment,{children:[m,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}):d.length===0?(0,z.jsxs)(z.Fragment,{children:[m,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):(0,z.jsxs)(z.Fragment,{children:[m,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(p.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:p.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,i=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&&i>0?` oc-kpi__value--error`:``),children:Q(i)}),(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:d({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:r()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:C({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":l({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,$s as i,AW as a,CF as o,CW as s,CY as c,DW as l,EW as u,FW as d,HY as f,IW as p,MW as m,NW as h,NY as ee,OW as g,OY as te,PW as ne,QU as re,Qs as ie,SW as ae,SY as oe,TW as se,TY as ce,UY as _,ZU as le,Zs as ue,_W as de,_Y as fe,_c as pe,aW as me,aY as he,bW as ge,bY as _e,cW as v,cY as y,dW as b,dY as x,eW as S,ec as C,fW as w,fY as T,fc as E,gW as D,gY as O,hW as k,hY as A,iW as j,iY as M,ic as N,jW as P,kW as F,lW as I,lY as ve,mW as ye,mY as be,nW as xe,nY as Se,nc as Ce,oW as L,oY as we,pW as Te,pY as Ee,r as R,rW as De,rY as Oe,rc as ke,sW as Ae,sY as je,t as z,tW as Me,tc as Ne,uW as B,uY as Pe,vW as Fe,vY as Ie,vc as Le,wW as Re,wY as ze,xW as Be,xY as Ve,yW as He,yY as Ue}from"./api-Da6_RPKW.js";import{t as V}from"./button-DezjmYbu.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-BcCFgPG0.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-aXaP7rD1.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>p()},{id:`composer`,label:()=>d()},{id:`sidebar`,label:()=>ne()},{id:`notifications`,label:()=>de()},{id:`other`,label:()=>h()}],X={showSource:{category:`messages`,label:()=>m(),help:()=>P()},showReport:{category:`messages`,label:()=>a(),help:()=>F()},copyAssistant:{category:`messages`,label:()=>g()},copyUser:{category:`messages`,label:()=>l()},showDelete:{category:`messages`,label:()=>u()},showTools:{category:`messages`,label:()=>se(),help:()=>Re()},voiceInput:{category:`composer`,label:()=>s(),help:()=>ae()},showUsage:{category:`composer`,label:()=>Be(),help:()=>ge()},autoReadAloud:{category:`composer`,label:()=>Le(),help:()=>pe()},showChatAge:{category:`sidebar`,label:()=>He(),help:()=>Fe()},notifSound:{category:`notifications`,label:()=>D(),help:()=>k()},notifSystem:{category:`notifications`,label:()=>ye(),help:()=>Te()},replySound:{category:`notifications`,label:()=>w(),help:()=>b()}};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:()=>Me()};function ut({prefKey:e,ui:t}){let n=f(z.admin.setUiPrefDefault),i=f(z.admin.setFeatureEnabled),a=ct(e),o=a?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:me()}),(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:r()}),(0,J.jsx)(G,{value:`off`,children:re()}),(0,J.jsx)(G,{value:`inherit`,children:le()})]})]}),a?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(W,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":j()}),j()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function dt({current:e,enabled:t}){let n=f(z.me.setDictationShortcut),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ye(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!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:[N(),e?(0,J.jsx)(U,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?Ne():r?Ce():ke()})]}),(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:ue()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?ie():e?i():C()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=_(z.me.getMe,{host:K}),a=i?.ui,o=$(i?.role)&&n,s=f(z.me.setUiPref).withOptimisticUpdate(We),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":L()}),L()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:De()}),(0,J.jsx)(`p`,{children:xe()}),(0,J.jsx)(`p`,{children:S()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:I()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(U,{variant:`outline`,children:v()}):l?(0,J.jsx)(U,{variant:`secondary`,children:E()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:Ae()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ee()})}var pt={sm:()=>Ee(),md:()=>T(),lg:()=>x(),xl:()=>Pe(),"2xl":()=>ve(),"3xl":()=>y()};function mt(){let e=_(z.me.getMe,{host:K}),t=f(z.me.setLocale),n=f(z.me.setTimezone),r=f(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:K});n&&e.setQuery(z.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=f(z.me.setMyName),a=Je(),s=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),p=u??l,m=p.trim()!==l.trim();async function h(){try{await i({name:p}),d(null),a.success(Ve())}catch(e){a.error(_e(),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:ce()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:p,maxLength:120,placeholder:c(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!m,onClick:()=>void h(),children:o()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(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:Ie()})]}),(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:te()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(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:we()})]}),(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:he()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(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:O()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(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:be()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Oe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AE as i,BE as a,CE as o,DE as s,E as c,FE as l,GE as u,HE as d,HY as f,IE as p,JE as m,KE as h,LE as g,ME as _,MT as v,NE as y,NY as b,OE as ee,PE as te,QE as ne,RE as re,To as ie,UE as ae,UY as x,VE as oe,WE as se,XE as ce,ZE as le,_E as S,aD as ue,bD as de,cD as fe,dC as pe,dD as me,eD as C,fD as he,fE as w,gE as T,hD as ge,hE as _e,kE as ve,mD as E,mE as ye,nD as D,oD as be,pE as O,qE as k,t as A,vE as j,wo as xe,xD as Se,xE as M,yD as Ce,yE as N,zE as we}from"./api-Da6_RPKW.js";import{r as Te}from"./dist-C5rZMbyx.js";import{t as Ee}from"./list-ZFvO2UcJ.js";import{t as P}from"./button-DezjmYbu.js";import{$n as De,$t as Oe,A as F,An as ke,Bn as I,C as L,D as Ae,E as je,Gn as Me,I as Ne,Kn as Pe,M as Fe,N as Ie,O as Le,P as R,Qn as Re,S as ze,T as Be,Un as z,Vn as Ve,Xn as He,Yt as Ue,Zn as We,_ as Ge,_t as Ke,an as qe,b as Je,ct as Ye,d as Xe,dr as B,en as Ze,er as Qe,f as $e,fr as et,g as tt,gt as V,h as nt,ht as H,in as rt,j as U,k as it,lt as at,mt as ot,nn as W,p as st,pr as G,pt as ct,rn as lt,sr as ut,tn as dt,tr as ft,v as K,w as q,x as J,y as pt,zn as mt}from"./index-BcCFgPG0.js";var ht=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`}]]),gt=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`}]]),_t=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`}]]),Y=c(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function vt({className:e}){return(0,Z.jsx)(qe,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":N(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(ft,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=f(A.projects.renameProject),c=f(A.projects.setProjectColor),l=f(A.projects.moveProject),u=f(A.projects.deleteProject),d=f(A.projects.createProject),p=Ye(),m=nt(),h=at(),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(t),[b,ee]=(0,X.useState)(!1),[te,ne]=(0,X.useState)(!1),re=x(A.projects.projectTreeCount,te?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ze,{onOpenChange:e=>e&&ne(!0),children:[(0,Z.jsx)(vt,{className:i}),(0,Z.jsxs)(dt,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(W,{onSelect:()=>a(),children:[(0,Z.jsx)(Re,{}),` `,D()]}),(0,Z.jsxs)(W,{onSelect:()=>{y(t),_(!0)},children:[(0,Z.jsx)(Ve,{}),` `,j()]}),(0,Z.jsxs)(W,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:k(),label:Se(),placeholder:de(),confirmLabel:Ce()});t&&await d({name:t,parentId:e})})},children:[(0,Z.jsx)(We,{}),` `,k()]}),(0,Z.jsxs)(W,{onSelect:()=>ee(!0),children:[(0,Z.jsx)(gt,{}),` `,ve()]}),(0,Z.jsx)(lt,{children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":ye(),children:`✕`}),Ge.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(rt,{}),(0,Z.jsxs)(W,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=re?.folders??0,r=re?.chats??0;await p({title:ue({name:t}),description:st({folders:n,chats:r,days:m}),confirmWord:M(),confirmLabel:be(),destructive:!0})&&await u({projectId:e})})},children:[(0,Z.jsx)(ke,{}),` `,M()]})]})]}),(0,Z.jsx)(Je,{open:g,onOpenChange:_,title:me(),canSubmit:v.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:v.trim()}),_(!1)},submitLabel:j(),children:(0,Z.jsx)(Oe,{value:v,onChange:e=>y(e.target.value),autoFocus:!0})}),b?(0,Z.jsx)(tt,{open:b,onOpenChange:ee,title:s(),movingFolderId:e,currentId:r,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function yt({chat:e,currentFolderId:t,className:n}){let a=f(A.chats.pinChat),o=f(A.chats.deleteChat),s=f(A.chats.renameChat),c=f(A.chats.setChatSidebar),l=f(A.chats.moveChatToProject),u=Ye(),d=nt(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(e.title??``),[_,y]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ze,{children:[(0,Z.jsx)(vt,{className:n}),(0,Z.jsxs)(dt,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(W,{onSelect:()=>{g(e.title??``),m(!0)},children:[(0,Z.jsx)(Ve,{}),` `,j()]}),(0,Z.jsxs)(W,{onSelect:()=>void a({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(mt,{}):(0,Z.jsx)(I,{}),e.pinned?S():T()]}),(0,Z.jsxs)(W,{onSelect:()=>y(!0),children:[(0,Z.jsx)(gt,{}),` `,i()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(W,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(z,{}):(0,Z.jsx)(Y,{}),e.inSidebar?r():C()]}),(0,Z.jsx)(rt,{}),(0,Z.jsxs)(W,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:O(),description:w({days:d}),confirmLabel:M(),destructive:!0})&&await o({chatId:e._id})})},children:[(0,Z.jsx)(ke,{}),` `,M()]})]})]}),(0,Z.jsx)(Je,{open:p,onOpenChange:m,title:v(),canSubmit:h.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:h.trim()}),m(!1)},submitLabel:j(),children:(0,Z.jsx)(Oe,{value:h,onChange:e=>g(e.target.value),autoFocus:!0})}),_?(0,Z.jsx)(tt,{open:_,onOpenChange:y,title:ee(),currentId:t,onPick:t=>void l({chatId:e._id,projectId:t})}):null]})}function bt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function xt(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 St(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 Ct=`oc.projpage.view`;function wt(){let e=localStorage.getItem(Ct);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,Tt=e=>`col:${e??`null`}`,Et=e=>`crumb:${e}`;function Dt(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 Ot(){let{projectId:e}=G({from:`/project/$projectId`}),t=B(),n=x(A.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:l()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:te()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:y()})]}):(0,Z.jsx)(kt,{page:n})})}function kt({page:e}){let t=B(),n=Ye(),r=nt(),i=at(),a=Ue(),c=f(A.projects.renameProject),l=f(A.projects.setProjectColor),u=f(A.projects.deleteProject),h=f(A.projects.createProject),v=f(A.projects.moveProject),y=f(A.projects.setProjectSidebar),b=f(A.chats.moveChatToProject),ee=f(A.chats.reorderChat),te=f(A.projects.reorderProject),oe=x(A.projects.projectTreeCount,{projectId:e.project._id}),[S,fe]=(0,X.useState)(wt),C=e=>{localStorage.setItem(Ct,e),fe(e)},w=x(A.projects.folderColumns,S===`columns`?{projectId:e.project._id}:`skip`),T=x(A.projects.projectTreeList,S===`list`?{projectId:e.project._id}:`skip`),{c:E}=et({from:`/project/$projectId`}),D=x(A.projects.listProjects,{}),O=x(A.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(O??[]),[O]),{byChat:Te}=Ke(O??null),I=x(A.chatReads.myChatReads,{}),L=(0,X.useMemo)(()=>St(e.chats,I??[]),[e.chats,I]),{startNewChat:R,picker:Re}=Xe(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,$e]=(0,X.useState)(``),[V,U]=(0,X.useState)(!1),[G,ut]=(0,X.useState)(e.project.name),[K,mt]=(0,X.useState)(!1),[Y,vt]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>vt(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=x(A.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),yt=Ie(Fe(Ae,{activationConstraint:{distance:4}}),Fe(Le,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),Tt=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Et,Ot]=(0,X.useState)(null),kt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=w?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||ge()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(D??[]).find(t=>t._id===e)?.name??``}}return null},Mt=e=>Ot(kt(String(e.active.id))),Pt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:it(n(t?`folder:`:`chat:`))},[]),It=t=>{if(S===`columns`){for(let e of w?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(S===`list`){let e=T?.chats.find(e=>e._id===t);return e?{list:T.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(S===`columns`){for(let e of w?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(S===`list`){let e=T?.folders.find(e=>e._id===t);if(!e||!T)return null;let n=e.parentId??T.rootId;return{list:ot(T.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{Ot(null),Tt();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),o=i.startsWith(`chat:`);try{let e=Dt(r);if(e!==void 0){if(o)await b({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ct(D??[],t,e)){a.error(m());return}await v({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=It(t);if(!n)return;n.list.some(t=>t._id===e)||await b({chatId:e,projectId:n.folderId});let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ee({chatId:e,...a});return}if(!o&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!ct(D??[],e,n.parentId)){a.error(m());return}await v({projectId:e,parentId:n.parentId})}let o=xt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await te({projectId:e,...o});return}}catch{a.error(m())}},[,Bt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=pt(e.project),Ut=bt(e.chats,z),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{$.current||e()};return(0,Z.jsx)(H.Provider,{value:Te,children:(0,Z.jsxs)(Be,{sensors:yt,collisionDetection:Pt,onDragStart:Mt,onDragEnd:zt,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":_(),children:[Wt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(At,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:ie(),onClick:()=>{y({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Qe,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:xe()}),(0,Z.jsx)(De,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":ne(),children:[(0,Z.jsx)(P,{variant:S===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ne(),title:ne(),"aria-pressed":S===`cards`,onClick:()=>C(`cards`),children:(0,Z.jsx)(_t,{})}),(0,Z.jsx)(P,{variant:S===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":le(),title:le(),"aria-pressed":S===`columns`,onClick:()=>C(`columns`),children:(0,Z.jsx)(ht,{})}),(0,Z.jsx)(P,{variant:S===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ce(),title:ce(),"aria-pressed":S===`list`,onClick:()=>C(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void R({projectId:e.project._id}),children:[(0,Z.jsx)(Pe,{}),d()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:k(),label:Se(),placeholder:de(),confirmLabel:Ce()});t&&await h({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(We,{}),k()]}),(0,Z.jsxs)(Ze,{children:[(0,Z.jsx)(qe,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":he(),children:(0,Z.jsx)(ft,{})})}),(0,Z.jsxs)(dt,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(W,{onSelect:()=>{ut(e.project.name),U(!0)},children:[(0,Z.jsx)(Ve,{}),` `,j()]}),(0,Z.jsxs)(W,{onSelect:()=>mt(!0),children:[(0,Z.jsx)(gt,{}),` `,ve()]}),(0,Z.jsx)(lt,{children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e.project._id,color:null}),"aria-label":ye(),children:`✕`}),Ge.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(rt,{}),(0,Z.jsxs)(W,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=oe?.folders??0,o=oe?.chats??0;await n({title:ue({name:e.project.name}),description:st({folders:a,chats:o,days:r}),confirmWord:M(),confirmLabel:be(),destructive:!0})&&(await u({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,Z.jsx)(ke,{}),` `,M()]})]})]})]})]}),S===`columns`?(0,Z.jsx)(Rt,{data:w,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:E??null}):S===`list`?(0,Z.jsx)(Ft,{data:T,busyIds:N,suppressClick:$,locateChatId:E??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:se()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(J,{items:e.children.map(e=>`folder:${e._id}`),strategy:ze,children:e.children.map(t=>(0,Z.jsx)(jt,{child:t,parentId:e.project._id,now:Vt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ae()}),e.chats.length>0?(0,Z.jsx)(Oe,{value:z,onChange:e=>$e(e.target.value),placeholder:we(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?g():p()}):Ut.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:re({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(J,{items:Ut.map(e=>`chat:${e._id}`),strategy:q,children:Ut.map(t=>(0,Z.jsx)(Nt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:N.has(t._id),unread:L.has(t._id),locate:t._id===E,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:o()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:re({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&Ne(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Me,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||pe()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)(Je,{open:V,onOpenChange:U,title:me(),canSubmit:G.trim().length>0,onSubmit:async()=>{await c({projectId:e.project._id,name:G.trim()}),U(!1)},submitLabel:j(),children:(0,Z.jsx)(Oe,{value:G,onChange:e=>ut(e.target.value),autoFocus:!0})}),K?(0,Z.jsx)(tt,{open:K,onOpenChange:mt,title:s(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void v({projectId:e.project._id,parentId:t})}):null,Re]}),(0,Z.jsx)(je,{children:Et?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Et.kind===`folder`?(0,Z.jsx)(He,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Me,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Et.label})]}):null})]})})}function At({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=U({id:Et(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function jt({child:e,parentId:t,now:n,suppressClick:r}){let i=B(),o=L({id:`folder:${e._id}`}),s=U({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.setNodeRef(e)},className:`oc-projpage__card`+(s.isOver?` is-over`:``)+(o.isDragging?` is-dragging`:``),style:{"--proj-hue":pt(e),transform:R.Transform.toString(o.transform),transition:o.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}})},...o.listeners,...o.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(He,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?oe({count:e.folderCount})+` · `:``,a({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:$e(e.lastActivityAt,n)})]})}function Mt({chat:e}){let t=f(A.chats.setChatSidebar),n=e.inSidebar?r():C();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(z,{}):(0,Z.jsx)(Y,{})})}function Nt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,X.useContext)(H).get(e._id),c=B(),l=K(e.color),u=L({id:`chat:${e._id}`}),d=Pt(a);return(0,Z.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:R.Transform.toString(u.transform),transition:u.transition},children:[(0,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ge()}),e.pinned?(0,Z.jsx)(I,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:$e(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:V(s,E()).className,title:V(s,E()).label,"aria-label":V(s,E()).label}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:fe(),"aria-label":fe()}):null]}),(0,Z.jsx)(Mt,{chat:e}),(0,Z.jsx)(yt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Pt(e){let t=(0,X.useRef)(null);return(0,X.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,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b()});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=ot(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Lt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(J,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.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,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&ot(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:g()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=B(),c=L({id:`folder:${e._id}`}),l=U({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":pt(e),transform:R.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?h():u(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(ut,{size:13}):(0,Z.jsx)(Te,{size:13})}),(0,Z.jsx)(He,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,X.useContext)(H).get(e._id),o=B(),s=L({id:`chat:${e._id}`}),c=Pt(r),l=K(e.color);return(0,Z.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:R.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||ge()}),n?(0,Z.jsx)(`span`,{className:V(a,``).className,"aria-hidden":!0}):null]}),(0,Z.jsx)(yt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(Mt,{chat:e})]})}function Rt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.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=B(),s=U({id:Tt(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(J,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.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,Z.jsx)(J,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.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,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:p()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=L({id:`folder:${e._id}`}),o=U({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":pt(e),transform:R.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(He,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,X.useContext)(H).get(e._id),s=L({id:`chat:${e._id}`}),c=Pt(r),l=K(e.color);return(0,Z.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:R.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||ge()}),n?(0,Z.jsx)(`span`,{className:V(o,``).className,"aria-hidden":!0}):null]}),(0,Z.jsx)(yt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(Mt,{chat:e})]})}export{Ot as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ak as r,Bd as i,Bp as a,Ck as o,Dk as s,Ek as c,HY as l,Hp as u,Id as d,Jd as f,Ld as p,Ok as m,Rd as h,Rk as g,Rp as _,Sk as ee,Tk as te,UY as v,Vp as y,Xd as b,Yd as x,_k as S,au as C,bk as w,fk as T,gk as E,hk as ne,jk as re,kk as ie,mk as ae,ou as oe,pk as D,qd as O,su as k,t as A,vk as j,wk as M,xk as N,xo as P,yk as F,zd as I,zk as L,zp as R}from"./api-Da6_RPKW.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-By4I98vO.js";import{t as U}from"./button-DezjmYbu.js";import{Mt as W,St as G,Yt as se,bt as K,ft as ce,gn as le,hn as ue,mn as de,pn as q,vt as J,xt as Y,yt as X}from"./index-BcCFgPG0.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:c,help:te},documentary_fetch:{label:M,help:o},inbound_files:{label:ee,help:N},history_summary:{label:u,help:y},file_curation:{label:b,help:i},quote_reply:{label:x,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:ae,references:D,files:T,previous_summary:a,new_messages:R,max_chars:_,file_name:I,budget_chars:h,feedback:p,content:d,excerpt:O};function _e(){let e=v(A.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()})});let i=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:re(),help:r()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:w()}),(0,$.jsxs)(J,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:i},i._id)]})}function ve({instance:e}){let t=l(A.admin.upsertInstanceConfig),n=se(),r=v(A.me.getMe,{host:ce}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>z(i,a));(0,Q.useEffect)(()=>{s(z(i,a))},[a,e._id]);let[c,u]=(0,Q.useState)(!1),d=o.promptInjections,f=(e,t)=>s({...o,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:V(o,i,a)})}catch(e){n.error(g(),e)}finally{u(!1)}}async function m(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(g(),e)}}let h=e.config?.contentLocale??`default`,_=fe[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:k()}),(0,$.jsxs)(J,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:C({locale:_})}),pe().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:oe()})]}),de.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:d[e]??{enabled:!0,template:q[e].defaultTemplate[a]},contentLocale:a,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void p(),disabled:c,children:L()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=ue(e,r,i),p=f?le(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(W,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:m()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?S():j()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:ie()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:E()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:P()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ne()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AN as r,CN as i,DN as a,EN as o,GM as ee,HM as s,HY as c,JM as l,KM as u,MN as d,ON as f,SN as p,TN as m,UM as te,UY as ne,WM as re,XM as ie,YM as h,_N as g,aN as _,bN as v,bf as y,cN as b,dN as x,fN as ae,gN as oe,hN as S,iN as C,jN as w,kN as T,lN as E,mN as D,nN as O,oN as k,pN as A,qM as j,rN as M,sN as N,t as P,uN as F,vN as I,wN as L,xN as R,yN as z}from"./api-Da6_RPKW.js";import{t as B}from"./button-DezjmYbu.js";import{$t as V,Jt as H,Mt as U,Yt as W,b as G,ct as K,qn as q}from"./index-BcCFgPG0.js";import{t as J}from"./roleDescriptions-m4nebceN.js";var Y=t(e(),1),X=n(),Z=[{group:()=>d(),keys:[{key:`traces.read`,label:()=>a()},{key:`traces.read.content`,label:()=>o(),phi:!0},{key:`traces.write`,label:()=>m()}]},{group:()=>w(),keys:[{key:`kpi.read`,label:()=>a()},{key:`kpi.write`,label:()=>m()}]},{group:()=>r(),keys:[{key:`openclaw.query`,label:()=>L()},{key:`anomalies.read`,label:()=>i()},{key:`anomalies.report`,label:()=>p()}]},{group:()=>T(),keys:[{key:`chats.read`,label:()=>a()},{key:`selfheal`,label:()=>v()},{key:`media.repair`,label:()=>z()},{key:`feedback.respond`,label:()=>y()}]},{group:()=>f(),keys:[{key:`admin.manage`,label:()=>R()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=ne(P.apiKeys.listRoles,{}),t=c(P.apiKeys.createRole),n=c(P.apiKeys.ensureRolesSeeded),r=c(P.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(P.apiKeys.listRoles,{});r&&e.setQuery(P.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=K(),a=W(),[o,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)($),[m,v]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{a.error(g(),e)})},[n,a]);let y=e??[];async function w(e,t){if(Q(e.permissions))return;if(e.builtin){await i({title:oe({name:e.name}),description:S(),confirmLabel:D()});return}if(m.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];v(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(A(),e)}finally{v(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function T(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),p($),d(!1)}catch(e){a.error(ae(),e)}}let L=e===void 0,R=!L&&y.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,F(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,E()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:b()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{p($),d(!0)},children:N()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:C()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?I({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:y.map(e=>{let t=Q(e.permissions),n=m.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,M()]}):(0,X.jsx)(H,{variant:`secondary`,children:O()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ie():n?h():r,onCheckedChange:()=>void w(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:o,onOpenChange:d,title:l(),description:j(),canSubmit:!!(f.key&&f.name),onSubmit:T,submitLabel:u(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(V,{value:f.key,placeholder:re(),onChange:e=>p({...f,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(V,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,X.jsx)(V,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|