@lacneu/atrium 0.68.11 → 0.68.12
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-gw37MX4z.js → AccessTab-BSVA9k6K.js} +1 -1
- package/dist/assets/{AdvancedFilter-BDno6bpi.js → AdvancedFilter-CCC-hSAD.js} +1 -1
- package/dist/assets/AgentFilesTab-C3kG8y4n.js +3 -0
- package/dist/assets/AnomaliesTab-Bf2VgLD6.js +1 -0
- package/dist/assets/AuditTab-D--2qtm6.js +1 -0
- package/dist/assets/BridgeTab-C9uI_Jkn.js +1 -0
- package/dist/assets/ChatDefaultsTab-BR4evcvF.js +1 -0
- package/dist/assets/{DataTableShell-BDPxsytR.js → DataTableShell-C4JNv9nB.js} +1 -1
- package/dist/assets/{DetailChips-Dz1CvCUA.js → DetailChips-ZTmtiMGp.js} +1 -1
- package/dist/assets/FeedbacksTab-bn3r3ZkW.js +1 -0
- package/dist/assets/{FieldLabel-TkK78Rxe.js → FieldLabel-CEeFouyE.js} +1 -1
- package/dist/assets/FilesTab-BkcRo9Tb.js +1 -0
- package/dist/assets/{FilterBar-BBUyj-UI.js → FilterBar-DKJ0vcLq.js} +1 -1
- package/dist/assets/GroupsTab-DOZlj0pg.js +1 -0
- package/dist/assets/InstancesTab-M2jqVZka.js +1 -0
- package/dist/assets/IntegrationsTab-BfvVJJEY.js +1 -0
- package/dist/assets/KpiTab-_LHhdq4q.js +1 -0
- package/dist/assets/PreferencesTab-DtFLdomR.js +1 -0
- package/dist/assets/ProjectPage-i387XExs.js +1 -0
- package/dist/assets/PromptInjectionsTab-T3JmPufg.js +4 -0
- package/dist/assets/RolesTab-D67TfduS.js +1 -0
- package/dist/assets/ScheduledTab-23blJw9f.js +1 -0
- package/dist/assets/ServiceAccountsTab-7h2WTk0b.js +1 -0
- package/dist/assets/SubAgentReportsTab-CQiiP_Y0.js +1 -0
- package/dist/assets/ThemeShowroom-CLR_y50D.js +1 -0
- package/dist/assets/{TimeRangePicker-Cgf77qy5.js → TimeRangePicker-Dg2XDCtQ.js} +1 -1
- package/dist/assets/{TimezoneCombobox-B6dL9fFG.js → TimezoneCombobox-EjRXLgwd.js} +1 -1
- package/dist/assets/TracesTab-SJeno4nA.js +1 -0
- package/dist/assets/UsersTab-CfeANHzM.js +1 -0
- package/dist/assets/VoiceTab-bjL-Kaf5.js +1 -0
- package/dist/assets/{api-CZm__5my.js → api-cIxpvlxL.js} +5 -5
- package/dist/assets/{button-DMpgqct_.js → button-B_41ue1q.js} +1 -1
- package/dist/assets/{card-CgG4ub16.js → card-jjobvHi-.js} +1 -1
- package/dist/assets/check-kD0OtbaK.js +1 -0
- package/dist/assets/chevron-up-BITJ61RO.js +1 -0
- package/dist/assets/chevrons-up-down--uZabsui.js +1 -0
- package/dist/assets/{compatView-DP5Md9HZ.js → compatView-D_RQaV5Q.js} +1 -1
- package/dist/assets/dispatchErrorInfo-BQ_k0x02.js +1 -0
- package/dist/assets/{dist-UT_Woyhk.js → dist-CMGgchWl.js} +1 -1
- package/dist/assets/{dist-51K385p9.js → dist-D_PfFX2y.js} +1 -1
- package/dist/assets/{dist-C_TiXuc7.js → dist-DhTrc5f7.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CYygbYpM.js → highlighted-body-OFNGDK62-leoLGCWI.js} +1 -1
- package/dist/assets/{index-7VpXzGMb.css → index-B6dXsL9w.css} +1 -1
- package/dist/assets/index-Bvfgr5EK.js +238 -0
- package/dist/assets/{list-Bb-2S9oG.js → list-CKn6A_6h.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DWYC55v0.js +1 -0
- package/dist/assets/{pdf-DRifwjPA.js → pdf-Cm84j6oW.js} +1 -1
- package/dist/assets/roleDescriptions-B3FKKHwq.js +1 -0
- package/dist/assets/{table-CwZjj3ZU.js → table-CcvWpXCm.js} +1 -1
- package/dist/assets/{tabs-CNjvgr2F.js → tabs-CMi9VYg6.js} +1 -1
- package/dist/assets/x-CoxK7tW1.js +1 -0
- package/dist/index.html +10 -10
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-W9i4xzRo.js +0 -3
- package/dist/assets/AnomaliesTab-Cl6fhnzj.js +0 -1
- package/dist/assets/AuditTab-D97UVjIT.js +0 -1
- package/dist/assets/BridgeTab-BDw6d-rB.js +0 -1
- package/dist/assets/ChatDefaultsTab-DyNXBEEJ.js +0 -1
- package/dist/assets/FeedbacksTab-CDK3yYEV.js +0 -1
- package/dist/assets/FilesTab-DLluQLgq.js +0 -1
- package/dist/assets/GroupsTab-Co_3EhXl.js +0 -1
- package/dist/assets/InstancesTab-CsLF4tq3.js +0 -1
- package/dist/assets/IntegrationsTab-Bjt9q4ZK.js +0 -1
- package/dist/assets/KpiTab-CRc4Euhi.js +0 -1
- package/dist/assets/PreferencesTab-BXkrfdNS.js +0 -1
- package/dist/assets/ProjectPage-u5Zbldt0.js +0 -1
- package/dist/assets/PromptInjectionsTab-BMZROwau.js +0 -4
- package/dist/assets/RolesTab-B_YbBBXC.js +0 -1
- package/dist/assets/ScheduledTab-C-0Lokx_.js +0 -1
- package/dist/assets/ServiceAccountsTab-DOcs-VU3.js +0 -1
- package/dist/assets/SubAgentReportsTab-BCuAGsRD.js +0 -1
- package/dist/assets/ThemeShowroom-BudrZBVa.js +0 -1
- package/dist/assets/TracesTab-DDn4A81J.js +0 -1
- package/dist/assets/UsersTab-uCx1h5JL.js +0 -1
- package/dist/assets/VoiceTab-Dr48C_we.js +0 -1
- package/dist/assets/check-la1GHs3B.js +0 -1
- package/dist/assets/chevron-up-vMJbEVXv.js +0 -1
- package/dist/assets/chevrons-up-down-EIX0ppH0.js +0 -1
- package/dist/assets/dispatchErrorInfo-BXrHatTD.js +0 -1
- package/dist/assets/index-DI3wVm5g.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-Q9KS1K9K.js +0 -1
- package/dist/assets/roleDescriptions-Dn4-uXz-.js +0 -1
- package/dist/assets/x-B8ncs2fH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Ff as i,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Ff as i,GL as a,Gf as o,Hf as s,IL as c,If as l,Jf as u,Kf as d,Lf as f,Rf as p,Uf as m,Vf as h,Wf as g,Yf as _,qf as v,t as y,zf as b}from"./api-cIxpvlxL.js";import{_t as x,bt as S,ut as C,vt as w,xt as T,yt as E}from"./index-Bvfgr5EK.js";var D=t(e(),1);function O(e){return e===`user`?b():e===`all`?p():f({group:e.group})}function k(e){return e===`common`?l():e===`owner`?i():f({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=a(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=a(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,A.jsxs)(x,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":u(),children:(0,A.jsx)(T,{placeholder:u()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(E,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(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:d()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(C,{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:g()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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)(C,{variant:`default`,children:r()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{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:m()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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)(C,{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()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(C,{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{ah as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ah as r,ch as i,ih as a,nh as o,oh as s,rh as c,sh as l}from"./api-cIxpvlxL.js";import{r as u}from"./dist-D_PfFX2y.js";import{t as d}from"./x-CoxK7tW1.js";import{t as f}from"./button-B_41ue1q.js";import{_t as p,bt as m,jt as h,ln as g,vt as _,xt as v,yt as y}from"./index-Bvfgr5EK.js";import{r as b}from"./TimeRangePicker-Dg2XDCtQ.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{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 i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.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)(u,{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:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(p,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:r()})}),(0,S.jsx)(_,{children:e.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(p,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(_,{children:C.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(g,{}),o()]})]}):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{Bi as r,Ca as i,Cu as a,Du as o,Ea as s,Eu as c,GL as l,HL as u,Hi as d,IL as f,Ou as p,RL as ee,Ri as m,Sa as h,Su as g,Ta as _,Tu as v,Ui as y,Vi as b,WL as x,Wi as S,_a as C,_u as w,au as T,ba as E,bu as D,ca as O,cu as k,da as A,dd as te,du as j,eu as M,fa as N,fu as ne,ga as P,gu as F,ha as I,hu as L,iu as re,ku as ie,la as R,lu as ae,ma as z,mu as B,nu as oe,oa as se,ou as V,pa as H,pd as U,pu as ce,ru as le,sa as ue,su as de,t as W,tA as fe,tu as pe,ua as me,uu as he,va as ge,vu as _e,wa as ve,wu as ye,xa as G,xu as be,ya as xe,yu as Se,zi as Ce}from"./api-cIxpvlxL.js";import{t as K}from"./button-B_41ue1q.js";import{$ as we,Dt as q,V as Te,_t as Ee,at as De,bt as Oe,dt as ke,et as Ae,ft as je,gt as Me,ht as Ne,it as Pe,nt as Fe,ot as Ie,pt as Le,rn as J,rt as Re,tt as ze,ut as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-Bvfgr5EK.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-D_RQaV5Q.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*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 Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=l(W.me.getMe,{host:He}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=l(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[s,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!s||!r.some(e=>e.name===s))&&d(r[0].name)},[t,r,s]);let m=l(W.agents.listAgentsForInstance,t&&s?{instanceName:s}:`skip`),_=l(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),y=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return s===null||m===void 0?r!==void 0&&r.length===0?[]:void 0:m.agents.map(e=>({instanceName:s,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(_!==void 0)return _.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,s,m,r,_]),[b,x]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!y||y.length===0||(!b||!y.some(e=>$(e)===b))&&x($(y[0]))},[y,b]);let S=y?.find(e=>$(e)===b)??null,C=u(W.agentFiles.listAgentFiles),[T,E]=(0,Y.useState)({status:`idle`}),O=S?.instanceName??null,k=S?.agentId??null,A=l(W.compat.forInstance,n&&O!==null?{instanceName:O}:`skip`),j=n&&O!==null?Te(A,`agentFiles`):null,M=j===null?!1:j===`loading`?null:j.blocked,N=(0,Y.useCallback)(async()=>{if(!(O===null||k===null)){E({status:`loading`});try{E({status:`done`,files:(await C({instanceName:O,agentId:k})).files})}catch{E({status:`error`})}}},[C,O,k]);(0,Y.useEffect)(()=>{M===!1&&N()},[N,M]);let[ne,P]=(0,Y.useState)(null),F=l(W.agentFileCuration.listCurations,t&&O!==null&&k!==null?{instanceName:O,agentId:k}:`skip`),I=l(W.agentFileCuration.curationSettings,t&&O!==null?{instanceName:O}:`skip`),L=u(W.agentFileCuration.requestCuration),[re,R]=(0,Y.useState)(null),[ae,z]=(0,Y.useState)(null),{toast:B}=q(),oe=(0,Y.useMemo)(()=>{let e=new Map;for(let t of F??[])e.has(t.name)||e.set(t.name,t);return e},[F]),se=(0,Y.useCallback)(async e=>{if(!(O===null||k===null)){R(e);try{let t=await L({instanceName:O,agentId:k,name:e,trigger:`manual`});t.ok?B({title:i(),variant:`success`}):B({title:h({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:G(),variant:`error`})}finally{R(null)}}},[L,O,k,B]),V=ee(),H=(0,Y.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||y===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ee,{value:s??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Oe,{size:`sm`,"aria-label":p(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:(r??[]).map(e=>(0,Q.jsx)(We,{value:e.name,children:e.name},e.name))})]}):null,y.length>0?(0,Q.jsxs)(Ee,{value:b??``,onValueChange:e=>x(e),children:[(0,Q.jsx)(Oe,{size:`sm`,"aria-label":o(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:y.map(e=>(0,Q.jsx)(We,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}),S===null?null:j===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):j!==null&&j.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(j.gatewayVersion,j.provider)]}):T.status===`loading`||T.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):T.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ye(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void N(),children:te()})]}):T.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:T.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Be,{variant:`outline`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:g({size:Z(e.size,V)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:be({pct:H.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":D()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?_e():w()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:I?.budgetChars??null,enabled:I?.enabled??!1,curation:oe.get(e.name)??null,inFlight:re===e.name,onCurate:()=>void se(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:Se({used:Z(Ze(T.files),V),total:Z(Je,V),pct:H.format(Xe(Ze(T.files)))})})]}),ne&&S?(0,Q.jsx)(rt,{instanceName:S.instanceName,agentId:S.agentId,name:ne.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void N()}):null,ae?(0,Q.jsx)(it,{curationId:ae,onClose:()=>z(null),onApplied:()=>{z(null),N()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:_()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Be,{variant:`outline`,className:`oc-afiles__curate-status`,children:ve()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:s()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=u(W.agentFiles.getAgentFile),s=u(W.agentFiles.setAgentFile),c=q(),[l,d]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),E=(0,Y.useCallback)(async r=>{m(!1);try{let i=await o({instanceName:e,agentId:t,name:n});d({content:i.content,updatedAtMs:i.updatedAtMs}),r||g(i.content),S(!1)}catch{m(!0)}},[o,e,t,n]);(0,Y.useEffect)(()=>{E(!1)},[E]);async function D(){if(l!==null){b(!0),w(!1);try{await s({instanceName:e,agentId:t,name:n,content:h,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(he({name:n})),a(),await E(!1)}catch(e){et(e)?S(!0):w(!0)}finally{b(!1)}}}let O=l!==null&&h!==l.content,A=(0,Y.useMemo)(()=>l===null?null:$e(l.content,h),[l,h]),N=h.length>X,P=ee(),I=(0,Y.useMemo)(()=>new Intl.NumberFormat(P),[P]);return(0,Q.jsx)(ke,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(je,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Me,{children:F({name:n})}),(0,Q.jsxs)(Le,{children:[L({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,B()]})]})]}),p?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[k(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void E(!1),children:te()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:h,readOnly:!r,spellCheck:!1,onChange:e=>g(e.target.value),"aria-label":F({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ce()}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[de(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void E(!0),children:V()})]}):null,C?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:ae()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:ne({count:I.format(h.length),max:I.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!O||y||x,onClick:()=>v(!0),children:y?U():j()}):null]})]}),(0,Q.jsx)(we,{open:_,onOpenChange:v,children:(0,Q.jsxs)(Fe,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Ie,{children:T({name:n})}),(0,Q.jsx)(Re,{children:re({agent:t})})]}),A?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:le({added:A.added,removed:A.removed})}),A.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:oe()}),A.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,A.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:pe()}),A.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(ze,{children:fe()}),(0,Q.jsx)(Ae,{onClick:()=>void D(),children:M()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let i=l(W.agentFileCuration.getProposal,{curationId:e}),a=u(W.agentFileCuration.approveCuration),o=x(W.agentFileCuration.rejectCuration),{toast:s}=q(),[c,p]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),w=ee(),T=(0,Y.useMemo)(()=>i?$e(i.beforeContent,i.proposedContent):null,[i]);async function D(){p(`approve`);try{let t=await a({curationId:e});t.ok?(s({title:E(),variant:`success`}),n()):s({title:t.reason===`conflict`?ge():C({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:G(),variant:`error`})}finally{p(null)}}async function k(n){p(`reject`);try{let r=_.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?Ce():xe(),variant:`success`}):s({title:z(),variant:`error`}),t()}catch{s({title:G(),variant:`error`})}finally{p(null)}}return(0,Q.jsx)(ke,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(je,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Me,{children:i?P({name:i.name}):f()}),(0,Q.jsx)(Le,{children:I()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[H({before:Z(i.beforeSize,w),after:Z(i.proposedSize,w)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,N()]}):null]}),T?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:A({added:T.added,removed:T.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:m({feedback:i.feedback})}):null,T&&T.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:se()}),(0,Q.jsx)(`ul`,{children:T.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:ue()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:me()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:S()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:y(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:c!==null,children:d()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void k(!1),disabled:c!==null,children:c===`reject`?U():b()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void k(!0),disabled:c!==null,children:c===`reject`?U():r()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:c!==null||i==null,children:R()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(),disabled:c!==null||i==null,children:c===`approve`?U():O()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AS as i,Bx as a,CS as ee,DS as te,ES as o,GL as s,Gx as c,Hx as l,Jx as u,Kx as ne,OS as d,Qx as re,Rx as f,SS as ie,TS as ae,Ux as p,Vx as m,WL as oe,Wx as h,Xx as se,Yx as ce,Zx as le,_S as ue,aS as g,bS as de,cS as _,dS as v,eS as fe,fS as pe,gS as me,hS as he,iS as ge,kS as y,lS as _e,mS as ve,nS as ye,oS as be,pS as b,qx as x,rS as S,sS as C,t as w,tS as T,uS as E,vS as D,wS as O,xS as k,yS as A,zx as j}from"./api-cIxpvlxL.js";import{Dt as M,Fn as N,Pn as P,Z as xe,_t as F,bt as I,ct as Se,dt as L,ft as R,gt as z,ht as B,i as Ce,o as we,ut as V,vt as H,wt as U,xt as W,yt as G}from"./index-Bvfgr5EK.js";import{n as Te}from"./TimeRangePicker-Dg2XDCtQ.js";import{t as Ee}from"./FilterBar-DKJ0vcLq.js";import{t as De}from"./DataTableShell-C4JNv9nB.js";import{t as K}from"./dispatchErrorInfo-BQ_k0x02.js";var q=t(e(),1),J=n(),Y=`__all__`,Oe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function ke(e){return e===`open`?i():e===`acknowledged`?y():d()}var Ae=[`info`,`warn`,`critical`],je=[`detector`,`agent`,`user`],Me={kind:`relative`,from:`now-30d`,to:`now`},Ne=200,X=`all`;function Z(){let e=N({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,i=e.status===X?Y:e.status,a=e.severity??Y,c=e.kind??Y,[l,d]=(0,q.useState)(Y),f=Ce(e.from,e.to),{from:p,to:m}=Te(f),h=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),y=e=>void t({search:t=>({...t,status:e===Y?X:e})}),j=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),L=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),R=e=>void t({search:t=>({...t,...we(e)})}),z=xe(),B=M(),K=oe(w.anomalies.resolveAnomaly),Z=(s(w.me.getMe,{host:U})?.permissions??[]).includes(`admin.manage`),Q=s(w.anomalies.listAnomalies,{limit:Ne,filter:{q:n||void 0,from:p,to:m,anomalyStatus:i===Y?void 0:i,severity:a===Y?void 0:a,source:l===Y?void 0:l,kind:c===Y?void 0:c}}),$=(0,q.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),ze=n!==``||i!==`open`||a!==Y||l!==Y||c!==Y||f.kind!==`relative`||f.from!==Me.from;function Be(){d(Y),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await z({title:te(),description:(0,J.jsxs)(J.Fragment,{children:[o(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ae(),` `,(0,J.jsx)(`strong`,{children:O()}),`.`,` `,ee()]}),confirmLabel:ie()}))try{await K({anomalyId:e._id,status:`resolved`}),B.success(k(),e.kind)}catch(e){B.error(de(),e)}}async function He(e){try{await K({anomalyId:e._id,status:`acknowledged`}),B.success(A(),e.kind)}catch(e){B.error(D(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ue(),` `,(0,J.jsx)(`strong`,{children:me()}),` `,he(),` `,(0,J.jsx)(`strong`,{children:ve()}),` `,b(),` `,(0,J.jsx)(`strong`,{children:pe()}),` `,v(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:E()})]}),(0,J.jsxs)(Ee,{q:n,onQChange:h,searchPlaceholder:_e(),timeRange:f,onTimeRangeChange:R,onReset:Be,canReset:ze,children:[(0,J.jsxs)(F,{value:i,onValueChange:y,children:[(0,J.jsx)(I,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(G,{value:Y,children:_()}),Oe.map(e=>(0,J.jsx)(G,{value:e.value,children:ke(e.value)},e.value))]})]}),(0,J.jsxs)(F,{value:a,onValueChange:j,children:[(0,J.jsx)(I,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{placeholder:C()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(G,{value:Y,children:be()}),Ae.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(F,{value:l,onValueChange:d,children:[(0,J.jsx)(I,{size:`sm`,className:`w-32`,children:(0,J.jsx)(W,{placeholder:g()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(G,{value:Y,children:ge()}),je.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(F,{value:c,onValueChange:L,children:[(0,J.jsx)(I,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{placeholder:S()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(G,{value:Y,children:ye()}),$.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]})]}),(0,J.jsx)(De,{title:T(),rows:Q,emptyHint:i===`open`?fe():r(),rowActions:e=>Z&&e.status===`open`?[{label:re(),onSelect:()=>void Ve(e)},{label:le(),onSelect:()=>void He(e)}]:[],columns:[{header:se(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:Se(e.at)}),sort:e=>e.at},{header:S(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:C(),cell:e=>(0,J.jsx)(Ie,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ce(),cell:e=>(0,J.jsx)(Le,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,J.jsx)(V,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:u(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Fe,{row:e})]}),sort:e=>e.message},{header:x(),cell:e=>(0,J.jsx)(Pe,{row:e}),sort:e=>e.evidence??null},{header:ne(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Pe({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,c()]}):null]})}let n=Q(e);if(!n.dominantCode)return(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=K(n.dominantCode),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,c()]}):null]})}function Fe({row:e}){let[t,n]=(0,q.useState)(!1),r=s(w.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[h(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(L,{open:t,onOpenChange:n,children:(0,J.jsxs)(R,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(B,{children:(0,J.jsx)(z,{children:p()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:l()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:m()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ie({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Le({status:e}){return e===`open`?(0,J.jsx)(V,{variant:`destructive`,children:a()}):e===`acknowledged`?(0,J.jsx)(V,{variant:`secondary`,children:j()}):(0,J.jsx)(V,{variant:`outline`,children:f()})}function Re(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,Br as i,CC as a,DC as o,EC as s,FC as c,Fr as l,GL as u,Ir as d,Lr as f,MC as p,NC as m,OC as h,PC as g,Rr as _,SC as v,TC as y,jC as b,kC as x,t as S,wC as C,xC as w,zr as T}from"./api-cIxpvlxL.js";import{Fn as E,Pn as D,_t as O,a as k,bt as A,ct as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-Bvfgr5EK.js";import{n as ee}from"./TimeRangePicker-Dg2XDCtQ.js";import{t as z}from"./FilterBar-DKJ0vcLq.js";import{t as B}from"./AdvancedFilter-CCC-hSAD.js";import{t as V}from"./DataTableShell-C4JNv9nB.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:i()},{value:`realLabel`,label:T()},{value:`targetLabel`,label:_()},{value:`impersonated`,label:f()},{value:`resource`,label:d()},{value:`resourceId`,label:l()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,l=e.impersonated??G,d=e.resource??G,f=M(e.from,e.to),_=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:T,to:N}=ee(f),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:k(e)}),replace:!0}),$=u(S.admin.listAudit,{filter:{q:n||void 0,from:T,to:N,action:i===G?void 0:i,resource:d===G?void 0:d,impersonated:l===G?void 0:l===`yes`,advanced:_.length>0?_: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!==``||i!==G||l!==G||d!==G||_.length>0||f.kind!==`relative`||f.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:g()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:m(),timeRange:f,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(O,{value:i,onValueChange:J,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:p()})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:b()}),te.map(e=>(0,U.jsx)(R,{value:e,children:e},e))]})]}),(0,U.jsxs)(O,{value:l,onValueChange:Y,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:r()}),(0,U.jsx)(R,{value:`yes`,children:x()}),(0,U.jsx)(R,{value:`no`,children:h()})]})]}),(0,U.jsxs)(O,{value:d,onValueChange:X,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:o()})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:s()}),ne.map(e=>(0,U.jsx)(R,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:_,onChange:Q}),(0,U.jsx)(V,{title:y(),rows:$,emptyHint:C(),columns:[{header:a(),cell:e=>j(e.at),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:v(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:w(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),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{$v as r,Av as i,Ay as a,Bl as o,Bv as s,Cv as c,D as l,Dl as u,Dv as d,Ev as f,Ey as p,Fl as m,Fv as h,Fy as g,GL as _,Gv as ee,HL as te,Hl as v,Hv as y,Il as b,Iv as ne,Iy as re,Jv as ie,Kv as ae,Ll as oe,Lv as se,Ml as ce,Mv as le,My as ue,Nl as de,Nv as fe,Ny as pe,Ov as me,Pl as he,Pv as ge,Py as _e,Qv as ve,Rl as ye,Rv as be,Ry as xe,Sv as Se,Tv as Ce,Ty as we,Ul as Te,Uv as Ee,Vl as De,Vv as Oe,WL as ke,Wv as Ae,Xv as je,Yv as Me,Zv as Ne,_v as Pe,ar as Fe,bv as x,cv as S,dv as Ie,ey as Le,fv as Re,gv as ze,hv as Be,ir as Ve,jl as He,jv as Ue,jy as We,kv as Ge,ky as Ke,lv as qe,mv as Je,ny as Ye,or as Xe,ov as Ze,pv as Qe,qv as $e,rr as et,ry as tt,sr as nt,sv as rt,t as C,ty as it,ur as at,uv as ot,vv as st,wv as ct,xv as lt,yv as ut,zl as dt,zv as ft,zy as pt}from"./api-cIxpvlxL.js";import{r as w}from"./dist-D_PfFX2y.js";import{t as mt}from"./chevron-up-BITJ61RO.js";import{t as ht}from"./chevrons-up-down--uZabsui.js";import{i as gt,n as T,o as _t,r as vt,s as yt}from"./FieldLabel-CEeFouyE.js";import{i as bt,n as xt,r as St,t as Ct}from"./tabs-CMi9VYg6.js";import{t as wt}from"./button-B_41ue1q.js";import{An as Tt,Bt as Et,Dt,Fn as Ot,I as kt,P as At,Pn as E,Rt as jt,_t as D,bn as Mt,bt as O,ct as Nt,dt as Pt,ft as Ft,gt as It,ht as Lt,jn as Rt,jt as k,lt as A,on as zt,pt as Bt,rn as j,ut as M,vt as N,wt as Vt,xt as P,yt as F,zt as Ht}from"./index-Bvfgr5EK.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as Wt,i as I,n as L,o as R,r as z,t as B}from"./table-CcvWpXCm.js";import{t as Gt}from"./FilterBar-DKJ0vcLq.js";import{a as V,n as Kt,o as H,r as U,s as qt,t as Jt}from"./compatView-D_RQaV5Q.js";import{t as W}from"./dispatchErrorInfo-BQ_k0x02.js";var Yt=l(`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`}]]),Xt=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function Zt(e){return e.filter(e=>e.state===`error`)}function Qt(e){return e.reachable&&Zt(e.targets).length===0}function $t(e){return Qt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function en(e){return e.state===`error`&&e.lastErrorCode!==null}function tn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function nn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function rn(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,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return nn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Y={q:``,state:J,instance:J,version:J},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return H(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function dn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>H(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(Y),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),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,G.useMemo)(()=>un(o),[o]),c=(0,G.useMemo)(()=>dn(o),[o]),l=(0,G.useMemo)(()=>fn(o),[o]),u=(0,G.useMemo)(()=>ln(on(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:lt(),onReset:()=>r(Y),canReset:an(n),children:[(0,Q.jsxs)(D,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:ut()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(F,{value:J,children:x()}),s.map(e=>(0,Q.jsx)(F,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(D,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:st()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(F,{value:J,children:x()}),c.map(e=>(0,Q.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(D,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:Pe()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(F,{value:J,children:x()}),l.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):(0,Q.jsxs)(B,{className:`oc-conn__table`,children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)($,{label:Be(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Je(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Qe(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Re(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ie(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(I,{children:ot()}),(0,Q.jsx)($,{label:qe(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(L,{children:u.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(I,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(mt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=en(e)?W(e.lastErrorCode):null,n=tn(e)?W(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(R,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(z,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(z,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(z,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(z,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(z,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(z,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:c({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(z,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:A(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(R,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(z,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${A(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Se({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${A(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?S():e===`error`?rt():Ze()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(M,{variant:`secondary`,children:S()}):e===`error`?(0,Q.jsx)(M,{variant:`destructive`,children:rt()}):(0,Q.jsx)(M,{variant:`outline`,children:Ze()})}function _n(){return _(C.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=_(C.compat.getBridgeCompat,{}),n=_(C.me.getMe,{host:Vt})?.role===`admin`,r=_(C.admin.listInstances,n?{}:`skip`),i=_(C.agents.usageForInstances,n?{}:`skip`),a=E(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=rn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ot({from:`/settings/bridge`}),l=E({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Kt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ee()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:y()}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)(I,{children:nt()}),(0,Q.jsx)(I,{children:Xe()}),(0,Q.jsx)(I,{children:Fe()}),(0,Q.jsx)(I,{children:Ve()}),(0,Q.jsx)(I,{children:et()})]})}),(0,Q.jsx)(L,{children:i.flatMap(e=>{let t=kt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(R,{children:[(0,Q.jsx)(z,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(z,{children:t.provider}),(0,Q.jsx)(z,{children:t.label}),(0,Q.jsx)(z,{children:(0,Q.jsxs)(M,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(z,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Ct,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(St,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(zt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(xt,{value:e.key,children:(0,Q.jsx)(bn,{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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):null]})}function yn({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,s=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:V(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:De(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,o({build:t.buildVersion??`?`})]}):null,` · `,dt(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?ye():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ge()});let c=Zt(e.targets),l=!e.reachable,u=$t(e),p=e.unreachableInstances??[],m=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,g=Nt(e.checkedAt),_=e.startedAt==null?null:Nt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${m}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Q.jsx)(Tt,{size:22}):l||u===`gateways_unreachable`?(0,Q.jsx)(Xt,{size:22}):(0,Q.jsx)(j,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?fe():u===`gateways_unreachable`?Ge({count:p.length}):l?le():Ue({count:c.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Yt,{size:12,"aria-hidden":!0}),` `,i({time:g})]}),_?(0,Q.jsx)(`span`,{children:d({time:_})}):null,s]}),u===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:me({names:p.join(`, `)})}):null,l?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:f()})]})}function bn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?qt(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=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(zt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),f?(0,Q.jsx)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:U(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Te()}),(0,Q.jsx)(Sn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(xn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Rt,{size:13,"aria-hidden":!0}),Ce({count:t.length})]}),p?(0,Q.jsx)(pn,{connections:t,displayByInstance:c}):null]})}function xn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Oe(),i.length>0?(0,Q.jsx)(M,{variant:`destructive`,children:ft({count:i.length})}):(0,Q.jsx)(M,{variant:`secondary`,children:s()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[be({version:e.vendoredVersion}),r?` · `+se({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Rt,{size:13,"aria-hidden":!0}),ne({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:at({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:m({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:ye()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:V(e.version)}),(0,Q.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:U(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(Pt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ft,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Lt,{children:[(0,Q.jsx)(It,{children:pt({instance:e.displayName??e.name})}),(0,Q.jsx)(Bt,{children:xe()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Tt,{"aria-hidden":!0}):(0,Q.jsx)(j,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?$e():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ae()]}):null}function Tn({instance:e,onClose:t}){let n=ke(C.admin.upsertInstanceConfig),i=te(C.bridge.validateMediaPaths),o=Dt(),s=Ut(e.config?.contentLocale,void 0),[c,l]=(0,G.useState)(()=>gt(e.config??{},s)),[u,d]=(0,G.useState)(!1),[f,m]=(0,G.useState)(!1),[h,_]=(0,G.useState)(null),v=c.inboundMediaMode===`shared-fs`,y=c.mediaMode===`shared-fs`,b=v||y;async function ne(){m(!0),_(null);try{_(await i({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){o.error(Ne(),e)}finally{m(!1)}}async function ae(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(c,r,s)}),t()}catch(e){o.error(We(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:re(),help:a()}),(0,Q.jsxs)(D,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:yt.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:g(),help:Ke()}),(0,Q.jsxs)(D,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:_t.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:_e(),help:p()}),(0,Q.jsx)(k,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:tt(),help:Ye()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:it(),help:Le()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(At,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(T,{label:pe(),help:we()})]}),b&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),Ae({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:Me(),result:h.inbound}),(0,Q.jsx)(wn,{label:ie(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:je()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),ee()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Q.jsxs)(wt,{variant:`outline`,size:`sm`,onClick:()=>void ne(),disabled:f,children:[f?(0,Q.jsx)(Mt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?ve():r()]}),(0,Q.jsx)(wt,{size:`sm`,onClick:()=>void ae(),disabled:u,children:ue()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(jt,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?he():de({count:e.length}),(0,Q.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ht,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GL as r,Gl as i,HL as a,IL as o,Jl as s,Kl as c,Ly as l,Ou as u,Ql as d,So as f,WL as p,Wl as m,Xl as h,Yl as g,Zl as _,_o as v,bo as y,dd as b,go as x,ho as S,lr as C,mo as w,od as T,pd as E,po as D,ql as O,sd as k,t as A,vo as j,xo as M,yo as N}from"./api-cIxpvlxL.js";import{t as P}from"./button-B_41ue1q.js";import{M as F,N as I,P as L,V as R,_t as z,bt as B,jt as V,rn as H,vt as U,xt as W,yt as G}from"./index-Bvfgr5EK.js";import{i as K}from"./compatView-D_RQaV5Q.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=p(A.admin.upsertInstanceConfig),n=r(A.agents.listAgentsForInstance,{instanceName:e.name}),a=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[o,s]=(0,q.useState)(a),[l,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(a),u(`idle`)},[e._id,a]);let d=`__none__`,f=o!==a;async function h(){u(`saving`);try{let n={...e.config??{}};o===``||o===d?delete n.converterAgentId:n.converterAgentId=o,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let g=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(z,{value:o===``?d:o,onValueChange:e=>s(e===d?``:e),children:[(0,X.jsx)(B,{className:`oc-cdefaults__select`,"aria-label":N(),children:(0,X.jsx)(W,{placeholder:v()})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(G,{value:d,children:v()}),g.map(e=>(0,X.jsx)(G,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!f||l===`saving`,onClick:()=>void h(),children:l===`saving`?E():c()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:i()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}):null]})}function Q({instance:e}){let t=p(A.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[s,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=s.trim(),h=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,g=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=a!==n||(h??null)!==r;async function v(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),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)(L,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":y()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":x(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?E():c()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:i()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]})}function $({instance:e}){let t=p(A.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,h=(u??null)!==n;async function g(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,X.jsx)(P,{size:`sm`,disabled:!h||!d||o===`saving`,onClick:()=>void g(),children:o===`saving`?E():c()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:i()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]})}function ee(){let e=a(A.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),i=r(A.admin.listInstances,{}),[c,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{!i||i.length===0||(!c||!i.some(e=>e.name===c))&&f(i[0].name)},[i,c]);let p=(i?.length??0)>1,m=i!==void 0&&i.length===0,v=r(A.compat.forInstance,c?{instanceName:c}:`skip`),y=c?R(v,`configDefaults`):`loading`,x=y===`loading`?null:y.blocked,S=(0,q.useMemo)(()=>p&&c?{instanceName:c}:{},[p,c]),w=(0,q.useRef)(0),E=(0,q.useCallback)(async()=>{let t=++w.current;n({status:`loading`});try{let r=Y(await e(S));if(w.current!==t)return;n({status:`done`,current:r})}catch{if(w.current!==t)return;n({status:`error`})}},[e,S]);(0,q.useEffect)(()=>{x===!1&&(p&&!c||E())},[E,x,p,c]);let D=t.status===`done`?t.current:null,j=(0,q.useMemo)(()=>J.map(e=>({id:e,label:I(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:k()},{id:`standard`,label:T()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),p&&c?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsxs)(z,{value:c,onValueChange:e=>f(e),children:[(0,X.jsx)(B,{size:`sm`,"aria-label":u(),children:(0,X.jsx)(W,{})}),(0,X.jsx)(U,{children:(i??[]).map(e=>(0,X.jsx)(G,{value:e.name,children:e.name},e.name))})]})]}):null,m?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:l()}):y===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):y.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(H,{size:14,"aria-hidden":!0}),` `,K(y.gatewayVersion,y.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[O(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:b()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(F,{options:j,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:h()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,X.jsx)(F,{options:M,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:C()})]}),(()=>{let e=i?.find(e=>e.name===(c??i[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{_m as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_m as r,bm as i,gm as a,hm as o,mm as s,vm as c,ym as l}from"./api-cIxpvlxL.js";import{r as u}from"./dist-D_PfFX2y.js";import{t as d}from"./chevron-up-BITJ61RO.js";import{t as f}from"./chevrons-up-down--uZabsui.js";import{t as p}from"./button-B_41ue1q.js";import{En as m,It as h,Lt as g,Mt as _,Nt as v,P as y,Pt as b,in as x,ln as S}from"./index-Bvfgr5EK.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CcvWpXCm.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=i(),bulkActions:F,emptyHint:I=l(),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)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(S,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):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)(y,{"aria-label":r(),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":s({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{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)(y,{"aria-label":a(),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)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(b,{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{ut as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ut as t}from"./index-Bvfgr5EK.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{$E as r,$T as i,AE as a,Aa as o,BE as s,CE as c,DE as l,EE as u,FE as d,GE as f,GL as p,HE as ee,IE as m,JE as h,KE as g,LE as _,ME as v,Ma as te,NE as ne,OE as re,PE as ie,QE as y,RE as ae,SE as b,TE as x,UE as S,VE as C,WE as w,WL as T,XE as E,YE as D,ZE as O,_E as k,aE as A,bE as j,cE as M,dE as N,eD as P,eE as F,fE as I,gE as L,hE as R,iE as z,jE as B,kE as V,lE as H,mE as U,nE as oe,oE as W,pE as G,qE as K,rE as q,sE as se,t as J,tD as ce,tE as le,uE as ue,vE as de,wE as fe,xE as pe,yE as me,zE as he}from"./api-cIxpvlxL.js";import{t as ge}from"./button-B_41ue1q.js";import{Z as _e,ct as Y}from"./index-Bvfgr5EK.js";import{t as ve}from"./DataTableShell-C4JNv9nB.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>ce(),incorrect:()=>P(),incoherence:()=>r(),formatting:()=>y(),latency:()=>O(),api_error:()=>E(),other:()=>D()},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:K()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:g()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:h()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=T(J.feedback.respondToFeedback),[o,c]=(0,X.useState)(e.thread),[p,h]=(0,X.useState)(``),[g,y]=(0,X.useState)(!1);async function b(){let t=p.trim();if(!(!t||g)){y(!0);try{await i({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{y(!1)}}}let E=[];try{E=r.contextJson?JSON.parse(r.contextJson):[]}catch{E=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${f()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:me(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(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:A()}),(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()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ee():e.authorRole===`agent`?e.authorLabel??te():C()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:s()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:he(),value:p,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 b(),disabled:!p.trim()||g,children:g?ae():_()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||d()})]}),r.clientInfo?.sourceWasOpen&&r.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:r.displayedText||d()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,E.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v({count:r.contextCount??E.length,truncated:r.contextTruncated?B():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:E.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,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.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:re()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?l({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[u(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,x()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=p(J.feedback.listForAdmin,{}),t=T(J.feedback.readSnapshot),n=T(J.feedback.deleteFeedback),r=_e(),[a,s]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function d(e){if(a===e._id){s(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function f(e){await r({title:le(),description:F(),confirmLabel:i(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[fe(),` `,(0,Z.jsx)(`strong`,{children:c()}),` `,b()]}),(0,Z.jsx)(ve,{title:pe(),rows:e,emptyHint:j(),isExpanded:e=>a===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:de(),cell:e=>Y(e.at),sort:e=>e.at},{header:k(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:L(),cell:e=>e.messageRole===`user`?R():U(),sort:e=>e.messageRole},{header:G(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${I({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:N(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ue(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:M()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:se()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:o()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:W()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?z():q(),onSelect:()=>void d(e)},{label:oe(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
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,QL as n}from"./api-cIxpvlxL.js";import{B as r,L as i,R as a,z as o}from"./index-Bvfgr5EK.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=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`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,CI as ee,DI as te,EI as o,FI as ne,Fa as re,GI as s,GL as ie,HI as c,II as l,IL as u,Ia as d,JI as ae,KI as f,LI as oe,MI as se,NI as ce,OI as le,PI as ue,QI as de,RI as fe,RL as pe,SI as me,TI as he,UI as p,VI as m,WI as h,WL as ge,XI as _e,YI as ve,ZI as ye,eL as g,jI as be,kI as xe,nL as Se,qI as _,rL as v,t as y,tA as b,tL as x,wI as S,zI as C}from"./api-cIxpvlxL.js";import{t as w}from"./button-B_41ue1q.js";import{$ as T,Dn as E,Dt as D,En as O,Lt as k,Mt as A,Nt as j,P as Ce,Pt as M,_t as N,at as we,bt as P,cn as Te,et as Ee,in as De,it as Oe,nt as ke,ot as Ae,rt as je,tt as Me,ut as F,vt as I,xt as L,yt as R}from"./index-Bvfgr5EK.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CcvWpXCm.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return f();case`audio`:return s();case`video`:return h();case`pdf`:return p();case`document`:return c();case`archive`:return m();default:return a()}}function K(){let[e,t]=(0,H.useState)(W),[n,a]=(0,H.useState)(W),[s,c]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[m,h]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=ge(y.files.softDelete),Y=D();function Ie(){t(W),a(W),c(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(xe())}catch(e){Y.error(le(),e)}}let X=ie(y.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:s===W?void 0:s,category:f===W?void 0:f,includeAutoGenerated:m||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(pe(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:u()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||s!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(N,{value:e,onValueChange:t,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":Se(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:W,children:x()}),(0,U.jsx)(R,{value:`inbound`,children:g()}),(0,U.jsx)(R,{value:`outbound`,children:r()})]})]}),(0,U.jsxs)(N,{value:n,onValueChange:a,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":de(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:W,children:ye()}),Q.chats.map(e=>(0,U.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(N,{value:s,onValueChange:c,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":_e(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:W,children:ve()}),Q.instances.map(e=>(0,U.jsx)(R,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(N,{value:f,onValueChange:p,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":ae(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:W,children:_()}),Q.categories.map(e=>(0,U.jsx)(R,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ce,{checked:m,onCheckedChange:e=>h(e===!0),"aria-label":d()}),(0,U.jsx)(`span`,{children:d()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Te,{size:14,"aria-hidden":!0}),se()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ee():S()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:C()}),(0,U.jsx)(z,{children:fe()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:l()}),(0,U.jsx)(z,{children:ne()}),(0,U.jsx)(z,{className:`text-right`,children:ue()})]})}),(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)(F,{variant:`outline`,style:{marginLeft:6},children:re()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(F,{variant:`secondary`,children:e.direction===`inbound`?g():r()})}),(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)(A,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":be(),children:(0,U.jsx)(O,{size:16})})}),(0,U.jsxs)(j,{align:`end`,children:[e.url?(0,U.jsx)(M,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(E,{size:14}),ce()]})}):(0,U.jsxs)(M,{disabled:!0,children:[(0,U.jsx)(E,{size:14}),he()]}),(0,U.jsxs)(M,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(De,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:me({cap:Be})}):null]}),(0,U.jsx)(T,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(ke,{children:[(0,U.jsxs)(we,{children:[(0,U.jsx)(Ae,{children:te()}),(0,U.jsx)(je,{children:o()})]}),(0,U.jsxs)(Oe,{children:[(0,U.jsx)(Me,{children:b()}),(0,U.jsx)(Ee,{onClick:()=>void Le(),children:i()})]})]})})]})}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{Sm as r,xm as i}from"./api-cIxpvlxL.js";import{t as a}from"./button-B_41ue1q.js";import{cn as o,jt as s,sn as c}from"./index-Bvfgr5EK.js";import{t as l}from"./TimeRangePicker-Dg2XDCtQ.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{$d as r,Ad as i,Af as a,Bd as o,Cf as s,D as c,Dd as l,Df as u,Ed as d,Ef as f,Fd as p,GL as m,Gd as h,Hd as g,Id as _,Jd as v,Kd as y,Ld as b,Md as x,Mf as S,Nd as C,Nf as w,Od as T,Of as E,Pd as D,Pf as O,Qd as ee,Rd as k,Sf as te,Td as A,Tf as j,Ud as M,Vd as ne,WL as N,Wd as re,Xd as P,Yd as ie,Zd as F,_f as ae,af as I,bf as L,cf as oe,df as se,ef as ce,ff as le,gf as ue,hf as de,if as fe,jd as pe,jf as me,kd as R,kf as he,lf as ge,mf as _e,nf as ve,of as ye,pf as be,qd as xe,rf as Se,sf as Ce,t as z,tf as we,uf as Te,vf as Ee,wf as De,xf as Oe,yf as ke,zd as Ae}from"./api-cIxpvlxL.js";import{t as je}from"./x-CoxK7tW1.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-CMi9VYg6.js";import{t as H}from"./button-B_41ue1q.js";import{Dt as U,Mn as Pe,P as W,Z as Fe,_ as Ie,_t as Le,an as G,bt as Re,dt as ze,ft as Be,gt as Ve,ht as He,jn as Ue,jt as K,on as q,pt as We,ut as J,vt as Ge,wt as Ke,xt as qe,yt as Je}from"./index-Bvfgr5EK.js";import{t as Ye}from"./FilterBar-DKJ0vcLq.js";import{t as Xe}from"./DataTableShell-C4JNv9nB.js";import{t as Y}from"./DetailChips-ZTmtiMGp.js";var Ze=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),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 we();case`user`:return ce();case`pending`:return r();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=m(z.groups.listGroups,{}),t=m(z.me.getMe,{host:Ke})?.role===`admin`,n=N(z.groups.createGroup),r=N(z.groups.updateGroup),i=N(z.groups.deleteGroup),o=Fe(),c=U(),[d,p]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[y,b]=(0,Z.useState)(null),[x,C]=(0,Z.useState)(``),D=(0,Z.useMemo)(()=>{if(!e)return e;let t=x.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,x]);function ee(){g(null),v($),p(!0)}function k(e){g(e),v({name:e.name,description:e.description??``}),p(!0)}async function A(){try{h?await r({groupId:h._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),p(!1)}catch(e){c.error(T(),e)}}async function M(e){if(await o({title:de({name:e.name}),description:_e(),confirmWord:e.name,confirmLabel:be(),cancelLabel:Oe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(l(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Q.jsx)(Ye,{q:x,onQChange:C,onReset:()=>C(``),canReset:x!==``,searchPlaceholder:f()}),(0,Q.jsx)(Xe,{title:O(),rows:D,addLabel:S(),onAdd:t?ee:void 0,emptyHint:me(),columns:[{header:a(),cell:e=>e.name,sort:e=>e.name},{header:he(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{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:E(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:u(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:j(),onSelect:()=>b({groupId:e._id,name:e.name})},...t?[{label:De(),onSelect:()=>k(e)},{label:s(),variant:`destructive`,onSelect:()=>void M(e)}]:[]]}),(0,Q.jsx)(Ie,{open:d,onOpenChange:p,title:h?ke():L(),description:Ee(),canSubmit:!!_.name.trim(),onSubmit:A,submitLabel:te(),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:ae()}),(0,Q.jsx)(K,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(K,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||b(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)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Pe,{size:14,"aria-hidden":!0}),fe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ve({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Se(),(0,Q.jsx)(Ue,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=m(z.groups.getGroup,n&&e?{groupId:e}:`skip`),o=m(z.groups.listAssignableInstances,n?{}:`skip`),s=m(z.groups.listAssignableUsers,n?{}:`skip`),c=N(z.groups.addMember),l=N(z.groups.removeMember),u=N(z.groups.bulkSetMembers),f=N(z.groups.setGroupManager),p=U(),[h,g]=(0,Z.useState)(``),[_,y]=(0,Z.useState)(``),[b,S]=(0,Z.useState)(`members`),[w,T]=(0,Z.useState)(1),[E,D]=(0,Z.useState)(new Set),O=(0,Z.useRef)(null),k=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),A=a?.viewerIsAdmin===!0,j=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{g(``),y(``),S(`members`),T(1),O.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[h]),(0,Z.useEffect)(()=>{n&&a&&e&&O.current!==e&&(O.current=e,D(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let M=(0,Z.useMemo)(()=>s?$e(s,h,E):[],[s,h,E]);async function re(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(d(),e)}}async function ie(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(i(),e)}}let F=rt(M,e=>k.has(e.userId)),ae=M.filter(e=>k.has(e.userId)).length,L=it(M,w,ot);async function ce(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:F!==`all`})}catch(e){p.error(d(),e)}}return(0,Q.jsx)(ze,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Be,{className:`oc-access`,children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ve,{children:le({name:t})}),(0,Q.jsx)(We,{children:se()})]}),(0,Q.jsxs)(Ne,{value:b,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),Te(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),oe(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),ne(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:h,onChange:e=>g(e.target.value),placeholder:ge(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ye()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Q.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=k.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(W,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":ee({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)(J,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&A?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?pe():x(),title:r?pe():x(),onClick:()=>void ie(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":C(),title:C(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:T})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:_,onChange:e=>y(e.target.value),placeholder:Ce(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:_},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=m(z.groups.listAssignableAgents,{instanceName:t}),o=N(z.groups.assignAgentToGroup),s=N(z.groups.removeAgentFromGroup),c=N(z.groups.bulkSetGroupAgents),l=U(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),p=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let _=f.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),b=it(f,u,ot);async function x(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(A(),e)}}async function S(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(A(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),p?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:re()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p?h():y()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,b.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(W,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void x(e.agentId,i),"aria-label":F({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":g(),title:g(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:M()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=m(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=N(z.charts.assignChartToGroup),r=N(z.charts.removeChartFromGroup),i=N(z.charts.setGroupDefaultChart),a=N(z.charts.addChartToGroupPool),s=N(z.charts.removeChartFromGroupPool),c=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:o()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),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)(W,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":_({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":p(),title:p(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:D()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":b({name:e.name}),title:b({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Le,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(qe,{placeholder:k()})}),(0,Q.jsx)(Ge,{children:u.map(e=>(0,Q.jsx)(Je,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):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{$C as r,$w as i,Aw as a,BC as o,Bo as s,Bw as c,CT as l,Cw as u,Dw as d,Dy as f,Ew as p,Fw as m,GC as h,GL as g,Gw as _,HC as v,HL as y,Hw as b,IC as x,Iw as ee,JA as te,JC as S,Jw as ne,KC as C,Kw as w,LC as T,Lo as E,Lw as re,Mw as ie,Nw as ae,Ow as D,Oy as oe,Pw as se,QC as ce,Qw as le,RC as ue,Ro as de,Rw as fe,ST as pe,Sw as me,TT as he,Tw as ge,UC as _e,Uw as ve,VC as ye,Vw as O,WC as be,WL as k,Ww as xe,XC as Se,Xw as Ce,YC as we,Yw as Te,ZC as Ee,Zw as De,_T as Oe,_w as ke,aT as Ae,bT as je,bw as Me,cT as Ne,cw as Pe,dT as A,dw as j,eT as Fe,ew as Ie,fT as Le,fr as Re,fw as ze,gT as Be,gw as Ve,hT as He,hw as Ue,iT as We,iw as Ge,jw as Ke,kw as qe,lT as Je,lw as Ye,mT as Xe,mr as Ze,mw as Qe,nT as $e,nw as et,oT as tt,ow as M,pT as nt,pr as rt,pw as it,qA as N,qC as at,qw as ot,rT as st,rw as ct,sT as lt,sw as ut,t as P,tT as dt,tw as ft,uT as pt,uw as mt,vT as ht,vw as gt,wT as _t,ww as vt,xT as yt,xw as bt,yT as xt,yw as St,zC as Ct,zo as wt,zw as Tt}from"./api-cIxpvlxL.js";import{a as Et,c as Dt}from"./FieldLabel-CEeFouyE.js";import{t as F}from"./button-B_41ue1q.js";import{Bt as Ot,Dt as I,P as L,Rt as kt,Z as At,_ as jt,_t as R,bt as z,dt as Mt,ft as B,gt as V,ht as H,jt as U,pt as W,ut as G,vt as K,xt as q,yt as J,zt as Nt}from"./index-Bvfgr5EK.js";import{t as Pt}from"./DataTableShell-C4JNv9nB.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-C9uI_Jkn.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Et},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(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??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=g(P.admin.listInstances,{}),t=g(P.agents.listAllInstanceAgents,{}),n=k(P.admin.upsertInstance),r=k(P.admin.deleteInstance),a=I(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(Q),[d,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);async function x(){try{await n({instanceId:y??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),u(Q),b(null),s(!1)}catch(e){a.error(l(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[pe(),(0,Z.jsx)(`strong`,{children:yt()}),je()]}),(0,Z.jsx)(Pt,{title:xt(),rows:e,addLabel:ht(),onAdd:()=>{b(null),u(Q),s(!0)},emptyHint:Oe(),columns:[{header:Be(),cell:e=>e.name,sort:e=>e.name},{header:He(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Xe(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:nt(),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,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?T():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Je(),onSelect:()=>{b(e._id),u(Bt(e)),s(!0)}},{label:_t(),onSelect:()=>p(e.name)},{label:ne(),onSelect:()=>v(e)},{label:Le(),onSelect:()=>h(e)},{label:A(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:A(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:s,title:y?Ne():pt(),description:tt(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:x,submitLabel:Ae(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:We(),children:[(0,Z.jsx)(U,{value:c.name,disabled:y!==null,onChange:e=>u({...c,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:lt()}):null]}),(0,Z.jsx)($,{label:st(),children:(0,Z.jsxs)(R,{value:c.kind,onValueChange:e=>u({...c,kind:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:Ze(),children:(0,Z.jsxs)(R,{value:c.transport,onValueChange:e=>u({...c,transport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`ws`,children:rt()}),(0,Z.jsx)(J,{value:`rest`,children:Re()})]})]})}):null,(0,Z.jsx)($,{label:$e(),children:(0,Z.jsx)(U,{value:c.gatewayUrl,onChange:e=>u({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:dt(),children:(0,Z.jsx)(U,{value:c.bridgeUrl,placeholder:Fe(),onChange:e=>u({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsx)(U,{value:c.displayName,onChange:e=>u({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:oe(),children:[(0,Z.jsxs)(R,{value:c.streamTransport,onValueChange:e=>u({...c,streamTransport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(K,{children:Dt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f()})]}),(0,Z.jsx)($,{label:le(),children:(0,Z.jsx)(U,{value:c.gatewayVersion,placeholder:De(),onChange:e=>u({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ce(),children:(0,Z.jsx)(U,{value:c.gatewayHttpUrl,placeholder:Te(),onChange:e=>u({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Ft,{instance:m,onClose:()=>h(null)},m._id):null,_?(0,Z.jsx)(Ht,{instance:_,onClose:()=>v(null)},_._id):null]})}function Ht({instance:e,onClose:t}){let n=g(P.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(Mt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(B,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:ot({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:w()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=y(P.instanceSync.forceInstanceSync),n=I(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(p());break;case`no_agents`:n.success(vt());break;case`no_bridge_url`:n.error(u());break;case`deploy_misconfigured`:n.error(me());break;case`unauthorized`:n.error(Me());break;case`not_served`:n.error(St());break;default:n.error(bt());break}}catch(e){n.error(ge(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:gt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?d():D()})})]})}function Wt({instance:e}){let t=g(P.bridgeAuth.listBridgeAuthStatus,{}),n=y(P.bridgeAuth.mintBridgeSecret),r=k(P.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(j(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(ze())}catch(e){i.error(j(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:ke(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:f?`outline`:`secondary`,children:f?`${b()} · ${d.prefix}…${d.lastFour}`:O()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Qe():Ue()}),f?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:it()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:mt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?te():N()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:Ye()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=y(P.instanceSecrets.setInstanceSecret),i=k(P.instanceSecrets.clearInstanceSecret),o=y(P.deviceIdentity.generateDeviceIdentity),s=I(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,h]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(!1),x=n!==null,S=t===`deviceIdentity`,ne=t===`token`?_():t===`deviceIdentity`?xe():ve();async function C(){if(!(!l.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),h(null),v(!1),s.success(ee())}catch(e){s.error(m(),e)}finally{f(!1)}}}async function w(){if(!d){f(!0);try{await i({instanceId:e,field:t}),h(null),v(!1),s.success(se())}catch(e){s.error(m(),e)}finally{f(!1)}}}async function T(){if(!d){f(!0);try{h(await o({instanceId:e})),v(!1),s.success(Ke())}catch(e){s.error(qe(),e)}finally{f(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function D(){if(E)try{await navigator.clipboard.writeText(E),v(!0)}catch{}}return(0,Z.jsxs)($,{label:ne,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:x?`outline`:`secondary`,children:x?b():O()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:x?Tt():c(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void C(),disabled:d||l.trim().length===0,children:fe()}),S?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:d,children:ae()}):null,x?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void w(),disabled:d,children:re()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Ke()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:g?te():N()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),v(!1)},children:Ye()})]}):null]})}var Kt={conversational:ce,documentary:Se,summarizer:s,curator:de},qt={conversational:Ee,documentary:we,summarizer:wt,curator:E},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:et()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ft()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ie()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:r()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(L,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=g(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(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)})}),a=k(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=k(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=Rt(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=k(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=k(P.agents.removeInstanceAgent),u=At(),d=I();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(M(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(M(),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(M(),e)}}async function _(t,n){if(e&&await u({title:C({name:n}),description:h(),confirmLabel:be(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(_e())}catch(e){d.error(M(),e)}}return(0,Z.jsx)(Mt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(B,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:Pe({name:e??``})}),(0,Z.jsx)(W,{children:ut()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:v()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ye():r.discovery.lastPollOk?o():Ct({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(L,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:x()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void _(t.agentId,a),children:at()})]}):i?(0,Z.jsx)(G,{variant:`default`,children:T()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:S()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(M(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Ge(),"aria-label":ct(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,GL as i,HL as a,WL as o,aD as s,ac as c,cD as l,dD as u,ec as d,fD as f,gD as p,hD as m,iD as h,ic as g,lD as _,mD as v,nc as y,oD as b,oc as x,pD as S,rD as C,rc as w,sD as T,sc as E,t as D,tc as O,uD as k}from"./api-cIxpvlxL.js";import{t as A}from"./button-B_41ue1q.js";import{P as j,jt as M,ut as N}from"./index-Bvfgr5EK.js";var P=t(e(),1),F=n();function I(){let e=i(D.integrations.status.status,{}),t=o(D.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let a=n,d=(e,t,n)=>r({...a,[e]:{...a[e],[t]:n}}),g=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,F.jsx)(`strong`,{children:v()}),` `,S()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:_(),children:[(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>d(`langfuse`,`host`,e.target.value),onBlur:()=>g(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:C(),checked:a.langfuse.enabled??!0,onChange:e=>{d(`langfuse`,`enabled`,e),g(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:l(),children:[(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>d(`opik`,`baseUrl`,e.target.value),onBlur:()=>g(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:s(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||h(),onChange:e=>d(`opik`,`workspace`,e.target.value),onBlur:()=>g(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:C(),checked:a.opik.enabled??!0,onChange:e=>{d(`opik`,`enabled`,e),g(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:E()}),note:x(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>d(`otlp`,`endpoint`,e.target.value),onBlur:()=>g(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:C(),checked:a.otlp.enabled??!0,onChange:e=>{d(`otlp`,`enabled`,e),g(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(j,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=a(D.integrations.otlpSecret.setOtlpHeaders),n=o(D.integrations.otlpSecret.clearOtlpHeaders),[i,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(null),[u,f]=(0,P.useState)(!1),p=async()=>{f(!0),l(null);try{await t({headersJson:i}),s(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:g(),children:[(0,F.jsx)(M,{value:i,placeholder:e?w():y(),onChange:e=>s(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:u||i.trim().length===0,onClick:()=>void p(),children:O()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:u,onClick:()=>void n({}),children:d()}):null]}),c?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:c}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:r()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,B_ as i,F_ as a,GL as o,G_ as s,HD as c,H_ as l,I_ as u,K_ as d,L_ as f,N_ as p,P_ as m,QD as h,R_ as g,UD as _,U_ as v,V_ as y,W_ as b,XD as x,ZD as S,t as C,wO as w,z_ as T}from"./api-cIxpvlxL.js";import{Fn as E,Pn as ee,i as te,o as ne,r as re,wt as D}from"./index-Bvfgr5EK.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-jjobvHi-.js";import{n as N,t as P}from"./TimeRangePicker-Dg2XDCtQ.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=o(C.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=o(C.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,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:w()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:r()}),(0,I.jsx)(j,{children:S()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),o=e=>74-e*68/i,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[c(),` p50 `,R(l.cP50),` `,h()]}),(0,I.jsxs)(`span`,{children:[_(),` p50 `,R(l.aP50),` `,h()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":r(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:d(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:s(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:b(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:v(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:l(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:y(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=te(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:a,to:s}=N(n),{rowLimit:c,buckets:l}=K(a,s),u=o(C.kpi.listKpis,{limit:c,filter:{from:a,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]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:T()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.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,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:u({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:a()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:m({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.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-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":p({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,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.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{q as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AM as r,BM as i,CL as a,CM as o,DL as s,DM as c,EL as l,EM as u,Et as d,FM as f,GL as p,GM as m,HM as h,IL as g,IM as ee,LM as _,MM as te,Mt as ne,NM as re,OL as ie,OM as ae,PM as oe,RM as se,SL as ce,SM as le,TL as ue,TM as de,UM as fe,VM as pe,WL as v,WM as me,_L as he,_M as ge,_t as _e,aL as y,aT as b,bL as x,bM as S,cL as C,cM as w,dL as T,dM as E,dt as D,fL as O,fM as k,ft as A,gL as j,gM as M,gt as N,hL as P,hM as F,ht as I,jL as ve,jM as ye,jt as be,kM as xe,lL as Se,lM as Ce,mL as we,mM as Te,mt as Ee,oL as De,oM as Oe,pL as ke,pM as L,pt as Ae,r as R,sL as je,sM as Me,t as z,uL as Ne,uM as Pe,vL as Fe,vM as Ie,vt as Le,wL as Re,wM as ze,xL as Be,xM as Ve,yL as He,yM as B,zM as Ue}from"./api-cIxpvlxL.js";import{t as V}from"./button-B_41ue1q.js";import{At as We,Dt as Ge,Ot as Ke,P as H,_t as qe,bt as Je,jt as U,kt as Ye,q as Xe,t as Ze,ut as W,vt as Qe,wt as G,xt as $e,yt as K}from"./index-Bvfgr5EK.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-EjRXLgwd.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>m()},{id:`composer`,label:()=>me()},{id:`sidebar`,label:()=>fe()},{id:`notifications`,label:()=>u()},{id:`other`,label:()=>h()}],X={showSource:{category:`messages`,label:()=>pe(),help:()=>i()},showReport:{category:`messages`,label:()=>Ue(),help:()=>se()},copyAssistant:{category:`messages`,label:()=>_()},copyUser:{category:`messages`,label:()=>ee()},showDelete:{category:`messages`,label:()=>f()},showTools:{category:`messages`,label:()=>oe(),help:()=>re()},voiceInput:{category:`composer`,label:()=>te(),help:()=>ye()},showUsage:{category:`composer`,label:()=>r(),help:()=>xe()},autoReadAloud:{category:`composer`,label:()=>ne(),help:()=>be()},showChatAge:{category:`sidebar`,label:()=>ae(),help:()=>c()},notifSound:{category:`notifications`,label:()=>de(),help:()=>ze()},notifSystem:{category:`notifications`,label:()=>o(),help:()=>le()},replySound:{category:`notifications`,label:()=>Ve(),help:()=>S()}};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:()=>Pe()};function ut({prefKey:e,ui:t}){let n=v(z.admin.setUiPrefDefault),r=v(z.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Te()}),(0,J.jsxs)(qe,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Je,{size:`sm`,className:`w-36`,children:(0,J.jsx)($e,{})}),(0,J.jsxs)(Qe,{children:[(0,J.jsx)(K,{value:`on`,children:w()}),(0,J.jsx)(K,{value:`off`,children:Me()}),(0,J.jsx)(K,{value:`inherit`,children:Oe()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(H,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":L()}),L()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=v(z.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=Ye(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:[Le(),e?(0,J.jsx)(W,{variant:`secondary`,children:We(e,Ke())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?I():r?N():_e()})]}),(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:D()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?A():e?Ae():Ee()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=p(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=v(z.me.setUiPref).withOptimisticUpdate(Xe),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(H,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":F()}),F()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:k()}),(0,J.jsx)(`p`,{children:E()}),(0,J.jsx)(`p`,{children:Ce()})]}):null,(0,J.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Ie()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(W,{variant:`outline`,children:ge()}):l?(0,J.jsx)(W,{variant:`secondary`,children:d()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:M()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:g()})}var pt={sm:()=>j(),md:()=>P(),lg:()=>we(),xl:()=>ke(),"2xl":()=>O(),"3xl":()=>T()};function mt(){let e=p(z.me.getMe,{host:G}),t=v(z.me.setLocale),n=v(z.me.setTimezone),r=v(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=v(z.me.setMyName),o=Ge(),c=e?.locale??`default`,u=e?.name??``,[d,f]=(0,q.useState)(null),m=d??u,h=m.trim()!==u.trim();async function g(){try{await i({name:m}),f(null),o.success(Re())}catch(e){o.error(a(),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:ie()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(U,{className:`max-w-xs`,value:m,maxLength:120,placeholder:l(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),g())}}),(0,J.jsx)(V,{size:`sm`,disabled:!h,onClick:()=>void g(),children:b()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ve()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ne()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(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:C()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(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:He()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Ze.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:he()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:De()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(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{$g as r,Ag as i,Bg as a,Cg as o,D as s,Dg as c,Fg as l,GL as u,Gg as d,Hg as f,IL as p,Ig as m,Jg as h,Kg as g,Lg as ee,Lm as _,Mg as v,Ng as y,Og as b,Pg as te,Qg as ne,Rg as re,Sg as ie,Tg as x,Ug as ae,Vg as oe,WL as S,Yg as C,Zg as se,_g as ce,cg as w,dg as T,e_ as le,fg as E,g_ as ue,gg as D,h_ as de,jg as fe,kg as pe,l_ as O,lg as me,m_ as he,mg as ge,o_ as _e,og as k,pg as A,qg as ve,r_ as j,s_ as ye,t as M,t_ as be,u_ as N,ug as xe,vg as Se,wg as Ce,zg as we}from"./api-cIxpvlxL.js";import{r as Te}from"./dist-D_PfFX2y.js";import{t as Ee}from"./list-CKn6A_6h.js";import{t as P}from"./button-B_41ue1q.js";import{A as De,C as Oe,Cn as ke,D as F,Dt as Ae,E as je,En as Me,Et as Ne,F as Pe,Fn as Fe,Ft as Ie,In as Le,It as Re,Lt as ze,Mt as Be,Nt as Ve,O as I,Pn as L,Pt as R,Q as He,S as Ue,Sn as z,T as We,Tt as Ge,Z as Ke,_ as qe,_n as Je,b as B,d as Ye,dn as Xe,f as Ze,fn as V,g as H,h as U,hn as W,in as Qe,j as G,jn as $e,jt as K,k as et,m as tt,p as nt,pn as rt,v as q,vn as it,w as at,wn as J,x as Y,y as ot}from"./index-Bvfgr5EK.js";var st=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),ct=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),lt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ut=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function Q({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":ge(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Me,{})})})}function dt({folderId:e,name:t,color:n,currentParentId:i,className:a,onOpen:o}){let s=S(M.projects.renameProject),c=S(M.projects.setProjectColor),l=S(M.projects.moveProject),d=S(M.projects.deleteProject),p=S(M.projects.createProject),m=Ke(),h=He(),[g,ee]=(0,X.useState)(!1),[_,v]=(0,X.useState)(t),[y,b]=(0,X.useState)(!1),[te,re]=(0,X.useState)(!1),x=u(M.projects.projectTreeCount,te?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{onOpenChange:e=>e&&re(!0),children:[(0,Z.jsx)(Q,{className:a}),(0,Z.jsxs)(Ve,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>o(),children:[(0,Z.jsx)(J,{}),` `,se()]}),(0,Z.jsxs)(R,{onSelect:()=>{v(t),ee(!0)},children:[(0,Z.jsx)(rt,{}),` `,A()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:f(),label:ue(),placeholder:de(),confirmLabel:he()});t&&await p({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,f()]}),(0,Z.jsxs)(R,{onSelect:()=>b(!0),children:[(0,Z.jsx)(ct,{}),` `,Ce()]}),(0,Z.jsx)(Ie,{children:xe()}),(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":me(),children:`✕`}),tt.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)(Re,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=x?.folders??0,i=x?.chats??0;await m({title:le({name:t}),description:n>0?ne({folders:n,chats:i}):i>0?r({count:i}):ce(),confirmWord:D(),confirmLabel:be(),destructive:!0})&&await d({projectId:e})})},children:[(0,Z.jsx)(Qe,{}),` `,D()]})]})]}),(0,Z.jsx)(qe,{open:g,onOpenChange:ee,title:_e(),canSubmit:_.trim().length>0,onSubmit:async()=>{await s({projectId:e,name:_.trim()}),ee(!1)},submitLabel:A(),children:(0,Z.jsx)(K,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),y?(0,Z.jsx)(nt,{open:y,onOpenChange:b,title:ie(),movingFolderId:e,currentId:i,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function $({chat:e,currentFolderId:t,className:n}){let r=S(M.chats.pinChat),i=S(M.chats.deleteChat),a=S(M.chats.renameChat),s=S(M.chats.setChatSidebar),c=S(M.chats.moveChatToProject),l=Ke(),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(e.title??``),[m,g]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(Q,{className:n}),(0,Z.jsxs)(Ve,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)(rt,{}),` `,A()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(Xe,{}):(0,Z.jsx)(V,{}),e.pinned?E():T()]}),(0,Z.jsxs)(R,{onSelect:()=>g(!0),children:[(0,Z.jsx)(ct,{}),` `,x()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void s({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(W,{}):(0,Z.jsx)(ut,{}),e.inSidebar?h():C()]}),(0,Z.jsx)(Re,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:w(),description:ce(),confirmLabel:D(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(Qe,{}),` `,D()]})]})]}),(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:A(),children:(0,Z.jsx)(K,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,Z.jsx)(nt,{open:m,onOpenChange:g,title:o(),currentId:t,onPick:t=>void c({chatId:e._id,projectId:t})}):null]})}function ft(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function pt(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 mt(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 ht=`oc.projpage.view`;function gt(){let e=localStorage.getItem(ht);return e===`cards`||e===`list`?e:`columns`}var _t=e=>`into:${e}`,vt=e=>`col:${e??`null`}`,yt=e=>`crumb:${e}`;function bt(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 xt(){let{projectId:e}=Le({from:`/project/$projectId`}),t=L(),n=u(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:p()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:i()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:pe()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:b()})]}):(0,Z.jsx)(St,{page:n})})}function St({page:e}){let t=L(),n=Ke(),i=He(),a=Ae(),o=S(M.projects.renameProject),s=S(M.projects.setProjectColor),l=S(M.projects.deleteProject),p=S(M.projects.createProject),m=S(M.projects.moveProject),h=S(M.chats.moveChatToProject),b=S(M.chats.reorderChat),x=S(M.projects.reorderProject),oe=u(M.projects.projectTreeCount,{projectId:e.project._id}),[C,se]=(0,X.useState)(gt),w=e=>{localStorage.setItem(ht,e),se(e)},T=u(M.projects.folderColumns,C===`columns`?{projectId:e.project._id}:`skip`),E=u(M.projects.projectTreeList,C===`list`?{projectId:e.project._id}:`skip`),{c:pe}=Fe({from:`/project/$projectId`}),O=u(M.projects.listProjects,{}),ge=u(M.chatReads.myBusyChats,{}),k=(0,X.useMemo)(()=>new Set(ge??[]),[ge]),j=u(M.chatReads.myChatReads,{}),Te=(0,X.useMemo)(()=>mt(e.chats,j??[]),[e.chats,j]),{startNewChat:Le,picker:I}=Ye(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[B,Xe]=(0,X.useState)(``),[Ze,V]=(0,X.useState)(!1),[U,W]=(0,X.useState)(e.project.name),[G,$e]=(0,X.useState)(!1),[J,ut]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ut(B.trim()),180);return()=>clearTimeout(e)},[B]);let Q=u(M.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),dt=De(et(at,{activationConstraint:{distance:4}}),et(We,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),_t=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[vt,yt]=(0,X.useState)(null),xt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=T?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||N()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(O??[]).find(t=>t._id===e)?.name??``}}return null},St=e=>yt(xt(String(e.active.id))),Tt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:je(n(t?`folder:`:`chat:`))},[]),Dt=t=>{if(C===`columns`){for(let e of T?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(C===`list`){let e=E?.chats.find(e=>e._id===t);return e?{list:E.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},kt=t=>{if(C===`columns`){for(let e of T?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(C===`list`){let e=E?.folders.find(e=>e._id===t);if(!e||!E)return null;let n=e.parentId??E.rootId;return{list:Ne(E.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},At=async e=>{yt(null),_t();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),o=i.startsWith(`chat:`);try{let e=bt(r);if(e!==void 0){if(o)await h({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Ge(O??[],t,e)){a.error(ae());return}await m({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Dt(t);if(!n)return;n.list.some(t=>t._id===e)||await h({chatId:e,projectId:n.folderId});let a=pt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await b({chatId:e,...a});return}if(!o&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=kt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Ge(O??[],e,n.parentId)){a.error(ae());return}await m({projectId:e,parentId:n.parentId})}let o=pt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await x({projectId:e,...o});return}}catch{a.error(ae())}},[,Mt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Mt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Nt=Date.now(),Pt=H(e.project),Ft=ft(e.chats,B),It=e.breadcrumb.slice(0,-1),Lt=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ue,{sensors:dt,collisionDetection:Tt,onDragStart:St,onDragEnd:At,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Pt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":c(),children:[It.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Ct,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Lt(()=>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}),(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":ve(),children:[(0,Z.jsx)(P,{variant:C===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ve(),title:ve(),"aria-pressed":C===`cards`,onClick:()=>w(`cards`),children:(0,Z.jsx)(lt,{})}),(0,Z.jsx)(P,{variant:C===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":g(),title:g(),"aria-pressed":C===`columns`,onClick:()=>w(`columns`),children:(0,Z.jsx)(st,{})}),(0,Z.jsx)(P,{variant:C===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":d(),title:d(),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void Le({projectId:e.project._id}),children:[(0,Z.jsx)(it,{}),ee()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:f(),label:ue(),placeholder:de(),confirmLabel:he()});t&&await p({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),f()]}),(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":ye(),children:(0,Z.jsx)(Me,{})})}),(0,Z.jsxs)(Ve,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{W(e.project.name),V(!0)},children:[(0,Z.jsx)(rt,{}),` `,A()]}),(0,Z.jsxs)(R,{onSelect:()=>$e(!0),children:[(0,Z.jsx)(ct,{}),` `,Ce()]}),(0,Z.jsx)(Ie,{children:xe()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e.project._id,color:null}),"aria-label":me(),children:`✕`}),tt.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 s({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Re,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=oe?.folders??0,o=oe?.chats??0;await n({title:le({name:e.project.name}),description:a>0?ne({folders:a,chats:o}):o>0?r({count:o}):ce(),confirmWord:D(),confirmLabel:be(),destructive:!0})&&(await l({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,Z.jsx)(Qe,{}),` `,D()]})]})]})]})]}),C===`columns`?(0,Z.jsx)(jt,{data:T,currentId:e.project._id,busyIds:k,suppressClick:$,locateChatId:pe??null}):C===`list`?(0,Z.jsx)(Ot,{data:E,busyIds:k,suppressClick:$,locateChatId:pe??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:we()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:ot,children:e.children.map(t=>(0,Z.jsx)(wt,{child:t,parentId:e.project._id,now:Nt,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:re()}),e.chats.length>0?(0,Z.jsx)(K,{value:B,onChange:e=>Xe(e.target.value),placeholder:te(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?v():fe()}):Ft.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:y({term:B.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(q,{items:Ft.map(e=>`chat:${e._id}`),strategy:Y,children:Ft.map(t=>(0,Z.jsx)(Et,{chat:t,currentFolderId:e.project._id,now:Nt,busy:k.has(t._id),unread:Te.has(t._id),locate:t._id===pe,suppressClick:$},t._id))})})]}),J.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:Se()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:y({term:J})}):(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&&J&&Pe(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Je,{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||_()}),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:Ze,onOpenChange:V,title:_e(),canSubmit:U.trim().length>0,onSubmit:async()=>{await o({projectId:e.project._id,name:U.trim()}),V(!1)},submitLabel:A(),children:(0,Z.jsx)(K,{value:U,onChange:e=>W(e.target.value),autoFocus:!0})}),G?(0,Z.jsx)(nt,{open:G,onOpenChange:$e,title:ie(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void m({projectId:e.project._id,parentId:t})}):null,I]}),(0,Z.jsx)(Oe,{children:vt?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[vt.kind===`folder`?(0,Z.jsx)(z,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Je,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:vt.label})]}):null})]})}function Ct({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=I({id:yt(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function wt({child:e,parentId:t,now:n,suppressClick:r}){let i=L(),a=B({id:`folder:${e._id}`}),o=I({id:_t(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":H(e),transform:G.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)(z,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(dt,{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?m({count:e.folderCount})+` · `:``,l({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:Ze(e.lastActivityAt,n)})]})}function Tt({chat:e}){let t=S(M.chats.setChatSidebar),n=e.inSidebar?h():C();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(W,{}):(0,Z.jsx)(ut,{})})}function Et({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=L(),c=U(e.color),l=B({id:`chat:${e._id}`}),u=Dt(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:G.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||N()}),e.pinned?(0,Z.jsx)(V,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:Ze(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:O(),"aria-label":O()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:j(),"aria-label":j()}):null]}),(0,Z.jsx)(Tt,{chat:e}),(0,Z.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Dt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ot({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:p()});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=Ne(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:Y,children:u.map(e=>(0,Z.jsx)(At,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:Y,children:d.map(t=>(0,Z.jsx)(kt,{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&&Ne(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:v()}):c(null,0)})}function kt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:o,children:s}){let c=L(),l=B({id:`folder:${e._id}`}),u=I({id:_t(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{l.setNodeRef(e),u.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(u.isOver?` is-over`:``)+(l.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":H(e),transform:G.Transform.toString(l.transform),transition:l.transition},...l.listeners,...l.attributes,role:`button`,tabIndex:0,onClick:()=>{o.current||c({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&c({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?oe():a(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!o.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)($e,{size:13}):(0,Z.jsx)(Te,{size:13})}),(0,Z.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(dt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void c({to:`/project/$projectId`,params:{projectId:e._id}})})]}),s]})}function At({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=L(),o=B({id:`chat:${e._id}`}),s=Dt(r),c=U(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:G.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||N()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)($,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(Tt,{chat:e})]})}function jt({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:p()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(Mt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function Mt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=L(),s=I({id:vt(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)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:Y,children:e.folders.map(t=>(0,Z.jsx)(Nt,{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)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:Y,children:e.chats.map(t=>(0,Z.jsx)(Pt,{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:fe()}):null]})}function Nt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=B({id:`folder:${e._id}`}),o=I({id:_t(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":H(e),transform:G.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)(z,{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)(dt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Pt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=B({id:`chat:${e._id}`}),s=Dt(r),c=U(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:G.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||N()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(Tt,{chat:e})]})}export{xt as ProjectPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cy as r,GL as i,Gi as a,Go as o,Ho as s,Ji as c,Ki as l,My as u,Sy as d,Uo as f,Vo as p,WL as ee,Wo as m,Yi as h,_r as g,_y as _,aa as v,ay as y,by as b,cy as x,dy as te,fy as ne,gr as re,gy as ie,hr as ae,hy as oe,ia as se,jy as S,ly as ce,my as le,na as C,oy as w,py as T,qi as E,ra as D,sy as O,t as k,uy as A,vy as j,wy as M,xy as N,yy as P}from"./api-cIxpvlxL.js";import{d as F,f as I,i as L,l as R,n as z,r as B,t as V,u as H}from"./FieldLabel-CEeFouyE.js";import{t as U}from"./button-B_41ue1q.js";import{Dt as W,P as ue,_t as G,bt as K,vt as q,wt as de,xt as J,yt as Y}from"./index-Bvfgr5EK.js";import{r as X,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Z=t(e(),1),Q=n(),$={media_delivery:{label:P,help:j},documentary_fetch:{label:_,help:ie},inbound_files:{label:oe,help:le},history_summary:{label:o,help:m},file_curation:{label:v,help:h},quote_reply:{label:se,help:D}},me={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.`},he={outboundDir:O,references:w,files:y,previous_summary:f,new_messages:s,max_chars:p,file_name:c,budget_chars:E,feedback:l,content:a,excerpt:C};function ge(){let e=i(k.admin.listInstances,{}),[t,n]=(0,Z.useState)(null);if(e===void 0)return(0,Q.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Q.jsx)(`div`,{className:`oc-injtab`,children:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})});let a=e.find(e=>e._id===t)??e[0];return(0,Q.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Q.jsx)(z,{label:M(),help:r()}),(0,Q.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Q.jsx)(`span`,{children:T()}),(0,Q.jsxs)(G,{value:a._id,onValueChange:e=>n(e),children:[(0,Q.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(J,{})}),(0,Q.jsx)(q,{children:e.map(e=>(0,Q.jsx)(Y,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Q.jsx)(_e,{instance:a},a._id)]})}function _e({instance:e}){let t=ee(k.admin.upsertInstanceConfig),n=W(),r=i(k.me.getMe,{host:de}),a=e.config??{},o=X(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Z.useState)(()=>L(a,o));(0,Z.useEffect)(()=>{c(L(a,o))},[o,e._id]);let[l,d]=(0,Z.useState)(!1),f=s.promptInjections,p=(e,t)=>c({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){d(!0);try{await t({instanceId:e._id,config:B(s,a,o)})}catch(e){n.error(S(),e)}finally{d(!1)}}async function h(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(S(),e)}}let _=e.config?.contentLocale??`default`,v=fe[X(void 0,r?.defaultLocale??void 0)];return(0,Q.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,Q.jsx)(`span`,{children:g()}),(0,Q.jsxs)(G,{value:_,onValueChange:e=>void h(e),children:[(0,Q.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(J,{})}),(0,Q.jsxs)(q,{children:[(0,Q.jsx)(Y,{value:`default`,children:ae({locale:v})}),pe().map(e=>(0,Q.jsx)(Y,{value:e.value,children:e.label},e.value))]})]}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()})]}),H.map(e=>(0,Q.jsx)(ve,{injKey:e,def:R[e],i18n:$[e],row:f[e]??{enabled:!0,template:R[e].defaultTemplate[o]},contentLocale:o,onChange:t=>p(e,t)},e)),(0,Q.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Q.jsx)(U,{size:`sm`,onClick:()=>void m(),disabled:l,children:u()})})]})}function ve({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Z.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,me[e]??`{${e}}`])),f=F(e,r,i),p=f?I(f,u):``;return(0,Q.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(ue,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,Q.jsx)(z,{label:n.label(),help:n.help()})]}):(0,Q.jsx)(z,{label:n.label(),help:n.help()}),c&&(0,Q.jsx)(`span`,{className:`oc-injection__badge`,children:N()})]}),(0,Q.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,Q.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:b()}),t.placeholders.map(e=>(0,Q.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Q.jsx)(`code`,{children:`{${e}}`}),(0,Q.jsx)(V,{text:(he[e]??(()=>e))()})]},e))]}),(0,Q.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?A():te()}),c&&(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:d()})]})]}),o&&(0,Q.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:ce()})]}):(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:x()})})]})}export{ge as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,FS as ee,GL as te,GS as i,IS as a,JS as o,KS as s,LS as c,MS as l,NS as u,PS as ne,QS as re,RS as d,WL as f,XS as p,YS as m,ZS as h,_C as g,aC as _,bC as v,cC as y,dC as b,eC as x,fC as S,gC as C,hC as w,iC as ie,jS as T,ka as E,lC as D,mC as O,nC as k,oC as A,pC as j,qS as M,rC as N,sC as P,t as F,tC as I,uC as L,vC as R,yC as z,zS as ae}from"./api-cIxpvlxL.js";import{t as B}from"./button-B_41ue1q.js";import{Dt as V,P as H,Z as U,_ as W,jt as G,ut as K,yn as q}from"./index-Bvfgr5EK.js";import{t as J}from"./roleDescriptions-B3FKKHwq.js";var Y=t(e(),1),X=n(),Z=[{group:()=>v(),keys:[{key:`traces.read`,label:()=>w()},{key:`traces.read.content`,label:()=>O(),phi:!0},{key:`traces.write`,label:()=>j()}]},{group:()=>z(),keys:[{key:`kpi.read`,label:()=>w()},{key:`kpi.write`,label:()=>j()}]},{group:()=>R(),keys:[{key:`openclaw.query`,label:()=>S()},{key:`anomalies.read`,label:()=>b()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>g(),keys:[{key:`chats.read`,label:()=>w()},{key:`selfheal`,label:()=>y()},{key:`feedback.respond`,label:()=>E()}]},{group:()=>C(),keys:[{key:`admin.manage`,label:()=>D()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=te(F.apiKeys.listRoles,{}),t=f(F.apiKeys.createRole),n=f(F.apiKeys.ensureRolesSeeded),g=f(F.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(F.apiKeys.listRoles,{});r&&e.setQuery(F.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),v=U(),y=V(),[b,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)($),[E,D]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{y.error(A(),e)})},[n,y]);let O=e??[];async function j(e,t){if(Q(e.permissions))return;if(e.builtin){await v({title:_({name:e.name}),description:ie(),confirmLabel:N()});return}if(E.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];D(t=>new Set(t).add(e._id));try{await g({roleId:e._id,permissions:n})}catch(e){y.error(k(),e)}finally{D(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function L(){try{await t({key:C.key,name:C.name,description:C.description||void 0,permissions:[]}),w($),S(!1)}catch(e){y.error(I(),e)}}let R=e===void 0,z=!R&&O.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,re()]}),(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:h()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{w($),S(!0)},children:p()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:M()}),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?P({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:O.map(e=>{let t=Q(e.permissions),n=E.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)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,s()]}):(0,X.jsx)(K,{variant:`secondary`,children:i()})]}),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)(H,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ae():n?d():r,onCheckedChange:()=>void j(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:b,onOpenChange:S,title:c(),description:a(),canSubmit:!!(C.key&&C.name),onSubmit:L,submitLabel:ee(),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:ne()}),(0,X.jsx)(G,{value:C.key,placeholder:u(),onChange:e=>w({...C,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,X.jsx)(G,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:T()}),(0,X.jsx)(G,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|