@lacneu/atrium 0.103.3 → 0.103.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/assets/{AccessTab-DIDDsgPT.js → AccessTab-DmfPezpr.js} +1 -1
  2. package/dist/assets/{AdminSettings-RN5-vhFB.js → AdminSettings-DJrTOlAw.js} +1 -1
  3. package/dist/assets/{AdvancedFilter-D14bDnZM.js → AdvancedFilter-D4ja71eC.js} +1 -1
  4. package/dist/assets/{AgentFilesTab-CzlG0CZI.js → AgentFilesTab-DsXOfdpT.js} +1 -1
  5. package/dist/assets/{AnomaliesTab-DI6_13hV.js → AnomaliesTab-B1KVrvF9.js} +1 -1
  6. package/dist/assets/{AuditTab-CtudlEKL.js → AuditTab-BsxWGDzT.js} +1 -1
  7. package/dist/assets/{BridgeTab-D7vwrcIC.js → BridgeTab-CBhC6xPF.js} +1 -1
  8. package/dist/assets/{ChatDefaultsTab-C29wKwC9.js → ChatDefaultsTab-D84PkwGg.js} +1 -1
  9. package/dist/assets/{ConfirmDialog-DUn2vS3y.js → ConfirmDialog-BTkA9EEC.js} +1 -1
  10. package/dist/assets/{DataTableShell-DlkJe0in.js → DataTableShell-PyJIukLO.js} +1 -1
  11. package/dist/assets/{DeletedChatsTab-fwnKocED.js → DeletedChatsTab-CGzdG-VS.js} +1 -1
  12. package/dist/assets/{DetailChips-CYx7WQ4_.js → DetailChips-DJDPdjC6.js} +1 -1
  13. package/dist/assets/{EntitySheet-BHlTwSgy.js → EntitySheet-DZaO__IZ.js} +1 -1
  14. package/dist/assets/{FeedbacksTab-B6yZLeCu.js → FeedbacksTab-C56lOjnO.js} +1 -1
  15. package/dist/assets/{FieldLabel-rU6Ua6ki.js → FieldLabel-BW2ofPSg.js} +1 -1
  16. package/dist/assets/{FilesTab-CX2DlSAl.js → FilesTab-Bo8GHHoP.js} +1 -1
  17. package/dist/assets/{FilterBar-1CED41DE.js → FilterBar-vkX3BGGz.js} +1 -1
  18. package/dist/assets/{GroupsTab-XqYgSNbn.js → GroupsTab-UPA0jBCI.js} +1 -1
  19. package/dist/assets/{InstancesTab-k_xDuLN5.js → InstancesTab-Cz8ZV2Yl.js} +1 -1
  20. package/dist/assets/{IntegrationsTab-wQIr0NRQ.js → IntegrationsTab-DLf771n0.js} +1 -1
  21. package/dist/assets/{KnobRow-GQ-yjRd-.js → KnobRow-NCREweI3.js} +1 -1
  22. package/dist/assets/{KpiTab-Bqw-Ktyf.js → KpiTab-CKvYVEzA.js} +1 -1
  23. package/dist/assets/{PreferencesTab-B3IgHTIx.js → PreferencesTab-CCwKgY4H.js} +1 -1
  24. package/dist/assets/{ProjectPage-3f1bBxNm.js → ProjectPage-CVFZP9wJ.js} +1 -1
  25. package/dist/assets/{PromptInjectionsTab-C_NJLRVi.js → PromptInjectionsTab-BVyjgCHZ.js} +1 -1
  26. package/dist/assets/{RolesTab-BH7cwUSl.js → RolesTab-D2iPXBrM.js} +1 -1
  27. package/dist/assets/{ScheduledTab-DEPYdnlj.js → ScheduledTab-Cl9WgL-w.js} +1 -1
  28. package/dist/assets/{ServiceAccountsTab-BW_IZtpv.js → ServiceAccountsTab-B0XVQpdC.js} +1 -1
  29. package/dist/assets/{SubAgentReportsTab-tnmtmSGh.js → SubAgentReportsTab-xU0OVWGk.js} +1 -1
  30. package/dist/assets/{ThemeShowroom-CXAiw6jt.js → ThemeShowroom-D_wDwAQt.js} +1 -1
  31. package/dist/assets/{TimeRangePicker-DGRmfXqe.js → TimeRangePicker-B3Jl2mvx.js} +1 -1
  32. package/dist/assets/{TimezoneCombobox-DAhFeIgd.js → TimezoneCombobox-CWbHKOiS.js} +1 -1
  33. package/dist/assets/{TracesTab-peFnZ-Tw.js → TracesTab-DOy5oUHa.js} +1 -1
  34. package/dist/assets/{TrashTab-Hd_LRcrR.js → TrashTab-DFi1o7_K.js} +1 -1
  35. package/dist/assets/{UsersTab-CYiw3R0P.js → UsersTab-CIC9NMtm.js} +1 -1
  36. package/dist/assets/{VoiceTab-BIJNy57E.js → VoiceTab-DD0Y1Cqz.js} +1 -1
  37. package/dist/assets/{alert-dialog-BdTFPzVf.js → alert-dialog-D8JROLng.js} +1 -1
  38. package/dist/assets/{api-DNOgniXv.js → api-C9TZ4xjz.js} +1 -1
  39. package/dist/assets/{badge-D7TV9F5d.js → badge-UrSDbO1c.js} +1 -1
  40. package/dist/assets/{button-2XjWVeWK.js → button-DEKA-XdT.js} +1 -1
  41. package/dist/assets/{card-CB4fBpkx.js → card-CoPKGkaG.js} +1 -1
  42. package/dist/assets/check-DLsNvgAq.js +1 -0
  43. package/dist/assets/{checkbox-kFoJxcMJ.js → checkbox-Bbl8iiIs.js} +1 -1
  44. package/dist/assets/chevron-left-PEVM2kG9.js +1 -0
  45. package/dist/assets/chevron-right-DrdFABbO.js +1 -0
  46. package/dist/assets/chevron-up-DpsXK7Un.js +1 -0
  47. package/dist/assets/chevrons-up-down-roy0B5KU.js +1 -0
  48. package/dist/assets/{compatView-BsJMEfMH.js → compatView-DCGywg8d.js} +1 -1
  49. package/dist/assets/convexApi-D2VdPGGW.js +1 -0
  50. package/dist/assets/{copy-uA2kyeTq.js → copy-BzGjJBzv.js} +1 -1
  51. package/dist/assets/{cronDescribe-CWrWu4NY.js → cronDescribe-BP6ZrZEc.js} +1 -1
  52. package/dist/assets/{deliveryRecorder-D2L37goZ.js → deliveryRecorder-B3Trh8JA.js} +1 -1
  53. package/dist/assets/{dialog-Cw-buQuR.js → dialog-CHpclz_0.js} +1 -1
  54. package/dist/assets/{dispatchErrorInfo-rA4PAW2w.js → dispatchErrorInfo-B-CAt7GQ.js} +1 -1
  55. package/dist/assets/{dist-s7OhF_Fl.js → dist-B12lxLhp.js} +1 -1
  56. package/dist/assets/{dist-BuPfsZqj.js → dist-BwFz2rDM.js} +1 -1
  57. package/dist/assets/{dist-yuq8NbqZ.js → dist-CMQ8ZmbJ.js} +1 -1
  58. package/dist/assets/{dist-whjwthuB.js → dist-CQTmJUEo.js} +1 -1
  59. package/dist/assets/{dist-CjNu_N10.js → dist-CT8KFZnw.js} +1 -1
  60. package/dist/assets/{dist-vqdeesMI.js → dist-Col6E8px.js} +1 -1
  61. package/dist/assets/{download-7V52FIS0.js → download-C_249zkC.js} +1 -1
  62. package/dist/assets/{dropdown-menu-BaUA_yBi.js → dropdown-menu-DhetHpBb.js} +1 -1
  63. package/dist/assets/{eye-Dj_nvUMH.js → eye-0fRXv2uN.js} +1 -1
  64. package/dist/assets/{format-Dmvblmga.js → format-CE4Tb-R7.js} +1 -1
  65. package/dist/assets/{groupManageView-B0Fd_T1s.js → groupManageView-9KcuSXgR.js} +1 -1
  66. package/dist/assets/{index-C5sCqQtj.js → index-DT3YA902.js} +21 -21
  67. package/dist/assets/{input-BOl1ZpD6.js → input-BW0GOs_g.js} +1 -1
  68. package/dist/assets/{list-CgDCvRps.js → list-DJaWqeCP.js} +1 -1
  69. package/dist/assets/loader-circle-D_v0YERy.js +1 -0
  70. package/dist/assets/{lock-BlAOODxr.js → lock-Cai4iWP-.js} +1 -1
  71. package/dist/assets/{pencil-C9Bd090l.js → pencil-DPtIvpHp.js} +1 -1
  72. package/dist/assets/plus-DYL_4aqG.js +1 -0
  73. package/dist/assets/{popover-BHbAt2S-.js → popover-rh1_TqjX.js} +1 -1
  74. package/dist/assets/roleDescriptions-heGPDkTY.js +1 -0
  75. package/dist/assets/rotate-ccw-Bs40VcST.js +1 -0
  76. package/dist/assets/{search-CU2PGfXc.js → search-B-R9kd8o.js} +1 -1
  77. package/dist/assets/{select-CYo6IZR2.js → select-CeQpPnet.js} +1 -1
  78. package/dist/assets/{server-BJJ3cVit.js → server-D8sEPnaP.js} +1 -1
  79. package/dist/assets/{speech-DCWd2QRW.js → speech-C9rnmV3n.js} +1 -1
  80. package/dist/assets/{star-DBwak3-9.js → star-DgW-1Cj9.js} +1 -1
  81. package/dist/assets/{switch-B0io8PF7.js → switch-BZom6_SV.js} +1 -1
  82. package/dist/assets/{table-C6NnEhxy.js → table-CGUWJWZI.js} +1 -1
  83. package/dist/assets/{tabs-DiirWTCN.js → tabs-xefd1SeB.js} +1 -1
  84. package/dist/assets/{toast-DN6P_at0.js → toast-pKIYRpST.js} +1 -1
  85. package/dist/assets/{tooltip-6h3mm-V5.js → tooltip-B27138uH.js} +1 -1
  86. package/dist/assets/{trash-2-BmifkPwA.js → trash-2-B3-1X1oZ.js} +1 -1
  87. package/dist/assets/{trashPage-DsBekB4q.js → trashPage-BNLG_tTi.js} +1 -1
  88. package/dist/assets/{trashView-Cd0pvgnM.js → trashView-CcPdpr1y.js} +1 -1
  89. package/dist/assets/{triangle-alert-DjNOW8SM.js → triangle-alert-uaH9SXmM.js} +1 -1
  90. package/dist/assets/{usageView-DsAOFF89.js → usageView-DIbIuJOR.js} +1 -1
  91. package/dist/assets/{useChart-CvUnULHg.js → useChart-DLAE1JpY.js} +1 -1
  92. package/dist/assets/{useFontScale-T-slFQPF.js → useFontScale-CWLfjbAm.js} +1 -1
  93. package/dist/assets/{useStartNewChat-Bg4hLp3d.js → useStartNewChat-BxlZDRnF.js} +1 -1
  94. package/dist/assets/{use_paginated_query-CrHKVq5I.js → use_paginated_query-DVbu_Fe7.js} +1 -1
  95. package/dist/assets/{users-4cOOjyOf.js → users-BUeuEf6k.js} +1 -1
  96. package/dist/assets/x-E03nFsG9.js +1 -0
  97. package/dist/index.html +54 -54
  98. package/package.json +1 -1
  99. package/dist/assets/check-ByAmVIRT.js +0 -1
  100. package/dist/assets/chevron-left-SzhbAbEJ.js +0 -1
  101. package/dist/assets/chevron-right-9DjIYDNR.js +0 -1
  102. package/dist/assets/chevron-up-uykFYjFv.js +0 -1
  103. package/dist/assets/chevrons-up-down-C45M3ZYP.js +0 -1
  104. package/dist/assets/convexApi-4XI9Ua6G.js +0 -1
  105. package/dist/assets/loader-circle-D-oC88g9.js +0 -1
  106. package/dist/assets/plus-1T1-a2EN.js +0 -1
  107. package/dist/assets/roleDescriptions-DIDUvLuU.js +0 -1
  108. package/dist/assets/rotate-ccw-WHZ3xMbc.js +0 -1
  109. package/dist/assets/x-xmpoCnTJ.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,CS as i,DS as a,ES as o,EZ as s,IZ as c,MS as l,OS as u,SS as d,TS as f,bS as p,jS as m,kS as h,t as g,vS as _,wS as v,xS as y,yS as b}from"./api-DNOgniXv.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-CYo6IZR2.js";import"./convexApi-4XI9Ua6G.js";import{t as E}from"./badge-D7TV9F5d.js";var D=t(e(),1);function O(e){return e===`user`?d():e===`all`?y():p({group:e.group})}function k(e){return e===`common`?b():e===`owner`?_():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=c(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),d=c(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":m(),children:(0,A.jsx)(x,{placeholder:m()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(w,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):d===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(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:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:d.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:d.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),d.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:d.groups.map(e=>(0,A.jsx)(E,{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:a()}),d.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:d.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)(E,{variant:`default`,children:i()}):null,(0,A.jsx)(E,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(E,{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:o()}),d.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:d.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)(E,{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:f()}),d.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:d.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,CS as i,DS as a,ES as o,EZ as s,IZ as c,MS as l,OS as u,SS as d,TS as f,bS as p,jS as m,kS as h,t as g,vS as _,wS as v,xS as y,yS as b}from"./api-C9TZ4xjz.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-CeQpPnet.js";import"./convexApi-D2VdPGGW.js";import{t as E}from"./badge-UrSDbO1c.js";var D=t(e(),1);function O(e){return e===`user`?d():e===`all`?y():p({group:e.group})}function k(e){return e===`common`?b():e===`owner`?_():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=c(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),d=c(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":m(),children:(0,A.jsx)(x,{placeholder:m()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(w,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):d===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(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:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:d.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:d.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),d.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:d.groups.map(e=>(0,A.jsx)(E,{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:a()}),d.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:d.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)(E,{variant:`default`,children:i()}):null,(0,A.jsx)(E,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(E,{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:o()}),d.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:d.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)(E,{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:f()}),d.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:d.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{$q as e,BS as t,Dv as n,FA as r,FS as i,GS as a,HS as o,IS as s,JX as c,LS as l,NS as u,PS as d,Qu as f,RS as p,US as m,VS as h,WS as g,bD as _,dX as v,iy as y,lg as b,xD as x,yZ as S,zS as C}from"./api-DNOgniXv.js";var w=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`,`deletedChats`],T=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`,`deletedChats`],E={users:()=>a(),groups:()=>d(),instances:()=>g(),bridge:()=>m(),injections:()=>r(),serviceAccounts:()=>o(),roles:()=>h(),access:()=>u(),traces:()=>t(),kpi:()=>C(),anomalies:()=>p(),files:()=>c(),scheduled:()=>v(),agentFiles:()=>y(),preferences:()=>S(),integrations:()=>l(),theme:()=>e(),chatDefaults:()=>n(),audit:()=>s(),feedbacks:()=>i(),subagentReports:()=>b(),voice:()=>f(),trash:()=>x(),deletedChats:()=>_()},D={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`,deletedChats:`chats.read`},O=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k(e){let t=new Set(e);return w.filter(e=>t.has(D[e]))}function A(e){return`/settings/${e}`}function j(e){let t=e.split(`/`)[2];return w.includes(t)?t:void 0}var M={uiprefs:`preferences`};export{E as a,j as c,w as i,k as l,T as n,D as o,M as r,A as s,O as t};
1
+ import{$q as e,BS as t,Dv as n,FA as r,FS as i,GS as a,HS as o,IS as s,JX as c,LS as l,NS as u,PS as d,Qu as f,RS as p,US as m,VS as h,WS as g,bD as _,dX as v,iy as y,lg as b,xD as x,yZ as S,zS as C}from"./api-C9TZ4xjz.js";var w=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`,`deletedChats`],T=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`,`deletedChats`],E={users:()=>a(),groups:()=>d(),instances:()=>g(),bridge:()=>m(),injections:()=>r(),serviceAccounts:()=>o(),roles:()=>h(),access:()=>u(),traces:()=>t(),kpi:()=>C(),anomalies:()=>p(),files:()=>c(),scheduled:()=>v(),agentFiles:()=>y(),preferences:()=>S(),integrations:()=>l(),theme:()=>e(),chatDefaults:()=>n(),audit:()=>s(),feedbacks:()=>i(),subagentReports:()=>b(),voice:()=>f(),trash:()=>x(),deletedChats:()=>_()},D={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`,deletedChats:`chats.read`},O=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k(e){let t=new Set(e);return w.filter(e=>t.has(D[e]))}function A(e){return`/settings/${e}`}function j(e){let t=e.split(`/`)[2];return w.includes(t)?t:void 0}var M={uiprefs:`preferences`};export{E as a,j as c,w as i,k as l,T as n,D as o,M as r,A as s,O as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Qw as i,Zw as a,eT as o,nT as s,rT as c,tT as l}from"./api-DNOgniXv.js";import{r as u}from"./dist-vqdeesMI.js";import{t as d}from"./plus-1T1-a2EN.js";import{t as f}from"./x-xmpoCnTJ.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-CYo6IZR2.js";import{t as v}from"./button-2XjWVeWK.js";import{t as y}from"./input-BOl1ZpD6.js";import{r as b}from"./TimeRangePicker-DGRmfXqe.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:c()},{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 c=(0,x.useRef)(t),w=!!(c.current&&c.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(c.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}),s(),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:l()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{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)(p,{placeholder:o()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(v,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(d,{}),a()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Qw as i,Zw as a,eT as o,nT as s,rT as c,tT as l}from"./api-C9TZ4xjz.js";import{r as u}from"./dist-Col6E8px.js";import{t as d}from"./plus-DYL_4aqG.js";import{t as f}from"./x-E03nFsG9.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-CeQpPnet.js";import{t as v}from"./button-DEKA-XdT.js";import{t as y}from"./input-BW0GOs_g.js";import{r as b}from"./TimeRangePicker-B3Jl2mvx.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:c()},{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 c=(0,x.useRef)(t),w=!!(c.current&&c.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(c.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}),s(),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:l()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{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)(p,{placeholder:o()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(v,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(d,{}),a()]})]}):null]})}export{D as t};
@@ -1,3 +1,3 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ap as i,Av as a,Bv as o,Cp as s,Dp as c,EZ as l,Ep as u,FZ as d,Fv as f,Gf as p,Gv as m,Hv as h,IZ as g,Iv as _,Jf as v,Jv as y,Kf as b,Kv as x,LH as S,Lv as C,Mv as w,NZ as T,Nv as ee,OZ as E,Op as D,Ov as O,Pv as k,Qv as A,Rv as j,Sp as M,Tp as N,Uf as P,Uv as te,Uy as F,Vv as ne,Vy as re,Wf as I,Wv as L,Xv as R,Yf as z,Yv as ie,Zv as ae,_p as B,bp as V,dp as H,ey as oe,fp as U,gp as W,hp as se,jp as ce,jv as le,kp as ue,kv as de,mc as fe,mp as pe,ny as me,pp as he,qf as ge,qv as _e,ry as ve,t as G,ty as ye,vp as be,wp as xe,xp as Se,yp as Ce,zv as we}from"./api-DNOgniXv.js";import{t as K}from"./triangle-alert-DjNOW8SM.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./select-CYo6IZR2.js";import{a as Ae,c as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./alert-dialog-BdTFPzVf.js";import{t as q}from"./button-2XjWVeWK.js";import"./convexApi-4XI9Ua6G.js";import{r as J}from"./toast-DN6P_at0.js";import{t as Re}from"./badge-D7TV9F5d.js";import{a as ze,n as Be,o as Ve,r as He,t as Ue}from"./dialog-Cw-buQuR.js";import{t as We}from"./appHost-CH3EGcJw.js";import{n as Ge}from"./capabilities-CASxhKEd.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-BsJMEfMH.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ap as i,Av as a,Bv as o,Cp as s,Dp as c,EZ as l,Ep as u,FZ as d,Fv as f,Gf as p,Gv as m,Hv as h,IZ as g,Iv as _,Jf as v,Jv as y,Kf as b,Kv as x,LH as S,Lv as C,Mv as w,NZ as T,Nv as ee,OZ as E,Op as D,Ov as O,Pv as k,Qv as A,Rv as j,Sp as M,Tp as N,Uf as P,Uv as te,Uy as F,Vv as ne,Vy as re,Wf as I,Wv as L,Xv as R,Yf as z,Yv as ie,Zv as ae,_p as B,bp as V,dp as H,ey as oe,fp as U,gp as W,hp as se,jp as ce,jv as le,kp as ue,kv as de,mc as fe,mp as pe,ny as me,pp as he,qf as ge,qv as _e,ry as ve,t as G,ty as ye,vp as be,wp as xe,xp as Se,yp as Ce,zv as we}from"./api-C9TZ4xjz.js";import{t as K}from"./triangle-alert-uaH9SXmM.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./select-CeQpPnet.js";import{a as Ae,c as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./alert-dialog-D8JROLng.js";import{t as q}from"./button-DEKA-XdT.js";import"./convexApi-D2VdPGGW.js";import{r as J}from"./toast-pKIYRpST.js";import{t as Re}from"./badge-UrSDbO1c.js";import{a as ze,n as Be,o as Ve,r as He,t as Ue}from"./dialog-CHpclz_0.js";import{t as We}from"./appHost-CH3EGcJw.js";import{n as Ge}from"./capabilities-CASxhKEd.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-DCGywg8d.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
2
2
  `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
3
  `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=g(G.me.getMe,{host:We}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=g(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=g(G.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=g(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,d]),[p,h]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!f||f.length===0||(!p||!f.some(e=>$(e)===p))&&h($(f[0]))},[f,p]);let _=f?.find(e=>$(e)===p)??null,v=T(G.agentFiles.listAgentFiles),[b,S]=(0,Y.useState)({status:`idle`}),C=_?.instanceName??null,w=_?.agentId??null,ee=g(G.compat.forInstance,n&&C!==null?{instanceName:C}:`skip`),O=n&&C!==null?Ge(ee,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,j=(0,Y.useCallback)(async()=>{if(!(C===null||w===null)){S({status:`loading`});try{let e=await v({instanceName:C,agentId:w});S({status:`done`,files:e.files})}catch(e){S({status:`error`,dashboardAbsent:tt(e)})}}},[v,C,w]);(0,Y.useEffect)(()=>{k===!1&&j()},[j,k]);let[M,N]=(0,Y.useState)(null),P=g(G.agentFileCuration.listCurations,t&&C!==null&&w!==null?{instanceName:C,agentId:w}:`skip`),te=g(G.agentFileCuration.curationSettings,t&&C!==null?{instanceName:C}:`skip`),F=T(G.agentFileCuration.requestCuration),[ne,I]=(0,Y.useState)(null),[L,z]=(0,Y.useState)(null),{toast:B}=J(),V=(0,Y.useMemo)(()=>{let e=new Map;for(let t of P??[])e.has(t.name)||e.set(t.name,t);return e},[P]),H=(0,Y.useCallback)(async e=>{if(!(C===null||w===null)){I(e);try{let t=await F({instanceName:C,agentId:w,name:e,trigger:`manual`});t.ok?B({title:D(),variant:`success`}):B({title:c({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:u(),variant:`error`})}finally{I(null)}}},[F,C,w,B]),U=E(),W=(0,Y.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(ke,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":me(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(De,{children:(i??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,f.length>0?(0,Q.jsxs)(ke,{value:p??``,onValueChange:e=>h(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":ye(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(De,{children:f.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()})]}),_===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(K,{size:14,"aria-hidden":!0}),` `,Je(O.gatewayVersion,O.provider)]}):b.status===`loading`||b.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):b.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[b.dashboardAbsent?fe():A(),` `,!b.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:re()})]}):b.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:b.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Re,{variant:`outline`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:R({size:Z(e.size,U)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ie({pct:W.format(n)})}),r?(0,Q.jsx)(K,{size:14,className:`oc-afiles__warn`,"aria-label":y()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?x():m()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:te?.budgetChars??null,enabled:te?.enabled??!1,curation:V.get(e.name)??null,inFlight:ne===e.name,onCurate:()=>void H(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:_e({used:Z(Qe(b.files),U),total:Z(Ye,U),pct:W.format(Ze(Qe(b.files)))})})]}),M&&_?(0,Q.jsx)(at,{instanceName:_.instanceName,agentId:_.agentId,name:M.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void j()}):null,L?(0,Q.jsx)(ot,{curationId:L,onClose:()=>z(null),onApplied:()=>{z(null),j()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:i()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Re,{variant:`outline`,className:`oc-afiles__curate-status`,children:ue()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:ce()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:s}){let c=T(G.agentFiles.getAgentFile),u=T(G.agentFiles.setAgentFile),d=J(),[p,m]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),[x,D]=(0,Y.useState)(!1),[A,M]=(0,Y.useState)(!1),[N,P]=(0,Y.useState)(!1),[I,R]=(0,Y.useState)(!1),z=(0,Y.useCallback)(async r=>{v(!1);try{let i=await c({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||b(i.content),P(!1)}catch{v(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{z(!1)},[z]);async function ie(){if(p!==null){M(!0),R(!1);try{await u({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(j({name:n})),s(),await z(!1)}catch(e){nt(e)?P(!0):R(!0)}finally{M(!1)}}}let ae=p!==null&&y!==p.content,B=(0,Y.useMemo)(()=>p===null?null:et(p.content,y),[p,y]),V=y.length>X,H=E(),oe=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Ve,{children:L({name:n})}),(0,Q.jsxs)(He,{children:[te({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,h()]})]})]}),g?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void z(!1),children:re()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>b(e.target.value),"aria-label":L({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ne()}),N?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void z(!0),children:k()})]}):null,I?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:C()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${V?` is-over`:``}`,children:o({count:oe.format(y.length),max:oe.format(X)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!ae||A||N,onClick:()=>D(!0),children:A?F():we()}):null]})]}),(0,Q.jsx)(Le,{open:x,onOpenChange:D,children:(0,Q.jsxs)(Me,{children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(je,{children:ee({name:n})}),(0,Q.jsx)(Ae,{children:w({agent:t})})]}),B?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:le({added:B.added,removed:B.removed})}),B.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:a()}),B.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,B.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:de()}),B.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)(Fe,{children:S()}),(0,Q.jsx)(Ne,{onClick:()=>void ie(),children:O()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=g(G.agentFileCuration.getProposal,{curationId:e}),i=T(G.agentFileCuration.approveCuration),a=d(G.agentFileCuration.rejectCuration),{toast:o}=J(),[c,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),[_,y]=(0,Y.useState)(``),x=E(),S=(0,Y.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function C(){f(`approve`);try{let t=await i({curationId:e});t.ok?(o({title:N(),variant:`success`}),n()):o({title:t.reason===`conflict`?s():M({reason:t.reason??`unknown`}),variant:`error`})}catch{o({title:u(),variant:`error`})}finally{f(null)}}async function w(n){f(`reject`);try{let r=_.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?o({title:n?I():xe(),variant:`success`}):o({title:Ce(),variant:`error`}),t()}catch{o({title:u(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Ve,{children:r?Se({name:r.name}):l()}),(0,Q.jsx)(He,{children:V()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[be({before:Z(r.beforeSize,x),after:Z(r.proposedSize,x)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),` `,B()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:W({added:S.added,removed:S.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:P({feedback:r.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:H()}),(0,Q.jsx)(`ul`,{children:S.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:U()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:se()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:z()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:v(),value:_,onChange:e=>y(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>h(!1),disabled:c!==null,children:ge()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void w(!1),disabled:c!==null,children:c===`reject`?F():b()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void w(!0),disabled:c!==null,children:c===`reject`?F():p()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>h(!0),disabled:c!==null||r==null,children:pe()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void C(),disabled:c!==null||r==null,children:c===`approve`?F():he()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,BN as a,CN as o,DN as ee,EN as s,FN as te,FZ as ne,GN as c,HN as re,IN as ie,IZ as l,JN as ae,KN as u,LN as d,MN as f,NN as p,ON as m,PN as oe,QN as se,RN as h,SN as g,TN as _,UN as ce,VN as le,WN as ue,XN as de,YN as fe,ZN as pe,aP as me,bN as v,cP as he,dP as ge,eP as _e,fP as y,iP as ve,jN as ye,kN as be,lP as xe,mP as b,nP as Se,oP as Ce,pP as x,qN as S,rP as C,sP as w,t as T,tP as E,uP as D,wN as O,xN as k,yN as A,zN as we}from"./api-DNOgniXv.js";import{n as Te,t as j}from"./useNavigate-D3GIoxyW.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CYo6IZR2.js";import"./convexApi-4XI9Ua6G.js";import{r as Ee}from"./toast-DN6P_at0.js";import{t as L}from"./badge-D7TV9F5d.js";import{n as R}from"./format-Dmvblmga.js";import{a as z,n as B,o as V,t as H}from"./dialog-Cw-buQuR.js";import{c as De,o as Oe}from"./searchSchemas-Dm-Qg010.js";import{t as ke}from"./appHost-CH3EGcJw.js";import{n as Ae}from"./ConfirmDialog-DUn2vS3y.js";import{n as je}from"./TimeRangePicker-DGRmfXqe.js";import{t as Me}from"./FilterBar-1CED41DE.js";import{t as Ne}from"./DataTableShell-DlkJe0in.js";import{t as U}from"./dispatchErrorInfo-rA4PAW2w.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?b():e===`acknowledged`?x():y()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],X={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=Te({from:`/settings/anomalies`}),t=j({from:`/settings/anomalies`}),n=e.q??``,o=e.status===Z?Y:e.status,s=e.severity??Y,g=e.kind??Y,[_,v]=(0,W.useState)(Y),y=Oe(e.from,e.to),{from:b,to:x}=je(y),O=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),k=e=>void t({search:t=>({...t,status:e===Y?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),B=e=>void t({search:t=>({...t,...De(e)})}),V=Ae(),H=Ee(),U=ne(T.anomalies.resolveAnomaly),G=(l(T.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),K=l(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:b,to:x,anomalyStatus:o===Y?void 0:o,severity:s===Y?void 0:s,source:_===Y?void 0:_,kind:g===Y?void 0:g}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Q=n!==``||o!==`open`||s!==Y||_!==Y||g!==Y||y.kind!==`relative`||y.from!==X.from;function $(){v(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:ge(),description:(0,J.jsxs)(J.Fragment,{children:[D(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,xe(),` `,(0,J.jsx)(`strong`,{children:he()}),`.`,` `,w()]}),confirmLabel:Ce()}))try{await U({anomalyId:e._id,status:`resolved`}),H.success(me(),e.kind)}catch(e){H.error(ve(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),H.success(C(),e.kind)}catch(e){H.error(Se(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,J.jsx)(`strong`,{children:_e()}),` `,r(),` `,(0,J.jsx)(`strong`,{children:se()}),` `,pe(),` `,(0,J.jsx)(`strong`,{children:de()}),` `,fe(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:ae()})]}),(0,J.jsxs)(Me,{q:n,onQChange:O,searchPlaceholder:S(),timeRange:y,onTimeRangeChange:B,onReset:$,canReset:Q,children:[(0,J.jsxs)(I,{value:o,onValueChange:k,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:u()}),Pe.map(e=>(0,J.jsx)(F,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:A,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:c()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:le()}),Ie.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:_,onValueChange:v,children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(M,{placeholder:a()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:we()}),Le.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:g,onValueChange:z,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:h()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:d()}),q.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:ie(),rows:K,emptyHint:o===`open`?te():oe(),rowActions:e=>G&&e.status===`open`?[{label:p(),onSelect:()=>void We(e)},{label:f(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ye(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:h(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ue(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:re({when:R(e.firstAt)}),children:ce({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:c(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:i(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:a(),cell:e=>(0,J.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:be(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:m(),cell:e=>(0,J.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ee(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=j();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:[`↗ `,s()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,s()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,s()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),r=l(T.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:[_(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(H,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(V,{children:O()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:o()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:g()}):(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 Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(L,{variant:`destructive`,children:k()}):e===`acknowledged`?(0,J.jsx)(L,{variant:`secondary`,children:v()}):(0,J.jsx)(L,{variant:`outline`,children:A()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,BN as a,CN as o,DN as ee,EN as s,FN as te,FZ as ne,GN as c,HN as re,IN as ie,IZ as l,JN as ae,KN as u,LN as d,MN as f,NN as p,ON as m,PN as oe,QN as se,RN as h,SN as g,TN as _,UN as ce,VN as le,WN as ue,XN as de,YN as fe,ZN as pe,aP as me,bN as v,cP as he,dP as ge,eP as _e,fP as y,iP as ve,jN as ye,kN as be,lP as xe,mP as b,nP as Se,oP as Ce,pP as x,qN as S,rP as C,sP as w,t as T,tP as E,uP as D,wN as O,xN as k,yN as A,zN as we}from"./api-C9TZ4xjz.js";import{n as Te,t as j}from"./useNavigate-D3GIoxyW.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CeQpPnet.js";import"./convexApi-D2VdPGGW.js";import{r as Ee}from"./toast-pKIYRpST.js";import{t as L}from"./badge-UrSDbO1c.js";import{n as R}from"./format-CE4Tb-R7.js";import{a as z,n as B,o as V,t as H}from"./dialog-CHpclz_0.js";import{c as De,o as Oe}from"./searchSchemas-Dm-Qg010.js";import{t as ke}from"./appHost-CH3EGcJw.js";import{n as Ae}from"./ConfirmDialog-BTkA9EEC.js";import{n as je}from"./TimeRangePicker-B3Jl2mvx.js";import{t as Me}from"./FilterBar-vkX3BGGz.js";import{t as Ne}from"./DataTableShell-PyJIukLO.js";import{t as U}from"./dispatchErrorInfo-B-CAt7GQ.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?b():e===`acknowledged`?x():y()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],X={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=Te({from:`/settings/anomalies`}),t=j({from:`/settings/anomalies`}),n=e.q??``,o=e.status===Z?Y:e.status,s=e.severity??Y,g=e.kind??Y,[_,v]=(0,W.useState)(Y),y=Oe(e.from,e.to),{from:b,to:x}=je(y),O=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),k=e=>void t({search:t=>({...t,status:e===Y?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),B=e=>void t({search:t=>({...t,...De(e)})}),V=Ae(),H=Ee(),U=ne(T.anomalies.resolveAnomaly),G=(l(T.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),K=l(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:b,to:x,anomalyStatus:o===Y?void 0:o,severity:s===Y?void 0:s,source:_===Y?void 0:_,kind:g===Y?void 0:g}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Q=n!==``||o!==`open`||s!==Y||_!==Y||g!==Y||y.kind!==`relative`||y.from!==X.from;function $(){v(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:ge(),description:(0,J.jsxs)(J.Fragment,{children:[D(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,xe(),` `,(0,J.jsx)(`strong`,{children:he()}),`.`,` `,w()]}),confirmLabel:Ce()}))try{await U({anomalyId:e._id,status:`resolved`}),H.success(me(),e.kind)}catch(e){H.error(ve(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),H.success(C(),e.kind)}catch(e){H.error(Se(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,J.jsx)(`strong`,{children:_e()}),` `,r(),` `,(0,J.jsx)(`strong`,{children:se()}),` `,pe(),` `,(0,J.jsx)(`strong`,{children:de()}),` `,fe(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:ae()})]}),(0,J.jsxs)(Me,{q:n,onQChange:O,searchPlaceholder:S(),timeRange:y,onTimeRangeChange:B,onReset:$,canReset:Q,children:[(0,J.jsxs)(I,{value:o,onValueChange:k,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:u()}),Pe.map(e=>(0,J.jsx)(F,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:A,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:c()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:le()}),Ie.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:_,onValueChange:v,children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(M,{placeholder:a()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:we()}),Le.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:g,onValueChange:z,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:h()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:d()}),q.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:ie(),rows:K,emptyHint:o===`open`?te():oe(),rowActions:e=>G&&e.status===`open`?[{label:p(),onSelect:()=>void We(e)},{label:f(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ye(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:h(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ue(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:re({when:R(e.firstAt)}),children:ce({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:c(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:i(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:a(),cell:e=>(0,J.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:be(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:m(),cell:e=>(0,J.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ee(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=j();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:[`↗ `,s()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,s()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,s()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),r=l(T.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:[_(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(H,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(V,{children:O()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:o()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:g()}):(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 Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(L,{variant:`destructive`,children:k()}):e===`acknowledged`?(0,J.jsx)(L,{variant:`secondary`,children:v()}):(0,J.jsx)(L,{variant:`outline`,children:A()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fd as r,IZ as i,Id as a,Ld as o,Pd as s,Rd as c,_F as l,bF as u,cF as d,dF as f,fF as p,gF as m,hF as h,lF as g,mF as _,oF as v,pF as y,sF as b,t as x,uF as S,vF as C,yF as w,zd as T}from"./api-DNOgniXv.js";import{n as E,t as D}from"./useNavigate-D3GIoxyW.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-CYo6IZR2.js";import"./convexApi-4XI9Ua6G.js";import{n as N}from"./format-Dmvblmga.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-Dm-Qg010.js";import{n as ee}from"./TimeRangePicker-DGRmfXqe.js";import{t as z}from"./FilterBar-1CED41DE.js";import{t as B}from"./AdvancedFilter-D14bDnZM.js";import{t as V}from"./DataTableShell-DlkJe0in.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:T()},{value:`realLabel`,label:c()},{value:`targetLabel`,label:o()},{value:`impersonated`,label:a()},{value:`resource`,label:r()},{value:`resourceId`,label:s()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,a=e.impersonated??G,o=e.resource??G,s=F(e.from,e.to),c=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:L}=ee(s),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:I(e)}),replace:!0}),$=i(x.admin.listAudit,{filter:{q:n||void 0,from:T,to:L,action:r===G?void 0:r,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:c.length>0?c:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||a!==G||o!==G||c.length>0||s.kind!==`relative`||s.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:[u(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:w()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:C(),timeRange:s,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:r,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:l()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:m()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:a,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:h()}),(0,U.jsx)(j,{value:`yes`,children:_()}),(0,U.jsx)(j,{value:`no`,children:y()})]})]}),(0,U.jsxs)(M,{value:o,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:p()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:f()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:c,onChange:Q}),(0,U.jsx)(V,{title:S(),rows:$,emptyHint:g(),columns:[{header:d(),cell:e=>N(e.at),sort:e=>e.at},{header:l(),cell:e=>e.action,sort:e=>e.action},{header:b(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:p(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fd as r,IZ as i,Id as a,Ld as o,Pd as s,Rd as c,_F as l,bF as u,cF as d,dF as f,fF as p,gF as m,hF as h,lF as g,mF as _,oF as v,pF as y,sF as b,t as x,uF as S,vF as C,yF as w,zd as T}from"./api-C9TZ4xjz.js";import{n as E,t as D}from"./useNavigate-D3GIoxyW.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-CeQpPnet.js";import"./convexApi-D2VdPGGW.js";import{n as N}from"./format-CE4Tb-R7.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-Dm-Qg010.js";import{n as ee}from"./TimeRangePicker-B3Jl2mvx.js";import{t as z}from"./FilterBar-vkX3BGGz.js";import{t as B}from"./AdvancedFilter-D4ja71eC.js";import{t as V}from"./DataTableShell-PyJIukLO.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:T()},{value:`realLabel`,label:c()},{value:`targetLabel`,label:o()},{value:`impersonated`,label:a()},{value:`resource`,label:r()},{value:`resourceId`,label:s()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,a=e.impersonated??G,o=e.resource??G,s=F(e.from,e.to),c=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:L}=ee(s),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:I(e)}),replace:!0}),$=i(x.admin.listAudit,{filter:{q:n||void 0,from:T,to:L,action:r===G?void 0:r,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:c.length>0?c:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||a!==G||o!==G||c.length>0||s.kind!==`relative`||s.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:[u(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:w()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:C(),timeRange:s,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:r,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:l()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:m()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:a,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:h()}),(0,U.jsx)(j,{value:`yes`,children:_()}),(0,U.jsx)(j,{value:`no`,children:y()})]})]}),(0,U.jsxs)(M,{value:o,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:p()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:f()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:c,onChange:Q}),(0,U.jsx)(V,{title:S(),rows:$,emptyHint:g(),columns:[{header:d(),cell:e=>N(e.at),sort:e=>e.at},{header:l(),cell:e=>e.action,sort:e=>e.action},{header:b(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:p(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$k as i,AA as a,Bk as o,CA as s,DA as c,E as l,EA as u,FZ as d,Gk as f,Go as p,Hk as m,IZ as h,Ik as g,Jk as _,Kk as v,Lk as y,MA as ee,NA as te,NZ as ne,OA as re,PA as ie,Qk as b,Rk as x,SA as ae,TA as oe,Uk as se,Vk as ce,Wk as le,Xk as S,Yk as ue,Zk as de,_A as fe,_v as pe,aA as me,ad as he,av as ge,bA as _e,cA as ve,cd as ye,cj as be,cv as xe,dA as C,dj as Se,dv as Ce,eA as we,fA as Te,fj as Ee,fv as w,gA as De,gj as Oe,gv as ke,hA as Ae,hc as je,hj as Me,hv as Ne,iA as Pe,id as Fe,jA as Ie,kA as Le,lA as Re,lj as ze,lv as Be,mA as Ve,mv as He,nA as Ue,nd as We,nj as Ge,oA as Ke,oj as qe,ov as Je,pA as Ye,pj as Xe,pv as Ze,qk as Qe,rA as $e,rd as et,rj as tt,sA as nt,sj as rt,sv as it,t as T,tA as at,td as ot,uA as st,uj as ct,uv as lt,vA as ut,wA as dt,xA as ft,yA as pt,zk as mt}from"./api-DNOgniXv.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-rU6Ua6ki.js";import{n as yt,t as D}from"./useNavigate-D3GIoxyW.js";import{r as O}from"./dist-vqdeesMI.js";import{t as bt}from"./chevron-right-9DjIYDNR.js";import{t as xt}from"./chevron-up-uykFYjFv.js";import{t as St}from"./chevrons-up-down-C45M3ZYP.js";import{n as Ct,t as wt}from"./usageView-DsAOFF89.js";import{t as Tt}from"./loader-circle-D-oC88g9.js";import{t as Et}from"./checkbox-kFoJxcMJ.js";import{t as Dt}from"./server-BJJ3cVit.js";import{t as k}from"./triangle-alert-DjNOW8SM.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-CYo6IZR2.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-DiirWTCN.js";import{n as Mt,r as Nt,t as Pt}from"./popover-BHbAt2S-.js";import{t as Ft}from"./button-2XjWVeWK.js";import{t as F}from"./input-BOl1ZpD6.js";import"./convexApi-4XI9Ua6G.js";import{r as It}from"./toast-DN6P_at0.js";import{t as I}from"./badge-D7TV9F5d.js";import{a as L,n as R}from"./format-Dmvblmga.js";import{a as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./dialog-Cw-buQuR.js";import{t as Ht}from"./appHost-CH3EGcJw.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as z,i as B,n as V,o as H,r as U,t as Wt}from"./table-C6NnEhxy.js";import{t as Gt}from"./FilterBar-1CED41DE.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-BsJMEfMH.js";import{t as W}from"./dispatchErrorInfo-rA4PAW2w.js";var $t=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`}]]),en=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 tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(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 ln(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__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(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 X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(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)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,a]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),i),[s,n,i]);function p(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:ue()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:S()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:_()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:S()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Qe()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:S()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:f(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:le(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:se(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:m(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ce(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(B,{children:o()}),(0,Z.jsx)(Q,{label:mt(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Z.jsx)(V,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(St,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:i({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:L(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${L(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[p({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${L(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[b({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${L(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?x():e===`error`?y():g()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(I,{variant:`secondary`,children:x()}):e===`error`?(0,Z.jsx)(I,{variant:`destructive`,children:y()}):(0,Z.jsx)(I,{variant:`outline`,children:g()})}function wn(){return h(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=h(T.compat.getBridgeCompat,{}),n=h(T.me.getMe,{host:Ht})?.role===`admin`,i=h(T.admin.listInstances,n?{}:`skip`),a=h(T.agents.usageForInstances,n?{}:`skip`),o=D(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=un(e?e.targets:[],t?t.targets:[],i??[]),{section:l}=yt({from:`/settings/bridge`}),u=D({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:_e()}),a&&a.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:pt()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:he()}),(0,Z.jsx)(B,{children:Fe()}),(0,Z.jsx)(B,{children:et()}),(0,Z.jsx)(B,{children:We()}),(0,Z.jsx)(B,{children:ot()})]})}),(0,Z.jsx)(V,{children:a.flatMap(e=>{let t=wt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Z.jsxs)(jt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(At,{className:`w-full`,children:c.map(e=>(0,Z.jsxs)(Ot,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),c.map(e=>(0,Z.jsx)(kt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:Ne(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,He({build:t.buildVersion??`?`})]}):null,` · `,Ze(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:st()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=R(e.checkedAt),f=e.startedAt==null?null:R(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(Ct,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(k,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Re():c===`gateways_unreachable`?me({count:l.length}):s?ve():nt({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,Ke({time:d})]}),f?(0,Z.jsx)(`span`,{children:$e({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Pe({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Dt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(I,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:pe()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(bt,{size:13,"aria-hidden":!0}),at({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[ut(),i.length>0?(0,Z.jsx)(I,{variant:`destructive`,children:De({count:i.length})}):a>0?(0,Z.jsx)(I,{variant:`destructive`,children:Ae()}):(0,Z.jsx)(I,{variant:`secondary`,children:fe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ve({version:e.vendoredVersion}),r?` · `+Ye({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:je({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(bt,{size:13,"aria-hidden":!0}),Te({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ye({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Be({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Vt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Lt,{children:[(0,Z.jsx)(zt,{children:Oe({instance:e.displayName??e.name})}),(0,Z.jsx)(Bt,{children:Me()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ct,{"aria-hidden":!0}):(0,Z.jsx)(k,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?dt():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,s()]}):null}function jn({instance:e,onClose:t}){let n=d(T.admin.upsertInstanceConfig),r=ne(T.bridge.validateMediaPaths),i=It(),o=Ut(e.config?.contentLocale,void 0),[s,l]=(0,G.useState)(()=>ht(e.config??{},o)),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(null),v=s.inboundMediaMode===`shared-fs`,y=s.mediaMode===`shared-fs`,b=v||y;async function x(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(re(),e)}finally{h(!1)}}async function se(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,o)}),t()}catch(e){i.error(be(),e)}finally{p(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Xe(),help:rt()}),(0,Z.jsxs)(P,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:vt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ee(),help:qe()}),(0,Z.jsxs)(P,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:gt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Se(),help:tt()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ie(),help:te()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ee(),help:Ie()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Z.jsx)(E,{label:ct(),help:Ge()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ft({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:u(),result:g.inbound}),(0,Z.jsx)($,{label:oe(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ae()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(Ft,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:m,children:[m?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?Le():a()]}),(0,Z.jsx)(Ft,{size:`sm`,onClick:()=>void se(),disabled:f,children:ze()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?xe():it({count:e.length}),(0,Z.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Mt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Je()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$k as i,AA as a,Bk as o,CA as s,DA as c,E as l,EA as u,FZ as d,Gk as f,Go as p,Hk as m,IZ as h,Ik as g,Jk as _,Kk as v,Lk as y,MA as ee,NA as te,NZ as ne,OA as re,PA as ie,Qk as b,Rk as x,SA as ae,TA as oe,Uk as se,Vk as ce,Wk as le,Xk as S,Yk as ue,Zk as de,_A as fe,_v as pe,aA as me,ad as he,av as ge,bA as _e,cA as ve,cd as ye,cj as be,cv as xe,dA as C,dj as Se,dv as Ce,eA as we,fA as Te,fj as Ee,fv as w,gA as De,gj as Oe,gv as ke,hA as Ae,hc as je,hj as Me,hv as Ne,iA as Pe,id as Fe,jA as Ie,kA as Le,lA as Re,lj as ze,lv as Be,mA as Ve,mv as He,nA as Ue,nd as We,nj as Ge,oA as Ke,oj as qe,ov as Je,pA as Ye,pj as Xe,pv as Ze,qk as Qe,rA as $e,rd as et,rj as tt,sA as nt,sj as rt,sv as it,t as T,tA as at,td as ot,uA as st,uj as ct,uv as lt,vA as ut,wA as dt,xA as ft,yA as pt,zk as mt}from"./api-C9TZ4xjz.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-BW2ofPSg.js";import{n as yt,t as D}from"./useNavigate-D3GIoxyW.js";import{r as O}from"./dist-Col6E8px.js";import{t as bt}from"./chevron-right-DrdFABbO.js";import{t as xt}from"./chevron-up-DpsXK7Un.js";import{t as St}from"./chevrons-up-down-roy0B5KU.js";import{n as Ct,t as wt}from"./usageView-DIbIuJOR.js";import{t as Tt}from"./loader-circle-D_v0YERy.js";import{t as Et}from"./checkbox-Bbl8iiIs.js";import{t as Dt}from"./server-D8sEPnaP.js";import{t as k}from"./triangle-alert-uaH9SXmM.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-CeQpPnet.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-xefd1SeB.js";import{n as Mt,r as Nt,t as Pt}from"./popover-rh1_TqjX.js";import{t as Ft}from"./button-DEKA-XdT.js";import{t as F}from"./input-BW0GOs_g.js";import"./convexApi-D2VdPGGW.js";import{r as It}from"./toast-pKIYRpST.js";import{t as I}from"./badge-UrSDbO1c.js";import{a as L,n as R}from"./format-CE4Tb-R7.js";import{a as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./dialog-CHpclz_0.js";import{t as Ht}from"./appHost-CH3EGcJw.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as z,i as B,n as V,o as H,r as U,t as Wt}from"./table-CGUWJWZI.js";import{t as Gt}from"./FilterBar-vkX3BGGz.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-DCGywg8d.js";import{t as W}from"./dispatchErrorInfo-B-CAt7GQ.js";var $t=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`}]]),en=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 tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(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 ln(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__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(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 X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(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)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,a]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),i),[s,n,i]);function p(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:ue()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:S()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:_()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:S()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Qe()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:S()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:f(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:le(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:se(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:m(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ce(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(B,{children:o()}),(0,Z.jsx)(Q,{label:mt(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Z.jsx)(V,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(St,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:i({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:L(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${L(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[p({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${L(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[b({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${L(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?x():e===`error`?y():g()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(I,{variant:`secondary`,children:x()}):e===`error`?(0,Z.jsx)(I,{variant:`destructive`,children:y()}):(0,Z.jsx)(I,{variant:`outline`,children:g()})}function wn(){return h(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=h(T.compat.getBridgeCompat,{}),n=h(T.me.getMe,{host:Ht})?.role===`admin`,i=h(T.admin.listInstances,n?{}:`skip`),a=h(T.agents.usageForInstances,n?{}:`skip`),o=D(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=un(e?e.targets:[],t?t.targets:[],i??[]),{section:l}=yt({from:`/settings/bridge`}),u=D({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:_e()}),a&&a.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:pt()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:he()}),(0,Z.jsx)(B,{children:Fe()}),(0,Z.jsx)(B,{children:et()}),(0,Z.jsx)(B,{children:We()}),(0,Z.jsx)(B,{children:ot()})]})}),(0,Z.jsx)(V,{children:a.flatMap(e=>{let t=wt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Z.jsxs)(jt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(At,{className:`w-full`,children:c.map(e=>(0,Z.jsxs)(Ot,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),c.map(e=>(0,Z.jsx)(kt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:Ne(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,He({build:t.buildVersion??`?`})]}):null,` · `,Ze(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:st()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=R(e.checkedAt),f=e.startedAt==null?null:R(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(Ct,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(k,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Re():c===`gateways_unreachable`?me({count:l.length}):s?ve():nt({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,Ke({time:d})]}),f?(0,Z.jsx)(`span`,{children:$e({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Pe({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Dt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(I,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:pe()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(bt,{size:13,"aria-hidden":!0}),at({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[ut(),i.length>0?(0,Z.jsx)(I,{variant:`destructive`,children:De({count:i.length})}):a>0?(0,Z.jsx)(I,{variant:`destructive`,children:Ae()}):(0,Z.jsx)(I,{variant:`secondary`,children:fe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ve({version:e.vendoredVersion}),r?` · `+Ye({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:je({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(bt,{size:13,"aria-hidden":!0}),Te({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ye({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Be({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Vt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Lt,{children:[(0,Z.jsx)(zt,{children:Oe({instance:e.displayName??e.name})}),(0,Z.jsx)(Bt,{children:Me()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ct,{"aria-hidden":!0}):(0,Z.jsx)(k,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?dt():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,s()]}):null}function jn({instance:e,onClose:t}){let n=d(T.admin.upsertInstanceConfig),r=ne(T.bridge.validateMediaPaths),i=It(),o=Ut(e.config?.contentLocale,void 0),[s,l]=(0,G.useState)(()=>ht(e.config??{},o)),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(null),v=s.inboundMediaMode===`shared-fs`,y=s.mediaMode===`shared-fs`,b=v||y;async function x(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(re(),e)}finally{h(!1)}}async function se(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,o)}),t()}catch(e){i.error(be(),e)}finally{p(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Xe(),help:rt()}),(0,Z.jsxs)(P,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:vt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ee(),help:qe()}),(0,Z.jsxs)(P,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:gt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Se(),help:tt()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ie(),help:te()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ee(),help:Ie()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Z.jsx)(E,{label:ct(),help:Ge()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ft({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:u(),result:g.inbound}),(0,Z.jsx)($,{label:oe(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ae()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(Ft,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:m,children:[m?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?Le():a()]}),(0,Z.jsx)(Ft,{size:`sm`,onClick:()=>void se(),disabled:f,children:ze()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?xe():it({count:e.length}),(0,Z.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Mt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Je()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Am as i,B as a,Cn as o,Cv as s,Dm as c,Dn as l,E as u,EZ as d,Em as f,En as p,Ev as m,F as h,FZ as g,G as _,H as v,I as y,IZ as b,Iy as x,J as ee,K as te,L as ne,Ly as S,M as re,Mm as C,N as ie,NZ as w,Nm as T,Om as E,On as D,P as ae,R as oe,Sn as O,Sv as se,Tm as ce,Tn as le,Tv as ue,U as de,Uy as k,V as fe,Vy as pe,W as me,X as he,Y as ge,Z as _e,_n as ve,an as ye,bn as be,bv as A,cn as xe,dn as Se,et as j,fn as Ce,gn as we,hn as Te,in as Ee,j as De,jm as Oe,km as ke,kn as Ae,ln as je,mj as Me,mn as Ne,ny as Pe,on as Fe,pn as Ie,q as Le,sd as Re,sn as ze,t as M,un as Be,vn as Ve,vv as N,wm as He,wn as Ue,wv as We,xn as Ge,xv as Ke,yn as qe,yv as P,z as Je}from"./api-DNOgniXv.js";import{t as Ye}from"./use_paginated_query-CrHKVq5I.js";import{t as Xe}from"./loader-circle-D-oC88g9.js";import{t as F}from"./checkbox-kFoJxcMJ.js";import{t as Ze}from"./plus-1T1-a2EN.js";import{t as Qe}from"./triangle-alert-DjNOW8SM.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CYo6IZR2.js";import{n as $e,r as et,t as tt}from"./popover-BHbAt2S-.js";import{t as V}from"./button-2XjWVeWK.js";import{t as H}from"./input-BOl1ZpD6.js";import"./convexApi-4XI9Ua6G.js";import{a as nt,t as U}from"./KnobRow-GQ-yjRd-.js";import{n as rt}from"./capabilities-CASxhKEd.js";import{a as it}from"./compatView-BsJMEfMH.js";/* empty css */import{t as at}from"./switch-B0io8PF7.js";var ot=u(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),W=t(e(),1),st=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ct(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 lt=[`auto`,`hybrid`,`tool`,`off`];function ut(e){switch(e){case`auto`:return p();case`hybrid`:return le();case`tool`:return Ue();default:return o()}}function G(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function dt(e){return typeof e==`string`&&lt.includes(e)}function K(e){return{injection:dt(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function ft(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function pt(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?Ve():mt(e)?xe():null:qe(),i=K(e),a=t.injection!==i.injection||!ft(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:Ge()}}function mt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function ht(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function gt(e){return e.ok?null:e.code===`scope_refused`?Ve():e.code===`stale_default`?ve():e.code===`write_unknown`||e.code===`not_confirmed`?Ne():e.code===`not_applied`?Ie():e.code===`default_too_large`?Fe():e.code===`allowlist_too_large`?ze():e.code===`plugin_too_old`?xe():e.code===`source_not_allowed`?je():e.code===`plugin_config_lag`?Be():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?be():we({code:e.code})}function _t(e,t){let n=G(e),r=G(t);if(n.injection!==r.injection||!ft(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var q=n();function vt({instanceName:e,row:t,supported:n}){let r=w(M.knowledge.setAgentKnowledgeDefault),[i,a]=(0,W.useState)(t),[o,s]=(0,W.useState)(()=>K(t)),[c,u]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=e=>{a(e),s(K(e)),f(null)},g=_t(i,t);(0,W.useEffect)(()=>{p&&g&&(m(!1),h(t))},[p,g]);let _=pt(i,o,n),v=_.readOnlyReason===null;async function y(){u(`saving`),f(null);try{let n=gt(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:G(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(gt({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsxs)(B,{value:o.injection,onValueChange:e=>{dt(e)&&s({...o,injection:e})},disabled:!v,children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":l(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:lt.map(e=>(0,q.jsx)(z,{value:e,children:ut(e)},e))})]})}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),t.sources.map(e=>(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:v?`pointer`:`default`},title:e.description||void 0,children:[(0,q.jsx)(F,{checked:o.sources.includes(e.id),onCheckedChange:()=>s(ht(t,o,e.id)),disabled:!v,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,q.jsx)(`span`,{children:e.label})]},e.id)),g&&!p?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ye(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:Ee()})]}):null,t.overridesAllowed?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Te()}),v?(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsx)(V,{size:`sm`,disabled:!_.dirty||!_.valid||c===`saving`,onClick:()=>void y(),children:c===`saving`?k():A()})}):(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:_.readOnlyReason}),v&&_.dirty&&_.invalidReason!==null?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_.invalidReason}):null,c===`done`&&d===null?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,d===null?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function yt({instanceName:e}){let t=b(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ye(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,q.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":Ae(),children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Ae()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),t.supported?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:qe()}),n.map(n=>(0,q.jsx)(vt,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce({shown:n.length})}),(0,q.jsx)(V,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:Se()})]}):null]})}function J(e){return e.displayName??e.agentId}function bt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function Y(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function xt(e,t){let n=Y(t);return n===``||Y(J(e)).includes(n)||Y(e.agentId).includes(n)}var St=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function X(e,t){return St.compare(J(e),J(t))||St.compare(e.agentId,t.agentId)}function Ct(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(X).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function wt(e,t){return Tt(e.length)?e.filter(e=>xt(e.agent,t)):[...e]}function Tt(e){return e>8}function Z(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&xt(e,t));return[...n.filter(e=>e.enabled).sort(X),...n.filter(e=>!e.enabled).sort(X)]}function Et(e){return!e}function Dt(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Ot(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function kt(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:Math.min(e+1,n-1);case`ArrowUp`:return e<=0?0:e-1;case`Home`:return 0;case`End`:return n-1;default:return Math.min(e,n-1)}}var Q=e=>e?j():r();function $(e,t){return e===null||e.kind!==t.kind?!1:e.kind===`instance`||t.kind===`agent`&&e.agentId===t.agentId}function At({instanceName:e}){let t=b(M.agents.listAgentsForInstance,{instanceName:e}),n=g(M.agents.setInstanceReasoningDefault),i=g(M.agents.setAgentReasoningDefault),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(``),[f,p]=(0,W.useState)(``),m=(0,W.useRef)(null),h=(0,W.useId)(),v=t?.showReasoningDefault===!0,x=t?.agents??[],S=(0,W.useMemo)(()=>Ct(x,v),[x,v]),C=wt(S,f),w=Z(x,``).length>0;async function T(e,t,n){o(e),c(null),u(``);try{return await t(),u(n),!0}catch{return c(e),!1}finally{o(t=>t===e?null:t)}}let E=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),ae({value:Q(t)})),D=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function oe(e){await D(e,null,De({agent:J(e)}))&&m.current?.focus()}let O=a!==null;return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_e()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()}),t===void 0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):x.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,q.jsx)(`label`,{htmlFor:h,className:`oc-rdefaults__default-label`,children:ee()}),(0,q.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,q.jsx)(Xe,{size:14,className:`oc-rdefaults__spin`}):Q(v)}),(0,q.jsx)(at,{id:h,checked:v,disabled:O,"aria-busy":a?.kind===`instance`,onCheckedChange:E})]}),s?.kind===`instance`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null,(0,q.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:Le({count:S.length})}),(0,q.jsx)(jt,{agents:x,instanceDefault:v,disabled:!w,triggerRef:m,onPick:e=>{let t=Et(v);D(e,t,ie({agent:J(e),value:Q(t)}))}})]}),S.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()}):(0,q.jsxs)(q.Fragment,{children:[Tt(S.length)?(0,q.jsx)(H,{type:`search`,value:f,onChange:e=>p(e.target.value),placeholder:ne(),"aria-label":ne(),className:`oc-rdefaults__filter`}):null,C.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()}):(0,q.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":Le({count:S.length}),children:C.map(({agent:e,show:t,sameAsDefault:n})=>{let i=J(e),o={kind:`agent`,agentId:e.agentId};return(0,q.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:i}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,q.jsx)(`span`,{className:`oc-rdefaults__same`,children:_()}):null]}),(0,q.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[$(a,o)?(0,q.jsx)(Xe,{size:14,className:`oc-rdefaults__spin`,"aria-label":k()}):null,(0,q.jsx)(U,{field:`showReasoning`,ariaLabel:me({agent:i}),options:[{id:`on`,label:j()},{id:`off`,label:r()}],value:t?`on`:`off`,onChange:t=>void D(e,t===`on`,re({agent:i,value:Q(t===`on`)})),disabled:O}),(0,q.jsx)(V,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":de({agent:i}),title:de({agent:i}),onClick:()=>void oe(e),children:(0,q.jsx)(ot,{"aria-hidden":!0})})]}),$(s,o)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:N()}):null]},e.agentId)})})]}),s?.kind===`agent`&&!S.some(e=>e.agent.agentId===s.agentId)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null]}),(0,q.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:l})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),f=(0,W.useId)(),p=(0,W.useRef)(null),m=Z(e,c),g=Dt(m,u),_=Z(e,``).length===0,y=e=>`${f}-opt-${e}`;function b(){s(!1),l(``),d(null)}function x(e){d(e>=0?m[e].agentId:null),e>=0&&p.current?.querySelector(`#${CSS.escape(y(e))}`)?.scrollIntoView({block:`nearest`})}function ee(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),x(kt(g,e.key,m.length));else if(e.key===`Enter`){e.preventDefault();let t=Ot(m,u);t===null?d(null):(b(),i(t))}}return(0,q.jsxs)(tt,{open:o,onOpenChange:e=>e?s(!0):b(),children:[(0,q.jsx)(et,{asChild:!0,children:(0,q.jsxs)(V,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,q.jsx)(Ze,{"aria-hidden":!0}),v()]})}),(0,q.jsxs)($e,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,q.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:fe({value:Q(Et(t))})}),(0,q.jsx)(H,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":f,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<m.length?y(g):void 0,"aria-label":a(),placeholder:a(),value:c,onChange:e=>{l(e.target.value),d(null)},onKeyDown:ee,className:`oc-rdefaults__search`}),(0,q.jsx)(`div`,{id:f,ref:p,role:`listbox`,"aria-label":v(),className:`oc-rdefaults__options`,children:m.length===0?(0,q.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?oe():Je()}):m.map((e,t)=>(0,q.jsxs)(`div`,{id:y(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>d(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{b(),i(e)},children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:J(e)}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,q.jsx)(`span`,{className:`oc-rdefaults__badge`,children:h()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=b(M.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,W.useState)(r),[s,c]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{o(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=a!==r;async function d(){c(`saving`);try{let n={...e.config??{}};a===``||a===l?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let f=n?.agents??[];return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsxs)(B,{value:a===``?l:a,onValueChange:e=>o(e===l?``:e),children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":i(),children:(0,q.jsx)(I,{placeholder:E()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(z,{value:l,children:E()}),f.map(e=>(0,q.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,q.jsx)(V,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?k():A()})]}),s===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,s===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null]})}function Nt({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,W.useState)(n),[o,s]=(0,W.useState)(r===null?``:String(r)),[l,u]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(n),s(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=o.trim(),p=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,m=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,h=i!==n||(p??null)!==r;async function _(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(F,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":Oe()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Oe()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":c(),disabled:!i}),(0,q.jsx)(V,{size:`sm`,disabled:!h||!m||l===`saving`,onClick:()=>void _(),children:l===`saving`?k():A()})]}),m?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}),l===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,l===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]})}function Pt({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,W.useState)(n===null?``:String(n)),[a,o]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,q.jsx)(V,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?k():A()})]}),l?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:He()}),a===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,a===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function Ft(){let e=w(M.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),r=b(M.admin.listInstances,{}),[i,a]=(0,W.useState)(null);(0,W.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let o=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=b(M.compat.forInstance,i?{instanceName:i}:`skip`),u=i?rt(l,`configDefaults`):`loading`,f=u===`loading`?null:u.blocked,p=(0,W.useMemo)(()=>o&&i?{instanceName:i}:{},[o,i]),h=(0,W.useRef)(0),g=(0,W.useCallback)(async()=>{let t=++h.current;n({status:`loading`});try{let r=ct(await e(p));if(h.current!==t)return;n({status:`done`,current:r})}catch{if(h.current!==t)return;n({status:`error`})}},[e,p]);(0,W.useEffect)(()=>{f===!1&&(o&&!i||g())},[g,f,o,i]);let _=t.status===`done`?t.current:null,v=(0,W.useMemo)(()=>st.map(e=>({id:e,label:nt(e)})),[]),y=(0,W.useMemo)(()=>[{id:`fast`,label:S()},{id:`standard`,label:x()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),o&&i?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Pe()}),(0,q.jsxs)(B,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(L,{size:`sm`,"aria-label":Pe(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:(r??[]).map(e=>(0,q.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:Me()}):u===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):u.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(Qe,{size:14,"aria-hidden":!0}),` `,it(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Ke(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:pe()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:ue()}),(0,q.jsx)(U,{field:`thinkingLevel`,options:v,value:_?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:ue()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:We()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,q.jsx)(U,{field:`fastMode`,options:y,value:_===null||_.fastModeDefault===null?null:_.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:s()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:Re()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Pt,{instance:e}),(0,q.jsx)(Nt,{instance:e}),(0,q.jsx)(Mt,{instance:e}),(0,q.jsx)(At,{instanceName:e.name}),(0,q.jsx)(yt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Am as i,B as a,Cn as o,Cv as s,Dm as c,Dn as l,E as u,EZ as d,Em as f,En as p,Ev as m,F as h,FZ as g,G as _,H as v,I as y,IZ as b,Iy as x,J as ee,K as te,L as ne,Ly as S,M as re,Mm as C,N as ie,NZ as w,Nm as T,Om as E,On as D,P as ae,R as oe,Sn as O,Sv as se,Tm as ce,Tn as le,Tv as ue,U as de,Uy as k,V as fe,Vy as pe,W as me,X as he,Y as ge,Z as _e,_n as ve,an as ye,bn as be,bv as A,cn as xe,dn as Se,et as j,fn as Ce,gn as we,hn as Te,in as Ee,j as De,jm as Oe,km as ke,kn as Ae,ln as je,mj as Me,mn as Ne,ny as Pe,on as Fe,pn as Ie,q as Le,sd as Re,sn as ze,t as M,un as Be,vn as Ve,vv as N,wm as He,wn as Ue,wv as We,xn as Ge,xv as Ke,yn as qe,yv as P,z as Je}from"./api-C9TZ4xjz.js";import{t as Ye}from"./use_paginated_query-DVbu_Fe7.js";import{t as Xe}from"./loader-circle-D_v0YERy.js";import{t as F}from"./checkbox-Bbl8iiIs.js";import{t as Ze}from"./plus-DYL_4aqG.js";import{t as Qe}from"./triangle-alert-uaH9SXmM.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CeQpPnet.js";import{n as $e,r as et,t as tt}from"./popover-rh1_TqjX.js";import{t as V}from"./button-DEKA-XdT.js";import{t as H}from"./input-BW0GOs_g.js";import"./convexApi-D2VdPGGW.js";import{a as nt,t as U}from"./KnobRow-NCREweI3.js";import{n as rt}from"./capabilities-CASxhKEd.js";import{a as it}from"./compatView-DCGywg8d.js";/* empty css */import{t as at}from"./switch-BZom6_SV.js";var ot=u(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),W=t(e(),1),st=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ct(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 lt=[`auto`,`hybrid`,`tool`,`off`];function ut(e){switch(e){case`auto`:return p();case`hybrid`:return le();case`tool`:return Ue();default:return o()}}function G(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function dt(e){return typeof e==`string`&&lt.includes(e)}function K(e){return{injection:dt(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function ft(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function pt(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?Ve():mt(e)?xe():null:qe(),i=K(e),a=t.injection!==i.injection||!ft(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:Ge()}}function mt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function ht(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function gt(e){return e.ok?null:e.code===`scope_refused`?Ve():e.code===`stale_default`?ve():e.code===`write_unknown`||e.code===`not_confirmed`?Ne():e.code===`not_applied`?Ie():e.code===`default_too_large`?Fe():e.code===`allowlist_too_large`?ze():e.code===`plugin_too_old`?xe():e.code===`source_not_allowed`?je():e.code===`plugin_config_lag`?Be():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?be():we({code:e.code})}function _t(e,t){let n=G(e),r=G(t);if(n.injection!==r.injection||!ft(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var q=n();function vt({instanceName:e,row:t,supported:n}){let r=w(M.knowledge.setAgentKnowledgeDefault),[i,a]=(0,W.useState)(t),[o,s]=(0,W.useState)(()=>K(t)),[c,u]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=e=>{a(e),s(K(e)),f(null)},g=_t(i,t);(0,W.useEffect)(()=>{p&&g&&(m(!1),h(t))},[p,g]);let _=pt(i,o,n),v=_.readOnlyReason===null;async function y(){u(`saving`),f(null);try{let n=gt(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:G(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(gt({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsxs)(B,{value:o.injection,onValueChange:e=>{dt(e)&&s({...o,injection:e})},disabled:!v,children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":l(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:lt.map(e=>(0,q.jsx)(z,{value:e,children:ut(e)},e))})]})}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),t.sources.map(e=>(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:v?`pointer`:`default`},title:e.description||void 0,children:[(0,q.jsx)(F,{checked:o.sources.includes(e.id),onCheckedChange:()=>s(ht(t,o,e.id)),disabled:!v,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,q.jsx)(`span`,{children:e.label})]},e.id)),g&&!p?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ye(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:Ee()})]}):null,t.overridesAllowed?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Te()}),v?(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsx)(V,{size:`sm`,disabled:!_.dirty||!_.valid||c===`saving`,onClick:()=>void y(),children:c===`saving`?k():A()})}):(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:_.readOnlyReason}),v&&_.dirty&&_.invalidReason!==null?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_.invalidReason}):null,c===`done`&&d===null?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,d===null?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function yt({instanceName:e}){let t=b(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ye(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,q.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":Ae(),children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Ae()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),t.supported?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:qe()}),n.map(n=>(0,q.jsx)(vt,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce({shown:n.length})}),(0,q.jsx)(V,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:Se()})]}):null]})}function J(e){return e.displayName??e.agentId}function bt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function Y(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function xt(e,t){let n=Y(t);return n===``||Y(J(e)).includes(n)||Y(e.agentId).includes(n)}var St=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function X(e,t){return St.compare(J(e),J(t))||St.compare(e.agentId,t.agentId)}function Ct(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(X).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function wt(e,t){return Tt(e.length)?e.filter(e=>xt(e.agent,t)):[...e]}function Tt(e){return e>8}function Z(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&xt(e,t));return[...n.filter(e=>e.enabled).sort(X),...n.filter(e=>!e.enabled).sort(X)]}function Et(e){return!e}function Dt(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Ot(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function kt(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:Math.min(e+1,n-1);case`ArrowUp`:return e<=0?0:e-1;case`Home`:return 0;case`End`:return n-1;default:return Math.min(e,n-1)}}var Q=e=>e?j():r();function $(e,t){return e===null||e.kind!==t.kind?!1:e.kind===`instance`||t.kind===`agent`&&e.agentId===t.agentId}function At({instanceName:e}){let t=b(M.agents.listAgentsForInstance,{instanceName:e}),n=g(M.agents.setInstanceReasoningDefault),i=g(M.agents.setAgentReasoningDefault),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(``),[f,p]=(0,W.useState)(``),m=(0,W.useRef)(null),h=(0,W.useId)(),v=t?.showReasoningDefault===!0,x=t?.agents??[],S=(0,W.useMemo)(()=>Ct(x,v),[x,v]),C=wt(S,f),w=Z(x,``).length>0;async function T(e,t,n){o(e),c(null),u(``);try{return await t(),u(n),!0}catch{return c(e),!1}finally{o(t=>t===e?null:t)}}let E=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),ae({value:Q(t)})),D=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function oe(e){await D(e,null,De({agent:J(e)}))&&m.current?.focus()}let O=a!==null;return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_e()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()}),t===void 0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):x.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,q.jsx)(`label`,{htmlFor:h,className:`oc-rdefaults__default-label`,children:ee()}),(0,q.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,q.jsx)(Xe,{size:14,className:`oc-rdefaults__spin`}):Q(v)}),(0,q.jsx)(at,{id:h,checked:v,disabled:O,"aria-busy":a?.kind===`instance`,onCheckedChange:E})]}),s?.kind===`instance`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null,(0,q.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:Le({count:S.length})}),(0,q.jsx)(jt,{agents:x,instanceDefault:v,disabled:!w,triggerRef:m,onPick:e=>{let t=Et(v);D(e,t,ie({agent:J(e),value:Q(t)}))}})]}),S.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()}):(0,q.jsxs)(q.Fragment,{children:[Tt(S.length)?(0,q.jsx)(H,{type:`search`,value:f,onChange:e=>p(e.target.value),placeholder:ne(),"aria-label":ne(),className:`oc-rdefaults__filter`}):null,C.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()}):(0,q.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":Le({count:S.length}),children:C.map(({agent:e,show:t,sameAsDefault:n})=>{let i=J(e),o={kind:`agent`,agentId:e.agentId};return(0,q.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:i}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,q.jsx)(`span`,{className:`oc-rdefaults__same`,children:_()}):null]}),(0,q.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[$(a,o)?(0,q.jsx)(Xe,{size:14,className:`oc-rdefaults__spin`,"aria-label":k()}):null,(0,q.jsx)(U,{field:`showReasoning`,ariaLabel:me({agent:i}),options:[{id:`on`,label:j()},{id:`off`,label:r()}],value:t?`on`:`off`,onChange:t=>void D(e,t===`on`,re({agent:i,value:Q(t===`on`)})),disabled:O}),(0,q.jsx)(V,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":de({agent:i}),title:de({agent:i}),onClick:()=>void oe(e),children:(0,q.jsx)(ot,{"aria-hidden":!0})})]}),$(s,o)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:N()}):null]},e.agentId)})})]}),s?.kind===`agent`&&!S.some(e=>e.agent.agentId===s.agentId)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null]}),(0,q.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:l})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),f=(0,W.useId)(),p=(0,W.useRef)(null),m=Z(e,c),g=Dt(m,u),_=Z(e,``).length===0,y=e=>`${f}-opt-${e}`;function b(){s(!1),l(``),d(null)}function x(e){d(e>=0?m[e].agentId:null),e>=0&&p.current?.querySelector(`#${CSS.escape(y(e))}`)?.scrollIntoView({block:`nearest`})}function ee(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),x(kt(g,e.key,m.length));else if(e.key===`Enter`){e.preventDefault();let t=Ot(m,u);t===null?d(null):(b(),i(t))}}return(0,q.jsxs)(tt,{open:o,onOpenChange:e=>e?s(!0):b(),children:[(0,q.jsx)(et,{asChild:!0,children:(0,q.jsxs)(V,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,q.jsx)(Ze,{"aria-hidden":!0}),v()]})}),(0,q.jsxs)($e,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,q.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:fe({value:Q(Et(t))})}),(0,q.jsx)(H,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":f,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<m.length?y(g):void 0,"aria-label":a(),placeholder:a(),value:c,onChange:e=>{l(e.target.value),d(null)},onKeyDown:ee,className:`oc-rdefaults__search`}),(0,q.jsx)(`div`,{id:f,ref:p,role:`listbox`,"aria-label":v(),className:`oc-rdefaults__options`,children:m.length===0?(0,q.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?oe():Je()}):m.map((e,t)=>(0,q.jsxs)(`div`,{id:y(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>d(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{b(),i(e)},children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:J(e)}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,q.jsx)(`span`,{className:`oc-rdefaults__badge`,children:h()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=b(M.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,W.useState)(r),[s,c]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{o(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=a!==r;async function d(){c(`saving`);try{let n={...e.config??{}};a===``||a===l?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let f=n?.agents??[];return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsxs)(B,{value:a===``?l:a,onValueChange:e=>o(e===l?``:e),children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":i(),children:(0,q.jsx)(I,{placeholder:E()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(z,{value:l,children:E()}),f.map(e=>(0,q.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,q.jsx)(V,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?k():A()})]}),s===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,s===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null]})}function Nt({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,W.useState)(n),[o,s]=(0,W.useState)(r===null?``:String(r)),[l,u]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(n),s(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=o.trim(),p=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,m=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,h=i!==n||(p??null)!==r;async function _(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(F,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":Oe()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Oe()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":c(),disabled:!i}),(0,q.jsx)(V,{size:`sm`,disabled:!h||!m||l===`saving`,onClick:()=>void _(),children:l===`saving`?k():A()})]}),m?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}),l===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,l===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]})}function Pt({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,W.useState)(n===null?``:String(n)),[a,o]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,q.jsx)(V,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?k():A()})]}),l?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:He()}),a===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,a===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function Ft(){let e=w(M.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),r=b(M.admin.listInstances,{}),[i,a]=(0,W.useState)(null);(0,W.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let o=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=b(M.compat.forInstance,i?{instanceName:i}:`skip`),u=i?rt(l,`configDefaults`):`loading`,f=u===`loading`?null:u.blocked,p=(0,W.useMemo)(()=>o&&i?{instanceName:i}:{},[o,i]),h=(0,W.useRef)(0),g=(0,W.useCallback)(async()=>{let t=++h.current;n({status:`loading`});try{let r=ct(await e(p));if(h.current!==t)return;n({status:`done`,current:r})}catch{if(h.current!==t)return;n({status:`error`})}},[e,p]);(0,W.useEffect)(()=>{f===!1&&(o&&!i||g())},[g,f,o,i]);let _=t.status===`done`?t.current:null,v=(0,W.useMemo)(()=>st.map(e=>({id:e,label:nt(e)})),[]),y=(0,W.useMemo)(()=>[{id:`fast`,label:S()},{id:`standard`,label:x()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),o&&i?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Pe()}),(0,q.jsxs)(B,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(L,{size:`sm`,"aria-label":Pe(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:(r??[]).map(e=>(0,q.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:Me()}):u===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):u.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(Qe,{size:14,"aria-hidden":!0}),` `,it(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Ke(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:pe()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:ue()}),(0,q.jsx)(U,{field:`thinkingLevel`,options:v,value:_?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:ue()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:We()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,q.jsx)(U,{field:`fastMode`,options:y,value:_===null||_.fastModeDefault===null?null:_.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:s()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:Re()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Pt,{instance:e}),(0,q.jsx)(Nt,{instance:e}),(0,q.jsx)(Mt,{instance:e}),(0,q.jsx)(At,{instanceName:e.name}),(0,q.jsx)(yt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Ff as i,Mf as a,Nf as o,Pf as s,jf as c}from"./api-DNOgniXv.js";import{a as l,c as u,i as d,o as f,r as p,s as m,t as h}from"./alert-dialog-BdTFPzVf.js";import{t as g}from"./button-2XjWVeWK.js";import{t as _}from"./input-BOl1ZpD6.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-Cw-buQuR.js";var w=t(e(),1),T=n(),E=w.createContext(null);function D({children:e}){let[t,n]=w.useState(null),D=w.useRef(null),O=w.useRef(null),[k,A]=w.useState(``),j=w.useCallback(e=>{let t=D.current;D.current=null,n(null),t&&t(e)},[]),M=w.useMemo(()=>({confirm:e=>new Promise(t=>{D.current=t,A(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{D.current=t,A(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),N=t?.kind===`confirm`,P=t?.kind===`prompt`,F=t?.kind===`confirm`?t.opts.confirmWord:void 0,I=!F||k.trim().toLowerCase()===F.trim().toLowerCase(),L=k.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,R=e=>{e.preventDefault(),requestAnimationFrame(()=>O.current?.focus())};return(0,T.jsxs)(E.Provider,{value:M,children:[e,(0,T.jsx)(h,{open:N,onOpenChange:e=>{e||j(!1)},children:N?(0,T.jsxs)(d,{onOpenAutoFocus:F?R:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(u,{children:t.opts.title}),t.opts.description?(0,T.jsx)(l,{children:t.opts.description}):null]}),F?(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[a(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:r({word:F})}),` `,c()]}),(0,T.jsx)(_,{ref:O,value:k,placeholder:F,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I&&(e.preventDefault(),j(!0))}})]}):null,(0,T.jsxs)(f,{children:[(0,T.jsx)(p,{onClick:()=>j(!1),children:t.opts.cancelLabel??i()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??s()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(x,{children:t.opts.title}),t.opts.description?(0,T.jsx)(S,{children:t.opts.description}):null]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,T.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,T.jsx)(_,{ref:O,value:k,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&L&&(e.preventDefault(),j(k.trim()))}})]}),(0,T.jsxs)(y,{children:[(0,T.jsx)(g,{variant:`outline`,onClick:()=>j(null),children:t.opts.cancelLabel??i()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??o()})]})]}):null})]})}function O(){let e=w.useContext(E);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function k(){return O().confirm}function A(){return O().prompt}export{k as n,A as r,D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Ff as i,Mf as a,Nf as o,Pf as s,jf as c}from"./api-C9TZ4xjz.js";import{a as l,c as u,i as d,o as f,r as p,s as m,t as h}from"./alert-dialog-D8JROLng.js";import{t as g}from"./button-DEKA-XdT.js";import{t as _}from"./input-BW0GOs_g.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-CHpclz_0.js";var w=t(e(),1),T=n(),E=w.createContext(null);function D({children:e}){let[t,n]=w.useState(null),D=w.useRef(null),O=w.useRef(null),[k,A]=w.useState(``),j=w.useCallback(e=>{let t=D.current;D.current=null,n(null),t&&t(e)},[]),M=w.useMemo(()=>({confirm:e=>new Promise(t=>{D.current=t,A(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{D.current=t,A(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),N=t?.kind===`confirm`,P=t?.kind===`prompt`,F=t?.kind===`confirm`?t.opts.confirmWord:void 0,I=!F||k.trim().toLowerCase()===F.trim().toLowerCase(),L=k.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,R=e=>{e.preventDefault(),requestAnimationFrame(()=>O.current?.focus())};return(0,T.jsxs)(E.Provider,{value:M,children:[e,(0,T.jsx)(h,{open:N,onOpenChange:e=>{e||j(!1)},children:N?(0,T.jsxs)(d,{onOpenAutoFocus:F?R:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(u,{children:t.opts.title}),t.opts.description?(0,T.jsx)(l,{children:t.opts.description}):null]}),F?(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[a(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:r({word:F})}),` `,c()]}),(0,T.jsx)(_,{ref:O,value:k,placeholder:F,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I&&(e.preventDefault(),j(!0))}})]}):null,(0,T.jsxs)(f,{children:[(0,T.jsx)(p,{onClick:()=>j(!1),children:t.opts.cancelLabel??i()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??s()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(x,{children:t.opts.title}),t.opts.description?(0,T.jsx)(S,{children:t.opts.description}):null]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,T.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,T.jsx)(_,{ref:O,value:k,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&L&&(e.preventDefault(),j(k.trim()))}})]}),(0,T.jsxs)(y,{children:[(0,T.jsx)(g,{variant:`outline`,onClick:()=>j(null),children:t.opts.cancelLabel??i()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??o()})]})]}):null})]})}function O(){let e=w.useContext(E);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function k(){return O().confirm}function A(){return O().prompt}export{k as n,A as r,D as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dw as r,fw as i,hw as a,lw as o,mw as s,pw as c,uw as l}from"./api-DNOgniXv.js";import{r as u}from"./dist-vqdeesMI.js";import{t as d}from"./chevron-up-uykFYjFv.js";import{t as f}from"./chevrons-up-down-C45M3ZYP.js";import{c as p,g as m,n as h,r as g,s as _,t as v}from"./dropdown-menu-BaUA_yBi.js";import{t as y}from"./checkbox-kFoJxcMJ.js";import{t as b}from"./plus-1T1-a2EN.js";import{t as x}from"./trash-2-BmifkPwA.js";import{t as S}from"./button-2XjWVeWK.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-C6NnEhxy.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=a(),bulkActions:F,emptyHint:I=s(),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)(S,{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)(S,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,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":i(),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":o({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)??[],i=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":r(),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)(v,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(h,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(_,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&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
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dw as r,fw as i,hw as a,lw as o,mw as s,pw as c,uw as l}from"./api-C9TZ4xjz.js";import{r as u}from"./dist-Col6E8px.js";import{t as d}from"./chevron-up-DpsXK7Un.js";import{t as f}from"./chevrons-up-down-roy0B5KU.js";import{c as p,g as m,n as h,r as g,s as _,t as v}from"./dropdown-menu-DhetHpBb.js";import{t as y}from"./checkbox-Bbl8iiIs.js";import{t as b}from"./plus-DYL_4aqG.js";import{t as x}from"./trash-2-B3-1X1oZ.js";import{t as S}from"./button-DEKA-XdT.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CGUWJWZI.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=a(),bulkActions:F,emptyHint:I=s(),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)(S,{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)(S,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,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":i(),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":o({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)??[],i=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":r(),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)(v,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(h,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(_,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&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{DD as t,ED as n,FD as r,FZ as i,PD as a,TD as o,sM as s,t as c}from"./api-DNOgniXv.js";import{t as l}from"./use_paginated_query-CrHKVq5I.js";import{t as u}from"./button-2XjWVeWK.js";import"./convexApi-4XI9Ua6G.js";import{n as d}from"./ConfirmDialog-DUn2vS3y.js";import{r as f}from"./trashView-Cd0pvgnM.js";import{n as p,t as m}from"./trashPage-DsBekB4q.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=i(c.trash.restoreChat),b=i(c.trash.purgeChat),x=i(c.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:r({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:n(),description:o(),confirmLabel:t(),destructive:!0})&&await x({})},children:t()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:a()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{DD as t,ED as n,FD as r,FZ as i,PD as a,TD as o,sM as s,t as c}from"./api-C9TZ4xjz.js";import{t as l}from"./use_paginated_query-DVbu_Fe7.js";import{t as u}from"./button-DEKA-XdT.js";import"./convexApi-D2VdPGGW.js";import{n as d}from"./ConfirmDialog-BTkA9EEC.js";import{r as f}from"./trashView-CcPdpr1y.js";import{n as p,t as m}from"./trashPage-BNLG_tTi.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=i(c.trash.restoreChat),b=i(c.trash.purgeChat),x=i(c.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:r({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:n(),description:o(),confirmLabel:t(),destructive:!0})&&await x({})},children:t()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:a()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-D7TV9F5d.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};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-UrSDbO1c.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};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Df as r,Ef as i,Ky as a,r as o}from"./api-DNOgniXv.js";import{t as s}from"./loader-circle-D-oC88g9.js";import{t as c}from"./x-xmpoCnTJ.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CjNu_N10.js";import{t as g}from"./button-2XjWVeWK.js";var _=t(e(),1),v=n();function y({...e}){return(0,v.jsx)(f,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-portal`,...e})}function x({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function S({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,v.jsxs)(b,{children:[(0,v.jsx)(x,{}),(0,v.jsxs)(d,{"data-slot":`sheet-content`,"data-side":n,className:o(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,v.jsx)(h,{"data-slot":`sheet-close`,asChild:!0,children:(0,v.jsxs)(g,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,v.jsx)(c,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:a()})]})})]})]})}function C({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-0.5 p-4`,e),...t})}function w({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-footer`,className:o(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function T({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:o(`font-heading text-base font-medium text-foreground`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(p,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function D({open:e,onOpenChange:t,title:n,description:a,children:o,onSubmit:c,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,_.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await c()}finally{p(!1)}}return(0,v.jsx)(y,{open:e,onOpenChange:t,children:(0,v.jsxs)(S,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,v.jsxs)(C,{className:`border-b px-6 py-4`,children:[(0,v.jsx)(T,{children:n}),a?(0,v.jsx)(E,{children:a}):null]}),(0,v.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,v.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,v.jsxs)(w,{className:`border-t px-6 py-4`,children:[(0,v.jsxs)(g,{type:`submit`,disabled:!d||m,children:[m?(0,v.jsx)(s,{className:`size-4 animate-spin`}):null,l??r()]}),(0,v.jsx)(g,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:i()})]})]})]})})}export{w as a,E as i,y as n,C as o,S as r,T as s,D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Df as r,Ef as i,Ky as a,r as o}from"./api-C9TZ4xjz.js";import{t as s}from"./loader-circle-D_v0YERy.js";import{t as c}from"./x-E03nFsG9.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CT8KFZnw.js";import{t as g}from"./button-DEKA-XdT.js";var _=t(e(),1),v=n();function y({...e}){return(0,v.jsx)(f,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-portal`,...e})}function x({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function S({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,v.jsxs)(b,{children:[(0,v.jsx)(x,{}),(0,v.jsxs)(d,{"data-slot":`sheet-content`,"data-side":n,className:o(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,v.jsx)(h,{"data-slot":`sheet-close`,asChild:!0,children:(0,v.jsxs)(g,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,v.jsx)(c,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:a()})]})})]})]})}function C({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-0.5 p-4`,e),...t})}function w({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-footer`,className:o(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function T({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:o(`font-heading text-base font-medium text-foreground`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(p,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function D({open:e,onOpenChange:t,title:n,description:a,children:o,onSubmit:c,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,_.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await c()}finally{p(!1)}}return(0,v.jsx)(y,{open:e,onOpenChange:t,children:(0,v.jsxs)(S,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,v.jsxs)(C,{className:`border-b px-6 py-4`,children:[(0,v.jsx)(T,{children:n}),a?(0,v.jsx)(E,{children:a}):null]}),(0,v.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,v.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,v.jsxs)(w,{className:`border-t px-6 py-4`,children:[(0,v.jsxs)(g,{type:`submit`,disabled:!d||m,children:[m?(0,v.jsx)(s,{className:`size-4 animate-spin`}):null,l??r()]}),(0,v.jsx)(g,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:i()})]})]})]})})}export{w as a,E as i,y as n,C as o,S as r,T as s,D as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AR as i,BR as a,CR as o,DR as s,ER as c,FR as l,FZ as u,Fp as d,GL as f,GR as p,HR as m,IR as ee,IZ as h,JL as g,KL as _,KR as v,LR as te,Lp as ne,MR as re,NR as ie,OR as ae,PR as y,QL as b,RR as x,SR as S,TR as C,UR as w,VR as T,WL as E,WR as D,XL as O,YL as k,ZL as A,_R as j,aR as M,bR as N,cR as P,dR as F,eR as I,fR as L,gR as R,hR as z,iR as B,jR as V,kR as H,lR as oe,mR as U,nR as W,oR as G,pR as K,qL as q,rR as se,sR as ce,t as J,tR as le,uR as ue,vR as de,wR as fe,xR as pe,yR as me,zR as he}from"./api-DNOgniXv.js";import{t as ge}from"./button-2XjWVeWK.js";import"./convexApi-4XI9Ua6G.js";import{n as _e}from"./format-Dmvblmga.js";import{n as Y}from"./ConfirmDialog-DUn2vS3y.js";import{t as ve}from"./DataTableShell-DlkJe0in.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>v(),incorrect:()=>p(),incoherence:()=>D(),formatting:()=>w(),latency:()=>m(),api_error:()=>T(),other:()=>a()},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:x()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:he()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,a=u(J.feedback.respondToFeedback),[d,f]=(0,X.useState)(e.thread),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);async function _(){let t=p.trim();if(!(!t||h)){g(!0);try{await a({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{g(!1)}}}let v=[];try{v=r.contextJson?JSON.parse(r.contextJson):[]}catch{v=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${ee()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:ue(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),d.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:d.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`?ie():e.authorRole===`agent`?e.authorLabel??ne():re()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:V()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:i(),value:p,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void _(),disabled:!p.trim()||h,children:h?H():ae()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||c()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||c()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,v.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o({count:r.contextCount??v.length,truncated:r.contextTruncated?S():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:v.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:pe()}),(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:N()}),(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:me()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?de({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:[j(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,R()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=h(J.feedback.listForAdmin,{}),t=u(J.feedback.readSnapshot),n=u(J.feedback.deleteFeedback),i=Y(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function p(e){await i({title:_(),description:f(),confirmLabel:E(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,Z.jsx)(`strong`,{children:U()}),` `,K()]}),(0,Z.jsx)(ve,{title:L(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:oe(),cell:e=>_e(e.at),sort:e=>e.at},{header:P(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ce(),cell:e=>e.messageRole===`user`?G():M(),sort:e=>e.messageRole},{header:B(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${se({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:W(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:le(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:I(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:r()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:b()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:d()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:A()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?k():g(),onSelect:()=>void l(e)},{label:q(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AR as i,BR as a,CR as o,DR as s,ER as c,FR as l,FZ as u,Fp as d,GL as f,GR as p,HR as m,IR as ee,IZ as h,JL as g,KL as _,KR as v,LR as te,Lp as ne,MR as re,NR as ie,OR as ae,PR as y,QL as b,RR as x,SR as S,TR as C,UR as w,VR as T,WL as E,WR as D,XL as O,YL as k,ZL as A,_R as j,aR as M,bR as N,cR as P,dR as F,eR as I,fR as L,gR as R,hR as z,iR as B,jR as V,kR as H,lR as oe,mR as U,nR as W,oR as G,pR as K,qL as q,rR as se,sR as ce,t as J,tR as le,uR as ue,vR as de,wR as fe,xR as pe,yR as me,zR as he}from"./api-C9TZ4xjz.js";import{t as ge}from"./button-DEKA-XdT.js";import"./convexApi-D2VdPGGW.js";import{n as _e}from"./format-CE4Tb-R7.js";import{n as Y}from"./ConfirmDialog-BTkA9EEC.js";import{t as ve}from"./DataTableShell-PyJIukLO.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>v(),incorrect:()=>p(),incoherence:()=>D(),formatting:()=>w(),latency:()=>m(),api_error:()=>T(),other:()=>a()},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:x()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:he()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,a=u(J.feedback.respondToFeedback),[d,f]=(0,X.useState)(e.thread),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);async function _(){let t=p.trim();if(!(!t||h)){g(!0);try{await a({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{g(!1)}}}let v=[];try{v=r.contextJson?JSON.parse(r.contextJson):[]}catch{v=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${ee()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:ue(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),d.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:d.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`?ie():e.authorRole===`agent`?e.authorLabel??ne():re()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:V()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:i(),value:p,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void _(),disabled:!p.trim()||h,children:h?H():ae()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||c()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||c()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,v.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o({count:r.contextCount??v.length,truncated:r.contextTruncated?S():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:v.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:pe()}),(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:N()}),(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:me()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?de({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:[j(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,R()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=h(J.feedback.listForAdmin,{}),t=u(J.feedback.readSnapshot),n=u(J.feedback.deleteFeedback),i=Y(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function p(e){await i({title:_(),description:f(),confirmLabel:E(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,Z.jsx)(`strong`,{children:U()}),` `,K()]}),(0,Z.jsx)(ve,{title:L(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:oe(),cell:e=>_e(e.at),sort:e=>e.at},{header:P(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ce(),cell:e=>e.messageRole===`user`?G():M(),sort:e=>e.messageRole},{header:B(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${se({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:W(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:le(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:I(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:r()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:b()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:d()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:A()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?k():g(),onSelect:()=>void l(e)},{label:q(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,UZ as n}from"./api-DNOgniXv.js";import{a as r,i,n as a,o,r as s,t as c}from"./tooltip-6h3mm-V5.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=Object.defineProperty,u=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),f=`https://docs.convex.dev/error#undefined-validator`;function p(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${f} for details.`)}var m=class{constructor({isOptional:e}){d(this,`type`),d(this,`fieldPaths`),d(this,`isOptional`),d(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},h=class e extends m{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),d(this,`tableName`),d(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},g=class e extends m{constructor(){super(...arguments),d(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},_=class e extends m{constructor(){super(...arguments),d(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},v=class e extends m{constructor(){super(...arguments),d(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},y=class e extends m{constructor(){super(...arguments),d(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},b=class e extends m{constructor(){super(...arguments),d(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends m{constructor(){super(...arguments),d(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends m{constructor(){super(...arguments),d(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends m{constructor({isOptional:e,fields:t}){super({isOptional:e}),d(this,`fields`),d(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&p(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},w=class e extends m{constructor({isOptional:e,value:t}){if(super({isOptional:e}),d(this,`value`),d(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:n(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},T=class e extends m{constructor({isOptional:e,element:t}){super({isOptional:e}),d(this,`element`),d(this,`kind`,`array`),t===void 0&&p(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},E=class e extends m{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),d(this,`key`),d(this,`value`),d(this,`kind`,`record`),t===void 0&&p(`v.record()`,`key`),n===void 0&&p(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},D=class e extends m{constructor({isOptional:e,members:t}){super({isOptional:e}),d(this,`members`),d(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&p(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},O={id:e=>new h({isOptional:`required`,tableName:e}),null:()=>new x({isOptional:`required`}),number:()=>new g({isOptional:`required`}),float64:()=>new g({isOptional:`required`}),bigint:()=>new _({isOptional:`required`}),int64:()=>new _({isOptional:`required`}),boolean:()=>new v({isOptional:`required`}),string:()=>new b({isOptional:`required`}),bytes:()=>new y({isOptional:`required`}),literal:e=>new w({isOptional:`required`,value:e}),array:e=>new T({isOptional:`required`,element:e}),object:e=>new C({isOptional:`required`,fields:e}),record:(e,t)=>new E({isOptional:`required`,key:e,value:t}),union:(...e)=>new D({isOptional:`required`,members:e}),any:()=>new S({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>O.union(e,O.null())},k=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`}]]),A=[`gateway-http`,`shared-fs`,`off`],j=[`inline`,`shared-fs`],M=[`reactive`,`sse`],N=`reactive`;O.object({mediaMode:O.optional(O.union(O.literal(`gateway-http`),O.literal(`shared-fs`),O.literal(`off`))),inboundMediaMode:O.optional(O.union(O.literal(`inline`),O.literal(`shared-fs`))),rehydration:O.optional(O.boolean()),mediaMaxMb:O.optional(O.number()),attachmentFixAttested:O.optional(O.boolean()),summarizeThresholdChars:O.optional(O.number()),curationEnabled:O.optional(O.boolean()),curationBudgetChars:O.optional(O.number()),converterAgentId:O.optional(O.string()),voiceEnabled:O.optional(O.boolean()),talkEnabled:O.optional(O.boolean()),widgetsEnabled:O.optional(O.boolean()),widgetPromptConfirm:O.optional(O.boolean()),voiceEngine:O.optional(O.union(O.literal(`browser`),O.literal(`gateway`))),voiceLang:O.optional(O.string()),voiceRate:O.optional(O.number()),voiceAutoRead:O.optional(O.boolean()),contentLocale:O.optional(O.string()),inboundAgentMount:O.optional(O.string()),outboundAgentMount:O.optional(O.string()),transcriptProjection:O.optional(O.union(O.literal(`off`),O.literal(`shadow`),O.literal(`on`))),promptInjections:O.optional(O.record(O.string(),O.object({enabled:O.optional(O.boolean()),template:O.optional(O.string())})))});var P={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function F(e,t){let n={};for(let i of o){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function I(e,t){let n={};for(let i of o){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function L(e,t){return{mediaMode:e.mediaMode??P.mediaMode,inboundMediaMode:e.inboundMediaMode??P.inboundMediaMode,rehydration:e.rehydration??P.rehydration,mediaMaxMb:e.mediaMaxMb??P.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??P.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??P.outboundAgentMount,promptInjections:F(e.promptInjections,t)}}var R=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function z(e,t,n){let r={},i=n=>{(e[n]!==P[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=I(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of R){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var B=e();function V({text:e}){return(0,B.jsx)(s,{delayDuration:150,children:(0,B.jsxs)(c,{children:[(0,B.jsx)(i,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,B.jsx)(k,{"aria-hidden":!0})})}),(0,B.jsx)(a,{className:`max-w-xs text-pretty`,children:e})]})})}function H({label:e,help:t}){return(0,B.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,B.jsx)(V,{text:t})]})}export{N as a,M as c,L as i,H as n,j as o,z as r,A as s,V as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,UZ as n}from"./api-C9TZ4xjz.js";import{a as r,i,n as a,o,r as s,t as c}from"./tooltip-B27138uH.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=Object.defineProperty,u=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),f=`https://docs.convex.dev/error#undefined-validator`;function p(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${f} for details.`)}var m=class{constructor({isOptional:e}){d(this,`type`),d(this,`fieldPaths`),d(this,`isOptional`),d(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},h=class e extends m{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),d(this,`tableName`),d(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},g=class e extends m{constructor(){super(...arguments),d(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},_=class e extends m{constructor(){super(...arguments),d(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},v=class e extends m{constructor(){super(...arguments),d(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},y=class e extends m{constructor(){super(...arguments),d(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},b=class e extends m{constructor(){super(...arguments),d(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends m{constructor(){super(...arguments),d(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends m{constructor(){super(...arguments),d(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends m{constructor({isOptional:e,fields:t}){super({isOptional:e}),d(this,`fields`),d(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&p(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},w=class e extends m{constructor({isOptional:e,value:t}){if(super({isOptional:e}),d(this,`value`),d(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:n(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},T=class e extends m{constructor({isOptional:e,element:t}){super({isOptional:e}),d(this,`element`),d(this,`kind`,`array`),t===void 0&&p(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},E=class e extends m{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),d(this,`key`),d(this,`value`),d(this,`kind`,`record`),t===void 0&&p(`v.record()`,`key`),n===void 0&&p(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},D=class e extends m{constructor({isOptional:e,members:t}){super({isOptional:e}),d(this,`members`),d(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&p(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},O={id:e=>new h({isOptional:`required`,tableName:e}),null:()=>new x({isOptional:`required`}),number:()=>new g({isOptional:`required`}),float64:()=>new g({isOptional:`required`}),bigint:()=>new _({isOptional:`required`}),int64:()=>new _({isOptional:`required`}),boolean:()=>new v({isOptional:`required`}),string:()=>new b({isOptional:`required`}),bytes:()=>new y({isOptional:`required`}),literal:e=>new w({isOptional:`required`,value:e}),array:e=>new T({isOptional:`required`,element:e}),object:e=>new C({isOptional:`required`,fields:e}),record:(e,t)=>new E({isOptional:`required`,key:e,value:t}),union:(...e)=>new D({isOptional:`required`,members:e}),any:()=>new S({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>O.union(e,O.null())},k=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`}]]),A=[`gateway-http`,`shared-fs`,`off`],j=[`inline`,`shared-fs`],M=[`reactive`,`sse`],N=`reactive`;O.object({mediaMode:O.optional(O.union(O.literal(`gateway-http`),O.literal(`shared-fs`),O.literal(`off`))),inboundMediaMode:O.optional(O.union(O.literal(`inline`),O.literal(`shared-fs`))),rehydration:O.optional(O.boolean()),mediaMaxMb:O.optional(O.number()),attachmentFixAttested:O.optional(O.boolean()),summarizeThresholdChars:O.optional(O.number()),curationEnabled:O.optional(O.boolean()),curationBudgetChars:O.optional(O.number()),converterAgentId:O.optional(O.string()),voiceEnabled:O.optional(O.boolean()),talkEnabled:O.optional(O.boolean()),widgetsEnabled:O.optional(O.boolean()),widgetPromptConfirm:O.optional(O.boolean()),voiceEngine:O.optional(O.union(O.literal(`browser`),O.literal(`gateway`))),voiceLang:O.optional(O.string()),voiceRate:O.optional(O.number()),voiceAutoRead:O.optional(O.boolean()),contentLocale:O.optional(O.string()),inboundAgentMount:O.optional(O.string()),outboundAgentMount:O.optional(O.string()),transcriptProjection:O.optional(O.union(O.literal(`off`),O.literal(`shadow`),O.literal(`on`))),promptInjections:O.optional(O.record(O.string(),O.object({enabled:O.optional(O.boolean()),template:O.optional(O.string())})))});var P={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function F(e,t){let n={};for(let i of o){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function I(e,t){let n={};for(let i of o){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function L(e,t){return{mediaMode:e.mediaMode??P.mediaMode,inboundMediaMode:e.inboundMediaMode??P.inboundMediaMode,rehydration:e.rehydration??P.rehydration,mediaMaxMb:e.mediaMaxMb??P.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??P.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??P.outboundAgentMount,promptInjections:F(e.promptInjections,t)}}var R=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function z(e,t,n){let r={},i=n=>{(e[n]!==P[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=I(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of R){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var B=e();function V({text:e}){return(0,B.jsx)(s,{delayDuration:150,children:(0,B.jsxs)(c,{children:[(0,B.jsx)(i,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,B.jsx)(k,{"aria-hidden":!0})})}),(0,B.jsx)(a,{className:`max-w-xs text-pretty`,children:e})]})})}function H({label:e,help:t}){return(0,B.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,B.jsx)(V,{text:t})]})}export{N as a,M as c,L as i,H as n,j as o,z as r,A as s,V as t};