@lacneu/atrium 0.97.0 → 0.98.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-CHD9OGB2.js → AccessTab-Bsu_pBw1.js} +1 -1
- package/dist/assets/{AdvancedFilter-DtBAnHBl.js → AdvancedFilter-DuAvb6_v.js} +1 -1
- package/dist/assets/AgentFilesTab-CajvKiFH.js +3 -0
- package/dist/assets/AnomaliesTab-DQLh8Yyx.js +1 -0
- package/dist/assets/AuditTab-PwLy5ZSV.js +1 -0
- package/dist/assets/BridgeTab-60WDe9Oh.js +1 -0
- package/dist/assets/ChatDefaultsTab-DhtiaDDk.js +1 -0
- package/dist/assets/{DataTableShell-D-TTxNiz.js → DataTableShell-CZIWIEsI.js} +1 -1
- package/dist/assets/DeletedChatsTab-bjOae5ku.js +1 -0
- package/dist/assets/{DetailChips-BG1A-DBR.js → DetailChips-Bv8rGcLM.js} +1 -1
- package/dist/assets/FeedbacksTab-BqOxEjoz.js +1 -0
- package/dist/assets/{FieldLabel-CYivkNb7.js → FieldLabel-BO1-yXaX.js} +1 -1
- package/dist/assets/FilesTab-CTieLSvW.js +1 -0
- package/dist/assets/{FilterBar-BcbgCjju.js → FilterBar-D1f8IVOZ.js} +1 -1
- package/dist/assets/{GroupsTab-Bu6exndB.js → GroupsTab-CJdGd3CX.js} +1 -1
- package/dist/assets/InstancesTab-DSvIWt7d.js +1 -0
- package/dist/assets/{IntegrationsTab-DkNTP0Rq.js → IntegrationsTab-DGyO4LdP.js} +1 -1
- package/dist/assets/KpiTab-DKy1FYxU.js +1 -0
- package/dist/assets/PreferencesTab-BtQQuvK8.js +1 -0
- package/dist/assets/ProjectPage-V-mFGtPc.js +1 -0
- package/dist/assets/PromptInjectionsTab-M0j0v8Zw.js +4 -0
- package/dist/assets/RolesTab-BEy1GjmZ.js +1 -0
- package/dist/assets/ScheduledTab-nN388CYz.js +1 -0
- package/dist/assets/ServiceAccountsTab-C4duhDDt.js +1 -0
- package/dist/assets/{SubAgentReportsTab-f79L5P5H.js → SubAgentReportsTab-Cq86t53b.js} +1 -1
- package/dist/assets/ThemeShowroom-BiL-NcBn.js +1 -0
- package/dist/assets/{TimeRangePicker-spgMK1lW.js → TimeRangePicker-BMeAmmsC.js} +1 -1
- package/dist/assets/{TimezoneCombobox-A-0jP4K0.js → TimezoneCombobox-JvLcqMC7.js} +1 -1
- package/dist/assets/TracesTab-DAR8-pmx.js +1 -0
- package/dist/assets/{TrashTab-DvQVUDCO.js → TrashTab-C34S9sxA.js} +1 -1
- package/dist/assets/UsersTab-Mu9Duc2n.js +1 -0
- package/dist/assets/{VoiceTab--hK27XzX.js → VoiceTab-3yLkRehJ.js} +1 -1
- package/dist/assets/{api-B8SYK4Qy.js → api-BEXV-QDx.js} +5 -5
- package/dist/assets/{button-CXjFGJbj.js → button-BI4NYd7l.js} +1 -1
- package/dist/assets/{card-RKiqrSX4.js → card-CUy80Snk.js} +1 -1
- package/dist/assets/chevrons-up-down-BBnIDUVh.js +1 -0
- package/dist/assets/{compatView-DTsAloUX.js → compatView-C6vyLpqy.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CPqs6Yse.js → dispatchErrorInfo-U1f-h1hb.js} +1 -1
- package/dist/assets/{dist-Bt7EMDhU.js → dist-BgUgjwlI.js} +1 -1
- package/dist/assets/{dist-CtzGb_ur.js → dist-Yi0k4JhM.js} +1 -1
- package/dist/assets/{dist-7qJAgXuT.js → dist-ibS6mHJS.js} +1 -1
- package/dist/assets/{dist-DV2cg11u.js → dist-xED7lptS.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-D7hrEPuh.js → highlighted-body-OFNGDK62-DaG1VFZL.js} +1 -1
- package/dist/assets/index-04n15OUt.css +1 -0
- package/dist/assets/index-DQx8LX7A.js +448 -0
- package/dist/assets/{list-77P9EclZ.js → list-CMpIlPcq.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DWPlOIbJ.js +1 -0
- package/dist/assets/{pdf-d0093JRQ.js → pdf-D3L6KL-o.js} +1 -1
- package/dist/assets/roleDescriptions-BUL4ira1.js +1 -0
- package/dist/assets/{table-BpXDMEP0.js → table-CvUcBPgp.js} +1 -1
- package/dist/assets/trashPage-B36nmIyS.js +1 -0
- package/dist/assets/{use_paginated_query-DXjegJvG.js → use_paginated_query-CWrNoLih.js} +1 -1
- package/dist/assets/x-ijoBrBAS.js +1 -0
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-Dv3deQ0j.js +0 -3
- package/dist/assets/AnomaliesTab-DhbNorRL.js +0 -1
- package/dist/assets/AuditTab-CyAOp6ce.js +0 -1
- package/dist/assets/BridgeTab-BUWF4UrP.js +0 -1
- package/dist/assets/ChatDefaultsTab-DiPPZqHr.js +0 -1
- package/dist/assets/DeletedChatsTab-BdBsLuP7.js +0 -1
- package/dist/assets/FeedbacksTab-Dgzk0NDh.js +0 -1
- package/dist/assets/FilesTab-B0bwkp5L.js +0 -1
- package/dist/assets/InstancesTab-DG5eRqcF.js +0 -1
- package/dist/assets/KpiTab-DxUA3rWG.js +0 -1
- package/dist/assets/PreferencesTab-CvrFdw7V.js +0 -1
- package/dist/assets/ProjectPage-IHPI3vtI.js +0 -1
- package/dist/assets/PromptInjectionsTab-WqUP6pCA.js +0 -4
- package/dist/assets/RolesTab-CW-SViZn.js +0 -1
- package/dist/assets/ScheduledTab-xhuLTCC1.js +0 -1
- package/dist/assets/ServiceAccountsTab-CPgJugHH.js +0 -1
- package/dist/assets/ThemeShowroom-DCvO9d1X.js +0 -1
- package/dist/assets/TracesTab-LLYV5o4G.js +0 -1
- package/dist/assets/UsersTab-jG9dMte6.js +0 -1
- package/dist/assets/chevrons-up-down-C5nDK8w5.js +0 -1
- package/dist/assets/index-CJlTinIx.css +0 -1
- package/dist/assets/index-DDEtFVdr.js +0 -448
- package/dist/assets/mermaid-GHXKKRXX-CaN0vriA.js +0 -1
- package/dist/assets/roleDescriptions-Cr2PVmkf.js +0 -1
- package/dist/assets/trashPage-LA_ooyZZ.js +0 -1
- package/dist/assets/x-Cqa-YMkZ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aN as e,iN as t,oN as n,rN as r,sN as i}from"./api-BEXV-QDx.js";var a={pending:i,user:n,admin:e,observer:t,agent:r};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-BEXV-QDx.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{cE as t,dE as n,fE as r,lE as i,rE as a,sE as o,uE as s,vD as c}from"./api-BEXV-QDx.js";import{t as l}from"./button-BI4NYd7l.js";import{An as u,In as d,ct as f,kt as p,m}from"./index-DQx8LX7A.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:a()})}function _({items:e,onRestore:a,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||c()}),(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,` · `]}),r({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 a(e._id),children:[(0,h.jsx)(d,{}),` `,s()]}),(0,h.jsxs)(l,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:async()=>{await _({title:t(),description:o(),confirmLabel:i(),destructive:!0})&&await g(e._id)},children:[(0,h.jsx)(u,{}),` `,i()]})]})]},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{dX as n,mX as r,sX as i,xX as a,yX as o}from"./api-BEXV-QDx.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(a(g)),_,u.initialNumItems,m]),[y,b]=(0,s.useState)(v),x=y;(r(e)!==r(y.query)||JSON.stringify(a(g))!==JSON.stringify(a(y.args))||m!==y.skip)&&(x=v(),b(x));let S=n().logger,C=i(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 o&&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-BEXV-QDx.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-DQx8LX7A.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-BEXV-QDx.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-xED7lptS.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BgUgjwlI.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-ibS6mHJS.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Yi0k4JhM.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/x-ijoBrBAS.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/button-BI4NYd7l.js">
|
|
74
|
+
<link rel="stylesheet" crossorigin href="/assets/index-04n15OUt.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.98.1",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,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,C_ as o,D_ as s,E_ as c,F_ as l,Fd as u,I_ as d,M_ as ee,Md as f,N_ as p,Nd as m,O_ as h,P_ as g,Pd as _,Qd as v,S_ as y,Sv as b,T_ as x,Zd as S,__ as C,_f as w,af as T,b_ as te,bv as ne,c_ as E,cf as D,dV as O,d_ as k,df as A,eX as j,ef as M,f_ as N,ff as P,g_ as F,gf as I,h_ as L,hf as R,if as z,j_ as re,jd as B,k_ as ie,kd as ae,lX as oe,l_ as V,lf as H,m_ as se,mf as ce,nX as U,nf as le,of as ue,p_ as de,pf as fe,rf as pe,sX as W,s_ as me,sf as he,ss as ge,t as G,tf as _e,uX as K,u_ as ve,uf as ye,v_ as be,w_ as xe,x_ as Se,y_ as Ce}from"./api-B8SYK4Qy.js";import{t as q}from"./button-CXjFGJbj.js";import{Bt as we,Ct as Te,Dt as Ee,Gt as De,Ht as Oe,Jt as ke,Kt as Ae,Ot as je,St as Me,Tt as Ne,Ut as Pe,Vt as Fe,Wt as Ie,Yt as J,bt as Le,ft as Re,kn as Y,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-DDEtFVdr.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-DTsAloUX.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=K(G.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=K(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[t,r,a]);let u=K(G.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),f=K(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,u,r,f]),[_,v]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!_||!m.some(e=>$(e)===_))&&v($(m[0]))},[m,_]);let y=m?.find(e=>$(e)===_)??null,b=W(G.agentFiles.listAgentFiles),[S,C]=(0,X.useState)({status:`idle`}),w=y?.instanceName??null,T=y?.agentId??null,te=K(G.compat.forInstance,n&&w!==null?{instanceName:w}:`skip`),E=n&&w!==null?ze(te,`agentFiles`):null,D=E===null?!1:E===`loading`?null:E.blocked,O=(0,X.useCallback)(async()=>{if(!(w===null||T===null)){C({status:`loading`});try{C({status:`done`,files:(await b({instanceName:w,agentId:T})).files})}catch(e){C({status:`error`,dashboardAbsent:tt(e)})}}},[b,w,T]);(0,X.useEffect)(()=>{D===!1&&O()},[O,D]);let[k,A]=(0,X.useState)(null),M=K(G.agentFileCuration.listCurations,t&&w!==null&&T!==null?{instanceName:w,agentId:T}:`skip`),N=K(G.agentFileCuration.curationSettings,t&&w!==null?{instanceName:w}:`skip`),F=W(G.agentFileCuration.requestCuration),[I,L]=(0,X.useState)(null),[R,z]=(0,X.useState)(null),{toast:B}=J(),ae=(0,X.useMemo)(()=>{let e=new Map;for(let t of M??[])e.has(t.name)||e.set(t.name,t);return e},[M]),oe=(0,X.useCallback)(async e=>{if(!(w===null||T===null)){L(e);try{let t=await F({instanceName:w,agentId:T,name:e,trigger:`manual`});t.ok?B({title:ce(),variant:`success`}):B({title:fe({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:P(),variant:`error`})}finally{L(null)}}},[F,w,T,B]),V=U(),H=(0,X.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ve,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":l(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:(r??[]).map(e=>(0,Q.jsx)(Le,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(Ve,{value:_??``,onValueChange:e=>v(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":g(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:m.map(e=>(0,Q.jsx)(Le,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}),y===null?null:E===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):E!==null&&E.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(E.gatewayVersion,E.provider)]}):S.status===`loading`||S.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):S.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[S.dashboardAbsent?ge():re(),` `,!S.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:ne()})]}):S.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:S.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(ke,{variant:`outline`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ie({size:Z(e.size,V)})}),(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:h({pct:H.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":s()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>A(e),children:t?x():xe()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:N?.budgetChars??null,enabled:N?.enabled??!1,curation:ae.get(e.name)??null,inFlight:I===e.name,onCurate:()=>void oe(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:c({used:Z(Qe(S.files),V),total:Z(Ye,V),pct:H.format(Ze(Qe(S.files)))})})]}),k&&y?(0,Q.jsx)(at,{instanceName:y.instanceName,agentId:y.agentId,name:k.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void O()}):null,R?(0,Q.jsx)(ot,{curationId:R,onClose:()=>z(null),onApplied:()=>{z(null),O()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:I()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:R()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:w()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let s=W(G.agentFiles.getAgentFile),c=W(G.agentFiles.setAgentFile),l=J(),[u,d]=(0,X.useState)(null),[ee,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!1),D=(0,X.useCallback)(async r=>{f(!1);try{let i=await s({instanceName:e,agentId:t,name:n});d({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),S(!1)}catch{f(!0)}},[s,e,t,n]);(0,X.useEffect)(()=>{D(!1)},[D]);async function A(){if(u!==null){v(!0),T(!1);try{await c({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:u.updatedAtMs??void 0}),l.success(C({name:n})),a(),await D(!1)}catch(e){nt(e)?S(!0):T(!0)}finally{v(!1)}}}let M=u!==null&&p!==u.content,P=(0,X.useMemo)(()=>u===null?null:et(u.content,p),[u,p]),I=p.length>Je,R=U(),z=(0,X.useMemo)(()=>new Intl.NumberFormat(R),[R]);return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(He,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:o({name:n})}),(0,Q.jsxs)(Ne,{children:[y({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Se()]})]})]}),ee?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[L(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:ne()})]}):u===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":o({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:te()}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[se(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:de()})]}):null,w?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:F()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${I?` is-over`:``}`,children:Ce({count:z.format(p.length),max:z.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!M||_||x,onClick:()=>g(!0),children:_?b():be()}):null]})]}),(0,Q.jsx)(we,{open:h,onOpenChange:g,children:(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Be,{children:N({name:n})}),(0,Q.jsx)(Ie,{children:k({agent:t})})]}),P?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ve({added:P.added,removed:P.removed})}),P.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:V()}),P.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),P.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Oe,{children:O()}),(0,Q.jsx)(Fe,{onClick:()=>void A(),children:me()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=K(G.agentFileCuration.getProposal,{curationId:e}),o=W(G.agentFileCuration.approveCuration),s=oe(G.agentFileCuration.rejectCuration),{toast:c}=J(),[l,d]=(0,X.useState)(null),[ee,p]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),y=U(),x=(0,X.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function C(){d(`approve`);try{let t=await o({curationId:e});t.ok?(c({title:A(),variant:`success`}),n()):c({title:t.reason===`conflict`?H():D({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:P(),variant:`error`})}finally{d(null)}}async function w(n){d(`reject`);try{let r=h.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?a():ye(),variant:`success`}):c({title:T(),variant:`error`}),t()}catch{c({title:P(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(He,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:i?he({name:i.name}):j()}),(0,Q.jsx)(Ne,{children:ue()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[z({before:Z(i.beforeSize,y),after:Z(i.proposedSize,y)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,pe()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:le({added:x.added,removed:x.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ae({feedback:i.feedback})}):null,x&&x.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:S()}),(0,Q.jsx)(`ul`,{children:x.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:v()}),(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:_e()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),ee?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:u()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:_(),value:h,onChange:e=>g(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>p(!1),disabled:l!==null,children:m()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void w(!1),disabled:l!==null,children:l===`reject`?b():f()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void w(!0),disabled:l!==null,children:l===`reject`?b():B()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>p(!0),disabled:l!==null||i==null,children:M()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void C(),disabled:l!==null||i==null,children:l===`approve`?b():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 ee,CM as a,DM as te,EM as ne,FM as re,HM as o,IM as ie,LM as ae,MM as oe,NM as se,OM as ce,PM as s,Qj as c,RM as l,SM as u,TM as le,UM as d,VM as ue,WM as f,Xj as p,Yj as m,Zj as h,_M as de,aM as fe,bM as pe,cM as me,dM as he,eM as g,fM as ge,gM as _,hM as _e,iM as ve,jM as ye,kM as be,lM as xe,lX as Se,mM as v,nM as y,oM as Ce,pM as b,rM as x,sM as S,t as C,tM as w,uM as T,uX as E,vM as D,wM as O,xM as k,yM as A,zM as we}from"./api-B8SYK4Qy.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-DDEtFVdr.js";import{n as je}from"./TimeRangePicker-spgMK1lW.js";import{t as Me}from"./FilterBar-BcbgCjju.js";import{t as Ne}from"./DataTableShell-D-TTxNiz.js";import{t as U}from"./dispatchErrorInfo-CPqs6Yse.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`?f():e===`acknowledged`?d():o()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],X={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=De({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,r=e.status===Z?Y:e.status,o=e.severity??Y,c=e.kind??Y,[d,f]=(0,W.useState)(Y),p=ke(e.from,e.to),{from:m,to:h}=je(p),g=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),y=e=>void t({search:t=>({...t,status:e===Y?Z:e})}),w=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=Se(C.anomalies.resolveAnomaly),G=(E(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),K=E(C.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:m,to:h,anomalyStatus:r===Y?void 0:r,severity:o===Y?void 0:o,source:d===Y?void 0:d,kind:c===Y?void 0:c}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Q=n!==``||r!==`open`||o!==Y||d!==Y||c!==Y||p.kind!==`relative`||p.from!==X.from;function $(){f(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:ue(),description:(0,J.jsxs)(J.Fragment,{children:[ee(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,we(),` `,(0,J.jsx)(`strong`,{children:l()}),`.`,` `,ae()]}),confirmLabel:ie()}))try{await U({anomalyId:e._id,status:`resolved`}),B.success(re(),e.kind)}catch(e){B.error(s(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),B.success(se(),e.kind)}catch(e){B.error(oe(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ye(),` `,(0,J.jsx)(`strong`,{children:i()}),` `,be(),` `,(0,J.jsx)(`strong`,{children:ce()}),` `,te(),` `,(0,J.jsx)(`strong`,{children:ne()}),` `,le(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:O()})]}),(0,J.jsxs)(Me,{q:n,onQChange:g,searchPlaceholder:a(),timeRange:p,onTimeRangeChange:N,onReset:$,canReset:Q,children:[(0,J.jsxs)(z,{value:r,onValueChange:y,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:u()}),Pe.map(e=>(0,J.jsx)(L,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(z,{value:o,onValueChange:w,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:k()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:de()}),Ie.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:d,onValueChange:f,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:_()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:_e()}),Le.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:c,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:b()}),q.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:ge(),rows:K,emptyHint:r===`open`?he():T(),rowActions:e=>G&&e.status===`open`?[{label:xe(),onSelect:()=>void We(e)},{label:me(),onSelect:()=>void Ge(e)}]:[],columns:[{header:S(),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:D({when:j(e.firstAt)}),children:A({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:k(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:Ce(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,J.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:fe(),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)(Be,{row:e})]}),sort:e=>e.message},{header:ve(),cell:e=>(0,J.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:x(),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 $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=$(e);return(0,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:[`↗ `,y()]}):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:[`↗ `,y()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),i=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:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,y()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),i=E(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:[w(),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:g()})}),i===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:r()}):i.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:c()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:i.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 Ve({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:h()}):e===`acknowledged`?(0,J.jsx)(P,{variant:`secondary`,children:p()}):(0,J.jsx)(P,{variant:`outline`,children:m()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,BN as i,Du as a,Eu as o,GN as s,HN as c,IN as l,JN as u,KN as d,LN as f,Ou as p,RN as m,UN as h,VN as g,WN as _,XN as v,YN as y,ju as b,ku as x,qN as S,t as C,uX as w,zN as T}from"./api-B8SYK4Qy.js";import{At as E,St as D,a as O,bt as k,dr as A,fr as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-DDEtFVdr.js";import{n as ee}from"./TimeRangePicker-spgMK1lW.js";import{t as z}from"./FilterBar-BcbgCjju.js";import{t as B}from"./AdvancedFilter-DtBAnHBl.js";import{t as V}from"./DataTableShell-D-TTxNiz.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:b()},{value:`realLabel`,label:r()},{value:`targetLabel`,label:x()},{value:`impersonated`,label:p()},{value:`resource`,label:a()},{value:`resourceId`,label:o()}];function q(){let e=j({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,r=e.action??G,a=e.impersonated??G,o=e.resource??G,p=M(e.from,e.to),b=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:x,to:N}=ee(p),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:O(e)}),replace:!0}),$=w(C.admin.listAudit,{filter:{q:n||void 0,from:x,to:N,action:r===G?void 0:r,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:b.length>0?b:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||a!==G||o!==G||b.length>0||p.kind!==`relative`||p.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:y()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:u(),timeRange:p,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(I,{value:r,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:S()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:d()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:a,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:s()}),(0,U.jsx)(k,{value:`yes`,children:_()}),(0,U.jsx)(k,{value:`no`,children:h()})]})]}),(0,U.jsxs)(I,{value:o,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:c()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:g()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:b,onChange:Q}),(0,U.jsx)(V,{title:i(),rows:$,emptyHint:T(),columns:[{header:m(),cell:e=>E(e.at),sort:e=>e.at},{header:S(),cell:e=>e.action,sort:e=>e.action},{header:f(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:l(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:c(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AO as i,BO as a,Bg as o,Bk as s,CO as c,DO as l,E as u,EO as d,FO as f,GO as p,Gg as m,Gk as h,HO as g,Hg as _,Hk as ee,IO as v,Ik as te,JO as y,Jg as ne,Jl as re,KO as ie,Kg as ae,Kk as oe,LO as se,Lk as ce,MO as le,Mg as ue,Mk as de,NO as fe,Nk as pe,OO as me,PO as he,QO as ge,RO as _e,Rg as ve,Rk as ye,SO as be,TO as xe,UO as Se,Ug as Ce,Uk as we,VO as b,Va as Te,Vg as Ee,Vk as De,WO as Oe,Wg as ke,XO as Ae,Xg as je,Xl as Me,YO as Ne,Yg as Pe,Yl as Fe,ZO as Ie,Zl as Le,_O as Re,ak as ze,bO as Be,ck as Ve,cs as He,ek as Ue,eu as We,fO as Ge,gO as Ke,hO as qe,ik as Je,jO as Ye,kO as Xe,lX as Ze,lk as Qe,mO as x,nk as $e,ok as et,pO as S,qO as tt,qg as nt,ql as rt,rk as it,sX as at,sk as ot,t as C,tk as st,uX as w,uk as ct,vO as lt,wO as ut,xO as dt,yO as ft,zO as pt,zg as mt,zk as ht}from"./api-B8SYK4Qy.js";import{r as T}from"./dist-7qJAgXuT.js";import{t as gt}from"./chevrons-up-down-C5nDK8w5.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-CYivkNb7.js";import{t as xt}from"./button-CXjFGJbj.js";import{$t as D,At as St,Ct,Dt as wt,Jn as Tt,Jt as O,L as Et,Mt as Dt,Ot,Pn as k,St as A,Tt as kt,Yt as At,ar as j,at as jt,bt as M,cn as Mt,dr as N,fr as Nt,ft as Pt,it as Ft,jt as P,kn as F,on as It,or as Lt,ot as Rt,sn as zt,sr as I,st as Bt,vt as L,wt as Vt,xt as R,yt as z}from"./index-DDEtFVdr.js";import{r as Ht}from"./locales-CPjguROj.js";import{a as B,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-BpXDMEP0.js";import{t as Gt}from"./FilterBar-BcbgCjju.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-DTsAloUX.js";import{t as W}from"./dispatchErrorInfo-CPqs6Yse.js";var $t=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function K(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return an(e)||K(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]),u=(0,G.useMemo)(()=>gn(s),[s]),f=(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:l(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:xe()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),u.map(e=>(0,Q.jsx)(M,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(A,{placeholder:ut()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),f.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:c()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),p.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:dt(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Be(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ft(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:lt(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Re(),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)(Lt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=K(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:P(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?` · ${P(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:[Te({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${P(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:[me({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${P(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?x():e===`error`?S():Ge()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:x()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:S()}):(0,Q.jsx)(O,{variant:`outline`,children:Ge()})}function Cn(){return w(C.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=w(C.compat.getBridgeCompat,{}),n=w(C.me.getMe,{host:Pt})?.role===`admin`,r=w(C.admin.listInstances,n?{}:`skip`),i=w(C.agents.usageForInstances,n?{}:`skip`),a=N(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Nt({from:`/settings/bridge`}),l=N({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:Ae()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ne()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Le()}),(0,Q.jsx)(V,{children:Me()}),(0,Q.jsx)(V,{children:Fe()}),(0,Q.jsx)(V,{children:re()}),(0,Q.jsx)(V,{children:rt()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(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)(O,{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)(Ft,{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)(Rt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(Bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(jt,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,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:ne(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,nt({build:t.buildVersion??`?`})]}):null,` · `,ae(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?m():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()});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`,p=St(e.checkedAt),h=e.startedAt==null?null:St(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)(j,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?pt():l===`gateways_unreachable`?f({count:u.length}):c?_e():se({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}),` `,v({time:p})]}),h?(0,Q.jsx)(`span`,{children:fe({time:h})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:he({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:le()})]})}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)(k,{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)(O,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:je()}),(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)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{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:[y(),i.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:ie({count:i.length})}):a>0?(0,Q.jsx)(O,{variant:`destructive`,children:p()}):(0,Q.jsx)(O,{variant:`secondary`,children:tt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Oe({version:e.vendoredVersion}),r?` · `+Se({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),g({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:b()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:We({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:_({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:m()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(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)(O,{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)(Ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Vt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(wt,{children:[(0,Q.jsx)(Ot,{children:oe({instance:e.displayName??e.name})}),(0,Q.jsx)(kt,{children:h()})]}),(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)(j,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ue():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=Ze(C.admin.upsertInstanceConfig),r=at(C.bridge.validateMediaPaths),i=At(),a=Ht(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>_t(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(null),h=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=h||g;async function v(){f(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Je(),e)}finally{f(!1)}}async function y(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(ye(),e)}finally{u(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:we(),help:ce()}),(0,Q.jsxs)(L,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:bt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ee(),help:te()}),(0,Q.jsxs)(L,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:vt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:De(),help:pe()}),(0,Q.jsx)(D,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ct(),help:Qe()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ve(),help:ot()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Dt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Q.jsx)(E,{label:s(),help:de()})]}),_&&p!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ie({reason:p.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:$e(),result:p.inbound}),(0,Q.jsx)(An,{label:st(),result:p.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)(F,{"aria-hidden":!0}),ge()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void v(),disabled:d,children:[d?(0,Q.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ze():et()]}),(0,Q.jsx)(xt,{size:`sm`,onClick:()=>void y(),disabled:l,children:ht()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(It,{children:[(0,Q.jsx)(Mt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ee():o({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(zt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:mt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{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,Ct as a,F_ as o,Qg as s,St as c,Sv as l,Tt as u,Wk as d,Zg as f,_p as p,_t as m,a_ as h,at as g,bt as _,bv as v,ct as y,dp as b,dt as x,eX as S,e_ as C,et as ee,fp as te,ft as ne,gp as w,gt as re,gv as ie,hp as ae,ht as T,hv as oe,i_ as E,it as D,lX as O,lt as se,mp as k,mt as A,n_ as j,nt as ce,ot as le,pp as ue,pt as de,r_ as fe,rt as pe,sX as M,st as me,t as N,t_ as he,tt as ge,uX as P,up as _e,ut as ve,vp as F,vt as ye,wt as be,xt as xe,yp as Se,yt as Ce}from"./api-B8SYK4Qy.js";import{t as we}from"./use_paginated_query-DXjegJvG.js";import{t as I}from"./button-CXjFGJbj.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-DDEtFVdr.js";import{a as Oe}from"./compatView-DTsAloUX.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 c();case`hybrid`:return xe();case`tool`:return _();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)?D():null:T(),i=Y(e),a=t.injection!==i.injection||!X(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:m()}}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`?de():e.code===`write_unknown`||e.code===`not_confirmed`?ve():e.code===`not_applied`?se():e.code===`default_too_large`?ce():e.code===`allowlist_too_large`?pe():e.code===`plugin_too_old`?D():e.code===`source_not_allowed`?g():e.code===`plugin_config_lag`?le():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?re():ne({code:e.code})}function Pe(e,t){let n=q(e),r=q(t);if(n.injection!==r.injection||!X(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let i=M(N.knowledge.setAgentKnowledgeDefault),[o,c]=(0,G.useState)(t),[u,d]=(0,G.useState)(()=>Y(t)),[f,p]=(0,G.useState)(`idle`),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),v=e=>{c(e),d(Y(e)),h(null)},y=Pe(o,t);(0,G.useEffect)(()=>{g&&y&&(_(!1),v(t))},[g,y]);let b=Me(o,u,n),S=b.readOnlyReason===null;async function C(){p(`saving`),h(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:u.injection,sources:u.sources,expected:q(o)}));h(n),p(n===null?`done`:`idle`),n===null&&_(!0)}catch(e){h(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),p(`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:u.injection,onValueChange:e=>{J(e)&&d({...u,injection:e})},disabled:!S,children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":a(),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:u.sources.includes(e.id),onCheckedChange:()=>d(Z(t,u,e.id)),disabled:!S,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!g?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ge(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:ee()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()}),S?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(I,{size:`sm`,disabled:!b.dirty||!b.valid||f===`saving`,onClick:()=>void C(),children:f===`saving`?l():r()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:b.readOnlyReason}),S&&b.dirty&&b.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b.invalidReason}):null,f===`done`&&m===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,m===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m})]})]})}function Ie({instanceName:e}){let t=P(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(N.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":u(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:T()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:y({shown:n.length})}),(0,$.jsx)(I,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:me()})]}):null]})}function Le({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=P(N.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,G.useState)(i),[c,u]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(i),u(`idle`)},[e._id,i]);let d=`__none__`,p=a!==i;async function m(){u(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let h=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(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":w(),children:(0,$.jsx)(z,{placeholder:k()})}),(0,$.jsxs)(W,{children:[(0,$.jsx)(B,{value:d,children:k()}),h.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||c===`saving`,onClick:()=>void m(),children:c===`saving`?l():r()})]}),c===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,c===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}):null]})}function Re({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,G.useState)(n),[c,u]=(0,G.useState)(i===null?``:String(i)),[d,m]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(n),u(i===null?``:String(i)),m(`idle`)},[e._id,n,i]);let h=c.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=a!==n||(g??null)!==i;async function y(){m(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),m(`done`)}catch{m(`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":p()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":ue(),disabled:!a}),(0,$.jsx)(I,{size:`sm`,disabled:!v||!_||d===`saving`,onClick:()=>void y(),children:d===`saving`?l():r()})]}),_?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:te()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function ze({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,G.useState)(n===null?``:String(n)),[o,c]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=i.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,p=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,$.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`?l():r()})]}),p?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_e()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]})}function Be(){let e=M(N.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=P(N.admin.listInstances,{}),[a,s]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[r,a]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=P(N.compat.forInstance,a?{instanceName:a}:`skip`),f=a?Ee(u,`configDefaults`):`loading`,p=f===`loading`?null:f.blocked,m=(0,G.useMemo)(()=>c&&a?{instanceName:a}:{},[c,a]),g=(0,G.useRef)(0),_=(0,G.useCallback)(async()=>{let t=++g.current;n({status:`loading`});try{let r=Ae(await e(m));if(g.current!==t)return;n({status:`done`,current:r})}catch{if(g.current!==t)return;n({status:`error`})}},[e,m]);(0,G.useEffect)(()=>{p===!1&&(c&&!a||_())},[_,p,c,a]);let y=t.status===`done`?t.current:null,b=(0,G.useMemo)(()=>ke.map(e=>({id:e,label:De(e)})),[]),x=(0,G.useMemo)(()=>[{id:`fast`,label:ie()},{id:`standard`,label:oe()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),c&&a?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,$.jsxs)(H,{value:a,onValueChange:e=>s(e),children:[(0,$.jsx)(U,{size:`sm`,"aria-label":o(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:(r??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):f===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):f.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,Oe(f.gatewayVersion,f.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:v()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,$.jsx)(V,{field:`thinkingLevel`,options:b,value:y?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:E()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:fe()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,$.jsx)(V,{field:`fastMode`,options:x,value:y===null||y.fastModeDefault===null?null:y.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:j()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(a??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{LA as t,dE as n,lX as r,nE as i,rE as a,t as o,tE as s,uE as c}from"./api-B8SYK4Qy.js";import{t as l}from"./use_paginated_query-DXjegJvG.js";import{t as u}from"./button-CXjFGJbj.js";import{ct as d,h as f}from"./index-DDEtFVdr.js";import{n as p,t as m}from"./trashPage-LA_ooyZZ.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(o.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=r(o.trash.restoreChat),b=r(o.trash.purgeChat),x=r(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:n({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:t()}):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,II as p,JI as m,KI as h,LI as g,MI as _,NI as v,OI as y,PI as b,QI as x,RI as S,SI as ee,SL as te,TI as ne,UI as re,VI as ie,WI as C,XI as w,YI as T,ZI as E,_L as D,aL as O,bI as k,bL as A,cL as j,dL as M,eL as N,fL as P,gL as F,hL as I,iL as L,jI as R,kI as z,lL as B,lX as V,mL as H,nL as U,oL as W,pL as G,qI as K,rL as ae,sL as q,t as J,tL as oe,uL as se,uX as ce,vL as le,wI as ue,xI as de,xL as fe,xf as pe,yL as me,zI as he}from"./api-B8SYK4Qy.js";import{t as ge}from"./button-CXjFGJbj.js";import{At as _e,ct as Y}from"./index-DDEtFVdr.js";import{t as ve}from"./DataTableShell-D-TTxNiz.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>te(),incorrect:()=>fe(),incoherence:()=>A(),formatting:()=>me(),latency:()=>le(),api_error:()=>D(),other:()=>F()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:H()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:G()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:I()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=V(J.feedback.respondToFeedback),[c,u]=(0,X.useState)(e.thread),[d,f]=(0,X.useState)(``),[p,g]=(0,X.useState)(!1);async function _(){let t=d.trim();if(!(!t||p)){g(!0);try{await o({feedbackId:e._id,text:t}),u(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{g(!1)}}}let v=[];try{v=i.contextJson?JSON.parse(i.contextJson):[]}catch{v=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${P()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:a(),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:l()}),(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:se()}),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`?B():e.authorRole===`agent`?e.authorLabel??s():j()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:q()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:W(),value:d,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void _(),disabled:!d.trim()||p,children:p?O():L()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||U()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||U()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,v.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r({count:i.contextCount??v.length,truncated:i.contextTruncated?x():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:v.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:E()}),(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:w()}),(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:T()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?m({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:[K(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,h()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=ce(J.feedback.listForAdmin,{}),t=V(J.feedback.readSnapshot),n=V(J.feedback.deleteFeedback),r=Y(),[a,s]=(0,X.useState)(null),[l,m]=(0,X.useState)({});async function h(e){if(a===e._id){s(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}s(e._id)}async function x(e){await r({title:ee(),description:de(),confirmLabel:k(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,re()]}),(0,Z.jsx)(ve,{title:f(),rows:e,emptyHint:ie(),isExpanded:e=>a===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:he(),cell:e=>_e(e.at),sort:e=>e.at},{header:S(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:g(),cell:e=>e.messageRole===`user`?p():u(),sort:e=>e.messageRole},{header:b(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${v({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:_(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:R(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:i(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:y()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:c()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?ne():ue(),onSelect:()=>void h(e)},{label:o(),onSelect:()=>void x(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,BJ as te,Df as r,Ef as ne,GJ as re,HJ as ie,JJ as i,KJ as ae,QJ as oe,UJ as a,VJ as o,WJ as s,XJ as c,YJ as l,ZJ as u,_Y as d,aY as f,bY as se,cY as p,dV as ce,dY as le,eX as ue,eY as de,fY as fe,gY as pe,hY as me,iY as m,lX as he,lY as h,mY as ge,nX as _e,nY as ve,oY as g,pY as ye,qJ as be,rY as xe,sY as _,t as v,tY as y,uX as b,uY as x,vY as S,xY as C,yY as w}from"./api-B8SYK4Qy.js";import{t as T}from"./button-CXjFGJbj.js";import{An as E,Bt as D,Gt as O,Ht as k,In as A,Jt as j,Kt as M,Mt as Se,St as N,Ut as Ce,Vt as we,Wt as Te,Yt as Ee,an as De,bt as P,en as Oe,nn as F,nr as I,qt as ke,tn as Ae,tr as je,vt as L,xt as R,yt as z}from"./index-DDEtFVdr.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-BpXDMEP0.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return x();case`audio`:return h();case`video`:return p();case`pdf`:return _();case`document`:return g();case`archive`:return f();default:return m()}}function q(){let[e,t]=(0,U.useState)(G),[n,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[h,g]=(0,U.useState)(G),[_,x]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=he(v.files.softDelete),Y=Ee();function Ie(){t(G),f(G),m(G),g(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(be())}catch(e){Y.error(ae(),e)}}let X=b(v.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:p===G?void 0:p,category:h===G?void 0:h,includeAutoGenerated:_||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(_e(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||p!==G||h!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":se(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:w()}),(0,W.jsx)(P,{value:`inbound`,children:S()}),(0,W.jsx)(P,{value:`outbound`,children:d()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:f,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:me()}),Q.chats.map(e=>(0,W.jsx)(P,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:p,onValueChange:m,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:ye()}),Q.instances.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:h,onValueChange:g,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:le()}),Q.categories.map(e=>(0,W.jsx)(P,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Se,{checked:_,onCheckedChange:e=>x(e===!0),"aria-label":r()}),(0,W.jsx)(`span`,{children:r()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(A,{size:14,"aria-hidden":!0}),c()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?o():ie()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:xe()}),(0,W.jsx)(B,{children:ve()}),(0,W.jsx)(B,{children:y()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:ee()}),(0,W.jsx)(B,{className:`text-right`,children:oe()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(j,{variant:`outline`,style:{marginLeft:6},children:ne()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(j,{variant:`secondary`,children:e.direction===`inbound`?S():d()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Oe,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":l(),children:(0,W.jsx)(je,{size:16})})}),(0,W.jsxs)(Ae,{align:`end`,children:[e.url?(0,W.jsx)(F,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(I,{size:14}),u()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(I,{size:14}),a()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(E,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:te({cap:Be})}):null]}),(0,W.jsx)(D,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ce,{children:[(0,W.jsxs)(M,{children:[(0,W.jsx)(ke,{children:re()}),(0,W.jsx)(Te,{children:s()})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(k,{children:ce()}),(0,W.jsx)(we,{onClick:()=>void Le(),children:i()})]})]})})]})}export{q as FilesTab};
|
|
@@ -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,CF as d,CP as f,D as p,DF as m,DP as h,EF as g,F as _,FF as v,FP as y,Fk as b,Fp as x,Fv as S,GF as C,GP as w,HF as ee,HP as T,IF as te,IP as E,Ip as D,Iv as O,JP as k,KF as ne,KP as re,LF as ie,LP as ae,Lp as oe,M as se,MF as A,MP as j,N as ce,NF as le,NP as ue,O as de,OF as fe,OP as pe,P as me,PF as he,PP as ge,Pk as _e,Pp as ve,Pv as ye,QN as be,QP as xe,Qa as Se,RF as Ce,RP as we,SF as Te,SP as Ee,TF as De,TP as Oe,UF as ke,UP as Ae,VF as je,VP as Me,WF as Ne,WP as Pe,XP as Fe,YP as Ie,ZN as Le,ZP as Re,Za as ze,_F as Be,_P as Ve,aF as He,aP as Ue,aU as We,ao as Ge,bF as Ke,bP as qe,cF as Je,cP as Ye,cn as Xe,co as Ze,dF as Qe,dP as $e,dn as et,do as tt,eF as nt,eP as rt,eo as it,fF as at,fP as ot,fn as st,fo as ct,gF as lt,gP as ut,gn as dt,hF as ft,hP as pt,hn as mt,iF as ht,iP as gt,io as _t,iu as vt,j as yt,jF as bt,jP as xt,k as St,kF as Ct,kP as wt,lF as M,lP as Tt,lX as N,ln as Et,lo as Dt,mF as Ot,mP as kt,mn as At,nF as jt,nP as Mt,no as Nt,nu as Pt,oF as Ft,oP as It,oU as Lt,oo as Rt,pF as zt,pP as Bt,pn as Vt,po as Ht,qP as Ut,rF as Wt,rP as Gt,ro as Kt,ru as qt,sF as Jt,sP as Yt,sX as P,sn as Xt,so as Zt,t as F,tF as Qt,tP as $t,to as en,uF as tn,uP as nn,uX as I,un as rn,uo as an,vF as on,vP as sn,wF as cn,wP as ln,xF as un,xP as dn,yF as fn,yP as pn,zF as mn,zP as hn}from"./api-B8SYK4Qy.js";import{a as gn,c as _n}from"./FieldLabel-CYivkNb7.js";import{t as L}from"./button-CXjFGJbj.js";import{$t as R,Ct as z,Dt as B,J as V,Jt as H,Mt as vn,Ot as yn,St as U,Tt as bn,Yt as W,b as xn,bt as G,cn as Sn,ct as Cn,on as wn,sn as Tn,vt as K,wt as En,xt as q,yt as J}from"./index-DDEtFVdr.js";import{t as Dn}from"./DataTableShell-D-TTxNiz.js";import{InstanceConfigDialog as On}from"./BridgeTab-BUWF4UrP.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:gn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=I(F.admin.listInstances,{}),t=I(F.agents.listAllInstanceAgents,{}),n=N(F.admin.upsertInstance),r=N(F.widgets.setInstanceWidgets),i=N(F.admin.deleteInstance),c=W(),[u,f]=(0,Y.useState)(!1),[h,y]=(0,Y.useState)(Q),[x,S]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null);async function re(){try{let t=await n({instanceId:O??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=O===null?null:e?.find(e=>e._id===O),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}),y(Q),k(null),f(!1)}catch(e){c.error(Ne(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ke(),(0,Z.jsx)(`strong`,{children:ee()}),je()]}),(0,Z.jsx)(Dn,{title:l(),rows:e,addLabel:mn(),onAdd:()=>{k(null),y(Q),f(!0)},emptyHint:Ce(),columns:[{header:ie(),cell:e=>e.name,sort:e=>e.name},{header:te(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:v(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:he(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ne(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let 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)(H,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?gt():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:s(),onSelect:()=>{k(e._id),y(Nn(e)),f(!0)}},{label:C(),onSelect:()=>S(e.name)},{label:ft(),onSelect:()=>D(e)},{label:le(),onSelect:()=>T(e)},{label:A(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:A(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(xn,{open:u,onOpenChange:f,title:O?Ct():bt(),description:m(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:re,submitLabel:g(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:De(),children:[(0,Z.jsx)(R,{value:h.name,disabled:O!==null,onChange:e=>y({...h,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:fe()}):null]}),(0,Z.jsx)($,{label:cn(),children:(0,Z.jsxs)(K,{value:h.kind,onValueChange:e=>y({...h,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(G,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:vt(),children:(0,Z.jsxs)(K,{value:h.transport,onValueChange:e=>y({...h,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`ws`,children:qt()}),(0,Z.jsx)(G,{value:`rest`,children:Pt()})]})]})}):null,(0,Z.jsx)($,{label:d(),children:(0,Z.jsx)(R,{value:h.gatewayUrl,onChange:e=>y({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(R,{value:h.bridgeUrl,placeholder:un(),onChange:e=>y({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsx)(R,{value:h.displayName,onChange:e=>y({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:b(),children:[(0,Z.jsxs)(K,{value:h.streamTransport,onValueChange:e=>y({...h,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(J,{children:_n.map(e=>(0,Z.jsx)(G,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_e()})]}),(0,Z.jsx)($,{label:fn(),children:(0,Z.jsx)(R,{value:h.gatewayVersion,placeholder:on(),onChange:e=>y({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Kt(),children:[(0,Z.jsxs)(K,{value:h.authMode,onValueChange:e=>y({...h,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`token`,children:Nt()}),(0,Z.jsx)(G,{value:`trusted-proxy`,children:en()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?a():it()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Ht(),children:[(0,Z.jsxs)(K,{value:h.personScopes,onValueChange:e=>y({...h,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`capped`,children:ct()}),(0,Z.jsx)(G,{value:`full`,children:tt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?Dt():an()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Ze(),children:[(0,Z.jsxs)(K,{value:h.identitySource,onValueChange:e=>y({...h,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`canonical`,children:Zt()}),(0,Z.jsx)(G,{value:`email`,children:Rt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?_t():Ge()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:dt(),children:[(0,Z.jsxs)(K,{value:h.participantIdentity,onValueChange:e=>y({...h,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`owner`,children:mt()}),(0,Z.jsx)(G,{value:`self`,children:At()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?Xt():Vt()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:st(),children:[(0,Z.jsxs)(K,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>y({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:et()}),(0,Z.jsx)(G,{value:`on`,children:rn()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?Xe():Et()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:_(),children:[(0,Z.jsxs)(K,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>y({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`on`,children:me()}),(0,Z.jsx)(G,{value:`off`,children:ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?se():yt()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:o(),children:[(0,Z.jsxs)(K,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>y({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:St()}),(0,Z.jsx)(G,{value:`on`,children:de()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:p()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:Se(),children:(0,Z.jsx)(R,{value:h.systemIdentity,placeholder:ze(),onChange:e=>y({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Be(),children:(0,Z.jsx)(R,{value:h.gatewayHttpUrl,placeholder:lt(),onChange:e=>y({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:x,open:x!==null,onOpenChange:e=>{e||S(null)}}),w?(0,Z.jsx)(On,{instance:w,onClose:()=>T(null)},w._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=I(F.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(En,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:Ot({instance:e.displayName??e.name})}),(0,Z.jsx)(bn,{children:zt()})]}),(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=P(F.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(Ut());break;case`no_agents`:n.success(w());break;case`no_bridge_url`:n.error(Pe());break;case`deploy_misconfigured`:n.error(Ae());break;case`unauthorized`:n.error(Me());break;case`not_served`:n.error(u());break;default:n.error(T());break}}catch(e){n.error(re(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:hn()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?k():Ie()})})]})}function Ln({instance:e}){let t=I(F.bridgeAuth.listBridgeAuthStatus,{}),n=P(F.bridgeAuth.mintBridgeSecret),r=N(F.bridgeAuth.revokeBridgeSecret),i=W(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(j(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(ue())}catch(e){i.error(j(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:we(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:p?`outline`:`secondary`,children:p?`${M()} · ${f.prefix}…${f.lastFour}`:Je()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?y():E()}),p?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:ge()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:xt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?Lt():We()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:c()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=P(F.instanceSecrets.setInstanceSecret),a=N(F.instanceSecrets.clearInstanceSecret),o=P(F.deviceIdentity.generateDeviceIdentity),s=W(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?at():t===`deviceIdentity`?Qe():tn();async function b(){if(!(!l.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),m(null),g(!1),s.success(Wt())}catch(e){s.error(jt(),e)}finally{f(!1)}}}async function x(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(Qt())}catch(e){s.error(jt(),e)}finally{f(!1)}}}async function S(){if(!d){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(xe())}catch(e){s.error(Fe(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function w(){if(C)try{await navigator.clipboard.writeText(C),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:_?`outline`:`secondary`,children:_?M():Je()}),(0,Z.jsx)(R,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:_?Ft():Jt(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void b(),disabled:d||l.trim().length===0,children:He()}),v?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:d,children:nt()}):null,_?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:d,children:ht()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:xe()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:h?Lt():We()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:c()})]}):null]})}var zn={conversational:pn,documentary:Ve,summarizer:oe,curator:x},Bn={conversational:sn,documentary:ut,summarizer:D,curator:ve},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:f()}),t.map(e=>(0,Z.jsx)(H,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(wn,{children:[(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ee()})}),(0,Z.jsxs)(Tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:dn()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:qe()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(vn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let i=I(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=N(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=N(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=N(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=N(F.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=N(F.agents.removeInstanceAgent),u=N(F.agents.setAgentReservation),d=I(F.groups.listGroupLabels,t?{}:`skip`),f=Cn(),p=W();async function m(t,n){if(e&&await f({title:rt({name:n}),description:r(),confirmLabel:$t()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){p.error(h(),V(e))}}async function g(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:ye()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){p.error(h(),V(e))}}async function _(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){p.error(h(),e)}}async function v(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){p.error(h(),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(h(),e)}}async function b(t,n){if(e&&await f({title:Bt({name:n}),description:ot(),confirmLabel:$e(),destructive:!0}))try{await l({instanceName:e,agentId:t}),p.success(nn())}catch(e){p.error(h(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(En,{className:`oc-access`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:wt({name:e??``})}),(0,Z.jsx)(bn,{children:pe()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Tt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?Ye():i.discovery.lastPollOk?Yt():It({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ue()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(t=>{let n=t.presentInLastOk===!1,r=i.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(vn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(H,{variant:`outline`,children:t.reserved.groupName===null?Mt():Gt({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:Le()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,a),children:kt()})]}):r?(0,Z.jsx)(H,{variant:`default`,children:gt()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:pt()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void m(t.agentId,a),children:$t()}),(0,Z.jsxs)(K,{value:``,onValueChange:e=>void g(t.agentId,a,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(U,{placeholder:be()})}),(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:o,onToggle:e=>void y(t.agentId,e,o)}):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(h(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(R,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Oe(),"aria-label":ln(),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{AR as r,BD as i,BR as a,GD as o,HD as s,JD as c,KD as l,LR as u,QD as d,RD as f,RR as p,UD as m,VD as h,WD as g,XD as _,YD as v,ZD as ee,dz as te,kR as y,qD as b,t as x,uX as S,zD as C,zR as w}from"./api-B8SYK4Qy.js";import{dr as T,fr as E,ft as D,i as O,o as ne,r as re}from"./index-DDEtFVdr.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-RKiqrSX4.js";import{n as P,t as F}from"./TimeRangePicker-spgMK1lW.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=S(x.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=S(x.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:te()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:a()}),(0,z.jsx)(M,{children:p()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/i,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=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:[y(),` p50 `,V(l.cP50),` `,w()]}),(0,z.jsxs)(`span`,{children:[r(),` p50 `,V(l.aP50),` `,w()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":a(),children:[(0,z.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:d(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:ee(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:_(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:v(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:c(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:b(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:l(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=E({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=O(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:i,to:a}=P(n),{rowLimit:c,buckets:l}=Y(i,a),u=S(x.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:g()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:h({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:i()}),(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":f({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$W as r,$s as i,AW as a,AY as o,BW as s,BY as c,CW as l,CY as u,DW as d,DY as ee,EF as te,EW as f,EY as p,FW as m,FY as ne,GW as h,GY as re,HW as ie,HY as ae,IW as oe,IY as se,JW as ce,KW as le,KY as ue,LW as de,LY as fe,MW as pe,MY as me,NW as he,NY as ge,OW as _e,OY as ve,PW as g,PY as _,QW as v,Qs as y,RW as b,RY as x,SW as S,TW as C,TY as w,UW as T,UY as E,VW as D,VY as O,WW as k,WY as A,XW as j,YW as M,YY as N,ZW as P,Zs as F,_c as ye,bW as be,eG as xe,eX as Se,ec as Ce,fc as we,ic as Te,jW as I,jY as Ee,kW as De,kY as Oe,lX as L,nG as ke,nc as Ae,qW as je,r as R,rG as Me,rc as Ne,t as z,tG as Pe,tc as Fe,uX as B,vW as Ie,vc as Le,wW as Re,wY as ze,xW as Be,yW as Ve,zW as He,zY as Ue}from"./api-B8SYK4Qy.js";import{t as V}from"./button-CXjFGJbj.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-DDEtFVdr.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-A-0jP4K0.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:()=>Me()},{id:`composer`,label:()=>ke()},{id:`sidebar`,label:()=>Pe()},{id:`notifications`,label:()=>b()},{id:`other`,label:()=>xe()}],X={showSource:{category:`messages`,label:()=>r(),help:()=>v()},showReport:{category:`messages`,label:()=>P(),help:()=>j()},copyAssistant:{category:`messages`,label:()=>M()},copyUser:{category:`messages`,label:()=>ce()},showDelete:{category:`messages`,label:()=>je()},showTools:{category:`messages`,label:()=>le(),help:()=>h()},voiceInput:{category:`composer`,label:()=>k(),help:()=>T()},showUsage:{category:`composer`,label:()=>ie(),help:()=>D()},autoReadAloud:{category:`composer`,label:()=>Le(),help:()=>ye()},showChatAge:{category:`sidebar`,label:()=>s(),help:()=>He()},notifSound:{category:`notifications`,label:()=>de(),help:()=>oe()},notifSystem:{category:`notifications`,label:()=>m(),help:()=>g()},replySound:{category:`notifications`,label:()=>he(),help:()=>pe()}};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:()=>S()};function ut({prefKey:e,ui:t}){let n=L(z.admin.setUiPrefDefault),r=L(z.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:f()}),(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:be()}),(0,J.jsx)(G,{value:`off`,children:Ve()}),(0,J.jsx)(G,{value:`inherit`,children:Ie()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":C()}),C()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=L(z.me.setDictationShortcut),[r,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:[Te(),e?(0,J.jsx)(U,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?Fe():r?Ae():Ne()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:F()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?y():e?i():Ce()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=B(z.me.getMe,{host:K}),o=i?.ui,s=$(i?.role)&&n,c=L(z.me.setUiPref).withOptimisticUpdate(We),u=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":d()}),d()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Re()}),(0,J.jsx)(`p`,{children:l()}),(0,J.jsx)(`p`,{children:Be()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:I(),"aria-label":I(),className:`mb-2`}),u.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:a()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(U,{variant:`outline`,children:De()}):l?(0,J.jsx)(U,{variant:`secondary`,children:we()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:_e()}):null,(0,J.jsx)(nt,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Se()})}var pt={sm:()=>_(),md:()=>ge(),lg:()=>me(),xl:()=>Ee(),"2xl":()=>o(),"3xl":()=>Oe()};function mt(){let e=B(z.me.getMe,{host:K}),t=L(z.me.setLocale),n=L(z.me.setTimezone),r=L(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=L(z.me.setMyName),a=Je(),o=e?.locale??`default`,s=e?.name??``,[l,d]=(0,q.useState)(null),f=l??s,m=f.trim()!==s.trim();async function h(){try{await i({name:f}),d(null),a.success(ae())}catch(e){a.error(O(),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:ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:f,maxLength:120,placeholder:A(),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:te()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:c()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:N()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(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:p()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(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:ne()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ze()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(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,IE as f,JE as p,KE as m,LE as h,ME as g,MT as _,NE as v,OE as y,PE as ee,QE as te,RE as ne,To as re,UE as ie,VE as ae,WE as oe,XE as se,ZE as ce,_E as le,aD as ue,bD as de,cD as b,dC as fe,dD as pe,eD as me,eX as x,fD as he,fE as S,gE as C,hD as w,hE as ge,kE as _e,lX as T,mD as E,mE as ve,nD as D,oD as ye,pE as O,qE as be,t as k,uX 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-B8SYK4Qy.js";import{r as Te}from"./dist-7qJAgXuT.js";import{t as Ee}from"./list-77P9EclZ.js";import{t as P}from"./button-CXjFGJbj.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 B,Yt as He,Zn as Ue,_ as We,_t as Ge,an as Ke,b as qe,ct as Je,d as Ye,dr as V,en as Xe,er as Ze,f as Qe,fr as $e,g as et,gt as H,h as tt,ht as U,in as nt,j as W,k as rt,lt as it,mt as at,nn as G,p as ot,pr as st,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-DDEtFVdr.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)(Ke,{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=T(k.projects.renameProject),c=T(k.projects.setProjectColor),l=T(k.projects.moveProject),u=T(k.projects.deleteProject),d=T(k.projects.createProject),f=Je(),p=tt(),m=it(),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(t),[y,ee]=(0,X.useState)(!1),[te,ne]=(0,X.useState)(!1),re=A(k.projects.projectTreeCount,te?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Xe,{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)(G,{onSelect:()=>a(),children:[(0,Z.jsx)(Re,{}),` `,D()]}),(0,Z.jsxs)(G,{onSelect:()=>{v(t),g(!0)},children:[(0,Z.jsx)(Ve,{}),` `,j()]}),(0,Z.jsxs)(G,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:be(),label:Se(),placeholder:de(),confirmLabel:Ce()});t&&await d({name:t,parentId:e})})},children:[(0,Z.jsx)(Ue,{}),` `,be()]}),(0,Z.jsxs)(G,{onSelect:()=>ee(!0),children:[(0,Z.jsx)(gt,{}),` `,_e()]}),(0,Z.jsx)(lt,{children:ge()}),(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":ve(),children:`✕`}),We.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)(nt,{}),(0,Z.jsxs)(G,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=re?.folders??0,r=re?.chats??0;await f({title:ue({name:t}),description:ot({folders:n,chats:r,days:p}),confirmWord:M(),confirmLabel:ye(),destructive:!0})&&await u({projectId:e})})},children:[(0,Z.jsx)(ke,{}),` `,M()]})]})]}),(0,Z.jsx)(qe,{open:h,onOpenChange:g,title:pe(),canSubmit:_.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:_.trim()}),g(!1)},submitLabel:j(),children:(0,Z.jsx)(Oe,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),y?(0,Z.jsx)(et,{open:y,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=T(k.chats.pinChat),o=T(k.chats.deleteChat),s=T(k.chats.renameChat),c=T(k.chats.setChatSidebar),l=T(k.chats.moveChatToProject),u=Je(),d=tt(),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(e.title??``),[g,v]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Xe,{children:[(0,Z.jsx)(vt,{className:n}),(0,Z.jsxs)(dt,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(G,{onSelect:()=>{h(e.title??``),p(!0)},children:[(0,Z.jsx)(Ve,{}),` `,j()]}),(0,Z.jsxs)(G,{onSelect:()=>void a({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(mt,{}):(0,Z.jsx)(I,{}),e.pinned?le():C()]}),(0,Z.jsxs)(G,{onSelect:()=>v(!0),children:[(0,Z.jsx)(gt,{}),` `,i()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(G,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(z,{}):(0,Z.jsx)(Y,{}),e.inSidebar?r():me()]}),(0,Z.jsx)(nt,{}),(0,Z.jsxs)(G,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:O(),description:S({days:d}),confirmLabel:M(),destructive:!0})&&await o({chatId:e._id})})},children:[(0,Z.jsx)(ke,{}),` `,M()]})]})]}),(0,Z.jsx)(qe,{open:f,onOpenChange:p,title:_(),canSubmit:m.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:m.trim()}),p(!1)},submitLabel:j(),children:(0,Z.jsx)(Oe,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),g?(0,Z.jsx)(et,{open:g,onOpenChange:v,title:y(),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}=st({from:`/project/$projectId`}),t=V(),n=A(k.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:l()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ee()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:v()})]}):(0,Z.jsx)(kt,{page:n})})}function kt({page:e}){let t=V(),n=Je(),r=tt(),i=it(),a=He(),c=T(k.projects.renameProject),l=T(k.projects.setProjectColor),u=T(k.projects.deleteProject),m=T(k.projects.createProject),_=T(k.projects.moveProject),v=T(k.projects.setProjectSidebar),y=T(k.chats.moveChatToProject),ee=T(k.chats.reorderChat),ae=T(k.projects.reorderProject),le=A(k.projects.projectTreeCount,{projectId:e.project._id}),[b,me]=(0,X.useState)(wt),x=e=>{localStorage.setItem(Ct,e),me(e)},S=A(k.projects.folderColumns,b===`columns`?{projectId:e.project._id}:`skip`),C=A(k.projects.projectTreeList,b===`list`?{projectId:e.project._id}:`skip`),{c:E}=$e({from:`/project/$projectId`}),D=A(k.projects.listProjects,{}),O=A(k.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(O??[]),[O]),{byChat:Te}=Ge(O??null),I=A(k.chatReads.myChatReads,{}),L=(0,X.useMemo)(()=>St(e.chats,I??[]),[e.chats,I]),{startNewChat:R,picker:Re}=Ye(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,Qe]=(0,X.useState)(``),[H,W]=(0,X.useState)(!1),[st,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=A(k.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=S?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||w()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(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:rt(n(t?`folder:`:`chat:`))},[]),It=t=>{if(b===`columns`){for(let e of S?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(b===`list`){let e=C?.chats.find(e=>e._id===t);return e?{list:C.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(b===`columns`){for(let e of S?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(b===`list`){let e=C?.folders.find(e=>e._id===t);if(!e||!C)return null;let n=e.parentId??C.rootId;return{list:at(C.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 y({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ct(D??[],t,e)){a.error(p());return}await _({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 y({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(p());return}await _({projectId:e,parentId:n.parentId})}let o=xt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await ae({projectId:e,...o});return}}catch{a.error(p())}},[,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)(U.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":g(),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:re(),onClick:()=>{v({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Ze,{"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":te(),children:[(0,Z.jsx)(P,{variant:b===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":te(),title:te(),"aria-pressed":b===`cards`,onClick:()=>x(`cards`),children:(0,Z.jsx)(_t,{})}),(0,Z.jsx)(P,{variant:b===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ce(),title:ce(),"aria-pressed":b===`columns`,onClick:()=>x(`columns`),children:(0,Z.jsx)(ht,{})}),(0,Z.jsx)(P,{variant:b===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":se(),title:se(),"aria-pressed":b===`list`,onClick:()=>x(`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:be(),label:Se(),placeholder:de(),confirmLabel:Ce()});t&&await m({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(Ue,{}),be()]}),(0,Z.jsxs)(Xe,{children:[(0,Z.jsx)(Ke,{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)(G,{onSelect:()=>{ut(e.project.name),W(!0)},children:[(0,Z.jsx)(Ve,{}),` `,j()]}),(0,Z.jsxs)(G,{onSelect:()=>mt(!0),children:[(0,Z.jsx)(gt,{}),` `,_e()]}),(0,Z.jsx)(lt,{children:ge()}),(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":ve(),children:`✕`}),We.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)(nt,{}),(0,Z.jsxs)(G,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=le?.folders??0,o=le?.chats??0;await n({title:ue({name:e.project.name}),description:ot({folders:a,chats:o,days:r}),confirmWord:M(),confirmLabel:ye(),destructive:!0})&&(await u({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,Z.jsx)(ke,{}),` `,M()]})]})]})]})]}),b===`columns`?(0,Z.jsx)(Rt,{data:S,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:E??null}):b===`list`?(0,Z.jsx)(Ft,{data:C,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:oe()}),(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:ie()}),e.chats.length>0?(0,Z.jsx)(Oe,{value:z,onChange:e=>Qe(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?h():f()}):Ut.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ne({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:ne({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||fe()}),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)(qe,{open:H,onOpenChange:W,title:pe(),canSubmit:st.trim().length>0,onSubmit:async()=>{await c({projectId:e.project._id,name:st.trim()}),W(!1)},submitLabel:j(),children:(0,Z.jsx)(Oe,{value:st,onChange:e=>ut(e.target.value),autoFocus:!0})}),K?(0,Z.jsx)(et,{open:K,onOpenChange:mt,title:s(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void _({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)(B,{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}=W({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=V(),o=L({id:`folder:${e._id}`}),s=W({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)(B,{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?ae({count:e.folderCount})+` · `:``,a({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:Qe(e.lastActivityAt,n)})]})}function Mt({chat:e}){let t=T(k.chats.setChatSidebar),n=e.inSidebar?r():me();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)(U).get(e._id),c=V(),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||w()}),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:Qe(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:H(s,E()).className,title:H(s,E()).label,"aria-label":H(s,E()).label}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:b(),"aria-label":b()}):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:x()});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=at(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&&at(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:h()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=V(),c=L({id:`folder:${e._id}`}),l=W({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?m():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)(B,{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)(U).get(e._id),o=V(),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||w()}),n?(0,Z.jsx)(`span`,{className:H(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:x()}):(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=V(),s=W({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:f()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=L({id:`folder:${e._id}`}),o=W({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)(B,{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)(U).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||w()}),n?(0,Z.jsx)(`span`,{className:H(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,Hp as l,Id as u,Jd as d,Ld as f,Ok as p,Rd as m,Rk as h,Rp as g,Sk as _,Tk as ee,Vp as te,Xd as ne,Yd as v,_k as y,au as b,bk as x,fk as S,gk as C,hk as w,jk as re,kk as ie,lX as ae,mk as oe,ou as se,pk as T,qd as E,su as D,t as O,uX as k,vk as A,wk as j,xk as M,xo as N,yk as P,zd as F,zk as I,zp as L}from"./api-B8SYK4Qy.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-CYivkNb7.js";import{t as H}from"./button-CXjFGJbj.js";import{Mt as U,St as W,Yt as G,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-DDEtFVdr.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:ee},documentary_fetch:{label:j,help:o},inbound_files:{label:_,help:M},history_summary:{label:l,help:te},file_curation:{label:ne,help:i},quote_reply:{label:v,help:d}},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:oe,references:T,files:S,previous_summary:a,new_messages:L,max_chars:g,file_name:F,budget_chars:m,feedback:f,content:u,excerpt:E};function _e(){let e=k(O.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:P()})});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)(z,{label:re(),help:r()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:x()}),(0,$.jsxs)(J,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(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=ae(O.admin.upsertInstanceConfig),n=G(),r=k(O.me.getMe,{host:ce}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>R(i,a));(0,Q.useEffect)(()=>{s(R(i,a))},[a,e._id]);let[c,l]=(0,Q.useState)(!1),u=o.promptInjections,d=(e,t)=>s({...o,promptInjections:{...u,[e]:{...u[e],...t}}});async function f(){l(!0);try{await t({instanceId:e._id,config:B(o,i,a)})}catch(e){n.error(h(),e)}finally{l(!1)}}async function p(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(h(),e)}}let m=e.config?.contentLocale??`default`,g=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:D()}),(0,$.jsxs)(J,{value:m,onValueChange:e=>void p(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:b({locale:g})}),pe().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()})]}),de.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:u[e]??{enabled:!0,template:q[e].defaultTemplate[a]},contentLocale:a,onChange:t=>d(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void f(),disabled:c,children:I()})})]})}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),m=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)(U,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:p()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?y():A()}),l&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:ie()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:C()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:N()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AN as i,CN as a,DN as o,EN as s,FN as c,GM as l,JM as u,KM as ee,MN as d,NN as f,ON as p,PN as m,QM as h,SN as g,TN as _,XM as te,YM as ne,ZM as v,_N as y,aN as b,bN as x,bf as S,cN as C,dN as re,fN as ie,gN as ae,hN as w,jN as T,kN as E,lN as D,lX as O,mN as k,oN as A,pN as j,qM as M,sN as N,t as P,uN as F,uX as I,vN as L,wN as R,xN as oe,yN as z}from"./api-B8SYK4Qy.js";import{t as B}from"./button-CXjFGJbj.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-DDEtFVdr.js";import{t as J}from"./roleDescriptions-Cr2PVmkf.js";var Y=t(e(),1),X=n(),Z=[{group:()=>c(),keys:[{key:`traces.read`,label:()=>i()},{key:`traces.read.content`,label:()=>E(),phi:!0},{key:`traces.write`,label:()=>p()}]},{group:()=>m(),keys:[{key:`kpi.read`,label:()=>i()},{key:`kpi.write`,label:()=>p()}]},{group:()=>f(),keys:[{key:`openclaw.query`,label:()=>o()},{key:`anomalies.read`,label:()=>s()},{key:`anomalies.report`,label:()=>_()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>i()},{key:`selfheal`,label:()=>a()},{key:`media.repair`,label:()=>g()},{key:`feedback.respond`,label:()=>S()}]},{group:()=>T(),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=I(P.apiKeys.listRoles,{}),t=O(P.apiKeys.createRole),n=O(P.apiKeys.ensureRolesSeeded),i=O(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))}),a=K(),o=W(),[s,c]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[p,m]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(x(),e)})},[n,o]);let g=e??[];async function _(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:z({name:e.name}),description:L(),confirmLabel:y()});return}if(p.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];m(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(ae(),e)}finally{m(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function S(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),c(!1)}catch(e){o.error(w(),e)}}let T=e===void 0,E=!T&&g.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,j(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,ie()]}),(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:re()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{f($),c(!0)},children:F()})})]}),T?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):E?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:N()}),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?oe({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:g.map(e=>{let t=Q(e.permissions),n=p.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,{}),` `,A()]}):(0,X.jsx)(H,{variant:`secondary`,children:b()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(i=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(U,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?r():n?h():i,onCheckedChange:()=>void _(e,i)})},i))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:s,onOpenChange:c,title:v(),description:te(),canSubmit:!!(d.key&&d.name),onSubmit:S,submitLabel:ne(),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:u()}),(0,X.jsx)(V,{value:d.key,placeholder:M(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(V,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,X.jsx)(V,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$q as i,AJ as a,AK as o,Aq as s,BK as c,Bq as l,CJ as u,Cq as d,DJ as ee,E as f,EJ as p,FJ as m,Fq as te,GK as ne,Gq as re,HK as ie,IJ as ae,IK as oe,Iq as se,JK as ce,Jq as le,KK as ue,Kq as de,LJ as fe,LK as pe,Lq as me,MJ as he,Mq as ge,NJ as _e,Nq as ve,OJ as ye,PJ as be,Pq as xe,QK as Se,RJ as Ce,RK as we,Rq as Te,Sq as Ee,TJ as De,UK as Oe,Uq as ke,VK as Ae,WK as je,Wq as Me,XK as Ne,Xq as Pe,YK as Fe,Yq as Ie,ZK as Le,Zq as h,_q as Re,bq as g,dq as ze,eJ as Be,eX as Ve,fq as _,gq as He,hq as Ue,iJ as We,jJ as Ge,jq as Ke,kJ as qe,kq as Je,lq as Ye,mq as Xe,nJ as Ze,nX as v,pq as Qe,qK as $e,qq as et,rJ as tt,sX as y,t as b,tJ as nt,uX as rt,uq as x,vq as it,wJ as at,wq as ot,xq as S,yq as st,zK as ct}from"./api-B8SYK4Qy.js";import{t as lt}from"./list-77P9EclZ.js";import{t as C}from"./button-CXjFGJbj.js";import{$t as ut,An as dt,Bt as ft,Ct as pt,Dt as mt,Et as ht,Gt as gt,Hn as _t,Ht as vt,In as yt,Jn as bt,Jt as w,Kt as xt,Ot as St,Rn as Ct,Rt as wt,St as T,Tt,Ut as Et,Vn as Dt,Vt as Ot,Wt as kt,Yt as At,bt as E,cn as D,cr as O,ft as jt,on as k,qt as Mt,sn as A,sr as j,vt as M,wn as Nt,wt as Pt,xt as N,yt as P,zt as Ft}from"./index-DDEtFVdr.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-BpXDMEP0.js";import{t as Bt}from"./FilterBar-BcbgCjju.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as z,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-A-0jP4K0.js";var qt=f(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Jt=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),V=t(e(),1),H=n();function U(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Ht(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,V.useState)(!1),c=(0,V.useMemo)(()=>U(v()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(v(),{month:`long`,year:`numeric`}),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=L(i.year,i.month),f=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(B(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,f,p)},ne=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},re=n===null?d():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(k,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":ot(),children:[(0,H.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,H.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,H.jsxs)(A,{align:`start`,className:`oc-dtp__pop`,children:[(0,H.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":Ee(),onClick:()=>ne(-1),children:(0,H.jsx)(O,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":S(),onClick:()=>ne(1),children:(0,H.jsx)(j,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(M,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,H.jsx)(N,{size:`sm`,"aria-label":g(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(P,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(M,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,H.jsx)(N,{size:`sm`,"aria-label":st(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(P,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function Qt(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function en(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=v(),c=(0,V.useMemo)(()=>Zt(e),[e]),l=(0,V.useMemo)(()=>$t(s),[s]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),ee=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},m=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":_(),onClick:()=>p(-1),children:(0,H.jsx)(O,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":ze(),onClick:()=>p(1),children:(0,H.jsx)(j,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:Qe()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:m}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:Ue()}),(0,H.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:Xe()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:c,weekdays:l,timeFmt:ee,now:f,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:c,monthShortFmt:d,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:x({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=L(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*on[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=z(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Gt(e)){case`ok`:return(0,H.jsx)(w,{variant:`secondary`,children:me()});case`error`:return(0,H.jsx)(w,{variant:`destructive`,children:te()});case`running`:return(0,H.jsx)(w,{variant:`outline`,children:xe()});case`other`:return(0,H.jsx)(w,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=y(b.scheduled.listMyCrons),t=y(b.scheduled.getCronDetail),n=y(b.scheduled.listCronRuns),d=y(b.scheduled.updateCron),f=y(b.scheduled.removeCron),Ee=y(b.scheduled.runCronNow),g=At(),ze=rt(b.me.getMe,{host:jt})?.timezone,[_,Ue]=(0,V.useState)(null),[Xe,Qe]=(0,V.useState)(!1),[x,ot]=(0,V.useState)(!1),[S,st]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),[k,A]=(0,V.useState)(null),[j,L]=(0,V.useState)(null),[Ht,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ut),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of _??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[_,B]),on=(0,V.useMemo)(()=>Qt===`year`?tn(G.year):en(G.year,G.month),[Qt,G]),sn=(0,V.useMemo)(()=>un(an,on.startMs,on.endMs),[an,on]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,V.useCallback)(async()=>{Qe(!0),ot(!1);try{Ue(await e({}))}catch{ot(!0)}finally{Qe(!1)}},[e]);(0,V.useEffect)(()=>{q()},[q]);let cn=(0,V.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,V.useRef)(null);(0,V.useEffect)(()=>{_!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[_]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{st(e);try{await t(),g.success(n),await q()}catch(e){g.toast({variant:`error`,title:h({code:dn(e)})})}finally{st(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;A({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;A({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;A(null),g.toast({variant:`error`,title:h({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;L(null),g.toast({variant:`error`,title:h({code:dn(e)})})}},mn=async()=>{if(j===null)return;let e={};if(j.nameDirty&&j.name.trim()===``||j.messageDirty&&j.hasMessage&&j.message.trim()===``){g.toast({variant:`error`,title:oe()});return}if(j.nameDirty&&j.name.trim()!==``&&(e.name=j.name.trim()),j.scheduleDirty){if(j.scheduleKind===`cron`&&j.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:j.cronExpr.trim(),...j.tz.trim()===``?{}:{tz:j.tz.trim()}};else if(j.scheduleKind===`every`){let t=Number(j.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[j.everyUnit])})}else if(j.scheduleKind===`at`&&j.at!==``){let t=Date.parse(j.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(j.scheduleDirty&&e.schedule===void 0){g.toast({variant:`error`,title:pe()});return}if(j.messageDirty&&j.hasMessage&&j.message.trim()!==``&&(e.message=j.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Gt(!0);try{await d({instanceName:j.instanceName,jobId:j.jobId,patch:e}),g.success(Ne()),t===Q.current&&L(null),await q()}catch(e){g.toast({variant:`error`,title:h({code:dn(e)})})}finally{Gt(!1)}},hn=_?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Ce()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":it(),children:[(0,H.jsx)(C,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Re(),title:Re(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(lt,{})}),(0,H.jsx)(C,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":He(),title:He(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Xe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(yt,{size:14,"aria-hidden":!0}),fe()]})]}),_!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:ge(),onReset:()=>U(Ut),canReset:Wt(B),children:[(0,H.jsxs)(M,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(N,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`all`,children:Ke()}),(0,H.jsx)(E,{value:`active`,children:at()}),(0,H.jsx)(E,{value:`paused`,children:De()}),(0,H.jsx)(E,{value:`auto-disabled`,children:u()})]})]}),(0,H.jsxs)(M,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(N,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`all`,children:s()}),(0,H.jsx)(E,{value:`ok`,children:me()}),(0,H.jsx)(E,{value:`error`,children:te()}),(0,H.jsx)(E,{value:`running`,children:xe()}),(0,H.jsx)(E,{value:`none`,children:ve()})]})]})]}):null,_===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Xe,children:x?ae():Ve()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[x?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):null,_.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:Ye()})]}):(0,H.jsxs)(H.Fragment,{children:[x?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):null,_.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):null,_.map(e=>{let t=e.jobs.filter(e=>Vt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[_.length>1||e.error||!e.supported?(0,H.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,H.jsx)(w,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:_e({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:Ge()}),(0,H.jsx)(F,{children:a()}),(0,H.jsx)(F,{children:qe()}),(0,H.jsx)(F,{children:ye()}),(0,H.jsx)(F,{children:ee()}),(0,H.jsx)(F,{children:Te()}),(0,H.jsx)(F,{children:r()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,a=S===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,H.jsxs)(Rt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??p()}),(0,H.jsx)(I,{children:(0,H.jsx)(w,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=wt(t.schedule),n=e===null?null:Ft(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(I,{children:z(t)===`auto-disabled`?(0,H.jsx)(w,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:u()}):z(t)===`active`?(0,H.jsx)(w,{variant:`secondary`,children:at()}):z(t)===`paused`?(0,H.jsx)(w,{variant:`outline`,children:De()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(I,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(w,{variant:`destructive`,title:t.lastDeliveryError??We(),children:se()}):null]}),(0,H.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,H.jsx)(bt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ze(),"aria-label":Ze(),disabled:S!==null,onClick:()=>void X(r,async()=>{let n=await Ee({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Pe()),children:(0,H.jsx)(Nt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?nt():Be(),"aria-label":R(t)===`pause`?nt():Be(),disabled:S!==null,onClick:()=>void X(r,()=>d({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?Ie():le()),children:R(t)===`pause`?(0,H.jsx)(_t,{size:14,"aria-hidden":!0}):(0,H.jsx)(Ct,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Se(),"aria-label":Se(),disabled:S!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(Dt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:S!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,o?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:i(),"aria-label":i(),disabled:S!==null,onClick:()=>O({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(dt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:o()}):null]}),(0,H.jsx)(ft,{open:D!==null,onOpenChange:e=>{e||O(null)},children:(0,H.jsxs)(Et,{children:[(0,H.jsxs)(xt,{children:[(0,H.jsx)(Mt,{children:de()}),(0,H.jsx)(kt,{children:re({name:D?.name??``})})]}),(0,H.jsxs)(gt,{children:[(0,H.jsx)(vt,{children:Me()}),(0,H.jsx)(Ot,{onClick:()=>{let e=D;O(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>f({instanceName:e.instanceName,jobId:e.jobId}),et())},children:ke()})]})]})}),(0,H.jsx)(pt,{open:k!==null,onOpenChange:e=>{e||(Z.current++,A(null))},children:(0,H.jsxs)(Pt,{style:{maxWidth:640},children:[(0,H.jsx)(mt,{children:(0,H.jsx)(St,{children:Fe({name:k?.name??``})})}),k?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):k!==null&&k.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):k===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:k.entries.map((e,t)=>(0,H.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,H.jsx)(fn,{status:e.status}),(0,H.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,H.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[l({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(pt,{open:j!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,H.jsxs)(Pt,{className:`oc-cronedit`,children:[(0,H.jsxs)(mt,{children:[(0,H.jsx)(St,{children:$e()}),(0,H.jsx)(Tt,{children:ue()})]}),j===null?null:j.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ge()}),(0,H.jsx)(ut,{value:j.name,maxLength:200,onChange:e=>L({...j,name:e.target.value,nameDirty:!0})})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ne()}),(0,H.jsxs)(M,{value:j.scheduleKind,onValueChange:e=>L({...j,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(N,{children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`cron`,children:je()}),(0,H.jsx)(E,{value:`every`,children:Oe()}),(0,H.jsx)(E,{value:`at`,children:ie()})]})]}),j.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(ut,{value:j.cronExpr,onChange:e=>L({...j,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:j.tz,onChange:e=>L({...j,tz:e,scheduleDirty:!0}),fallbackTz:ze??void 0})]}):j.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(ut,{type:`number`,min:1,value:j.everyValue,onChange:e=>L({...j,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(M,{value:j.everyUnit,onValueChange:e=>L({...j,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(N,{style:{maxWidth:160},children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`minutes`,children:Ae()}),(0,H.jsx)(E,{value:`hours`,children:c()}),(0,H.jsx)(E,{value:`days`,children:ct()})]})]})]}):(0,H.jsx)(Yt,{value:j.at,onChange:e=>L({...j,at:e,scheduleDirty:!0})})]}),j.hasMessage?(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:tt()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:j.message,onChange:e=>L({...j,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(ht,{children:[(0,H.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:Me()}),(0,H.jsxs)(C,{onClick:()=>void mn(),disabled:j===null||j.loading||Ht,children:[Ht?(0,H.jsx)(bt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,we()]})]})]})})]})}export{pn as ScheduledTab};
|