@lacneu/atrium 0.104.2 → 0.104.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 (111) hide show
  1. package/dist/assets/{AccessTab-D8xdWzT5.js → AccessTab-B2bpNynj.js} +1 -1
  2. package/dist/assets/{AdminSettings-CtNcFhMz.js → AdminSettings-C2bsOn0u.js} +1 -1
  3. package/dist/assets/{AdvancedFilter-Cod8SSd6.js → AdvancedFilter-DYTsdqhC.js} +1 -1
  4. package/dist/assets/{AgentFilesTab-Dfkkm3Fw.js → AgentFilesTab-BM2NUWub.js} +1 -1
  5. package/dist/assets/{AnomaliesTab-DlZ5M2UC.js → AnomaliesTab-BWiKxnXQ.js} +1 -1
  6. package/dist/assets/{AuditTab-Dh6gO6j5.js → AuditTab-CqpDXgVz.js} +1 -1
  7. package/dist/assets/{BridgeTab-Bnu9R5N4.js → BridgeTab-Cv2Co6h7.js} +1 -1
  8. package/dist/assets/{ChatDefaultsTab-CxmayDqi.js → ChatDefaultsTab-Dr-czhQm.js} +1 -1
  9. package/dist/assets/{ConfirmDialog-B7k0wvSi.js → ConfirmDialog-Bfi4_Ti8.js} +1 -1
  10. package/dist/assets/{DataTableShell-DvtkASQG.js → DataTableShell-1ZsZ0a2J.js} +1 -1
  11. package/dist/assets/{DeletedChatsTab-CnaK-AH0.js → DeletedChatsTab-By_xLvEC.js} +1 -1
  12. package/dist/assets/{DetailChips-DDAtgnjA.js → DetailChips-DkRU5HQ5.js} +1 -1
  13. package/dist/assets/{EntitySheet-DRzkWKlH.js → EntitySheet-D8Vdib4B.js} +1 -1
  14. package/dist/assets/{FeedbacksTab-D4LKaB_2.js → FeedbacksTab-YFBk45oU.js} +1 -1
  15. package/dist/assets/{FieldLabel-imj_Z0rZ.js → FieldLabel-Ce8urE01.js} +1 -1
  16. package/dist/assets/{FilesTab-D3XWSI2t.js → FilesTab-DL27Krkt.js} +1 -1
  17. package/dist/assets/{FilterBar-DCCuFxDn.js → FilterBar-DtNuk6dI.js} +1 -1
  18. package/dist/assets/{GroupsTab-DbayDYbZ.js → GroupsTab-CQrEUZSF.js} +1 -1
  19. package/dist/assets/{InstancesTab-031fn2Jt.js → InstancesTab-DiW-4KlM.js} +1 -1
  20. package/dist/assets/{IntegrationsTab-1whhDsmk.js → IntegrationsTab-DqWlrC3M.js} +1 -1
  21. package/dist/assets/{KnobRow-D6kXWvVI.js → KnobRow-4WODwFrS.js} +1 -1
  22. package/dist/assets/{KpiTab-2Vk6EtCf.js → KpiTab-BXC9YG9_.js} +1 -1
  23. package/dist/assets/{PreferencesTab-B5h49bYq.js → PreferencesTab-DarNzYdF.js} +1 -1
  24. package/dist/assets/{ProjectPage-BNKL-iOz.js → ProjectPage-BbYuFPDW.js} +1 -1
  25. package/dist/assets/{PromptInjectionsTab-Bmn1iSpB.js → PromptInjectionsTab-KMsWE-dW.js} +1 -1
  26. package/dist/assets/{RolesTab-DHxLatAl.js → RolesTab-DpN3MOih.js} +1 -1
  27. package/dist/assets/{ScheduledTab-NHSyQ677.js → ScheduledTab-BBofaJj5.js} +1 -1
  28. package/dist/assets/{ServiceAccountsTab-CKV8crhK.js → ServiceAccountsTab-CSIwvppo.js} +1 -1
  29. package/dist/assets/{SubAgentReportsTab-BWfXOTck.js → SubAgentReportsTab-BoNbdt38.js} +1 -1
  30. package/dist/assets/{ThemeShowroom-Do9I3hrR.js → ThemeShowroom-DdUZV2nA.js} +1 -1
  31. package/dist/assets/{TimeRangePicker-BZtw1JkM.js → TimeRangePicker-jsNw51TL.js} +1 -1
  32. package/dist/assets/{TimezoneCombobox-CeRN4N3z.js → TimezoneCombobox-zOqV7dxe.js} +1 -1
  33. package/dist/assets/{TracesTab-BNWFPad2.js → TracesTab-Dg_eyLYF.js} +1 -1
  34. package/dist/assets/{TrashTab-D5irFeF0.js → TrashTab-Dwjjxu8X.js} +1 -1
  35. package/dist/assets/{UsersTab-CHs3CRev.js → UsersTab-eQY9UCh5.js} +1 -1
  36. package/dist/assets/{VoiceTab-DRvjgMdZ.js → VoiceTab-BFVfbSld.js} +1 -1
  37. package/dist/assets/{alert-dialog-BcJMHbhI.js → alert-dialog-C6NSAwQv.js} +1 -1
  38. package/dist/assets/{api-CWqdeSbN.js → api-D64JTta1.js} +1 -1
  39. package/dist/assets/{badge-ChMMFtuW.js → badge-DwWXPxwl.js} +1 -1
  40. package/dist/assets/{button-C_rIPtCv.js → button-DeHzYOzP.js} +1 -1
  41. package/dist/assets/{card-BV8NO76j.js → card-WAOfM0PL.js} +1 -1
  42. package/dist/assets/check-pVsND9oZ.js +1 -0
  43. package/dist/assets/{checkbox-DPxJTQjc.js → checkbox-BuTZzFvU.js} +1 -1
  44. package/dist/assets/chevron-left-CjQ1kn0w.js +1 -0
  45. package/dist/assets/chevron-right-DkaFdk2G.js +1 -0
  46. package/dist/assets/chevron-up-s_deZUWR.js +1 -0
  47. package/dist/assets/chevrons-up-down-uk0IvxY8.js +1 -0
  48. package/dist/assets/{compatView-Cz5KNXa-.js → compatView-Db657dNx.js} +1 -1
  49. package/dist/assets/convexApi-DxRiI80M.js +1 -0
  50. package/dist/assets/{copy-DbstFM9Q.js → copy-4wREwP-V.js} +1 -1
  51. package/dist/assets/{cronDescribe-CkiSvbCK.js → cronDescribe-B-ifUeLg.js} +1 -1
  52. package/dist/assets/{deliveryRecorder-B_kVKMkR.js → deliveryRecorder-owdOglrQ.js} +1 -1
  53. package/dist/assets/{dialog-CPAskUwF.js → dialog-awuZdW9M.js} +1 -1
  54. package/dist/assets/{dispatchErrorInfo-7H2cJGwt.js → dispatchErrorInfo-C4Qh_2oR.js} +1 -1
  55. package/dist/assets/{dist-Bu9sqVcp.js → dist-B4zBnzNF.js} +1 -1
  56. package/dist/assets/{dist-BjZo0sql.js → dist-BtzRSR0_.js} +1 -1
  57. package/dist/assets/{dist-CzmY6YrA.js → dist-C0V3m4aH.js} +1 -1
  58. package/dist/assets/{dist-Uf18yR_a.js → dist-D4a9D7kU.js} +1 -1
  59. package/dist/assets/{dist-CYh9BuQS.js → dist-mViq22LZ.js} +1 -1
  60. package/dist/assets/{download-BaebAe6Z.js → download-BUlwPQI8.js} +1 -1
  61. package/dist/assets/{dropdown-menu-BVKVjups.js → dropdown-menu-C5VrCGFe.js} +1 -1
  62. package/dist/assets/{eye-LggiM6Z5.js → eye-BU60QIdS.js} +1 -1
  63. package/dist/assets/{format-AQELUhPa.js → format-g5Z3Txjl.js} +1 -1
  64. package/dist/assets/{groupManageView-DC3eSLA1.js → groupManageView-CKEYC6zY.js} +1 -1
  65. package/dist/assets/index-DLjKxzJ_.css +1 -0
  66. package/dist/assets/index-MNxzNMLb.js +158 -0
  67. package/dist/assets/{input-CSZu-bVE.js → input-CZ0jp9Rx.js} +1 -1
  68. package/dist/assets/{list-obbqPBzD.js → list-Bb0MIh_I.js} +1 -1
  69. package/dist/assets/loader-circle-1XN8tjq6.js +1 -0
  70. package/dist/assets/{lock-BlVhOk85.js → lock-xfEfLa2G.js} +1 -1
  71. package/dist/assets/{pencil-K7SBkvHL.js → pencil-CHRZ3__S.js} +1 -1
  72. package/dist/assets/plus-DrzxZ4iS.js +1 -0
  73. package/dist/assets/{popover-C-Y_Yoco.js → popover-UJtu3EZ6.js} +1 -1
  74. package/dist/assets/roleDescriptions-BW3e0J2_.js +1 -0
  75. package/dist/assets/rotate-ccw-CiOuaG2h.js +1 -0
  76. package/dist/assets/{search-Dz6sLH0-.js → search-NOJ0tWl2.js} +1 -1
  77. package/dist/assets/{select-CjcMQhwm.js → select-wXM6h61N.js} +1 -1
  78. package/dist/assets/{server-DcInl3Nh.js → server-C5TTb6-A.js} +1 -1
  79. package/dist/assets/{speech-ehUcmGCg.js → speech-BPCrvnrE.js} +1 -1
  80. package/dist/assets/{star-5ysDlx3k.js → star-N2N0cbAA.js} +1 -1
  81. package/dist/assets/{switch--NPD3Vp0.js → switch-Beq0wUQ_.js} +1 -1
  82. package/dist/assets/{table-rRR3TpMc.js → table-CegX53gV.js} +1 -1
  83. package/dist/assets/{tabs-B8emuY1B.js → tabs-CfQK0-wk.js} +1 -1
  84. package/dist/assets/{toast-C_YfUacM.js → toast-DtA87VYn.js} +1 -1
  85. package/dist/assets/{tooltip-Ct0TGxtk.js → tooltip-Dpar43UD.js} +1 -1
  86. package/dist/assets/{trash-2-xhtrhYsd.js → trash-2-CqKGt3lC.js} +1 -1
  87. package/dist/assets/{trashPage-3suR6eIy.js → trashPage-D9B1uAuS.js} +1 -1
  88. package/dist/assets/{trashView-CwUC01r_.js → trashView-TIQT30u4.js} +1 -1
  89. package/dist/assets/{triangle-alert-DoL9TI6v.js → triangle-alert-nUld87-H.js} +1 -1
  90. package/dist/assets/{usageView-BuRtXekW.js → usageView-DIPUGYx9.js} +1 -1
  91. package/dist/assets/{useChart-bV4rotdu.js → useChart-BTVKxdLu.js} +1 -1
  92. package/dist/assets/{useFontScale-DiSkEM6I.js → useFontScale-P_rNok04.js} +1 -1
  93. package/dist/assets/{useStartNewChat-8wVLrYnZ.js → useStartNewChat-GAbwTTkG.js} +1 -1
  94. package/dist/assets/{use_paginated_query-CebdO_HQ.js → use_paginated_query-C-Aw4n8b.js} +1 -1
  95. package/dist/assets/{users-CRbE186D.js → users-BUu1wJNm.js} +1 -1
  96. package/dist/assets/x-BNU-sWkh.js +1 -0
  97. package/dist/index.html +54 -54
  98. package/package.json +1 -1
  99. package/dist/assets/check-DdmANHSb.js +0 -1
  100. package/dist/assets/chevron-left-ByEQraEh.js +0 -1
  101. package/dist/assets/chevron-right-DMqzlhWH.js +0 -1
  102. package/dist/assets/chevron-up-B3KYmtzo.js +0 -1
  103. package/dist/assets/chevrons-up-down-CITEfz7_.js +0 -1
  104. package/dist/assets/convexApi-G20_TNBS.js +0 -1
  105. package/dist/assets/index-2h5cvmc2.css +0 -1
  106. package/dist/assets/index-CzYLP7A2.js +0 -158
  107. package/dist/assets/loader-circle-BqKiW3X9.js +0 -1
  108. package/dist/assets/plus-DTL4K-j9.js +0 -1
  109. package/dist/assets/roleDescriptions-DHny6e80.js +0 -1
  110. package/dist/assets/rotate-ccw-CvefWwHW.js +0 -1
  111. package/dist/assets/x-CcIT4ync.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,QS as i,XS as a,YS as o,ZS as s,aC as c,bQ as l,cC as u,eC as d,iC as f,lC as p,lQ as m,nC as h,oC as g,rC as _,sC as v,t as y,tC as b}from"./api-CWqdeSbN.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-CjcMQhwm.js";import"./convexApi-G20_TNBS.js";import{t as E}from"./badge-ChMMFtuW.js";var D=t(e(),1);function O(e){return e===`user`?r():e===`all`?i():s({group:e.group})}function k(e){return e===`common`?a():e===`owner`?o():s({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=l(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=l(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":u(),children:(0,A.jsx)(x,{placeholder:u()})}),(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:v()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(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:g()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.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:f()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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:d()}):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:_()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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:h()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.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{$S as r,QS as i,XS as a,YS as o,ZS as s,aC as c,bQ as l,cC as u,eC as d,iC as f,lC as p,lQ as m,nC as h,oC as g,rC as _,sC as v,t as y,tC as b}from"./api-D64JTta1.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-wXM6h61N.js";import"./convexApi-DxRiI80M.js";import{t as E}from"./badge-DwWXPxwl.js";var D=t(e(),1);function O(e){return e===`user`?r():e===`all`?i():s({group:e.group})}function k(e){return e===`common`?a():e===`owner`?o():s({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=l(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=l(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":u(),children:(0,A.jsx)(x,{placeholder:u()})}),(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:v()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(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:g()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.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:f()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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:d()}):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:_()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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:h()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{Bg as e,Fy as t,JX as n,PJ as r,SC as i,_C as a,bC as o,dC as s,eO as c,fC as l,gC as u,hC as d,hj as f,iy as p,jZ as m,mC as h,nQ as g,pC as _,sd as v,tO as y,uC as b,vC as x,xC as S,yC as C}from"./api-CWqdeSbN.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:()=>i(),groups:()=>s(),instances:()=>S(),bridge:()=>o(),injections:()=>f(),serviceAccounts:()=>C(),roles:()=>x(),access:()=>b(),traces:()=>a(),kpi:()=>u(),anomalies:()=>d(),files:()=>m(),scheduled:()=>n(),agentFiles:()=>t(),preferences:()=>g(),integrations:()=>h(),theme:()=>r(),chatDefaults:()=>p(),audit:()=>_(),feedbacks:()=>l(),subagentReports:()=>e(),voice:()=>v(),trash:()=>y(),deletedChats:()=>c()},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{Bg as e,Fy as t,JX as n,PJ as r,SC as i,_C as a,bC as o,dC as s,eO as c,fC as l,gC as u,hC as d,hj as f,iy as p,jZ as m,mC as h,nQ as g,pC as _,sd as v,tO as y,uC as b,vC as x,xC as S,yC as C}from"./api-D64JTta1.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:()=>i(),groups:()=>s(),instances:()=>S(),bridge:()=>o(),injections:()=>f(),serviceAccounts:()=>C(),roles:()=>x(),access:()=>b(),traces:()=>a(),kpi:()=>u(),anomalies:()=>d(),files:()=>m(),scheduled:()=>n(),agentFiles:()=>t(),preferences:()=>g(),integrations:()=>h(),theme:()=>r(),chatDefaults:()=>p(),audit:()=>_(),feedbacks:()=>l(),subagentReports:()=>e(),voice:()=>v(),trash:()=>y(),deletedChats:()=>c()},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{AT as r,FT as i,IT as a,MT as o,NT as s,PT as c,jT as l}from"./api-CWqdeSbN.js";import{r as u}from"./dist-CzmY6YrA.js";import{t as d}from"./plus-DTL4K-j9.js";import{t as f}from"./x-CcIT4ync.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-CjcMQhwm.js";import{t as v}from"./button-C_rIPtCv.js";import{t as y}from"./input-CSZu-bVE.js";import{r as b}from"./TimeRangePicker-BZtw1JkM.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),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:c()}):(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:s()})}),(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:o()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),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,{}),r()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,FT as i,IT as a,MT as o,NT as s,PT as c,jT as l}from"./api-D64JTta1.js";import{r as u}from"./dist-C0V3m4aH.js";import{t as d}from"./plus-DrzxZ4iS.js";import{t as f}from"./x-BNU-sWkh.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-wXM6h61N.js";import{t as v}from"./button-DeHzYOzP.js";import{t as y}from"./input-CZ0jp9Rx.js";import{r as b}from"./TimeRangePicker-jsNw51TL.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),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:c()}):(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:s()})}),(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:o()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),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,{}),r()]})]}):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{$f as r,$p as i,Ay as a,Bp as o,Cy as s,Dy as c,Ey as l,Fp as u,Gp as d,Hp as f,Ip as p,Jp as m,Kp as h,Lp as g,My as _,Np as v,Ny as y,Oy as b,Pp as x,Py as S,Qf as C,Qp as w,Rp as T,Sy as E,Ty as D,Up as O,Vp as k,Wp as ee,Xp as te,Yp as A,Zp as j,_Q as M,_y as N,ay as P,bQ as F,bb as I,by as ne,cy as re,dy as ie,ep as ae,fQ as L,fy as R,gy as z,hy as B,ip as oe,jy as se,ky as ce,lQ as V,ly as le,my as H,np as U,oy as W,py as ue,qp as de,rp as fe,sy as pe,t as G,tp as me,uy as he,vU as ge,vb as _e,vy as ve,wy as ye,xy as be,yQ as xe,yc as Se,yy as Ce,zp as we}from"./api-CWqdeSbN.js";import{t as K}from"./triangle-alert-DoL9TI6v.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./select-CjcMQhwm.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-BcJMHbhI.js";import{t as q}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{r as J}from"./toast-C_YfUacM.js";import{t as Re}from"./badge-ChMMFtuW.js";import{a as ze,i as Y,n as Be,o as Ve,r as He,t as Ue}from"./dialog-CPAskUwF.js";import{t as We}from"./appHost-CH3EGcJw.js";import{n as Ge}from"./capabilities-CASxhKEd.js";import{r as Ke,t as qe}from"./measureClone-CHN0WNEY.js";import{n as Je,t as Ye}from"./curation-CQksaIbm.js";import{a as Xe}from"./compatView-Cz5KNXa-.js";/* empty css */var X=t(e(),1),Ze=2e4,Qe=6e4;function $e(e){return typeof e!=`number`||e<=0?0:Math.round(e/Ze*100)}function et(e){return e<=0?0:Math.round(e/Qe*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 tt(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var nt=3;function rt(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{$f as r,$p as i,Ay as a,Bp as o,Cy as s,Dy as c,Ey as l,Fp as u,Gp as d,Hp as f,Ip as p,Jp as m,Kp as h,Lp as g,My as _,Np as v,Ny as y,Oy as b,Pp as x,Py as S,Qf as C,Qp as w,Rp as T,Sy as E,Ty as D,Up as O,Vp as k,Wp as ee,Xp as te,Yp as A,Zp as j,_Q as M,_y as N,ay as P,bQ as F,bb as I,by as ne,cy as re,dy as ie,ep as ae,fQ as L,fy as R,gy as z,hy as B,ip as oe,jy as se,ky as ce,lQ as V,ly as le,my as H,np as U,oy as W,py as ue,qp as de,rp as fe,sy as pe,t as G,tp as me,uy as he,vU as ge,vb as _e,vy as ve,wy as ye,xy as be,yQ as xe,yc as Se,yy as Ce,zp as we}from"./api-D64JTta1.js";import{t as K}from"./triangle-alert-nUld87-H.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./select-wXM6h61N.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-C6NSAwQv.js";import{t as q}from"./button-DeHzYOzP.js";import"./convexApi-DxRiI80M.js";import{r as J}from"./toast-DtA87VYn.js";import{t as Re}from"./badge-DwWXPxwl.js";import{a as ze,i as Y,n as Be,o as Ve,r as He,t as Ue}from"./dialog-awuZdW9M.js";import{t as We}from"./appHost-CH3EGcJw.js";import{n as Ge}from"./capabilities-CASxhKEd.js";import{r as Ke,t as qe}from"./measureClone-CHN0WNEY.js";import{n as Je,t as Ye}from"./curation-CQksaIbm.js";import{a as Xe}from"./compatView-Db657dNx.js";/* empty css */var X=t(e(),1),Ze=2e4,Qe=6e4;function $e(e){return typeof e!=`number`||e<=0?0:Math.round(e/Ze*100)}function et(e){return e<=0?0:Math.round(e/Qe*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 tt(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var nt=3;function rt(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<nt&&a.push(e)):t>0&&(i+=t,o.length<nt&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function it(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function at(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function ot(){let e=F(G.me.getMe,{host:We}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=F(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[t,r,i]);let u=F(G.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),d=F(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return i===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:i,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,i,u,r,d]),[p,h]=(0,X.useState)(null);(0,X.useEffect)(()=>{!f||f.length===0||(!p||!f.some(e=>$(e)===p))&&h($(f[0]))},[f,p]);let g=f?.find(e=>$(e)===p)??null,v=M(G.agentFiles.listAgentFiles),[x,C]=(0,X.useState)({status:`idle`}),w=g?.instanceName??null,T=g?.agentId??null,O=F(G.compat.forInstance,n&&w!==null?{instanceName:w}:`skip`),k=n&&w!==null?Ge(O,`agentFiles`):null,ee=k===null?!1:k===`loading`?null:k.blocked,j=(0,X.useCallback)(async()=>{if(!(w===null||T===null)){C({status:`loading`});try{let e=await v({instanceName:w,agentId:T});C({status:`done`,files:e.files})}catch(e){C({status:`error`,dashboardAbsent:it(e)})}}},[v,w,T]);(0,X.useEffect)(()=>{ee===!1&&j()},[j,ee]);let[N,P]=(0,X.useState)(null),I=F(G.agentFileCuration.listCurations,t&&w!==null&&T!==null?{instanceName:w,agentId:T}:`skip`),ne=F(G.agentFileCuration.curationSettings,t&&w!==null?{instanceName:w}:`skip`),re=M(G.agentFileCuration.requestCuration),[ie,ae]=(0,X.useState)(null),[R,z]=(0,X.useState)(null),{toast:B}=J(),oe=(0,X.useMemo)(()=>{let e=new Map;for(let t of I??[])e.has(t.name)||e.set(t.name,t);return e},[I]),le=(0,X.useCallback)(async e=>{if(!(w===null||T===null)){ae(e);try{let t=await re({instanceName:w,agentId:T,name:e,trigger:`manual`});t.ok?B({title:te(),variant:`success`}):B({title:A({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:m(),variant:`error`})}finally{ae(null)}}},[re,w,T,B]),H=L(),U=(0,X.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]),W=(0,X.useRef)(null),ue=Ke(()=>{let e=W.current;if(e===null)return null;let[t]=qe(e,[e=>e.setAttribute(`data-layout`,`line`)],`oc-afiles__measure`);return{available:e.clientWidth,required:[t]}},()=>[W.current],[x,H,t]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(ke,{value:i??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":y(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(De,{children:(r??[]).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":_(),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:se()})]}),g===null?null:k===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):k!==null&&k.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(K,{size:14,"aria-hidden":!0}),` `,Xe(k.gatewayVersion,k.provider)]}):x.status===`loading`||x.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):x.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x.dashboardAbsent?Se():ce(),` `,!x.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:_e()})]}):x.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:W,className:`oc-afiles__list`,"data-layout":ue===0?`line`:`two-level`,children:x.files.map(e=>{let n=$e(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:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:c({size:Z(e.size,H)})}),(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:l({pct:U.format(n)})}),r?(0,Q.jsx)(K,{size:14,className:`oc-afiles__warn`,"aria-label":D()}):(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:()=>P(e),children:t?s():E()}),t&&!e.missing?(0,Q.jsx)(st,{curatable:Ye.includes(e.name),size:e.size??0,budget:ne?.budgetChars??null,enabled:ne?.enabled??!1,curation:oe.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void le(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ye({used:Z(tt(x.files),H),total:Z(Qe,H),pct:U.format(et(tt(x.files)))})})]}),N&&g?(0,Q.jsx)(ct,{instanceName:g.instanceName,agentId:g.agentId,name:N.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void j()}):null,R?(0,Q.jsx)(lt,{curationId:R,onClose:()=>z(null),onApplied:()=>{z(null),j()}}):null]})}function st({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:w()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Re,{variant:`outline`,className:`oc-afiles__curate-status`,children:j()}):e&&r&&n!==null&&Je(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:i()}):null}function ct({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=M(G.agentFiles.getAgentFile),s=M(G.agentFiles.setAgentFile),c=J(),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),C=(0,X.useCallback)(async r=>{f(!1);try{let i=await o({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),b(!1)}catch{f(!0)}},[o,e,t,n]);(0,X.useEffect)(()=>{C(!1)},[C]);async function w(){if(l!==null){v(!0),S(!1);try{await s({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(B({name:n})),a(),await C(!1)}catch(e){at(e)?b(!0):S(!0)}finally{v(!1)}}}let T=l!==null&&p!==l.content,E=(0,X.useMemo)(()=>l===null?null:rt(l.content,p),[l,p]),D=p.length>Ze,O=L(),k=(0,X.useMemo)(()=>new Intl.NumberFormat(O),[O]);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:be({name:n})}),(0,Q.jsxs)(He,{children:[ne({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Ce()]})]})]}),d?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ue(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(!1),children:_e()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":be({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ve()}),y?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[R(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(!0),children:ie()})]}):null,x?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:H()}):null,(0,Q.jsxs)(Y,{className:`oc-afiles__editor-foot flex-row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${D?` is-over`:``}`,children:N({count:k.format(p.length),max:k.format(Ze)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!T||_||y,onClick:()=>g(!0),children:_?I():z()}):null]})]}),(0,Q.jsx)(Le,{open:h,onOpenChange:g,children:(0,Q.jsxs)(Me,{children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(je,{children:he({name:n})}),(0,Q.jsx)(Ae,{children:le({agent:t})})]}),E?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:re({added:E.added,removed:E.removed})}),E.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:pe()}),E.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,E.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:W()}),E.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:ge()}),(0,Q.jsx)(Ne,{onClick:()=>void w(),children:P()})]})]})})]})})}function lt({curationId:e,onClose:t,onApplied:n}){let i=F(G.agentFileCuration.getProposal,{curationId:e}),a=M(G.agentFileCuration.approveCuration),s=xe(G.agentFileCuration.rejectCuration),{toast:c}=J(),[l,_]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[S,w]=(0,X.useState)(``),E=L(),D=(0,X.useMemo)(()=>i?rt(i.beforeContent,i.proposedContent):null,[i]);async function te(){_(`approve`);try{let t=await a({curationId:e});t.ok?(c({title:de(),variant:`success`}),n()):c({title:t.reason===`conflict`?d():ee({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:m(),variant:`error`})}finally{_(null)}}async function A(n){_(`reject`);try{let i=S.trim();(await s({curationId:e,...i?{comment:i}:{},relaunch:n})).ok?c({title:n?r():h(),variant:`success`}):c({title:k(),variant:`error`}),t()}catch{c({title:m(),variant:`error`})}finally{_(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:i?O({name:i.name}):V()}),(0,Q.jsx)(He,{children:f()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[o({before:Z(i.beforeSize,E),after:Z(i.proposedSize,E)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),` `,we()]}):null]}),D?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:T({added:D.added,removed:D.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:C({feedback:i.feedback})}):null,D&&D.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:v()}),(0,Q.jsx)(`ul`,{children:D.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:x()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:g()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),y?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:oe()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:fe(),value:S,onChange:e=>w(e.target.value)})]}):null,y?(0,Q.jsxs)(Y,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>b(!1),disabled:l!==null,children:U()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void A(!1),disabled:l!==null,children:l===`reject`?I():me()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void A(!0),disabled:l!==null,children:l===`reject`?I():ae()})]}):(0,Q.jsxs)(Y,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>b(!0),disabled:l!==null||i==null,children:p()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void te(),disabled:l!==null||i==null,children:l===`approve`?I():u()})]})]})})}export{ot as AgentFilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AP as r,BP as i,CP as a,DP as ee,EP as o,FP as te,GP as s,HP as ne,IP as re,JP as c,KP as l,LP as u,MP as ie,NP as ae,OP as oe,PP as se,RP as ce,SP as le,TP as ue,UP as de,VP as fe,WP as pe,YP as d,_P as me,aP as f,bP as he,bQ as p,cP as ge,dP as m,eP as h,fP as g,gP as _e,hP as ve,iP as _,jP as ye,kP as be,lP as xe,mP as Se,nP as v,oP as y,pP as Ce,qP as b,rP as x,sP as S,t as C,tP as w,uP as T,vP as E,wP as D,xP as O,yP as k,yQ as A,zP as we}from"./api-CWqdeSbN.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-CjcMQhwm.js";import"./convexApi-G20_TNBS.js";import{r as Ee}from"./toast-C_YfUacM.js";import{t as L}from"./badge-ChMMFtuW.js";import{n as R}from"./format-AQELUhPa.js";import{a as z,n as B,o as V,t as H}from"./dialog-CPAskUwF.js";import{c as U,o as De}from"./searchSchemas-Dm-Qg010.js";import{t as Oe}from"./appHost-CH3EGcJw.js";import{n as ke}from"./ConfirmDialog-B7k0wvSi.js";import{n as Ae}from"./TimeRangePicker-BZtw1JkM.js";import{t as je}from"./FilterBar-DCCuFxDn.js";import{t as Me}from"./DataTableShell-DvtkASQG.js";import{t as W}from"./dispatchErrorInfo-7H2cJGwt.js";var G=t(e(),1),K=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),q=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function J(e){let t=q.has(e.kind);if(!K.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 Y=n(),X=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?d():e===`acknowledged`?c():b()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={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??``,c=e.status===Z?X:e.status,d=e.severity??X,f=e.kind??X,[h,_]=(0,G.useState)(X),v=De(e.from,e.to),{from:y,to:b}=Ae(v),x=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),S=e=>void t({search:t=>({...t,status:e===X?Z:e})}),w=e=>void t({search:t=>({...t,severity:e===X?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===X?void 0:e})}),B=e=>void t({search:t=>({...t,...U(e)})}),V=ke(),H=Ee(),W=A(C.anomalies.resolveAnomaly),K=(p(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),q=p(C.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:y,to:b,anomalyStatus:c===X?void 0:c,severity:d===X?void 0:d,source:h===X?void 0:h,kind:f===X?void 0:f}}),J=(0,G.useMemo)(()=>{let e=new Set;for(let t of q??[])e.add(t.kind);return[...e].sort()},[q]),Q=n!==``||c!==`open`||d!==X||h!==X||f!==X||v.kind!==`relative`||v.from!==Le.from;function $(){_(X),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:l(),description:(0,Y.jsxs)(Y.Fragment,{children:[s(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,pe(),` `,(0,Y.jsx)(`strong`,{children:de()}),`.`,` `,ne()]}),confirmLabel:fe()}))try{await W({anomalyId:e._id,status:`resolved`}),H.success(i(),e.kind)}catch(e){H.error(we(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),H.success(ce(),e.kind)}catch(e){H.error(u(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,Y.jsx)(`strong`,{children:te()}),` `,se(),` `,(0,Y.jsx)(`strong`,{children:ae()}),` `,ie(),` `,(0,Y.jsx)(`strong`,{children:ye()}),` `,r(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:be()})]}),(0,Y.jsxs)(je,{q:n,onQChange:x,searchPlaceholder:oe(),timeRange:v,onTimeRangeChange:B,onReset:$,canReset:Q,children:[(0,Y.jsxs)(I,{value:c,onValueChange:S,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:ee()}),Ne.map(e=>(0,Y.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,Y.jsxs)(I,{value:d,onValueChange:w,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{placeholder:o()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:le()}),Fe.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]}),(0,Y.jsxs)(I,{value:h,onValueChange:_,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(M,{placeholder:O()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:he()}),Ie.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]}),(0,Y.jsxs)(I,{value:f,onValueChange:z,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{placeholder:k()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:E()}),J.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]})]}),(0,Y.jsx)(Me,{title:me(),rows:q,emptyHint:c===`open`?_e():ve(),rowActions:e=>K&&e.status===`open`?[{label:Se(),onSelect:()=>void We(e)},{label:Ce(),onSelect:()=>void Ge(e)}]:[],columns:[{header:g(),cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:k(),cell:e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ue(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,Y.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:a({when:R(e.firstAt)}),children:D({count:String(e.occurrenceCount)})}):(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:o(),cell:e=>(0,Y.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:m(),cell:e=>(0,Y.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:O(),cell:e=>(0,Y.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:T(),cell:e=>(0,Y.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,Y.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:xe(),cell:e=>(0,Y.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ge(),cell:e=>e.correlationId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,Y.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,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,Y.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=J(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,Y.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,S()]})}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,Y.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,Y.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,G.useState)(!1),r=p(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[y(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,Y.jsx)(H,{open:t,onOpenChange:n,children:(0,Y.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,Y.jsx)(z,{children:(0,Y.jsx)(V,{children:f()})}),r===void 0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):r.length===0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:x()}):(0,Y.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,Y.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,Y.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,Y.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,Y.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,Y.jsx)(L,{variant:`destructive`,children:v()}):e===`acknowledged`?(0,Y.jsx)(L,{variant:`secondary`,children:w()}):(0,Y.jsx)(L,{variant:`outline`,children:h()})}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{AP as r,BP as i,CP as a,DP as ee,EP as o,FP as te,GP as s,HP as ne,IP as re,JP as c,KP as l,LP as u,MP as ie,NP as ae,OP as oe,PP as se,RP as ce,SP as le,TP as ue,UP as de,VP as fe,WP as pe,YP as d,_P as me,aP as f,bP as he,bQ as p,cP as ge,dP as m,eP as h,fP as g,gP as _e,hP as ve,iP as _,jP as ye,kP as be,lP as xe,mP as Se,nP as v,oP as y,pP as Ce,qP as b,rP as x,sP as S,t as C,tP as w,uP as T,vP as E,wP as D,xP as O,yP as k,yQ as A,zP as we}from"./api-D64JTta1.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-wXM6h61N.js";import"./convexApi-DxRiI80M.js";import{r as Ee}from"./toast-DtA87VYn.js";import{t as L}from"./badge-DwWXPxwl.js";import{n as R}from"./format-g5Z3Txjl.js";import{a as z,n as B,o as V,t as H}from"./dialog-awuZdW9M.js";import{c as U,o as De}from"./searchSchemas-Dm-Qg010.js";import{t as Oe}from"./appHost-CH3EGcJw.js";import{n as ke}from"./ConfirmDialog-Bfi4_Ti8.js";import{n as Ae}from"./TimeRangePicker-jsNw51TL.js";import{t as je}from"./FilterBar-DtNuk6dI.js";import{t as Me}from"./DataTableShell-1ZsZ0a2J.js";import{t as W}from"./dispatchErrorInfo-C4Qh_2oR.js";var G=t(e(),1),K=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),q=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function J(e){let t=q.has(e.kind);if(!K.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 Y=n(),X=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?d():e===`acknowledged`?c():b()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={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??``,c=e.status===Z?X:e.status,d=e.severity??X,f=e.kind??X,[h,_]=(0,G.useState)(X),v=De(e.from,e.to),{from:y,to:b}=Ae(v),x=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),S=e=>void t({search:t=>({...t,status:e===X?Z:e})}),w=e=>void t({search:t=>({...t,severity:e===X?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===X?void 0:e})}),B=e=>void t({search:t=>({...t,...U(e)})}),V=ke(),H=Ee(),W=A(C.anomalies.resolveAnomaly),K=(p(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),q=p(C.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:y,to:b,anomalyStatus:c===X?void 0:c,severity:d===X?void 0:d,source:h===X?void 0:h,kind:f===X?void 0:f}}),J=(0,G.useMemo)(()=>{let e=new Set;for(let t of q??[])e.add(t.kind);return[...e].sort()},[q]),Q=n!==``||c!==`open`||d!==X||h!==X||f!==X||v.kind!==`relative`||v.from!==Le.from;function $(){_(X),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:l(),description:(0,Y.jsxs)(Y.Fragment,{children:[s(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,pe(),` `,(0,Y.jsx)(`strong`,{children:de()}),`.`,` `,ne()]}),confirmLabel:fe()}))try{await W({anomalyId:e._id,status:`resolved`}),H.success(i(),e.kind)}catch(e){H.error(we(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),H.success(ce(),e.kind)}catch(e){H.error(u(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,Y.jsx)(`strong`,{children:te()}),` `,se(),` `,(0,Y.jsx)(`strong`,{children:ae()}),` `,ie(),` `,(0,Y.jsx)(`strong`,{children:ye()}),` `,r(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:be()})]}),(0,Y.jsxs)(je,{q:n,onQChange:x,searchPlaceholder:oe(),timeRange:v,onTimeRangeChange:B,onReset:$,canReset:Q,children:[(0,Y.jsxs)(I,{value:c,onValueChange:S,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:ee()}),Ne.map(e=>(0,Y.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,Y.jsxs)(I,{value:d,onValueChange:w,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{placeholder:o()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:le()}),Fe.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]}),(0,Y.jsxs)(I,{value:h,onValueChange:_,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(M,{placeholder:O()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:he()}),Ie.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]}),(0,Y.jsxs)(I,{value:f,onValueChange:z,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{placeholder:k()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:E()}),J.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]})]}),(0,Y.jsx)(Me,{title:me(),rows:q,emptyHint:c===`open`?_e():ve(),rowActions:e=>K&&e.status===`open`?[{label:Se(),onSelect:()=>void We(e)},{label:Ce(),onSelect:()=>void Ge(e)}]:[],columns:[{header:g(),cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:k(),cell:e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ue(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,Y.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:a({when:R(e.firstAt)}),children:D({count:String(e.occurrenceCount)})}):(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:o(),cell:e=>(0,Y.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:m(),cell:e=>(0,Y.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:O(),cell:e=>(0,Y.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:T(),cell:e=>(0,Y.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,Y.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:xe(),cell:e=>(0,Y.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ge(),cell:e=>e.correlationId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,Y.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,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,Y.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=J(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,Y.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,S()]})}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,Y.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,Y.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,G.useState)(!1),r=p(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[y(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,Y.jsx)(H,{open:t,onOpenChange:n,children:(0,Y.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,Y.jsx)(z,{children:(0,Y.jsx)(V,{children:f()})}),r===void 0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):r.length===0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:x()}):(0,Y.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,Y.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,Y.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,Y.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,Y.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,Y.jsx)(L,{variant:`destructive`,children:v()}):e===`acknowledged`?(0,Y.jsx)(L,{variant:`secondary`,children:w()}):(0,Y.jsx)(L,{variant:`outline`,children:h()})}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{$F as r,GF as i,Gd as a,HF as o,JF as s,Jd as c,KF as l,Kd as u,QF as d,UF as f,Ud as p,VF as m,WF as h,Wd as g,XF as _,YF as v,ZF as y,bQ as b,eI as x,qF as S,qd as C,t as w,tI as T}from"./api-CWqdeSbN.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-CjcMQhwm.js";import"./convexApi-G20_TNBS.js";import{n as N}from"./format-AQELUhPa.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-BZtw1JkM.js";import{t as z}from"./FilterBar-DCCuFxDn.js";import{t as B}from"./AdvancedFilter-Cod8SSd6.js";import{t as V}from"./DataTableShell-DvtkASQG.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:c()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:u()},{value:`impersonated`,label:a()},{value:`resource`,label:g()},{value:`resourceId`,label:p()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,a=e.action??G,c=e.impersonated??G,u=e.resource??G,p=F(e.from,e.to),g=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:C,to:L}=ee(p),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:I(e)}),replace:!0}),$=b(w.admin.listAudit,{filter:{q:n||void 0,from:C,to:L,action:a===G?void 0:a,resource:u===G?void 0:u,impersonated:c===G?void 0:c===`yes`,advanced:g.length>0?g: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!==``||a!==G||c!==G||u!==G||g.length>0||p.kind!==`relative`||p.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:r(),timeRange:p,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:a,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:d()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:y()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:c,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:_()}),(0,U.jsx)(j,{value:`yes`,children:v()}),(0,U.jsx)(j,{value:`no`,children:s()})]})]}),(0,U.jsxs)(M,{value:u,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:S()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:l()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:g,onChange:Q}),(0,U.jsx)(V,{title:i(),rows:$,emptyHint:h(),columns:[{header:f(),cell:e=>N(e.at),sort:e=>e.at},{header:d(),cell:e=>e.action,sort:e=>e.action},{header:o(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:m(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:S(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,GF as i,Gd as a,HF as o,JF as s,Jd as c,KF as l,Kd as u,QF as d,UF as f,Ud as p,VF as m,WF as h,Wd as g,XF as _,YF as v,ZF as y,bQ as b,eI as x,qF as S,qd as C,t as w,tI as T}from"./api-D64JTta1.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-wXM6h61N.js";import"./convexApi-DxRiI80M.js";import{n as N}from"./format-g5Z3Txjl.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-jsNw51TL.js";import{t as z}from"./FilterBar-DtNuk6dI.js";import{t as B}from"./AdvancedFilter-DYTsdqhC.js";import{t as V}from"./DataTableShell-1ZsZ0a2J.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:c()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:u()},{value:`impersonated`,label:a()},{value:`resource`,label:g()},{value:`resourceId`,label:p()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,a=e.action??G,c=e.impersonated??G,u=e.resource??G,p=F(e.from,e.to),g=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:C,to:L}=ee(p),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:I(e)}),replace:!0}),$=b(w.admin.listAudit,{filter:{q:n||void 0,from:C,to:L,action:a===G?void 0:a,resource:u===G?void 0:u,impersonated:c===G?void 0:c===`yes`,advanced:g.length>0?g: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!==``||a!==G||c!==G||u!==G||g.length>0||p.kind!==`relative`||p.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:r(),timeRange:p,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:a,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:d()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:y()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:c,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:_()}),(0,U.jsx)(j,{value:`yes`,children:v()}),(0,U.jsx)(j,{value:`no`,children:s()})]})]}),(0,U.jsxs)(M,{value:u,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:S()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:l()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:g,onChange:Q}),(0,U.jsx)(V,{title:i(),rows:$,emptyHint:h(),columns:[{header:f(),cell:e=>N(e.at),sort:e=>e.at},{header:d(),cell:e=>e.action,sort:e=>e.action},{header:o(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:m(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:S(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AA as i,Av as a,BA as o,Bj as s,Bv as c,CA as l,DA as u,EA as d,FA as f,GA as p,Gj as m,Gv as h,HA as g,Hj as ee,Hv as _,IA as v,Ij as te,Iv as y,JA as b,Jv as ne,KA as re,Kj as ie,Kv as ae,LA as oe,Lj as se,Lv as ce,MA as le,NA as ue,OA as de,PA as fe,QA as pe,RA as me,Rv as he,SA as ge,TA as _e,UA as ve,Uj as ye,Uv as x,VA as be,Vj as xe,Vv as Se,WA as Ce,Wj as we,Wv as Te,XA as Ee,Xj as De,Xo as Oe,YA as ke,Yj as Ae,ZA as je,_A as S,_Q as Me,_d as Ne,aj as Pe,bA as Fe,bQ as C,bc as Ie,cj as Le,dd as Re,dj as ze,ej as Be,fd as Ve,fj as He,gA as Ue,ij as We,jA as Ge,k as w,kA as Ke,lj as qe,md as Je,mj as Ye,nj as Xe,oj as Ze,pd as Qe,pj as $e,qA as et,qj as tt,qv as nt,rj as rt,sj as it,t as T,tj as at,ud as ot,uj as st,vA as E,wA as ct,xA as lt,yA as ut,yQ as dt,zA as ft,zv as pt}from"./api-CWqdeSbN.js";import{i as mt,n as D,o as ht,r as gt,s as _t}from"./FieldLabel-imj_Z0rZ.js";import{n as vt,t as O}from"./useNavigate-D3GIoxyW.js";import{r as k}from"./dist-CzmY6YrA.js";import{t as yt}from"./chevron-right-DMqzlhWH.js";import{t as bt}from"./chevron-up-B3KYmtzo.js";import{t as xt}from"./chevrons-up-down-CITEfz7_.js";import{n as St,t as Ct}from"./usageView-BuRtXekW.js";import{t as wt}from"./loader-circle-BqKiW3X9.js";import{t as Tt}from"./checkbox-DPxJTQjc.js";import{t as A}from"./server-DcInl3Nh.js";import{t as j}from"./triangle-alert-DoL9TI6v.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import{n as Et,r as Dt,t as Ot}from"./popover-C-Y_Yoco.js";import{i as kt,n as At,r as jt,t as Mt}from"./tabs-B8emuY1B.js";import{t as L}from"./button-C_rIPtCv.js";import{t as R}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as Nt}from"./toast-C_YfUacM.js";import{t as z}from"./badge-ChMMFtuW.js";import{a as B,n as Pt}from"./format-AQELUhPa.js";import{a as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-CPAskUwF.js";import{t as Bt}from"./appHost-CH3EGcJw.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-rRR3TpMc.js";import{t as Gt}from"./FilterBar-DCCuFxDn.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-Cz5KNXa-.js";import{t as W}from"./dispatchErrorInfo-7H2cJGwt.js";var $t=w(`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=w(`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),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),f=(0,G.useMemo)(()=>vn(s),[s]),p=(0,G.useMemo)(()=>yn(s),[s]),m=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ge(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:Ke()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),c.map(e=>(0,Z.jsx)(F,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:de()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),f.map(e=>(0,Z.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:u()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),p.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ct(),sortKey:`state`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:l(),sortKey:`instance`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ge(),sortKey:`host`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:lt(),sortKey:`version`,sort:a,onSort:h}),(0,Z.jsx)(V,{children:Fe()}),(0,Z.jsx)(Q,{label:ut(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Z.jsx)(Ut,{children:m.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)(V,{"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)(bt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{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:ue({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:B(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?` · ${B(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:[Oe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${B(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:[le({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${B(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?E():e===`error`?S():Ue()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(z,{variant:`secondary`,children:E()}):e===`error`?(0,Z.jsx)(z,{variant:`destructive`,children:S()}):(0,Z.jsx)(z,{variant:`outline`,children:Ue()})}function wn(){return C(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=C(T.compat.getBridgeCompat,{}),n=C(T.me.getMe,{host:Bt})?.role===`admin`,i=C(T.admin.listInstances,n?{}:`skip`),o=C(T.agents.usageForInstances,n?{}:`skip`),s=O(),c=()=>void s({to:`/settings/anomalies`,search:{status:`open`}}),l=un(e?e.targets:[],t?t.targets:[],i??[]),{section:u}=vt({from:`/settings/bridge`}),d=O({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=f!==null&&Xt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:c}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Be()}),o&&o.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:r()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:Je()}),(0,Z.jsx)(V,{children:Qe()}),(0,Z.jsx)(V,{children:Ve()}),(0,Z.jsx)(V,{children:Re()}),(0,Z.jsx)(V,{children:ot()})]})}),(0,Z.jsx)(Ut,{children:o.flatMap(e=>{let t=Ct(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)(z,{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,l.length>0?(0,Z.jsxs)(Mt,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(jt,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(At,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):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:ae(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,h({build:t.buildVersion??`?`})]}):null,` · `,Te(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ce()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(St,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(j,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ve():l===`gateways_unreachable`?ft({count:u.length}):c?g():be({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,o({time:f})]}),m?(0,Z.jsx)(`span`,{children:oe({time:m})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:me({names:u.join(`, `)})}):null,c?(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:v()})]})}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)),[p,m]=(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)(A,{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)(z,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ne()}),(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":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),f({count:t.length})]}),p?(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:[pe(),i.length>0?(0,Z.jsx)(z,{variant:`destructive`,children:Ee({count:i.length})}):a>0?(0,Z.jsx)(z,{variant:`destructive`,children:ke()}):(0,Z.jsx)(z,{variant:`secondary`,children:je()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b({version:e.vendoredVersion}),r?` · `+et({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ie({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)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),re({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:p()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ne({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:c({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:x()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(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)(z,{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)(zt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Lt,{children:De({instance:e.displayName??e.name})}),(0,Z.jsx)(Rt,{children:Ae()})]}),(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)(St,{"aria-hidden":!0}):(0,Z.jsx)(j,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?We():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,rt()]}):null}function jn({instance:e,onClose:t}){let n=dt(T.admin.upsertInstanceConfig),r=Me(T.bridge.validateMediaPaths),i=Nt(),a=Vt(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>mt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,h]=(0,G.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Le(),e)}finally{f(!1)}}async function b(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(o,r,a)}),t()}catch(e){i.error(ee(),e)}finally{u(!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)(D,{label:tt(),help:xe()}),(0,Z.jsxs)(I,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:_t.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:ie(),help:s()}),(0,Z.jsxs)(I,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:ht.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:m(),help:se()}),(0,Z.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Ye(),help:$e()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:He(),help:ze()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Tt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:we(),help:te()})]}),v&&p!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),at({reason:p.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Ze(),result:p.inbound}),(0,Z.jsx)($,{label:Pe(),result:p.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),Xe()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?qe():st()]}),(0,Z.jsx)(L,{size:`sm`,onClick:()=>void b(),disabled:l,children:ye()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pt():he({count:e.length}),(0,Z.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(z,{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{$A as r,AA as i,Av as a,BA as o,Bj as s,Bv as c,CA as l,DA as u,EA as d,FA as f,GA as p,Gj as m,Gv as h,HA as g,Hj as ee,Hv as _,IA as v,Ij as te,Iv as y,JA as b,Jv as ne,KA as re,Kj as ie,Kv as ae,LA as oe,Lj as se,Lv as ce,MA as le,NA as ue,OA as de,PA as fe,QA as pe,RA as me,Rv as he,SA as ge,TA as _e,UA as ve,Uj as ye,Uv as x,VA as be,Vj as xe,Vv as Se,WA as Ce,Wj as we,Wv as Te,XA as Ee,Xj as De,Xo as Oe,YA as ke,Yj as Ae,ZA as je,_A as S,_Q as Me,_d as Ne,aj as Pe,bA as Fe,bQ as C,bc as Ie,cj as Le,dd as Re,dj as ze,ej as Be,fd as Ve,fj as He,gA as Ue,ij as We,jA as Ge,k as w,kA as Ke,lj as qe,md as Je,mj as Ye,nj as Xe,oj as Ze,pd as Qe,pj as $e,qA as et,qj as tt,qv as nt,rj as rt,sj as it,t as T,tj as at,ud as ot,uj as st,vA as E,wA as ct,xA as lt,yA as ut,yQ as dt,zA as ft,zv as pt}from"./api-D64JTta1.js";import{i as mt,n as D,o as ht,r as gt,s as _t}from"./FieldLabel-Ce8urE01.js";import{n as vt,t as O}from"./useNavigate-D3GIoxyW.js";import{r as k}from"./dist-C0V3m4aH.js";import{t as yt}from"./chevron-right-DkaFdk2G.js";import{t as bt}from"./chevron-up-s_deZUWR.js";import{t as xt}from"./chevrons-up-down-uk0IvxY8.js";import{n as St,t as Ct}from"./usageView-DIPUGYx9.js";import{t as wt}from"./loader-circle-1XN8tjq6.js";import{t as Tt}from"./checkbox-BuTZzFvU.js";import{t as A}from"./server-C5TTb6-A.js";import{t as j}from"./triangle-alert-nUld87-H.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-wXM6h61N.js";import{n as Et,r as Dt,t as Ot}from"./popover-UJtu3EZ6.js";import{i as kt,n as At,r as jt,t as Mt}from"./tabs-CfQK0-wk.js";import{t as L}from"./button-DeHzYOzP.js";import{t as R}from"./input-CZ0jp9Rx.js";import"./convexApi-DxRiI80M.js";import{r as Nt}from"./toast-DtA87VYn.js";import{t as z}from"./badge-DwWXPxwl.js";import{a as B,n as Pt}from"./format-g5Z3Txjl.js";import{a as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-awuZdW9M.js";import{t as Bt}from"./appHost-CH3EGcJw.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CegX53gV.js";import{t as Gt}from"./FilterBar-DtNuk6dI.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-Db657dNx.js";import{t as W}from"./dispatchErrorInfo-C4Qh_2oR.js";var $t=w(`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=w(`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),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),f=(0,G.useMemo)(()=>vn(s),[s]),p=(0,G.useMemo)(()=>yn(s),[s]),m=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ge(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:Ke()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),c.map(e=>(0,Z.jsx)(F,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:de()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),f.map(e=>(0,Z.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:u()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),p.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ct(),sortKey:`state`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:l(),sortKey:`instance`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ge(),sortKey:`host`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:lt(),sortKey:`version`,sort:a,onSort:h}),(0,Z.jsx)(V,{children:Fe()}),(0,Z.jsx)(Q,{label:ut(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Z.jsx)(Ut,{children:m.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)(V,{"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)(bt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{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:ue({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:B(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?` · ${B(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:[Oe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${B(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:[le({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${B(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?E():e===`error`?S():Ue()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(z,{variant:`secondary`,children:E()}):e===`error`?(0,Z.jsx)(z,{variant:`destructive`,children:S()}):(0,Z.jsx)(z,{variant:`outline`,children:Ue()})}function wn(){return C(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=C(T.compat.getBridgeCompat,{}),n=C(T.me.getMe,{host:Bt})?.role===`admin`,i=C(T.admin.listInstances,n?{}:`skip`),o=C(T.agents.usageForInstances,n?{}:`skip`),s=O(),c=()=>void s({to:`/settings/anomalies`,search:{status:`open`}}),l=un(e?e.targets:[],t?t.targets:[],i??[]),{section:u}=vt({from:`/settings/bridge`}),d=O({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=f!==null&&Xt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:c}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Be()}),o&&o.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:r()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:Je()}),(0,Z.jsx)(V,{children:Qe()}),(0,Z.jsx)(V,{children:Ve()}),(0,Z.jsx)(V,{children:Re()}),(0,Z.jsx)(V,{children:ot()})]})}),(0,Z.jsx)(Ut,{children:o.flatMap(e=>{let t=Ct(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)(z,{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,l.length>0?(0,Z.jsxs)(Mt,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(jt,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(At,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):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:ae(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,h({build:t.buildVersion??`?`})]}):null,` · `,Te(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ce()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(St,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(j,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ve():l===`gateways_unreachable`?ft({count:u.length}):c?g():be({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,o({time:f})]}),m?(0,Z.jsx)(`span`,{children:oe({time:m})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:me({names:u.join(`, `)})}):null,c?(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:v()})]})}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)),[p,m]=(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)(A,{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)(z,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ne()}),(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":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),f({count:t.length})]}),p?(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:[pe(),i.length>0?(0,Z.jsx)(z,{variant:`destructive`,children:Ee({count:i.length})}):a>0?(0,Z.jsx)(z,{variant:`destructive`,children:ke()}):(0,Z.jsx)(z,{variant:`secondary`,children:je()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b({version:e.vendoredVersion}),r?` · `+et({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ie({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)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),re({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:p()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ne({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:c({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:x()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(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)(z,{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)(zt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Lt,{children:De({instance:e.displayName??e.name})}),(0,Z.jsx)(Rt,{children:Ae()})]}),(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)(St,{"aria-hidden":!0}):(0,Z.jsx)(j,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?We():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,rt()]}):null}function jn({instance:e,onClose:t}){let n=dt(T.admin.upsertInstanceConfig),r=Me(T.bridge.validateMediaPaths),i=Nt(),a=Vt(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>mt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,h]=(0,G.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Le(),e)}finally{f(!1)}}async function b(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(o,r,a)}),t()}catch(e){i.error(ee(),e)}finally{u(!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)(D,{label:tt(),help:xe()}),(0,Z.jsxs)(I,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:_t.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:ie(),help:s()}),(0,Z.jsxs)(I,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:ht.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:m(),help:se()}),(0,Z.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Ye(),help:$e()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:He(),help:ze()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Tt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:we(),help:te()})]}),v&&p!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),at({reason:p.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Ze(),result:p.inbound}),(0,Z.jsx)($,{label:Pe(),result:p.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),Xe()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?qe():st()]}),(0,Z.jsx)(L,{size:`sm`,onClick:()=>void b(),disabled:l,children:ye()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pt():he({count:e.length}),(0,Z.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(z,{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,$v as i,An as a,B as o,Cn as s,Dn as c,En as l,F as u,G as d,H as f,I as p,J as m,Jj as h,K as g,L as _,Mn as v,Nn as y,Ny as b,On as x,P as ee,Pn as S,Q as te,Qv as C,R as w,Sn as ne,Tn as T,U as E,V as D,W as re,X as ie,Xv as O,Y as ae,Yv as k,Z as oe,Zv as A,_Q as se,_n as ce,ah as le,bQ as j,bb as M,bn as ue,ch as de,dn as fe,et as pe,ey as me,fn as he,gd as ge,gn as _e,hn as ve,ih as ye,jn as be,k as xe,kn as Se,lQ as N,lh as Ce,ln as we,mb as Te,mn as Ee,nh as De,nt as Oe,ny as ke,oh as Ae,pb as je,pn as Me,q as Ne,rh as Pe,rt as Fe,ry as Ie,sh as Le,t as P,th as Re,ty as ze,uh as Be,un as Ve,vb as He,vn as Ue,wn as We,xn as Ge,yQ as F,yn as Ke,z as qe}from"./api-CWqdeSbN.js";import{t as Je}from"./use_paginated_query-CebdO_HQ.js";import{t as Ye}from"./loader-circle-BqKiW3X9.js";import{t as I}from"./checkbox-DPxJTQjc.js";import{t as Xe}from"./plus-DTL4K-j9.js";import{t as Ze}from"./triangle-alert-DoL9TI6v.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-CjcMQhwm.js";import{n as Qe,r as $e,t as et}from"./popover-C-Y_Yoco.js";import{t as H}from"./button-C_rIPtCv.js";import{t as U}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{a as tt,t as W}from"./KnobRow-D6kXWvVI.js";import{n as nt}from"./capabilities-CASxhKEd.js";import{a as rt}from"./compatView-Cz5KNXa-.js";/* empty css */import{t as it}from"./switch--NPD3Vp0.js";var at=xe(`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`}]]),G=t(e(),1),ot=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function st(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 ct=[`auto`,`hybrid`,`tool`,`off`];function lt(e){switch(e){case`auto`:return be();case`hybrid`:return a();case`tool`:return Se();default:return x()}}function K(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function ut(e){return typeof e==`string`&&ct.includes(e)}function q(e){return{injection:ut(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function dt(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function ft(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?s():pt(e)?Me():null:We(),i=q(e),a=t.injection!==i.injection||!dt(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),c=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:c,invalidReason:c?null:l()}}function pt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function mt(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 ht(e){return e.ok?null:e.code===`scope_refused`?s():e.code===`stale_default`?ne():e.code===`write_unknown`||e.code===`not_confirmed`?Ke():e.code===`not_applied`?Ue():e.code===`default_too_large`?fe():e.code===`allowlist_too_large`?he():e.code===`plugin_too_old`?Me():e.code===`source_not_allowed`?Ee():e.code===`plugin_config_lag`?ve():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?T():Ge({code:e.code})}function gt(e,t){let n=K(e),r=K(t);if(n.injection!==r.injection||!dt(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 J=n();function _t({instanceName:e,row:t,supported:n}){let r=se(P.knowledge.setAgentKnowledgeDefault),[i,a]=(0,G.useState)(t),[o,s]=(0,G.useState)(()=>q(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),h=e=>{a(e),s(q(e)),f(null)},g=gt(i,t);(0,G.useEffect)(()=>{p&&g&&(m(!1),h(t))},[p,g]);let _=ft(i,o,n),y=_.readOnlyReason===null;async function b(){u(`saving`),f(null);try{let n=ht(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:K(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(ht({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsxs)(V,{value:o.injection,onValueChange:e=>{ut(e)&&s({...o,injection:e})},disabled:!y,children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":v(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:ct.map(e=>(0,J.jsx)(B,{value:e,children:lt(e)},e))})]})}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),t.sources.map(e=>(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,J.jsx)(I,{checked:o.sources.includes(e.id),onCheckedChange:()=>s(mt(t,o,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,J.jsx)(`span`,{children:e.label})]},e.id)),g&&!p?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Ve(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:we()})]}):null,t.overridesAllowed?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ue()}),y?(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsx)(H,{size:`sm`,disabled:!_.dirty||!_.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?M():A()})}):(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:_.readOnlyReason}),y&&_.dirty&&_.invalidReason!==null?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_.invalidReason}):null,l===`done`&&d===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,d===null?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function vt({instanceName:e}){let t=j(P.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Je(P.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,J.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":S(),children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),t.supported?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:We()}),n.map(n=>(0,J.jsx)(_t,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce({shown:n.length})}),(0,J.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:_e()})]}):null]})}function Y(e){return e.displayName??e.agentId}function yt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function X(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function bt(e,t){let n=X(t);return n===``||X(Y(e)).includes(n)||X(e.agentId).includes(n)}var xt=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function Z(e,t){return xt.compare(Y(e),Y(t))||xt.compare(e.agentId,t.agentId)}function St(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(Z).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function Ct(e,t){return wt(e.length)?e.filter(e=>bt(e.agent,t)):[...e]}function wt(e){return e>8}function Q(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&bt(e,t));return[...n.filter(e=>e.enabled).sort(Z),...n.filter(e=>!e.enabled).sort(Z)]}function Tt(e){return!e}function Et(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Dt(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function Ot(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 $=e=>e?Fe():Oe();function kt(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=j(P.agents.listAgentsForInstance,{instanceName:e}),n=F(P.agents.setInstanceReasoningDefault),i=F(P.agents.setAgentReasoningDefault),[a,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(null),[d,f]=(0,G.useState)(``),[h,v]=(0,G.useState)(``),y=(0,G.useRef)(null),b=(0,G.useId)(),x=t?.showReasoningDefault===!0,S=t?.agents??[],C=(0,G.useMemo)(()=>St(S,x),[S,x]),w=Ct(C,h),ne=Q(S,``).length>0;async function T(e,t,n){s(e),l(null),f(``);try{return await t(),f(n),!0}catch{return l(e),!1}finally{s(t=>t===e?null:t)}}let E=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),_({value:$(t)})),D=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function re(e){await D(e,null,ee({agent:Y(e)}))&&y.current?.focus()}let O=a!==null;return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:pe()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),t===void 0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):S.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,J.jsx)(`label`,{htmlFor:b,className:`oc-rdefaults__default-label`,children:oe()}),(0,J.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`}):$(x)}),(0,J.jsx)(it,{id:b,checked:x,disabled:O,"aria-busy":a?.kind===`instance`,onCheckedChange:E})]}),c?.kind===`instance`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:ie({count:C.length})}),(0,J.jsx)(jt,{agents:S,instanceDefault:x,disabled:!ne,triggerRef:y,onPick:e=>{let t=Tt(x);D(e,t,p({agent:Y(e),value:$(t)}))}})]}),C.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ae()}):(0,J.jsxs)(J.Fragment,{children:[wt(C.length)?(0,J.jsx)(U,{type:`search`,value:h,onChange:e=>v(e.target.value),placeholder:o(),"aria-label":o(),className:`oc-rdefaults__filter`}):null,w.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:qe()}):(0,J.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":ie({count:C.length}),children:w.map(({agent:e,show:t,sameAsDefault:n})=>{let r=Y(e),i={kind:`agent`,agentId:e.agentId};return(0,J.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:r}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,J.jsx)(`span`,{className:`oc-rdefaults__same`,children:m()}):null]}),(0,J.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[kt(a,i)?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`,"aria-label":M()}):null,(0,J.jsx)(W,{field:`showReasoning`,ariaLabel:Ne({agent:r}),options:[{id:`on`,label:Fe()},{id:`off`,label:Oe()}],value:t?`on`:`off`,onChange:t=>void D(e,t===`on`,u({agent:r,value:$(t===`on`)})),disabled:O}),(0,J.jsx)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":g({agent:r}),title:g({agent:r}),onClick:()=>void re(e),children:(0,J.jsx)(at,{"aria-hidden":!0})})]}),kt(c,i)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:k()}):null]},e.agentId)})})]}),c?.kind===`agent`&&!C.some(e=>e.agent.agentId===c.agentId)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]}),(0,J.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:d})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),p=(0,G.useId)(),m=(0,G.useRef)(null),h=Q(e,s),g=Et(h,l),_=Q(e,``).length===0,v=e=>`${p}-opt-${e}`;function y(){o(!1),c(``),u(null)}function b(e){u(e>=0?h[e].agentId:null),e>=0&&m.current?.querySelector(`#${CSS.escape(v(e))}`)?.scrollIntoView({block:`nearest`})}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),b(Ot(g,e.key,h.length));else if(e.key===`Enter`){e.preventDefault();let t=Dt(h,l);t===null?u(null):(y(),i(t))}}return(0,J.jsxs)(et,{open:a,onOpenChange:e=>e?o(!0):y(),children:[(0,J.jsx)($e,{asChild:!0,children:(0,J.jsxs)(H,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,J.jsx)(Xe,{"aria-hidden":!0}),d()]})}),(0,J.jsxs)(Qe,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,J.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:re({value:$(Tt(t))})}),(0,J.jsx)(U,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":p,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<h.length?v(g):void 0,"aria-label":E(),placeholder:E(),value:s,onChange:e=>{c(e.target.value),u(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,J.jsx)(`div`,{id:p,ref:m,role:`listbox`,"aria-label":d(),className:`oc-rdefaults__options`,children:h.length===0?(0,J.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?D():f()}):h.map((e,t)=>(0,J.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>u(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{y(),i(e)},children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:Y(e)}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,J.jsx)(`span`,{className:`oc-rdefaults__badge`,children:w()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=j(P.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,l=i!==r;async function u(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let d=n?.agents??[];return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Le()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":Le(),children:(0,J.jsx)(L,{placeholder:le()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:c,children:le()}),d.map(e=>(0,J.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,J.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?M():A()})]}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]})}function Nt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(r===null?``:String(r)),[c,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),s(r===null?``:String(r)),l(`idle`)},[e._id,n,r]);let u=o.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=!i||d===null||Number.isInteger(d)&&d>=4e3&&d<=6e4,p=i!==n||(d??null)!==r;async function m(){l(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||d===null||Number.isNaN(d)?delete n.curationBudgetChars:n.curationBudgetChars=d,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,J.jsx)(I,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":de()}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:de()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f,"aria-label":ye(),disabled:!i}),(0,J.jsx)(H,{size:`sm`,disabled:!p||!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?M():A()})]}),f?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Pe()}),c===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,c===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:De()})]})}function Pt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,G.useState)(n===null?``:String(n)),[a,o]=(0,G.useState)(`idle`);(0,G.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,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Be()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,J.jsx)(H,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?M():A()})]}),l?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Re()}),a===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,a===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ce()})]})}function Ft(){let e=se(P.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=j(P.admin.listInstances,{}),[a,o]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[r,a]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=j(P.compat.forInstance,a?{instanceName:a}:`skip`),u=a?nt(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,G.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),p=(0,G.useRef)(0),m=(0,G.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=st(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,G.useEffect)(()=>{d===!1&&(s&&!a||m())},[m,d,s,a]);let g=t.status===`done`?t.current:null,_=(0,G.useMemo)(()=>ot.map(e=>({id:e,label:tt(e)})),[]),v=(0,G.useMemo)(()=>[{id:`fast`,label:Te()},{id:`standard`,label:je()}],[]);return(0,J.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}),s&&a?(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,"aria-label":b(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:(r??[]).map(e=>(0,J.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):u===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):u.blocked?(0,J.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,J.jsx)(Ze,{size:14,"aria-hidden":!0}),` `,rt(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):t.status===`error`?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:He()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ke()}),(0,J.jsx)(W,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:ke()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ze()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:me()}),(0,J.jsx)(W,{field:`fastMode`,options:v,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:me()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:ge()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pt,{instance:e}),(0,J.jsx)(Nt,{instance:e}),(0,J.jsx)(Mt,{instance:e}),(0,J.jsx)(At,{instanceName:e.name}),(0,J.jsx)(vt,{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,$v as i,An as a,B as o,Cn as s,Dn as c,En as l,F as u,G as d,H as f,I as p,J as m,Jj as h,K as g,L as _,Mn as v,Nn as y,Ny as b,On as x,P as ee,Pn as S,Q as te,Qv as C,R as w,Sn as ne,Tn as T,U as E,V as D,W as re,X as ie,Xv as O,Y as ae,Yv as k,Z as oe,Zv as A,_Q as se,_n as ce,ah as le,bQ as j,bb as M,bn as ue,ch as de,dn as fe,et as pe,ey as me,fn as he,gd as ge,gn as _e,hn as ve,ih as ye,jn as be,k as xe,kn as Se,lQ as N,lh as Ce,ln as we,mb as Te,mn as Ee,nh as De,nt as Oe,ny as ke,oh as Ae,pb as je,pn as Me,q as Ne,rh as Pe,rt as Fe,ry as Ie,sh as Le,t as P,th as Re,ty as ze,uh as Be,un as Ve,vb as He,vn as Ue,wn as We,xn as Ge,yQ as F,yn as Ke,z as qe}from"./api-D64JTta1.js";import{t as Je}from"./use_paginated_query-C-Aw4n8b.js";import{t as Ye}from"./loader-circle-1XN8tjq6.js";import{t as I}from"./checkbox-BuTZzFvU.js";import{t as Xe}from"./plus-DrzxZ4iS.js";import{t as Ze}from"./triangle-alert-nUld87-H.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-wXM6h61N.js";import{n as Qe,r as $e,t as et}from"./popover-UJtu3EZ6.js";import{t as H}from"./button-DeHzYOzP.js";import{t as U}from"./input-CZ0jp9Rx.js";import"./convexApi-DxRiI80M.js";import{a as tt,t as W}from"./KnobRow-4WODwFrS.js";import{n as nt}from"./capabilities-CASxhKEd.js";import{a as rt}from"./compatView-Db657dNx.js";/* empty css */import{t as it}from"./switch-Beq0wUQ_.js";var at=xe(`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`}]]),G=t(e(),1),ot=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function st(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 ct=[`auto`,`hybrid`,`tool`,`off`];function lt(e){switch(e){case`auto`:return be();case`hybrid`:return a();case`tool`:return Se();default:return x()}}function K(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function ut(e){return typeof e==`string`&&ct.includes(e)}function q(e){return{injection:ut(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function dt(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function ft(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?s():pt(e)?Me():null:We(),i=q(e),a=t.injection!==i.injection||!dt(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),c=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:c,invalidReason:c?null:l()}}function pt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function mt(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 ht(e){return e.ok?null:e.code===`scope_refused`?s():e.code===`stale_default`?ne():e.code===`write_unknown`||e.code===`not_confirmed`?Ke():e.code===`not_applied`?Ue():e.code===`default_too_large`?fe():e.code===`allowlist_too_large`?he():e.code===`plugin_too_old`?Me():e.code===`source_not_allowed`?Ee():e.code===`plugin_config_lag`?ve():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?T():Ge({code:e.code})}function gt(e,t){let n=K(e),r=K(t);if(n.injection!==r.injection||!dt(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 J=n();function _t({instanceName:e,row:t,supported:n}){let r=se(P.knowledge.setAgentKnowledgeDefault),[i,a]=(0,G.useState)(t),[o,s]=(0,G.useState)(()=>q(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),h=e=>{a(e),s(q(e)),f(null)},g=gt(i,t);(0,G.useEffect)(()=>{p&&g&&(m(!1),h(t))},[p,g]);let _=ft(i,o,n),y=_.readOnlyReason===null;async function b(){u(`saving`),f(null);try{let n=ht(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:K(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(ht({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsxs)(V,{value:o.injection,onValueChange:e=>{ut(e)&&s({...o,injection:e})},disabled:!y,children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":v(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:ct.map(e=>(0,J.jsx)(B,{value:e,children:lt(e)},e))})]})}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),t.sources.map(e=>(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,J.jsx)(I,{checked:o.sources.includes(e.id),onCheckedChange:()=>s(mt(t,o,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,J.jsx)(`span`,{children:e.label})]},e.id)),g&&!p?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Ve(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:we()})]}):null,t.overridesAllowed?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ue()}),y?(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsx)(H,{size:`sm`,disabled:!_.dirty||!_.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?M():A()})}):(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:_.readOnlyReason}),y&&_.dirty&&_.invalidReason!==null?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_.invalidReason}):null,l===`done`&&d===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,d===null?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function vt({instanceName:e}){let t=j(P.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Je(P.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,J.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":S(),children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),t.supported?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:We()}),n.map(n=>(0,J.jsx)(_t,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce({shown:n.length})}),(0,J.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:_e()})]}):null]})}function Y(e){return e.displayName??e.agentId}function yt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function X(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function bt(e,t){let n=X(t);return n===``||X(Y(e)).includes(n)||X(e.agentId).includes(n)}var xt=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function Z(e,t){return xt.compare(Y(e),Y(t))||xt.compare(e.agentId,t.agentId)}function St(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(Z).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function Ct(e,t){return wt(e.length)?e.filter(e=>bt(e.agent,t)):[...e]}function wt(e){return e>8}function Q(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&bt(e,t));return[...n.filter(e=>e.enabled).sort(Z),...n.filter(e=>!e.enabled).sort(Z)]}function Tt(e){return!e}function Et(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Dt(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function Ot(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 $=e=>e?Fe():Oe();function kt(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=j(P.agents.listAgentsForInstance,{instanceName:e}),n=F(P.agents.setInstanceReasoningDefault),i=F(P.agents.setAgentReasoningDefault),[a,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(null),[d,f]=(0,G.useState)(``),[h,v]=(0,G.useState)(``),y=(0,G.useRef)(null),b=(0,G.useId)(),x=t?.showReasoningDefault===!0,S=t?.agents??[],C=(0,G.useMemo)(()=>St(S,x),[S,x]),w=Ct(C,h),ne=Q(S,``).length>0;async function T(e,t,n){s(e),l(null),f(``);try{return await t(),f(n),!0}catch{return l(e),!1}finally{s(t=>t===e?null:t)}}let E=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),_({value:$(t)})),D=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function re(e){await D(e,null,ee({agent:Y(e)}))&&y.current?.focus()}let O=a!==null;return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:pe()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),t===void 0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):S.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,J.jsx)(`label`,{htmlFor:b,className:`oc-rdefaults__default-label`,children:oe()}),(0,J.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`}):$(x)}),(0,J.jsx)(it,{id:b,checked:x,disabled:O,"aria-busy":a?.kind===`instance`,onCheckedChange:E})]}),c?.kind===`instance`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:ie({count:C.length})}),(0,J.jsx)(jt,{agents:S,instanceDefault:x,disabled:!ne,triggerRef:y,onPick:e=>{let t=Tt(x);D(e,t,p({agent:Y(e),value:$(t)}))}})]}),C.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ae()}):(0,J.jsxs)(J.Fragment,{children:[wt(C.length)?(0,J.jsx)(U,{type:`search`,value:h,onChange:e=>v(e.target.value),placeholder:o(),"aria-label":o(),className:`oc-rdefaults__filter`}):null,w.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:qe()}):(0,J.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":ie({count:C.length}),children:w.map(({agent:e,show:t,sameAsDefault:n})=>{let r=Y(e),i={kind:`agent`,agentId:e.agentId};return(0,J.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:r}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,J.jsx)(`span`,{className:`oc-rdefaults__same`,children:m()}):null]}),(0,J.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[kt(a,i)?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`,"aria-label":M()}):null,(0,J.jsx)(W,{field:`showReasoning`,ariaLabel:Ne({agent:r}),options:[{id:`on`,label:Fe()},{id:`off`,label:Oe()}],value:t?`on`:`off`,onChange:t=>void D(e,t===`on`,u({agent:r,value:$(t===`on`)})),disabled:O}),(0,J.jsx)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":g({agent:r}),title:g({agent:r}),onClick:()=>void re(e),children:(0,J.jsx)(at,{"aria-hidden":!0})})]}),kt(c,i)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:k()}):null]},e.agentId)})})]}),c?.kind===`agent`&&!C.some(e=>e.agent.agentId===c.agentId)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]}),(0,J.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:d})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),p=(0,G.useId)(),m=(0,G.useRef)(null),h=Q(e,s),g=Et(h,l),_=Q(e,``).length===0,v=e=>`${p}-opt-${e}`;function y(){o(!1),c(``),u(null)}function b(e){u(e>=0?h[e].agentId:null),e>=0&&m.current?.querySelector(`#${CSS.escape(v(e))}`)?.scrollIntoView({block:`nearest`})}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),b(Ot(g,e.key,h.length));else if(e.key===`Enter`){e.preventDefault();let t=Dt(h,l);t===null?u(null):(y(),i(t))}}return(0,J.jsxs)(et,{open:a,onOpenChange:e=>e?o(!0):y(),children:[(0,J.jsx)($e,{asChild:!0,children:(0,J.jsxs)(H,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,J.jsx)(Xe,{"aria-hidden":!0}),d()]})}),(0,J.jsxs)(Qe,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,J.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:re({value:$(Tt(t))})}),(0,J.jsx)(U,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":p,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<h.length?v(g):void 0,"aria-label":E(),placeholder:E(),value:s,onChange:e=>{c(e.target.value),u(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,J.jsx)(`div`,{id:p,ref:m,role:`listbox`,"aria-label":d(),className:`oc-rdefaults__options`,children:h.length===0?(0,J.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?D():f()}):h.map((e,t)=>(0,J.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>u(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{y(),i(e)},children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:Y(e)}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,J.jsx)(`span`,{className:`oc-rdefaults__badge`,children:w()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=j(P.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,l=i!==r;async function u(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let d=n?.agents??[];return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Le()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":Le(),children:(0,J.jsx)(L,{placeholder:le()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:c,children:le()}),d.map(e=>(0,J.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,J.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?M():A()})]}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]})}function Nt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(r===null?``:String(r)),[c,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),s(r===null?``:String(r)),l(`idle`)},[e._id,n,r]);let u=o.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=!i||d===null||Number.isInteger(d)&&d>=4e3&&d<=6e4,p=i!==n||(d??null)!==r;async function m(){l(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||d===null||Number.isNaN(d)?delete n.curationBudgetChars:n.curationBudgetChars=d,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,J.jsx)(I,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":de()}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:de()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f,"aria-label":ye(),disabled:!i}),(0,J.jsx)(H,{size:`sm`,disabled:!p||!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?M():A()})]}),f?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Pe()}),c===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,c===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:De()})]})}function Pt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,G.useState)(n===null?``:String(n)),[a,o]=(0,G.useState)(`idle`);(0,G.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,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Be()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,J.jsx)(H,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?M():A()})]}),l?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Re()}),a===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,a===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ce()})]})}function Ft(){let e=se(P.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=j(P.admin.listInstances,{}),[a,o]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[r,a]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=j(P.compat.forInstance,a?{instanceName:a}:`skip`),u=a?nt(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,G.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),p=(0,G.useRef)(0),m=(0,G.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=st(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,G.useEffect)(()=>{d===!1&&(s&&!a||m())},[m,d,s,a]);let g=t.status===`done`?t.current:null,_=(0,G.useMemo)(()=>ot.map(e=>({id:e,label:tt(e)})),[]),v=(0,G.useMemo)(()=>[{id:`fast`,label:Te()},{id:`standard`,label:je()}],[]);return(0,J.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}),s&&a?(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,"aria-label":b(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:(r??[]).map(e=>(0,J.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):u===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):u.blocked?(0,J.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,J.jsx)(Ze,{size:14,"aria-hidden":!0}),` `,rt(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):t.status===`error`?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:He()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ke()}),(0,J.jsx)(W,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:ke()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ze()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:me()}),(0,J.jsx)(W,{field:`fastMode`,options:v,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:me()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:ge()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pt,{instance:e}),(0,J.jsx)(Nt,{instance:e}),(0,J.jsx)(Mt,{instance:e}),(0,J.jsx)(At,{instanceName:e.name}),(0,J.jsx)(vt,{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{Bf as r,Hf as i,Uf as a,Vf as o,Wf as s,zf as c}from"./api-CWqdeSbN.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-BcJMHbhI.js";import{t as g}from"./button-C_rIPtCv.js";import{t as _}from"./input-CSZu-bVE.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-CPAskUwF.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,returnFocus:t.opts.returnFocus,...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:[o(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:c({word:F})}),` `,r()]}),(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??s()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??a()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,returnFocus:t.opts.returnFocus,...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??s()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??i()})]})]}):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{Bf as r,Hf as i,Uf as a,Vf as o,Wf as s,zf as c}from"./api-D64JTta1.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-C6NSAwQv.js";import{t as g}from"./button-DeHzYOzP.js";import{t as _}from"./input-CZ0jp9Rx.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-awuZdW9M.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,returnFocus:t.opts.returnFocus,...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:[o(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:c({word:F})}),` `,r()]}),(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??s()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??a()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,returnFocus:t.opts.returnFocus,...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??s()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??i()})]})]}):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{Gw as r,Hw as i,Jw as a,Kw as o,Uw as s,Ww as c,fQ as l,qw as u}from"./api-CWqdeSbN.js";import{r as d}from"./dist-CzmY6YrA.js";import{t as f}from"./chevron-up-B3KYmtzo.js";import{t as p}from"./chevrons-up-down-CITEfz7_.js";import{c as m,g as h,n as g,r as _,s as v,t as y}from"./dropdown-menu-BVKVjups.js";import{t as b}from"./checkbox-DPxJTQjc.js";import{t as x}from"./plus-DTL4K-j9.js";import{t as S}from"./trash-2-xhtrhYsd.js";import{t as C}from"./button-C_rIPtCv.js";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./table-rRR3TpMc.js";import{t as A}from"./useTableLayout-Cmwnuzxb.js";var j=t(e(),1);function M(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 N(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=M(i,a);return n===`asc`?c:-c})}var P=n();function F({title:e,rows:t,columns:n,rowActions:M,onAdd:F,addLabel:I=a(),bulkActions:L,emptyHint:R=u(),isExpanded:z,renderExpanded:B}){let[V,H]=(0,j.useState)(new Set),U=(0,j.useRef)(null),[W,G]=(0,j.useState)(null),K=t??[],q=W?n[W.index]:void 0,J=W&&q?.sort?N(K,q.sort,W.dir):K;function Y(e){G(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let X=+!!L+n.length+ +!!M,Z=K.length>0&&V.size===K.length,Q=V.size>0&&!Z,$=A(U,[t,W?.index,W?.dir,n.length,!!L,!!M,l()]);function ee(){H(Z?new Set:new Set(K.map(e=>e._id)))}function te(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:`oc-dt`,children:[(0,P.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,P.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,P.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[V.size>0&&L?L.map(e=>(0,P.jsxs)(C,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...V]),H(new Set)},children:[e.variant===`destructive`?(0,P.jsx)(S,{}):null,e.label,` (`,V.size,`)`]},e.label)):null,F?(0,P.jsxs)(C,{size:`sm`,onClick:F,children:[(0,P.jsx)(x,{}),` `,I]}):null]})]}),t===void 0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):K.length===0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:R}):(0,P.jsx)(`div`,{ref:U,className:`oc-tablefit`,"data-layout":$,children:(0,P.jsxs)(k,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(D,{children:[L?(0,P.jsx)(T,{className:`oc-dt__check w-8`,children:(0,P.jsx)(b,{"aria-label":r(),checked:Z?!0:Q?`indeterminate`:!1,onCheckedChange:ee})}):null,n.map((e,t)=>{let n=W?.index===t;return e.sort?(0,P.jsx)(T,{className:e.className,"aria-sort":n?W.dir===`asc`?`ascending`:`descending`:`none`,children:(0,P.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>Y(t),"aria-label":i({column:e.header}),children:[e.header,n?W.dir===`asc`?(0,P.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(p,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,P.jsx)(T,{className:e.className,children:e.header},e.header)}),M?(0,P.jsx)(T,{className:`w-8`}):null]})}),(0,P.jsx)(E,{children:J.map(e=>{let t=M?.(e)??[],r=z?.(e)??!1;return(0,P.jsxs)(j.Fragment,{children:[(0,P.jsxs)(D,{className:`oc-reveal-host group/row`,children:[L?(0,P.jsx)(O,{className:`oc-dt__check`,children:(0,P.jsx)(b,{"aria-label":c(),checked:V.has(e._id),onCheckedChange:()=>te(e._id)})}):null,n.map((t,n)=>(0,P.jsx)(O,{className:n===0?`oc-dt__lead ${t.className??``}`:t.className,"data-label":t.header,children:t.cell(e)},t.header)),M?(0,P.jsx)(O,{className:`oc-dt__actions`,children:t.length>0?(0,P.jsxs)(y,{children:[(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`oc-reveal oc-hit`,children:(0,P.jsx)(h,{})})}),(0,P.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,P.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,P.jsx)(v,{}):null,(0,P.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&B?(0,P.jsx)(D,{className:`oc-dt__expansion`,children:(0,P.jsx)(O,{colSpan:X,className:`oc-dt__expansion-cell`,children:B(e)})}):null]},e._id)})})]})})]})}export{F as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gw as r,Hw as i,Jw as a,Kw as o,Uw as s,Ww as c,fQ as l,qw as u}from"./api-D64JTta1.js";import{r as d}from"./dist-C0V3m4aH.js";import{t as f}from"./chevron-up-s_deZUWR.js";import{t as p}from"./chevrons-up-down-uk0IvxY8.js";import{c as m,g as h,n as g,r as _,s as v,t as y}from"./dropdown-menu-C5VrCGFe.js";import{t as b}from"./checkbox-BuTZzFvU.js";import{t as x}from"./plus-DrzxZ4iS.js";import{t as S}from"./trash-2-CqKGt3lC.js";import{t as C}from"./button-DeHzYOzP.js";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./table-CegX53gV.js";import{t as A}from"./useTableLayout-Cmwnuzxb.js";var j=t(e(),1);function M(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 N(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=M(i,a);return n===`asc`?c:-c})}var P=n();function F({title:e,rows:t,columns:n,rowActions:M,onAdd:F,addLabel:I=a(),bulkActions:L,emptyHint:R=u(),isExpanded:z,renderExpanded:B}){let[V,H]=(0,j.useState)(new Set),U=(0,j.useRef)(null),[W,G]=(0,j.useState)(null),K=t??[],q=W?n[W.index]:void 0,J=W&&q?.sort?N(K,q.sort,W.dir):K;function Y(e){G(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let X=+!!L+n.length+ +!!M,Z=K.length>0&&V.size===K.length,Q=V.size>0&&!Z,$=A(U,[t,W?.index,W?.dir,n.length,!!L,!!M,l()]);function ee(){H(Z?new Set:new Set(K.map(e=>e._id)))}function te(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:`oc-dt`,children:[(0,P.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,P.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,P.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[V.size>0&&L?L.map(e=>(0,P.jsxs)(C,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...V]),H(new Set)},children:[e.variant===`destructive`?(0,P.jsx)(S,{}):null,e.label,` (`,V.size,`)`]},e.label)):null,F?(0,P.jsxs)(C,{size:`sm`,onClick:F,children:[(0,P.jsx)(x,{}),` `,I]}):null]})]}),t===void 0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):K.length===0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:R}):(0,P.jsx)(`div`,{ref:U,className:`oc-tablefit`,"data-layout":$,children:(0,P.jsxs)(k,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(D,{children:[L?(0,P.jsx)(T,{className:`oc-dt__check w-8`,children:(0,P.jsx)(b,{"aria-label":r(),checked:Z?!0:Q?`indeterminate`:!1,onCheckedChange:ee})}):null,n.map((e,t)=>{let n=W?.index===t;return e.sort?(0,P.jsx)(T,{className:e.className,"aria-sort":n?W.dir===`asc`?`ascending`:`descending`:`none`,children:(0,P.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>Y(t),"aria-label":i({column:e.header}),children:[e.header,n?W.dir===`asc`?(0,P.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(p,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,P.jsx)(T,{className:e.className,children:e.header},e.header)}),M?(0,P.jsx)(T,{className:`w-8`}):null]})}),(0,P.jsx)(E,{children:J.map(e=>{let t=M?.(e)??[],r=z?.(e)??!1;return(0,P.jsxs)(j.Fragment,{children:[(0,P.jsxs)(D,{className:`oc-reveal-host group/row`,children:[L?(0,P.jsx)(O,{className:`oc-dt__check`,children:(0,P.jsx)(b,{"aria-label":c(),checked:V.has(e._id),onCheckedChange:()=>te(e._id)})}):null,n.map((t,n)=>(0,P.jsx)(O,{className:n===0?`oc-dt__lead ${t.className??``}`:t.className,"data-label":t.header,children:t.cell(e)},t.header)),M?(0,P.jsx)(O,{className:`oc-dt__actions`,children:t.length>0?(0,P.jsxs)(y,{children:[(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`oc-reveal oc-hit`,children:(0,P.jsx)(h,{})})}),(0,P.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,P.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,P.jsx)(v,{}):null,(0,P.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&B?(0,P.jsx)(D,{className:`oc-dt__expansion`,children:(0,P.jsx)(O,{colSpan:X,className:`oc-dt__expansion-cell`,children:B(e)})}):null]},e._id)})})]})})]})}export{F as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HM as t,aO as n,hO as r,mO as i,oO as a,sO as o,t as s,yQ as c}from"./api-CWqdeSbN.js";import{t as l}from"./use_paginated_query-CebdO_HQ.js";import{t as u}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{n as d}from"./ConfirmDialog-B7k0wvSi.js";import{r as f}from"./trashView-CwUC01r_.js";import{n as p,t as m}from"./trashPage-3suR6eIy.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(s.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=c(s.trash.restoreChat),b=c(s.trash.purgeChat),x=c(s.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:a(),description:n(),confirmLabel:o(),destructive:!0})&&await x({})},children:o()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:i()}):(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{HM as t,aO as n,hO as r,mO as i,oO as a,sO as o,t as s,yQ as c}from"./api-D64JTta1.js";import{t as l}from"./use_paginated_query-C-Aw4n8b.js";import{t as u}from"./button-DeHzYOzP.js";import"./convexApi-DxRiI80M.js";import{n as d}from"./ConfirmDialog-Bfi4_Ti8.js";import{r as f}from"./trashView-TIQT30u4.js";import{n as p,t as m}from"./trashPage-D9B1uAuS.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(s.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=c(s.trash.restoreChat),b=c(s.trash.purgeChat),x=c(s.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:a(),description:n(),confirmLabel:o(),destructive:!0})&&await x({})},children:o()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:i()}):(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-ChMMFtuW.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-DwWXPxwl.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{Cb as r,Ff as i,If as a,i as o,o as s}from"./api-CWqdeSbN.js";import{t as c}from"./loader-circle-BqKiW3X9.js";import{t as l}from"./x-CcIT4ync.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-Uf18yR_a.js";import{t as _}from"./button-C_rIPtCv.js";var v=t(e(),1),y=n();function b({...e}){return(0,y.jsx)(p,{"data-slot":`sheet`,...e})}function x({...e}){return(0,y.jsx)(g,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,y.jsx)(u,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,y.jsx)(d,{"data-slot":`sheet-overlay`,className:s(`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 w({className:e,overlayClassName:t,children:n,side:i=`right`,showCloseButton:a=!0,returnFocus:c,...u}){let d=o(`dialog`,c);return(0,y.jsxs)(S,{children:[(0,y.jsx)(C,{className:t}),(0,y.jsxs)(f,{"data-slot":`sheet-content`,"data-side":i,className:s(`fixed z-50 flex flex-col gap-4 overflow-y-auto 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]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full 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),...u,ref:d.ref,onCloseAutoFocus:d.onCloseAutoFocus,children:[n,a&&(0,y.jsx)(g,{"data-slot":`sheet-close`,asChild:!0,children:(0,y.jsxs)(_,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,y.jsx)(l,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:r()})]})})]})]})}function T({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-header`,className:s(`flex flex-col gap-0.5 p-4`,e),...t})}function E({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-footer`,className:s(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function D({className:e,...t}){return(0,y.jsx)(h,{"data-slot":`sheet-title`,className:s(`font-heading text-base font-medium text-foreground`,e),...t})}function O({className:e,...t}){return(0,y.jsx)(m,{"data-slot":`sheet-description`,className:s(`text-sm text-muted-foreground`,e),...t})}function k({open:e,onOpenChange:t,title:n,description:r,children:o,onSubmit:s,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,v.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await s()}finally{p(!1)}}return(0,y.jsx)(b,{open:e,onOpenChange:t,children:(0,y.jsxs)(w,{side:`right`,className:`oc-entity-sheet sm:max-w-none gap-0 p-0`,children:[(0,y.jsxs)(T,{className:`border-b px-6 py-4`,children:[(0,y.jsx)(D,{children:n}),r?(0,y.jsx)(O,{children:r}):null]}),(0,y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,y.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,y.jsxs)(E,{className:`border-t px-6 py-4`,children:[(0,y.jsxs)(_,{type:`submit`,disabled:!d||m,children:[m?(0,y.jsx)(c,{className:`size-4 animate-spin`}):null,l??a()]}),(0,y.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:i()})]})]})]})})}export{O as a,D as c,w as i,b as n,E as o,x as r,T as s,k as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cb as r,Ff as i,If as a,i as o,o as s}from"./api-D64JTta1.js";import{t as c}from"./loader-circle-1XN8tjq6.js";import{t as l}from"./x-BNU-sWkh.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-D4a9D7kU.js";import{t as _}from"./button-DeHzYOzP.js";var v=t(e(),1),y=n();function b({...e}){return(0,y.jsx)(p,{"data-slot":`sheet`,...e})}function x({...e}){return(0,y.jsx)(g,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,y.jsx)(u,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,y.jsx)(d,{"data-slot":`sheet-overlay`,className:s(`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 w({className:e,overlayClassName:t,children:n,side:i=`right`,showCloseButton:a=!0,returnFocus:c,...u}){let d=o(`dialog`,c);return(0,y.jsxs)(S,{children:[(0,y.jsx)(C,{className:t}),(0,y.jsxs)(f,{"data-slot":`sheet-content`,"data-side":i,className:s(`fixed z-50 flex flex-col gap-4 overflow-y-auto 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]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full 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),...u,ref:d.ref,onCloseAutoFocus:d.onCloseAutoFocus,children:[n,a&&(0,y.jsx)(g,{"data-slot":`sheet-close`,asChild:!0,children:(0,y.jsxs)(_,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,y.jsx)(l,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:r()})]})})]})]})}function T({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-header`,className:s(`flex flex-col gap-0.5 p-4`,e),...t})}function E({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-footer`,className:s(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function D({className:e,...t}){return(0,y.jsx)(h,{"data-slot":`sheet-title`,className:s(`font-heading text-base font-medium text-foreground`,e),...t})}function O({className:e,...t}){return(0,y.jsx)(m,{"data-slot":`sheet-description`,className:s(`text-sm text-muted-foreground`,e),...t})}function k({open:e,onOpenChange:t,title:n,description:r,children:o,onSubmit:s,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,v.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await s()}finally{p(!1)}}return(0,y.jsx)(b,{open:e,onOpenChange:t,children:(0,y.jsxs)(w,{side:`right`,className:`oc-entity-sheet sm:max-w-none gap-0 p-0`,children:[(0,y.jsxs)(T,{className:`border-b px-6 py-4`,children:[(0,y.jsx)(D,{children:n}),r?(0,y.jsx)(O,{children:r}):null]}),(0,y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,y.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,y.jsxs)(E,{className:`border-t px-6 py-4`,children:[(0,y.jsxs)(_,{type:`submit`,disabled:!d||m,children:[m?(0,y.jsx)(c,{className:`size-4 animate-spin`}):null,l??a()]}),(0,y.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:i()})]})]})]})})}export{O as a,D as c,w as i,b as n,E as o,x as r,T as s,k as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,AR as i,BR as a,Cz as o,DR as s,Dz as c,ER as l,Ez as u,FR as d,GR as f,HR as p,IR as m,JR as ee,KR as te,LR as ne,MR as re,NR as ie,OR as ae,PR as oe,QR as h,RR as se,Sz as g,TR as _,Tz as v,UR as y,VR as b,WR as x,XR as S,YR as C,ZR as w,_z as T,am as E,az as D,bQ as O,bz as k,cz as A,dz as j,ez as M,fz as N,gz as P,hz as F,iz as I,jR as L,kR as R,lz as z,mz as B,nz as ce,oz as V,pz as H,qR as U,rm as W,rz as G,sz as K,t as q,tz as le,uz as ue,vz as de,wz as fe,xz as pe,yQ as J,yz as me,zR as he}from"./api-CWqdeSbN.js";import{t as ge}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{n as _e}from"./format-AQELUhPa.js";import{n as Y}from"./ConfirmDialog-B7k0wvSi.js";import{t as ve}from"./DataTableShell-DvtkASQG.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>c(),incorrect:()=>u(),incoherence:()=>v(),formatting:()=>fe(),latency:()=>o(),api_error:()=>g(),other:()=>pe()},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:me()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=J(q.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${T()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:f(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?B():e.authorRole===`agent`?e.authorLabel??E():H()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:j(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 p(),disabled:!c.trim()||u,children:u?ue():z()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||K()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||K()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I({count:i.contextCount??m.length,truncated:i.contextTruncated?G():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?r({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,w()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=O(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=Y(),[o,c]=(0,X.useState)(null),[u,f]=(0,X.useState)({});async function h(e){if(o===e._id){c(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}c(e._id)}async function g(e){await r({title:s(),description:l(),confirmLabel:_(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,ee()]}),(0,Z.jsx)(ve,{title:U(),rows:e,emptyHint:te(),isExpanded:e=>o===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:x(),cell:e=>_e(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?b():a(),sort:e=>e.messageRole},{header:he(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${se({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ne(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:m(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:W()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:re()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?i():R(),onSelect:()=>void h(e)},{label:ae(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,AR as i,BR as a,Cz as o,DR as s,Dz as c,ER as l,Ez as u,FR as d,GR as f,HR as p,IR as m,JR as ee,KR as te,LR as ne,MR as re,NR as ie,OR as ae,PR as oe,QR as h,RR as se,Sz as g,TR as _,Tz as v,UR as y,VR as b,WR as x,XR as S,YR as C,ZR as w,_z as T,am as E,az as D,bQ as O,bz as k,cz as A,dz as j,ez as M,fz as N,gz as P,hz as F,iz as I,jR as L,kR as R,lz as z,mz as B,nz as ce,oz as V,pz as H,qR as U,rm as W,rz as G,sz as K,t as q,tz as le,uz as ue,vz as de,wz as fe,xz as pe,yQ as J,yz as me,zR as he}from"./api-D64JTta1.js";import{t as ge}from"./button-DeHzYOzP.js";import"./convexApi-DxRiI80M.js";import{n as _e}from"./format-g5Z3Txjl.js";import{n as Y}from"./ConfirmDialog-Bfi4_Ti8.js";import{t as ve}from"./DataTableShell-1ZsZ0a2J.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>c(),incorrect:()=>u(),incoherence:()=>v(),formatting:()=>fe(),latency:()=>o(),api_error:()=>g(),other:()=>pe()},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:me()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=J(q.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${T()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:f(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?B():e.authorRole===`agent`?e.authorLabel??E():H()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:j(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 p(),disabled:!c.trim()||u,children:u?ue():z()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||K()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||K()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I({count:i.contextCount??m.length,truncated:i.contextTruncated?G():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?r({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,w()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=O(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=Y(),[o,c]=(0,X.useState)(null),[u,f]=(0,X.useState)({});async function h(e){if(o===e._id){c(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}c(e._id)}async function g(e){await r({title:s(),description:l(),confirmLabel:_(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,ee()]}),(0,Z.jsx)(ve,{title:U(),rows:e,emptyHint:te(),isExpanded:e=>o===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:x(),cell:e=>_e(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?b():a(),sort:e=>e.messageRole},{header:he(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${se({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ne(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:m(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:W()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:re()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?i():R(),onSelect:()=>void h(e)},{label:ae(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{DQ as t,k as n}from"./api-CWqdeSbN.js";import{c as r,i,l as a,n as o,r as s,s as c,t as l}from"./tooltip-Ct0TGxtk.js";import{n as u,r as d,t as f}from"./popover-C-Y_Yoco.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var p=Object.defineProperty,m=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t,n)=>m(e,typeof t==`symbol`?t:t+``,n),g=`https://docs.convex.dev/error#undefined-validator`;function _(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 ${g} for details.`)}var v=class{constructor({isOptional:e}){h(this,`type`),h(this,`fieldPaths`),h(this,`isOptional`),h(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},y=class e extends v{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),h(this,`tableName`),h(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})}},b=class e extends v{constructor(){super(...arguments),h(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends v{constructor(){super(...arguments),h(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends v{constructor(){super(...arguments),h(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends v{constructor(){super(...arguments),h(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},w=class e extends v{constructor(){super(...arguments),h(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},T=class e extends v{constructor(){super(...arguments),h(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},E=class e extends v{constructor(){super(...arguments),h(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},D=class e extends v{constructor({isOptional:e,fields:t}){super({isOptional:e}),h(this,`fields`),h(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&_(`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}})}},O=class e extends v{constructor({isOptional:e,value:t}){if(super({isOptional:e}),h(this,`value`),h(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:t(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},k=class e extends v{constructor({isOptional:e,element:t}){super({isOptional:e}),h(this,`element`),h(this,`kind`,`array`),t===void 0&&_(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},A=class e extends v{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),h(this,`key`),h(this,`value`),h(this,`kind`,`record`),t===void 0&&_(`v.record()`,`key`),n===void 0&&_(`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})}},j=class e extends v{constructor({isOptional:e,members:t}){super({isOptional:e}),h(this,`members`),h(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&_(`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})}},M={id:e=>new y({isOptional:`required`,tableName:e}),null:()=>new T({isOptional:`required`}),number:()=>new b({isOptional:`required`}),float64:()=>new b({isOptional:`required`}),bigint:()=>new x({isOptional:`required`}),int64:()=>new x({isOptional:`required`}),boolean:()=>new S({isOptional:`required`}),string:()=>new w({isOptional:`required`}),bytes:()=>new C({isOptional:`required`}),literal:e=>new O({isOptional:`required`,value:e}),array:e=>new k({isOptional:`required`,element:e}),object:e=>new D({isOptional:`required`,fields:e}),record:(e,t)=>new A({isOptional:`required`,key:e,value:t}),union:(...e)=>new j({isOptional:`required`,members:e}),any:()=>new E({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>M.union(e,M.null())},N=n(`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`}]]),P=[`gateway-http`,`shared-fs`,`off`],F=[`inline`,`shared-fs`],I=[`reactive`,`sse`],L=`reactive`;M.object({mediaMode:M.optional(M.union(M.literal(`gateway-http`),M.literal(`shared-fs`),M.literal(`off`))),inboundMediaMode:M.optional(M.union(M.literal(`inline`),M.literal(`shared-fs`))),rehydration:M.optional(M.boolean()),mediaMaxMb:M.optional(M.number()),attachmentFixAttested:M.optional(M.boolean()),summarizeThresholdChars:M.optional(M.number()),curationEnabled:M.optional(M.boolean()),curationBudgetChars:M.optional(M.number()),converterAgentId:M.optional(M.string()),voiceEnabled:M.optional(M.boolean()),talkEnabled:M.optional(M.boolean()),widgetsEnabled:M.optional(M.boolean()),widgetPromptConfirm:M.optional(M.boolean()),voiceEngine:M.optional(M.union(M.literal(`browser`),M.literal(`gateway`))),voiceLang:M.optional(M.string()),voiceRate:M.optional(M.number()),voiceAutoRead:M.optional(M.boolean()),contentLocale:M.optional(M.string()),inboundAgentMount:M.optional(M.string()),outboundAgentMount:M.optional(M.string()),transcriptProjection:M.optional(M.union(M.literal(`off`),M.literal(`shadow`),M.literal(`on`))),promptInjections:M.optional(M.record(M.string(),M.object({enabled:M.optional(M.boolean()),template:M.optional(M.string())})))});var R={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function z(e,t){let n={};for(let i of a){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 B(e,t){let n={};for(let i of a){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 V(e,t){return{mediaMode:e.mediaMode??R.mediaMode,inboundMediaMode:e.inboundMediaMode??R.inboundMediaMode,rehydration:e.rehydration??R.rehydration,mediaMaxMb:e.mediaMaxMb??R.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??R.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??R.outboundAgentMount,promptInjections:z(e.promptInjections,t)}}var H=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function U(e,t,n){let r={},i=n=>{(e[n]!==R[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=B(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of H){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var W=e();function G({text:e}){return c()?(0,W.jsxs)(f,{children:[(0,W.jsx)(d,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help oc-hit`,"aria-label":e,children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(u,{className:`oc-fieldhelp w-auto p-3 text-sm text-pretty`,children:e})]}):(0,W.jsx)(s,{delayDuration:150,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(i,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(o,{className:`max-w-xs text-pretty`,children:e})]})})}function K({label:e,help:t}){return(0,W.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,W.jsx)(G,{text:t})]})}export{L as a,I as c,V as i,K as n,F as o,U as r,P as s,G as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{DQ as t,k as n}from"./api-D64JTta1.js";import{c as r,i,l as a,n as o,r as s,s as c,t as l}from"./tooltip-Dpar43UD.js";import{n as u,r as d,t as f}from"./popover-UJtu3EZ6.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var p=Object.defineProperty,m=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t,n)=>m(e,typeof t==`symbol`?t:t+``,n),g=`https://docs.convex.dev/error#undefined-validator`;function _(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 ${g} for details.`)}var v=class{constructor({isOptional:e}){h(this,`type`),h(this,`fieldPaths`),h(this,`isOptional`),h(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},y=class e extends v{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),h(this,`tableName`),h(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})}},b=class e extends v{constructor(){super(...arguments),h(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends v{constructor(){super(...arguments),h(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends v{constructor(){super(...arguments),h(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends v{constructor(){super(...arguments),h(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},w=class e extends v{constructor(){super(...arguments),h(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},T=class e extends v{constructor(){super(...arguments),h(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},E=class e extends v{constructor(){super(...arguments),h(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},D=class e extends v{constructor({isOptional:e,fields:t}){super({isOptional:e}),h(this,`fields`),h(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&_(`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}})}},O=class e extends v{constructor({isOptional:e,value:t}){if(super({isOptional:e}),h(this,`value`),h(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:t(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},k=class e extends v{constructor({isOptional:e,element:t}){super({isOptional:e}),h(this,`element`),h(this,`kind`,`array`),t===void 0&&_(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},A=class e extends v{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),h(this,`key`),h(this,`value`),h(this,`kind`,`record`),t===void 0&&_(`v.record()`,`key`),n===void 0&&_(`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})}},j=class e extends v{constructor({isOptional:e,members:t}){super({isOptional:e}),h(this,`members`),h(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&_(`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})}},M={id:e=>new y({isOptional:`required`,tableName:e}),null:()=>new T({isOptional:`required`}),number:()=>new b({isOptional:`required`}),float64:()=>new b({isOptional:`required`}),bigint:()=>new x({isOptional:`required`}),int64:()=>new x({isOptional:`required`}),boolean:()=>new S({isOptional:`required`}),string:()=>new w({isOptional:`required`}),bytes:()=>new C({isOptional:`required`}),literal:e=>new O({isOptional:`required`,value:e}),array:e=>new k({isOptional:`required`,element:e}),object:e=>new D({isOptional:`required`,fields:e}),record:(e,t)=>new A({isOptional:`required`,key:e,value:t}),union:(...e)=>new j({isOptional:`required`,members:e}),any:()=>new E({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>M.union(e,M.null())},N=n(`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`}]]),P=[`gateway-http`,`shared-fs`,`off`],F=[`inline`,`shared-fs`],I=[`reactive`,`sse`],L=`reactive`;M.object({mediaMode:M.optional(M.union(M.literal(`gateway-http`),M.literal(`shared-fs`),M.literal(`off`))),inboundMediaMode:M.optional(M.union(M.literal(`inline`),M.literal(`shared-fs`))),rehydration:M.optional(M.boolean()),mediaMaxMb:M.optional(M.number()),attachmentFixAttested:M.optional(M.boolean()),summarizeThresholdChars:M.optional(M.number()),curationEnabled:M.optional(M.boolean()),curationBudgetChars:M.optional(M.number()),converterAgentId:M.optional(M.string()),voiceEnabled:M.optional(M.boolean()),talkEnabled:M.optional(M.boolean()),widgetsEnabled:M.optional(M.boolean()),widgetPromptConfirm:M.optional(M.boolean()),voiceEngine:M.optional(M.union(M.literal(`browser`),M.literal(`gateway`))),voiceLang:M.optional(M.string()),voiceRate:M.optional(M.number()),voiceAutoRead:M.optional(M.boolean()),contentLocale:M.optional(M.string()),inboundAgentMount:M.optional(M.string()),outboundAgentMount:M.optional(M.string()),transcriptProjection:M.optional(M.union(M.literal(`off`),M.literal(`shadow`),M.literal(`on`))),promptInjections:M.optional(M.record(M.string(),M.object({enabled:M.optional(M.boolean()),template:M.optional(M.string())})))});var R={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function z(e,t){let n={};for(let i of a){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 B(e,t){let n={};for(let i of a){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 V(e,t){return{mediaMode:e.mediaMode??R.mediaMode,inboundMediaMode:e.inboundMediaMode??R.inboundMediaMode,rehydration:e.rehydration??R.rehydration,mediaMaxMb:e.mediaMaxMb??R.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??R.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??R.outboundAgentMount,promptInjections:z(e.promptInjections,t)}}var H=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function U(e,t,n){let r={},i=n=>{(e[n]!==R[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=B(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of H){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var W=e();function G({text:e}){return c()?(0,W.jsxs)(f,{children:[(0,W.jsx)(d,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help oc-hit`,"aria-label":e,children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(u,{className:`oc-fieldhelp w-auto p-3 text-sm text-pretty`,children:e})]}):(0,W.jsx)(s,{delayDuration:150,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(i,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(o,{className:`max-w-xs text-pretty`,children:e})]})})}function K({label:e,help:t}){return(0,W.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,W.jsx)(G,{text:t})]})}export{L as a,I as c,V as i,K as n,F as o,U as r,P as s,G as t};