@lacneu/atrium 0.84.2 → 0.84.4
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-BnjDbsIq.js → AccessTab-U9gkqPi_.js} +1 -1
- package/dist/assets/{AdvancedFilter-6o-vjEqR.js → AdvancedFilter-BbGwAk2J.js} +1 -1
- package/dist/assets/AgentFilesTab-B8Yjl6k_.js +3 -0
- package/dist/assets/AnomaliesTab-j2y9uU-G.js +1 -0
- package/dist/assets/AuditTab-Hce8hJqk.js +1 -0
- package/dist/assets/BridgeTab-fCJQhfcl.js +1 -0
- package/dist/assets/ChatDefaultsTab-CU8MWJDx.js +1 -0
- package/dist/assets/{DataTableShell-CQpAyEEP.js → DataTableShell-tMQLeAkL.js} +1 -1
- package/dist/assets/{DetailChips-2FbzhIf1.js → DetailChips-BJrU9abA.js} +1 -1
- package/dist/assets/FeedbacksTab-ChbJhdh0.js +1 -0
- package/dist/assets/{FieldLabel-4QP66FKv.js → FieldLabel-D-1TOAEd.js} +1 -1
- package/dist/assets/FilesTab-BK5AB6xP.js +1 -0
- package/dist/assets/{FilterBar-CZtflyw0.js → FilterBar-BB9HpiR0.js} +1 -1
- package/dist/assets/GroupsTab-Cvthu-9e.js +1 -0
- package/dist/assets/InstancesTab-BGpPt4KT.js +1 -0
- package/dist/assets/{IntegrationsTab-CfuI1MGk.js → IntegrationsTab-D7z-nVKE.js} +1 -1
- package/dist/assets/KpiTab-1TZebhaA.js +1 -0
- package/dist/assets/PreferencesTab-IF07Bg1d.js +1 -0
- package/dist/assets/ProjectPage-D2cJu3qQ.js +1 -0
- package/dist/assets/PromptInjectionsTab-BLc91QlQ.js +4 -0
- package/dist/assets/RolesTab-CWanW3h-.js +1 -0
- package/dist/assets/ScheduledTab-Bd-mayHR.js +1 -0
- package/dist/assets/ServiceAccountsTab-BhZ24YSZ.js +1 -0
- package/dist/assets/SubAgentReportsTab-t74GNChq.js +1 -0
- package/dist/assets/ThemeShowroom-CxUfL_C0.js +1 -0
- package/dist/assets/{TimeRangePicker-Br6VJeCu.js → TimeRangePicker-BNzXp6XH.js} +1 -1
- package/dist/assets/{TimezoneCombobox-Ca1xgI0k.js → TimezoneCombobox-I1Uc-Ubw.js} +1 -1
- package/dist/assets/TracesTab-DmBA2Kdl.js +1 -0
- package/dist/assets/UsersTab-DeLrFIwE.js +1 -0
- package/dist/assets/VoiceTab-BwqfO1Qw.js +1 -0
- package/dist/assets/{api-CzqUiUHp.js → api-NzmVMBHn.js} +5 -5
- package/dist/assets/{button-mVD1CeVl.js → button-BHiy_q9F.js} +1 -1
- package/dist/assets/{card-D75hHhpt.js → card-Dgi0cIBy.js} +1 -1
- package/dist/assets/chevrons-up-down-ByP4WpSK.js +1 -0
- package/dist/assets/{compatView-CDOjftYx.js → compatView-DaOCauKc.js} +1 -1
- package/dist/assets/dispatchErrorInfo-Cv5NrLNL.js +1 -0
- package/dist/assets/{dist-BZeJS6Sb.js → dist-Bq7TOaac.js} +1 -1
- package/dist/assets/{dist-BmaVGWkf.js → dist-Dlw2jmvE.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-Ck7PppRT.js → highlighted-body-OFNGDK62-B_P-O6Hv.js} +1 -1
- package/dist/assets/{index-BFVb3Mjo.css → index-ButHo2z6.css} +1 -1
- package/dist/assets/index-DRTZkZgA.js +324 -0
- package/dist/assets/{list-D82d6otE.js → list-Dbcww3Mb.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BXcnFAbM.js +1 -0
- package/dist/assets/{pdf-G6tnCj_R.js → pdf-qp966rql.js} +1 -1
- package/dist/assets/roleDescriptions-Dj1fvyuY.js +1 -0
- package/dist/assets/{table-J7fjwIkj.js → table-BKRXY_Eg.js} +1 -1
- package/dist/assets/{tabs-gkzHrCFV.js → tabs-JuirMY8K.js} +1 -1
- package/dist/assets/x-B2aLNZur.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-D4h1Eu5S.js +0 -3
- package/dist/assets/AnomaliesTab-CFJwY8OX.js +0 -1
- package/dist/assets/AuditTab-CUsPVYYA.js +0 -1
- package/dist/assets/BridgeTab-DXLJRxq0.js +0 -1
- package/dist/assets/ChatDefaultsTab-pmrb04Z8.js +0 -1
- package/dist/assets/FeedbacksTab-C4SWnnLu.js +0 -1
- package/dist/assets/FilesTab-WF7Ywnw5.js +0 -1
- package/dist/assets/GroupsTab-D5yFhbEf.js +0 -1
- package/dist/assets/InstancesTab-rpykNSgd.js +0 -1
- package/dist/assets/KpiTab-BlR8kWRx.js +0 -1
- package/dist/assets/PreferencesTab-BLHBDN_p.js +0 -1
- package/dist/assets/ProjectPage-iG5lwJKE.js +0 -1
- package/dist/assets/PromptInjectionsTab-Bo48J3FL.js +0 -4
- package/dist/assets/RolesTab-DrrF836-.js +0 -1
- package/dist/assets/ScheduledTab-SZz4k8uK.js +0 -1
- package/dist/assets/ServiceAccountsTab-C4T3vVW5.js +0 -1
- package/dist/assets/SubAgentReportsTab-DaUidFsA.js +0 -1
- package/dist/assets/ThemeShowroom-C-tuB0xu.js +0 -1
- package/dist/assets/TracesTab-Dx1WMkPR.js +0 -1
- package/dist/assets/UsersTab-BmfZaKj1.js +0 -1
- package/dist/assets/VoiceTab-DcngXxuS.js +0 -1
- package/dist/assets/chevrons-up-down-BQwZKuAc.js +0 -1
- package/dist/assets/dispatchErrorInfo-DYk7zLf1.js +0 -1
- package/dist/assets/index-B_pZhBYM.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-p--yzMEy.js +0 -1
- package/dist/assets/roleDescriptions-DVC-Aspp.js +0 -1
- package/dist/assets/x-CNUeHA-C.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cm as r,Dm as i,Em as a,Om as o,Sm as s,Tm as c,_m as l,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cm as r,Dm as i,Em as a,Om as o,Sm as s,Tm as c,_m as l,bB as u,bm as d,dB as f,gm as p,hm as m,km as h,t as g,vm as _,wm as v,xm as y,ym as b}from"./api-NzmVMBHn.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-DRTZkZgA.js";var D=t(e(),1);function O(e){return e===`user`?b():e===`all`?_():l({group:e.group})}function k(e){return e===`common`?p():e===`owner`?m():l({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=u(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),l=u(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":o(),children:(0,A.jsx)(E,{placeholder:o()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):l===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:l.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:l.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),l.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:l.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),l.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:l.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:d()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),l.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:l.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),l.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:l.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gg as r,Hg as i,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gg as r,Hg as i,Jg as a,Kg as o,Ug as s,Wg as c,qg as l}from"./api-NzmVMBHn.js";import{t as u}from"./x-B2aLNZur.js";import{t as d}from"./button-BHiy_q9F.js";import{$ as f,Hn as p,Q as m,X as h,Z as g,et as _,gn as v,jt as y}from"./index-DRTZkZgA.js";import{r as b}from"./TimeRangePicker-BNzXp6XH.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(p,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),l(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:r()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),i()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Bd as i,Bo as a,Fd as o,Fo as s,Gd as c,Gf as l,Go as u,Hd as d,Ho as f,Id as p,Io as m,Jd as h,Jo as g,Jt as _,Kd as v,Ko as y,Ld as b,Lo as x,Md as S,Mo as C,Nd as w,No as T,Pd as E,Po as D,Qd as O,Qo as k,Rd as ee,Ro as A,Ud as j,Uo as M,Vd as N,Vo as P,Wd as te,Wo as F,Xd as I,Xo as L,Yd as ne,Yo as re,Zd as R,Zo as z,_B as B,af as V,bB as H,dB as U,do as ie,ef as ae,fo as oe,gM as se,go as ce,ho as le,if as ue,mo as de,nf as fe,of as pe,pB as W,po as me,qd as he,qf as G,qo as K,rf as ge,sf as _e,t as q,tf as ve,uo as ye,yB as be,zd as xe,zo as Se}from"./api-NzmVMBHn.js";import{t as J}from"./button-BHiy_q9F.js";import{$ as Ce,B as we,Ct as Te,Dt as Y,Et as Ee,Q as De,St as Oe,Tt as ke,X as Ae,Z as je,at as Me,bt as Ne,et as Pe,nt as Fe,ot as Ie,q as Le,rt as Re,tt as ze,un as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-DRTZkZgA.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-DaOCauKc.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=H(q.me.getMe,{host:Le}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=H(q.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=H(q.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=H(q.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[d,f]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let p=u?.find(e=>$(e)===d)??null,m=B(q.agentFiles.listAgentFiles),[h,v]=(0,X.useState)({status:`idle`}),y=p?.instanceName??null,b=p?.agentId??null,x=H(q.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),S=n&&y!==null?we(x,`agentFiles`):null,C=S===null?!1:S===`loading`?null:S.blocked,w=(0,X.useCallback)(async()=>{if(!(y===null||b===null)){v({status:`loading`});try{v({status:`done`,files:(await m({instanceName:y,agentId:b})).files})}catch(e){v({status:`error`,dashboardAbsent:tt(e)})}}},[m,y,b]);(0,X.useEffect)(()=>{C===!1&&w()},[w,C]);let[T,E]=(0,X.useState)(null),D=H(q.agentFileCuration.listCurations,t&&y!==null&&b!==null?{instanceName:y,agentId:b}:`skip`),k=H(q.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),ee=B(q.agentFileCuration.requestCuration),[A,j]=(0,X.useState)(null),[M,N]=(0,X.useState)(null),{toast:P}=Y(),te=(0,X.useMemo)(()=>{let e=new Map;for(let t of D??[])e.has(t.name)||e.set(t.name,t);return e},[D]),F=(0,X.useCallback)(async e=>{if(!(y===null||b===null)){j(e);try{let t=await ee({instanceName:y,agentId:b,name:e,trigger:`manual`});t.ok?P({title:re(),variant:`success`}):P({title:g({reason:t.reason??`unknown`}),variant:`error`})}catch{P({title:K(),variant:`error`})}finally{j(null)}}},[ee,y,b,P]),L=W(),z=(0,X.useMemo)(()=>new Intl.NumberFormat(L,{maximumFractionDigits:0}),[L]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ae,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ce,{size:`sm`,"aria-label":pe(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:(i??[]).map(e=>(0,Q.jsx)(De,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ae,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(Ce,{size:`sm`,"aria-label":V(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:u.map(e=>(0,Q.jsx)(De,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()})]}),p===null?null:S===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):S!==null&&S.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Be,{size:14,"aria-hidden":!0}),` `,qe(S.gatewayVersion,S.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?_():fe(),` `,!h.dashboardAbsent&&(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:l()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Xe(e.size),i=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)(Ee,{variant:`outline`,children:ve()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ae({size:Z(e.size,L)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` 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:r({pct:z.format(n)})}),i?(0,Q.jsx)(Be,{size:14,className:`oc-afiles__warn`,"aria-label":O()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>E(e),children:t?I():ne()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:k?.budgetChars??null,enabled:k?.enabled??!1,curation:te.get(e.name)??null,inFlight:A===e.name,onCurate:()=>void F(e.name),onReview:e=>N(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:R({used:Z(Qe(h.files),L),total:Z(Ye,L),pct:z.format(Ze(Qe(h.files)))})})]}),T&&p?(0,Q.jsx)(at,{instanceName:p.instanceName,agentId:p.agentId,name:T.name,isAdmin:t,onClose:()=>E(null),onSaved:()=>void w()}):null,M?(0,Q.jsx)(ot,{curationId:M,onClose:()=>N(null),onApplied:()=>{N(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(J,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:z()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ee,{variant:`outline`,className:`oc-afiles__curate-status`,children:L()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:k()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:s}){let u=B(q.agentFiles.getAgentFile),f=B(q.agentFiles.setAgentFile),m=Y(),[g,_]=(0,X.useState)(null),[y,x]=(0,X.useState)(!1),[C,T]=(0,X.useState)(``),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),[M,P]=(0,X.useState)(!1),[F,I]=(0,X.useState)(!1),L=(0,X.useCallback)(async r=>{x(!1);try{let i=await u({instanceName:e,agentId:t,name:n});_({content:i.content,updatedAtMs:i.updatedAtMs}),r||T(i.content),P(!1)}catch{x(!0)}},[u,e,t,n]);(0,X.useEffect)(()=>{L(!1)},[L]);async function ne(){if(g!==null){A(!0),I(!1);try{await f({instanceName:e,agentId:t,name:n,content:C,baseUpdatedAtMs:g.updatedAtMs??void 0}),m.success(d({name:n})),s(),await L(!1)}catch(e){nt(e)?P(!0):I(!0)}finally{A(!1)}}}let re=g!==null&&C!==g.content,R=(0,X.useMemo)(()=>g===null?null:et(g.content,C),[g,C]),z=C.length>Je,V=W(),H=(0,X.useMemo)(()=>new Intl.NumberFormat(V),[V]);return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ie,{children:h({name:n})}),(0,Q.jsxs)(Re,{children:[he({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,v()]})]})]}),y?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[i(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:l()})]}):g===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:C,readOnly:!r,spellCheck:!1,onChange:e=>T(e.target.value),"aria-label":h({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:c()}),M?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[xe(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:ee()})]}):null,F?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:N()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${z?` is-over`:``}`,children:te({count:H.format(C.length),max:H.format(Je)})}),r?(0,Q.jsx)(J,{size:`sm`,disabled:!re||k||M,onClick:()=>O(!0),children:k?G():j()}):null]})]}),(0,Q.jsx)(Ve,{open:D,onOpenChange:O,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(ke,{children:b({name:n})}),(0,Q.jsx)(Oe,{children:p({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:o({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:w()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ne,{children:se()}),(0,Q.jsx)(We,{onClick:()=>void ne(),children:S()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=H(q.agentFileCuration.getProposal,{curationId:e}),i=B(q.agentFileCuration.approveCuration),o=be(q.agentFileCuration.rejectCuration),{toast:c}=Y(),[l,d]=(0,X.useState)(null),[p,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(``),v=W(),b=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function S(){d(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:y(),variant:`success`}),n()):c({title:t.reason===`conflict`?F():M({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:K(),variant:`error`})}finally{d(null)}}async function w(n){d(`reject`);try{let r=g.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?ie():u(),variant:`success`}):c({title:a(),variant:`error`}),t()}catch{c({title:K(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ie,{children:r?f({name:r.name}):U()}),(0,Q.jsx)(Re,{children:P()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[Se({before:Z(r.beforeSize,v),after:Z(r.proposedSize,v)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Be,{size:13,"aria-hidden":!0}),` `,A()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:x({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ye({feedback:r.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:C()}),(0,Q.jsx)(`ul`,{children:b.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:T()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:m()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:ce()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:le(),value:g,onChange:e=>_(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:de()}),(0,Q.jsx)(J,{variant:`outline`,onClick:()=>void w(!1),disabled:l!==null,children:l===`reject`?G():me()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void w(!0),disabled:l!==null,children:l===`reject`?G():oe()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:s()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void S(),disabled:l!==null||r==null,children:l===`approve`?G():D()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Aw as i,Cw as ee,Dw as te,Ew as ne,Fw as a,GC as o,Iw as re,JC as s,KC as c,Lw as l,Mw as ie,Nw as ae,Ow as oe,Pw as se,QC as ce,Rw as u,Sw as le,Tw as ue,WC as d,XC as f,YC as p,ZC as m,_w as de,aw as fe,bB as h,bw as pe,cw as me,dw as g,ew as _,fw as he,gw as v,hw as ge,iw as _e,jw as ve,kw as ye,lw as y,mw as be,nw as xe,ow as Se,pw as Ce,qC as b,rw as x,sw as S,t as C,tw as w,uw as T,vw as E,ww as D,xw as O,yB as k,yw as A,zw as j}from"./api-NzmVMBHn.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-DRTZkZgA.js";import{n as Ae}from"./TimeRangePicker-BNzXp6XH.js";import{t as je}from"./FilterBar-BB9HpiR0.js";import{t as Me}from"./DataTableShell-tMQLeAkL.js";import{t as W}from"./dispatchErrorInfo-Cv5NrLNL.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?j():e===`acknowledged`?u():l()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,J=`all`;function Y(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,o=e.status===J?q:e.status,s=e.severity??q,c=e.kind??q,[l,u]=(0,G.useState)(q),d=De(e.from,e.to),{from:f,to:p}=Ae(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),b=e=>void t({search:t=>({...t,status:e===q?J:e})}),j=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=k(C.anomalies.resolveAnomaly),Y=(h(C.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=h(C.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:f,to:p,anomalyStatus:o===q?void 0:o,severity:s===q?void 0:s,source:l===q?void 0:l,kind:c===q?void 0:c}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||o!==`open`||s!==q||l!==q||c!==q||d.kind!==`relative`||d.from!==Le.from;function $(){u(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:re(),description:(0,K.jsxs)(K.Fragment,{children:[a(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,se(),` `,(0,K.jsx)(`strong`,{children:ae()}),`.`,` `,ie()]}),confirmLabel:ve()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(i(),e.kind)}catch(e){U.error(ye(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(oe(),e.kind)}catch(e){U.error(te(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,K.jsx)(`strong`,{children:ue()}),` `,D(),` `,(0,K.jsx)(`strong`,{children:ee()}),` `,le(),` `,(0,K.jsx)(`strong`,{children:O()}),` `,pe(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:A()})]}),(0,K.jsxs)(je,{q:n,onQChange:m,searchPlaceholder:E(),timeRange:d,onTimeRangeChange:V,onReset:$,canReset:Q,children:[(0,K.jsxs)(I,{value:o,onValueChange:b,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:de()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:s,onValueChange:j,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:v()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:he()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:l,onValueChange:u,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:g()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:T()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:c,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:y()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:me()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:S(),rows:X,emptyHint:o===`open`?Se():fe(),rowActions:e=>Y&&e.status===`open`?[{label:_e(),onSelect:()=>void We(e)},{label:x(),onSelect:()=>void Ge(e)}]:[],columns:[{header:xe(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:y(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ge(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Ce({when:z(e.firstAt)}),children:be({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:v(),cell:e=>(0,K.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:w(),cell:e=>(0,K.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:_(),cell:e=>(0,K.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,K.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:r(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ce(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var X=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Z(e){if(!X.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=Q(e);return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,m()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,m()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,m()]}):null]})}function Be({row:e}){let[t,n]=(0,G.useState)(!1),r=h(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[f(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(U,{open:t,onOpenChange:n,children:(0,K.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(H,{children:p()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:s()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:b()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,K.jsx)(N,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:o()}):(0,K.jsx)(N,{variant:`outline`,children:d()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BT as i,FT as a,HT as o,IT as s,LT as c,MT as l,NT as u,PT as d,RT as f,UT as p,VT as m,WT as h,bB as g,ca as _,da as v,fa as y,jT as b,la as x,sa as S,t as C,ua as w,zT as T}from"./api-NzmVMBHn.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-DRTZkZgA.js";import{n as ee}from"./TimeRangePicker-BNzXp6XH.js";import{t as z}from"./FilterBar-BB9HpiR0.js";import{t as B}from"./AdvancedFilter-BbGwAk2J.js";import{t as V}from"./DataTableShell-tMQLeAkL.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:y()},{value:`realLabel`,label:v()},{value:`targetLabel`,label:w()},{value:`impersonated`,label:x()},{value:`resource`,label:_()},{value:`resourceId`,label:S()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,_=e.action??G,v=e.impersonated??G,y=e.resource??G,x=F(e.from,e.to),S=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:w,to:I}=ee(x),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=g(C.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:_===G?void 0:_,resource:y===G?void 0:y,impersonated:v===G?void 0:v===`yes`,advanced:S.length>0?S:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||_!==G||v!==G||y!==G||S.length>0||x.kind!==`relative`||x.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:[h(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:o(),timeRange:x,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:_,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:m()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:i()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:v,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:T()}),(0,U.jsx)(k,{value:`yes`,children:f()}),(0,U.jsx)(k,{value:`no`,children:c()})]})]}),(0,U.jsxs)(A,{value:y,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:s()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:a()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:S,onChange:Q}),(0,U.jsx)(V,{title:d(),rows:$,emptyHint:u(),columns:[{header:l(),cell:e=>N(e.at),sort:e=>e.at},{header:m(),cell:e=>e.action,sort:e=>e.action},{header:b(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ab as i,Ai as a,Ax as o,Bb as s,Bx as c,Cb as l,D as u,Db as d,Eb as f,Fb as p,Fx as m,Gb as h,Hb as g,Ib as _,Ii as v,Ix as ee,Jb as y,Kb as b,Lb as x,Lx as te,Mb as ne,Mi as re,Nb as ie,Ni as ae,Ob as oe,Pb as se,Px as ce,Qb as le,Rb as ue,Rx as de,Sb as fe,Tb as pe,Ub as me,Ux as he,Vb as ge,Vx as _e,Wb as ve,Wx as ye,Xb as be,Yb as xe,Yt as Se,Zb as Ce,_B as we,_b as Te,_d as Ee,ax as De,bB as S,bb as Oe,bd as ke,cx as Ae,db as C,dd as je,ex as Me,fb as w,fd as Ne,gb as Pe,gd as T,hb as Fe,hd as Ie,id as Le,ix as Re,jb as ze,ji as Be,jx as Ve,kb as He,ki as Ue,ld as We,mb as Ge,md as Ke,nx as qe,ox as Je,pb as Ye,pd as Xe,qb as Ze,rx as Qe,sx as $e,t as E,tx as et,ub as D,ud as tt,vb as nt,vd as rt,wb as O,xb as it,xd as at,yB as ot,yb as st,yd as ct,zb as lt,zx as ut}from"./api-NzmVMBHn.js";import{t as dt}from"./chevrons-up-down-ByP4WpSK.js";import{i as ft,n as k,o as pt,r as mt,s as ht}from"./FieldLabel-D-1TOAEd.js";import{i as gt,n as _t,r as vt,t as yt}from"./tabs-JuirMY8K.js";import{t as bt}from"./button-BHiy_q9F.js";import{$ as A,Bn as xt,Bt as St,Dn as Ct,Dt as wt,Et as j,F as Tt,Gn as Et,Hn as M,Kn as Dt,Q as N,Rn as Ot,Rt as kt,X as P,Z as F,at as At,ct as jt,et as I,jt as L,lt as R,nt as Mt,ot as Nt,pn as Pt,q as Ft,rt as It,tt as Lt,un as z,ut as Rt,zn as zt,zt as Bt}from"./index-DRTZkZgA.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-BKRXY_Eg.js";import{t as Gt}from"./FilterBar-BB9HpiR0.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-DaOCauKc.js";import{t as U}from"./dispatchErrorInfo-Cv5NrLNL.js";var $t=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Y(e.label,t.label))}function gn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[i,a]=(0,W.useState)(null),o=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,W.useMemo)(()=>mn(o),[o]),c=(0,W.useMemo)(()=>hn(o),[o]),u=(0,W.useMemo)(()=>gn(o),[o]),d=(0,W.useMemo)(()=>pn(dn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:pe(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:l()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:O()}),s.map(e=>(0,Z.jsx)(N,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:fe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:O()}),c.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:it()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:O()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:st(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:nt(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Te(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Pe(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Fe(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(B,{children:Ge()}),(0,Z.jsx)(Q,{label:Ye(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(vn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(dt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:d({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[f({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?w():e===`error`?C():D()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(j,{variant:`secondary`,children:w()}):e===`error`?(0,Z.jsx)(j,{variant:`destructive`,children:C()}):(0,Z.jsx)(j,{variant:`outline`,children:D()})}function xn(){return S(E.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=S(E.compat.getBridgeCompat,{}),n=S(E.me.getMe,{host:Ft})?.role===`admin`,r=S(E.admin.listInstances,n?{}:`skip`),i=S(E.agents.usageForInstances,n?{}:`skip`),o=Et(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=Et({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:y()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ze()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(B,{children:ae()}),(0,Z.jsx)(B,{children:re()}),(0,Z.jsx)(B,{children:Be()}),(0,Z.jsx)(B,{children:a()}),(0,Z.jsx)(B,{children:Ue()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Z.jsxs)(yt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(vt,{className:`w-full`,children:c.map(e=>(0,Z.jsxs)(gt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Pt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),c.map(e=>(0,Z.jsx)(_t,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):null]})}function Cn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:ct(),children:[`(`,a,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,rt({build:t.buildVersion??`?`})]}):null,` · `,Ee(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?T():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ue()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=jt(e.checkedAt),m=e.startedAt==null?null:jt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(Ot,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(z,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?x():l===`gateways_unreachable`?ie({count:u.length}):c?_():p({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,se({time:f})]}),m?(0,Z.jsx)(`span`,{children:ze({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ne({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:i()})]})}function wn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(j,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:at()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}),He({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[b(),i.length>0?(0,Z.jsx)(j,{variant:`destructive`,children:ve({count:i.length})}):a>0?(0,Z.jsx)(j,{variant:`destructive`,children:me()}):(0,Z.jsx)(j,{variant:`secondary`,children:h()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[g({version:e.vendoredVersion}),r?` · `+ge({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}),s({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:v({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Xe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:T()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Nt,{children:ye({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:he()})]}),(0,Z.jsx)(On,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ot,{"aria-hidden":!0}):(0,Z.jsx)(z,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?le():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ce()]}):null}function On({instance:e,onClose:t}){let n=ot(E.admin.upsertInstanceConfig),i=we(E.bridge.validateMediaPaths),a=wt(),s=Vt(e.config?.contentLocale,void 0),[l,u]=(0,W.useState)(()=>ft(e.config??{},s)),[d,f]=(0,W.useState)(!1),[p,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(null),v=l.inboundMediaMode===`shared-fs`,y=l.mediaMode===`shared-fs`,b=v||y;async function x(){h(!0),_(null);try{_(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){a.error(qe(),e)}finally{h(!1)}}async function ne(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:mt(l,r,s)}),t()}catch(e){a.error(ee(),e)}finally{f(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:_e(),help:m()}),(0,Z.jsxs)(P,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:ht.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:c(),help:ce()}),(0,Z.jsxs)(P,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:pt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:ut(),help:Ve()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:Ae(),help:$e()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:Je(),help:De()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(k,{label:de(),help:o()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),xe({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Me(),result:g.inbound}),(0,Z.jsx)($,{label:r(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:et()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),be()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(bt,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:p,children:[p?(0,Z.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?Qe():Re()]}),(0,Z.jsx)(bt,{size:`sm`,onClick:()=>void ne(),disabled:d,children:te()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(St,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ne():je({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:tt()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Bf as i,Cd as a,Dd as o,Ed as s,Fi as c,Gf as l,Gs as u,Hx as d,Js as f,Ks as p,Od as m,Qs as h,Sd as g,Td as _,Us as v,Vf as y,Ws as b,Xs as x,Ys as S,Zs as C,_B as w,bB as T,dB as E,kd as D,of as O,qf as k,qs as A,t as j,wd as M,yB as N}from"./api-NzmVMBHn.js";import{t as P}from"./button-BHiy_q9F.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,un as W,ut as G}from"./index-DRTZkZgA.js";import{a as K}from"./compatView-DaOCauKc.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=N(j.admin.upsertInstanceConfig),n=T(j.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,o]=(0,q.useState)(r),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=i!==r;async function d(){c(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let p=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?l:i,onValueChange:e=>o(e===l?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":S(),children:(0,X.jsx)(H,{placeholder:A()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:l,children:A()}),p.map(e=>(0,X.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?k():M()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null]})}function Q({instance:e}){let t=N(j.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,q.useState)(n),[s,c]=(0,q.useState)(r===null?``:String(r)),[l,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),c(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=s.trim(),m=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,h=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,_=i!==n||(m??null)!==r;async function v(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":x()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":p(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!h||l===`saving`,onClick:()=>void v(),children:l===`saving`?k():M()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:u()}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function $({instance:e}){let t=N(j.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,d=(l??null)!==n;async function f(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,X.jsx)(P,{size:`sm`,disabled:!d||!u||o===`saving`,onClick:()=>void f(),children:o===`saving`?k():M()})]}),u?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function ee(){let e=w(j.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=T(j.admin.listInstances,{}),[u,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!u||!a.some(e=>e.name===u))&&f(a[0].name)},[a,u]);let p=(a?.length??0)>1,h=a!==void 0&&a.length===0,g=T(j.compat.forInstance,u?{instanceName:u}:`skip`),v=u?I(g,`configDefaults`):`loading`,b=v===`loading`?null:v.blocked,x=(0,q.useMemo)(()=>p&&u?{instanceName:u}:{},[p,u]),S=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++S.current;n({status:`loading`});try{let r=Y(await e(x));if(S.current!==t)return;n({status:`done`,current:r})}catch{if(S.current!==t)return;n({status:`error`})}},[e,x]);(0,q.useEffect)(()=>{b===!1&&(p&&!u||C())},[C,b,p,u]);let k=t.status===`done`?t.current:null,A=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:y()},{id:`standard`,label:i()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),p&&u?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,X.jsxs)(B,{value:u,onValueChange:e=>f(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":O(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(a??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,h?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):v===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):v.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(v.gatewayVersion,v.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[_(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:l()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:A,value:k?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:D()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,X.jsx)(L,{field:`fastMode`,options:M,value:k===null||k.fastModeDefault===null?null:k.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:o()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:c()})]}),(()=>{let e=a?.find(e=>e.name===(u??a[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ag as r,eg as i,ig as a,ng as o,og as s,rg as c,tg as l}from"./api-NzmVMBHn.js";import{t as u}from"./chevrons-up-down-ByP4WpSK.js";import{t as d}from"./button-BHiy_q9F.js";import{Hn as f,It as p,Lt as m,Mt as h,Nt as g,Pn as _,Pt as v,dn as y,gn as b,ut as x,zn as S}from"./index-DRTZkZgA.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BKRXY_Eg.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=s(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(x,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(S,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(x,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(p,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-DRTZkZgA.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
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,CO as o,DO as s,EO as c,FO as l,GO as u,HO as d,IO as f,JO as p,KO as ee,LO as te,MO as m,NO as h,OO as ne,PO as g,QO as _,RO as re,SO as v,TO as y,UO as ie,VO as ae,WO as b,XO as oe,YO as x,ZO as S,_O as C,ak as w,bB as T,bO as E,cO as D,ck as O,dO as k,ek as A,fO as j,gO as M,hO as N,ik as P,is as F,jO as I,kO as L,lO as R,lk as z,mO as B,nk as V,ns as H,ok as U,pO as W,qO as se,rk as G,sk as K,t as q,tk as ce,uO as le,uk as ue,vO as de,wO as fe,xO as pe,yB as J,yO as me,zO as he}from"./api-NzmVMBHn.js";import{t as ge}from"./button-BHiy_q9F.js";import{U as _e,ct as Y}from"./index-DRTZkZgA.js";import{t as ve}from"./DataTableShell-tMQLeAkL.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>ue(),incorrect:()=>z(),incoherence:()=>O(),formatting:()=>K(),latency:()=>U(),api_error:()=>w(),other:()=>P()},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:V()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:ce()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:G()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=J(q.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[m,h]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1);async function C(){let t=m.trim();if(!(!t||v)){y(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{y(!1)}}}let w=[];try{w=i.contextJson?JSON.parse(i.contextJson):[]}catch{w=[]}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?` · ${A()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:ne(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(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:B()}),(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:_()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?S():e.authorRole===`agent`?e.authorLabel??F():oe()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:x()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:p(),value:m,maxLength:2e3,rows:3,onChange:e=>h(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 C(),disabled:!m.trim()||v,children:v?se():ee()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||b()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||b()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae({count:i.contextCount??w.length,truncated:i.contextTruncated?a():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.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:he()}),(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:re()}),(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:te()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?f({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:[l(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,g()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=T(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=_e(),[a,l]=(0,X.useState)(null),[u,d]=(0,X.useState)({});async function f(e){if(a===e._id){l(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function p(e){await r({title:le(),description:R(),confirmLabel:D(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&l(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,Z.jsx)(`strong`,{children:m()}),` `,I()]}),(0,Z.jsx)(ve,{title:i(),rows:e,emptyHint:L(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:s(),cell:e=>Y(e.at),sort:e=>e.at},{header:c(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:y(),cell:e=>e.messageRole===`user`?fe():o(),sort:e=>e.messageRole},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${pe({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:E(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:me(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:de(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:C()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:M()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:H()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:N()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?W():j(),onSelect:()=>void f(e)},{label:k(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,DB as n}from"./api-NzmVMBHn.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-DRTZkZgA.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as ee,Az as r,Cz as i,Dz as a,Ez as o,Mz as te,Oz as s,QR as ne,Sz as re,Tz as c,ZR as l,_z as u,az as d,bB as f,bz as p,cs as m,cz as ie,dB as ae,dz as oe,ez as se,fz as ce,gM as le,gz as h,hz as g,iz as ue,jz as de,kz as _,lz as fe,mz as pe,nz as me,oz as he,pB as ge,pz as _e,rz as ve,ss as ye,sz as be,t as v,tz as y,uz as b,vz as x,wz as S,xz as C,yB as w,yz as T}from"./api-NzmVMBHn.js";import{t as E}from"./button-BHiy_q9F.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-DRTZkZgA.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-BKRXY_Eg.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return C();case`audio`:return p();case`video`:return T();case`pdf`:return x();case`document`:return u();case`archive`:return h();default:return g()}}function K(){let[e,t]=(0,H.useState)(W),[n,u]=(0,H.useState)(W),[p,h]=(0,H.useState)(W),[g,x]=(0,H.useState)(W),[C,T]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=w(v.files.softDelete),Y=k();function Ie(){t(W),u(W),h(W),x(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ue())}catch(e){Y.error(ve(),e)}}let X=f(v.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:p===W?void 0:p,category:g===W?void 0:g,includeAutoGenerated:C||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ae()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||p!==W||g!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":de(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:r()}),(0,U.jsx)(F,{value:`inbound`,children:_()}),(0,U.jsx)(F,{value:`outbound`,children:s()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:u,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":a(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:o()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:p,onValueChange:h,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":c(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:S()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:g,onValueChange:x,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":i(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:re()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:C,onCheckedChange:e=>T(e===!0),"aria-label":m()}),(0,U.jsx)(`span`,{children:m()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),be()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ne():ee()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:pe()}),(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:b()}),(0,U.jsx)(z,{className:`text-right`,children:fe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:ye()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?_():s()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),ie()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),se()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),d()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:l({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:me()}),(0,U.jsx)(Ce,{children:y()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:le()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:d()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cg as r,sg as i}from"./api-NzmVMBHn.js";import{t as a}from"./button-BHiy_q9F.js";import{hn as o,jt as s,mn as c}from"./index-DRTZkZgA.js";import{t as l}from"./TimeRangePicker-BNzXp6XH.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Ap as i,Bp as a,Cp as o,D as s,Dp as c,Ep as l,Fp as u,Gp as d,Hp as f,Ip as p,Jp as m,Kp as h,Lp as g,Mp as _,Np as v,Op as y,Pp as b,Qp as x,Rp as S,Sp as C,Tp as w,Up as ee,Vp as te,Wp as ne,Xp as T,Yp as re,Zp as E,_p as D,am as ie,ap as O,bB as k,bp as A,cm as ae,cp as oe,dm as j,dp as se,em as M,fm as ce,fp as le,gp as ue,hp as N,im as de,jp as P,kp as fe,lm as pe,lp as F,mm as me,mp as he,nm as ge,om as _e,op as ve,pm as ye,pp as be,qp as xe,rm as Se,sm as Ce,sp as we,t as I,tm as Te,um as Ee,up as De,vp as Oe,wp as ke,xp as Ae,yB as L,yp as je,zp as R}from"./api-NzmVMBHn.js";import{t as Me}from"./x-B2aLNZur.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-JuirMY8K.js";import{t as V}from"./button-BHiy_q9F.js";import{$ as Fe,Bn as Ie,Dt as H,Et as U,Q as Le,U as Re,Vn as ze,X as Be,Z as Ve,_ as He,at as Ue,cn as We,et as Ge,fn as W,jt as G,nt as Ke,ot as qe,pn as K,q as Je,rt as Ye,tt as Xe,ut as q}from"./index-DRTZkZgA.js";import{t as Ze}from"./FilterBar-BB9HpiR0.js";import{t as Qe}from"./DataTableShell-tMQLeAkL.js";import{t as J}from"./DetailChips-BJrU9abA.js";var Y=s(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=s(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return u();case`user`:return b();case`pending`:return v();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=k(I.groups.listGroups,{}),t=k(I.me.getMe,{host:Je})?.role===`admin`,n=L(I.groups.createGroup),i=L(I.groups.updateGroup),a=L(I.groups.deleteGroup),o=Re(),s=H(),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)($),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(``),y=(0,Z.useMemo)(()=>{if(!e)return e;let t=_.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,_]);function b(){d(null),p($),l(!0)}function S(e){d(e),p({name:e.name,description:e.description??``}),l(!0)}async function C(){try{u?await i({groupId:u._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p($),d(null),l(!1)}catch(e){s.error(oe(),e)}}async function w(e){if(await o({title:re({name:e.name}),description:m(),confirmWord:e.name,confirmLabel:xe(),cancelLabel:Te(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(we(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,Q.jsx)(Ze,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:_e()}),(0,Q.jsx)(Qe,{title:me(),rows:y,addLabel:ce(),onAdd:t?b:void 0,emptyHint:j(),columns:[{header:Ee(),cell:e=>e.name,sort:e=>e.name},{header:pe(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(We,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ae(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ce(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Y,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ie(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:de(),onSelect:()=>S(e)},{label:Se(),variant:`destructive`,onSelect:()=>void w(e)}]:[]]}),(0,Q.jsx)(He,{open:c,onOpenChange:l,title:u?r():M(),description:x(),canSubmit:!!f.name.trim(),onSubmit:C,submitLabel:ge(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:E()}),(0,Q.jsx)(G,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:T()}),(0,Q.jsx)(G,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(ze,{size:14,"aria-hidden":!0}),S()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":p({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[g(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let o=k(I.groups.getGroup,n&&e?{groupId:e}:`skip`),s=k(I.groups.listAssignableInstances,n?{}:`skip`),l=k(I.groups.listAssignableUsers,n?{}:`skip`),u=L(I.groups.addMember),p=L(I.groups.removeMember),m=L(I.groups.bulkSetMembers),g=L(I.groups.setGroupManager),v=H(),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(`members`),[re,E]=(0,Z.useState)(1),[D,ie]=(0,Z.useState)(new Set),O=(0,Z.useRef)(null),A=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ae=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),oe=o?.viewerIsAdmin===!0,j=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Z.useEffect)(()=>{x(``),C(``),T(`members`),E(1),O.current=null},[n,e]),(0,Z.useEffect)(()=>{E(1)},[b]),(0,Z.useEffect)(()=>{n&&o&&e&&O.current!==e&&(O.current=e,ie(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let M=(0,Z.useMemo)(()=>l?$e(l,b,D):[],[l,b,D]);async function ce(t,n){if(e)try{n?await p({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){v.error(ve(),e)}}async function ue(t,n){if(e)try{await g({groupId:e,userId:t,manager:!n})}catch(e){v.error(De(),e)}}let N=rt(M,e=>A.has(e.userId)),de=M.filter(e=>A.has(e.userId)).length,P=it(M,re,ot);async function fe(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:N!==`all`})}catch(e){v.error(ve(),e)}}return(0,Q.jsx)(Xe,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Ke,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(qe,{children:h({name:t})}),(0,Q.jsx)(Ye,{children:d()})]}),(0,Q.jsxs)(Pe,{value:w,onValueChange:T,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(We,{size:13,"aria-hidden":!0}),ne(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),f(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),Ae(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:l===void 0||o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:b,onChange:e=>x(e.target.value),placeholder:ee(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void fe(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[de,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=A.has(e.userId),n=tt(e),r=ae.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ce(e.userId,t),"aria-label":_({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&oe?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?se():le(),title:r?se():le(),onClick:()=>void ue(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":be(),title:be(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:E})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:c()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:S,onChange:e=>C(e.target.value),placeholder:te(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:S},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=k(I.groups.listAssignableAgents,{instanceName:t}),s=L(I.groups.assignAgentToGroup),c=L(I.groups.removeAgentFromGroup),u=L(I.groups.bulkSetGroupAgents),d=H(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[i]),!e)return null;let m=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=rt(g,e=>r.has(`${t}/${e.agentId}`)),v=it(m,f,ot);async function y(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(O(),e)}}async function b(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){d.error(O(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:ke()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):m.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?w():l()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void b(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,v.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,s=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||s)&&!i,onCheckedChange:()=>void y(e.agentId,i),"aria-label":P({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":C(),title:C(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:o()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:v.page,pageCount:v.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=k(I.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(I.charts.assignChartToGroup),r=L(I.charts.removeChartFromGroup),a=L(I.charts.setGroupDefaultChart),o=L(I.charts.addChartToGroupPool),s=L(I.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:A()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":ue({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":N(),title:N(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:he()}):null,d?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":D({name:e.name}),title:D({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:Oe()})}),(0,Q.jsx)(Ve,{children:u.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:je()}):null:null]})}export{at as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AD as a,AE as o,B as s,BE as c,Bi as l,CD as u,CE as d,DD as f,DE as p,ED as m,EE as h,F as g,FE as _,G as v,GE as y,GT as b,H as x,HE as S,I as C,IE as w,JE as T,JT as E,K as D,KE as ee,KT as te,L as ne,LE as re,M as ie,MD as ae,ME as oe,Mx as se,N as ce,ND as le,NE as ue,Nx as de,OD as fe,OE as pe,P as me,PD as he,PE as ge,QE as _e,QT as ve,R as ye,RE as be,Ri as xe,SD as Se,SE as Ce,TD as we,TE as Te,U as Ee,UE as De,V as Oe,VE as ke,W as Ae,WE as je,XE as Me,XT as Ne,YE as Pe,YT as Fe,ZE as Ie,ZT as Le,_B as O,_D as Re,_E as ze,_N as k,aD as Be,aE as Ve,bB as A,bD as j,bE as M,cD as He,cE as Ue,dD as We,dE as Ge,eD as Ke,eE as qe,fD as Je,fE as Ye,gD as Xe,gE as Ze,gc as Qe,hD as $e,hE as N,hc as et,iD as tt,iE as nt,j as rt,jD as it,jE as at,kD as ot,kE as st,lD as ct,lE as lt,mD as ut,mc as dt,nD as ft,nE as pt,oD as mt,oE as ht,pD as gt,pE as _t,pc as vt,q as yt,qE as bt,qT as xt,rD as St,rE as Ct,sD as wt,sE as Tt,t as P,tD as Et,tE as Dt,uD as Ot,uE as kt,vD as At,vE as jt,vN as Mt,wD as Nt,wE as Pt,xD as Ft,xE as It,yB as F,yD as Lt,yE as Rt,z as zt,zE as Bt,zi as Vt}from"./api-NzmVMBHn.js";import{a as Ht,c as Ut}from"./FieldLabel-D-1TOAEd.js";import{t as I}from"./button-BHiy_q9F.js";import{$ as L,Bt as Wt,Dt as R,Et as z,Q as B,Rt as Gt,U as Kt,X as V,Z as H,_ as qt,at as U,et as W,jt as G,nt as K,ot as q,rt as Jt,tt as Yt,ut as Xt,zt as Zt}from"./index-DRTZkZgA.js";import{t as Qt}from"./DataTableShell-tMQLeAkL.js";import{InstanceConfigDialog as $t}from"./BridgeTab-fCJQhfcl.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],en=new Set(Y),tn=`conversational`;function nn(e){let t=new Set((e??[]).filter(e=>en.has(e)));return t.size===0?[tn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Ht},rn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function an(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`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function on(){let e=A(P.admin.listInstances,{}),t=A(P.agents.listAllInstanceAgents,{}),n=F(P.admin.upsertInstance),r=F(P.admin.deleteInstance),i=R(),[o,c]=(0,J.useState)(!1),[d,p]=(0,J.useState)(Z),[h,_]=(0,J.useState)(null),[y,b]=(0,J.useState)(null),[S,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null);async function ee(){try{await n({instanceId:T??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,...d.kind===`openclaw`?{authMode:d.authMode,personScopes:d.personScopes,identitySource:d.identitySource,systemIdentity:d.systemIdentity||void 0}:{},streamTransport:d.streamTransport}),p(Z),E(null),c(!1)}catch(e){i.error(ae(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[it(),(0,X.jsx)(`strong`,{children:a()}),ot()]}),(0,X.jsx)(Qt,{title:fe(),rows:e,addLabel:f(),onAdd:()=>{E(null),p(Z),c(!0)},emptyHint:m(),columns:[{header:we(),cell:e=>e.name,sort:e=>e.name},{header:Nt(),cell:e=>(0,X.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:u(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Se(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:he(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?te():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:At(),onSelect:()=>{E(e._id),p(an(e)),c(!0)}},{label:le(),onSelect:()=>_(e.name)},{label:St(),onSelect:()=>w(e)},{label:Ft(),onSelect:()=>b(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,X.jsx)(qt,{open:o,onOpenChange:c,title:T?Re():Lt(),description:$e(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:ee,submitLabel:ut(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:gt(),children:[(0,X.jsx)(G,{value:d.name,disabled:T!==null,onChange:e=>p({...d,name:e.target.value})}),T?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Xe()}):null]}),(0,X.jsx)($,{label:Je(),children:(0,X.jsxs)(V,{value:d.kind,onValueChange:e=>p({...d,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(B,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,X.jsx)($,{label:l(),children:(0,X.jsxs)(V,{value:d.transport,onValueChange:e=>p({...d,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`ws`,children:Vt()}),(0,X.jsx)(B,{value:`rest`,children:xe()})]})]})}):null,(0,X.jsx)($,{label:We(),children:(0,X.jsx)(G,{value:d.gatewayUrl,onChange:e=>p({...d,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:Ot(),children:(0,X.jsx)(G,{value:d.bridgeUrl,placeholder:ct(),onChange:e=>p({...d,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:He(),children:(0,X.jsx)(G,{value:d.displayName,onChange:e=>p({...d,displayName:e.target.value})})}),(0,X.jsxs)($,{label:de(),children:[(0,X.jsxs)(V,{value:d.streamTransport,onValueChange:e=>p({...d,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsx)(H,{children:Ut.map(e=>(0,X.jsx)(B,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:se()})]}),(0,X.jsx)($,{label:wt(),children:(0,X.jsx)(G,{value:d.gatewayVersion,placeholder:mt(),onChange:e=>p({...d,gatewayVersion:e.target.value})})}),d.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:ne(),children:[(0,X.jsxs)(V,{value:d.authMode,onValueChange:e=>p({...d,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`token`,children:C()}),(0,X.jsx)(B,{value:`trusted-proxy`,children:g()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:d.authMode===`trusted-proxy`?ce():me()})]}),d.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:yt(),children:[(0,X.jsxs)(V,{value:d.personScopes,onValueChange:e=>p({...d,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`capped`,children:D()}),(0,X.jsx)(B,{value:`full`,children:v()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:d.personScopes===`full`?Ee():Ae()})]}):null,d.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:x(),children:[(0,X.jsxs)(V,{value:d.identitySource,onValueChange:e=>p({...d,identitySource:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`canonical`,children:Oe()}),(0,X.jsx)(B,{value:`email`,children:s()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:d.identitySource===`email`?ye():zt()})]}):null,d.authMode===`trusted-proxy`?(0,X.jsx)($,{label:ie(),children:(0,X.jsx)(G,{value:d.systemIdentity,placeholder:rt(),onChange:e=>p({...d,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:Be(),children:(0,X.jsx)(G,{value:d.gatewayHttpUrl,placeholder:tt(),onChange:e=>p({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(hn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),y?(0,X.jsx)($t,{instance:y,onClose:()=>b(null)},y._id):null,S?(0,X.jsx)(sn,{instance:S,onClose:()=>w(null)},S._id):null]})}function sn({instance:e,onClose:t}){let n=A(P.instanceSecrets.listInstanceSecretStatus,{}),r=rn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(Yt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(q,{children:ft({instance:e.displayName??e.name})}),(0,X.jsx)(Jt,{children:Et()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(un,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(ln,{instance:e})}),(0,X.jsx)(cn,{instance:e})]})})}function cn({instance:e}){let t=O(P.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,J.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(_());break;case`no_agents`:n.success(ue());break;case`no_bridge_url`:n.error(oe());break;case`deploy_misconfigured`:n.error(at());break;case`unauthorized`:n.error(st());break;case`not_served`:n.error(pe());break;default:n.error(o());break}}catch(e){n.error(ge(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?w():re()})})]})}function ln({instance:e}){let t=A(P.bridgeAuth.listBridgeAuthStatus,{}),n=O(P.bridgeAuth.mintBridgeSecret),r=F(P.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(M(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(It())}catch(e){i.error(M(),e)}finally{o(!1)}}}async function _(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:h(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(z,{variant:p?`outline`:`secondary`,children:p?`${Ie()} · ${f.prefix}…${f.lastFour}`:Me()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(I,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?d():Pt()}),p?(0,X.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:Ce()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Rt()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:l?Mt():k()})]}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:jt()})]}):null]})}function un({instanceId:e,field:t,updatedAt:n}){let i=O(P.instanceSecrets.setInstanceSecret),a=F(P.instanceSecrets.clearInstanceSecret),o=O(P.deviceIdentity.generateDeviceIdentity),s=R(),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(!1),_=n!==null,v=t===`deviceIdentity`,b=t===`token`?Ke():t===`deviceIdentity`?r():_e();async function x(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),g(!1),s.success(y())}catch(e){s.error(je(),e)}finally{f(!1)}}}async function C(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(De())}catch(e){s.error(je(),e)}finally{f(!1)}}}async function w(){if(!d){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(c())}catch(e){s.error(be(),e)}finally{f(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function D(){if(E)try{await navigator.clipboard.writeText(E),g(!0)}catch{}}return(0,X.jsxs)($,{label:b,children:[v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(z,{variant:_?`outline`:`secondary`,children:_?Ie():Me()}),(0,X.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:_?T():Pe(),onChange:e=>u(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(I,{size:`sm`,onClick:()=>void x(),disabled:d||l.trim().length===0,children:bt()}),v?(0,X.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:d,children:S()}):null,_?(0,X.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:d,children:ee()}):null]})]}),p?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:c()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Bt()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,X.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:h?Mt():k()})]}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:jt()})]}):null]})}var dn={conversational:Tt,documentary:Ve,summarizer:Qe,curator:dt},fn={conversational:ht,documentary:nt,summarizer:et,curator:vt},pn=e=>(dn[e]??(()=>e))(),Q=e=>(fn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Ge()}),t.map(e=>(0,X.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:pn(e)},e)),(0,X.jsxs)(Gt,{children:[(0,X.jsx)(Wt,{asChild:!0,children:(0,X.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:kt()})}),(0,X.jsxs)(Zt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ue()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(Xt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:pn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=A(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=F(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=F(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=F(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=nn(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=F(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=F(P.agents.removeInstanceAgent),u=Kt(),d=R();async function f(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(N(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(N(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(N(),e)}}async function h(t,n){if(e&&await u({title:Dt({name:n}),description:qe(),confirmLabel:i(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(ve())}catch(e){d.error(N(),e)}}return(0,X.jsx)(Yt,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(q,{children:ze({name:e??``})}),(0,X.jsx)(Jt,{children:Ze()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Le()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Ne():r.discovery.lastPollOk?Fe():E({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:xt()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(Xt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:b()}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:pt()})]}):i?(0,X.jsx)(z,{variant:`default`,children:te()}):(0,X.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:Ct()})]}),t.enabled?(0,X.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(N(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:_t(),"aria-label":Ye(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{on as InstancesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Ck as i,Fl as a,Il as o,Ll as s,Ml as c,Nl as l,Pl as u,Sk as d,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Ck as i,Fl as a,Il as o,Ll as s,Ml as c,Nl as l,Pl as u,Sk as d,Tk as f,_B as p,_k as m,bB as h,bk as g,fk as _,gk as v,hk as y,jl as b,kl as x,mk as S,pk as C,t as w,vk as T,wk as E,xk as D,yB as O,yk as k}from"./api-NzmVMBHn.js";import{t as A}from"./button-BHiy_q9F.js";import{Et as j,jt as M,ut as N}from"./index-DRTZkZgA.js";var P=t(e(),1),F=n();function I(){let e=h(w.integrations.status.status,{}),t=O(w.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:f()});let c=n,l=(e,t,n)=>r({...c,[e]:{...c[e],[t]:n}}),u=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,d()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:k()}),note:T(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(M,{value:c.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>u(`langfuse`,{host:c.langfuse.host??``})})}),(0,F.jsx)(z,{label:_(),checked:c.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),u(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:k()}),note:m(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(M,{value:c.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>u(`opik`,{baseUrl:c.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(M,{value:c.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||C(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>u(`opik`,{workspace:c.opik.workspace??``})})}),(0,F.jsx)(z,{label:_(),checked:c.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),u(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:o(),children:[(0,F.jsx)(R,{label:a(),children:(0,F.jsx)(M,{value:c.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>u(`otlp`,{endpoint:c.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:_(),checked:c.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),u(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=p(w.integrations.otlpSecret.setOtlpHeaders),n=O(w.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[d,f]=(0,P.useState)(!1),m=async()=>{f(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:u(),children:[(0,F.jsx)(M,{value:i,placeholder:e?l():c(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||i.trim().length===0,onClick:()=>void m(),children:b()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:r()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:x()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{By as r,Gy as i,Hy as a,Iy as o,Jy as s,Ky as c,Ly as l,NA as u,Qk as d,Ry as f,Uy as ee,Vy as p,Wy as m,Xy as h,Yy as g,Zk as _,aA as te,bB as v,cA as y,oA as b,qy as ne,sA as x,t as S,zy as C}from"./api-NzmVMBHn.js";import{Gn as w,Kn as T,i as E,o as D,q as re,r as ie}from"./index-DRTZkZgA.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-Dgi0cIBy.js";import{n as N,t as P}from"./TimeRangePicker-BNzXp6XH.js";var F=t(e(),1),I={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`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=v(S.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=v(S.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:u()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:y()}),(0,R.jsx)(j,{children:b()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[_(),` p50 `,B(s.cP50),` `,x()]}),(0,R.jsxs)(`span`,{children:[d(),` p50 `,B(s.aP50),` `,x()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":y(),children:[(0,R.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:h(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:g(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:s(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:ne(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:c(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:i(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:m(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=E(e.from,e.to,ie,`now`),i=e=>void t({search:t=>({...t,...D(e)})}),{from:o,to:s}=N(n),{rowLimit:c,buckets:l}=J(o,s),u=v(S.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),d=(0,F.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,R.jsx)(oe,{value:n,onChange:i})]});return u===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):u.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:r()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(Y,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function oe({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:C({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:f()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:l({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.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,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":o({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,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.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{ae as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$z as i,AP as a,BP as o,Bn as s,Bz as c,FP as l,Fz as u,GP as d,Gz as f,HP as p,Hn as m,Hz as ee,IP as te,Iz as h,JP as ne,Jz as re,KP as ie,Kz as ae,LP as g,Ln as oe,Lz as se,MP as ce,NP as le,PP as ue,Pz as de,QP as fe,Qn as pe,Qz as me,RP as he,Rn as ge,Rz as _e,UP as _,Un as v,Uz as y,VP as b,Vn as x,Vz as S,WP as C,Wn as w,Wz as T,XP as E,Xz as D,YP as O,Yz as k,ZP as A,Zz as j,aF as M,bB as N,cF as P,dB as F,dF as I,eB as ve,eF as ye,fF as be,hF as xe,iF as Se,ir as Ce,jP as we,lF as Te,mD as Ee,mF as De,nB as Oe,nF as ke,oB as Ae,oF as je,pF as Me,qP as Ne,qz as Pe,r as L,rB as Fe,rF as Ie,rr as Le,sF as Re,t as R,tB as ze,tF as Be,uF as Ve,yB as z,zP as B,zn as He,zz as Ue}from"./api-NzmVMBHn.js";import{t as V}from"./button-BHiy_q9F.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-DRTZkZgA.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-I1Uc-Ubw.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:L(`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:L(`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:()=>xe()},{id:`composer`,label:()=>De()},{id:`sidebar`,label:()=>Me()},{id:`notifications`,label:()=>E()},{id:`other`,label:()=>be()}],X={showSource:{category:`messages`,label:()=>I(),help:()=>Ve()},showReport:{category:`messages`,label:()=>Te(),help:()=>P()},copyAssistant:{category:`messages`,label:()=>Re()},copyUser:{category:`messages`,label:()=>je()},showDelete:{category:`messages`,label:()=>M()},showTools:{category:`messages`,label:()=>Se(),help:()=>Ie()},voiceInput:{category:`composer`,label:()=>ke(),help:()=>Be()},showUsage:{category:`composer`,label:()=>ye(),help:()=>r()},autoReadAloud:{category:`composer`,label:()=>Ce(),help:()=>Le()},showChatAge:{category:`sidebar`,label:()=>fe(),help:()=>A()},notifSound:{category:`notifications`,label:()=>O(),help:()=>ne()},notifSystem:{category:`notifications`,label:()=>Ne(),help:()=>ie()},replySound:{category:`notifications`,label:()=>d(),help:()=>C()}};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:()=>ue()};function ut({prefKey:e,ui:t}){let n=z(R.admin.setUiPrefDefault),r=z(R.admin.setFeatureEnabled),i=ct(e),o=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:he()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:ce()}),(0,J.jsx)(U,{value:`off`,children:we()}),(0,J.jsx)(U,{value:`inherit`,children:a()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":g()}),g()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function dt({current:e,enabled:t}){let n=z(R.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[w(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?x():r?m():v()})]}),(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:oe()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?ge():e?He():s()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=N(R.me.getMe,{host:G}),a=i?.ui,s=$(i?.role)&&n,c=z(R.me.setUiPref).withOptimisticUpdate(Je),u=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":B()}),B()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:te()}),(0,J.jsx)(`p`,{children:l()}),(0,J.jsx)(`p`,{children:le()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),u.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:p()}):(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=a.locked[e],l=a.effective[e],u=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:b()}):u?(0,J.jsx)(H,{variant:`secondary`,children:pe()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:o()}):null,(0,J.jsx)(nt,{checked:l,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:F()})}var pt={sm:()=>f(),md:()=>T(),lg:()=>y(),xl:()=>ee(),"2xl":()=>S(),"3xl":()=>c()};function mt(){let e=N(R.me.getMe,{host:G}),t=z(R.me.setLocale),n=z(R.me.setTimezone),r=z(R.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(R.me.getMe,{host:G});n&&e.setQuery(R.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=z(R.me.setMyName),o=Ke(),s=e?.locale??`default`,c=e?.name??``,[l,d]=(0,q.useState)(null),f=l??c,p=f.trim()!==c.trim();async function m(){try{await a({name:f}),d(null),o.success(i())}catch(e){o.error(me(),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:Fe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:ze(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:Ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(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:j()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Ae()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(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:se()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(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:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:u()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Av as r,Bv as i,Cg as a,D as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as p,Kv as m,Lv as h,Mv as g,Nv as _,Ov as v,Pv as y,Qv as b,Rv as x,Tv as ee,Uv as te,Vv as ne,Wv as re,Xv as ie,Yv as ae,Zv as oe,_v as se,_y as ce,bB as S,bv as le,dB as C,dt as ue,dv as w,ey as de,ft as fe,fv as pe,fy as T,gv as E,hv as D,iy as me,jv as O,lv as k,ly as he,mv as A,ny as ge,oy as j,pv as _e,py as ve,ry as ye,t as M,ty as be,uy as xe,vy as Se,xv as Ce,yB as N,yv as P,yy as we,zv as Te}from"./api-NzmVMBHn.js";import{t as Ee}from"./list-Dbcww3Mb.js";import{t as F}from"./button-BHiy_q9F.js";import{A as De,An as Oe,Bn as ke,C as Ae,D as I,Dt as je,E as Me,Ft as Ne,Gn as L,Hn as Pe,It as Fe,J as Ie,Kn as Le,Lt as Re,Mn as ze,Mt as Be,Nn as Ve,Nt as He,O as R,P as Ue,Pn as We,Pt as z,S as Ge,Sn as Ke,T as qe,Tn as Je,U as Ye,W as Xe,Y as Ze,_ as Qe,b as B,bn as $e,d as et,dn as tt,f as nt,g as rt,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-DRTZkZgA.js";var ft=o(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=o(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=o(`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=o(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":se(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(We,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=N(M.projects.renameProject),c=N(M.projects.setProjectColor),l=N(M.projects.moveProject),d=N(M.projects.deleteProject),f=N(M.projects.createProject),p=Ye(),m=Xe(),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(t),[y,b]=(0,X.useState)(!1),[x,te]=(0,X.useState)(!1),ne=S(M.projects.projectTreeCount,x?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{onOpenChange:e=>e&&te(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,de()]}),(0,Z.jsxs)(z,{onSelect:()=>{v(t),g(!0)},children:[(0,Z.jsx)($e,{}),` `,E()]}),(0,Z.jsxs)(z,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:u(),label:we(),placeholder:Se(),confirmLabel:ce()});t&&await f({name:t,parentId:e})})},children:[(0,Z.jsx)(Oe,{}),` `,u()]}),(0,Z.jsxs)(z,{onSelect:()=>b(!0),children:[(0,Z.jsx)(pt,{}),` `,s()]}),(0,Z.jsx)(Ne,{children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":pe(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ne?.folders??0,r=ne?.chats??0;await p({title:ye({name:t}),description:n>0?be({folders:n,chats:r}):r>0?ge({count:r}):le(),confirmWord:P(),confirmLabel:me(),destructive:!0})&&await d({projectId:e})})},children:[(0,Z.jsx)(tt,{}),` `,P()]})]})]}),(0,Z.jsx)(Qe,{open:h,onOpenChange:g,title:he(),canSubmit:_.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:_.trim()}),g(!1)},submitLabel:E(),children:(0,Z.jsx)(W,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),y?(0,Z.jsx)(ot,{open:y,onOpenChange:b,title:ee(),movingFolderId:e,currentId:r,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=N(M.chats.pinChat),i=N(M.chats.deleteChat),a=N(M.chats.renameChat),o=N(M.chats.setChatSidebar),s=N(M.chats.moveChatToProject),l=Ye(),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(e.title??``),[m,h]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(He,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)($e,{}),` `,E()]}),(0,Z.jsxs)(z,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?D():A()]}),(0,Z.jsxs)(z,{onSelect:()=>h(!0),children:[(0,Z.jsx)(pt,{}),` `,v()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(z,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Ke,{}):(0,Z.jsx)(Y,{}),e.inSidebar?oe():b()]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:w(),description:le(),confirmLabel:P(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(tt,{}),` `,P()]})]})]}),(0,Z.jsx)(Qe,{open:u,onOpenChange:d,title:k(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:E(),children:(0,Z.jsx)(W,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,Z.jsx)(ot,{open:m,onOpenChange:h,title:c(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=st({from:`/project/$projectId`}),t=L(),n=S(M.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:C()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:_()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:g()}),(0,Z.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:O()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=L(),n=Ye(),o=Xe(),c=je(),g=N(M.projects.renameProject),_=N(M.projects.setProjectColor),v=N(M.projects.deleteProject),b=N(M.projects.createProject),x=N(M.projects.moveProject),te=N(M.projects.setProjectSidebar),re=N(M.chats.moveChatToProject),oe=N(M.chats.reorderChat),se=N(M.projects.reorderProject),C=S(M.projects.projectTreeCount,{projectId:e.project._id}),[w,de]=(0,X.useState)(xt),T=e=>{localStorage.setItem(bt,e),de(e)},D=S(M.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),O=S(M.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:k}=Le({from:`/project/$projectId`}),A=S(M.projects.listProjects,{}),j=S(M.chatReads.myBusyChats,{}),Te=(0,X.useMemo)(()=>new Set(j??[]),[j]),ke=S(M.chatReads.myChatReads,{}),Pe=(0,X.useMemo)(()=>yt(e.chats,ke??[]),[e.chats,ke]),{startNewChat:R,picker:Ke}=et(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[B,nt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(B.trim()),180);return()=>clearTimeout(e)},[B]);let Q=S(M.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=De(it(lt,{activationConstraint:{distance:4}}),it(qe,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=D?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||ve()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=I(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=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Me(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`columns`){for(let e of D?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=O?.chats.find(e=>e._id===t);return e?{list:O.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(w===`columns`){for(let e of D?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:Ze(O.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(a)await re({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Ie(A??[],t,e)){c.error(m());return}await x({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await re({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await oe({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Ie(A??[],e,n.parentId)){c.error(m());return}await x({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({projectId:e,...a});return}}catch{c.error(m())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=rt(e.project),Bt=_t(e.chats,B),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ge,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":r(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:fe(),onClick:()=>{te({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Ve,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:ue()}),(0,Z.jsx)(ze,{"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":ie(),children:[(0,Z.jsx)(F,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ie(),title:ie(),"aria-pressed":w===`cards`,onClick:()=>T(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(F,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ae(),title:ae(),"aria-pressed":w===`columns`,onClick:()=>T(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(F,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":p(),title:p(),"aria-pressed":w===`list`,onClick:()=>T(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void R({projectId:e.project._id}),children:[(0,Z.jsx)(Je,{}),i()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:u(),label:we(),placeholder:Se(),confirmLabel:ce()});t&&await b({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(Oe,{}),u()]}),(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":xe(),children:(0,Z.jsx)(We,{})})}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(z,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)($e,{}),` `,E()]}),(0,Z.jsxs)(z,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,s()]}),(0,Z.jsx)(Ne,{children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void _({projectId:e.project._id,color:null}),"aria-label":pe(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void _({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=C?.folders??0,a=C?.chats??0;await n({title:ye({name:e.project.name}),description:i>0?be({folders:i,chats:a}):a>0?ge({count:a}):le(),confirmWord:P(),confirmLabel:me(),destructive:!0})&&(await v({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(tt,{}),` `,P()]})]})]})]})]}),w===`columns`?(0,Z.jsx)(Ft,{data:D,currentId:e.project._id,busyIds:Te,suppressClick:$,locateChatId:k??null}):w===`list`?(0,Z.jsx)(Mt,{data:O,busyIds:Te,suppressClick:$,locateChatId:k??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:d()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ne()}),e.chats.length>0?(0,Z.jsx)(W,{value:B,onChange:e=>nt(e.target.value),placeholder:h(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?l():y()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:f({term:B.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:Te.has(t._id),unread:Pe.has(t._id),locate:t._id===k,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:Ce()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:f({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&&Ue(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||a()}),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:V,onOpenChange:H,title:he(),canSubmit:U.trim().length>0,onSubmit:async()=>{await g({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:E(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:ee(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void x({projectId:e.project._id,parentId:t})}):null,Ke]}),(0,Z.jsx)(Ae,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=R({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=L(),a=B({id:`folder:${e._id}`}),o=R({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":rt(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?Te({count:e.folderCount})+` · `:``,x({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:nt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=N(M.chats.setChatSidebar),n=e.inSidebar?oe():b();return(0,Z.jsx)(F,{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)(Ke,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=L(),c=V(e.color),l=B({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ve()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:nt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:T(),"aria-label":T()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:j(),"aria-label":j()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:C()});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=Ze(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Ze(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:l()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=L(),c=B({id:`folder:${e._id}`}),l=R({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":rt(e),transform:H.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?re():te(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(ke,{size:13}):(0,Z.jsx)(Pe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=L(),o=B({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||ve()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:C()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=L(),s=R({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:y()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=B({id:`folder:${e._id}`}),o=R({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":rt(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=B({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||ve()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Cx as i,Dx as a,Ex as o,Hi as s,Ix as c,Lx as l,Oo as u,Ox as d,Sx as f,Tx as p,Ui as m,Vi as h,_c as g,_o as _,_x as v,bB as y,bc as b,bo as x,bx as ee,ct as S,dx as te,fx as C,gx as w,hx as T,jo as E,ko as D,kx as ne,mx as re,px as ie,t as O,ux as ae,vc as oe,vo as se,vx as k,wx as A,xc as j,xo as M,xx as N,yB as P,yc as F,yo as I,yx as L}from"./api-NzmVMBHn.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-D-1TOAEd.js";import{t as H}from"./button-BHiy_q9F.js";import{$ as U,Dt as ce,Q as W,Qt as G,X as K,Xt as le,Yt as q,Z as J,Zt as ue,et as Y,q as de,ut as fe}from"./index-DRTZkZgA.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:A,help:i},documentary_fetch:{label:f,help:N},inbound_files:{label:ee,help:L},history_summary:{label:j,help:b},file_curation:{label:E,help:M},quote_reply:{label:r,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:C,references:te,files:ae,previous_summary:F,new_messages:oe,max_chars:g,file_name:x,budget_chars:I,feedback:se,content:_,excerpt:u};function _e(){let e=y(O.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:v()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(z,{label:ne(),help:d()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:k()}),(0,$.jsxs)(K,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(J,{children:e.map(e=>(0,$.jsx)(W,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=P(O.admin.upsertInstanceConfig),n=ce(),r=y(O.me.getMe,{host:de}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[o,u]=(0,Q.useState)(()=>R(i,a));(0,Q.useEffect)(()=>{u(R(i,a))},[a,e._id]);let[d,f]=(0,Q.useState)(!1),p=o.promptInjections,g=(e,t)=>u({...o,promptInjections:{...p,[e]:{...p[e],...t}}});async function _(){f(!0);try{await t({instanceId:e._id,config:B(o,i,a)})}catch(e){n.error(c(),e)}finally{f(!1)}}async function v(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(c(),e)}}let b=e.config?.contentLocale??`default`,x=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:m()}),(0,$.jsxs)(K,{value:b,onValueChange:e=>void v(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(J,{children:[(0,$.jsx)(W,{value:`default`,children:h({locale:x})}),pe().map(e=>(0,$.jsx)(W,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:p[e]??{enabled:!0,template:q[e].defaultTemplate[a]},contentLocale:a,onChange:t=>g(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void _(),disabled:d,children:l()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:s}){let[c,l]=(0,Q.useState)(!1),u=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),m=ue(e,r,i),h=m?G(m,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(fe,{checked:r.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:o()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>s({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:p()}),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:()=>l(e=>!e),children:c?T():w()}),u&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate[i]}),children:a()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:re()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:S()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ie()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bw as r,CT as i,DT as a,ET as o,Gw as s,Hw as ee,Jw as c,Kw as l,OT as u,ST as d,TT as f,Uw as p,Vw as te,Ww as m,_T as h,aT as g,bB as _,bT as v,cT as ne,dT as y,eT as re,fT as b,gT as x,hT as ie,iT as ae,kT as S,lT as C,mT as w,nT as T,oT as E,pT as D,qw as O,rT as k,sT as A,t as j,tT as M,ts as N,uT as P,vT as F,wT as I,xT as L,yB as R,yT as z}from"./api-NzmVMBHn.js";import{t as B}from"./button-BHiy_q9F.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-DRTZkZgA.js";import{t as J}from"./roleDescriptions-Dj1fvyuY.js";var Y=t(e(),1),X=n(),Z=[{group:()=>S(),keys:[{key:`traces.read`,label:()=>I()},{key:`traces.read.content`,label:()=>i(),phi:!0},{key:`traces.write`,label:()=>d()}]},{group:()=>u(),keys:[{key:`kpi.read`,label:()=>I()},{key:`kpi.write`,label:()=>d()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>L()},{key:`anomalies.read`,label:()=>v()},{key:`anomalies.report`,label:()=>z()}]},{group:()=>o(),keys:[{key:`chats.read`,label:()=>I()},{key:`selfheal`,label:()=>h()},{key:`feedback.respond`,label:()=>N()}]},{group:()=>f(),keys:[{key:`admin.manage`,label:()=>F()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=_(j.apiKeys.listRoles,{}),t=R(j.apiKeys.createRole),n=R(j.apiKeys.ensureRolesSeeded),i=R(j.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(j.apiKeys.listRoles,{});r&&e.setQuery(j.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),o=V(),[u,d]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)($),[v,S]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(ie(),e)})},[n,o]);let N=e??[];async function F(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:w({name:e.name}),description:D(),confirmLabel:b()});return}if(v.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];S(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(y(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function I(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),h($),d(!1)}catch(e){o.error(P(),e)}}let L=e===void 0,z=!L&&N.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,A()]}),(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:E()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{h($),d(!0)},children:g()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(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:T()}),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?x({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:N.map(e=>{let t=Q(e.permissions),n=v.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,M()]}):(0,X.jsx)(U,{variant:`secondary`,children:re()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?c():n?O():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:u,onOpenChange:d,title:l(),description:s(),canSubmit:!!(f.key&&f.name),onSubmit:I,submitLabel:m(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,X.jsx)(K,{value:f.key,placeholder:ee(),onChange:e=>h({...f,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(K,{value:f.name,onChange:e=>h({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,X.jsx)(K,{value:f.description,onChange:e=>h({...f,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|