@xopcai/xopc 0.0.441 → 0.0.442

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 (375) hide show
  1. package/README.md +2 -3
  2. package/README.zh-CN.md +1 -2
  3. package/dist/browser-ext/_locales/en/messages.json +0 -28
  4. package/dist/browser-ext/_locales/zh_CN/messages.json +0 -28
  5. package/dist/browser-ext/dist/assets/{sidepanel-CQeQB5vW.css → sidepanel-lpBGVKwZ.css} +0 -42
  6. package/dist/browser-ext/dist/background.js +247 -647
  7. package/dist/browser-ext/dist/sidepanel.html +2 -2
  8. package/dist/browser-ext/dist/sidepanel.js +105 -346
  9. package/dist/browser-ext/manifest.json +1 -1
  10. package/dist/extensions/telegram/xopc.extension.json +1 -1
  11. package/dist/gateway/static/root/assets/{activity-store-t5c6XavH.js → activity-store-CuPXAoLe.js} +1 -1
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CSTtf3RI.js → agent-avatar-dicebear-D92uHOFV.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-avatar-display-Cm0afn_O.js → agent-avatar-display-DINzeGs0.js} +2 -2
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BMbsLf16.js → agent-defaults-settings-panel-Chneosh4.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DofyWKnP.js → agent-plugin-dialog-B2vXlrDW.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-CAqwtADW.js → agents-DKfOY5z9.js} +3 -3
  17. package/dist/gateway/static/root/assets/{agents-admin-api-CewiIx4v.js → agents-admin-api-DPLtjJtX.js} +1 -1
  18. package/dist/gateway/static/root/assets/{api-CE6gdBWx.js → api-CEzBruRJ.js} +1 -1
  19. package/dist/gateway/static/root/assets/{api-DRyQFk9q.js → api-ClZ7BrD4.js} +1 -1
  20. package/dist/gateway/static/root/assets/app-link-CdD448kS.js +1 -0
  21. package/dist/gateway/static/root/assets/{app-management-settings-panel-BZfs2ydm.js → app-management-settings-panel-CONwDpqL.js} +1 -1
  22. package/dist/gateway/static/root/assets/{appearance-settings-BA7spRv6.js → appearance-settings-Bu7K-_ri.js} +1 -1
  23. package/dist/gateway/static/root/assets/{apps-page-B0qorxfq.js → apps-page-CBLj-m2k.js} +1 -1
  24. package/dist/gateway/static/root/assets/{archive-plugin-CPCI6nqQ.js → archive-plugin-CfLz9o-2.js} +1 -1
  25. package/dist/gateway/static/root/assets/{automation-api-paBg5ie6.js → automation-api-Dl9fi8t0.js} +1 -1
  26. package/dist/gateway/static/root/assets/{automation-result-state-Ds-59DdX.js → automation-result-state-BjjZCxee.js} +1 -1
  27. package/dist/gateway/static/root/assets/{automation-run-list-Crw5qn_I.js → automation-run-list-9IPHu_UC.js} +1 -1
  28. package/dist/gateway/static/root/assets/automation-task-card-DLg-LYCm.js +3 -0
  29. package/dist/gateway/static/root/assets/{automations-page-D3Cb5vfR.js → automations-page-CYngiwxI.js} +1 -1
  30. package/dist/gateway/static/root/assets/automations-workspace-zyhyqSdH.js +9 -0
  31. package/dist/gateway/static/root/assets/{binary-plugins-CFJCUpWH.js → binary-plugins-Bv4ixxo4.js} +1 -1
  32. package/dist/gateway/static/root/assets/{block-editor-DbG2QKd0.js → block-editor-CtaJSB9U.js} +1 -1
  33. package/dist/gateway/static/root/assets/browser-settings-page-CmBsnx24.js +8 -0
  34. package/dist/gateway/static/root/assets/capabilities-BpYi2fQO.js +1 -0
  35. package/dist/gateway/static/root/assets/{capabilities-DG0ckPuF.js → capabilities-oWWLfwf3.js} +1 -1
  36. package/dist/gateway/static/root/assets/capabilities-page-Dlgwv1dI.js +2 -0
  37. package/dist/gateway/static/root/assets/capabilities-settings-panel-CslXPIs8.js +8 -0
  38. package/dist/gateway/static/root/assets/capability-icon-CmvCZOJX.js +1 -0
  39. package/dist/gateway/static/root/assets/{capability-links-DeO34GIF.js → capability-links-MZdYfPKx.js} +1 -1
  40. package/dist/gateway/static/root/assets/{channels-OiT-5N_6.js → channels-P-xOLYBz.js} +1 -1
  41. package/dist/gateway/static/root/assets/{chat-agents-api-CTL8cwNk.js → chat-agents-api-BOB3dILf.js} +1 -1
  42. package/dist/gateway/static/root/assets/{chat-chart-block-Z41MRuzh.js → chat-chart-block-DsaCatBN.js} +1 -1
  43. package/dist/gateway/static/root/assets/chat-page-Cen4dGHa.js +72 -0
  44. package/dist/gateway/static/root/assets/{chat-terminal-dock-CEaFlZEs.js → chat-terminal-dock-DTQL2DBu.js} +1 -1
  45. package/dist/gateway/static/root/assets/{command-palette-api-C3G6veE2.js → command-palette-api-Cj0_7g9o.js} +1 -1
  46. package/dist/gateway/static/root/assets/{composer-payload-handoff-Ccq_KF1W.js → composer-payload-handoff-B1GFVFK_.js} +1 -1
  47. package/dist/gateway/static/root/assets/{computer-settings-page-CTkICYyM.js → computer-settings-page-DJ9BIOHC.js} +1 -1
  48. package/dist/gateway/static/root/assets/connected-providers-grid-sULM6YyQ.js +1 -0
  49. package/dist/gateway/static/root/assets/connection-usage-BhdQRWgQ.js +1 -0
  50. package/dist/gateway/static/root/assets/connection-usage-guide-bD1sKiAp.js +1 -0
  51. package/dist/gateway/static/root/assets/{connector-service-page-C6yeCQWW.js → connector-service-page-BEq3i3Vi.js} +1 -1
  52. package/dist/gateway/static/root/assets/{connectors-api-HFW1Iey5.js → connectors-api-DEExP6a7.js} +1 -1
  53. package/dist/gateway/static/root/assets/connectors-page-DN9BOiFk.js +1 -0
  54. package/dist/gateway/static/root/assets/{date-picker-C_tweuM0.js → date-picker-D2whl8Ci.js} +1 -1
  55. package/dist/gateway/static/root/assets/{desktop-pet-narrative-ChwjpnsG.js → desktop-pet-narrative-C8zQtMcw.js} +1 -1
  56. package/dist/gateway/static/root/assets/{desktop-pet-BAX0ZLyq.js → desktop-pet-qnIdmNnH.js} +1 -1
  57. package/dist/gateway/static/root/assets/{desktop-pet-settings-BIIsWpW9.js → desktop-pet-settings-C54b1FY4.js} +1 -1
  58. package/dist/gateway/static/root/assets/{dev-view-store-D4C_zjRq.js → dev-view-store-bryv5YRw.js} +1 -1
  59. package/dist/gateway/static/root/assets/{device-pairing-wizard-ZUE6wZ1X.js → device-pairing-wizard-Du-yOxZv.js} +1 -1
  60. package/dist/gateway/static/root/assets/{directory-picker-path-field-CFb2VFW-.js → directory-picker-path-field-GsMkjw59.js} +1 -1
  61. package/dist/gateway/static/root/assets/{discussion-annotation-sync-Bd4r2auZ.js → discussion-annotation-sync-CrpDiC7J.js} +1 -1
  62. package/dist/gateway/static/root/assets/earth-C9Z4bTTG.js +1 -0
  63. package/dist/gateway/static/root/assets/{extension-debug-page-DXGpnxwM.js → extension-debug-page-D2Dhtu6H.js} +1 -1
  64. package/dist/gateway/static/root/assets/{extension-iframe-host-DTwDBQQ9.js → extension-iframe-host-Dra7k_6o.js} +1 -1
  65. package/dist/gateway/static/root/assets/{extension-marketplace-api-Q6E4x8gu.js → extension-marketplace-api-D7Av-sOf.js} +1 -1
  66. package/dist/gateway/static/root/assets/{extension-page-BVBxNzys.js → extension-page-Dd16lQg-.js} +1 -1
  67. package/dist/gateway/static/root/assets/{extension-provider-D-Fa5PU-.js → extension-provider-C4WwnCxf.js} +1 -1
  68. package/dist/gateway/static/root/assets/{extension-settings-page-ycMuOpv3.js → extension-settings-page-BHwQ2ipj.js} +1 -1
  69. package/dist/gateway/static/root/assets/{file-preview-surface-D62ph0m0.js → file-preview-surface-Dtla5oAW.js} +1 -1
  70. package/dist/gateway/static/root/assets/{gateway-config-swr-BW6eBLIt.js → gateway-config-swr-B5THNdYK.js} +1 -1
  71. package/dist/gateway/static/root/assets/{gateway-realtime-Bg4Mf7HA.js → gateway-realtime-hnEaDFaA.js} +1 -1
  72. package/dist/gateway/static/root/assets/gateway-realtime-store-ugwtyD4q.js +1 -0
  73. package/dist/gateway/static/root/assets/{gateway-restart-BzrJNB4Q.js → gateway-restart-kwv0njYq.js} +1 -1
  74. package/dist/gateway/static/root/assets/{gateway-settings-BOW90CER.js → gateway-settings-CxYPJTy8.js} +1 -1
  75. package/dist/gateway/static/root/assets/{gateway-startup-retry-DCjREMIO.js → gateway-startup-retry-CqtCJzWJ.js} +1 -1
  76. package/dist/gateway/static/root/assets/{global-defaults-api-myAmGZ2_.js → global-defaults-api-BQMdHLlp.js} +1 -1
  77. package/dist/gateway/static/root/assets/{home-page-eXW3llb0.js → home-page-D-gy9LlQ.js} +2 -2
  78. package/dist/gateway/static/root/assets/{image-generation-api-CLkuZdsz.js → image-generation-api-G3tQFhif.js} +1 -1
  79. package/dist/gateway/static/root/assets/{imports-page-BFsLQu7n.js → imports-page-BmEqiunH.js} +1 -1
  80. package/dist/gateway/static/root/assets/index-CqQZfWRQ.js +11 -0
  81. package/dist/gateway/static/root/assets/index-D7Noveui.css +1 -0
  82. package/dist/gateway/static/root/assets/{install-connector-dialog-CVjCFdly.js → install-connector-dialog-BU4l6KJv.js} +1 -1
  83. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DdZfxLQb.js → keyboard-shortcuts-settings-CtNI6i7K.js} +1 -1
  84. package/dist/gateway/static/root/assets/{local-app-workbench-page-xV9a7McI.js → local-app-workbench-page-Drbzz4Lm.js} +1 -1
  85. package/dist/gateway/static/root/assets/{local-apps-page-buwr_S_-.js → local-apps-page-DqZT5hLH.js} +1 -1
  86. package/dist/gateway/static/root/assets/{local-session-drafts-v7v7Hb6T.js → local-session-drafts-Bt_e3A8f.js} +1 -1
  87. package/dist/gateway/static/root/assets/{locale-store-DGtk-KSF.js → locale-store-Bld7_m-Q.js} +1 -1
  88. package/dist/gateway/static/root/assets/{logs-page-D_VBpYkM.js → logs-page-CzajqK40.js} +1 -1
  89. package/dist/gateway/static/root/assets/{management-settings-BlRCdUF3.js → management-settings-BgdAP0kf.js} +1 -1
  90. package/dist/gateway/static/root/assets/{markdown-view-JXJ3e1CB.js → markdown-view-B3cFKCfO.js} +1 -1
  91. package/dist/gateway/static/root/assets/markdown-view-DG8DDkEA.css +1 -0
  92. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-Vr2dpowU.js → mcp-conversation-setup-page-ZcY1nqMO.js} +1 -1
  93. package/dist/gateway/static/root/assets/{media-plugins-DcN8Y0hJ.js → media-plugins-DSOplRhW.js} +1 -1
  94. package/dist/gateway/static/root/assets/messages-CGO1P4mz.js +3 -0
  95. package/dist/gateway/static/root/assets/{model-selector-zD2x0Sn6.js → model-selector-yAKlOR3O.js} +1 -1
  96. package/dist/gateway/static/root/assets/{models-hub-cache-DtZG5bA_.js → models-hub-cache-8V-ZpAIa.js} +1 -1
  97. package/dist/gateway/static/root/assets/{note-detail-panel-CVrfF6XL.js → note-detail-panel-BQdgpm0s.js} +3 -3
  98. package/dist/gateway/static/root/assets/note-image-lightbox-BbNYW2Rw.js +1 -0
  99. package/dist/gateway/static/root/assets/notes-api-CVQqqmGI.js +1 -0
  100. package/dist/gateway/static/root/assets/{notes-page-BOCURwg6.js → notes-page-IefutMyg.js} +3 -3
  101. package/dist/gateway/static/root/assets/{oauth-api-DYNQAQBx.js → oauth-api-DGa6PTuq.js} +1 -1
  102. package/dist/gateway/static/root/assets/{oauth-provider-connect-BvV6SP0k.js → oauth-provider-connect-Bc-KLH1e.js} +1 -1
  103. package/dist/gateway/static/root/assets/{page-context-capture-button-Dor5Y5Bf.js → page-context-capture-button-DDmLslYG.js} +1 -1
  104. package/dist/gateway/static/root/assets/{page-context-draft-B8DQ5lNT.js → page-context-draft-GveHK8e2.js} +1 -1
  105. package/dist/gateway/static/root/assets/page-header-store-YZfSLNTg.js +1 -0
  106. package/dist/gateway/static/root/assets/palette-CDI0VweW.js +1 -0
  107. package/dist/gateway/static/root/assets/{personal-avatar-CF6T0aTT.js → personal-avatar-Cu8lGBXZ.js} +1 -1
  108. package/dist/gateway/static/root/assets/personal-page-DkrDSJqk.js +1 -0
  109. package/dist/gateway/static/root/assets/{personal-settings-panel-BrQ94X_A.js → personal-settings-panel-awr10jTV.js} +1 -1
  110. package/dist/gateway/static/root/assets/{phone-dependencies-card-Zvbw-N0D.js → phone-dependencies-card-CAxn3usD.js} +1 -1
  111. package/dist/gateway/static/root/assets/{phone-model-connection-CQ4PhhE5.js → phone-model-connection-BBG3LxRP.js} +1 -1
  112. package/dist/gateway/static/root/assets/{phone-model-picker-BDBtemUm.js → phone-model-picker-CfPjKpnd.js} +1 -1
  113. package/dist/gateway/static/root/assets/{phone-settings-page-D2KXWcg1.js → phone-settings-page-C4dJdwRW.js} +1 -1
  114. package/dist/gateway/static/root/assets/{phone-workspace-store-BhJAeHdQ.js → phone-workspace-store-BKltFHtG.js} +1 -1
  115. package/dist/gateway/static/root/assets/{plugin-details-dialog-DpPtI0sI.js → plugin-details-dialog-BqcFfZFH.js} +1 -1
  116. package/dist/gateway/static/root/assets/{popover-select-CEMWIrtY.js → popover-select-CLsphyzA.js} +1 -1
  117. package/dist/gateway/static/root/assets/{preference-select-fields-Bx26yGRF.js → preference-select-fields-QlyIA8ve.js} +1 -1
  118. package/dist/gateway/static/root/assets/product-automation-feedback-CRsfuAXl.js +7 -0
  119. package/dist/gateway/static/root/assets/product-navigation-Dp-adLY_.js +1 -0
  120. package/dist/gateway/static/root/assets/{product-open-page-DSWELoz0.js → product-open-page-CQ4dk-_l.js} +1 -1
  121. package/dist/gateway/static/root/assets/{product-preview-content-DJb-OtMo.js → product-preview-content-COU6H_jO.js} +1 -1
  122. package/dist/gateway/static/root/assets/{product-preview-modal-DaQhXcev.js → product-preview-modal-Ct5q4tv6.js} +2 -2
  123. package/dist/gateway/static/root/assets/{project-detail-page-BHLOHrat.js → project-detail-page-CQj7nm6I.js} +1 -1
  124. package/dist/gateway/static/root/assets/{project-understanding-CjhVk8l-.js → project-understanding-CU2af95r.js} +1 -1
  125. package/dist/gateway/static/root/assets/{projects-page-sVWDuzmC.js → projects-page-sWxQJrFS.js} +1 -1
  126. package/dist/gateway/static/root/assets/{providers-api-gWGsgOOf.js → providers-api-CspehmSU.js} +1 -1
  127. package/dist/gateway/static/root/assets/recording-upload-BOZAOdCI.js +1 -0
  128. package/dist/gateway/static/root/assets/{registry-api-CRxE9kFY.js → registry-api-Bdp3UUyz.js} +1 -1
  129. package/dist/gateway/static/root/assets/{remote-access-hub-Bw__qp-v.js → remote-access-hub-Bos3uwAT.js} +1 -1
  130. package/dist/gateway/static/root/assets/{resource-unavailable-BaczkGfK.js → resource-unavailable-DJR3SCy6.js} +1 -1
  131. package/dist/gateway/static/root/assets/route-preload-CDQtPdgq.js +2 -0
  132. package/dist/gateway/static/root/assets/{runtime-tools-api-ygfM5FCT.js → runtime-tools-api-DsbahxzE.js} +1 -1
  133. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BWEK7BZS.js → runtime-tools-settings-panel-DW9_OFi2.js} +1 -1
  134. package/dist/gateway/static/root/assets/{schema-form-C-jw6Hid.js → schema-form-CtRM41Re.js} +1 -1
  135. package/dist/gateway/static/root/assets/{service-recommendation-list-DrgwXSEt.js → service-recommendation-list-Bd1JDO5T.js} +1 -1
  136. package/dist/gateway/static/root/assets/{session-api-CpZ24vrQ.js → session-api-DjnHJ-0n.js} +1 -1
  137. package/dist/gateway/static/root/assets/{session-manager-CZyY5Y87.js → session-manager-Czu9GpZX.js} +1 -1
  138. package/dist/gateway/static/root/assets/{sessions-page-DgXRw0_8.js → sessions-page-CGkbbrz-.js} +1 -1
  139. package/dist/gateway/static/root/assets/settings-advanced-gate-DyGT3o1e.js +1 -0
  140. package/dist/gateway/static/root/assets/{settings-advanced-section-DmCp3OWb.js → settings-advanced-section-CM44UlF8.js} +1 -1
  141. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BTqvr_Fw.js → settings-loading-skeleton-CAoOV17i.js} +1 -1
  142. package/dist/gateway/static/root/assets/{settings-mode-store-fZ6mzf4A.js → settings-mode-store-Blc4C8aw.js} +1 -1
  143. package/dist/gateway/static/root/assets/{settings-page-header-4d1u-o-F.js → settings-page-header-BYFaTD8a.js} +1 -1
  144. package/dist/gateway/static/root/assets/{settings-page-layout-Cy9_VBag.js → settings-page-layout-CnUQSxT3.js} +1 -1
  145. package/dist/gateway/static/root/assets/{settings-page-SQwLKlTr.js → settings-page-zGjDXdHY.js} +1 -1
  146. package/dist/gateway/static/root/assets/{setup-interaction-page-OFU6DKgp.js → setup-interaction-page-DqaiLQ0I.js} +1 -1
  147. package/dist/gateway/static/root/assets/{setup-status-panel-KKAneNTe.js → setup-status-panel-iOYgfkoK.js} +1 -1
  148. package/dist/gateway/static/root/assets/{share-link-dialog-Apq3cegw.js → share-link-dialog-C_uYNUlp.js} +1 -1
  149. package/dist/gateway/static/root/assets/{share-preview-page-B6yMj5nG.js → share-preview-page-Bs3VjTGj.js} +1 -1
  150. package/dist/gateway/static/root/assets/{shares-api-Q5x_ty6F.js → shares-api-C2GDyqxP.js} +1 -1
  151. package/dist/gateway/static/root/assets/{shares-settings-vxTYg6Hp.js → shares-settings-BseSozxm.js} +1 -1
  152. package/dist/gateway/static/root/assets/skeleton-DzdOeGYz.js +1 -0
  153. package/dist/gateway/static/root/assets/{skill-api-CBFXDh9m.js → skill-api-BnpTSZGc.js} +1 -1
  154. package/dist/gateway/static/root/assets/{skill-list-api-C8tm-XxH.js → skill-list-api-7MY9ewiu.js} +1 -1
  155. package/dist/gateway/static/root/assets/{skill-reload-api-B-4Yj46U.js → skill-reload-api-DkDpu3Wd.js} +1 -1
  156. package/dist/gateway/static/root/assets/skills-page-sL2kGqHZ.js +2 -0
  157. package/dist/gateway/static/root/assets/{system-settings-panel-a4mBz4J2.js → system-settings-panel-BltKPJdb.js} +1 -1
  158. package/dist/gateway/static/root/assets/{task-detail-page-B9akf3i8.js → task-detail-page-CwMpmFVS.js} +1 -1
  159. package/dist/gateway/static/root/assets/{task-result-evidence-DFiu5SlL.js → task-result-evidence-BNhYqUAa.js} +1 -1
  160. package/dist/gateway/static/root/assets/{terminal-panel-store-BdOlpRkY.js → terminal-panel-store-DUEJoa1M.js} +1 -1
  161. package/dist/gateway/static/root/assets/{theme-store-D58tk8pq.js → theme-store-DsvYj7Vy.js} +1 -1
  162. package/dist/gateway/static/root/assets/tool-friendly-title-DEGpbye4.js +1 -0
  163. package/dist/gateway/static/root/assets/{tracing-settings-page-CO0-AiCl.js → tracing-settings-page-CMtFem_g.js} +1 -1
  164. package/dist/gateway/static/root/assets/{tunnel-api-DVRX9yW6.js → tunnel-api-B6BhWTh3.js} +1 -1
  165. package/dist/gateway/static/root/assets/{understanding-activity-store-B_-648uj.js → understanding-activity-store-B7rFXhDk.js} +1 -1
  166. package/dist/gateway/static/root/assets/{understanding-refresh-store-BXJ-kwzq.js → understanding-refresh-store-DCFASve5.js} +1 -1
  167. package/dist/gateway/static/root/assets/{usage-page-C76JnWR8.js → usage-page-BO2OFCoA.js} +1 -1
  168. package/dist/gateway/static/root/assets/{use-autosave-xytwr7Lc.js → use-autosave-DsqcLHV9.js} +1 -1
  169. package/dist/gateway/static/root/assets/use-composer-attachments-DA6SxZPQ.js +2 -0
  170. package/dist/gateway/static/root/assets/use-file-preview-expanded-g4SwMHbx.js +2 -0
  171. package/dist/gateway/static/root/assets/{use-personal-profile-BXHU0P8I.js → use-personal-profile-T2e6P5Ed.js} +1 -1
  172. package/dist/gateway/static/root/assets/{use-workspace-tree-CiLbOQHQ.js → use-workspace-tree-DG5ZMfaY.js} +1 -1
  173. package/dist/gateway/static/root/assets/user-model-page-B5_01fi_.js +2 -0
  174. package/dist/gateway/static/root/assets/{voice-api-key-field-Dn092u0X.js → voice-api-key-field-D7NPAc1E.js} +1 -1
  175. package/dist/gateway/static/root/assets/voice-call-context-CJ1ZiJWR.js +1 -0
  176. package/dist/gateway/static/root/assets/{voice-config-api-fqUzP-ZY.js → voice-config-api-UQDTh6hh.js} +1 -1
  177. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-D7QdPeuj.js → voice-input-shortcut-events-SD2gZVg8.js} +1 -1
  178. package/dist/gateway/static/root/assets/{voice-transcribe-api-NpNY_gsE.js → voice-transcribe-api-Cc92OabY.js} +1 -1
  179. package/dist/gateway/static/root/assets/{work-discovery-overlay-BARpCMZl.js → work-discovery-overlay-B41GOFXh.js} +1 -1
  180. package/dist/gateway/static/root/assets/{work-discovery-page-p0aVb8xr.js → work-discovery-page-NNhExALx.js} +1 -1
  181. package/dist/gateway/static/root/assets/{working-directory-picker-modal-7G-6icvh.js → working-directory-picker-modal-DeNWVFFK.js} +1 -1
  182. package/dist/gateway/static/root/assets/{workspace-api-BKbezgv-.js → workspace-api-fKmmIslV.js} +2 -2
  183. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CmSYxTmk.js +1 -0
  184. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-CS8-ZbVG.js → workspace-file-preview-dialog-C_0lUEsm.js} +1 -1
  185. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BQrTy-8o.js → workspace-open-location-menu-BznuSmFZ.js} +1 -1
  186. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Bc5rXL-E.js → xopc-cloud-account-card-BlhFT1q9.js} +1 -1
  187. package/dist/gateway/static/root/index.html +95 -98
  188. package/dist/package.js +1 -1
  189. package/dist/packages/browser-control-contract/src/dom.js +79 -0
  190. package/dist/packages/browser-control-contract/src/index.js +2 -25
  191. package/dist/packages/gateway-contract/src/automations.js +0 -6
  192. package/dist/src/agent/agent-manager.d.ts +0 -1
  193. package/dist/src/agent/agent-manager.js +0 -1
  194. package/dist/src/agent/external-tools/index.d.ts +1 -1
  195. package/dist/src/agent/service.js +0 -1
  196. package/dist/src/agent/service.types.d.ts +0 -1
  197. package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
  198. package/dist/src/agent/tool-manuals/browser.js +0 -3
  199. package/dist/src/agent/tools/factory.d.ts +0 -2
  200. package/dist/src/agent/tools/factory.js +0 -2
  201. package/dist/src/agent/tools/find.d.ts +1 -1
  202. package/dist/src/agent/tools/grep.d.ts +1 -1
  203. package/dist/src/agent/tools/index.d.ts +0 -1
  204. package/dist/src/agent/tools/index.js +1 -2
  205. package/dist/src/agent/tools/metadata.d.ts +1 -1
  206. package/dist/src/auth/oauth/anthropic.d.ts +1 -7
  207. package/dist/src/auth/oauth/anthropic.js +6 -83
  208. package/dist/src/auth/oauth/index.d.ts +0 -2
  209. package/dist/src/auth/oauth/index.js +2 -6
  210. package/dist/src/auth/oauth/kimi-coding.d.ts +1 -6
  211. package/dist/src/auth/oauth/kimi-coding.js +5 -79
  212. package/dist/src/auth/oauth/openai.js +1 -1
  213. package/dist/src/auth/oauth/pi-oauth-adapter.d.ts +4 -0
  214. package/dist/src/auth/oauth/pi-oauth-adapter.js +53 -0
  215. package/dist/src/auth/oauth/registry.js +0 -9
  216. package/dist/src/automations/capabilities/write.d.ts +0 -12
  217. package/dist/src/automations/domain/defaults.d.ts +0 -1
  218. package/dist/src/automations/domain/defaults.js +2 -3
  219. package/dist/src/automations/domain/index.js +2 -2
  220. package/dist/src/automations/domain/types.d.ts +0 -26
  221. package/dist/src/automations/domain/validation.d.ts +0 -24
  222. package/dist/src/automations/domain/validation.js +0 -7
  223. package/dist/src/automations/draft/automation-draft-validator.d.ts +0 -6
  224. package/dist/src/automations/draft/automation-draft-validator.js +0 -1
  225. package/dist/src/automations/index.js +2 -2
  226. package/dist/src/automations/service/action-executor.d.ts +0 -1
  227. package/dist/src/automations/service/action-executor.js +0 -31
  228. package/dist/src/automations/service/automation-service.d.ts +0 -1
  229. package/dist/src/automations/service/automation-service.js +1 -13
  230. package/dist/src/browser/drivers/playwright-driver.js +1 -2
  231. package/dist/src/cli/commands/extension-dev.js +1 -1
  232. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  233. package/dist/src/cli/commands/extension.js +1 -1
  234. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  235. package/dist/src/cli/commands/models.js +1 -1
  236. package/dist/src/cli/commands/onboard/model.js +3 -3
  237. package/dist/src/cli/commands/tunnel.js +1 -1
  238. package/dist/src/cli/commands/update.js +1 -1
  239. package/dist/src/config/models-json.d.ts +24 -24
  240. package/dist/src/endpoint-tools/policy.js +3 -4
  241. package/dist/src/gateway/hono/app.js +1 -1
  242. package/dist/src/gateway/hono/middleware/auth.js +1 -1
  243. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  244. package/dist/src/gateway/hono/routes/desktop-host.js +1 -1
  245. package/dist/src/gateway/hono/routes/exposure.js +1 -1
  246. package/dist/src/gateway/hono/routes/files.js +2 -2
  247. package/dist/src/gateway/hono/routes/imports.js +1 -1
  248. package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -16
  249. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  250. package/dist/src/gateway/hono/routes/logs.js +1 -1
  251. package/dist/src/gateway/hono/routes/models.js +5 -5
  252. package/dist/src/gateway/hono/routes/notes.js +1 -1
  253. package/dist/src/gateway/hono/routes/personal-agent.js +2 -2
  254. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  255. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  256. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  257. package/dist/src/gateway/hono/routes/shares.js +5 -5
  258. package/dist/src/gateway/hono/routes/status.js +1 -1
  259. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  260. package/dist/src/gateway/hono/routes/tunnel.js +2 -2
  261. package/dist/src/gateway/hono/routes/update.js +2 -2
  262. package/dist/src/gateway/hono/routes/voice.js +1 -1
  263. package/dist/src/gateway/index.js +2 -2
  264. package/dist/src/gateway/provider-model-setup.js +1 -1
  265. package/dist/src/gateway/run-loop.js +2 -2
  266. package/dist/src/gateway/security/audit.js +1 -1
  267. package/dist/src/gateway/security/gateway-scopes.js +0 -2
  268. package/dist/src/gateway/security/index.js +2 -2
  269. package/dist/src/gateway/server.js +1 -1
  270. package/dist/src/gateway/service/agent-runner.js +1 -1
  271. package/dist/src/gateway/service/run-gateway-agent.js +2 -2
  272. package/dist/src/gateway/service/sessions-api.js +1 -1
  273. package/dist/src/gateway/service.d.ts +0 -3
  274. package/dist/src/gateway/service.js +31 -46
  275. package/dist/src/gateway/side-chat/run-service.js +1 -1
  276. package/dist/src/home-intelligence/host.js +2 -2
  277. package/dist/src/infra/gateway-processes.js +1 -1
  278. package/dist/src/infra/update-restart.js +1 -1
  279. package/dist/src/infra/update-runner.js +2 -2
  280. package/dist/src/infra/update-startup.js +1 -1
  281. package/dist/src/notifications/service.js +2 -2
  282. package/dist/src/personal-agent/prompts.js +1 -1
  283. package/dist/src/personal-agent/reply-style.d.ts +2 -2
  284. package/dist/src/personal-agent/reply-style.js +10 -0
  285. package/dist/src/phone/stream-gateway.js +1 -1
  286. package/dist/src/providers/domestic-presets.d.ts +2 -310
  287. package/dist/src/providers/domestic-presets.js +2 -396
  288. package/dist/src/providers/env-keys.js +2 -6
  289. package/dist/src/providers/index.js +6 -13
  290. package/dist/src/providers/presentation.js +4 -6
  291. package/dist/src/providers/setup/profiles.js +1 -2
  292. package/dist/src/providers/setup/voice.js +1 -1
  293. package/dist/src/realtime/runtime.js +1 -1
  294. package/dist/src/remote-access/exposure-manager.js +1 -1
  295. package/dist/src/share/site-share-router.js +2 -2
  296. package/dist/src/storage/sqlite/schema.sql +0 -81
  297. package/dist/src/tasks/home-query-service.js +0 -1
  298. package/dist/src/tui/backends/embedded-backend.js +3 -3
  299. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  300. package/dist/src/voice/realtime/runtime.js +1 -1
  301. package/dist/src/work-discovery/index.js +2 -2
  302. package/dist/src/work-discovery/investigator.js +1 -1
  303. package/dist/src/work-discovery/service.js +3 -3
  304. package/package.json +9 -9
  305. package/dist/gateway/static/root/assets/app-link-DRy3-k7j.js +0 -1
  306. package/dist/gateway/static/root/assets/arrow-up-right-T72JbQ1Q.js +0 -1
  307. package/dist/gateway/static/root/assets/automation-task-card-BecBULES.js +0 -3
  308. package/dist/gateway/static/root/assets/automations-workspace-BBSTBucV.js +0 -9
  309. package/dist/gateway/static/root/assets/book-open-CCGtrT3R.js +0 -1
  310. package/dist/gateway/static/root/assets/browser-automation-inputs-DADzEaqe.js +0 -1
  311. package/dist/gateway/static/root/assets/browser-automations-page-V7_ZTcyU.js +0 -3
  312. package/dist/gateway/static/root/assets/browser-control-api-Bdr2nGCE.js +0 -6
  313. package/dist/gateway/static/root/assets/browser-settings-page-irOt8KDh.js +0 -3
  314. package/dist/gateway/static/root/assets/capabilities-CrAs-oqU.js +0 -1
  315. package/dist/gateway/static/root/assets/capabilities-page-CJLVUcD4.js +0 -2
  316. package/dist/gateway/static/root/assets/capabilities-settings-panel-D8t5F998.js +0 -8
  317. package/dist/gateway/static/root/assets/capability-icon-DVoZxEgW.js +0 -1
  318. package/dist/gateway/static/root/assets/chat-page-DBAezT9u.js +0 -72
  319. package/dist/gateway/static/root/assets/connected-providers-grid-CpO98SqR.js +0 -1
  320. package/dist/gateway/static/root/assets/connection-usage-Cm_McddI.js +0 -1
  321. package/dist/gateway/static/root/assets/connection-usage-guide-DOf2VWzv.js +0 -1
  322. package/dist/gateway/static/root/assets/connectors-page-Cbn4LSpC.js +0 -1
  323. package/dist/gateway/static/root/assets/earth-BMhZtzcj.js +0 -1
  324. package/dist/gateway/static/root/assets/gateway-realtime-store-xYMxjztG.js +0 -1
  325. package/dist/gateway/static/root/assets/index-CKIirf4W.css +0 -1
  326. package/dist/gateway/static/root/assets/index-CQ570IAI.js +0 -11
  327. package/dist/gateway/static/root/assets/markdown-view-C-DHb3Io.css +0 -1
  328. package/dist/gateway/static/root/assets/messages-DYDySzn1.js +0 -3
  329. package/dist/gateway/static/root/assets/note-image-lightbox-V4rmgfLB.js +0 -1
  330. package/dist/gateway/static/root/assets/notes-api-UXC3eyeM.js +0 -1
  331. package/dist/gateway/static/root/assets/page-header-store-f8XcAs9b.js +0 -1
  332. package/dist/gateway/static/root/assets/personal-page-DUykELZZ.js +0 -1
  333. package/dist/gateway/static/root/assets/product-automation-feedback-_K6grEOt.js +0 -7
  334. package/dist/gateway/static/root/assets/product-navigation-Co8pLbDP.js +0 -1
  335. package/dist/gateway/static/root/assets/recording-upload-CBefH7C5.js +0 -1
  336. package/dist/gateway/static/root/assets/route-preload-Coy9Gjyy.js +0 -2
  337. package/dist/gateway/static/root/assets/settings-advanced-gate-Ch9MNvvk.js +0 -1
  338. package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
  339. package/dist/gateway/static/root/assets/skills-page-Xbnh0-6I.js +0 -2
  340. package/dist/gateway/static/root/assets/star-BUWJqJ5c.js +0 -1
  341. package/dist/gateway/static/root/assets/tool-friendly-title-DcCc6g7o.js +0 -1
  342. package/dist/gateway/static/root/assets/use-composer-attachments-fK2PUQbB.js +0 -2
  343. package/dist/gateway/static/root/assets/use-file-preview-expanded-ivMxmMu1.js +0 -2
  344. package/dist/gateway/static/root/assets/user-model-page-BzpV1hq_.js +0 -2
  345. package/dist/gateway/static/root/assets/video-B6V0GFss.js +0 -1
  346. package/dist/gateway/static/root/assets/voice-call-context-BM2A4bLz.js +0 -1
  347. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CODAQqJn.js +0 -1
  348. package/dist/packages/browser-control-contract/src/automation.js +0 -213
  349. package/dist/src/agent/tools/browser-automation-tool.d.ts +0 -194
  350. package/dist/src/agent/tools/browser-automation-tool.js +0 -243
  351. package/dist/src/auth/oauth/minimax-cn.d.ts +0 -11
  352. package/dist/src/auth/oauth/minimax-cn.js +0 -95
  353. package/dist/src/auth/oauth/minimax.d.ts +0 -8
  354. package/dist/src/auth/oauth/minimax.js +0 -95
  355. package/dist/src/browser/automations/index.d.ts +0 -4
  356. package/dist/src/browser/automations/index.js +0 -4
  357. package/dist/src/browser/automations/repository.d.ts +0 -17
  358. package/dist/src/browser/automations/repository.js +0 -81
  359. package/dist/src/browser/automations/runner.d.ts +0 -17
  360. package/dist/src/browser/automations/runner.js +0 -265
  361. package/dist/src/browser/automations/runtime-service.d.ts +0 -8
  362. package/dist/src/browser/automations/runtime-service.js +0 -38
  363. package/dist/src/browser/automations/schema.d.ts +0 -227
  364. package/dist/src/browser/automations/schema.js +0 -201
  365. package/dist/src/browser/automations/service.d.ts +0 -232
  366. package/dist/src/browser/automations/service.js +0 -214
  367. package/dist/src/browser/automations/types.d.ts +0 -105
  368. package/dist/src/browser/automations/types.js +0 -1
  369. package/dist/src/browser/recordings/service.d.ts +0 -22
  370. package/dist/src/browser/recordings/service.js +0 -159
  371. package/dist/src/gateway/hono/routes/browser-automations.d.ts +0 -3
  372. package/dist/src/gateway/hono/routes/browser-automations.js +0 -93
  373. package/dist/src/gateway/hono/routes/browser-recordings.d.ts +0 -3
  374. package/dist/src/gateway/hono/routes/browser-recordings.js +0 -78
  375. package/dist/browser-ext/dist/assets/{page-context-DngcqfGf.js → auth-DAIwDtVp.js} +1368 -1368
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-CEMWIrtY.js";import{t as o}from"./secret-input-Dryrns2s.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./secret-input-labels-B5Jl5HqK.js";import{t as l}from"./number-input-El7Szeln.js";var u=n(),d=e(t(),1),f=r();function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function h(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function g(e){return e[`x-hidden`]===!0}function _(e){let t=e.properties;if(!p(t))return[];let n=[];for(let[e,r]of Object.entries(t))p(r)&&(g(r)||n.push({key:e,sub:r,order:m(r),group:h(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function v(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function y(e){let t=(0,u.c)(48),{labels:n,id:r,name:a,s,value:l,onChange:d,disabled:p}=e,m=typeof s.description==`string`?s.description:void 0,h=(typeof s[`x-placeholder`]==`string`?s[`x-placeholder`]:null)||m,g=s.format;if(Array.isArray(s.enum)&&s.enum.every(x)){let e;t[0]!==m||t[1]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[0]=m,t[1]=r,t[2]=e):e=t[2];let n=m?`${r}-help`:void 0,o;t[3]===d?o=t[4]:(o=e=>d(e.target.value),t[3]=d,t[4]=o);let c;t[5]===s.enum?c=t[6]:(c=s.enum.map(b),t[5]=s.enum,t[6]=c);let u;t[7]!==p||t[8]!==r||t[9]!==a||t[10]!==n||t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,f.jsx)(i,{id:r,"aria-describedby":n,name:a,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:l,disabled:p,onChange:o,children:c}),t[7]=p,t[8]=r,t[9]=a,t[10]=n,t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14];let h;return t[15]!==e||t[16]!==u?(h=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,u]}),t[15]=e,t[16]=u,t[17]=h):h=t[17],h}if(g===`password`){let e;t[18]!==m||t[19]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[18]=m,t[19]=r,t[20]=e):e=t[20];let i=m?`${r}-help`:void 0,a=n?.secretInputLabels??c,s;t[21]!==p||t[22]!==r||t[23]!==d||t[24]!==h||t[25]!==i||t[26]!==a||t[27]!==l?(s=(0,f.jsx)(o,{id:r,ariaDescribedBy:i,value:l,onChange:d,placeholder:h,labels:a,disabled:p,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[21]=p,t[22]=r,t[23]=d,t[24]=h,t[25]=i,t[26]=a,t[27]=l,t[28]=s):s=t[28];let u;return t[29]!==e||t[30]!==s?(u=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,s]}),t[29]=e,t[30]=s,t[31]=u):u=t[31],u}let _;t[32]!==m||t[33]!==r?(_=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[32]=m,t[33]=r,t[34]=_):_=t[34];let v=m?`${r}-help`:void 0,y;t[35]===d?y=t[36]:(y=e=>d(e.target.value),t[35]=d,t[36]=y);let S;t[37]!==p||t[38]!==r||t[39]!==a||t[40]!==h||t[41]!==v||t[42]!==y||t[43]!==l?(S=(0,f.jsx)(`input`,{id:r,"aria-describedby":v,name:a,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:l,placeholder:h,disabled:p,onChange:y}),t[37]=p,t[38]=r,t[39]=a,t[40]=h,t[41]=v,t[42]=y,t[43]=l,t[44]=S):S=t[44];let C;return t[45]!==_||t[46]!==S?(C=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[_,S]}),t[45]=_,t[46]=S,t[47]=C):C=t[47],C}function b(e){return(0,f.jsx)(a,{value:e,children:e},e)}function x(e){return typeof e==`string`}function S(e){let t=(0,u.c)(14),{id:n,s:r,value:i,onChange:a,disabled:o}=e,s=typeof r.description==`string`?r.description:void 0,c;t[0]!==s||t[1]!==n?(c=s?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:s}):null,t[0]=s,t[1]=n,t[2]=c):c=t[2];let d=s?`${n}-help`:void 0,p=Number.isFinite(i)?i:0,m;t[3]===a?m=t[4]:(m=e=>a(Number(e.target.value)),t[3]=a,t[4]=m);let h;t[5]!==o||t[6]!==n||t[7]!==d||t[8]!==p||t[9]!==m?(h=(0,f.jsx)(l,{id:n,"aria-describedby":d,type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:p,disabled:o,onChange:m}),t[5]=o,t[6]=n,t[7]=d,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;return t[11]!==c||t[12]!==h?(g=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[c,h]}),t[11]=c,t[12]=h,t[13]=g):g=t[13],g}function C(e){let t=(0,u.c)(13),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=(typeof r.description==`string`?r.description:void 0)??(typeof r.title==`string`&&r.title.length>0?r.title:s?.defaultBooleanLabel??`Enable`),l=`${n}-label`,d;t[0]===a?d=t[1]:(d=e=>a(e.target.checked),t[0]=a,t[1]=d);let p;t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==d||t[6]!==i?(p=(0,f.jsx)(`input`,{id:n,"aria-labelledby":l,type:`checkbox`,className:`size-4 rounded border border-edge`,checked:i,disabled:o,onChange:d}),t[2]=o,t[3]=n,t[4]=l,t[5]=d,t[6]=i,t[7]=p):p=t[7];let m;t[8]===c?m=t[9]:(m=(0,f.jsx)(`span`,{children:c}),t[8]=c,t[9]=m);let h;return t[10]!==p||t[11]!==m?(h=(0,f.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[p,m]}),t[10]=p,t[11]=m,t[12]=h):h=t[12],h}function w(e){let t=(0,u.c)(31),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=typeof r.description==`string`?r.description:void 0,l=r.items,d=p(l)?l.type:void 0;if(!(d===`string`||Array.isArray(d)&&d.includes(`string`))){let e=s?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let m,h,g,_,v;if(t[2]!==c||t[3]!==o||t[4]!==n||t[5]!==a||t[6]!==i){let e=i.map(String);m=t=>{let n=t.trim();!n||e.includes(n)||a([...e,n])},_=`flex flex-col gap-1.5`,t[12]!==c||t[13]!==n?(v=c?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:c}):null,t[12]=c,t[13]=n,t[14]=v):v=t[14],h=`flex flex-wrap gap-1`,g=e.map(t=>(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,f.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:o,onClick:()=>a(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=c,t[3]=o,t[4]=n,t[5]=a,t[6]=i,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11];let y;t[15]!==h||t[16]!==g?(y=(0,f.jsx)(`div`,{className:h,children:g}),t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=c?`${n}-help`:void 0,x=s?.arrayAddPlaceholder??`Add and press Enter`,S;t[18]===m?S=t[19]:(S=e=>{e.key===`Enter`&&(e.preventDefault(),m(e.target.value),e.target.value=``)},t[18]=m,t[19]=S);let C;t[20]!==o||t[21]!==n||t[22]!==b||t[23]!==x||t[24]!==S?(C=(0,f.jsx)(`input`,{id:n,"aria-describedby":b,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:o,placeholder:x,onKeyDown:S}),t[20]=o,t[21]=n,t[22]=b,t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==C?(w=(0,f.jsxs)(`div`,{className:_,children:[v,y,C]}),t[26]=_,t[27]=v,t[28]=y,t[29]=C,t[30]=w):w=t[30],w}function T(e){let t=(0,u.c)(76),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=(0,d.useId)(),l=r.type,m=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(l===`boolean`){let e=`${c}-label`,n;t[0]!==c||t[1]!==e||t[2]!==m?(n=(0,f.jsx)(`label`,{id:e,htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[0]=c,t[1]=e,t[2]=m,t[3]=n):n=t[3];let l=i===!0,u;t[4]===a?u=t[5]:(u=e=>a(e),t[4]=a,t[5]=u);let d;t[6]!==o||t[7]!==c||t[8]!==s||t[9]!==r||t[10]!==l||t[11]!==u?(d=(0,f.jsx)(C,{id:c,s:r,value:l,disabled:o,onChange:u,labels:s}),t[6]=o,t[7]=c,t[8]=s,t[9]=r,t[10]=l,t[11]=u,t[12]=d):d=t[12];let p;return t[13]!==n||t[14]!==d?(p=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[n,d]}),t[13]=n,t[14]=d,t[15]=p):p=t[15],p}if(l===`number`||l===`integer`){let e;t[16]!==c||t[17]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[16]=c,t[17]=m,t[18]=e):e=t[18];let n=typeof i==`number`?i:0,s;t[19]!==o||t[20]!==c||t[21]!==a||t[22]!==r||t[23]!==n?(s=(0,f.jsx)(S,{id:c,s:r,value:n,disabled:o,onChange:a}),t[19]=o,t[20]=c,t[21]=a,t[22]=r,t[23]=n,t[24]=s):s=t[24];let l;return t[25]!==e||t[26]!==s?(l=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[25]=e,t[26]=s,t[27]=l):l=t[27],l}if(l===`string`){let e;t[28]!==c||t[29]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[28]=c,t[29]=m,t[30]=e):e=t[30];let l=typeof i==`string`?i:``,u;t[31]!==o||t[32]!==c||t[33]!==n||t[34]!==s||t[35]!==a||t[36]!==r||t[37]!==l?(u=(0,f.jsx)(y,{labels:s,id:c,name:n,s:r,value:l,disabled:o,onChange:a}),t[31]=o,t[32]=c,t[33]=n,t[34]=s,t[35]=a,t[36]=r,t[37]=l,t[38]=u):u=t[38];let d;return t[39]!==e||t[40]!==u?(d=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[39]=e,t[40]=u,t[41]=d):d=t[41],d}if(l===`array`){let e=r.items,n=p(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[42]!==c||t[43]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[42]=c,t[43]=m,t[44]=e):e=t[44];let n;t[45]===i?n=t[46]:(n=Array.isArray(i)&&i.every(E)?i.map(String):[],t[45]=i,t[46]=n);let l;t[47]!==o||t[48]!==c||t[49]!==s||t[50]!==a||t[51]!==r||t[52]!==n?(l=(0,f.jsx)(w,{id:c,s:r,value:n,disabled:o,onChange:a,labels:s}),t[47]=o,t[48]=c,t[49]=s,t[50]=a,t[51]=r,t[52]=n,t[53]=l):l=t[53];let u;return t[54]!==e||t[55]!==l?(u=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[54]=e,t[55]=l,t[56]=u):u=t[56],u}}if(l===`object`){let e;t[57]===i?e=t[58]:(e=p(i)?i:{},t[57]=i,t[58]=e);let n=e,c;t[59]===m?c=t[60]:(c=(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:m}),t[59]=m,t[60]=c);let l;t[61]!==o||t[62]!==s||t[63]!==n||t[64]!==a||t[65]!==r?(l=(0,f.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,f.jsx)(D,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[61]=o,t[62]=s,t[63]=n,t[64]=a,t[65]=r,t[66]=l):l=t[66];let u;return t[67]!==c||t[68]!==l?(u=(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[67]=c,t[68]=l,t[69]=u):u=t[69],u}let h;t[70]!==s||t[71]!==l||t[72]!==m?(h=s?.unsupportedFieldType?.(m,typeof l==`string`?l:void 0)??`${m}: unsupported field type${typeof l==`string`?` (${l})`:``}`,t[70]=s,t[71]=l,t[72]=m,t[73]=h):h=t[73];let g;return t[74]===h?g=t[75]:(g=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h}),t[74]=h,t[75]=g),g}function E(e){return typeof e==`string`||typeof e==`number`}function D(e){let t=(0,u.c)(28),{schema:n,values:r,onChange:i,disabled:a,className:o,labels:c}=e,l=a!==void 0&&a,d;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],d=e;break bb0}let e;t[1]===n?e=t[2]:(e=_(n),t[1]=n,t[2]=e),d=e}let m=d,h;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],h=e;break bb1}let e;t[4]===m?e=t[5]:(e=v(m),t[4]=m,t[5]=e),h=e}let g=h,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!p(n.properties)||m.length===0)return null;let x,S;if(t[9]!==o||t[10]!==l||t[11]!==g||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(g.keys()).sort(O);t[17]===o?x=t[18]:(x=s(`flex flex-col gap-4`,o),t[17]=o,t[18]=x);let n;t[19]!==l||t[20]!==g||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(g.get(e)??[]).map(e=>(0,f.jsx)(T,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:l,labels:c},e.key));return e===``?(0,f.jsx)(`div`,{children:t},`default`):(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,f.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=l,t[20]=g,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=o,t[10]=l,t[11]=g,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let C;return t[25]!==x||t[26]!==S?(C=(0,f.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=C):C=t[27],C}function O(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{D as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-CLsphyzA.js";import{t as o}from"./secret-input-Dryrns2s.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./secret-input-labels-B5Jl5HqK.js";import{t as l}from"./number-input-El7Szeln.js";var u=n(),d=e(t(),1),f=r();function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function h(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function g(e){return e[`x-hidden`]===!0}function _(e){let t=e.properties;if(!p(t))return[];let n=[];for(let[e,r]of Object.entries(t))p(r)&&(g(r)||n.push({key:e,sub:r,order:m(r),group:h(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function v(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function y(e){let t=(0,u.c)(48),{labels:n,id:r,name:a,s,value:l,onChange:d,disabled:p}=e,m=typeof s.description==`string`?s.description:void 0,h=(typeof s[`x-placeholder`]==`string`?s[`x-placeholder`]:null)||m,g=s.format;if(Array.isArray(s.enum)&&s.enum.every(x)){let e;t[0]!==m||t[1]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[0]=m,t[1]=r,t[2]=e):e=t[2];let n=m?`${r}-help`:void 0,o;t[3]===d?o=t[4]:(o=e=>d(e.target.value),t[3]=d,t[4]=o);let c;t[5]===s.enum?c=t[6]:(c=s.enum.map(b),t[5]=s.enum,t[6]=c);let u;t[7]!==p||t[8]!==r||t[9]!==a||t[10]!==n||t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,f.jsx)(i,{id:r,"aria-describedby":n,name:a,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:l,disabled:p,onChange:o,children:c}),t[7]=p,t[8]=r,t[9]=a,t[10]=n,t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14];let h;return t[15]!==e||t[16]!==u?(h=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,u]}),t[15]=e,t[16]=u,t[17]=h):h=t[17],h}if(g===`password`){let e;t[18]!==m||t[19]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[18]=m,t[19]=r,t[20]=e):e=t[20];let i=m?`${r}-help`:void 0,a=n?.secretInputLabels??c,s;t[21]!==p||t[22]!==r||t[23]!==d||t[24]!==h||t[25]!==i||t[26]!==a||t[27]!==l?(s=(0,f.jsx)(o,{id:r,ariaDescribedBy:i,value:l,onChange:d,placeholder:h,labels:a,disabled:p,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[21]=p,t[22]=r,t[23]=d,t[24]=h,t[25]=i,t[26]=a,t[27]=l,t[28]=s):s=t[28];let u;return t[29]!==e||t[30]!==s?(u=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,s]}),t[29]=e,t[30]=s,t[31]=u):u=t[31],u}let _;t[32]!==m||t[33]!==r?(_=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[32]=m,t[33]=r,t[34]=_):_=t[34];let v=m?`${r}-help`:void 0,y;t[35]===d?y=t[36]:(y=e=>d(e.target.value),t[35]=d,t[36]=y);let S;t[37]!==p||t[38]!==r||t[39]!==a||t[40]!==h||t[41]!==v||t[42]!==y||t[43]!==l?(S=(0,f.jsx)(`input`,{id:r,"aria-describedby":v,name:a,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:l,placeholder:h,disabled:p,onChange:y}),t[37]=p,t[38]=r,t[39]=a,t[40]=h,t[41]=v,t[42]=y,t[43]=l,t[44]=S):S=t[44];let C;return t[45]!==_||t[46]!==S?(C=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[_,S]}),t[45]=_,t[46]=S,t[47]=C):C=t[47],C}function b(e){return(0,f.jsx)(a,{value:e,children:e},e)}function x(e){return typeof e==`string`}function S(e){let t=(0,u.c)(14),{id:n,s:r,value:i,onChange:a,disabled:o}=e,s=typeof r.description==`string`?r.description:void 0,c;t[0]!==s||t[1]!==n?(c=s?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:s}):null,t[0]=s,t[1]=n,t[2]=c):c=t[2];let d=s?`${n}-help`:void 0,p=Number.isFinite(i)?i:0,m;t[3]===a?m=t[4]:(m=e=>a(Number(e.target.value)),t[3]=a,t[4]=m);let h;t[5]!==o||t[6]!==n||t[7]!==d||t[8]!==p||t[9]!==m?(h=(0,f.jsx)(l,{id:n,"aria-describedby":d,type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:p,disabled:o,onChange:m}),t[5]=o,t[6]=n,t[7]=d,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;return t[11]!==c||t[12]!==h?(g=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[c,h]}),t[11]=c,t[12]=h,t[13]=g):g=t[13],g}function C(e){let t=(0,u.c)(13),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=(typeof r.description==`string`?r.description:void 0)??(typeof r.title==`string`&&r.title.length>0?r.title:s?.defaultBooleanLabel??`Enable`),l=`${n}-label`,d;t[0]===a?d=t[1]:(d=e=>a(e.target.checked),t[0]=a,t[1]=d);let p;t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==d||t[6]!==i?(p=(0,f.jsx)(`input`,{id:n,"aria-labelledby":l,type:`checkbox`,className:`size-4 rounded border border-edge`,checked:i,disabled:o,onChange:d}),t[2]=o,t[3]=n,t[4]=l,t[5]=d,t[6]=i,t[7]=p):p=t[7];let m;t[8]===c?m=t[9]:(m=(0,f.jsx)(`span`,{children:c}),t[8]=c,t[9]=m);let h;return t[10]!==p||t[11]!==m?(h=(0,f.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[p,m]}),t[10]=p,t[11]=m,t[12]=h):h=t[12],h}function w(e){let t=(0,u.c)(31),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=typeof r.description==`string`?r.description:void 0,l=r.items,d=p(l)?l.type:void 0;if(!(d===`string`||Array.isArray(d)&&d.includes(`string`))){let e=s?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let m,h,g,_,v;if(t[2]!==c||t[3]!==o||t[4]!==n||t[5]!==a||t[6]!==i){let e=i.map(String);m=t=>{let n=t.trim();!n||e.includes(n)||a([...e,n])},_=`flex flex-col gap-1.5`,t[12]!==c||t[13]!==n?(v=c?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:c}):null,t[12]=c,t[13]=n,t[14]=v):v=t[14],h=`flex flex-wrap gap-1`,g=e.map(t=>(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,f.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:o,onClick:()=>a(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=c,t[3]=o,t[4]=n,t[5]=a,t[6]=i,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11];let y;t[15]!==h||t[16]!==g?(y=(0,f.jsx)(`div`,{className:h,children:g}),t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=c?`${n}-help`:void 0,x=s?.arrayAddPlaceholder??`Add and press Enter`,S;t[18]===m?S=t[19]:(S=e=>{e.key===`Enter`&&(e.preventDefault(),m(e.target.value),e.target.value=``)},t[18]=m,t[19]=S);let C;t[20]!==o||t[21]!==n||t[22]!==b||t[23]!==x||t[24]!==S?(C=(0,f.jsx)(`input`,{id:n,"aria-describedby":b,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:o,placeholder:x,onKeyDown:S}),t[20]=o,t[21]=n,t[22]=b,t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==C?(w=(0,f.jsxs)(`div`,{className:_,children:[v,y,C]}),t[26]=_,t[27]=v,t[28]=y,t[29]=C,t[30]=w):w=t[30],w}function T(e){let t=(0,u.c)(76),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=(0,d.useId)(),l=r.type,m=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(l===`boolean`){let e=`${c}-label`,n;t[0]!==c||t[1]!==e||t[2]!==m?(n=(0,f.jsx)(`label`,{id:e,htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[0]=c,t[1]=e,t[2]=m,t[3]=n):n=t[3];let l=i===!0,u;t[4]===a?u=t[5]:(u=e=>a(e),t[4]=a,t[5]=u);let d;t[6]!==o||t[7]!==c||t[8]!==s||t[9]!==r||t[10]!==l||t[11]!==u?(d=(0,f.jsx)(C,{id:c,s:r,value:l,disabled:o,onChange:u,labels:s}),t[6]=o,t[7]=c,t[8]=s,t[9]=r,t[10]=l,t[11]=u,t[12]=d):d=t[12];let p;return t[13]!==n||t[14]!==d?(p=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[n,d]}),t[13]=n,t[14]=d,t[15]=p):p=t[15],p}if(l===`number`||l===`integer`){let e;t[16]!==c||t[17]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[16]=c,t[17]=m,t[18]=e):e=t[18];let n=typeof i==`number`?i:0,s;t[19]!==o||t[20]!==c||t[21]!==a||t[22]!==r||t[23]!==n?(s=(0,f.jsx)(S,{id:c,s:r,value:n,disabled:o,onChange:a}),t[19]=o,t[20]=c,t[21]=a,t[22]=r,t[23]=n,t[24]=s):s=t[24];let l;return t[25]!==e||t[26]!==s?(l=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[25]=e,t[26]=s,t[27]=l):l=t[27],l}if(l===`string`){let e;t[28]!==c||t[29]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[28]=c,t[29]=m,t[30]=e):e=t[30];let l=typeof i==`string`?i:``,u;t[31]!==o||t[32]!==c||t[33]!==n||t[34]!==s||t[35]!==a||t[36]!==r||t[37]!==l?(u=(0,f.jsx)(y,{labels:s,id:c,name:n,s:r,value:l,disabled:o,onChange:a}),t[31]=o,t[32]=c,t[33]=n,t[34]=s,t[35]=a,t[36]=r,t[37]=l,t[38]=u):u=t[38];let d;return t[39]!==e||t[40]!==u?(d=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[39]=e,t[40]=u,t[41]=d):d=t[41],d}if(l===`array`){let e=r.items,n=p(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[42]!==c||t[43]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[42]=c,t[43]=m,t[44]=e):e=t[44];let n;t[45]===i?n=t[46]:(n=Array.isArray(i)&&i.every(E)?i.map(String):[],t[45]=i,t[46]=n);let l;t[47]!==o||t[48]!==c||t[49]!==s||t[50]!==a||t[51]!==r||t[52]!==n?(l=(0,f.jsx)(w,{id:c,s:r,value:n,disabled:o,onChange:a,labels:s}),t[47]=o,t[48]=c,t[49]=s,t[50]=a,t[51]=r,t[52]=n,t[53]=l):l=t[53];let u;return t[54]!==e||t[55]!==l?(u=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[54]=e,t[55]=l,t[56]=u):u=t[56],u}}if(l===`object`){let e;t[57]===i?e=t[58]:(e=p(i)?i:{},t[57]=i,t[58]=e);let n=e,c;t[59]===m?c=t[60]:(c=(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:m}),t[59]=m,t[60]=c);let l;t[61]!==o||t[62]!==s||t[63]!==n||t[64]!==a||t[65]!==r?(l=(0,f.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,f.jsx)(D,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[61]=o,t[62]=s,t[63]=n,t[64]=a,t[65]=r,t[66]=l):l=t[66];let u;return t[67]!==c||t[68]!==l?(u=(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[67]=c,t[68]=l,t[69]=u):u=t[69],u}let h;t[70]!==s||t[71]!==l||t[72]!==m?(h=s?.unsupportedFieldType?.(m,typeof l==`string`?l:void 0)??`${m}: unsupported field type${typeof l==`string`?` (${l})`:``}`,t[70]=s,t[71]=l,t[72]=m,t[73]=h):h=t[73];let g;return t[74]===h?g=t[75]:(g=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h}),t[74]=h,t[75]=g),g}function E(e){return typeof e==`string`||typeof e==`number`}function D(e){let t=(0,u.c)(28),{schema:n,values:r,onChange:i,disabled:a,className:o,labels:c}=e,l=a!==void 0&&a,d;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],d=e;break bb0}let e;t[1]===n?e=t[2]:(e=_(n),t[1]=n,t[2]=e),d=e}let m=d,h;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],h=e;break bb1}let e;t[4]===m?e=t[5]:(e=v(m),t[4]=m,t[5]=e),h=e}let g=h,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!p(n.properties)||m.length===0)return null;let x,S;if(t[9]!==o||t[10]!==l||t[11]!==g||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(g.keys()).sort(O);t[17]===o?x=t[18]:(x=s(`flex flex-col gap-4`,o),t[17]=o,t[18]=x);let n;t[19]!==l||t[20]!==g||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(g.get(e)??[]).map(e=>(0,f.jsx)(T,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:l,labels:c},e.key));return e===``?(0,f.jsx)(`div`,{children:t},`default`):(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,f.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=l,t[20]=g,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=o,t[10]=l,t[11]=g,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let C;return t[25]!==x||t[26]!==S?(C=(0,f.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=C):C=t[27],C}function O(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{D as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{u as r}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i,n as a,o}from"./locale-store-DGtk-KSF.js";import{t as s}from"./messages-DYDySzn1.js";import{t as c}from"./createLucideIcon-DPHK1VkS.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{i as l}from"./working-directory-picker-modal-7G-6icvh.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{s as d,t as f}from"./install-connector-dialog-CVjCFdly.js";import{t as p}from"./package-wATCyihJ.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-BI5TyibZ.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{t as te}from"./button-Cc4hUNTt.js";import{a as v,i as y,o as b,s as x}from"./connectors-api-HFW1Iey5.js";import{t as S}from"./agent-plugin-dialog-DofyWKnP.js";import{t as C}from"./capability-icon-DVoZxEgW.js";import{t as w}from"./extension-marketplace-api-Q6E4x8gu.js";var T=c(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),E=e(t(),1),D={"notion-office":`notion`,"todoist-mcp":`todoist`,"amap-maps":`amap`,"feishu-workspace":`feishu`,"wecom-workspace":`wecom`,"dingtalk-workspace":`dingtalk`,"wps365-workspace":`wps365`},O=[`feishu`,`wecom`,`dingtalk`,`tencent-docs`,`wps365`,`yuque`,`dida365`,`flomo`,`tencent-meeting`,`amap`,`bailian-web-search`,`railway-12306`,`antv-chart`],k={"store-plugin":0,"builtin-connector":1,"store-connector":2,"registry-connector":3};function A(e){let t=e.toLowerCase().replace(/^composio-/,``);return D[t]??t}function j(e){if(!e)return 2**53-1;let t=O.indexOf(A(e.id));return t>=0?t:e.regions?.includes(`china`)?O.length:2**53-1}function M(e,t){let n=new Map;for(let t of e){if(!t.service)continue;let e=A(t.service.id),r=n.get(e);(!r?.service||k[t.service.source]<k[r.service.source])&&n.set(e,t)}let r=e.filter(e=>!e.service||n.get(A(e.service.id))===e);return t.startsWith(`zh`)?r.toSorted((e,t)=>j(e.service)-j(t.service)):r}function N(e,t){let n=t.trim().toLocaleLowerCase();return!n||[e.name,e.description,e.source,...e.tags].some(e=>e.toLocaleLowerCase().includes(n))}function P(e){return e?[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)?`attention`:`installed`:`available`}function F(e,t,n,r=`en`){return M(e,r).filter(e=>(t===`all`||e.kind===t)&&N(e,n))}function I(e,t,n,r=`en`){let i=new Map(n.map(e=>[e.connectorId,e])),a=new Map;for(let t of e){let e=i.get(t.id);a.set(t.id,{id:t.id,service:{id:t.id,source:t.source===`builtin`?`builtin-connector`:t.source===`store`?`store-connector`:`registry-connector`},kind:`connector`,name:t.displayName,description:t.description,source:t.source,status:P(e),tags:[t.category,t.kind,...t.tags??[]],href:`/capabilities/connectors?tab=${e?`connected`:`discover`}&${e?`instance`:`connector`}=${encodeURIComponent(e?.instanceId??t.id)}`,iconUrl:t.branding?.logoUrl})}for(let e of t){let t=e.name,n=e.localizations?.[r.startsWith(`zh`)?`zh-CN`:`en`],o=i.get(t);a.set(`store:${t}`,{id:t,service:{id:t,source:`store-connector`,regions:e.regions},kind:`connector`,name:n?.displayName??e.name,description:n?.description??e.description,source:e.author.username||`XOPC Store`,status:P(o),tags:[e.name,e.category,...e.tags??[]].filter(e=>!!e),href:o?`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(o.instanceId)}`:`/capabilities/connectors?tab=discover&storeConnector=${encodeURIComponent(t)}`,iconUrl:e.branding?.iconUrl})}return M([...a.values()],r)}function L(e,t,n=`en`){return e.map(e=>({id:e.id,kind:`extension`,...e.packageType===`plugin`?{service:{id:e.id,source:`store-plugin`}}:{},name:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.displayName??e.name,description:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.description??e.description??``,source:e.author||e.npmPackage,status:t.has(e.id)?`installed`:`available`,tags:[e.id,...e.categories??[],...e.tags??[]],href:`/capabilities/extensions?tab=marketplace&q=${encodeURIComponent(e.name)}`,iconUrl:e.branding?.iconUrl}))}async function R(e=``){let t=await b({q:e,page:1,pageSize:50,sort:`downloads`}),n=await Promise.all(Array.from({length:Math.max(0,t.meta.totalPages-1)},(t,n)=>b({q:e,page:n+2,pageSize:50,sort:`downloads`})));return[...t.items,...n.flatMap(e=>e.items)]}async function z(e){let[t,n,r]=await Promise.allSettled([w(),y(),R()]),i=[t,n,r].filter(e=>e.status===`rejected`).length;if(i===3)throw Error(`Service recommendations unavailable`);let a=n.status===`fulfilled`?n.value:[];return{items:M([...L(t.status===`fulfilled`?t.value.filter(e=>e.packageType===`plugin`):[],new Set,e),...I(a,r.status===`fulfilled`?r.value:[],[],e)],e),definitions:a,failedSources:i}}var B=n();function V({initialCount:e=3,query:t=``,layout:n=`list`,onChanged:c}){let y=r(),b=a(e=>e.language),w=b.startsWith(`zh`),D=s(b).onboarding.workDiscovery,O=s(b).connectorsSettings,{data:k,error:A,isLoading:j,mutate:M}=_([`service-recommendations`,b],()=>z(b),{revalidateOnFocus:!1}),{data:N,error:P,mutate:I}=_(`recommended-connector-instances`,v),{data:L,error:R,mutate:V}=_(`gateway-extensions-list`,()=>o(i(`/api/extensions`))),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(null),[K,q]=(0,E.useState)(null),[J,Y]=(0,E.useState)(null),[X,Z]=(0,E.useState)(``),Q=F(k?.items??[],`all`,t,b);async function $(){let e=(await Promise.allSettled([I(),V(),Promise.resolve().then(()=>c?.())])).find(e=>e.status===`rejected`);e?.status===`rejected`&&Z(String(e.reason))}async function ne(e,t){if(Z(``),e.service?.source===`store-plugin`){q({id:e.id,extension:t});return}let n=N?.find(t=>t.connectorId===e.id);if(n){y(`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(n.instanceId)}`);return}Y(e.id);try{if(e.service?.source===`store-connector`){let t=await x(e.id);G(d(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}else{let t=k?.definitions.find(t=>t.id===e.id);t&&G(d(t))}}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Y(null)}}return(0,B.jsxs)(`div`,{children:[j?(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`space-y-2`,"aria-busy":`true`,children:Array.from({length:e},(e,t)=>(0,B.jsx)(g,{className:n===`cards`?`h-[8.75rem] rounded-xl`:`h-20 rounded-xl`},t))}):null,A||k?.failedSources||P||R?(0,B.jsxs)(`p`,{className:`mb-3 text-sm text-fg-muted`,role:`status`,children:[D.connectorLoadFailed,` `,(0,B.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>{M(),I(),V()},children:w?`重试`:`Retry`})]}):null,!j&&!A&&Q.length===0?(0,B.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:D.noWorkServices}):null,(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-base/55`,children:(H?Q:Q.slice(0,e)).map(e=>{let t=L?.extensions.find(t=>t.format===`agent-plugin`&&t.provenance?.packageName===e.id),r=N?.find(t=>t.connectorId===e.id),i=e.service?.source===`store-plugin`,a=i?!!(t?.active&&t.readiness===`ready`&&[`connected`,`not_required`].includes(t.authorizationStatus??``)):!!(r?.enabled&&r.status===`connected`),o=i?!!t:!!r,s=(i?!L&&!R:!N&&!P)?(0,B.jsx)(g,{className:`h-8 w-16 shrink-0 rounded-lg`}):(0,B.jsxs)(te,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-3 text-xs`,disabled:J!==null,onClick:()=>void ne(e,t),children:[J===e.id?(0,B.jsx)(u,{className:`size-3.5 animate-spin`}):o?null:(0,B.jsx)(m,{className:`size-3.5`}),a?w?`管理`:`Manage`:o?w?`继续设置`:`Set up`:O.connect]});return(0,B.jsx)(`article`,{className:h(n===`cards`?`group flex min-h-[8.75rem] min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`:`flex min-h-20 items-center gap-3 px-3 py-3 sm:px-4`),children:n===`cards`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),s]}),(0,B.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:e.description,children:e.description})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),s]})},`${e.kind}:${e.id}`)})}),Q.length>e?(0,B.jsxs)(`button`,{type:`button`,className:`mx-auto mt-3 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>U(e=>!e),children:[H?(0,B.jsx)(l,{className:`size-3.5`}):(0,B.jsx)(ee,{className:`size-3.5`}),H?D.showFewerServices:D.showMoreServices]}):null,X?(0,B.jsx)(`p`,{className:`mt-3 text-xs text-danger`,role:`alert`,children:X}):null,W?(0,B.jsx)(f,{draft:W,onChange:G,onClose:()=>G(null),t:O,onInstalled:async()=>{await $(),G(null)}}):null,K?(0,B.jsx)(S,{initialSource:`store:${K.id}`,extension:K.extension,onClose:()=>{q(null),$()}}):null]})}export{T as a,M as i,z as n,A as r,V as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{u as r}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i,n as a,o}from"./locale-store-Bld7_m-Q.js";import{t as s}from"./messages-CGO1P4mz.js";import{t as c}from"./createLucideIcon-DPHK1VkS.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{i as l}from"./working-directory-picker-modal-DeNWVFFK.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{s as d,t as f}from"./install-connector-dialog-BU4l6KJv.js";import{t as p}from"./package-wATCyihJ.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-DzdOeGYz.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{t as te}from"./button-Cc4hUNTt.js";import{a as v,i as y,o as b,s as x}from"./connectors-api-DEExP6a7.js";import{t as S}from"./agent-plugin-dialog-B2vXlrDW.js";import{t as C}from"./capability-icon-CmvCZOJX.js";import{t as w}from"./extension-marketplace-api-D7Av-sOf.js";var T=c(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),E=e(t(),1),D={"notion-office":`notion`,"todoist-mcp":`todoist`,"amap-maps":`amap`,"feishu-workspace":`feishu`,"wecom-workspace":`wecom`,"dingtalk-workspace":`dingtalk`,"wps365-workspace":`wps365`},O=[`feishu`,`wecom`,`dingtalk`,`tencent-docs`,`wps365`,`yuque`,`dida365`,`flomo`,`tencent-meeting`,`amap`,`bailian-web-search`,`railway-12306`,`antv-chart`],k={"store-plugin":0,"builtin-connector":1,"store-connector":2,"registry-connector":3};function A(e){let t=e.toLowerCase().replace(/^composio-/,``);return D[t]??t}function j(e){if(!e)return 2**53-1;let t=O.indexOf(A(e.id));return t>=0?t:e.regions?.includes(`china`)?O.length:2**53-1}function M(e,t){let n=new Map;for(let t of e){if(!t.service)continue;let e=A(t.service.id),r=n.get(e);(!r?.service||k[t.service.source]<k[r.service.source])&&n.set(e,t)}let r=e.filter(e=>!e.service||n.get(A(e.service.id))===e);return t.startsWith(`zh`)?r.toSorted((e,t)=>j(e.service)-j(t.service)):r}function N(e,t){let n=t.trim().toLocaleLowerCase();return!n||[e.name,e.description,e.source,...e.tags].some(e=>e.toLocaleLowerCase().includes(n))}function P(e){return e?[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)?`attention`:`installed`:`available`}function F(e,t,n,r=`en`){return M(e,r).filter(e=>(t===`all`||e.kind===t)&&N(e,n))}function I(e,t,n,r=`en`){let i=new Map(n.map(e=>[e.connectorId,e])),a=new Map;for(let t of e){let e=i.get(t.id);a.set(t.id,{id:t.id,service:{id:t.id,source:t.source===`builtin`?`builtin-connector`:t.source===`store`?`store-connector`:`registry-connector`},kind:`connector`,name:t.displayName,description:t.description,source:t.source,status:P(e),tags:[t.category,t.kind,...t.tags??[]],href:`/capabilities/connectors?tab=${e?`connected`:`discover`}&${e?`instance`:`connector`}=${encodeURIComponent(e?.instanceId??t.id)}`,iconUrl:t.branding?.logoUrl})}for(let e of t){let t=e.name,n=e.localizations?.[r.startsWith(`zh`)?`zh-CN`:`en`],o=i.get(t);a.set(`store:${t}`,{id:t,service:{id:t,source:`store-connector`,regions:e.regions},kind:`connector`,name:n?.displayName??e.name,description:n?.description??e.description,source:e.author.username||`XOPC Store`,status:P(o),tags:[e.name,e.category,...e.tags??[]].filter(e=>!!e),href:o?`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(o.instanceId)}`:`/capabilities/connectors?tab=discover&storeConnector=${encodeURIComponent(t)}`,iconUrl:e.branding?.iconUrl})}return M([...a.values()],r)}function L(e,t,n=`en`){return e.map(e=>({id:e.id,kind:`extension`,...e.packageType===`plugin`?{service:{id:e.id,source:`store-plugin`}}:{},name:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.displayName??e.name,description:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.description??e.description??``,source:e.author||e.npmPackage,status:t.has(e.id)?`installed`:`available`,tags:[e.id,...e.categories??[],...e.tags??[]],href:`/capabilities/extensions?tab=marketplace&q=${encodeURIComponent(e.name)}`,iconUrl:e.branding?.iconUrl}))}async function R(e=``){let t=await b({q:e,page:1,pageSize:50,sort:`downloads`}),n=await Promise.all(Array.from({length:Math.max(0,t.meta.totalPages-1)},(t,n)=>b({q:e,page:n+2,pageSize:50,sort:`downloads`})));return[...t.items,...n.flatMap(e=>e.items)]}async function z(e){let[t,n,r]=await Promise.allSettled([w(),y(),R()]),i=[t,n,r].filter(e=>e.status===`rejected`).length;if(i===3)throw Error(`Service recommendations unavailable`);let a=n.status===`fulfilled`?n.value:[];return{items:M([...L(t.status===`fulfilled`?t.value.filter(e=>e.packageType===`plugin`):[],new Set,e),...I(a,r.status===`fulfilled`?r.value:[],[],e)],e),definitions:a,failedSources:i}}var B=n();function V({initialCount:e=3,query:t=``,layout:n=`list`,onChanged:c}){let y=r(),b=a(e=>e.language),w=b.startsWith(`zh`),D=s(b).onboarding.workDiscovery,O=s(b).connectorsSettings,{data:k,error:A,isLoading:j,mutate:M}=_([`service-recommendations`,b],()=>z(b),{revalidateOnFocus:!1}),{data:N,error:P,mutate:I}=_(`recommended-connector-instances`,v),{data:L,error:R,mutate:V}=_(`gateway-extensions-list`,()=>o(i(`/api/extensions`))),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(null),[K,q]=(0,E.useState)(null),[J,Y]=(0,E.useState)(null),[X,Z]=(0,E.useState)(``),Q=F(k?.items??[],`all`,t,b);async function $(){let e=(await Promise.allSettled([I(),V(),Promise.resolve().then(()=>c?.())])).find(e=>e.status===`rejected`);e?.status===`rejected`&&Z(String(e.reason))}async function ne(e,t){if(Z(``),e.service?.source===`store-plugin`){q({id:e.id,extension:t});return}let n=N?.find(t=>t.connectorId===e.id);if(n){y(`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(n.instanceId)}`);return}Y(e.id);try{if(e.service?.source===`store-connector`){let t=await x(e.id);G(d(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}else{let t=k?.definitions.find(t=>t.id===e.id);t&&G(d(t))}}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Y(null)}}return(0,B.jsxs)(`div`,{children:[j?(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`space-y-2`,"aria-busy":`true`,children:Array.from({length:e},(e,t)=>(0,B.jsx)(g,{className:n===`cards`?`h-[8.75rem] rounded-xl`:`h-20 rounded-xl`},t))}):null,A||k?.failedSources||P||R?(0,B.jsxs)(`p`,{className:`mb-3 text-sm text-fg-muted`,role:`status`,children:[D.connectorLoadFailed,` `,(0,B.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>{M(),I(),V()},children:w?`重试`:`Retry`})]}):null,!j&&!A&&Q.length===0?(0,B.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:D.noWorkServices}):null,(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-base/55`,children:(H?Q:Q.slice(0,e)).map(e=>{let t=L?.extensions.find(t=>t.format===`agent-plugin`&&t.provenance?.packageName===e.id),r=N?.find(t=>t.connectorId===e.id),i=e.service?.source===`store-plugin`,a=i?!!(t?.active&&t.readiness===`ready`&&[`connected`,`not_required`].includes(t.authorizationStatus??``)):!!(r?.enabled&&r.status===`connected`),o=i?!!t:!!r,s=(i?!L&&!R:!N&&!P)?(0,B.jsx)(g,{className:`h-8 w-16 shrink-0 rounded-lg`}):(0,B.jsxs)(te,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-3 text-xs`,disabled:J!==null,onClick:()=>void ne(e,t),children:[J===e.id?(0,B.jsx)(u,{className:`size-3.5 animate-spin`}):o?null:(0,B.jsx)(m,{className:`size-3.5`}),a?w?`管理`:`Manage`:o?w?`继续设置`:`Set up`:O.connect]});return(0,B.jsx)(`article`,{className:h(n===`cards`?`group flex min-h-[8.75rem] min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`:`flex min-h-20 items-center gap-3 px-3 py-3 sm:px-4`),children:n===`cards`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),s]}),(0,B.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:e.description,children:e.description})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),s]})},`${e.kind}:${e.id}`)})}),Q.length>e?(0,B.jsxs)(`button`,{type:`button`,className:`mx-auto mt-3 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>U(e=>!e),children:[H?(0,B.jsx)(l,{className:`size-3.5`}):(0,B.jsx)(ee,{className:`size-3.5`}),H?D.showFewerServices:D.showMoreServices]}):null,X?(0,B.jsx)(`p`,{className:`mt-3 text-xs text-danger`,role:`alert`,children:X}):null,W?(0,B.jsx)(f,{draft:W,onChange:G,onClose:()=>G(null),t:O,onInstalled:async()=>{await $(),G(null)}}):null,K?(0,B.jsx)(S,{initialSource:`store:${K.id}`,extension:K.extension,onClose:()=>{q(null),$()}}):null]})}export{T as a,M as i,z as n,A as r,V as t};
@@ -1 +1 @@
1
- import{i as e,o as t}from"./locale-store-DGtk-KSF.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,i as c,m as l,n as u,u as d,y as f}from"./schemas-CCWMleym.js";import{t as p}from"./gateway-startup-retry-DCjREMIO.js";f().transform(e=>e.toLowerCase()).brand();var m=l().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),h=u([`active`,`idle`,`archived`,`pinned`]),g=a({agentId:l().optional(),source:l().optional(),accountId:l().optional(),peerKind:l().optional(),peerId:l().optional(),threadId:l().optional(),scopeId:l().optional()}).passthrough();a({agentId:l().optional(),projectId:l().optional(),key:l(),transcriptId:m.optional(),name:l().optional(),title:l().optional(),displayName:l().optional(),messageCount:d(),updatedAt:l(),sourceChannel:l().optional(),status:h.optional(),usage:a({calls:d().int().nonnegative(),unknownCostCalls:d().int().nonnegative(),totalTokens:d().int().nonnegative(),knownCostUsd:l(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:g.optional()}).passthrough();var _=a({items:c(n()),total:d(),limit:d(),offset:d(),hasMore:r()}),v=a({role:l(),content:n(),timestamp:s([l(),d()]).optional()}).passthrough(),y=a({key:l(),messages:c(v)}).passthrough(),b=a({session:y}),ee=a({session:a({key:l(),transcriptId:m.optional(),messages:c(v),name:l().optional(),status:h.optional(),sourceChannel:l().optional(),sourceChatId:l().optional(),projectId:l().optional(),customData:o(l(),n()).optional(),routing:g.optional()}).passthrough(),pagination:a({total:d(),limit:d(),offset:d(),hasMore:r(),before:l().optional(),nextBeforeCursor:l().optional(),revision:d().int().nonnegative().optional()}).passthrough()}).passthrough(),x=a({ok:i(!0),conversationId:f(),rowCount:d().int().nonnegative(),lastTurnId:l().min(1),session:y}).passthrough(),S=a({ok:r().optional(),payload:a({active:r(),runId:l().optional()}).passthrough().optional()}).passthrough(),C=a({ok:r().optional(),error:l().optional()}).passthrough(),w=C.extend({renamed:r().optional()}),T=C.extend({reset:r().optional(),transcriptId:m.optional(),previousTranscriptId:l().optional(),session:n().optional()}),E=a({totalSessions:d(),activeSessions:d(),archivedSessions:d(),pinnedSessions:d(),totalMessages:d(),totalTokens:d(),oldestSession:l().optional(),newestSession:l().optional(),byChannel:o(l(),d())}).passthrough();a({ok:r(),payload:a({conversationId:f(),transcriptId:m,session:n()}).passthrough().optional(),error:l().optional()}).passthrough();var D=a({ok:i(!0),projects:a({items:c(a({project:n(),sessions:c(n()),sessionTotal:d(),sessionHasMore:r()}).passthrough()),total:d(),limit:d(),offset:d(),hasMore:r()}),inbox:_,pinned:c(n()).default([]),layouts:o(l(),a({itemIds:c(l()),revision:d().int().nonnegative()})).default({}),childrenByConversationId:o(l(),a({total:d(),activeCount:d(),items:c(a({taskId:l(),title:l(),phase:l(),runStatus:l().optional(),activeConversationId:l().optional()}))})).default({})}).passthrough();function O(e){return b.parse(e)}function k(e){return ee.parse(e)}function A(e){return x.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){let t=j(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function R(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.excludeAutomationRuns&&t.set(`excludeAutomationRuns`,`true`),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function z(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function B(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function H(){return`/api/sessions/stats`}function U(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function W(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function G(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function K(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,excludeAutomationRuns:e.excludeAutomationRuns,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var q=new Map;async function J(t){let n=K(t),r=q.get(n);if(r)return r;let i=e(`/api/sessions${R(t)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{q.delete(n)});return q.set(n,a),a}async function Y(n){return I(await t(e(U(n))))}async function X(n){let r=await t(e(W(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Z(){return F(await t(e(H())))}async function Q(n,r){let i=O(await t(e(z(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function ne(n){let r=await t(e(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function $(n){M(await t(e(G(n,`delete`)),{method:`DELETE`}))}async function re(n,r){return{renamed:N(await t(e(G(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function ie(n){M(await t(e(G(n,`archive`)),{method:`POST`}))}async function ae(n){M(await t(e(G(n,`unarchive`)),{method:`POST`}))}async function oe(n){M(await t(e(G(n,`pin`)),{method:`POST`}))}async function se(n){M(await t(e(G(n,`unpin`)),{method:`POST`}))}async function ce(n){return(await t(e(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{L as _,Q as a,P as b,oe as c,X as d,ae as f,V as g,te as h,Y as i,re as l,B as m,$ as n,Z as o,se as p,ce as r,J as s,ie as t,ne as u,A as v,k as y};
1
+ import{i as e,o as t}from"./locale-store-Bld7_m-Q.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,i as c,m as l,n as u,u as d,y as f}from"./schemas-CCWMleym.js";import{t as p}from"./gateway-startup-retry-CqtCJzWJ.js";f().transform(e=>e.toLowerCase()).brand();var m=l().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),h=u([`active`,`idle`,`archived`,`pinned`]),g=a({agentId:l().optional(),source:l().optional(),accountId:l().optional(),peerKind:l().optional(),peerId:l().optional(),threadId:l().optional(),scopeId:l().optional()}).passthrough();a({agentId:l().optional(),projectId:l().optional(),key:l(),transcriptId:m.optional(),name:l().optional(),title:l().optional(),displayName:l().optional(),messageCount:d(),updatedAt:l(),sourceChannel:l().optional(),status:h.optional(),usage:a({calls:d().int().nonnegative(),unknownCostCalls:d().int().nonnegative(),totalTokens:d().int().nonnegative(),knownCostUsd:l(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:g.optional()}).passthrough();var _=a({items:c(n()),total:d(),limit:d(),offset:d(),hasMore:r()}),v=a({role:l(),content:n(),timestamp:s([l(),d()]).optional()}).passthrough(),y=a({key:l(),messages:c(v)}).passthrough(),b=a({session:y}),ee=a({session:a({key:l(),transcriptId:m.optional(),messages:c(v),name:l().optional(),status:h.optional(),sourceChannel:l().optional(),sourceChatId:l().optional(),projectId:l().optional(),customData:o(l(),n()).optional(),routing:g.optional()}).passthrough(),pagination:a({total:d(),limit:d(),offset:d(),hasMore:r(),before:l().optional(),nextBeforeCursor:l().optional(),revision:d().int().nonnegative().optional()}).passthrough()}).passthrough(),x=a({ok:i(!0),conversationId:f(),rowCount:d().int().nonnegative(),lastTurnId:l().min(1),session:y}).passthrough(),S=a({ok:r().optional(),payload:a({active:r(),runId:l().optional()}).passthrough().optional()}).passthrough(),C=a({ok:r().optional(),error:l().optional()}).passthrough(),w=C.extend({renamed:r().optional()}),T=C.extend({reset:r().optional(),transcriptId:m.optional(),previousTranscriptId:l().optional(),session:n().optional()}),E=a({totalSessions:d(),activeSessions:d(),archivedSessions:d(),pinnedSessions:d(),totalMessages:d(),totalTokens:d(),oldestSession:l().optional(),newestSession:l().optional(),byChannel:o(l(),d())}).passthrough();a({ok:r(),payload:a({conversationId:f(),transcriptId:m,session:n()}).passthrough().optional(),error:l().optional()}).passthrough();var D=a({ok:i(!0),projects:a({items:c(a({project:n(),sessions:c(n()),sessionTotal:d(),sessionHasMore:r()}).passthrough()),total:d(),limit:d(),offset:d(),hasMore:r()}),inbox:_,pinned:c(n()).default([]),layouts:o(l(),a({itemIds:c(l()),revision:d().int().nonnegative()})).default({}),childrenByConversationId:o(l(),a({total:d(),activeCount:d(),items:c(a({taskId:l(),title:l(),phase:l(),runStatus:l().optional(),activeConversationId:l().optional()}))})).default({})}).passthrough();function O(e){return b.parse(e)}function k(e){return ee.parse(e)}function A(e){return x.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){let t=j(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function R(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.excludeAutomationRuns&&t.set(`excludeAutomationRuns`,`true`),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function z(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function B(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function H(){return`/api/sessions/stats`}function U(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function W(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function G(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function K(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,excludeAutomationRuns:e.excludeAutomationRuns,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var q=new Map;async function J(t){let n=K(t),r=q.get(n);if(r)return r;let i=e(`/api/sessions${R(t)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{q.delete(n)});return q.set(n,a),a}async function Y(n){return I(await t(e(U(n))))}async function X(n){let r=await t(e(W(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Z(){return F(await t(e(H())))}async function Q(n,r){let i=O(await t(e(z(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function ne(n){let r=await t(e(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function $(n){M(await t(e(G(n,`delete`)),{method:`DELETE`}))}async function re(n,r){return{renamed:N(await t(e(G(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function ie(n){M(await t(e(G(n,`archive`)),{method:`POST`}))}async function ae(n){M(await t(e(G(n,`unarchive`)),{method:`POST`}))}async function oe(n){M(await t(e(G(n,`pin`)),{method:`POST`}))}async function se(n){M(await t(e(G(n,`unpin`)),{method:`POST`}))}async function ce(n){return(await t(e(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{L as _,Q as a,P as b,oe as c,X as d,ae as f,V as g,te as h,Y as i,re as l,B as m,$ as n,Z as o,se as p,ce as r,J as s,ie as t,ne as u,A as v,k as y};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,l as r,n as i,p as a,u as o}from"./locale-store-DGtk-KSF.js";import{t as s}from"./messages-DYDySzn1.js";import{_ as c,c as l,d as u,f as d,g as f,i as ee,m as p,n as m,u as h}from"./schemas-CCWMleym.js";import{i as g,n as _}from"./constants-DBtMsXdW.js";import{_ as te,b as ne,g as v,h as y,m as b,s as x,v as S,y as C}from"./session-api-CpZ24vrQ.js";import{_ as w,a as T,b as E,c as re,d as ie,f as ae,i as oe,l as D,o as se,p as ce,r as le,s as ue,t as de,u as fe,v as pe,y as me}from"./local-session-drafts-v7v7Hb6T.js";import{t as O}from"./tool-activity-BtJkgjFf.js";import{r as he}from"./personal-proactivity-DaRnbB1f.js";import{t as ge}from"./gateway-startup-retry-DCjREMIO.js";import{a as _e}from"./attachment-utils-core-BIOUBrpT.js";import{a as ve}from"./gateway-realtime-Bg4Mf7HA.js";import{n as ye}from"./registry-api-CRxE9kFY.js";import{a as be}from"./agents-admin-api-CewiIx4v.js";var xe=[0,500,1500],Se=1e4;function Ce(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function we(e){return e===408||e===429||e>=500}var Te=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,Ee=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function De(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Oe(e){return Te.test(e)||e.startsWith(`<source_contexts>`)||Ee.some(t=>e.startsWith(`<${t}>`))}function ke(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function Ae(e){let t=e,n=De(t.trimStart(),`xopc_task_execution`);n!==null&&Oe(n)&&(t=n),t=ke(t);let r=t,i=!1;for(t=t.trimStart();;){let e=Ee.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=De(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Te.test(t)&&(t=r),t.replace(Te,``)}function je(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,l as r,n as i,p as a,u as o}from"./locale-store-Bld7_m-Q.js";import{t as s}from"./messages-CGO1P4mz.js";import{_ as c,c as l,d as u,f as d,g as f,i as ee,m as p,n as m,u as h}from"./schemas-CCWMleym.js";import{i as g,n as _}from"./constants-DBtMsXdW.js";import{_ as te,b as ne,g as v,h as y,m as b,s as x,v as S,y as C}from"./session-api-DjnHJ-0n.js";import{_ as w,a as T,b as E,c as re,d as ie,f as ae,i as oe,l as D,o as se,p as ce,r as le,s as ue,t as de,u as fe,v as pe,y as me}from"./local-session-drafts-Bt_e3A8f.js";import{t as O}from"./tool-activity-BtJkgjFf.js";import{r as he}from"./personal-proactivity-DaRnbB1f.js";import{t as ge}from"./gateway-startup-retry-CqtCJzWJ.js";import{a as _e}from"./attachment-utils-core-BIOUBrpT.js";import{a as ve}from"./gateway-realtime-hnEaDFaA.js";import{n as ye}from"./registry-api-Bdp3UUyz.js";import{a as be}from"./agents-admin-api-DPLtjJtX.js";var xe=[0,500,1500],Se=1e4;function Ce(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function we(e){return e===408||e===429||e>=500}var Te=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,Ee=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function De(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Oe(e){return Te.test(e)||e.startsWith(`<source_contexts>`)||Ee.some(t=>e.startsWith(`<${t}>`))}function ke(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function Ae(e){let t=e,n=De(t.trimStart(),`xopc_task_execution`);n!==null&&Oe(n)&&(t=n),t=ke(t);let r=t,i=!1;for(t=t.trimStart();;){let e=Ee.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=De(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Te.test(t)&&(t=r),t.replace(Te,``)}function je(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
2
2
 
3
3
  `).trim()}var Me=`@xopc-ref:`,Ne=`[A-Za-z0-9_-]{1,64}`,Pe=RegExp(`${Me}(${Ne})`,`g`);function Fe(e){if(!RegExp(`^${Ne}$`).test(e))throw Error(`Invalid context reference id`);return`${Me}${e}`}function Ie(){return new RegExp(Pe.source,`g`)}function Le(e){let t=[],n=Ie(),r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`context_ref`,refId:i[1]??``}),r=i.index+i[0].length;return t.length===0?null:(r<e.length&&t.push({type:`text`,text:e.slice(r)}),{version:1,parts:t})}function Re(e){return e.parts.flatMap(e=>e.type===`context_ref`?[e.refId]:[])}function ze(e,t){return e.parts.map(e=>{if(e.type===`text`)return e.text;let n=t(e.refId)?.trim();return n?`@${n}`:``}).join(``)}function Be(e){return e.parts.map(e=>e.type===`text`?e.text:Fe(e.refId)).join(``)}function Ve(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.version!==1||!Array.isArray(t.parts)?!1:t.parts.every(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`text`?typeof t.text==`string`:t.type===`context_ref`&&typeof t.refId==`string`&&RegExp(`^${Ne}$`).test(t.refId)})}var He=8e3,Ue=u({schemaVersion:f([l(1),l(2)]).optional(),questions:me.optional(),interactionMode:m([`quick`,`compose`]).optional(),choiceDetails:ee(u({id:p().min(1).max(160),label:p().trim().min(1).max(1e3),description:p().max(2e3).optional()}).strict()).min(2).max(10).optional(),recommendedChoiceId:p().min(1).max(160).optional(),approval:u({operation:p().min(1).max(1e3),target:p().max(2e3).optional(),impact:p().max(4e3).optional(),argumentsPreview:d(p(),c()).optional()}).strict().optional()}),We=u({schemaVersion:f([l(1),l(2)]).optional(),answers:pe.optional(),response:u({choiceId:p().min(1).max(160).optional(),text:p().trim().max(He).optional()}).strict().optional(),decision:m([`approve`,`deny`]).optional()}).strict();We.extend({action:m([`answer`,`agent_decide`,`cancel`]),expectedVersion:h().int().positive(),idempotencyKey:p().trim().min(1).max(256)}).strict();function Ge(e){let t=Ue.safeParse(e);return t.success?t.data:{}}function Ke(e,t){let n=We.parse(t);if(e.schemaVersion===2){if(e.kind===`approval`||n.schemaVersion!==2||n.response||n.decision||!e.questions)throw Error(`Multi-question response requires schemaVersion 2`);return{schemaVersion:2,...E(e.questions,n.answers)}}if(n.schemaVersion===2||n.answers!==void 0)throw Error(`Unexpected multi-question response`);if(e.kind===`approval`){if(n.response||!n.decision)throw Error(`An explicit approval decision is required`);return{answer:n.decision,decision:n.decision}}if(n.decision||!n.response)throw Error(`A structured response is required`);let r=n.response.choiceId?e.choiceDetails?.find(e=>e.id===n.response.choiceId):void 0;if(n.response.choiceId&&!r)throw Error(`Unknown clarification choice`);let i=n.response.text?.trim()??``;if(!r&&!i)throw Error(`Answer is required`);return{answer:r&&i?`Choice: ${r.label}\nAdditional information: ${i}`:r?.label??i,response:{...r?{choiceId:r.id}:{},...i?{text:i}:{}}}}var qe=u({version:l(1),deliveryId:p().min(1),taskId:p().min(1),taskRunId:p().min(1),taskTitle:p().min(1).max(500),conversationId:p().min(1),originTranscriptId:p().min(1),requestInputId:p().optional(),assignmentEpoch:h().int().nonnegative(),resultRevision:h().int().positive().optional(),previousResultId:p().optional(),contractVersion:h().int().positive().optional(),instructionSequence:h().int().nonnegative().optional(),adoption:ee(u({entryId:p(),sequence:h().int(),status:m([`applied`,`partially_applied`,`not_applied`,`superseded`]),verification:m([`passed`,`failed`,`unverified`]),claimIds:ee(p()),note:p()})).optional(),outcome:_,text:p().optional(),createdAt:h()});function Je(e){let t=qe.safeParse(e);return t.success?t.data:void 0}var Ye=[`## Result for the originating conversation`,`For ordinary Tasks when publish_task_result is available, use it before completion to review the actual result. Connected Requests use their own structured result tool instead. When files were published, finalArtifactIds must select the exact final artifact IDs from publication receipts, including [] for a text-only result. Exclude intermediate, obsolete and failed files; publication history is not the final delivery manifest.`,`Provide a complete, evidence-grounded result for the originating conversation. The personal assistant may synthesize its final reply from your report. Match the user’s language and requested depth; preserve requested content, relevant sources, verified data cutoffs, uncertainty, and partial failures. Distinguish reported findings from verified facts. Do not invent a friendly opening or assume a new user request.`,`Keep internal planning, Agent names, tool logs, and task progress links out of the result unless the user specifically requested them or they are necessary to explain a blocker. Never substitute a progress page, a plan, or a promise for the requested result. Publish required files through the available artifact tools; do not repeat the same attachments or send the user to a Task page to collect them.`].join(`
4
4
  `),Xe=`Before finishing, call personal_request_result with the verified summary and, for mail, message items and coverage. The host composes the final explanation and preserves structured items in the main chat.`;function Ze(e){let t=e.replace(/\r\n/g,`
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-DGtk-KSF.js";import{t as l}from"./messages-DYDySzn1.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{n as g,r as _,t as v}from"./session-identity-label-BP7OIYth.js";import{t as y}from"./archive-Dz0hferG.js";import{n as b,r as x}from"./popover-select-CEMWIrtY.js";import{t as S}from"./circle-BoO4YvTx.js";import{t as C}from"./coins-DjP27vUx.js";import{t as ee}from"./database-CjjeZfRG.js";import{t as w}from"./download-Dk-ZjtO6.js";import{t as T}from"./folder-open-CyzJ19I9.js";import{t as E}from"./layers-mJW7JJKm.js";import{t as D}from"./layout-grid-CEVZdVFU.js";import{t as O}from"./message-square-fVE7Ghj1.js";import{t as k}from"./minimize-2-DtOGrlpo.js";import{t as A}from"./session-channel-icon-D1ktvt1P.js";import{n as j,t as M}from"./pin-off-BMRv-Kxr.js";import{t as N}from"./plus-Q2yW6OE7.js";import{t as P}from"./search-DA7gz22f.js";import{t as F}from"./settings-uiTATseT.js";import{t as I}from"./trash-2-DusmjVPV.js";import{t as te}from"./x-B_N4OPjy.js";import{t as L}from"./cn-0WouolD0.js";import{t as R}from"./skeleton-BI5TyibZ.js";import{a as z,c as B,f as V,n as ne,o as re,p as ie,r as ae,s as oe,t as se}from"./session-api-CpZ24vrQ.js";import{i as ce}from"./vendor-swr-CdRzEUwF.js";import{n as H,r as le}from"./gateway-config-swr-BW6eBLIt.js";import{t as ue}from"./chat-agents-api-CTL8cwNk.js";import{n as de,t as U}from"./registry-api-CRxE9kFY.js";import{t as W}from"./button-Cc4hUNTt.js";import{i as fe,o as pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as G,t as me}from"./interaction-BdhHBbYa.js";import{s as K}from"./form-field-width-DJw_jULe.js";import{t as he}from"./page-tabs-oeTY7z3_.js";import{t as ge}from"./agent-avatar-display-Cm0afn_O.js";import{t as _e}from"./sliding-tab-list-DuQyViqe.js";import{n as ve,r as ye,t as q}from"./settings-form-draft-Dy10ldo8.js";import{n as be}from"./model-selector-zD2x0Sn6.js";import{n as xe,r as Se}from"./segmented-styles-Cqb91xsn.js";import{t as J}from"./settings-advanced-section-DmCp3OWb.js";import{t as Y}from"./number-input-El7Szeln.js";import{n as Ce,t as we}from"./settings-page-header-4d1u-o-F.js";import"./settings-page-layout-Cy9_VBag.js";import{n as Te,t as X}from"./settings-form-section-num14vSv.js";import{n as Ee,t as De}from"./use-autosave-xytwr7Lc.js";import{t as Oe}from"./settings-advanced-gate-Ch9MNvvk.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:u}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,p=s(Le),m;t[3]!==p||t[4]!==n?(m=v(n,l(p).sidebar.sessionFilters),t[3]=p,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let b=!!g,x=n.status===`archived`,S=n.status===`pinned`,T=n.usage,E;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==T?(E=T?.calls?T.costCompleteness===`unknown`?i.costUnknown:`${T.costCompleteness===`partial`?`≥ `:`≈ `}${Me(T.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=T,t[11]=E):E=t[11];let D=E,k=T?.calls?T.costCompleteness===`partial`?i.costPartial:T.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,N=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,P;t[12]===N?P=t[13]:(P=L(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,N),t[12]=N,t[13]=P);let F;t[14]===c?F=t[15]:(F=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=F);let te=r===`list`&&`sm:py-3`,R;t[16]===te?R=t[17]:(R=L(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[16]=te,t[17]=R);let z;t[18]===n?z=t[19]:(z=(0,Q.jsx)(A,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=z);let B;t[20]===h?B=t[21]:(B=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[20]=h,t[21]=B);let V;t[22]!==z||t[23]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[z,B]}),t[22]=z,t[23]=B,t[24]=V):V=t[24];let ne;t[25]===S?ne=t[26]:(ne=S?(0,Q.jsx)(j,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=S,t[26]=ne);let re;t[27]===n.updatedAt?re=t[28]:(re=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=re);let ie;t[29]===re?ie=t[30]:(ie=(0,Q.jsx)(`span`,{children:re}),t[29]=re,t[30]=ie);let ae;t[31]!==ne||t[32]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[ne,ie]}),t[31]=ne,t[32]=ie,t[33]=ae):ae=t[33];let oe;t[34]!==V||t[35]!==ae||t[36]!==R?(oe=(0,Q.jsxs)(`div`,{className:R,children:[V,ae]}),t[34]=V,t[35]=ae,t[36]=R,t[37]=oe):oe=t[37];let se=r===`list`&&`sm:py-3`,ce;t[38]===se?ce=t[39]:(ce=L(`min-w-0 flex-1 px-3 py-2`,se),t[38]=se,t[39]=ce);let H=r===`list`&&`sm:items-start`,le;t[40]===H?le=t[41]:(le=L(`flex gap-3`,H),t[40]=H,t[41]=le);let ue;t[42]!==o||t[43]!==a?(ue=(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ue):ue=t[44];let de;t[45]===f?de=t[46]:(de=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[45]=f,t[46]=de);let U;t[47]!==n.key||t[48]!==b?(U=b?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=b,t[49]=U):U=t[49];let W;t[50]!==de||t[51]!==U?(W=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[de,U]}),t[50]=de,t[51]=U,t[52]=W):W=t[52];let fe;t[53]!==le||t[54]!==ue||t[55]!==W?(fe=(0,Q.jsxs)(`div`,{className:le,children:[ue,W]}),t[53]=le,t[54]=ue,t[55]=W,t[56]=fe):fe=t[56];let pe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=pe):pe=t[57];let G;t[58]===n.messageCount?G=t[59]:(G=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,n.messageCount]}),t[58]=n.messageCount,t[59]=G);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(ee,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let he=T?.totalTokens??0,_e;t[61]!==p||t[62]!==he?(_e=je(he,p),t[61]=p,t[62]=he,t[63]=_e):_e=t[63];let ve;t[64]!==i.tokens||t[65]!==_e?(ve=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,_e,` `,i.tokens]}),t[64]=i.tokens,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ye):ye=t[67];let q;t[68]!==D||t[69]!==k?(q=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:k,children:[ye,D]}),t[68]=D,t[69]=k,t[70]=q):q=t[70];let be;t[71]!==G||t[72]!==ve||t[73]!==q?(be=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[G,ve,q]}),t[71]=G,t[72]=ve,t[73]=q,t[74]=be):be=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==ce||t[78]!==fe||t[79]!==be||t[80]!==xe?(Se=(0,Q.jsxs)(`div`,{className:ce,children:[fe,be,xe]}),t[77]=ce,t[78]=fe,t[79]=be,t[80]=xe,t[81]=Se):Se=t[81];let J;t[82]===u?J=t[83]:(J=()=>u(`continue`),t[82]=u,t[83]=J);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==J?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.continueChat,"aria-label":i.continueChat,onClick:J,children:Y}),t[85]=i.continueChat,t[86]=J,t[87]=Ce):Ce=t[87];let we;t[88]!==x||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==u?(we=x?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>u(`unarchive`),children:(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.archive,"aria-label":i.archive,onClick:()=>u(`archive`),children:(0,Q.jsx)(y,{className:`size-4`,strokeWidth:1.75})}),t[88]=x,t[89]=i.archive,t[90]=i.unarchive,t[91]=u,t[92]=we):we=t[92];let Te;t[93]!==S||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==u?(Te=S?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unpin,"aria-label":i.unpin,onClick:()=>u(`unpin`),children:(0,Q.jsx)(M,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.pin,"aria-label":i.pin,onClick:()=>u(`pin`),children:(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75})}),t[93]=S,t[94]=i.pin,t[95]=i.unpin,t[96]=u,t[97]=Te):Te=t[97];let X;t[98]===u?X=t[99]:(X=()=>u(`export`),t[98]=u,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(w,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=L(me,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===u?Z=t[106]:(Z=()=>u(`delete`),t[105]=u,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(I,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==oe||t[119]!==Se||t[120]!==ze||t[121]!==P||t[122]!==F?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:P,onClick:c,onKeyDown:F,children:[oe,Se,ze]}),t[117]=c,t[118]=oe,t[119]=Se,t[120]=ze,t[121]=P,t[122]=F,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await H()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=q();function Ze(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,K,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,ke.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Q.jsx)(Y,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,ke.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=L(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Q.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function nt({hasToken:e}){let t=l(s(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=le(e),{data:i=[],isLoading:a}=ce(e?U:null,de,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[c,u]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(!1),m=(0,Z.useRef)(c.form);m.current=c.form;let h=(0,Z.useRef)(null);ve({enabled:e,parsed:o,dirty:p.current,trackedParsedRef:h,dispatch:u,onResetDirty:()=>{p.current=!1}});let g=c.form,_=c.baseline,v=!!(g&&_&&JSON.stringify(g)!==JSON.stringify(_)),y=(0,Z.useCallback)(e=>{p.current=!0,u({type:`patch`,patch:e})},[]),b=(0,Z.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=De({value:g,dirty:v,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!g)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-48`}),(0,Q.jsx)(R,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(R,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(g),C=Math.max(0,Je-g.reserveTokens),ee=Math.min(Math.floor(Je*g.triggerThreshold),C),w=Math.min(100,ee/Je*100),T=Math.min(100,C/Je*100),E=g.model?i.find(e=>e.id===g.model):void 0,D=E?.contextWindow&&g.summaryChunkTokens+g.summaryMaxTokens+4096>E.contextWindow,O=g.keepRecentTokens+g.reserveTokens>ee,A=Math.round(g.summaryTimeoutMs*(g.summaryRetries+1)/1e3),j=e=>{let t=Ye[e];y({...t,...g.model?{model:g.model}:{model:void 0},postCompactionSections:g.postCompactionSections})},M={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},P=()=>{let e=d.trim();!e||g.postCompactionSections.includes(e)||g.postCompactionSections.length>=12||(y({postCompactionSections:[...g.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:x.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:k,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:x.status,error:x.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g.enabled,onChange:e=>y({enabled:e.target.checked})}),g.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,g.enabled?null:(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Q.jsxs)(`fieldset`,{disabled:!g.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:L(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,G.transition,G.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>j(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:M[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:M[e].hint})]},e))})]}),(0,Q.jsxs)(J,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(ee)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${w}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${T}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((g.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(g.reserveTokens)),value:g.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:g.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(g.keepRecentTokens)),value:g.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),O?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(be,{value:g.model??``,disabled:!g.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),g.model?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:g.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:g.gapAudit,onChange:e=>y({gapAudit:e})})]}),g.qualityGuard?null:(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:g.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((g.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:g.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:g.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(A)),value:g.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:g.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:g.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),D?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),g.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g.postCompactionSections.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Q.jsx)(`button`,{type:`button`,className:L(`text-fg-muted hover:text-fg`,G.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:g.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:g.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),P())}}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!d.trim()||g.postCompactionSections.length>=12,onClick:P,children:[(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),H()}function st(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=q();function lt({hasToken:e}){let t=l(s(e=>e.language)).sessions.config,{data:n,isLoading:r}=le(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,Z.useReducer)(ct,{form:null,baseline:null}),c=a.form,u=a.baseline,d=(0,Z.useRef)(!1),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(null);ve({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{d.current=!1}});let m=!!(c&&u&&JSON.stringify(c)!==JSON.stringify(u)),h=(0,Z.useCallback)(e=>{d.current=!0,o({type:`patch`,patch:e})},[]),g=De({value:c,dirty:m,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!c?r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-40`}),(0,Q.jsx)(R,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:g.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:ee,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:g.status,error:g.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(J,{title:t.dmScope,summary:c.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(b,{className:st(),value:c.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Q.jsx)(x,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(x,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(x,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(x,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:0,className:st(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsx)(J,{title:t.maxEntries,summary:c.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:1,className:st(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:g,onPin:_,onUnpin:v,onExport:y,onDelete:b}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let ee;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=ee):ee=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=L(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,fe,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]!==i||t[5]!==o||t[6]!==a?(T=i&&a?(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=T):T=t[7];let E;t[8]!==s.unnamedSession||t[9]!==i?.name?(E=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=E):E=t[10];let D;t[11]===E?D=t[12]:(D=(0,Q.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:E}),t[11]=E,t[12]=D);let O;t[13]!==T||t[14]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[T,D]}),t[13]=T,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===s.close?A=t[18]:(A=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:k})}),t[17]=s.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==g?(F=x?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.unarchive}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=g,t[37]=F):F=t[37];let I;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==_||t[42]!==v?(I=S?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:s.unpin}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=_,t[42]=v,t[43]=I):I=t[43];let R;t[44]!==s.delete||t[45]!==b?(R=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=R):R=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==I||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,I,R]})}),t[47]=P,t[48]=F,t[49]=I,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(f,{children:[ee,(0,Q.jsxs)(p,{className:w,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==C||t[58]!==B?(V=(0,Q.jsx)(h,{open:n,onOpenChange:C,children:B}),t[56]=n,t[57]=C,t[58]=B,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,ke.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?E:F})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(he,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,ke.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a!==void 0&&a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(s(e=>e.language)),t=e.sessions,n=o(e=>e.conversationId),r=!!n,{data:a,mutate:c}=ce(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),d=a?.defaultId??`main`,_=a?.items??[],[v,b]=i(),x=vt(v.get(`tab`)),C=(0,Z.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),b(t,{replace:!0})},[v,b]),[ee,w]=(0,Z.useReducer)(ye,v,Ct),{searchInput:O,debouncedSearch:k,statusFilter:A,viewMode:M,channelFilter:N,sessions:F,loading:I,error:te,hasMore:R,stats:H,detailOpen:le,detailLoading:de,detailSession:U,confirmOpen:me,confirmKey:K}=ee;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=O.trim();k!==e&&w({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[O,k]);let he=v.toString(),ge=(0,Z.useRef)(he);if(ge.current!==he){ge.current=he;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();w({type:`patch`,patch:{...O===e?{}:{searchInput:e},...k===o?{}:{debouncedSearch:o},...A===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...N===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(v),t=k.trim();t?e.set(`q`,t):e.delete(`q`),A===`all`?e.delete(`status`):e.set(`status`,A),M===`grid`?e.delete(`view`):e.set(`view`,M),N?e.set(`channel`,N):e.delete(`channel`),e.toString()!==v.toString()&&b(e,{replace:!0})},[k,v,b,A,M,N]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{w({type:`patch`,patch:{loading:!0,error:null}});try{let t=await oe({limit:pt,offset:0,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});if(e)return;w({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||w({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||w({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,k,A,N,t.loadError]),(0,Z.useEffect)(()=>{!r||x!==`sessions`||re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,c]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||w({type:`patch`,patch:{sessions:F.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:U&&U.key===t.key?{...U,name:t.name}:U}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,F,U]);let ve=(0,Z.useCallback)(async()=>{if(!(!r||I||!R)){w({type:`patch`,patch:{loading:!0,error:null}});try{let e=await oe({limit:pt,offset:F.length,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});w({type:`patch`,patch:{sessions:[...F,...e.items],hasMore:e.hasMore}})}catch(e){w({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{w({type:`patch`,patch:{loading:!1}})}}},[r,I,R,F.length,k,A,N,t.loadError]),q=(0,Z.useCallback)((e,t)=>{w({type:`patch`,patch:{sessions:F.map(n=>n.key===e?{...n,status:t}:n),detailSession:U&&U.key===e?{...U,status:t}:U}})},[F,U]),be=(0,Z.useCallback)(async e=>{w({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{let t=await z(e);w({type:`patch`,patch:{detailSession:t}})}catch{w({type:`patch`,patch:{detailOpen:!1}})}finally{w({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{be(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){w({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await se(e),q(e,`archived`);break;case`unarchive`:await V(e),q(e,`active`);break;case`pin`:await B(e),q(e,`pinned`);break;case`unpin`:await ie(e),q(e,`active`);break;case`export`:{let t=await ae(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await ne(e),w({type:`patch`,patch:{sessions:F.filter(t=>t.key!==e),detailSession:U?.key===e?null:U,...U?.key===e?{detailOpen:!1}:{}}}),re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:E},{key:`active`,label:t.filterActive,icon:S},{key:`pinned`,label:t.filterPinned,icon:j},{key:`archived`,label:t.filterArchived,icon:y}],Oe=(()=>{let e=Object.entries(H?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:x,onChange:C}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(_e,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":A===e,onClick:()=>w({type:`patch`,patch:{statusFilter:e}}),className:L(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,A===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:O,onChange:e=>w({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":k||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(_e,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!N,onClick:()=>w({type:`patch`,patch:{channelFilter:``}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":N===e,onClick:()=>w({type:`patch`,patch:{channelFilter:e}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,H?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:H.byChannel[e]})]},e))]}),H?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[H.totalSessions,t.totalSessions],[H.activeSessions,t.activeSessions],[H.pinnedSessions,t.pinnedSessions],[H.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,te?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:te}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:F.length})}),(0,Q.jsxs)(_e,{className:Se,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>w({type:`patch`,patch:{viewMode:`grid`}}),className:L(xe,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(D,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>w({type:`patch`,patch:{viewMode:`list`}}),className:L(xe,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Q.jsx)(g,{className:`size-3.5`,strokeWidth:1.5})})]})]}),I&&F.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):F.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(T,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:L(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":k||void 0,children:F.map(e=>{let t=Re(e,d);return(0,Q.jsx)(Ne,{session:e,variant:M,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,_),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),R?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:I,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:de,session:U,sessionAgentId:U?Re(U,d):void 0,sessionAgentAvatar:U?ze(Re(U,d),_):void 0,labels:Ee,onClose:()=>{w({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>U&&void Y(U.key,`archive`),onUnarchive:()=>U&&void Y(U.key,`unarchive`),onPin:()=>U&&void Y(U.key,`pin`),onUnpin:()=>U&&void Y(U.key,`unpin`),onExport:()=>U&&void Y(U.key,`export`),onDelete:()=>U&&w({type:`patch`,patch:{confirmKey:U.key,confirmOpen:!0}})}),(0,Q.jsx)(h,{open:me,onOpenChange:e=>w({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Q.jsxs)(p,{className:L(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,fe),children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:F.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>w({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Te(K),w({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-Bld7_m-Q.js";import{t as l}from"./messages-CGO1P4mz.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{n as g,r as _,t as v}from"./session-identity-label-BP7OIYth.js";import{t as y}from"./archive-Dz0hferG.js";import{n as b,r as x}from"./popover-select-CLsphyzA.js";import{t as S}from"./circle-BoO4YvTx.js";import{t as C}from"./coins-DjP27vUx.js";import{t as ee}from"./database-CjjeZfRG.js";import{t as w}from"./download-Dk-ZjtO6.js";import{t as T}from"./folder-open-CyzJ19I9.js";import{t as E}from"./layers-mJW7JJKm.js";import{t as D}from"./layout-grid-CEVZdVFU.js";import{t as O}from"./message-square-fVE7Ghj1.js";import{t as k}from"./minimize-2-DtOGrlpo.js";import{t as A}from"./session-channel-icon-D1ktvt1P.js";import{n as j,t as M}from"./pin-off-BMRv-Kxr.js";import{t as N}from"./plus-Q2yW6OE7.js";import{t as P}from"./search-DA7gz22f.js";import{t as F}from"./settings-uiTATseT.js";import{t as I}from"./trash-2-DusmjVPV.js";import{t as te}from"./x-B_N4OPjy.js";import{t as L}from"./cn-0WouolD0.js";import{t as R}from"./skeleton-DzdOeGYz.js";import{a as z,c as B,f as V,n as ne,o as re,p as ie,r as ae,s as oe,t as se}from"./session-api-DjnHJ-0n.js";import{i as ce}from"./vendor-swr-CdRzEUwF.js";import{n as H,r as le}from"./gateway-config-swr-B5THNdYK.js";import{t as ue}from"./chat-agents-api-BOB3dILf.js";import{n as de,t as U}from"./registry-api-Bdp3UUyz.js";import{t as W}from"./button-Cc4hUNTt.js";import{i as fe,o as pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as G,t as me}from"./interaction-BdhHBbYa.js";import{s as K}from"./form-field-width-DJw_jULe.js";import{t as he}from"./page-tabs-oeTY7z3_.js";import{t as ge}from"./agent-avatar-display-DINzeGs0.js";import{t as _e}from"./sliding-tab-list-DuQyViqe.js";import{n as ve,r as ye,t as q}from"./settings-form-draft-Dy10ldo8.js";import{n as be}from"./model-selector-yAKlOR3O.js";import{n as xe,r as Se}from"./segmented-styles-Cqb91xsn.js";import{t as J}from"./settings-advanced-section-CM44UlF8.js";import{t as Y}from"./number-input-El7Szeln.js";import{n as Ce,t as we}from"./settings-page-header-BYFaTD8a.js";import"./settings-page-layout-CnUQSxT3.js";import{n as Te,t as X}from"./settings-form-section-num14vSv.js";import{n as Ee,t as De}from"./use-autosave-DsqcLHV9.js";import{t as Oe}from"./settings-advanced-gate-DyGT3o1e.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:u}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,p=s(Le),m;t[3]!==p||t[4]!==n?(m=v(n,l(p).sidebar.sessionFilters),t[3]=p,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let b=!!g,x=n.status===`archived`,S=n.status===`pinned`,T=n.usage,E;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==T?(E=T?.calls?T.costCompleteness===`unknown`?i.costUnknown:`${T.costCompleteness===`partial`?`≥ `:`≈ `}${Me(T.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=T,t[11]=E):E=t[11];let D=E,k=T?.calls?T.costCompleteness===`partial`?i.costPartial:T.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,N=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,P;t[12]===N?P=t[13]:(P=L(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,N),t[12]=N,t[13]=P);let F;t[14]===c?F=t[15]:(F=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=F);let te=r===`list`&&`sm:py-3`,R;t[16]===te?R=t[17]:(R=L(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[16]=te,t[17]=R);let z;t[18]===n?z=t[19]:(z=(0,Q.jsx)(A,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=z);let B;t[20]===h?B=t[21]:(B=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[20]=h,t[21]=B);let V;t[22]!==z||t[23]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[z,B]}),t[22]=z,t[23]=B,t[24]=V):V=t[24];let ne;t[25]===S?ne=t[26]:(ne=S?(0,Q.jsx)(j,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=S,t[26]=ne);let re;t[27]===n.updatedAt?re=t[28]:(re=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=re);let ie;t[29]===re?ie=t[30]:(ie=(0,Q.jsx)(`span`,{children:re}),t[29]=re,t[30]=ie);let ae;t[31]!==ne||t[32]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[ne,ie]}),t[31]=ne,t[32]=ie,t[33]=ae):ae=t[33];let oe;t[34]!==V||t[35]!==ae||t[36]!==R?(oe=(0,Q.jsxs)(`div`,{className:R,children:[V,ae]}),t[34]=V,t[35]=ae,t[36]=R,t[37]=oe):oe=t[37];let se=r===`list`&&`sm:py-3`,ce;t[38]===se?ce=t[39]:(ce=L(`min-w-0 flex-1 px-3 py-2`,se),t[38]=se,t[39]=ce);let H=r===`list`&&`sm:items-start`,le;t[40]===H?le=t[41]:(le=L(`flex gap-3`,H),t[40]=H,t[41]=le);let ue;t[42]!==o||t[43]!==a?(ue=(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ue):ue=t[44];let de;t[45]===f?de=t[46]:(de=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[45]=f,t[46]=de);let U;t[47]!==n.key||t[48]!==b?(U=b?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=b,t[49]=U):U=t[49];let W;t[50]!==de||t[51]!==U?(W=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[de,U]}),t[50]=de,t[51]=U,t[52]=W):W=t[52];let fe;t[53]!==le||t[54]!==ue||t[55]!==W?(fe=(0,Q.jsxs)(`div`,{className:le,children:[ue,W]}),t[53]=le,t[54]=ue,t[55]=W,t[56]=fe):fe=t[56];let pe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=pe):pe=t[57];let G;t[58]===n.messageCount?G=t[59]:(G=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,n.messageCount]}),t[58]=n.messageCount,t[59]=G);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(ee,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let he=T?.totalTokens??0,_e;t[61]!==p||t[62]!==he?(_e=je(he,p),t[61]=p,t[62]=he,t[63]=_e):_e=t[63];let ve;t[64]!==i.tokens||t[65]!==_e?(ve=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,_e,` `,i.tokens]}),t[64]=i.tokens,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ye):ye=t[67];let q;t[68]!==D||t[69]!==k?(q=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:k,children:[ye,D]}),t[68]=D,t[69]=k,t[70]=q):q=t[70];let be;t[71]!==G||t[72]!==ve||t[73]!==q?(be=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[G,ve,q]}),t[71]=G,t[72]=ve,t[73]=q,t[74]=be):be=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==ce||t[78]!==fe||t[79]!==be||t[80]!==xe?(Se=(0,Q.jsxs)(`div`,{className:ce,children:[fe,be,xe]}),t[77]=ce,t[78]=fe,t[79]=be,t[80]=xe,t[81]=Se):Se=t[81];let J;t[82]===u?J=t[83]:(J=()=>u(`continue`),t[82]=u,t[83]=J);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==J?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.continueChat,"aria-label":i.continueChat,onClick:J,children:Y}),t[85]=i.continueChat,t[86]=J,t[87]=Ce):Ce=t[87];let we;t[88]!==x||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==u?(we=x?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>u(`unarchive`),children:(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.archive,"aria-label":i.archive,onClick:()=>u(`archive`),children:(0,Q.jsx)(y,{className:`size-4`,strokeWidth:1.75})}),t[88]=x,t[89]=i.archive,t[90]=i.unarchive,t[91]=u,t[92]=we):we=t[92];let Te;t[93]!==S||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==u?(Te=S?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unpin,"aria-label":i.unpin,onClick:()=>u(`unpin`),children:(0,Q.jsx)(M,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.pin,"aria-label":i.pin,onClick:()=>u(`pin`),children:(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75})}),t[93]=S,t[94]=i.pin,t[95]=i.unpin,t[96]=u,t[97]=Te):Te=t[97];let X;t[98]===u?X=t[99]:(X=()=>u(`export`),t[98]=u,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(w,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=L(me,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===u?Z=t[106]:(Z=()=>u(`delete`),t[105]=u,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(I,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==oe||t[119]!==Se||t[120]!==ze||t[121]!==P||t[122]!==F?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:P,onClick:c,onKeyDown:F,children:[oe,Se,ze]}),t[117]=c,t[118]=oe,t[119]=Se,t[120]=ze,t[121]=P,t[122]=F,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await H()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=q();function Ze(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,K,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,ke.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Q.jsx)(Y,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,ke.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=L(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Q.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function nt({hasToken:e}){let t=l(s(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=le(e),{data:i=[],isLoading:a}=ce(e?U:null,de,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[c,u]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(!1),m=(0,Z.useRef)(c.form);m.current=c.form;let h=(0,Z.useRef)(null);ve({enabled:e,parsed:o,dirty:p.current,trackedParsedRef:h,dispatch:u,onResetDirty:()=>{p.current=!1}});let g=c.form,_=c.baseline,v=!!(g&&_&&JSON.stringify(g)!==JSON.stringify(_)),y=(0,Z.useCallback)(e=>{p.current=!0,u({type:`patch`,patch:e})},[]),b=(0,Z.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=De({value:g,dirty:v,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!g)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-48`}),(0,Q.jsx)(R,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(R,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(g),C=Math.max(0,Je-g.reserveTokens),ee=Math.min(Math.floor(Je*g.triggerThreshold),C),w=Math.min(100,ee/Je*100),T=Math.min(100,C/Je*100),E=g.model?i.find(e=>e.id===g.model):void 0,D=E?.contextWindow&&g.summaryChunkTokens+g.summaryMaxTokens+4096>E.contextWindow,O=g.keepRecentTokens+g.reserveTokens>ee,A=Math.round(g.summaryTimeoutMs*(g.summaryRetries+1)/1e3),j=e=>{let t=Ye[e];y({...t,...g.model?{model:g.model}:{model:void 0},postCompactionSections:g.postCompactionSections})},M={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},P=()=>{let e=d.trim();!e||g.postCompactionSections.includes(e)||g.postCompactionSections.length>=12||(y({postCompactionSections:[...g.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:x.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:k,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:x.status,error:x.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g.enabled,onChange:e=>y({enabled:e.target.checked})}),g.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,g.enabled?null:(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Q.jsxs)(`fieldset`,{disabled:!g.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:L(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,G.transition,G.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>j(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:M[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:M[e].hint})]},e))})]}),(0,Q.jsxs)(J,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(ee)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${w}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${T}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((g.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(g.reserveTokens)),value:g.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:g.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(g.keepRecentTokens)),value:g.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),O?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(be,{value:g.model??``,disabled:!g.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),g.model?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:g.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:g.gapAudit,onChange:e=>y({gapAudit:e})})]}),g.qualityGuard?null:(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:g.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((g.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:g.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:g.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(A)),value:g.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:g.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:g.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),D?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),g.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g.postCompactionSections.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Q.jsx)(`button`,{type:`button`,className:L(`text-fg-muted hover:text-fg`,G.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:g.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:g.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),P())}}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!d.trim()||g.postCompactionSections.length>=12,onClick:P,children:[(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),H()}function st(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=q();function lt({hasToken:e}){let t=l(s(e=>e.language)).sessions.config,{data:n,isLoading:r}=le(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,Z.useReducer)(ct,{form:null,baseline:null}),c=a.form,u=a.baseline,d=(0,Z.useRef)(!1),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(null);ve({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{d.current=!1}});let m=!!(c&&u&&JSON.stringify(c)!==JSON.stringify(u)),h=(0,Z.useCallback)(e=>{d.current=!0,o({type:`patch`,patch:e})},[]),g=De({value:c,dirty:m,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!c?r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-40`}),(0,Q.jsx)(R,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:g.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:ee,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:g.status,error:g.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(J,{title:t.dmScope,summary:c.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(b,{className:st(),value:c.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Q.jsx)(x,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(x,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(x,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(x,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:0,className:st(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsx)(J,{title:t.maxEntries,summary:c.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:1,className:st(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:g,onPin:_,onUnpin:v,onExport:y,onDelete:b}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let ee;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=ee):ee=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=L(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,fe,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]!==i||t[5]!==o||t[6]!==a?(T=i&&a?(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=T):T=t[7];let E;t[8]!==s.unnamedSession||t[9]!==i?.name?(E=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=E):E=t[10];let D;t[11]===E?D=t[12]:(D=(0,Q.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:E}),t[11]=E,t[12]=D);let O;t[13]!==T||t[14]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[T,D]}),t[13]=T,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===s.close?A=t[18]:(A=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:k})}),t[17]=s.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==g?(F=x?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.unarchive}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=g,t[37]=F):F=t[37];let I;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==_||t[42]!==v?(I=S?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:s.unpin}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=_,t[42]=v,t[43]=I):I=t[43];let R;t[44]!==s.delete||t[45]!==b?(R=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=R):R=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==I||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,I,R]})}),t[47]=P,t[48]=F,t[49]=I,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(f,{children:[ee,(0,Q.jsxs)(p,{className:w,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==C||t[58]!==B?(V=(0,Q.jsx)(h,{open:n,onOpenChange:C,children:B}),t[56]=n,t[57]=C,t[58]=B,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,ke.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?E:F})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(he,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,ke.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a!==void 0&&a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(s(e=>e.language)),t=e.sessions,n=o(e=>e.conversationId),r=!!n,{data:a,mutate:c}=ce(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),d=a?.defaultId??`main`,_=a?.items??[],[v,b]=i(),x=vt(v.get(`tab`)),C=(0,Z.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),b(t,{replace:!0})},[v,b]),[ee,w]=(0,Z.useReducer)(ye,v,Ct),{searchInput:O,debouncedSearch:k,statusFilter:A,viewMode:M,channelFilter:N,sessions:F,loading:I,error:te,hasMore:R,stats:H,detailOpen:le,detailLoading:de,detailSession:U,confirmOpen:me,confirmKey:K}=ee;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=O.trim();k!==e&&w({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[O,k]);let he=v.toString(),ge=(0,Z.useRef)(he);if(ge.current!==he){ge.current=he;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();w({type:`patch`,patch:{...O===e?{}:{searchInput:e},...k===o?{}:{debouncedSearch:o},...A===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...N===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(v),t=k.trim();t?e.set(`q`,t):e.delete(`q`),A===`all`?e.delete(`status`):e.set(`status`,A),M===`grid`?e.delete(`view`):e.set(`view`,M),N?e.set(`channel`,N):e.delete(`channel`),e.toString()!==v.toString()&&b(e,{replace:!0})},[k,v,b,A,M,N]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{w({type:`patch`,patch:{loading:!0,error:null}});try{let t=await oe({limit:pt,offset:0,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});if(e)return;w({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||w({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||w({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,k,A,N,t.loadError]),(0,Z.useEffect)(()=>{!r||x!==`sessions`||re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,c]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||w({type:`patch`,patch:{sessions:F.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:U&&U.key===t.key?{...U,name:t.name}:U}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,F,U]);let ve=(0,Z.useCallback)(async()=>{if(!(!r||I||!R)){w({type:`patch`,patch:{loading:!0,error:null}});try{let e=await oe({limit:pt,offset:F.length,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});w({type:`patch`,patch:{sessions:[...F,...e.items],hasMore:e.hasMore}})}catch(e){w({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{w({type:`patch`,patch:{loading:!1}})}}},[r,I,R,F.length,k,A,N,t.loadError]),q=(0,Z.useCallback)((e,t)=>{w({type:`patch`,patch:{sessions:F.map(n=>n.key===e?{...n,status:t}:n),detailSession:U&&U.key===e?{...U,status:t}:U}})},[F,U]),be=(0,Z.useCallback)(async e=>{w({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{let t=await z(e);w({type:`patch`,patch:{detailSession:t}})}catch{w({type:`patch`,patch:{detailOpen:!1}})}finally{w({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{be(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){w({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await se(e),q(e,`archived`);break;case`unarchive`:await V(e),q(e,`active`);break;case`pin`:await B(e),q(e,`pinned`);break;case`unpin`:await ie(e),q(e,`active`);break;case`export`:{let t=await ae(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await ne(e),w({type:`patch`,patch:{sessions:F.filter(t=>t.key!==e),detailSession:U?.key===e?null:U,...U?.key===e?{detailOpen:!1}:{}}}),re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:E},{key:`active`,label:t.filterActive,icon:S},{key:`pinned`,label:t.filterPinned,icon:j},{key:`archived`,label:t.filterArchived,icon:y}],Oe=(()=>{let e=Object.entries(H?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:x,onChange:C}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(_e,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":A===e,onClick:()=>w({type:`patch`,patch:{statusFilter:e}}),className:L(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,A===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:O,onChange:e=>w({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":k||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(_e,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!N,onClick:()=>w({type:`patch`,patch:{channelFilter:``}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":N===e,onClick:()=>w({type:`patch`,patch:{channelFilter:e}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,H?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:H.byChannel[e]})]},e))]}),H?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[H.totalSessions,t.totalSessions],[H.activeSessions,t.activeSessions],[H.pinnedSessions,t.pinnedSessions],[H.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,te?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:te}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:F.length})}),(0,Q.jsxs)(_e,{className:Se,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>w({type:`patch`,patch:{viewMode:`grid`}}),className:L(xe,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(D,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>w({type:`patch`,patch:{viewMode:`list`}}),className:L(xe,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Q.jsx)(g,{className:`size-3.5`,strokeWidth:1.5})})]})]}),I&&F.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):F.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(T,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:L(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":k||void 0,children:F.map(e=>{let t=Re(e,d);return(0,Q.jsx)(Ne,{session:e,variant:M,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,_),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),R?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:I,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:de,session:U,sessionAgentId:U?Re(U,d):void 0,sessionAgentAvatar:U?ze(Re(U,d),_):void 0,labels:Ee,onClose:()=>{w({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>U&&void Y(U.key,`archive`),onUnarchive:()=>U&&void Y(U.key,`unarchive`),onPin:()=>U&&void Y(U.key,`pin`),onUnpin:()=>U&&void Y(U.key,`unpin`),onExport:()=>U&&void Y(U.key,`export`),onDelete:()=>U&&w({type:`patch`,patch:{confirmKey:U.key,confirmOpen:!0}})}),(0,Q.jsx)(h,{open:me,onOpenChange:e=>w({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Q.jsxs)(p,{className:L(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,fe),children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:F.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>w({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Te(K),w({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
@@ -0,0 +1 @@
1
+ import{n as e}from"./settings-mode-store-Blc4C8aw.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n}from"./locale-store-DGtk-KSF.js";import{t as r}from"./button-Cc4hUNTt.js";import{t as i}from"./settings-mode-store-fZ6mzf4A.js";var a=e(),o=t();function s(e){let t=(0,a.c)(15),{title:s,summary:d,children:f}=e,p=i(u),m=i(l),h=n(c)===`zh`;if(p)return f;let g;t[0]===s?g=t[1]:(g=(0,o.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:s}),t[0]=s,t[1]=g);let _;t[2]===d?_=t[3]:(_=(0,o.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d}),t[2]=d,t[3]=_);let v;t[4]!==g||t[5]!==_?(v=(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,_]}),t[4]=g,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=()=>m(`advanced`),t[7]=m,t[8]=y);let b=h?`查看高级设置`:`Show advanced settings`,x;t[9]!==y||t[10]!==b?(x=(0,o.jsx)(r,{type:`button`,variant:`ghost`,onClick:y,children:b}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;return t[12]!==v||t[13]!==x?(S=(0,o.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-surface-hover/20 p-4`,children:[v,x]}),t[12]=v,t[13]=x,t[14]=S):S=t[14],S}function c(e){return e.language}function l(e){return e.setMode}function u(e){return e.mode===`advanced`}export{s as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n}from"./locale-store-Bld7_m-Q.js";import{t as r}from"./button-Cc4hUNTt.js";import{t as i}from"./settings-mode-store-Blc4C8aw.js";var a=e(),o=t();function s(e){let t=(0,a.c)(15),{title:s,summary:d,children:f}=e,p=i(u),m=i(l),h=n(c)===`zh`;if(p)return f;let g;t[0]===s?g=t[1]:(g=(0,o.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:s}),t[0]=s,t[1]=g);let _;t[2]===d?_=t[3]:(_=(0,o.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d}),t[2]=d,t[3]=_);let v;t[4]!==g||t[5]!==_?(v=(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,_]}),t[4]=g,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=()=>m(`advanced`),t[7]=m,t[8]=y);let b=h?`查看高级设置`:`Show advanced settings`,x;t[9]!==y||t[10]!==b?(x=(0,o.jsx)(r,{type:`button`,variant:`ghost`,onClick:y,children:b}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;return t[12]!==v||t[13]!==x?(S=(0,o.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-surface-hover/20 p-4`,children:[v,x]}),t[12]=v,t[13]=x,t[14]=S):S=t[14],S}function c(e){return e.language}function l(e){return e.setMode}function u(e){return e.mode===`advanced`}export{s as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./skeleton-BI5TyibZ.js";var r=e(),i=t();function a(e){let t=(0,r.c)(3),{sections:a}=e,s=a===void 0?2:a,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-6 w-48 max-w-full`}),(0,i.jsx)(n,{className:`h-4 w-80 max-w-full`})]}),t[0]=c):c=t[0];let l;return t[1]===s?l=t[2]:(l=(0,i.jsxs)(`div`,{className:`flex flex-col gap-6`,"aria-busy":`true`,children:[c,Array.from({length:s}).map(o)]}),t[1]=s,t[2]=l),l}function o(e,t){return(0,i.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-5 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-4 w-72 max-w-full`}),(0,i.jsx)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:Array.from({length:4}).map(s)})]},t)}function s(e,t){return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-3 w-24`}),(0,i.jsx)(n,{className:`h-10 w-full rounded-lg`})]},t)}function c(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,o;return t[0]===a?o=t[1]:(o=(0,i.jsx)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:Array.from({length:a}).map(l)}),t[0]=a,t[1]=o),o}function l(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-64 max-w-full`})]},t)}export{a as n,c as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./skeleton-DzdOeGYz.js";var r=e(),i=t();function a(e){let t=(0,r.c)(3),{sections:a}=e,s=a===void 0?2:a,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-6 w-48 max-w-full`}),(0,i.jsx)(n,{className:`h-4 w-80 max-w-full`})]}),t[0]=c):c=t[0];let l;return t[1]===s?l=t[2]:(l=(0,i.jsxs)(`div`,{className:`flex flex-col gap-6`,"aria-busy":`true`,children:[c,Array.from({length:s}).map(o)]}),t[1]=s,t[2]=l),l}function o(e,t){return(0,i.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-5 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-4 w-72 max-w-full`}),(0,i.jsx)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:Array.from({length:4}).map(s)})]},t)}function s(e,t){return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-3 w-24`}),(0,i.jsx)(n,{className:`h-10 w-full rounded-lg`})]},t)}function c(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,o;return t[0]===a?o=t[1]:(o=(0,i.jsx)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:Array.from({length:a}).map(l)}),t[0]=a,t[1]=o),o}function l(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-64 max-w-full`})]},t)}export{a as n,c as t};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-DGtk-KSF.js";import{t}from"./middleware-Pd0e8Igk.js";var n=e(t(e=>({mode:`simple`,setMode:t=>e({mode:t}),setShowAdvanced:t=>e({mode:t?`advanced`:`simple`})}),{name:`xopc-web-settings-mode`}));function r(){return n(i)}function i(e){return e.mode===`advanced`}export{r as n,n as t};
1
+ import{p as e}from"./locale-store-Bld7_m-Q.js";import{t}from"./middleware-Pd0e8Igk.js";var n=e(t(e=>({mode:`simple`,setMode:t=>e({mode:t}),setShowAdvanced:t=>e({mode:t?`advanced`:`simple`})}),{name:`xopc-web-settings-mode`}));function r(){return n(i)}function i(e){return e.mode===`advanced`}export{r as n,n as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as r}from"./locale-store-DGtk-KSF.js";import{t as i}from"./external-link-DjqjBmc3.js";import{t as a}from"./sparkles-DHlfQFAF.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./button-Cc4hUNTt.js";var c=e(),l=t();function u(e){let t=(0,c.c)(14),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({children:n,className:r,gap:a,padding:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let u=a===void 0?`gap-5`:a,d=s===void 0?`px-4 py-6 sm:px-5 xl:px-6`:s,f;t[6]!==r||t[7]!==u||t[8]!==d?(f=o(`settings-page-frame mx-auto flex min-h-full w-full max-w-[56rem] flex-col`,u,d,r),t[6]=r,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==i||t[12]!==f?(p=(0,l.jsx)(`div`,{className:f,...i,children:n}),t[10]=n,t[11]=i,t[12]=f,t[13]=p):p=t[13],p}var d={phone:{scene:`configure-phone`,zh:`帮我配置 Phone Use,从模型、依赖、手机连接到验收。`,en:`Help configure Phone Use: model, dependencies, phone connection and verification.`},browser:{scene:`configure-xopc`,zh:`帮我配置 Browser Use,连接本机 Chrome 并完成验收。`,en:`Help me configure Browser Use with local Chrome and verify it.`}};function f(e){let t=(0,c.c)(8),{target:i}=e,o=r(p)===`zh`,u=d[i],f=o?u.zh:u.en,m;t[0]!==u.scene||t[1]!==f?(m=new URLSearchParams({skill:`configure-xopc`,scene:u.scene,draft:f,autoSend:`1`}),t[0]=u.scene,t[1]=f,t[2]=m):m=t[2];let h=`/chat/new?${m}`,g=o?`让 AI 帮我配置`:`Set up with AI`,_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,l.jsx)(a,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[3]=_):_=t[3];let v=o?`AI 配置`:`AI setup`,y;return t[4]!==h||t[5]!==g||t[6]!==v?(y=(0,l.jsx)(s,{asChild:!0,className:`order-first whitespace-nowrap sm:order-last text-accent-fg shadow-none sm:shadow-none`,children:(0,l.jsxs)(n,{to:h,title:g,children:[_,v]})}),t[4]=h,t[5]=g,t[6]=v,t[7]=y):y=t[7],y}function p(e){return e.language}function m(e){let t=(0,c.c)(22),{title:n,subtitle:r,docsLink:a,docsLabel:s,meta:u,actions:d,aiSetup:p,className:m}=e,h=p?`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3`:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,g;t[0]!==m||t[1]!==h?(g=o(h,m),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=(0,l.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight sm:text-lg text-fg`,children:n}),t[3]=n,t[4]=_);let v;t[5]===r?v=t[6]:(v=r?(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:r}):null,t[5]=r,t[6]=v);let y;t[7]!==s||t[8]!==a?(y=a&&s?(0,l.jsxs)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,className:`touch-target mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[s,(0,l.jsx)(i,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[7]=s,t[8]=a,t[9]=y):y=t[9];let b;t[10]!==u||t[11]!==_||t[12]!==v||t[13]!==y?(b=(0,l.jsxs)(`div`,{className:`min-w-0`,children:[_,v,y,u]}),t[10]=u,t[11]=_,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]!==d||t[16]!==p?(x=d||p?(0,l.jsxs)(`div`,{className:o(`flex shrink-0 items-center gap-2`,p?`min-w-0 max-w-[50vw] flex-col items-end sm:flex-row sm:justify-end`:`flex-wrap justify-start sm:justify-end`),children:[d,p&&(0,l.jsx)(f,{target:p})]}):null,t[15]=d,t[16]=p,t[17]=x):x=t[17];let S;return t[18]!==g||t[19]!==b||t[20]!==x?(S=(0,l.jsxs)(`header`,{className:g,children:[b,x]}),t[18]=g,t[19]=b,t[20]=x,t[21]=S):S=t[21],S}export{u as n,m as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as r}from"./locale-store-Bld7_m-Q.js";import{t as i}from"./external-link-DjqjBmc3.js";import{t as a}from"./sparkles-DHlfQFAF.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./button-Cc4hUNTt.js";var c=e(),l=t();function u(e){let t=(0,c.c)(14),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({children:n,className:r,gap:a,padding:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let u=a===void 0?`gap-5`:a,d=s===void 0?`px-4 py-6 sm:px-5 xl:px-6`:s,f;t[6]!==r||t[7]!==u||t[8]!==d?(f=o(`settings-page-frame mx-auto flex min-h-full w-full max-w-[56rem] flex-col`,u,d,r),t[6]=r,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==i||t[12]!==f?(p=(0,l.jsx)(`div`,{className:f,...i,children:n}),t[10]=n,t[11]=i,t[12]=f,t[13]=p):p=t[13],p}var d={phone:{scene:`configure-phone`,zh:`帮我配置 Phone Use,从模型、依赖、手机连接到验收。`,en:`Help configure Phone Use: model, dependencies, phone connection and verification.`},browser:{scene:`configure-xopc`,zh:`帮我配置 Browser Use,连接本机 Chrome 并完成验收。`,en:`Help me configure Browser Use with local Chrome and verify it.`}};function f(e){let t=(0,c.c)(8),{target:i}=e,o=r(p)===`zh`,u=d[i],f=o?u.zh:u.en,m;t[0]!==u.scene||t[1]!==f?(m=new URLSearchParams({skill:`configure-xopc`,scene:u.scene,draft:f,autoSend:`1`}),t[0]=u.scene,t[1]=f,t[2]=m):m=t[2];let h=`/chat/new?${m}`,g=o?`让 AI 帮我配置`:`Set up with AI`,_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,l.jsx)(a,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[3]=_):_=t[3];let v=o?`AI 配置`:`AI setup`,y;return t[4]!==h||t[5]!==g||t[6]!==v?(y=(0,l.jsx)(s,{asChild:!0,className:`order-first whitespace-nowrap sm:order-last text-accent-fg shadow-none sm:shadow-none`,children:(0,l.jsxs)(n,{to:h,title:g,children:[_,v]})}),t[4]=h,t[5]=g,t[6]=v,t[7]=y):y=t[7],y}function p(e){return e.language}function m(e){let t=(0,c.c)(22),{title:n,subtitle:r,docsLink:a,docsLabel:s,meta:u,actions:d,aiSetup:p,className:m}=e,h=p?`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3`:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,g;t[0]!==m||t[1]!==h?(g=o(h,m),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=(0,l.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight sm:text-lg text-fg`,children:n}),t[3]=n,t[4]=_);let v;t[5]===r?v=t[6]:(v=r?(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:r}):null,t[5]=r,t[6]=v);let y;t[7]!==s||t[8]!==a?(y=a&&s?(0,l.jsxs)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,className:`touch-target mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[s,(0,l.jsx)(i,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[7]=s,t[8]=a,t[9]=y):y=t[9];let b;t[10]!==u||t[11]!==_||t[12]!==v||t[13]!==y?(b=(0,l.jsxs)(`div`,{className:`min-w-0`,children:[_,v,y,u]}),t[10]=u,t[11]=_,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]!==d||t[16]!==p?(x=d||p?(0,l.jsxs)(`div`,{className:o(`flex shrink-0 items-center gap-2`,p?`min-w-0 max-w-[50vw] flex-col items-end sm:flex-row sm:justify-end`:`flex-wrap justify-start sm:justify-end`),children:[d,p&&(0,l.jsx)(f,{target:p})]}):null,t[15]=d,t[16]=p,t[17]=x):x=t[17];let S;return t[18]!==g||t[19]!==b||t[20]!==x?(S=(0,l.jsxs)(`header`,{className:g,children:[b,x]}),t[18]=g,t[19]=b,t[20]=x,t[21]=S):S=t[21],S}export{u as n,m as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import"./settings-page-header-4d1u-o-F.js";var r=e(),i=t();function a(e){let t=(0,r.c)(13),{id:a,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0||d,g=f===void 0||f;if(o!==a)return null;let _=`${c}-${a}`,v=`${s}-${a}`,y=g&&`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,i.jsxs)(`div`,{className:`mb-5`,children:[l?(0,i.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,i.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,i.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{a as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import"./settings-page-header-BYFaTD8a.js";var r=e(),i=t();function a(e){let t=(0,r.c)(13),{id:a,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0||d,g=f===void 0||f;if(o!==a)return null;let _=`${c}-${a}`,v=`${s}-${a}`,y=g&&`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,i.jsxs)(`div`,{className:`mb-5`,children:[l?(0,i.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,i.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,i.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{a as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-DGtk-KSF.js";import{t as s}from"./messages-DYDySzn1.js";import{A as c,D as l,E as u,M as d,N as f,g as p,i as m,l as h,m as g,n as _,r as v,u as y,x as b}from"./route-preload-Coy9Gjyy.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>c().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>m().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>b().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>f().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>h().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>v().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>g().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>l().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>u().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>d().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>_().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>y().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=o(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=s(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let o=t;if(o===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[o];if(o===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(o===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(o===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(o===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(o===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(o===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(o===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(o===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(o===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(o===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(o===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(o===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-Bld7_m-Q.js";import{t as s}from"./messages-CGO1P4mz.js";import{E as c,M as l,T as u,b as d,c as f,h as p,i as m,j as h,k as g,l as _,n as v,p as y,r as b}from"./route-preload-CDQtPdgq.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>g().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>m().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>d().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>l().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>f().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>b().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>y().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>c().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>u().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>h().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>v().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>_().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=o(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=s(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let o=t;if(o===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[o];if(o===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(o===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(o===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(o===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(o===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(o===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(o===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(o===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(o===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(o===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(o===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(o===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,m as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as o,n as s,o as c}from"./locale-store-DGtk-KSF.js";import{a as l,i as u,o as d,r as f,s as p,t as m}from"./dist-BGTk37IG.js";import{n as h,r as g}from"./popover-select-CEMWIrtY.js";import{t as _}from"./lock-keyhole-DEK5kH0u.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./skeleton-BI5TyibZ.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-Cc4hUNTt.js";import{n as S,t as C}from"./phone-model-connection-CQ4PhhE5.js";var w=e(t(),1),T=n();function E(){let{scene:e,setupId:t}=r(),[n]=i(),E=n.get(`conversationId`)??``,D=n.get(`step`),O=s(e=>e.language)===`zh`,k=a(),[A,j]=(0,w.useState)(!1),M=(0,w.useRef)(null),[N,P]=(0,w.useState)(!1),[F,I]=(0,w.useState)(``),[L,R]=(0,w.useState)(``),z=(0,w.useRef)(!1);(0,w.useEffect)(()=>{z.current=!1,j(!1),R(``),I(``)},[e,t,E]);let B=[`browser`,`phone`].includes(e??``)&&!!(t&&E),V=async(n,r={})=>(await c(o(`/api/${e}/setup`),{method:`POST`,body:JSON.stringify({conversationId:E,setupId:t,action:n,...r})})).payload,{data:H,error:U,mutate:W}=b(B?[`setup-interaction`,e,t,E]:null,()=>V(`get`),{refreshInterval:2e3}),G=e=>e.id===t&&e.conversationId===E&&!e.stale&&![`cancelled`,`completed`].includes(e.state),K=()=>{!N&&!z.current&&k(`/chat/${encodeURIComponent(E)}`,{replace:!0})},q=async(t=``)=>{if(!z.current){z.current=!0,P(!0),I(``);try{let n=await V(`recheck`);if(!G(n))throw Error(`changed`);if(e===`browser`&&!n.endpoints?.some(e=>e.endpointId===t))throw Error(`not-connected`);let r=e===`browser`?O?`允许仅在独立测试页进行读取、点击和示例输入的有界验收,完成后关闭并确认释放,不操作业务网页。`:`I authorize bounded read, click and sample input on the isolated test page only; close and confirm release afterwards. Do not operate business pages.`:``,i=O?`人工配置步骤已完成。${r}请先重新检查本对话 ${e===`browser`?`Browser Use`:`Phone Use`} 的配置进度,继续此前已授权的流程。${t?`本次选择:${t}。`:``}不要扩大设备、权限或任务范围;取消或过期的授权不能恢复。`:`The manual setup step is complete. ${r} Recheck this conversation’s ${e===`browser`?`Browser Use`:`Phone Use`} setup before continuing the previously authorized flow.${t?` Selected target: ${t}.`:``} Do not widen device, permission or task scope, or revive cancelled or expired grants.`,a=new URLSearchParams({draft:i,autoSend:`1`});k(`/chat/${encodeURIComponent(E)}?${a}`,{replace:!0})}catch{z.current=!1,I(O?`尚未检测到有效配置,或原请求已变更。请检查后重试。`:`The setup is not ready or the original request changed. Check and try again.`)}finally{P(!1)}}},J=H&&G(H);if(J&&e===`phone`&&D===`connection`&&H.source===`aliyun`&&!A)return(0,T.jsx)(S,{zh:O,initialMethod:`aliyun`,onClose:K,onSelect:()=>{I(O?`请在原对话确认本机设备。`:`Confirm the local device in the original chat.`)},onAdded:()=>{j(!0),q()}});let Y=e===`browser`?O?`完成浏览器连接`:`Finish browser connection`:D===`model`?O?`配置手机模型`:`Set up Phone model`:O?`完成手机连接`:`Finish phone connection`;return(0,T.jsx)(`main`,{className:`h-full bg-surface-base`,children:(0,T.jsx)(m,{open:!0,onOpenChange:e=>{e||K()},children:(0,T.jsxs)(d,{children:[(0,T.jsx)(l,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-sm`}),(0,T.jsxs)(f,{onOpenAutoFocus:e=>{e.preventDefault(),M.current?.focus()},className:`fixed inset-x-0 bottom-0 z-[70] flex h-[min(36rem,calc(100dvh-1rem))] flex-col overflow-hidden rounded-t-3xl border border-edge bg-surface-overlay text-fg sm:inset-x-auto sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-[30rem] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-3xl`,children:[(0,T.jsxs)(`header`,{className:`relative shrink-0 px-6 pb-5 pt-8 text-center`,children:[(0,T.jsx)(x,{variant:`ghost`,className:`absolute right-2 top-2 size-11 p-0`,disabled:N,"aria-label":O?`暂时关闭`:`Close for now`,onClick:K,children:(0,T.jsx)(v,{className:`size-4`,"aria-hidden":!0})}),(0,T.jsx)(_,{className:`mx-auto mb-4 size-6 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(p,{ref:M,tabIndex:-1,className:`text-xl font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:Y}),(0,T.jsx)(u,{className:`mt-3 text-sm text-fg-muted`,children:O?`只完成需要你操作的一步,密钥不会进入对话。`:`Complete only the step that needs you. Secrets never enter the conversation.`})]}),(0,T.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 pb-5`,children:[!H&&!U&&B?(0,T.jsx)(y,{className:`h-32 w-full rounded-xl`}):J?e===`phone`&&D===`model`?(0,T.jsx)(C,{zh:O,value:H.readiness?.model.ref??``,disabled:N,onSave:async e=>{P(!0);try{await V(`set_model`,{modelRef:e,expectedRevision:H.revision,replaceExisting:!0}),await W()}finally{P(!1)}await q()}}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:e===`browser`?O?`在 Gateway 所在电脑的 Chrome 加载已准备的扩展,并接受你同意的原生权限。随后选择这个 Chrome,系统会在独立测试页验证读取、点击和输入,再释放控制。`:`Load the prepared extension in Chrome on the Gateway computer and accept the native permissions you agree to. Select that Chrome to verify read, click and fill on an isolated test page, then release control.`:O?`连接并解锁 Gateway 所在电脑上的测试手机,按手机提示确认 USB 调试。返回后会重新检查设备,只继续此前授权的设置页测试。`:`Connect and unlock the test phone on the Gateway computer and confirm USB debugging on the phone. The device will be rechecked before the previously authorized Settings test continues.`}),e===`browser`?(0,T.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,T.jsx)(`span`,{children:O?`用于验收的 Chrome`:`Chrome to verify`}),(0,T.jsxs)(h,{"aria-label":O?`用于验收的 Chrome`:`Chrome to verify`,value:L,onChange:e=>R(e.target.value),children:[(0,T.jsx)(g,{value:``,children:O?`选择 Chrome`:`Choose Chrome`}),H.endpoints?.map(e=>(0,T.jsx)(g,{value:e.endpointId,children:e.displayName},e.endpointId))]})]}):null]}):(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:O?`此配置请求已失效或无法读取,请返回原对话重新检查。`:`This setup is no longer valid or could not be loaded. Return to the original chat to recheck.`}),F?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:F}):null]}),(0,T.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))]`,children:[J&&!(e===`phone`&&D===`model`)?(0,T.jsx)(x,{variant:`primary`,className:`min-h-12 w-full`,disabled:N||e===`browser`&&!L,onClick:()=>{q(L)},children:e===`browser`?O?`核对并开始安全验收`:`Recheck and start safe test`:O?`检查并继续原对话`:`Recheck and continue in chat`}):null,(0,T.jsx)(x,{variant:`ghost`,className:`min-h-11 w-full`,disabled:N,onClick:K,children:O?`返回原对话`:`Return to original chat`})]})]})]})})})}export{E as SetupInteractionPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,m as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as o,n as s,o as c}from"./locale-store-Bld7_m-Q.js";import{a as l,i as u,o as d,r as f,s as p,t as m}from"./dist-BGTk37IG.js";import{n as h,r as g}from"./popover-select-CLsphyzA.js";import{t as _}from"./lock-keyhole-DEK5kH0u.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./skeleton-DzdOeGYz.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-Cc4hUNTt.js";import{n as S,t as C}from"./phone-model-connection-BBG3LxRP.js";var w=e(t(),1),T=n();function E(){let{scene:e,setupId:t}=r(),[n]=i(),E=n.get(`conversationId`)??``,D=n.get(`step`),O=s(e=>e.language)===`zh`,k=a(),[A,j]=(0,w.useState)(!1),M=(0,w.useRef)(null),[N,P]=(0,w.useState)(!1),[F,I]=(0,w.useState)(``),[L,R]=(0,w.useState)(``),z=(0,w.useRef)(!1);(0,w.useEffect)(()=>{z.current=!1,j(!1),R(``),I(``)},[e,t,E]);let B=[`browser`,`phone`].includes(e??``)&&!!(t&&E),V=async(n,r={})=>(await c(o(`/api/${e}/setup`),{method:`POST`,body:JSON.stringify({conversationId:E,setupId:t,action:n,...r})})).payload,{data:H,error:U,mutate:W}=b(B?[`setup-interaction`,e,t,E]:null,()=>V(`get`),{refreshInterval:2e3}),G=e=>e.id===t&&e.conversationId===E&&!e.stale&&![`cancelled`,`completed`].includes(e.state),K=()=>{!N&&!z.current&&k(`/chat/${encodeURIComponent(E)}`,{replace:!0})},q=async(t=``)=>{if(!z.current){z.current=!0,P(!0),I(``);try{let n=await V(`recheck`);if(!G(n))throw Error(`changed`);if(e===`browser`&&!n.endpoints?.some(e=>e.endpointId===t))throw Error(`not-connected`);let r=e===`browser`?O?`允许仅在独立测试页进行读取、点击和示例输入的有界验收,完成后关闭并确认释放,不操作业务网页。`:`I authorize bounded read, click and sample input on the isolated test page only; close and confirm release afterwards. Do not operate business pages.`:``,i=O?`人工配置步骤已完成。${r}请先重新检查本对话 ${e===`browser`?`Browser Use`:`Phone Use`} 的配置进度,继续此前已授权的流程。${t?`本次选择:${t}。`:``}不要扩大设备、权限或任务范围;取消或过期的授权不能恢复。`:`The manual setup step is complete. ${r} Recheck this conversation’s ${e===`browser`?`Browser Use`:`Phone Use`} setup before continuing the previously authorized flow.${t?` Selected target: ${t}.`:``} Do not widen device, permission or task scope, or revive cancelled or expired grants.`,a=new URLSearchParams({draft:i,autoSend:`1`});k(`/chat/${encodeURIComponent(E)}?${a}`,{replace:!0})}catch{z.current=!1,I(O?`尚未检测到有效配置,或原请求已变更。请检查后重试。`:`The setup is not ready or the original request changed. Check and try again.`)}finally{P(!1)}}},J=H&&G(H);if(J&&e===`phone`&&D===`connection`&&H.source===`aliyun`&&!A)return(0,T.jsx)(S,{zh:O,initialMethod:`aliyun`,onClose:K,onSelect:()=>{I(O?`请在原对话确认本机设备。`:`Confirm the local device in the original chat.`)},onAdded:()=>{j(!0),q()}});let Y=e===`browser`?O?`完成浏览器连接`:`Finish browser connection`:D===`model`?O?`配置手机模型`:`Set up Phone model`:O?`完成手机连接`:`Finish phone connection`;return(0,T.jsx)(`main`,{className:`h-full bg-surface-base`,children:(0,T.jsx)(m,{open:!0,onOpenChange:e=>{e||K()},children:(0,T.jsxs)(d,{children:[(0,T.jsx)(l,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-sm`}),(0,T.jsxs)(f,{onOpenAutoFocus:e=>{e.preventDefault(),M.current?.focus()},className:`fixed inset-x-0 bottom-0 z-[70] flex h-[min(36rem,calc(100dvh-1rem))] flex-col overflow-hidden rounded-t-3xl border border-edge bg-surface-overlay text-fg sm:inset-x-auto sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-[30rem] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-3xl`,children:[(0,T.jsxs)(`header`,{className:`relative shrink-0 px-6 pb-5 pt-8 text-center`,children:[(0,T.jsx)(x,{variant:`ghost`,className:`absolute right-2 top-2 size-11 p-0`,disabled:N,"aria-label":O?`暂时关闭`:`Close for now`,onClick:K,children:(0,T.jsx)(v,{className:`size-4`,"aria-hidden":!0})}),(0,T.jsx)(_,{className:`mx-auto mb-4 size-6 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(p,{ref:M,tabIndex:-1,className:`text-xl font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:Y}),(0,T.jsx)(u,{className:`mt-3 text-sm text-fg-muted`,children:O?`只完成需要你操作的一步,密钥不会进入对话。`:`Complete only the step that needs you. Secrets never enter the conversation.`})]}),(0,T.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 pb-5`,children:[!H&&!U&&B?(0,T.jsx)(y,{className:`h-32 w-full rounded-xl`}):J?e===`phone`&&D===`model`?(0,T.jsx)(C,{zh:O,value:H.readiness?.model.ref??``,disabled:N,onSave:async e=>{P(!0);try{await V(`set_model`,{modelRef:e,expectedRevision:H.revision,replaceExisting:!0}),await W()}finally{P(!1)}await q()}}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:e===`browser`?O?`在 Gateway 所在电脑的 Chrome 加载已准备的扩展,并接受你同意的原生权限。随后选择这个 Chrome,系统会在独立测试页验证读取、点击和输入,再释放控制。`:`Load the prepared extension in Chrome on the Gateway computer and accept the native permissions you agree to. Select that Chrome to verify read, click and fill on an isolated test page, then release control.`:O?`连接并解锁 Gateway 所在电脑上的测试手机,按手机提示确认 USB 调试。返回后会重新检查设备,只继续此前授权的设置页测试。`:`Connect and unlock the test phone on the Gateway computer and confirm USB debugging on the phone. The device will be rechecked before the previously authorized Settings test continues.`}),e===`browser`?(0,T.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,T.jsx)(`span`,{children:O?`用于验收的 Chrome`:`Chrome to verify`}),(0,T.jsxs)(h,{"aria-label":O?`用于验收的 Chrome`:`Chrome to verify`,value:L,onChange:e=>R(e.target.value),children:[(0,T.jsx)(g,{value:``,children:O?`选择 Chrome`:`Choose Chrome`}),H.endpoints?.map(e=>(0,T.jsx)(g,{value:e.endpointId,children:e.displayName},e.endpointId))]})]}):null]}):(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:O?`此配置请求已失效或无法读取,请返回原对话重新检查。`:`This setup is no longer valid or could not be loaded. Return to the original chat to recheck.`}),F?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:F}):null]}),(0,T.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))]`,children:[J&&!(e===`phone`&&D===`model`)?(0,T.jsx)(x,{variant:`primary`,className:`min-h-12 w-full`,disabled:N||e===`browser`&&!L,onClick:()=>{q(L)},children:e===`browser`?O?`核对并开始安全验收`:`Recheck and start safe test`:O?`检查并继续原对话`:`Recheck and continue in chat`}):null,(0,T.jsx)(x,{variant:`ghost`,className:`min-h-11 w-full`,disabled:N,onClick:K,children:O?`返回原对话`:`Return to original chat`})]})]})]})})})}export{E as SetupInteractionPage};