@hienlh/ppm 0.23.27 → 0.23.28

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 (446) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/CLAUDE.md +1 -0
  3. package/assets/skills/ppm/SKILL.md +1 -1
  4. package/assets/skills/ppm/references/cli-reference.md +4 -4
  5. package/assets/skills/ppm/references/http-api.md +1 -1
  6. package/dist/web/assets/{accounts-settings-section-CZglHifc.js → accounts-settings-section-BpPfPPms.js} +1 -1
  7. package/dist/web/assets/accounts-settings-section-BpPfPPms.js.br +0 -0
  8. package/dist/web/assets/accounts-settings-section-BpPfPPms.js.gz +0 -0
  9. package/dist/web/assets/{agent-session-sheet-B3VLD2H6.js → agent-session-sheet-DzlLsud2.js} +2 -2
  10. package/dist/web/assets/agent-session-sheet-DzlLsud2.js.br +0 -0
  11. package/dist/web/assets/agent-session-sheet-DzlLsud2.js.gz +0 -0
  12. package/dist/web/assets/{agent-session-window-content-HEdIT_LQ.js → agent-session-window-content-Db1N_iji.js} +1 -1
  13. package/dist/web/assets/agent-session-window-content-Db1N_iji.js.br +0 -0
  14. package/dist/web/assets/agent-session-window-content-Db1N_iji.js.gz +0 -0
  15. package/dist/web/assets/{ai-resource-editor-CFbXgGMo.js → ai-resource-editor-BkMMCRXw.js} +1 -1
  16. package/dist/web/assets/ai-resource-editor-BkMMCRXw.js.br +0 -0
  17. package/dist/web/assets/ai-resource-editor-BkMMCRXw.js.gz +0 -0
  18. package/dist/web/assets/{ai-settings-section-BNiVD9D3.js → ai-settings-section-DfsLLATF.js} +1 -1
  19. package/dist/web/assets/ai-settings-section-DfsLLATF.js.br +0 -0
  20. package/dist/web/assets/ai-settings-section-DfsLLATF.js.gz +0 -0
  21. package/dist/web/assets/{ai-settings-section-W0kfADRB.js → ai-settings-section-Kd7dvbpg.js} +1 -1
  22. package/dist/web/assets/{android-tab-CY3aa_vU.js → android-tab-pF-ccFeQ.js} +1 -1
  23. package/dist/web/assets/android-tab-pF-ccFeQ.js.br +0 -0
  24. package/dist/web/assets/android-tab-pF-ccFeQ.js.gz +0 -0
  25. package/dist/web/assets/{appearance-settings-section-lbtuzecW.js → appearance-settings-section-D0WDuhJ2.js} +1 -1
  26. package/dist/web/assets/appearance-settings-section-D0WDuhJ2.js.br +0 -0
  27. package/dist/web/assets/appearance-settings-section-D0WDuhJ2.js.gz +0 -0
  28. package/dist/web/assets/{apps-panel-CF2mbvVq.js → apps-panel-BxXS0WUD.js} +1 -1
  29. package/dist/web/assets/apps-panel-BxXS0WUD.js.br +0 -0
  30. package/dist/web/assets/apps-panel-BxXS0WUD.js.gz +0 -0
  31. package/dist/web/assets/{branch-review-tab-CR7JnS5x.js → branch-review-tab-0iO--u-m.js} +1 -1
  32. package/dist/web/assets/branch-review-tab-0iO--u-m.js.br +0 -0
  33. package/dist/web/assets/branch-review-tab-0iO--u-m.js.gz +0 -0
  34. package/dist/web/assets/{chat-tab-BCELq4nK.js → chat-tab-B8eIHFK1.js} +1 -1
  35. package/dist/web/assets/chat-tab-B8eIHFK1.js.br +0 -0
  36. package/dist/web/assets/chat-tab-B8eIHFK1.js.gz +0 -0
  37. package/dist/web/assets/{chat-tab-C4aOYSea.js → chat-tab-CmF4QVA9.js} +3 -3
  38. package/dist/web/assets/chat-tab-CmF4QVA9.js.br +0 -0
  39. package/dist/web/assets/chat-tab-CmF4QVA9.js.gz +0 -0
  40. package/dist/web/assets/{code-editor-_axJbYkP.js → code-editor-X--V1VeT.js} +4 -4
  41. package/dist/web/assets/code-editor-X--V1VeT.js.br +0 -0
  42. package/dist/web/assets/code-editor-X--V1VeT.js.gz +0 -0
  43. package/dist/web/assets/codex-reset-credit-button-XC0rCF5U.js +1 -0
  44. package/dist/web/assets/codex-reset-credit-button-XC0rCF5U.js.br +0 -0
  45. package/dist/web/assets/codex-reset-credit-button-XC0rCF5U.js.gz +0 -0
  46. package/dist/web/assets/{conflict-editor-D0AYuLKI.js → conflict-editor-D2hb69oL.js} +1 -1
  47. package/dist/web/assets/conflict-editor-D2hb69oL.js.br +0 -0
  48. package/dist/web/assets/conflict-editor-D2hb69oL.js.gz +0 -0
  49. package/dist/web/assets/{connection-form-tab-C3QyUWnE.js → connection-form-tab-DQMO4qU5.js} +1 -1
  50. package/dist/web/assets/connection-form-tab-DQMO4qU5.js.br +0 -0
  51. package/dist/web/assets/{connection-form-tab-C3QyUWnE.js.gz → connection-form-tab-DQMO4qU5.js.gz} +0 -0
  52. package/dist/web/assets/{csv-preview-CmKkcz4M.js → csv-preview-eY8R-UbG.js} +1 -1
  53. package/dist/web/assets/csv-preview-eY8R-UbG.js.br +0 -0
  54. package/dist/web/assets/csv-preview-eY8R-UbG.js.gz +0 -0
  55. package/dist/web/assets/{db-tab-parts-BXL34wrZ.js → db-tab-parts-C6YcRshd.js} +1 -1
  56. package/dist/web/assets/db-tab-parts-C6YcRshd.js.br +0 -0
  57. package/dist/web/assets/db-tab-parts-C6YcRshd.js.gz +0 -0
  58. package/dist/web/assets/{design-settings-section-DukfVtwP.js → design-settings-section-BgSPZ0kW.js} +1 -1
  59. package/dist/web/assets/design-settings-section-BgSPZ0kW.js.br +0 -0
  60. package/dist/web/assets/design-settings-section-BgSPZ0kW.js.gz +0 -0
  61. package/dist/web/assets/{design-tab-BoPiL2ge.js → design-tab-CHAF9GTs.js} +1 -1
  62. package/dist/web/assets/design-tab-CHAF9GTs.js.br +0 -0
  63. package/dist/web/assets/design-tab-CHAF9GTs.js.gz +0 -0
  64. package/dist/web/assets/{designs-sidebar-panel-BVTqPPzG.js → designs-sidebar-panel-D3WyvAkV.js} +1 -1
  65. package/dist/web/assets/designs-sidebar-panel-D3WyvAkV.js.br +0 -0
  66. package/dist/web/assets/designs-sidebar-panel-D3WyvAkV.js.gz +0 -0
  67. package/dist/web/assets/{diff-viewer-C86mR7vD.js → diff-viewer-Z7U41YSt.js} +1 -1
  68. package/dist/web/assets/diff-viewer-Z7U41YSt.js.br +0 -0
  69. package/dist/web/assets/diff-viewer-Z7U41YSt.js.gz +0 -0
  70. package/dist/web/assets/{docx-preview-B9EhDCMi.js → docx-preview-Dfcjr_SW.js} +1 -1
  71. package/dist/web/assets/docx-preview-Dfcjr_SW.js.br +0 -0
  72. package/dist/web/assets/docx-preview-Dfcjr_SW.js.gz +0 -0
  73. package/dist/web/assets/{editor-dialog-DTDsbJd6.js → editor-dialog-CFKRnl0r.js} +1 -1
  74. package/dist/web/assets/editor-dialog-CFKRnl0r.js.br +0 -0
  75. package/dist/web/assets/editor-dialog-CFKRnl0r.js.gz +0 -0
  76. package/dist/web/assets/{editor-language-service-BtrrQAS2.js → editor-language-service-DF0iZ-oJ.js} +1 -1
  77. package/dist/web/assets/editor-language-service-DF0iZ-oJ.js.br +0 -0
  78. package/dist/web/assets/editor-language-service-DF0iZ-oJ.js.gz +0 -0
  79. package/dist/web/assets/{explorer-body-DLaWmxri.js → explorer-body-CjgqTA5z.js} +1 -1
  80. package/dist/web/assets/explorer-body-CjgqTA5z.js.br +0 -0
  81. package/dist/web/assets/explorer-body-CjgqTA5z.js.gz +0 -0
  82. package/dist/web/assets/{explorer-window-content-CbUIbrzL.js → explorer-window-content-D5lMhuEE.js} +1 -1
  83. package/dist/web/assets/explorer-window-content-D5lMhuEE.js.br +0 -0
  84. package/dist/web/assets/explorer-window-content-D5lMhuEE.js.gz +0 -0
  85. package/dist/web/assets/{extension-manager-section-BpKMyLwI.js → extension-manager-section-vMRBnoJO.js} +1 -1
  86. package/dist/web/assets/extension-manager-section-vMRBnoJO.js.br +0 -0
  87. package/dist/web/assets/extension-manager-section-vMRBnoJO.js.gz +0 -0
  88. package/dist/web/assets/{extension-webview-BGfyaXMI.js → extension-webview-DanhPG0F.js} +1 -1
  89. package/dist/web/assets/extension-webview-DanhPG0F.js.br +0 -0
  90. package/dist/web/assets/extension-webview-DanhPG0F.js.gz +0 -0
  91. package/dist/web/assets/{files-settings-section-CQT9_rX2.js → files-settings-section-C8CYlT-I.js} +1 -1
  92. package/dist/web/assets/files-settings-section-C8CYlT-I.js.br +0 -0
  93. package/dist/web/assets/files-settings-section-C8CYlT-I.js.gz +0 -0
  94. package/dist/web/assets/{general-settings-section-BoQGeqBi.js → general-settings-section-DTpOZJ-p.js} +1 -1
  95. package/dist/web/assets/general-settings-section-DTpOZJ-p.js.br +0 -0
  96. package/dist/web/assets/general-settings-section-DTpOZJ-p.js.gz +0 -0
  97. package/dist/web/assets/{git-log-panel-T8Fzn8-5.js → git-log-panel-ChpHJfMr.js} +1 -1
  98. package/dist/web/assets/git-log-panel-ChpHJfMr.js.br +0 -0
  99. package/dist/web/assets/git-log-panel-ChpHJfMr.js.gz +0 -0
  100. package/dist/web/assets/{git-review-tab-WzuX4Ml9.js → git-review-tab-XCGVDLWC.js} +1 -1
  101. package/dist/web/assets/git-review-tab-XCGVDLWC.js.br +0 -0
  102. package/dist/web/assets/git-review-tab-XCGVDLWC.js.gz +0 -0
  103. package/dist/web/assets/{glide-data-grid-BBzGDYvj.js → glide-data-grid-BIicS817.js} +1 -1
  104. package/dist/web/assets/glide-data-grid-BIicS817.js.br +0 -0
  105. package/dist/web/assets/glide-data-grid-BIicS817.js.gz +0 -0
  106. package/dist/web/assets/{grid-save-dialog-HiqlnSky.js → grid-save-dialog-lH5FqCsy.js} +1 -1
  107. package/dist/web/assets/grid-save-dialog-lH5FqCsy.js.br +0 -0
  108. package/dist/web/assets/grid-save-dialog-lH5FqCsy.js.gz +0 -0
  109. package/dist/web/assets/{group-chat-tab-URU3FCLs.js → group-chat-tab-CJ_oCDXh.js} +1 -1
  110. package/dist/web/assets/group-chat-tab-CJ_oCDXh.js.br +0 -0
  111. package/dist/web/assets/group-chat-tab-CJ_oCDXh.js.gz +0 -0
  112. package/dist/web/assets/{impexp-tab-B0m1Q8ia.js → impexp-tab-DaWPiD5j.js} +1 -1
  113. package/dist/web/assets/impexp-tab-DaWPiD5j.js.br +0 -0
  114. package/dist/web/assets/impexp-tab-DaWPiD5j.js.gz +0 -0
  115. package/dist/web/assets/{index-Vd9Xr54k.js → index-hEtw8BzE.js} +5 -5
  116. package/dist/web/assets/index-hEtw8BzE.js.br +0 -0
  117. package/dist/web/assets/index-hEtw8BzE.js.gz +0 -0
  118. package/dist/web/assets/{jira-watcher-section-CnSTbAF6.js → jira-watcher-section-CwUHMdEh.js} +1 -1
  119. package/dist/web/assets/{keybindings-store-D_U8jECl.js → keybindings-store-B0yahyjU.js} +1 -1
  120. package/dist/web/assets/{keyboard-shortcuts-section-CU7JjDsU.js → keyboard-shortcuts-section-wtV3OtKT.js} +1 -1
  121. package/dist/web/assets/keyboard-shortcuts-section-wtV3OtKT.js.br +0 -0
  122. package/dist/web/assets/keyboard-shortcuts-section-wtV3OtKT.js.gz +0 -0
  123. package/dist/web/assets/{language-servers-section-CzUG9H69.js → language-servers-section-Cgq5jqIq.js} +2 -2
  124. package/dist/web/assets/language-servers-section-Cgq5jqIq.js.br +0 -0
  125. package/dist/web/assets/language-servers-section-Cgq5jqIq.js.gz +0 -0
  126. package/dist/web/assets/{logs-app-CDSvyY1H.js → logs-app-DMGSa0EZ.js} +1 -1
  127. package/dist/web/assets/logs-app-DMGSa0EZ.js.br +0 -0
  128. package/dist/web/assets/logs-app-DMGSa0EZ.js.gz +0 -0
  129. package/dist/web/assets/{logs-tab-CQw9vrNw.js → logs-tab-CNAJfY0p.js} +1 -1
  130. package/dist/web/assets/{logs-window-content-CGvPnPrr.js → logs-window-content-BLZTSzA_.js} +1 -1
  131. package/dist/web/assets/{lsp-client-CpjPUUYJ.js → lsp-client-DeDps1ff.js} +1 -1
  132. package/dist/web/assets/lsp-client-DeDps1ff.js.br +0 -0
  133. package/dist/web/assets/lsp-client-DeDps1ff.js.gz +0 -0
  134. package/dist/web/assets/{markdown-renderer-DZNMRg6p.js → markdown-renderer-BglemZay.js} +1 -1
  135. package/dist/web/assets/markdown-renderer-BglemZay.js.br +0 -0
  136. package/dist/web/assets/markdown-renderer-BglemZay.js.gz +0 -0
  137. package/dist/web/assets/{markdown-renderer-3ZR2x0CC.js → markdown-renderer-CbMb0KIt.js} +1 -1
  138. package/dist/web/assets/{mobile-explorer-sheet-D7e-MM6m.js → mobile-explorer-sheet-B-rEK1Rv.js} +1 -1
  139. package/dist/web/assets/mobile-explorer-sheet-B-rEK1Rv.js.br +0 -0
  140. package/dist/web/assets/mobile-explorer-sheet-B-rEK1Rv.js.gz +0 -0
  141. package/dist/web/assets/{new-design-dialog-BthM423i.js → new-design-dialog-MZChmJxx.js} +1 -1
  142. package/dist/web/assets/new-design-dialog-MZChmJxx.js.br +0 -0
  143. package/dist/web/assets/new-design-dialog-MZChmJxx.js.gz +0 -0
  144. package/dist/web/assets/{notification-store-GKweleCQ.js → notification-store-BeHQe3xv.js} +1 -1
  145. package/dist/web/assets/{notifications-settings-section-TS3gNFcc.js → notifications-settings-section-B3ZivJoQ.js} +1 -1
  146. package/dist/web/assets/notifications-settings-section-B3ZivJoQ.js.br +0 -0
  147. package/dist/web/assets/notifications-settings-section-B3ZivJoQ.js.gz +0 -0
  148. package/dist/web/assets/{ppmbot-settings-section-D8jIlmp8.js → ppmbot-settings-section-DNBoSvo3.js} +1 -1
  149. package/dist/web/assets/ppmbot-settings-section-DNBoSvo3.js.br +0 -0
  150. package/dist/web/assets/ppmbot-settings-section-DNBoSvo3.js.gz +0 -0
  151. package/dist/web/assets/{problems-panel-DjCHA1r5.js → problems-panel-DELXPISU.js} +1 -1
  152. package/dist/web/assets/problems-panel-DELXPISU.js.br +0 -0
  153. package/dist/web/assets/problems-panel-DELXPISU.js.gz +0 -0
  154. package/dist/web/assets/{process-table-BxXEh4tN.js → process-table-DLxTp9xB.js} +1 -1
  155. package/dist/web/assets/process-table-DLxTp9xB.js.br +0 -0
  156. package/dist/web/assets/process-table-DLxTp9xB.js.gz +0 -0
  157. package/dist/web/assets/{proxy-settings-section-B8igco2L.js → proxy-settings-section-Cl0NpYCd.js} +1 -1
  158. package/dist/web/assets/proxy-settings-section-Cl0NpYCd.js.br +0 -0
  159. package/dist/web/assets/proxy-settings-section-Cl0NpYCd.js.gz +0 -0
  160. package/dist/web/assets/{query-tab-DHU3ANHN.js → query-tab-BxeuwVui.js} +1 -1
  161. package/dist/web/assets/query-tab-BxeuwVui.js.br +0 -0
  162. package/dist/web/assets/query-tab-BxeuwVui.js.gz +0 -0
  163. package/dist/web/assets/{release-notes-window-content-B33RDfFY.js → release-notes-window-content-B_D7adpm.js} +1 -1
  164. package/dist/web/assets/{remote-access-settings-section-CoYQTFKd.js → remote-access-settings-section-D6qVIt6l.js} +1 -1
  165. package/dist/web/assets/remote-access-settings-section-D6qVIt6l.js.br +0 -0
  166. package/dist/web/assets/remote-access-settings-section-D6qVIt6l.js.gz +0 -0
  167. package/dist/web/assets/{remote-desktop-clipboard-notice-Dwn-iV4g.js → remote-desktop-clipboard-notice-BEAcnbOM.js} +1 -1
  168. package/dist/web/assets/remote-desktop-clipboard-notice-BEAcnbOM.js.br +0 -0
  169. package/dist/web/assets/remote-desktop-clipboard-notice-BEAcnbOM.js.gz +0 -0
  170. package/dist/web/assets/{remote-desktop-mobile-sheet-bfKiSG0C.js → remote-desktop-mobile-sheet-CZSaAw0H.js} +2 -2
  171. package/dist/web/assets/remote-desktop-mobile-sheet-CZSaAw0H.js.br +0 -0
  172. package/dist/web/assets/remote-desktop-mobile-sheet-CZSaAw0H.js.gz +0 -0
  173. package/dist/web/assets/{remote-desktop-mobile-view-CV8eHh4A.js → remote-desktop-mobile-view-BfFE873g.js} +1 -1
  174. package/dist/web/assets/remote-desktop-mobile-view-BfFE873g.js.br +0 -0
  175. package/dist/web/assets/remote-desktop-mobile-view-BfFE873g.js.gz +0 -0
  176. package/dist/web/assets/{remote-desktop-readiness-gate-DrSYb_9z.js → remote-desktop-readiness-gate-Q1fu27Au.js} +1 -1
  177. package/dist/web/assets/remote-desktop-readiness-gate-Q1fu27Au.js.br +0 -0
  178. package/dist/web/assets/remote-desktop-readiness-gate-Q1fu27Au.js.gz +0 -0
  179. package/dist/web/assets/{remote-desktop-window-content-CAuxeGbK.js → remote-desktop-window-content-d6jXrRd6.js} +1 -1
  180. package/dist/web/assets/remote-desktop-window-content-d6jXrRd6.js.br +0 -0
  181. package/dist/web/assets/remote-desktop-window-content-d6jXrRd6.js.gz +0 -0
  182. package/dist/web/assets/{rename-object-dialog-BPuh3dAH.js → rename-object-dialog-CuMEO81R.js} +1 -1
  183. package/dist/web/assets/rename-object-dialog-CuMEO81R.js.br +0 -0
  184. package/dist/web/assets/rename-object-dialog-CuMEO81R.js.gz +0 -0
  185. package/dist/web/assets/{review-address-setup-CoI2BGdx.js → review-address-setup-CjK0xtI4.js} +1 -1
  186. package/dist/web/assets/review-address-setup-CjK0xtI4.js.br +0 -0
  187. package/dist/web/assets/review-address-setup-CjK0xtI4.js.gz +0 -0
  188. package/dist/web/assets/{review-code-Dy8y4_17.js → review-code-DhgeQzGz.js} +1 -1
  189. package/dist/web/assets/review-code-DhgeQzGz.js.br +0 -0
  190. package/dist/web/assets/review-code-DhgeQzGz.js.gz +0 -0
  191. package/dist/web/assets/{save-as-dialog-C9OpJz2x.js → save-as-dialog-C7ECuSxR.js} +1 -1
  192. package/dist/web/assets/save-as-dialog-C7ECuSxR.js.br +0 -0
  193. package/dist/web/assets/save-as-dialog-C7ECuSxR.js.gz +0 -0
  194. package/dist/web/assets/{schedule-script-editor--roOsFbc.js → schedule-script-editor-Duwi_hAc.js} +1 -1
  195. package/dist/web/assets/schedule-script-editor-Duwi_hAc.js.br +0 -0
  196. package/dist/web/assets/schedule-script-editor-Duwi_hAc.js.gz +0 -0
  197. package/dist/web/assets/{schedules-settings-section-BTn_NSzU.js → schedules-settings-section-5dlXgx4Z.js} +3 -3
  198. package/dist/web/assets/schedules-settings-section-5dlXgx4Z.js.br +0 -0
  199. package/dist/web/assets/schedules-settings-section-5dlXgx4Z.js.gz +0 -0
  200. package/dist/web/assets/{session-review-tab-fRzyogNH.js → session-review-tab-B57ji6e7.js} +1 -1
  201. package/dist/web/assets/session-review-tab-B57ji6e7.js.br +0 -0
  202. package/dist/web/assets/session-review-tab-B57ji6e7.js.gz +0 -0
  203. package/dist/web/assets/{settings-body-D5pmlFft.js → settings-body-CQQBaAhh.js} +1 -1
  204. package/dist/web/assets/settings-body-CQQBaAhh.js.br +0 -0
  205. package/dist/web/assets/settings-body-CQQBaAhh.js.gz +0 -0
  206. package/dist/web/assets/{settings-rows-VtjChFlm.js → settings-rows-7pRcbnko.js} +1 -1
  207. package/dist/web/assets/settings-rows-7pRcbnko.js.br +0 -0
  208. package/dist/web/assets/settings-rows-7pRcbnko.js.gz +0 -0
  209. package/dist/web/assets/{settings-section-content-BOwSlBkZ.js → settings-section-content-BxrZV4TG.js} +2 -2
  210. package/dist/web/assets/settings-section-content-BxrZV4TG.js.br +0 -0
  211. package/dist/web/assets/settings-section-content-BxrZV4TG.js.gz +0 -0
  212. package/dist/web/assets/{settings-section-content-Ck39TJA7.js → settings-section-content-Cp1L2Ujm.js} +1 -1
  213. package/dist/web/assets/{settings-tab-A81xb81d.js → settings-tab-DizKbuwq.js} +1 -1
  214. package/dist/web/assets/{settings-window-content-BCDRi6xS.js → settings-window-content-BPqPZ196.js} +1 -1
  215. package/dist/web/assets/{slash-command-picker-BKeEykkF.js → slash-command-picker-Tdojfoue.js} +1 -1
  216. package/dist/web/assets/slash-command-picker-Tdojfoue.js.br +0 -0
  217. package/dist/web/assets/slash-command-picker-Tdojfoue.js.gz +0 -0
  218. package/dist/web/assets/{sql-object-tab-I5bl3DVf.js → sql-object-tab-CZtcHAMF.js} +1 -1
  219. package/dist/web/assets/sql-object-tab-CZtcHAMF.js.br +0 -0
  220. package/dist/web/assets/sql-object-tab-CZtcHAMF.js.gz +0 -0
  221. package/dist/web/assets/{sqlite-viewer-ECCCjxdn.js → sqlite-viewer-CCb_rhpZ.js} +1 -1
  222. package/dist/web/assets/sqlite-viewer-CCb_rhpZ.js.br +0 -0
  223. package/dist/web/assets/sqlite-viewer-CCb_rhpZ.js.gz +0 -0
  224. package/dist/web/assets/{structure-save-dialog-DcQdamD3.js → structure-save-dialog-D9naj5dT.js} +1 -1
  225. package/dist/web/assets/structure-save-dialog-D9naj5dT.js.br +0 -0
  226. package/dist/web/assets/structure-save-dialog-D9naj5dT.js.gz +0 -0
  227. package/dist/web/assets/{structure-tab-DyQGhf9t.js → structure-tab-gYa8tU6n.js} +1 -1
  228. package/dist/web/assets/structure-tab-gYa8tU6n.js.br +0 -0
  229. package/dist/web/assets/structure-tab-gYa8tU6n.js.gz +0 -0
  230. package/dist/web/assets/{system-monitor-body-B5AvRT5J.js → system-monitor-body-CeyIOGpH.js} +2 -2
  231. package/dist/web/assets/system-monitor-body-CeyIOGpH.js.br +0 -0
  232. package/dist/web/assets/system-monitor-body-CeyIOGpH.js.gz +0 -0
  233. package/dist/web/assets/{system-monitor-tab-CfwHKQ5k.js → system-monitor-tab-D4M7Peo1.js} +1 -1
  234. package/dist/web/assets/{system-monitor-window-content-Cvx1V8Mf.js → system-monitor-window-content-B5VTVjWl.js} +1 -1
  235. package/dist/web/assets/{tab-host-window-content-DqOUHxEL.js → tab-host-window-content-ChUuAIIm.js} +1 -1
  236. package/dist/web/assets/tab-host-window-content-ChUuAIIm.js.br +0 -0
  237. package/dist/web/assets/tab-host-window-content-ChUuAIIm.js.gz +0 -0
  238. package/dist/web/assets/{table-tab-dI8rBbCS.js → table-tab-PG0eKr51.js} +1 -1
  239. package/dist/web/assets/table-tab-PG0eKr51.js.br +0 -0
  240. package/dist/web/assets/table-tab-PG0eKr51.js.gz +0 -0
  241. package/dist/web/assets/{telegram-bot-token-field-DSLtG8vw.js → telegram-bot-token-field-kR3Gia1c.js} +1 -1
  242. package/dist/web/assets/telegram-bot-token-field-kR3Gia1c.js.br +0 -0
  243. package/dist/web/assets/telegram-bot-token-field-kR3Gia1c.js.gz +0 -0
  244. package/dist/web/assets/{terminal-tab-CDg0AHBK.js → terminal-tab-CmmKY_Z9.js} +1 -1
  245. package/dist/web/assets/terminal-tab-CmmKY_Z9.js.br +0 -0
  246. package/dist/web/assets/terminal-tab-CmmKY_Z9.js.gz +0 -0
  247. package/dist/web/assets/{tool-cards-7E0jtwP0.js → tool-cards-72GKNSD3.js} +2 -2
  248. package/dist/web/assets/tool-cards-72GKNSD3.js.br +0 -0
  249. package/dist/web/assets/{tool-cards-7E0jtwP0.js.gz → tool-cards-72GKNSD3.js.gz} +0 -0
  250. package/dist/web/assets/{tools-settings-section-AChVQJyU.js → tools-settings-section-CphfnhQ9.js} +1 -1
  251. package/dist/web/assets/tools-settings-section-CphfnhQ9.js.br +0 -0
  252. package/dist/web/assets/tools-settings-section-CphfnhQ9.js.gz +0 -0
  253. package/dist/web/assets/{use-inline-blame-BvlcOQd9.js → use-inline-blame-CXHYEnbI.js} +1 -1
  254. package/dist/web/assets/use-inline-blame-CXHYEnbI.js.br +0 -0
  255. package/dist/web/assets/use-inline-blame-CXHYEnbI.js.gz +0 -0
  256. package/dist/web/assets/{use-lsp-fLNwD0BI.js → use-lsp-BnUfzZvt.js} +1 -1
  257. package/dist/web/assets/use-lsp-BnUfzZvt.js.br +0 -0
  258. package/dist/web/assets/use-lsp-BnUfzZvt.js.gz +0 -0
  259. package/dist/web/assets/{use-monaco-theme-CbNQ4HnC.js → use-monaco-theme-CftL7YLM.js} +1 -1
  260. package/dist/web/assets/{use-process-kill-B4Srjl2m.js → use-process-kill-BV2qes3Y.js} +1 -1
  261. package/dist/web/assets/use-process-kill-BV2qes3Y.js.br +0 -0
  262. package/dist/web/assets/use-process-kill-BV2qes3Y.js.gz +0 -0
  263. package/dist/web/assets/{use-sql-schema-info-CqISFaAW.js → use-sql-schema-info-kvFlHYFB.js} +1 -1
  264. package/dist/web/assets/{use-sql-schema-info-CqISFaAW.js.br → use-sql-schema-info-kvFlHYFB.js.br} +0 -0
  265. package/dist/web/assets/use-sql-schema-info-kvFlHYFB.js.gz +0 -0
  266. package/dist/web/assets/{use-websocket-DVJuWhlA.js → use-websocket-BcikOlHe.js} +1 -1
  267. package/dist/web/assets/{web-preview-tab-CZJAVoVU.js → web-preview-tab-DfKgQQuP.js} +1 -1
  268. package/dist/web/assets/web-preview-tab-DfKgQQuP.js.br +0 -0
  269. package/dist/web/assets/web-preview-tab-DfKgQQuP.js.gz +0 -0
  270. package/dist/web/index.html +1 -1
  271. package/dist/web/index.html.br +0 -0
  272. package/dist/web/index.html.gz +0 -0
  273. package/dist/web/sw.js +1 -1
  274. package/dist/web/sw.js.br +0 -0
  275. package/dist/web/sw.js.gz +0 -0
  276. package/package.json +1 -1
  277. package/src/providers/codex-app-server/codex-history-async.ts +8 -19
  278. package/src/providers/codex-app-server/codex-history.ts +36 -51
  279. package/src/providers/codex-app-server/codex-provider.ts +1 -1
  280. package/src/providers/codex-app-server/codex-rollout-header.ts +40 -0
  281. package/src/providers/codex-app-server/codex-rollout-index.ts +145 -0
  282. package/src/web/components/settings/accounts/use-accounts-data.ts +38 -16
  283. package/dist/web/assets/accounts-settings-section-CZglHifc.js.br +0 -0
  284. package/dist/web/assets/accounts-settings-section-CZglHifc.js.gz +0 -0
  285. package/dist/web/assets/agent-session-sheet-B3VLD2H6.js.br +0 -0
  286. package/dist/web/assets/agent-session-sheet-B3VLD2H6.js.gz +0 -0
  287. package/dist/web/assets/agent-session-window-content-HEdIT_LQ.js.br +0 -0
  288. package/dist/web/assets/agent-session-window-content-HEdIT_LQ.js.gz +0 -0
  289. package/dist/web/assets/ai-resource-editor-CFbXgGMo.js.br +0 -0
  290. package/dist/web/assets/ai-resource-editor-CFbXgGMo.js.gz +0 -0
  291. package/dist/web/assets/ai-settings-section-BNiVD9D3.js.br +0 -0
  292. package/dist/web/assets/ai-settings-section-BNiVD9D3.js.gz +0 -0
  293. package/dist/web/assets/android-tab-CY3aa_vU.js.br +0 -0
  294. package/dist/web/assets/android-tab-CY3aa_vU.js.gz +0 -0
  295. package/dist/web/assets/appearance-settings-section-lbtuzecW.js.br +0 -0
  296. package/dist/web/assets/appearance-settings-section-lbtuzecW.js.gz +0 -0
  297. package/dist/web/assets/apps-panel-CF2mbvVq.js.br +0 -0
  298. package/dist/web/assets/apps-panel-CF2mbvVq.js.gz +0 -0
  299. package/dist/web/assets/branch-review-tab-CR7JnS5x.js.br +0 -0
  300. package/dist/web/assets/branch-review-tab-CR7JnS5x.js.gz +0 -0
  301. package/dist/web/assets/chat-tab-BCELq4nK.js.br +0 -0
  302. package/dist/web/assets/chat-tab-BCELq4nK.js.gz +0 -0
  303. package/dist/web/assets/chat-tab-C4aOYSea.js.br +0 -0
  304. package/dist/web/assets/chat-tab-C4aOYSea.js.gz +0 -0
  305. package/dist/web/assets/code-editor-_axJbYkP.js.br +0 -0
  306. package/dist/web/assets/code-editor-_axJbYkP.js.gz +0 -0
  307. package/dist/web/assets/codex-reset-credit-button-DJQD6NUF.js +0 -1
  308. package/dist/web/assets/codex-reset-credit-button-DJQD6NUF.js.br +0 -0
  309. package/dist/web/assets/codex-reset-credit-button-DJQD6NUF.js.gz +0 -0
  310. package/dist/web/assets/conflict-editor-D0AYuLKI.js.br +0 -0
  311. package/dist/web/assets/conflict-editor-D0AYuLKI.js.gz +0 -0
  312. package/dist/web/assets/connection-form-tab-C3QyUWnE.js.br +0 -0
  313. package/dist/web/assets/csv-preview-CmKkcz4M.js.br +0 -0
  314. package/dist/web/assets/csv-preview-CmKkcz4M.js.gz +0 -0
  315. package/dist/web/assets/db-tab-parts-BXL34wrZ.js.br +0 -0
  316. package/dist/web/assets/db-tab-parts-BXL34wrZ.js.gz +0 -0
  317. package/dist/web/assets/design-settings-section-DukfVtwP.js.br +0 -0
  318. package/dist/web/assets/design-settings-section-DukfVtwP.js.gz +0 -0
  319. package/dist/web/assets/design-tab-BoPiL2ge.js.br +0 -0
  320. package/dist/web/assets/design-tab-BoPiL2ge.js.gz +0 -0
  321. package/dist/web/assets/designs-sidebar-panel-BVTqPPzG.js.br +0 -0
  322. package/dist/web/assets/designs-sidebar-panel-BVTqPPzG.js.gz +0 -0
  323. package/dist/web/assets/diff-viewer-C86mR7vD.js.br +0 -0
  324. package/dist/web/assets/diff-viewer-C86mR7vD.js.gz +0 -0
  325. package/dist/web/assets/docx-preview-B9EhDCMi.js.br +0 -0
  326. package/dist/web/assets/docx-preview-B9EhDCMi.js.gz +0 -0
  327. package/dist/web/assets/editor-dialog-DTDsbJd6.js.br +0 -0
  328. package/dist/web/assets/editor-dialog-DTDsbJd6.js.gz +0 -0
  329. package/dist/web/assets/editor-language-service-BtrrQAS2.js.br +0 -0
  330. package/dist/web/assets/editor-language-service-BtrrQAS2.js.gz +0 -0
  331. package/dist/web/assets/explorer-body-DLaWmxri.js.br +0 -0
  332. package/dist/web/assets/explorer-body-DLaWmxri.js.gz +0 -0
  333. package/dist/web/assets/explorer-window-content-CbUIbrzL.js.br +0 -0
  334. package/dist/web/assets/explorer-window-content-CbUIbrzL.js.gz +0 -0
  335. package/dist/web/assets/extension-manager-section-BpKMyLwI.js.br +0 -0
  336. package/dist/web/assets/extension-manager-section-BpKMyLwI.js.gz +0 -0
  337. package/dist/web/assets/extension-webview-BGfyaXMI.js.br +0 -0
  338. package/dist/web/assets/extension-webview-BGfyaXMI.js.gz +0 -0
  339. package/dist/web/assets/files-settings-section-CQT9_rX2.js.br +0 -0
  340. package/dist/web/assets/files-settings-section-CQT9_rX2.js.gz +0 -0
  341. package/dist/web/assets/general-settings-section-BoQGeqBi.js.br +0 -0
  342. package/dist/web/assets/general-settings-section-BoQGeqBi.js.gz +0 -0
  343. package/dist/web/assets/git-log-panel-T8Fzn8-5.js.br +0 -0
  344. package/dist/web/assets/git-log-panel-T8Fzn8-5.js.gz +0 -0
  345. package/dist/web/assets/git-review-tab-WzuX4Ml9.js.br +0 -0
  346. package/dist/web/assets/git-review-tab-WzuX4Ml9.js.gz +0 -0
  347. package/dist/web/assets/glide-data-grid-BBzGDYvj.js.br +0 -0
  348. package/dist/web/assets/glide-data-grid-BBzGDYvj.js.gz +0 -0
  349. package/dist/web/assets/grid-save-dialog-HiqlnSky.js.br +0 -0
  350. package/dist/web/assets/grid-save-dialog-HiqlnSky.js.gz +0 -0
  351. package/dist/web/assets/group-chat-tab-URU3FCLs.js.br +0 -0
  352. package/dist/web/assets/group-chat-tab-URU3FCLs.js.gz +0 -0
  353. package/dist/web/assets/impexp-tab-B0m1Q8ia.js.br +0 -0
  354. package/dist/web/assets/impexp-tab-B0m1Q8ia.js.gz +0 -0
  355. package/dist/web/assets/index-Vd9Xr54k.js.br +0 -0
  356. package/dist/web/assets/index-Vd9Xr54k.js.gz +0 -0
  357. package/dist/web/assets/keyboard-shortcuts-section-CU7JjDsU.js.br +0 -0
  358. package/dist/web/assets/keyboard-shortcuts-section-CU7JjDsU.js.gz +0 -0
  359. package/dist/web/assets/language-servers-section-CzUG9H69.js.br +0 -0
  360. package/dist/web/assets/language-servers-section-CzUG9H69.js.gz +0 -0
  361. package/dist/web/assets/logs-app-CDSvyY1H.js.br +0 -0
  362. package/dist/web/assets/logs-app-CDSvyY1H.js.gz +0 -0
  363. package/dist/web/assets/lsp-client-CpjPUUYJ.js.br +0 -0
  364. package/dist/web/assets/lsp-client-CpjPUUYJ.js.gz +0 -0
  365. package/dist/web/assets/markdown-renderer-DZNMRg6p.js.br +0 -0
  366. package/dist/web/assets/markdown-renderer-DZNMRg6p.js.gz +0 -0
  367. package/dist/web/assets/mobile-explorer-sheet-D7e-MM6m.js.br +0 -0
  368. package/dist/web/assets/mobile-explorer-sheet-D7e-MM6m.js.gz +0 -0
  369. package/dist/web/assets/new-design-dialog-BthM423i.js.br +0 -0
  370. package/dist/web/assets/new-design-dialog-BthM423i.js.gz +0 -0
  371. package/dist/web/assets/notifications-settings-section-TS3gNFcc.js.br +0 -0
  372. package/dist/web/assets/notifications-settings-section-TS3gNFcc.js.gz +0 -0
  373. package/dist/web/assets/ppmbot-settings-section-D8jIlmp8.js.br +0 -0
  374. package/dist/web/assets/ppmbot-settings-section-D8jIlmp8.js.gz +0 -0
  375. package/dist/web/assets/problems-panel-DjCHA1r5.js.br +0 -0
  376. package/dist/web/assets/problems-panel-DjCHA1r5.js.gz +0 -0
  377. package/dist/web/assets/process-table-BxXEh4tN.js.br +0 -0
  378. package/dist/web/assets/process-table-BxXEh4tN.js.gz +0 -0
  379. package/dist/web/assets/proxy-settings-section-B8igco2L.js.br +0 -0
  380. package/dist/web/assets/proxy-settings-section-B8igco2L.js.gz +0 -0
  381. package/dist/web/assets/query-tab-DHU3ANHN.js.br +0 -0
  382. package/dist/web/assets/query-tab-DHU3ANHN.js.gz +0 -0
  383. package/dist/web/assets/remote-access-settings-section-CoYQTFKd.js.br +0 -0
  384. package/dist/web/assets/remote-access-settings-section-CoYQTFKd.js.gz +0 -0
  385. package/dist/web/assets/remote-desktop-clipboard-notice-Dwn-iV4g.js.br +0 -0
  386. package/dist/web/assets/remote-desktop-clipboard-notice-Dwn-iV4g.js.gz +0 -0
  387. package/dist/web/assets/remote-desktop-mobile-sheet-bfKiSG0C.js.br +0 -0
  388. package/dist/web/assets/remote-desktop-mobile-sheet-bfKiSG0C.js.gz +0 -0
  389. package/dist/web/assets/remote-desktop-mobile-view-CV8eHh4A.js.br +0 -0
  390. package/dist/web/assets/remote-desktop-mobile-view-CV8eHh4A.js.gz +0 -0
  391. package/dist/web/assets/remote-desktop-readiness-gate-DrSYb_9z.js.br +0 -0
  392. package/dist/web/assets/remote-desktop-readiness-gate-DrSYb_9z.js.gz +0 -0
  393. package/dist/web/assets/remote-desktop-window-content-CAuxeGbK.js.br +0 -0
  394. package/dist/web/assets/remote-desktop-window-content-CAuxeGbK.js.gz +0 -0
  395. package/dist/web/assets/rename-object-dialog-BPuh3dAH.js.br +0 -0
  396. package/dist/web/assets/rename-object-dialog-BPuh3dAH.js.gz +0 -0
  397. package/dist/web/assets/review-address-setup-CoI2BGdx.js.br +0 -0
  398. package/dist/web/assets/review-address-setup-CoI2BGdx.js.gz +0 -0
  399. package/dist/web/assets/review-code-Dy8y4_17.js.br +0 -0
  400. package/dist/web/assets/review-code-Dy8y4_17.js.gz +0 -0
  401. package/dist/web/assets/save-as-dialog-C9OpJz2x.js.br +0 -0
  402. package/dist/web/assets/save-as-dialog-C9OpJz2x.js.gz +0 -0
  403. package/dist/web/assets/schedule-script-editor--roOsFbc.js.br +0 -0
  404. package/dist/web/assets/schedule-script-editor--roOsFbc.js.gz +0 -0
  405. package/dist/web/assets/schedules-settings-section-BTn_NSzU.js.br +0 -0
  406. package/dist/web/assets/schedules-settings-section-BTn_NSzU.js.gz +0 -0
  407. package/dist/web/assets/session-review-tab-fRzyogNH.js.br +0 -0
  408. package/dist/web/assets/session-review-tab-fRzyogNH.js.gz +0 -0
  409. package/dist/web/assets/settings-body-D5pmlFft.js.br +0 -0
  410. package/dist/web/assets/settings-body-D5pmlFft.js.gz +0 -0
  411. package/dist/web/assets/settings-rows-VtjChFlm.js.br +0 -0
  412. package/dist/web/assets/settings-rows-VtjChFlm.js.gz +0 -0
  413. package/dist/web/assets/settings-section-content-BOwSlBkZ.js.br +0 -0
  414. package/dist/web/assets/settings-section-content-BOwSlBkZ.js.gz +0 -0
  415. package/dist/web/assets/slash-command-picker-BKeEykkF.js.br +0 -0
  416. package/dist/web/assets/slash-command-picker-BKeEykkF.js.gz +0 -0
  417. package/dist/web/assets/sql-object-tab-I5bl3DVf.js.br +0 -0
  418. package/dist/web/assets/sql-object-tab-I5bl3DVf.js.gz +0 -0
  419. package/dist/web/assets/sqlite-viewer-ECCCjxdn.js.br +0 -0
  420. package/dist/web/assets/sqlite-viewer-ECCCjxdn.js.gz +0 -0
  421. package/dist/web/assets/structure-save-dialog-DcQdamD3.js.br +0 -0
  422. package/dist/web/assets/structure-save-dialog-DcQdamD3.js.gz +0 -0
  423. package/dist/web/assets/structure-tab-DyQGhf9t.js.br +0 -0
  424. package/dist/web/assets/structure-tab-DyQGhf9t.js.gz +0 -0
  425. package/dist/web/assets/system-monitor-body-B5AvRT5J.js.br +0 -0
  426. package/dist/web/assets/system-monitor-body-B5AvRT5J.js.gz +0 -0
  427. package/dist/web/assets/tab-host-window-content-DqOUHxEL.js.br +0 -0
  428. package/dist/web/assets/tab-host-window-content-DqOUHxEL.js.gz +0 -0
  429. package/dist/web/assets/table-tab-dI8rBbCS.js.br +0 -0
  430. package/dist/web/assets/table-tab-dI8rBbCS.js.gz +0 -0
  431. package/dist/web/assets/telegram-bot-token-field-DSLtG8vw.js.br +0 -0
  432. package/dist/web/assets/telegram-bot-token-field-DSLtG8vw.js.gz +0 -0
  433. package/dist/web/assets/terminal-tab-CDg0AHBK.js.br +0 -0
  434. package/dist/web/assets/terminal-tab-CDg0AHBK.js.gz +0 -0
  435. package/dist/web/assets/tool-cards-7E0jtwP0.js.br +0 -0
  436. package/dist/web/assets/tools-settings-section-AChVQJyU.js.br +0 -0
  437. package/dist/web/assets/tools-settings-section-AChVQJyU.js.gz +0 -0
  438. package/dist/web/assets/use-inline-blame-BvlcOQd9.js.br +0 -0
  439. package/dist/web/assets/use-inline-blame-BvlcOQd9.js.gz +0 -0
  440. package/dist/web/assets/use-lsp-fLNwD0BI.js.br +0 -0
  441. package/dist/web/assets/use-lsp-fLNwD0BI.js.gz +0 -0
  442. package/dist/web/assets/use-process-kill-B4Srjl2m.js.br +0 -0
  443. package/dist/web/assets/use-process-kill-B4Srjl2m.js.gz +0 -0
  444. package/dist/web/assets/use-sql-schema-info-CqISFaAW.js.gz +0 -0
  445. package/dist/web/assets/web-preview-tab-CZJAVoVU.js.br +0 -0
  446. package/dist/web/assets/web-preview-tab-CZJAVoVU.js.gz +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.23.28] - 2026-11-04
4
+
5
+ ### Fixed
6
+
7
+ - **PPM no longer freezes for up to a minute and a half at a time.** Listing a project's chats read the start of every Codex transcript on disk (thousands of files, across every project) on each request, and the whole server waited for the disk, many times a day; it now remembers what it read, rereads only changed files, and never makes other requests wait.
8
+ - **The usage panel opens straight away.** It shows the numbers it last loaded while fresh ones arrive, instead of "Loading..." on every open, and no longer waits for its slowest request.
9
+
3
10
  ## [0.23.27] - 2026-11-04
4
11
 
5
12
  ### Changed
package/CLAUDE.md CHANGED
@@ -249,6 +249,7 @@ Related: `configService.save()`/`set()` throw when `load()` has not run, because
249
249
  - **Stripping ANSI codes from a terminal buffer leaks what the screen never showed**: a line editor redraws in place, so zsh-autosuggestions draws the rest of a history entry in grey and the next key erases it with cursor moves — a regex that drops escape sequences keeps that text and hands the AI the user's shell history as if it were output. `read_terminal` replays the buffer into `@xterm/headless` at the terminal's own size instead (`terminal-text.ts`), which also keeps a progress bar's last state and a full-screen program's screen; any new reader of terminal output should go through it.
250
250
  - **Playwright's headless shell ignores `--unsafely-treat-insecure-origin-as-secure`**: the default `headless: true` launches `chromium-headless-shell`, where a page on a mapped name (`--host-resolver-rules=MAP ppm-remote.test 127.0.0.1`) stays an insecure origin and loses every API a browser keeps for secure contexts. That is how PPM's chat send was found broken on plain HTTP: it called `crypto.randomUUID`, so a turn never started and the test read as hung. Full Chromium (`channel: "chromium"`, also headless) honours the flag; `ai-tab-tools-e2e.mjs` launches it only for its device-that-is-not-the-host step.
251
251
 
252
+ - **The chat sidebar's session list read every Codex transcript on disk, synchronously, on every request**: `GET /chat/sessions` asks every provider, and Codex finds a project's sessions by reading the head of each rollout in each account's sessions tree, which holds every project's rollouts (5,262 files / 5.4 GB on the dev host). Done with `readSync` per request, that was 10.9 s of stopped event loop for one project with the files out of the OS cache, and the sidebar lists two or three projects at once — so the server froze 35–90 s at a time, many times a day (`Event loop stalled … cause=blocked`, main thread `waiting/Executive`), taking the usage panel, chat history and health probe down with it. The tell was in the log: nearly every stall had a `/chat/sessions` request whose duration matched the stall to within a second. `codex-rollout-index.ts` now keeps each rollout's header keyed by path and re-reads a file only when its size or mtime moves, reads asynchronously, shares one pass between concurrent callers and reads titles only for the page returned (two projects at once: 135 ms, longest event-loop block ~30 ms). Any new reader of that tree should go through it rather than `readSessionMeta`, which is for single lookups.
252
253
  - **A process with little CPU during a stall was not necessarily starved**: the Windows autostart task once ran at the Task Scheduler's default priority 7, which also means memory priority 2 and I/O priority Low for the supervisor and every child it spawns. The server's main thread then sat in `PageIn` waits for 20-60s on an idle machine (13% CPU) until the health check killed it, while the lag monitor logged `cause=starved`. The task is now priority 5, both processes raise themselves at start (`process-priority.ts`, logged as a `WARN` when it fires), the lag monitor says `cause=blocked` when cores were free, and a failed health probe logs the server's main-thread wait from the supervisor (`process-thread-snapshot.ts`). See `docs/lessons-learned.md`.
253
254
  - **The SDK's `getSessionMessages` reads the whole transcript, however little you need from it**: past 5 MB it scans every byte for the last `compact_boundary` (1 MB reads on Bun's pool threads) and then `JSON.parse`s all that follows. The streaming loop's tool_result fallback used to fire on the frames that follow a tool_use inside its own response (`content_block_stop`, `message_delta`, `message_stop`), i.e. on every tool call before the tool had even run, and it yielded each result twice. One 7-day session's 1.47 GB transcript was read back every ~8 s: the server's RSS swung 4.9→12.8 GB, its main thread sat at 96% and requests hit Bun's 10 s timeout. The fallback now waits for a new response (`message_start`, or an assistant frame of another message id). Measured over 3 tool calls on a 401 MB transcript, peak RSS went 1466 MB → 203 MB. Keep it off every per-event path: `getMessages` (a history load) still pays it once per call, `readCompactions` with no window once more. `claude-agent-sdk.test.ts` "tool results" pins both halves of the fallback.
254
255
  - **Every Claude CLI must come from `query` in `src/providers/claude-cli-process-group.ts`, never from the SDK's own `query`**: the CLI starts its stdio MCP servers (`npm exec @playwright/mcp`, `slack-mcp-server`) in its own process group, and the SDK spawned the CLI in PPM's, so every CLI and MCP server of every session shared the supervisor's group and a server that outlived its CLI could not be told from a live one. On 2026-10-20 about 30 `npm exec` + node families sat in `ppm.service` hours after their CLI, swap filled, and systemd-oomd killed the unit with every session in it, twice that day. The wrapper spawns the CLI `detached` (a group of its own) and on its exit SIGTERMs the group, then SIGKILLs it 20 s later. Measured with the real CLI: an MCP server that ignores its stdin closing survives the SDK's spawn whether the query is closed or the CLI SIGKILLed, and is gone within 8 s with the wrapper, Playwright's Chrome included. This group teardown never reaches the Bash tool's commands, because the CLI starts each in a session of its own; what can wrap and stop those is leftover tracking, the next entry. A custom spawn has two costs. The SDK no longer reads stderr, so its exit errors lose their `stderr:` tail, though the `stderr` option still gets every line. And a `toEqual` on query options has to ignore `spawnClaudeCodeProcess` the way it ignores `stderr`. Why those servers outlived their CLI in production is still unknown; a `[cli-group] CLI pid=… exited (…) leaving …` warning names each case.
@@ -73,4 +73,4 @@ This skill covers the `ppm` CLI, its HTTP API, and its config DB. It does **not*
73
73
  - Third-party extensions (inspect via `ppm ext list`).
74
74
  - The Claude Agent SDK internals (separate skill).
75
75
 
76
- <!-- Generated for PPM v0.23.27 at build time. Re-run `ppm export skill --install` to refresh. -->
76
+ <!-- Generated for PPM v0.23.28 at build time. Re-run `ppm export skill --install` to refresh. -->
@@ -843,7 +843,7 @@ Replace a script schedule's state with a JSON file; the schedule must be off
843
843
  Manage and inspect discovered skills & commands
844
844
 
845
845
  **Options:**
846
- - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
846
+ - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release-0.23.28"`)
847
847
 
848
848
  **Usage:** `ppm skills [options] [command]`
849
849
 
@@ -853,7 +853,7 @@ List all discovered skills and commands
853
853
 
854
854
  **Options:**
855
855
  - `--json` — JSON output
856
- - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
856
+ - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release-0.23.28"`)
857
857
 
858
858
  ### `ppm skills search`
859
859
 
@@ -861,7 +861,7 @@ Fuzzy search skills and commands
861
861
 
862
862
  **Options:**
863
863
  - `--json` — JSON output
864
- - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
864
+ - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release-0.23.28"`)
865
865
 
866
866
  **Usage:** `ppm skills search [options] <query>`
867
867
 
@@ -871,7 +871,7 @@ Show detailed info for a specific skill
871
871
 
872
872
  **Options:**
873
873
  - `--json` — JSON output
874
- - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
874
+ - `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release-0.23.28"`)
875
875
 
876
876
  **Usage:** `ppm skills info [options] <name>`
877
877
 
@@ -500,4 +500,4 @@ _Base URL: `http://localhost:8080` (default; override via `ppm config set port <
500
500
  - `ws://<host>/ws/terminal` — PTY terminal multiplexer
501
501
  - `ws://<host>/ws/extensions` — extension host channel
502
502
 
503
- <!-- Generated from src/server/routes/ for PPM v0.23.27 -->
503
+ <!-- Generated from src/server/routes/ for PPM v0.23.28 -->
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{At as r,Cn as i,Cr as a,J as o,Kr as s,Zr as c,cr as l,ht as u,li as d,ln as f,ut as p,xn as m}from"./icons-C1wDt09O.js";import{a as h}from"./api-client-BnYFnEfK.js";import{n as g}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./chat-preparation-cache-Bzb-T1pm.js";import{n as _}from"./use-is-mobile-CL2I7hLf.js";import{r as v}from"./clipboard-D3XnL7CB.js";import{r as y,t as b}from"./button-BHGVTbam.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./dialog-DnE192fh.js";import{t as D}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{t as O}from"./input-CReAuQTF.js";import{Ii as k,Jn as A,Mr as j,Qn as M,Xi as N,Xn as P,Yi as F,Yn as I,Zi as L,Zn as ee,qn as te}from"./index-Vd9Xr54k.js";import{_ as ne,a as re,h as R,m as ie,o as ae,p as oe,r as se,v as ce,x as z,y as le}from"./api-settings-BPIlTiBi.js";import{_ as ue,a as de,b as fe,c as pe,d as me,g as B,h as V,l as he,m as ge,n as _e,o as ve,p as H,r as ye,s as U,t as be,u as xe,x as W,y as G}from"./codex-reset-credit-button-DJQD6NUF.js";var K=e(t(),1),q=n(),J=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Y=Array.from({length:24},(e,t)=>t);function Se(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function Ce(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function we(e){return Y.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function X(e){return e===0?`bg-surface-elevated`:e<.3?`bg-success/30`:e<.5?`bg-success/60`:e<.7?`bg-warning/50`:e<.9?`bg-warning/80`:`bg-error/80`}function Te(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function Ee({accountId:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(!0),[a,o]=(0,K.useState)(`5h`);(0,K.useEffect)(()=>{i(!0),oe(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,K.useMemo)(()=>t?Se(t,a):null,[t,a]),c=(0,K.useMemo)(()=>s?Ce(s):[],[s]),l=(0,K.useMemo)(()=>s?we(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,q.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,q.jsx)(m,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,q.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let d=t.length,f=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,q.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,q.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,q.jsx)(`button`,{onClick:()=>o(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,q.jsx)(`button`,{onClick:()=>o(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,q.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,f,`d (`,d,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,q.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:J.map((e,t)=>{let n=c[t]??0;return(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,q.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,q.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Te(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,q.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,q.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:Y.map(e=>{let t=l[e]??0;return(0,q.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,q.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${X(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[J.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,q.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),Y.map(n=>{let r=s[t][n];return(0,q.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${X(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,q.jsx)(`span`,{className:`w-4 shrink-0`}),Y.map(e=>(0,q.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,q.jsx)(`span`,{children:`Low`}),(0,q.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,q.jsx)(`span`,{children:`High`}),(0,q.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,q.jsx)(`span`,{children:`No data`})]})]})}function De({profile:e,accountId:t,onClose:n}){let r=[[`Name`,e.account?.display_name],[`Email`,e.account?.email],[`Org`,e.organization?.name],[`Type`,e.organization?.organization_type],[`Tier`,e.organization?.rate_limit_tier],[`Status`,e.organization?.subscription_status]];return(0,q.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,q.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,q.jsx)(d,{className:`size-4`})})]}),(0,q.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,q.jsxs)(`span`,{className:`contents`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,q.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,q.jsx)(Ee,{accountId:t})]})}function Oe({display:e,onConfirm:t,onCancel:n}){let r=_(),i=(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,q.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,q.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,q.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`The stored token is deleted from this machine. Any export you already made keeps working.`}),(0,q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,q.jsx)(b,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,q.jsx)(b,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,q.jsx)(D,{open:!0,onClose:n,children:(0,q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,q.jsx)(E,{open:!0,onOpenChange:e=>{e||n()},children:(0,q.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,q.jsx)(x,{children:(0,q.jsx)(w,{className:`text-sm`,children:`Remove account`})}),i]})})}var ke=80;function Ae({current:e,onSave:t,onCancel:n}){let r=_(),[i,a]=(0,K.useState)(e),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(null),u=i.trim(),d=!!u&&u!==e&&!o,f=async()=>{if(d){s(!0),l(null);try{await t(u)}catch(e){l(e.message||`Could not rename the account`),s(!1)}}},p=()=>{o||n()},h=(0,q.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,q.jsx)(O,{autoFocus:!0,value:i,maxLength:ke,onChange:e=>a(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),c&&(0,q.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:c}),(0,q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,q.jsx)(b,{type:`button`,variant:`outline`,onClick:p,disabled:o,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,q.jsxs)(b,{type:`submit`,disabled:!d,className:`min-h-11 md:min-h-9`,children:[o&&(0,q.jsx)(m,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,q.jsx)(D,{open:!0,onClose:p,children:(0,q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),h]})}):(0,q.jsx)(E,{open:!0,onOpenChange:e=>{e||p()},children:(0,q.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,q.jsx)(x,{children:(0,q.jsx)(w,{className:`text-sm`,children:`Rename account`})}),h]})})}function je(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function Me({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:a}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,K.useState)(new Set),[l,d]=(0,K.useState)(``),[f,g]=(0,K.useState)(!1),[_,y]=(0,K.useState)(!1),[D,k]=(0,K.useState)(!1),[A,M]=(0,K.useState)(!1);e&&!A&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),M(!0)),!e&&A&&M(!1);function N(){t(!1),d(``),g(!1),y(!1)}async function P(e){if(s.size===0)return;k(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=h();r&&(n.Authorization=`Bearer ${r}`);let i=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:f,refreshBeforeExport:_})});if(!i.ok){let e=await i.json();throw Error(e.error??`Export failed: ${i.status}`)}let o=await i.text();e&&await v(o)?a?.(`Backup copied to clipboard!`):(je(o),a?.(`Backup downloaded.`)),N()}catch{}k(!1)}let F=s.size>0&&!D;return(0,q.jsx)(E,{open:e,onOpenChange:e=>{e||N()},children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(i,{className:`size-3.5`}),` Export Accounts`]}),(0,q.jsx)(T,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,q.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===o.length?new Set:new Set(o.map(e=>e.id))),children:s.size===o.length?`Deselect all`:`Select all`})]}),o.length===0?(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,q.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:s.has(e.id),onChange:t=>{let n=new Set(s);t.target.checked?n.add(e.id):n.delete(e.id),c(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,q.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(j,{className:`text-xs`,children:[`Password `,(0,q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,q.jsx)(O,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>d(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>g(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,q.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:_,onChange:e=>y(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,q.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,q.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,q.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):_?(0,q.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,q.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,q.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,q.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,q.jsxs)(S,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:N,children:`Cancel`}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!0),children:[(0,q.jsx)(p,{className:`size-3 mr-1`}),` Copy`]}),(0,q.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!1),children:D?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Ne({open:e,onOpenChange:t,onSuccess:n}){let[r,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(``),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null);function f(){t(!1),a(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await ie({data:r.trim(),password:o.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,q.jsx)(E,{open:e,onOpenChange:e=>{e||f()},children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(i,{className:`size-3.5`}),` Import Accounts`]}),(0,q.jsx)(T,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(j,{className:`text-xs`,children:`Backup data`}),(0,q.jsx)(`textarea`,{value:r,onChange:e=>a(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(j,{className:`text-xs`,children:[`Password `,(0,q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,q.jsx)(O,{type:`password`,placeholder:`Leave empty for default`,value:o,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,q.jsxs)(S,{children:[(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,q.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var Z=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Pe(e){return Z?.addEventListener(`change`,e),()=>Z?.removeEventListener(`change`,e)}function Fe(){return Z?.matches??!0}function Q(){let[e,t]=(0,K.useState)(null),[n,r]=(0,K.useState)(!0);return(0,K.useEffect)(()=>{r(!0),ae().then(t).finally(()=>r(!1))},[]),n?(0,q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,q.jsxs)(te,{value:e.strategy,onValueChange:async e=>{t(await z({strategy:e}))},children:[(0,q.jsx)(P,{className:`w-full h-9 text-xs`,children:(0,q.jsx)(ee,{})}),(0,q.jsxs)(A,{children:[(0,q.jsx)(I,{value:`round-robin`,children:`Round-robin`}),(0,q.jsx)(I,{value:`fill-first`,children:`Fill-first`}),(0,q.jsx)(I,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,q.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,q.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await z({maxRetry:n}))}}),(0,q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,q.jsx)(M,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await z({cooldownEnabled:e}))}})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Park a failing account (rate limit / usage limit / auth error) until it recovers. Off: accounts stay selectable — rotation still skips accounts already ≥95% on the 5-hour limit.`})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,q.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,q.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function Ie({open:e,onOpenChange:t}){let n=(0,K.useSyncExternalStore)(Pe,Fe);return e?n?(0,q.jsx)(E,{open:e,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,q.jsx)(x,{children:(0,q.jsxs)(w,{className:`text-sm flex items-center gap-2`,children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation & Retry`]})}),(0,q.jsx)(Q,{})]})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,q.jsxs)(`div`,{className:g(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,q.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,q.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,q.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation & Retry`]}),(0,q.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,q.jsx)(d,{className:`size-4`})})]}),(0,q.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,q.jsx)(Q,{})})]})]}):null}var Le=y(`inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground shadow`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground shadow`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function $({className:e,variant:t,...n}){return(0,q.jsx)(`div`,{className:g(Le({variant:t}),e),...n})}function Re(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function ze({accounts:e}){let[t,n]=(0,K.useState)([]),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(new Map),l=e.filter(e=>e.hasRefreshToken);async function u(){if(l.length!==0){i(!0);try{let e=await ce(l.map(e=>e.id),a);n(t=>[...t,{round:t.length+1,time:new Date().toLocaleTimeString(),includeRefresh:a,items:e}])}catch{}i(!1)}}async function d(e,t){c(t=>new Map(t).set(e,{loading:!0}));try{let n=await le(t);c(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){c(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function f(e,t){return[{key:`r${e.round}-pre-${t.id}`,label:`Pre-export`,token:t.preExportTokenFull,preview:t.preExportToken,expires:t.preExportExpires},{key:`r${e.round}-exp-${t.id}`,label:`Exported`,token:t.exportedTokenFull,preview:t.exportedToken,expires:t.exportedExpires},{key:`r${e.round}-post-${t.id}`,label:`Post-export`,token:t.postExportTokenFull,preview:t.postExportToken,expires:t.postExportExpires}]}function p(){for(let e of t)for(let t of e.items)for(let n of f(e,t))n.token&&d(n.key,n.token)}return(0,q.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every run appends a round. Earlier rounds are kept so tokens can be compared across runs.`}),l.length===0?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(M,{id:`sim-include-refresh`,checked:a,onCheckedChange:o,className:`cursor-pointer`}),(0,q.jsx)(j,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,q.jsx)(b,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void u(),children:r?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:p,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,q.jsx)($,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,q.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,q.jsx)($,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),f(e,t).map(e=>{let t=s.get(e.key);return(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,q.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,q.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Re(e.expires)}),e.token?(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void d(e.key,e.token),children:t?.loading?(0,q.jsx)(m,{className:`size-3 animate-spin`}):`Test`}):(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,q.jsx)(`span`,{className:`text-[10px] font-medium shrink-0 ${t.status?.startsWith(`valid`)?`text-success`:`text-error`}`,children:t.status})]},e.key)})]},`r${e.round}-${t.id}`))]},e.round))]})]})}function Be(e){let t=Math.floor(Date.now()/1e3),n=Math.floor(Math.abs(e-t)/60);return e>t?`${n}m left`:`expired ${n}m ago`}function Ve({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,K.useState)(new Map),[o,s]=(0,K.useState)(!1);async function c(e){a(t=>new Map(t).set(e,{loading:!0}));try{let t=await ne(e,o);a(n=>new Map(n).set(e,{loading:!1,result:t}))}catch(t){a(n=>new Map(n).set(e,{loading:!1,error:t.message}))}}function l(){for(let e of n.filter(e=>e.expiresAt!==null))c(e.id)}return(0,q.jsx)(E,{open:e,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,q.jsx)(T,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,q.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,q.jsxs)(`section`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(M,{id:`token-test-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,q.jsx)(j,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:l,children:`Test all`})]})]}),n.length===0&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,q.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,q.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:Be(e.expiresAt)})]}),(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void c(e.id),children:t?.loading?(0,q.jsx)(m,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,q.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,q.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,q.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,q.jsx)(ze,{accounts:n})]}),(0,q.jsx)(S,{children:(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function He(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:o,flashIds:s,reload:d}=he(),[p,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(null),[x,S]=(0,K.useState)(null),[C,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(null),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(void 0);function j(e){d(),e&&h(e)}async function M(e,t){_(e);try{await R(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){h(e.message)}_(null),d()}async function N(){if(v){try{await se(v.id),h(`Account "${v.display}" removed.`),d()}catch(e){h(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){x&&(await R(x.id,{label:e}),S(null),h(`Account renamed to "${e}".`),d())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(V,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void d(),refreshing:o,disabled:i,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),O(`add`)},children:[(0,q.jsx)(l,{className:`size-4`}),` Add account`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{E(null),O(`export`)},children:[(0,q.jsx)(u,{className:`size-4`}),` Export`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`import`),children:[(0,q.jsx)(c,{className:`size-4`}),` Import`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`rotation`),children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`token-test`),children:[(0,q.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,q.jsx)(B,{message:p,onDismiss:()=>h(null)}),(0,q.jsxs)(`section`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,fe(new Date(I).getTime())]})]}),i?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,q.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,q.jsx)(H,{children:e.map(e=>(0,q.jsx)(xe,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:g===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>S({id:e,current:t}),onExport:e=>{E(e),O(`export`)},onViewProfile:(e,t)=>w({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),O(`add`)},flash:s.has(e.accountId)},e.accountId))})]}),C&&(0,q.jsx)(De,{profile:C.profile,accountId:C.accountId,onClose:()=>w(null)}),v&&(0,q.jsx)(Oe,{display:v.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),x&&(0,q.jsx)(Ae,{current:x.current,onSave:P,onCancel:()=>S(null)}),(0,q.jsx)(pe,{open:D===`add`,onOpenChange:e=>{O(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:k}),(0,q.jsx)(Me,{open:D===`export`,onOpenChange:e=>{O(e?`export`:null),e||E(null)},accounts:t,preselectId:T,onMessage:h}),(0,q.jsx)(Ne,{open:D===`import`,onOpenChange:e=>O(e?`import`:null),onSuccess:j}),(0,q.jsx)(Ie,{open:D===`rotation`,onOpenChange:e=>O(e?`rotation`:null)}),(0,q.jsx)(Ve,{open:D===`token-test`,onOpenChange:e=>O(e?`token-test`:null),accounts:t})]})}function Ue({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:a,onExport:o,onImport:s,error:l}){let d=(0,K.useRef)(null),f=e===`export`;return(0,q.jsx)(E,{open:e!==null,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(i,{className:`size-4`}),` `,f?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,q.jsx)(T,{className:`text-xs leading-relaxed`,children:f?`Writes a password-encrypted file containing each account's login.`:`Reads a backup file. The password must be the one it was exported with.`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(j,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,q.jsx)(O,{id:`codex-backup-password`,type:`password`,placeholder:f?`Choose a password`:`Password used for the export`,value:n,onChange:e=>r(e.target.value),className:`text-xs`,autoComplete:f?`new-password`:`current-password`}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,q.jsx)(`input`,{ref:d,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,q.jsxs)(S,{children:[(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,q.jsxs)(b,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||a,onClick:()=>f?o():d.current?.click(),children:[a?(0,q.jsx)(m,{className:`size-3.5 animate-spin`}):f?(0,q.jsx)(u,{className:`size-3.5`}):(0,q.jsx)(c,{className:`size-3.5`}),f?`Download backup`:`Choose file`]})]})]})})}var We=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function Ge({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,q.jsx)(E,{open:e,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsx)(w,{className:`text-sm`,children:`Codex Rotation`}),(0,q.jsx)(T,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,q.jsx)(`div`,{className:`space-y-2`,children:We.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:g(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,q.jsx)(S,{children:(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function Ke(e){return e==null?null:Math.round(e*100)}function qe({usage:e}){let t=e.session==null&&e.weekly==null;return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,q.jsx)(G,{label:`5-Hour Session`,pct:Ke(e.fiveHour),reset:W(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,q.jsx)(G,{label:`Weekly`,pct:Ke(e.sevenDay),reset:W(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function Je(){let[e,t]=(0,K.useState)(null),n=de(()=>t(null)),[r,i]=(0,K.useState)(null);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(V,{description:(0,q.jsxs)(q.Fragment,{children:[`Each Codex account keeps its own login (`,(0,q.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,q.jsx)(l,{className:`size-4`}),` Add account`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,q.jsx)(u,{className:`size-4`}),` Export`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,q.jsx)(c,{className:`size-4`}),` Import`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation`]})]})}),(0,q.jsx)(B,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,q.jsxs)(`section`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,q.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,q.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,q.jsx)(H,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,q.jsxs)(ge,{dense:!0,className:`min-w-[300px] shrink-0 snap-start${e.signedOut?` opacity-60`:``}`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,q.jsx)(ue,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`Codex rejected this account's login (revoked or expired), so no turn can run on it and it is skipped. The usage shown is the last reading. Click to sign in again — the account keeps its settings and chats.`,onClick:e.type===`chatgpt`?()=>i(e):void 0,children:`Sign in again`}),(0,q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),U(e.planType)&&(0,q.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:U(e.planType)}),(0,q.jsx)(M,{checked:e.status!==`disabled`,onCheckedChange:()=>void n.toggle(e.id,e.status??`active`),disabled:n.toggling.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),(0,q.jsxs)(F,{children:[(0,q.jsx)(L,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,onClick:()=>void n.remove(e.id),"aria-label":`Remove account`,className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,q.jsx)(s,{className:`size-4`})})}),(0,q.jsx)(N,{side:`top`,children:`Remove account`})]})]}),(0,q.jsx)(qe,{usage:t}),t.resetCredits&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,q.jsx)(me,{credits:t.resetCredits}),(0,q.jsx)(be,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=ve(t.weekly);return r?(0,q.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${e.dailyGuardEnabled&&r.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,q.jsx)(`span`,{children:`Daily guard`}),(0,q.jsxs)(F,{children:[(0,q.jsx)(L,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,q.jsx)(o,{className:`size-3.5`})})}),(0,q.jsx)(N,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays. Turn it off any time to use the remaining quota freely.`})]})]}),(0,q.jsx)(`p`,{className:`text-[10px] tabular-nums ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-subtle`}`,children:e.dailyGuardEnabled&&r.blocked?`${Math.round(r.used*100)}% used / ${Math.round(r.cap*100)}% daily cap. New turns paused.`:`Weekday ${r.day}/5, ${Math.round(r.cap*100)}% daily cap`})]}),(0,q.jsxs)(`span`,{className:`hidden`,title:`Weekday ${r.day}/5: hold weekly usage at or below ${Math.round(r.cap*100)}% to last until reset.`,children:[`Daily guard `,e.dailyGuardEnabled?`· Weekday ${r.day}/5 cap ${Math.round(r.cap*100)}%`:``]}),(0,q.jsx)(M,{checked:!!e.dailyGuardEnabled,onCheckedChange:()=>void n.toggleDailyGuard(e.id,!!e.dailyGuardEnabled),disabled:n.toggling.has(e.id),"aria-label":e.dailyGuardEnabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}):null})()]},e.id)})})]}),(0,q.jsx)(ye,{open:e===`add`,onOpenChange:e=>{e||n.cancelLogin(),t(e?`add`:null)},label:n.label,onLabelChange:n.setLabel,apiKey:n.apiKey,onApiKeyChange:n.setApiKey,adding:n.adding,onAddApiKey:()=>void n.addApiKey(),deviceWaiting:n.deviceWaiting,onStartDevice:()=>void n.startDevice(),device:n.device,browser:n.browser,onStartBrowser:()=>void n.startBrowser(),loginStarting:n.loginStarting,callbackUrl:n.callbackUrl,onCallbackUrlChange:n.setCallbackUrl,submittingCallback:n.submittingCallback,onSubmitCallback:()=>void n.submitCallback(),error:n.err}),(0,q.jsx)(Ue,{mode:e===`export`?`export`:e===`import`?`import`:null,onOpenChange:e=>{e||t(null)},password:n.backupPassword,onPasswordChange:n.setBackupPassword,busy:n.exporting||n.importing,onExport:()=>void n.doExport(),onImport:e=>void n.doImport(e),error:n.err}),r&&(0,q.jsx)(_e,{account:r,onClose:()=>i(null),onDone:()=>void n.load()}),(0,q.jsx)(Ge,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var Ye=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}];function Xe(){let[e,t]=(0,K.useState)(null),[n,r]=(0,K.useState)(`claude`);(0,K.useEffect)(()=>{let e=!1;return re().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let i=Ye.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,q.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,q.jsxs)(`button`,{onClick:()=>r(e.id),"data-testid":`accounts-tab-${e.id}`,"aria-current":n===e.id?`page`:void 0,className:`flex items-center gap-1.5 px-3 py-2 text-xs rounded-t transition-colors cursor-pointer ${n===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,q.jsx)(k,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,q.jsx)(He,{}):(0,q.jsx)(Je,{})]})}export{Xe as AccountsSettingsSection};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{At as r,Cn as i,Cr as a,J as o,Kr as s,Zr as c,cr as l,ht as u,li as d,ln as f,ut as p,xn as m}from"./icons-C1wDt09O.js";import{a as h}from"./api-client-BnYFnEfK.js";import{n as g}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./chat-preparation-cache-Bzb-T1pm.js";import{n as _}from"./use-is-mobile-CL2I7hLf.js";import{r as v}from"./clipboard-D3XnL7CB.js";import{r as y,t as b}from"./button-BHGVTbam.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./dialog-DnE192fh.js";import{t as D}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{t as O}from"./input-CReAuQTF.js";import{Ii as k,Jn as A,Mr as j,Qn as M,Xi as N,Xn as P,Yi as F,Yn as I,Zi as L,Zn as ee,qn as te}from"./index-hEtw8BzE.js";import{_ as ne,a as re,h as R,m as ie,o as ae,p as oe,r as se,v as ce,x as z,y as le}from"./api-settings-BPIlTiBi.js";import{_ as ue,a as de,b as fe,c as pe,d as me,g as B,h as V,l as he,m as ge,n as _e,o as ve,p as H,r as ye,s as U,t as be,u as xe,x as W,y as G}from"./codex-reset-credit-button-XC0rCF5U.js";var K=e(t(),1),q=n(),J=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Y=Array.from({length:24},(e,t)=>t);function Se(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function Ce(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function we(e){return Y.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function X(e){return e===0?`bg-surface-elevated`:e<.3?`bg-success/30`:e<.5?`bg-success/60`:e<.7?`bg-warning/50`:e<.9?`bg-warning/80`:`bg-error/80`}function Te(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function Ee({accountId:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(!0),[a,o]=(0,K.useState)(`5h`);(0,K.useEffect)(()=>{i(!0),oe(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,K.useMemo)(()=>t?Se(t,a):null,[t,a]),c=(0,K.useMemo)(()=>s?Ce(s):[],[s]),l=(0,K.useMemo)(()=>s?we(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,q.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,q.jsx)(m,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,q.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let d=t.length,f=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,q.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,q.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,q.jsx)(`button`,{onClick:()=>o(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,q.jsx)(`button`,{onClick:()=>o(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,q.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,f,`d (`,d,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,q.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:J.map((e,t)=>{let n=c[t]??0;return(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,q.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,q.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Te(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,q.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,q.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:Y.map(e=>{let t=l[e]??0;return(0,q.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,q.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${X(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[J.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,q.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),Y.map(n=>{let r=s[t][n];return(0,q.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${X(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,q.jsx)(`span`,{className:`w-4 shrink-0`}),Y.map(e=>(0,q.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,q.jsx)(`span`,{children:`Low`}),(0,q.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,q.jsx)(`span`,{children:`High`}),(0,q.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,q.jsx)(`span`,{children:`No data`})]})]})}function De({profile:e,accountId:t,onClose:n}){let r=[[`Name`,e.account?.display_name],[`Email`,e.account?.email],[`Org`,e.organization?.name],[`Type`,e.organization?.organization_type],[`Tier`,e.organization?.rate_limit_tier],[`Status`,e.organization?.subscription_status]];return(0,q.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,q.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,q.jsx)(d,{className:`size-4`})})]}),(0,q.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,q.jsxs)(`span`,{className:`contents`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,q.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,q.jsx)(Ee,{accountId:t})]})}function Oe({display:e,onConfirm:t,onCancel:n}){let r=_(),i=(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,q.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,q.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,q.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`The stored token is deleted from this machine. Any export you already made keeps working.`}),(0,q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,q.jsx)(b,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,q.jsx)(b,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,q.jsx)(D,{open:!0,onClose:n,children:(0,q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,q.jsx)(E,{open:!0,onOpenChange:e=>{e||n()},children:(0,q.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,q.jsx)(x,{children:(0,q.jsx)(w,{className:`text-sm`,children:`Remove account`})}),i]})})}var ke=80;function Ae({current:e,onSave:t,onCancel:n}){let r=_(),[i,a]=(0,K.useState)(e),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(null),u=i.trim(),d=!!u&&u!==e&&!o,f=async()=>{if(d){s(!0),l(null);try{await t(u)}catch(e){l(e.message||`Could not rename the account`),s(!1)}}},p=()=>{o||n()},h=(0,q.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,q.jsx)(O,{autoFocus:!0,value:i,maxLength:ke,onChange:e=>a(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),c&&(0,q.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:c}),(0,q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,q.jsx)(b,{type:`button`,variant:`outline`,onClick:p,disabled:o,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,q.jsxs)(b,{type:`submit`,disabled:!d,className:`min-h-11 md:min-h-9`,children:[o&&(0,q.jsx)(m,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,q.jsx)(D,{open:!0,onClose:p,children:(0,q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),h]})}):(0,q.jsx)(E,{open:!0,onOpenChange:e=>{e||p()},children:(0,q.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,q.jsx)(x,{children:(0,q.jsx)(w,{className:`text-sm`,children:`Rename account`})}),h]})})}function je(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function Me({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:a}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,K.useState)(new Set),[l,d]=(0,K.useState)(``),[f,g]=(0,K.useState)(!1),[_,y]=(0,K.useState)(!1),[D,k]=(0,K.useState)(!1),[A,M]=(0,K.useState)(!1);e&&!A&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),M(!0)),!e&&A&&M(!1);function N(){t(!1),d(``),g(!1),y(!1)}async function P(e){if(s.size===0)return;k(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=h();r&&(n.Authorization=`Bearer ${r}`);let i=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:f,refreshBeforeExport:_})});if(!i.ok){let e=await i.json();throw Error(e.error??`Export failed: ${i.status}`)}let o=await i.text();e&&await v(o)?a?.(`Backup copied to clipboard!`):(je(o),a?.(`Backup downloaded.`)),N()}catch{}k(!1)}let F=s.size>0&&!D;return(0,q.jsx)(E,{open:e,onOpenChange:e=>{e||N()},children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(i,{className:`size-3.5`}),` Export Accounts`]}),(0,q.jsx)(T,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,q.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===o.length?new Set:new Set(o.map(e=>e.id))),children:s.size===o.length?`Deselect all`:`Select all`})]}),o.length===0?(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,q.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:s.has(e.id),onChange:t=>{let n=new Set(s);t.target.checked?n.add(e.id):n.delete(e.id),c(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,q.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(j,{className:`text-xs`,children:[`Password `,(0,q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,q.jsx)(O,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>d(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>g(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,q.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:_,onChange:e=>y(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,q.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,q.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,q.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):_?(0,q.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,q.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,q.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,q.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,q.jsxs)(S,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:N,children:`Cancel`}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!0),children:[(0,q.jsx)(p,{className:`size-3 mr-1`}),` Copy`]}),(0,q.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!1),children:D?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Ne({open:e,onOpenChange:t,onSuccess:n}){let[r,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(``),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null);function f(){t(!1),a(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await ie({data:r.trim(),password:o.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,q.jsx)(E,{open:e,onOpenChange:e=>{e||f()},children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(i,{className:`size-3.5`}),` Import Accounts`]}),(0,q.jsx)(T,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(j,{className:`text-xs`,children:`Backup data`}),(0,q.jsx)(`textarea`,{value:r,onChange:e=>a(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(j,{className:`text-xs`,children:[`Password `,(0,q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,q.jsx)(O,{type:`password`,placeholder:`Leave empty for default`,value:o,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,q.jsxs)(S,{children:[(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,q.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var Z=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Pe(e){return Z?.addEventListener(`change`,e),()=>Z?.removeEventListener(`change`,e)}function Fe(){return Z?.matches??!0}function Q(){let[e,t]=(0,K.useState)(null),[n,r]=(0,K.useState)(!0);return(0,K.useEffect)(()=>{r(!0),ae().then(t).finally(()=>r(!1))},[]),n?(0,q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,q.jsxs)(te,{value:e.strategy,onValueChange:async e=>{t(await z({strategy:e}))},children:[(0,q.jsx)(P,{className:`w-full h-9 text-xs`,children:(0,q.jsx)(ee,{})}),(0,q.jsxs)(A,{children:[(0,q.jsx)(I,{value:`round-robin`,children:`Round-robin`}),(0,q.jsx)(I,{value:`fill-first`,children:`Fill-first`}),(0,q.jsx)(I,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,q.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,q.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await z({maxRetry:n}))}}),(0,q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,q.jsx)(M,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await z({cooldownEnabled:e}))}})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Park a failing account (rate limit / usage limit / auth error) until it recovers. Off: accounts stay selectable — rotation still skips accounts already ≥95% on the 5-hour limit.`})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,q.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,q.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function Ie({open:e,onOpenChange:t}){let n=(0,K.useSyncExternalStore)(Pe,Fe);return e?n?(0,q.jsx)(E,{open:e,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,q.jsx)(x,{children:(0,q.jsxs)(w,{className:`text-sm flex items-center gap-2`,children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation & Retry`]})}),(0,q.jsx)(Q,{})]})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,q.jsxs)(`div`,{className:g(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,q.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,q.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,q.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation & Retry`]}),(0,q.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,q.jsx)(d,{className:`size-4`})})]}),(0,q.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,q.jsx)(Q,{})})]})]}):null}var Le=y(`inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground shadow`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground shadow`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function $({className:e,variant:t,...n}){return(0,q.jsx)(`div`,{className:g(Le({variant:t}),e),...n})}function Re(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function ze({accounts:e}){let[t,n]=(0,K.useState)([]),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(new Map),l=e.filter(e=>e.hasRefreshToken);async function u(){if(l.length!==0){i(!0);try{let e=await ce(l.map(e=>e.id),a);n(t=>[...t,{round:t.length+1,time:new Date().toLocaleTimeString(),includeRefresh:a,items:e}])}catch{}i(!1)}}async function d(e,t){c(t=>new Map(t).set(e,{loading:!0}));try{let n=await le(t);c(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){c(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function f(e,t){return[{key:`r${e.round}-pre-${t.id}`,label:`Pre-export`,token:t.preExportTokenFull,preview:t.preExportToken,expires:t.preExportExpires},{key:`r${e.round}-exp-${t.id}`,label:`Exported`,token:t.exportedTokenFull,preview:t.exportedToken,expires:t.exportedExpires},{key:`r${e.round}-post-${t.id}`,label:`Post-export`,token:t.postExportTokenFull,preview:t.postExportToken,expires:t.postExportExpires}]}function p(){for(let e of t)for(let t of e.items)for(let n of f(e,t))n.token&&d(n.key,n.token)}return(0,q.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every run appends a round. Earlier rounds are kept so tokens can be compared across runs.`}),l.length===0?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(M,{id:`sim-include-refresh`,checked:a,onCheckedChange:o,className:`cursor-pointer`}),(0,q.jsx)(j,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,q.jsx)(b,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void u(),children:r?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:p,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,q.jsx)($,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,q.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,q.jsx)($,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),f(e,t).map(e=>{let t=s.get(e.key);return(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,q.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,q.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Re(e.expires)}),e.token?(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void d(e.key,e.token),children:t?.loading?(0,q.jsx)(m,{className:`size-3 animate-spin`}):`Test`}):(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,q.jsx)(`span`,{className:`text-[10px] font-medium shrink-0 ${t.status?.startsWith(`valid`)?`text-success`:`text-error`}`,children:t.status})]},e.key)})]},`r${e.round}-${t.id}`))]},e.round))]})]})}function Be(e){let t=Math.floor(Date.now()/1e3),n=Math.floor(Math.abs(e-t)/60);return e>t?`${n}m left`:`expired ${n}m ago`}function Ve({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,K.useState)(new Map),[o,s]=(0,K.useState)(!1);async function c(e){a(t=>new Map(t).set(e,{loading:!0}));try{let t=await ne(e,o);a(n=>new Map(n).set(e,{loading:!1,result:t}))}catch(t){a(n=>new Map(n).set(e,{loading:!1,error:t.message}))}}function l(){for(let e of n.filter(e=>e.expiresAt!==null))c(e.id)}return(0,q.jsx)(E,{open:e,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,q.jsx)(T,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,q.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,q.jsxs)(`section`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(M,{id:`token-test-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,q.jsx)(j,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:l,children:`Test all`})]})]}),n.length===0&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,q.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,q.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:Be(e.expiresAt)})]}),(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void c(e.id),children:t?.loading?(0,q.jsx)(m,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,q.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,q.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,q.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,q.jsx)(ze,{accounts:n})]}),(0,q.jsx)(S,{children:(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function He(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:o,flashIds:s,reload:d}=he(),[p,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(null),[x,S]=(0,K.useState)(null),[C,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(null),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(void 0);function j(e){d(),e&&h(e)}async function M(e,t){_(e);try{await R(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){h(e.message)}_(null),d()}async function N(){if(v){try{await se(v.id),h(`Account "${v.display}" removed.`),d()}catch(e){h(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){x&&(await R(x.id,{label:e}),S(null),h(`Account renamed to "${e}".`),d())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(V,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void d(),refreshing:o,disabled:i,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),O(`add`)},children:[(0,q.jsx)(l,{className:`size-4`}),` Add account`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{E(null),O(`export`)},children:[(0,q.jsx)(u,{className:`size-4`}),` Export`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`import`),children:[(0,q.jsx)(c,{className:`size-4`}),` Import`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`rotation`),children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`token-test`),children:[(0,q.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,q.jsx)(B,{message:p,onDismiss:()=>h(null)}),(0,q.jsxs)(`section`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,fe(new Date(I).getTime())]})]}),i?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,q.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,q.jsx)(H,{children:e.map(e=>(0,q.jsx)(xe,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:g===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>S({id:e,current:t}),onExport:e=>{E(e),O(`export`)},onViewProfile:(e,t)=>w({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),O(`add`)},flash:s.has(e.accountId)},e.accountId))})]}),C&&(0,q.jsx)(De,{profile:C.profile,accountId:C.accountId,onClose:()=>w(null)}),v&&(0,q.jsx)(Oe,{display:v.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),x&&(0,q.jsx)(Ae,{current:x.current,onSave:P,onCancel:()=>S(null)}),(0,q.jsx)(pe,{open:D===`add`,onOpenChange:e=>{O(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:k}),(0,q.jsx)(Me,{open:D===`export`,onOpenChange:e=>{O(e?`export`:null),e||E(null)},accounts:t,preselectId:T,onMessage:h}),(0,q.jsx)(Ne,{open:D===`import`,onOpenChange:e=>O(e?`import`:null),onSuccess:j}),(0,q.jsx)(Ie,{open:D===`rotation`,onOpenChange:e=>O(e?`rotation`:null)}),(0,q.jsx)(Ve,{open:D===`token-test`,onOpenChange:e=>O(e?`token-test`:null),accounts:t})]})}function Ue({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:a,onExport:o,onImport:s,error:l}){let d=(0,K.useRef)(null),f=e===`export`;return(0,q.jsx)(E,{open:e!==null,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,q.jsx)(i,{className:`size-4`}),` `,f?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,q.jsx)(T,{className:`text-xs leading-relaxed`,children:f?`Writes a password-encrypted file containing each account's login.`:`Reads a backup file. The password must be the one it was exported with.`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(j,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,q.jsx)(O,{id:`codex-backup-password`,type:`password`,placeholder:f?`Choose a password`:`Password used for the export`,value:n,onChange:e=>r(e.target.value),className:`text-xs`,autoComplete:f?`new-password`:`current-password`}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,q.jsx)(`input`,{ref:d,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,q.jsxs)(S,{children:[(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,q.jsxs)(b,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||a,onClick:()=>f?o():d.current?.click(),children:[a?(0,q.jsx)(m,{className:`size-3.5 animate-spin`}):f?(0,q.jsx)(u,{className:`size-3.5`}):(0,q.jsx)(c,{className:`size-3.5`}),f?`Download backup`:`Choose file`]})]})]})})}var We=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function Ge({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,q.jsx)(E,{open:e,onOpenChange:t,children:(0,q.jsxs)(C,{className:`sm:max-w-md`,children:[(0,q.jsxs)(x,{children:[(0,q.jsx)(w,{className:`text-sm`,children:`Codex Rotation`}),(0,q.jsx)(T,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,q.jsx)(`div`,{className:`space-y-2`,children:We.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:g(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,q.jsx)(S,{children:(0,q.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function Ke(e){return e==null?null:Math.round(e*100)}function qe({usage:e}){let t=e.session==null&&e.weekly==null;return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,q.jsx)(G,{label:`5-Hour Session`,pct:Ke(e.fiveHour),reset:W(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,q.jsx)(G,{label:`Weekly`,pct:Ke(e.sevenDay),reset:W(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function Je(){let[e,t]=(0,K.useState)(null),n=de(()=>t(null)),[r,i]=(0,K.useState)(null);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(V,{description:(0,q.jsxs)(q.Fragment,{children:[`Each Codex account keeps its own login (`,(0,q.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,q.jsx)(l,{className:`size-4`}),` Add account`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,q.jsx)(u,{className:`size-4`}),` Export`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,q.jsx)(c,{className:`size-4`}),` Import`]}),(0,q.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,q.jsx)(a,{className:`size-4`}),` Rotation`]})]})}),(0,q.jsx)(B,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,q.jsxs)(`section`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,q.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,q.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,q.jsx)(H,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,q.jsxs)(ge,{dense:!0,className:`min-w-[300px] shrink-0 snap-start${e.signedOut?` opacity-60`:``}`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,q.jsx)(ue,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`Codex rejected this account's login (revoked or expired), so no turn can run on it and it is skipped. The usage shown is the last reading. Click to sign in again — the account keeps its settings and chats.`,onClick:e.type===`chatgpt`?()=>i(e):void 0,children:`Sign in again`}),(0,q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),U(e.planType)&&(0,q.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:U(e.planType)}),(0,q.jsx)(M,{checked:e.status!==`disabled`,onCheckedChange:()=>void n.toggle(e.id,e.status??`active`),disabled:n.toggling.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),(0,q.jsxs)(F,{children:[(0,q.jsx)(L,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,onClick:()=>void n.remove(e.id),"aria-label":`Remove account`,className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,q.jsx)(s,{className:`size-4`})})}),(0,q.jsx)(N,{side:`top`,children:`Remove account`})]})]}),(0,q.jsx)(qe,{usage:t}),t.resetCredits&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,q.jsx)(me,{credits:t.resetCredits}),(0,q.jsx)(be,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=ve(t.weekly);return r?(0,q.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${e.dailyGuardEnabled&&r.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,q.jsx)(`span`,{children:`Daily guard`}),(0,q.jsxs)(F,{children:[(0,q.jsx)(L,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,q.jsx)(o,{className:`size-3.5`})})}),(0,q.jsx)(N,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays. Turn it off any time to use the remaining quota freely.`})]})]}),(0,q.jsx)(`p`,{className:`text-[10px] tabular-nums ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-subtle`}`,children:e.dailyGuardEnabled&&r.blocked?`${Math.round(r.used*100)}% used / ${Math.round(r.cap*100)}% daily cap. New turns paused.`:`Weekday ${r.day}/5, ${Math.round(r.cap*100)}% daily cap`})]}),(0,q.jsxs)(`span`,{className:`hidden`,title:`Weekday ${r.day}/5: hold weekly usage at or below ${Math.round(r.cap*100)}% to last until reset.`,children:[`Daily guard `,e.dailyGuardEnabled?`· Weekday ${r.day}/5 cap ${Math.round(r.cap*100)}%`:``]}),(0,q.jsx)(M,{checked:!!e.dailyGuardEnabled,onCheckedChange:()=>void n.toggleDailyGuard(e.id,!!e.dailyGuardEnabled),disabled:n.toggling.has(e.id),"aria-label":e.dailyGuardEnabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}):null})()]},e.id)})})]}),(0,q.jsx)(ye,{open:e===`add`,onOpenChange:e=>{e||n.cancelLogin(),t(e?`add`:null)},label:n.label,onLabelChange:n.setLabel,apiKey:n.apiKey,onApiKeyChange:n.setApiKey,adding:n.adding,onAddApiKey:()=>void n.addApiKey(),deviceWaiting:n.deviceWaiting,onStartDevice:()=>void n.startDevice(),device:n.device,browser:n.browser,onStartBrowser:()=>void n.startBrowser(),loginStarting:n.loginStarting,callbackUrl:n.callbackUrl,onCallbackUrlChange:n.setCallbackUrl,submittingCallback:n.submittingCallback,onSubmitCallback:()=>void n.submitCallback(),error:n.err}),(0,q.jsx)(Ue,{mode:e===`export`?`export`:e===`import`?`import`:null,onOpenChange:e=>{e||t(null)},password:n.backupPassword,onPasswordChange:n.setBackupPassword,busy:n.exporting||n.importing,onExport:()=>void n.doExport(),onImport:e=>void n.doImport(e),error:n.err}),r&&(0,q.jsx)(_e,{account:r,onClose:()=>i(null),onDone:()=>void n.load()}),(0,q.jsx)(Ge,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var Ye=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}];function Xe(){let[e,t]=(0,K.useState)(null),[n,r]=(0,K.useState)(`claude`);(0,K.useEffect)(()=>{let e=!1;return re().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let i=Ye.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,q.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,q.jsxs)(`button`,{onClick:()=>r(e.id),"data-testid":`accounts-tab-${e.id}`,"aria-current":n===e.id?`page`:void 0,className:`flex items-center gap-1.5 px-3 py-2 text-xs rounded-t transition-colors cursor-pointer ${n===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,q.jsx)(k,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,q.jsx)(He,{}):(0,q.jsx)(Je,{})]})}export{Xe as AccountsSettingsSection};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-HEdIT_LQ.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-Vd9Xr54k.js","assets/preload-helper-Bf_JiD2A.js","assets/vendor-ui-BTSIXzhZ.js","assets/vendor-markdown-C-P1aR4p.js","assets/button-BHGVTbam.js","assets/utils-D3xTlJyU.js","assets/createLucideIcon-B2pji242.js","assets/file-diff-CScJM-VZ.js","assets/git-commit-horizontal-ZMFP54eB.js","assets/api-client-BnYFnEfK.js","assets/react-B9hau9ra.js","assets/open-db-tabs-DBgV2hbA.js","assets/window-store-D6EgLSfT.js","assets/minimal-mode-rLZOjciW.js","assets/panel-store-H7e9XHZF.js","assets/settings-store-CMpVMq3Y.js","assets/session-list-sync-triggers-D9i1FxWd.js","assets/project-store-Bs-kiU8m.js","assets/project-framework-store-nuePqBBa.js","assets/explorer-model-f5q-50DN.js","assets/db-sidebar-reveal-CGqWBYay.js","assets/use-is-mobile-CL2I7hLf.js","assets/db-types-cHkNH-mN.js","assets/tab-store-NUmgzMPf.js","assets/use-db-driver-installed-BL1XW_bI.js","assets/impexp-state-Cx2Az9iZ.js","assets/file-store-Bn0vbkCx.js","assets/sql-identifiers-7jHNEORb.js","assets/db-explorer-store-DJNNIfN5.js","assets/onboarding-quick-orientation-DTMrcMf0.js","assets/dialog-DnE192fh.js","assets/portal-container-context-Gepuvxdg.js","assets/icons-C1wDt09O.js","assets/format-file-meta-BOAh9mam.js","assets/fs-api-BVIVh_De.js","assets/open-settings-DWbF5YsE.js","assets/settings-categories-BY9n3BRr.js","assets/adaptive-context-menu-CxHkI7dL.js","assets/context-menu-DhKbkI1X.js","assets/mobile-bottom-sheet-M9pZptfh.js","assets/use-visual-viewport-B_GFo6k2.js","assets/dropdown-menu-CxZR_vuV.js","assets/input-CReAuQTF.js","assets/scroll-area-CSmNLlfl.js","assets/start-ellipsis-DfU-W_6j.js","assets/chat-preparation-cache-Bzb-T1pm.js","assets/clipboard-D3XnL7CB.js","assets/file-icons-CB0RsVdl.js","assets/format-date-SZ6qU2sD.js","assets/git-repo-store-CESIqItW.js","assets/patch-tab-metadata-DqvfqUI4.js","assets/ws-auth-k7DWnL9T.js","assets/apply-theme-Kiqxd1NZ.js","assets/resolve-theme-DGQXDIbF.js","assets/index-Cb3Z6wNy.css","assets/libesm-C9iw2_pm.js","assets/tool-cards-7E0jtwP0.js","assets/db-ai-tools-BhRcsCRL.js","assets/split-sql-statements-Bujv4uO8.js","assets/agent-session-sheet-store-BFUVxjab.js","assets/image-preview-geometry-BX1a3Lfa.js","assets/use-blob-url-CIHAdKoN.js","assets/html-preview-loads-xkLR1cU9.js","assets/image-gallery-DuV1wTMD.js","assets/design-canvas-check-DQB9dn_O.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{li as r}from"./icons-C1wDt09O.js";import{t as i}from"./preload-helper-Bf_JiD2A.js";import"./portal-container-context-Gepuvxdg.js";import{t as a}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{t as o}from"./agent-session-sheet-store-BFUVxjab.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-HEdIT_LQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66])));function u(){let e=o(e=>e.payload),t=o(e=>e.close);return e?(0,c.jsxs)(a,{open:!0,onClose:t,zIndex:45,className:`flex h-[var(--sheet-vh)] flex-col p-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,c.jsx)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:e.title??`Agent session`}),(0,c.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto flex size-11 items-center justify-center rounded text-text-secondary hover:text-text-primary`,"aria-label":`Close`,children:(0,c.jsx)(r,{className:`size-5`})})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`Loading…`}),children:(0,c.jsx)(l,{id:`sheet-${e.sessionId}`,payload:e})})})]}):null}export{u as AgentSessionSheet};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-Db1N_iji.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-hEtw8BzE.js","assets/preload-helper-Bf_JiD2A.js","assets/vendor-ui-BTSIXzhZ.js","assets/vendor-markdown-C-P1aR4p.js","assets/button-BHGVTbam.js","assets/utils-D3xTlJyU.js","assets/createLucideIcon-B2pji242.js","assets/file-diff-CScJM-VZ.js","assets/git-commit-horizontal-ZMFP54eB.js","assets/api-client-BnYFnEfK.js","assets/react-B9hau9ra.js","assets/open-db-tabs-DBgV2hbA.js","assets/window-store-D6EgLSfT.js","assets/minimal-mode-rLZOjciW.js","assets/panel-store-H7e9XHZF.js","assets/settings-store-CMpVMq3Y.js","assets/session-list-sync-triggers-D9i1FxWd.js","assets/project-store-Bs-kiU8m.js","assets/project-framework-store-nuePqBBa.js","assets/explorer-model-f5q-50DN.js","assets/db-sidebar-reveal-CGqWBYay.js","assets/use-is-mobile-CL2I7hLf.js","assets/db-types-cHkNH-mN.js","assets/tab-store-NUmgzMPf.js","assets/use-db-driver-installed-BL1XW_bI.js","assets/impexp-state-Cx2Az9iZ.js","assets/file-store-Bn0vbkCx.js","assets/sql-identifiers-7jHNEORb.js","assets/db-explorer-store-DJNNIfN5.js","assets/onboarding-quick-orientation-DTMrcMf0.js","assets/dialog-DnE192fh.js","assets/portal-container-context-Gepuvxdg.js","assets/icons-C1wDt09O.js","assets/format-file-meta-BOAh9mam.js","assets/fs-api-BVIVh_De.js","assets/open-settings-DWbF5YsE.js","assets/settings-categories-BY9n3BRr.js","assets/adaptive-context-menu-CxHkI7dL.js","assets/context-menu-DhKbkI1X.js","assets/mobile-bottom-sheet-M9pZptfh.js","assets/use-visual-viewport-B_GFo6k2.js","assets/dropdown-menu-CxZR_vuV.js","assets/input-CReAuQTF.js","assets/scroll-area-CSmNLlfl.js","assets/start-ellipsis-DfU-W_6j.js","assets/chat-preparation-cache-Bzb-T1pm.js","assets/clipboard-D3XnL7CB.js","assets/file-icons-CB0RsVdl.js","assets/format-date-SZ6qU2sD.js","assets/git-repo-store-CESIqItW.js","assets/patch-tab-metadata-DqvfqUI4.js","assets/ws-auth-k7DWnL9T.js","assets/apply-theme-Kiqxd1NZ.js","assets/resolve-theme-DGQXDIbF.js","assets/index-Cb3Z6wNy.css","assets/libesm-C9iw2_pm.js","assets/tool-cards-72GKNSD3.js","assets/db-ai-tools-BhRcsCRL.js","assets/split-sql-statements-Bujv4uO8.js","assets/agent-session-sheet-store-BFUVxjab.js","assets/image-preview-geometry-BX1a3Lfa.js","assets/use-blob-url-CIHAdKoN.js","assets/html-preview-loads-xkLR1cU9.js","assets/image-gallery-DuV1wTMD.js","assets/design-canvas-check-DQB9dn_O.js"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{li as r}from"./icons-C1wDt09O.js";import{t as i}from"./preload-helper-Bf_JiD2A.js";import"./portal-container-context-Gepuvxdg.js";import{t as a}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{t as o}from"./agent-session-sheet-store-BFUVxjab.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-Db1N_iji.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66])));function u(){let e=o(e=>e.payload),t=o(e=>e.close);return e?(0,c.jsxs)(a,{open:!0,onClose:t,zIndex:45,className:`flex h-[var(--sheet-vh)] flex-col p-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,c.jsx)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:e.title??`Agent session`}),(0,c.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto flex size-11 items-center justify-center rounded text-text-secondary hover:text-text-primary`,"aria-label":`Close`,children:(0,c.jsx)(r,{className:`size-5`})})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`Loading…`}),children:(0,c.jsx)(l,{id:`sheet-${e.sessionId}`,payload:e})})})]}):null}export{u as AgentSessionSheet};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{L as r,P as i,xn as a}from"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-CMpVMq3Y.js";import{n as o}from"./utils-D3xTlJyU.js";import"./window-store-D6EgLSfT.js";import"./panel-store-H7e9XHZF.js";import"./project-store-Bs-kiU8m.js";import"./project-framework-store-nuePqBBa.js";import"./session-list-sync-triggers-D9i1FxWd.js";import"./tab-store-NUmgzMPf.js";import"./file-store-Bn0vbkCx.js";import"./use-is-mobile-CL2I7hLf.js";import"./fs-api-BVIVh_De.js";import{B as s,V as c,ni as l}from"./index-Vd9Xr54k.js";import"./agent-session-sheet-store-BFUVxjab.js";import"./libesm-C9iw2_pm.js";import{f as u,l as d,t as f,u as p}from"./tool-cards-7E0jtwP0.js";import"./use-blob-url-CIHAdKoN.js";import"./design-canvas-check-DQB9dn_O.js";import"./db-ai-tools-BhRcsCRL.js";var m=e(t(),1),h=2e3;function g(e,t){let n=t.reset?[]:e.slice();for(let{ev:e,ts:r,k:i,replace:a}of t.events){let t=n.findIndex(e=>e.k===i);if(t!==-1){a&&(n[t]={k:i,ts:r,ev:e});continue}let o=n.length;for(;o>0&&n[o-1].ts>r;)o--;n.splice(o,0,{k:i,ts:r,ev:e})}return n.length>2e3?n.slice(n.length-h):n}function _(){return`ats-${Math.random().toString(36).slice(2,10)}`}function v(e){let{projectName:t,providerId:n,sessionId:r,source:i,fallbackEvents:a}=e,[o,l]=(0,m.useState)([]),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(!1),[h,v]=(0,m.useState)(!0),[y,b]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=_(),a=[],o;l([]),d(!1),p(!1),v(!0),b(null);let u=()=>{c(JSON.stringify({type:`agent-transcript:subscribe`,subId:e,projectName:t,providerId:n,sessionId:r,source:i,...o?{cursor:o}:{}}))},f=t=>{let n=t.detail;n.subId===e&&(a=g(a,n),o=n.cursor,l(a),d(n.available),p(n.running),v(!1),b(null))},m=t=>{let n=t.detail;n.subId===e&&(d(!1),v(!1),b(n.code))};window.addEventListener(`agent-transcript:events`,f),window.addEventListener(`agent-transcript:error`,m);let h=s(u);return u(),()=>{window.removeEventListener(`agent-transcript:events`,f),window.removeEventListener(`agent-transcript:error`,m),h(),c(JSON.stringify({type:`agent-transcript:unsubscribe`,subId:e}))}},[JSON.stringify([t,n,r,i])]);let x=(0,m.useMemo)(()=>o.map(e=>e.ev),[o]);return{events:u?x:a??[],available:u,running:f,loading:h,error:y}}var y=n();function b(e){return e.filter(e=>e.type===`tool_use`).length}function x({status:e}){return e===`loading`?null:e===`running`?(0,y.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-primary shrink-0`,children:[(0,y.jsx)(a,{className:`size-2.5 animate-spin`}),` running`]}):e===`failed`?(0,y.jsx)(`span`,{className:`text-[10px] text-error shrink-0`,children:`failed`}):(0,y.jsx)(`span`,{className:`text-[10px] text-success shrink-0`,children:`done`})}function S({payload:e}){let t=e??{},n=t.sessionId?d(t.sessionId,t.source):``,s=p(e=>n?e.entries[n]:void 0),{events:c,available:h,running:g,loading:_,error:S}=v({projectName:t.projectName,providerId:t.providerId,sessionId:t.sessionId,source:t.source,fallbackEvents:s}),[C,w]=(0,m.useState)(!1),T=l(),E=(0,m.useMemo)(()=>b(c),[c]),D=c[c.length-1],O=!g&&!!D&&D.type===`tool_result`&&!!D.isError,k=_?`loading`:g?`running`:O?`failed`:`done`;return(0,y.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface @container`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,y.jsx)(`span`,{className:`truncate text-xs font-medium`,children:t.title??`Agent session`}),c.length>0&&(0,y.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:u(E)}),(0,y.jsx)(x,{status:k}),!h&&!_&&(0,y.jsx)(`span`,{className:`ml-auto text-[10px] text-text-subtle shrink-0`,title:`No live transcript for this session — showing steps already held in memory`,children:`offline`})]}),!!t.prompt&&(0,y.jsxs)(`div`,{className:`border-b border-border/30 shrink-0`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>!e),className:o(`flex w-full items-center gap-1.5 px-3 py-1.5 text-[11px] text-text-subtle hover:text-foreground`,T?`min-h-[44px]`:`min-h-[28px]`),children:[C?(0,y.jsx)(i,{className:`size-3`}):(0,y.jsx)(r,{className:`size-3`}),`Prompt`]}),C&&(0,y.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-text-secondary whitespace-pre-wrap select-text`,children:t.prompt})]}),_&&c.length===0?(0,y.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,y.jsx)(a,{className:`size-3 animate-spin`}),`Loading session…`]}):c.length===0?(0,y.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle px-4 text-center`,children:S?`Could not load this session`:`No recorded steps`}):(0,y.jsx)(f,{events:c,projectName:t.projectName,variant:`window`,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{S as default};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{L as r,P as i,xn as a}from"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-CMpVMq3Y.js";import{n as o}from"./utils-D3xTlJyU.js";import"./window-store-D6EgLSfT.js";import"./panel-store-H7e9XHZF.js";import"./project-store-Bs-kiU8m.js";import"./project-framework-store-nuePqBBa.js";import"./session-list-sync-triggers-D9i1FxWd.js";import"./tab-store-NUmgzMPf.js";import"./file-store-Bn0vbkCx.js";import"./use-is-mobile-CL2I7hLf.js";import"./fs-api-BVIVh_De.js";import{B as s,V as c,ni as l}from"./index-hEtw8BzE.js";import"./agent-session-sheet-store-BFUVxjab.js";import"./libesm-C9iw2_pm.js";import{f as u,l as d,t as f,u as p}from"./tool-cards-72GKNSD3.js";import"./use-blob-url-CIHAdKoN.js";import"./design-canvas-check-DQB9dn_O.js";import"./db-ai-tools-BhRcsCRL.js";var m=e(t(),1),h=2e3;function g(e,t){let n=t.reset?[]:e.slice();for(let{ev:e,ts:r,k:i,replace:a}of t.events){let t=n.findIndex(e=>e.k===i);if(t!==-1){a&&(n[t]={k:i,ts:r,ev:e});continue}let o=n.length;for(;o>0&&n[o-1].ts>r;)o--;n.splice(o,0,{k:i,ts:r,ev:e})}return n.length>2e3?n.slice(n.length-h):n}function _(){return`ats-${Math.random().toString(36).slice(2,10)}`}function v(e){let{projectName:t,providerId:n,sessionId:r,source:i,fallbackEvents:a}=e,[o,l]=(0,m.useState)([]),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(!1),[h,v]=(0,m.useState)(!0),[y,b]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=_(),a=[],o;l([]),d(!1),p(!1),v(!0),b(null);let u=()=>{c(JSON.stringify({type:`agent-transcript:subscribe`,subId:e,projectName:t,providerId:n,sessionId:r,source:i,...o?{cursor:o}:{}}))},f=t=>{let n=t.detail;n.subId===e&&(a=g(a,n),o=n.cursor,l(a),d(n.available),p(n.running),v(!1),b(null))},m=t=>{let n=t.detail;n.subId===e&&(d(!1),v(!1),b(n.code))};window.addEventListener(`agent-transcript:events`,f),window.addEventListener(`agent-transcript:error`,m);let h=s(u);return u(),()=>{window.removeEventListener(`agent-transcript:events`,f),window.removeEventListener(`agent-transcript:error`,m),h(),c(JSON.stringify({type:`agent-transcript:unsubscribe`,subId:e}))}},[JSON.stringify([t,n,r,i])]);let x=(0,m.useMemo)(()=>o.map(e=>e.ev),[o]);return{events:u?x:a??[],available:u,running:f,loading:h,error:y}}var y=n();function b(e){return e.filter(e=>e.type===`tool_use`).length}function x({status:e}){return e===`loading`?null:e===`running`?(0,y.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-primary shrink-0`,children:[(0,y.jsx)(a,{className:`size-2.5 animate-spin`}),` running`]}):e===`failed`?(0,y.jsx)(`span`,{className:`text-[10px] text-error shrink-0`,children:`failed`}):(0,y.jsx)(`span`,{className:`text-[10px] text-success shrink-0`,children:`done`})}function S({payload:e}){let t=e??{},n=t.sessionId?d(t.sessionId,t.source):``,s=p(e=>n?e.entries[n]:void 0),{events:c,available:h,running:g,loading:_,error:S}=v({projectName:t.projectName,providerId:t.providerId,sessionId:t.sessionId,source:t.source,fallbackEvents:s}),[C,w]=(0,m.useState)(!1),T=l(),E=(0,m.useMemo)(()=>b(c),[c]),D=c[c.length-1],O=!g&&!!D&&D.type===`tool_result`&&!!D.isError,k=_?`loading`:g?`running`:O?`failed`:`done`;return(0,y.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface @container`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,y.jsx)(`span`,{className:`truncate text-xs font-medium`,children:t.title??`Agent session`}),c.length>0&&(0,y.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:u(E)}),(0,y.jsx)(x,{status:k}),!h&&!_&&(0,y.jsx)(`span`,{className:`ml-auto text-[10px] text-text-subtle shrink-0`,title:`No live transcript for this session — showing steps already held in memory`,children:`offline`})]}),!!t.prompt&&(0,y.jsxs)(`div`,{className:`border-b border-border/30 shrink-0`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>!e),className:o(`flex w-full items-center gap-1.5 px-3 py-1.5 text-[11px] text-text-subtle hover:text-foreground`,T?`min-h-[44px]`:`min-h-[28px]`),children:[C?(0,y.jsx)(i,{className:`size-3`}):(0,y.jsx)(r,{className:`size-3`}),`Prompt`]}),C&&(0,y.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-text-secondary whitespace-pre-wrap select-text`,children:t.prompt})]}),_&&c.length===0?(0,y.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,y.jsx)(a,{className:`size-3 animate-spin`}),`Loading session…`]}):c.length===0?(0,y.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle px-4 text-center`,children:S?`Could not load this session`:`No recorded steps`}):(0,y.jsx)(f,{events:c,projectName:t.projectName,variant:`window`,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{S as default};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{Cn as r,Yr as i,r as a,vr as o,xn as s}from"./icons-C1wDt09O.js";import{k as c}from"./api-client-BnYFnEfK.js";import"./settings-store-CMpVMq3Y.js";import{n as l}from"./utils-D3xTlJyU.js";import{$ as u,Gn as d,Hn as f,Kn as p,Un as m,Wn as h,et as g}from"./index-Vd9Xr54k.js";import{t as _}from"./use-monaco-theme-CbNQ4HnC.js";var v=e(t(),1),y=n();function b({metadata:e}){let t=e?.filePath,n=e?.name,l=e?.resourceType??`skill`,b=e?.scope??`user`,S=e?.readOnly===!0,C=e?.shadowed===!0,w=e?.shadowedBy,T=e?.project??``,[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!0),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(!1),I=_(),L=(0,v.useRef)(``),R=E!==O;(0,v.useEffect)(()=>{let e=!1;return j(!0),N(null),d(t,T).then(t=>{e||(D(t.content),k(t.content),L.current=t.content)}).catch(t=>{e||N(t.message)}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,T]);let z=(0,v.useCallback)(async()=>{if(S||P)return;let e=L.current;if(e!==O){F(!0);try{await p(t,e,T),k(e),D(e),c.success(`Saved`),h.getState().reload()}catch(e){c.error(e.message)}finally{F(!1)}}},[t,T,O,S,P]);(0,v.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[z]);let B=m[l];return(0,y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,y.jsx)(B,{className:`size-4 text-text-subtle`}),(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:n}),(0,y.jsx)(f,{scope:b}),R&&!S&&(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary`,title:`Unsaved changes`}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsxs)(`span`,{className:`hidden sm:block text-[11px] text-text-subtle`,children:[l,` · markdown`]}),!S&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`button`,{onClick:()=>D(O),disabled:!R||P,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-text-secondary hover:bg-surface-elevated disabled:opacity-40`,children:[(0,y.jsx)(i,{className:`size-3.5`}),` Revert`]}),(0,y.jsxs)(`button`,{onClick:()=>void z(),disabled:!R||P,className:`flex items-center gap-1 rounded bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,children:[P?(0,y.jsx)(s,{className:`size-3.5 animate-spin`}):(0,y.jsx)(o,{className:`size-3.5`}),` Save`]})]})]}),S&&(0,y.jsx)(x,{icon:r,tone:`muted`,children:`Bundled resource — read-only. Duplicate it (from the AI Resources panel) to make an editable copy.`}),C&&w&&(0,y.jsxs)(x,{icon:a,tone:`warn`,children:[`This `,l,` is overridden by another “`,w.name,`” from a higher-priority source (`,w.source,`). It is currently inactive.`]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1`,children:A?(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,y.jsx)(s,{className:`size-5 animate-spin text-primary`})}):M?(0,y.jsx)(`div`,{className:`p-6 text-center text-sm text-destructive`,children:M}):(0,y.jsx)(g,{beforeMount:u,height:`100%`,language:`markdown`,theme:I,value:E,onChange:e=>{let t=e??``;L.current=t,D(t)},options:{readOnly:S,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,lineNumbers:`on`}})})]})}function x({icon:e,tone:t,children:n}){return(0,y.jsxs)(`div`,{className:l(`flex items-start gap-2 px-3 py-2 text-[12px] shrink-0 border-b border-border`,t===`warn`?`bg-amber-500/10 text-amber-300`:`bg-surface-elevated text-text-secondary`),children:[(0,y.jsx)(e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,y.jsx)(`span`,{children:n})]})}export{b as AiResourceEditor};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{Cn as r,Yr as i,r as a,vr as o,xn as s}from"./icons-C1wDt09O.js";import{k as c}from"./api-client-BnYFnEfK.js";import"./settings-store-CMpVMq3Y.js";import{n as l}from"./utils-D3xTlJyU.js";import{$ as u,Gn as d,Hn as f,Kn as p,Un as m,Wn as h,et as g}from"./index-hEtw8BzE.js";import{t as _}from"./use-monaco-theme-CftL7YLM.js";var v=e(t(),1),y=n();function b({metadata:e}){let t=e?.filePath,n=e?.name,l=e?.resourceType??`skill`,b=e?.scope??`user`,S=e?.readOnly===!0,C=e?.shadowed===!0,w=e?.shadowedBy,T=e?.project??``,[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!0),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(!1),I=_(),L=(0,v.useRef)(``),R=E!==O;(0,v.useEffect)(()=>{let e=!1;return j(!0),N(null),d(t,T).then(t=>{e||(D(t.content),k(t.content),L.current=t.content)}).catch(t=>{e||N(t.message)}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,T]);let z=(0,v.useCallback)(async()=>{if(S||P)return;let e=L.current;if(e!==O){F(!0);try{await p(t,e,T),k(e),D(e),c.success(`Saved`),h.getState().reload()}catch(e){c.error(e.message)}finally{F(!1)}}},[t,T,O,S,P]);(0,v.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[z]);let B=m[l];return(0,y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,y.jsx)(B,{className:`size-4 text-text-subtle`}),(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:n}),(0,y.jsx)(f,{scope:b}),R&&!S&&(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary`,title:`Unsaved changes`}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsxs)(`span`,{className:`hidden sm:block text-[11px] text-text-subtle`,children:[l,` · markdown`]}),!S&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`button`,{onClick:()=>D(O),disabled:!R||P,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-text-secondary hover:bg-surface-elevated disabled:opacity-40`,children:[(0,y.jsx)(i,{className:`size-3.5`}),` Revert`]}),(0,y.jsxs)(`button`,{onClick:()=>void z(),disabled:!R||P,className:`flex items-center gap-1 rounded bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,children:[P?(0,y.jsx)(s,{className:`size-3.5 animate-spin`}):(0,y.jsx)(o,{className:`size-3.5`}),` Save`]})]})]}),S&&(0,y.jsx)(x,{icon:r,tone:`muted`,children:`Bundled resource — read-only. Duplicate it (from the AI Resources panel) to make an editable copy.`}),C&&w&&(0,y.jsxs)(x,{icon:a,tone:`warn`,children:[`This `,l,` is overridden by another “`,w.name,`” from a higher-priority source (`,w.source,`). It is currently inactive.`]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1`,children:A?(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,y.jsx)(s,{className:`size-5 animate-spin text-primary`})}):M?(0,y.jsx)(`div`,{className:`p-6 text-center text-sm text-destructive`,children:M}):(0,y.jsx)(g,{beforeMount:u,height:`100%`,language:`markdown`,theme:I,value:E,onChange:e=>{let t=e??``;L.current=t,D(t)},options:{readOnly:S,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,lineNumbers:`on`}})})]})}function x({icon:e,tone:t,children:n}){return(0,y.jsxs)(`div`,{className:l(`flex items-start gap-2 px-3 py-2 text-[12px] shrink-0 border-b border-border`,t===`warn`?`bg-amber-500/10 text-amber-300`:`bg-surface-elevated text-text-secondary`),children:[(0,y.jsx)(e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,y.jsx)(`span`,{children:n})]})}export{b as AiResourceEditor};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{Kr as r,gt as i,hr as a,r as o}from"./icons-C1wDt09O.js";import{r as s}from"./api-client-BnYFnEfK.js";import{t as c}from"./open-settings-DWbF5YsE.js";import{t as l}from"./button-BHGVTbam.js";import{t as u}from"./input-CReAuQTF.js";import{Bn as d,Ii as ee,Jn as f,Mr as p,Qn as m,Xn as h,Yn as g,Zn as _,qn as v}from"./index-Vd9Xr54k.js";import{a as te,b as ne}from"./api-settings-BPIlTiBi.js";import{n as re,t as ie}from"./leftover-processes-Bc3fIjkK.js";function y(e){let t=/^claude-([a-z]+)((?:-\d{1,2})+)(?:-\d{8})?$/i.exec(e);if(!t)return e;let n=t[1],r=t[2].slice(1).split(`-`).join(`.`);return`${n[0].toUpperCase()}${n.slice(1)} ${r}`}var b=[`low`,`medium`,`high`,`xhigh`,`max`];function x(e){return typeof e==`string`&&b.includes(e)}function S(e){return b.indexOf(e)}function C(e){if(!e)return null;let t=e.toLowerCase();if(t===`auto`||t===`unset`)return{kind:`auto`};let n=t===`med`?`medium`:t;return x(n)?{kind:`level`,level:n}:Number.isNaN(parseInt(t,10))?null:{kind:`budget`}}function w(e,t){if(!t)return{level:e,reason:null};let n=C(t.env?.value),{observed:r}=t;if(n)return r?{level:r.applied,reason:`env`}:{level:T(n,t),reason:`env`};let i=r&&r.requested===e?r.applied:E(e,t);return i===e?{level:i,reason:null}:{level:i,reason:t.cap&&S(e)>S(t.cap.value)?`cap`:`model`}}function T(e,t){return e.kind===`level`?E(e.level,t):t.cap?e.kind===`budget`?E(`high`,t):t.cap.value===`low`?E(`low`,t):null:null}function E(e,t){if(t.supported?.length===0)return null;let n=t.cap&&S(e)>S(t.cap.value)?t.cap.value:e;return t.supported&&!t.supported.includes(n)&&(n===`xhigh`||n===`max`)?`high`:n}function D(e){if(e.file)return e.file;switch(e.source){case`userSettings`:return`~/.claude/settings.json`;case`projectSettings`:return`.claude/settings.json`;case`localSettings`:return`.claude/settings.local.json`;case`policySettings`:return`managed settings`;case`flagSettings`:return`the settings PPM passes to Claude Code`;case`environment`:return`the environment PPM runs in`}}var O=[{label:`Low`,value:`low`},{label:`Medium`,value:`medium`},{label:`High`,value:`high`,default:!0},{label:`Extra`,value:`xhigh`},{label:`Max`,value:`max`}];function k(e){return e?O.find(t=>t.value===e)?.label??e:``}function A(e,t){let n=k(t);return n?`${e} · ${n}`:e}var j=O.find(e=>e.default).value;function M(e,t){let n=x(e)?e:j;return{pick:n,...w(n,t)}}function N(e){return e.map(e=>typeof e==`string`?e:e.code).join(``)}var P=`Remove it there to use the effort picked in PPM.`;function F(e,t,n){if(!e.reason||!t)return null;let r=t.observed?.model,i=r?y(r.replace(/\[[^\]]*\]$/,``)):n,a=e.level?k(e.level):null,o=C(t.env?.value);if(e.reason===`env`&&t.env&&o){let n=[{code:`CLAUDE_CODE_EFFORT_LEVEL=${t.env.value}`},` in `,{code:D(t.env)}];if(o.kind===`auto`){let e=t.cap?`Claude Code sends ${i}'s default effort, capped at ${k(t.cap.value)}.`:a?`Claude Code sends ${i}'s default, ${a}.`:`no effort is sent, so ${i}'s default applies.`;return{title:`Effort is left to the model`,detail:[...n,` overrides the effort picked here: ${e} `,P]}}if(o.kind===`budget`)return a?{title:`Effort is set to ${a} outside PPM`,detail:[...n,` overrides the effort picked here; with a maxEffortLevel set, Claude Code runs it as ${a}. `,P]}:{title:`A thinking budget replaces the effort`,detail:[...n,` sets a thinking budget instead of an effort level, so the effort picked here is not sent. `,P]};let r=e.level===o.level?``:a?` ${i} runs it as ${a}.`:` ${i} takes no effort level, so none is sent.`;return{title:`Effort is set to ${k(o.level)} outside PPM`,detail:[...n,` overrides the effort picked here.${r} `,P]}}if(e.reason===`cap`&&t.cap){let n=e.level===t.cap.value||!a?``:` ${i} runs it as ${a}.`;return{title:`Effort is capped at ${k(t.cap.value)}`,detail:[{code:`maxEffortLevel: "${t.cap.value}"`},` in `,{code:D(t.cap)},` lowers any effort picked above it.${n}`]}}return a?{title:`Runs at ${a}`,detail:[`${k(e.pick)} isn't available for ${i}, so Claude Code runs it at ${a}.`]}:{title:`${i} takes no effort level`,detail:[`Claude Code sends no effort with ${i}, so the effort picked here has no effect.`]}}var I=e(t(),1),L=n(),R=[128e3,272e3,4e5,512e3,872e3,1e6],z=[1e5,2e5,23e4,35e4,45e4,75e4,9e5];function B({id:e,label:t,value:n,presets:r,disabled:i,compact:a,onChange:o}){let[s,c]=(0,I.useState)(!!n&&!r.includes(Number(n))),l=a?`text-[11px]`:`text-sm`;return(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(p,{htmlFor:e,className:l,children:t}),(0,L.jsxs)(`select`,{id:e,value:s?`custom`:n||`default`,disabled:i,"aria-describedby":`codex-context-help`,className:`w-full min-h-11 sm:min-h-0 rounded-md border border-input bg-background px-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 ${a?`h-7`:`h-9`} ${l}`,onChange:e=>{let t=e.target.value;c(t===`custom`),t!==`custom`&&o(t===`default`?``:t)},children:[(0,L.jsx)(`option`,{value:`default`,children:`Codex default`}),r.map(e=>(0,L.jsxs)(`option`,{value:String(e),children:[e===1e6?`1M`:`${e/1e3}K`,` tokens`]},e)),(0,L.jsx)(`option`,{value:`custom`,children:`Custom...`})]}),s&&(0,L.jsx)(u,{id:`${e}-custom`,"aria-label":`Custom ${t.toLowerCase()}`,type:`number`,min:1,step:1,required:!0,value:n,disabled:i,placeholder:`Enter tokens`,"aria-describedby":`codex-context-help`,className:`min-h-11 sm:min-h-0 ${a?`h-7 text-[11px]`:``}`,onChange:e=>o(e.target.value)})]})}function ae({config:e,compact:t,saving:n,onSave:r}){let[i,a]=(0,I.useState)(String(e?.model_context_window??``)),[o,s]=(0,I.useState)(String(e?.model_auto_compact_token_limit??``)),[c,l]=(0,I.useState)(null),u=t?`text-[11px]`:`text-sm`,d=t?`text-[9px]`:`text-[11px]`;async function ee(e){e.preventDefault();let t=i.trim()?Number(i):null,n=o.trim()?Number(o):null;if([t,n].some(e=>e!==null&&(!Number.isSafeInteger(e)||e<=0))){l(`Enter positive whole numbers of tokens, or leave blank for Codex defaults.`);return}if(t!==null&&n!==null&&n>t){l(`Auto-compact threshold must not exceed the context window.`);return}l(null),await r({model_context_window:t,model_auto_compact_token_limit:n})}return(0,L.jsxs)(`form`,{onSubmit:ee,className:`space-y-2 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(B,{id:`codex-context-window`,label:`Context window (tokens)`,value:i,presets:R,disabled:n,compact:t,onChange:e=>{a(e),l(null)}}),(0,L.jsx)(B,{id:`codex-compact-threshold`,label:`Auto-compact threshold (tokens)`,value:o,presets:z,disabled:n,compact:t,onChange:e=>{s(e),l(null)}})]}),(0,L.jsx)(`p`,{id:`codex-context-help`,className:`${d} text-muted-foreground`,children:`Choose Codex default to use Codex configuration and model defaults, or Custom to enter a value. Presets are shortcuts, not a list of limits supported by your model; increasing these values does not unlock a larger context window. Applies to new sessions and sessions resumed after a PPM restart.`}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`${u} text-error`,children:c}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`a`,{href:`https://learn.chatgpt.com/docs/config-file/config-reference`,target:`_blank`,rel:`noreferrer`,className:`${d} text-primary underline`,children:`Codex context documentation`}),(0,L.jsx)(`button`,{type:`submit`,disabled:n,className:`min-h-11 sm:min-h-0 rounded-md border border-border px-3 py-1.5 hover:bg-surface-elevated disabled:opacity-50 ${u}`,children:n?`Saving...`:`Save context settings`})]})]})}var oe=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`xhigh`,label:`Extra`},{value:`max`,label:`Max`}],se=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],V={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function H({compact:e}={}){let[t,n]=(0,I.useState)(null),[r,b]=(0,I.useState)(``),[x,S]=(0,I.useState)([]),[C,w]=(0,I.useState)(!1),[T,E]=(0,I.useState)(!1),[D,O]=(0,I.useState)(null),[k,A]=(0,I.useState)(0),[j,P]=(0,I.useState)([]),[R,z]=(0,I.useState)(!1);(0,I.useEffect)(()=>{te().then(e=>{n(e),b(e.default_provider??`claude`)}).catch(e=>O(e.message))},[]),(0,I.useEffect)(()=>{r&&s.get(`/api/settings/ai/providers/status`).then(P).catch(()=>P([]))},[r]);let B=j.find(e=>e.id===r&&!e.registered);(0,I.useEffect)(()=>{r&&(w(!0),s.get(`/api/settings/ai/providers/${r}/models`).then(S).catch(()=>S([])).finally(()=>w(!1)))},[r,!B]);let[H,U]=(0,I.useState)(null),W=t?.providers[r]?.model;(0,I.useEffect)(()=>{if(U(null),!r)return;let e=!0,t=W?`?model=${encodeURIComponent(W)}`:``;return s.get(`/api/settings/ai/providers/${r}/effort-status${t}`).then(({status:t})=>{e&&U(t)}).catch(()=>{}),()=>{e=!1}},[r,W]);let le=async()=>{z(!0);try{let e=await s.post(`/api/settings/ai/providers/${r}/probe`);P(t=>t.map(t=>t.id===e.id?e:t))}catch(e){O(e.message)}finally{z(!1)}},G=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:V[e]??e})):[],K=t?.providers[r],q=K?.type===`agent-sdk`||!K?.type&&r===`claude`,J=F(M(K?.effort,H),H,K?.model?y(K.model):`the model`),Y=async e=>{if(!t)return!1;E(!0),O(null);try{return n(await ne(e)),A(e=>e+1),!0}catch(e){return O(e.message),!1}finally{E(!1)}},X=(e,t)=>Y({providers:{[r]:{[e]:t}}}),Z=e?`text-[11px]`:`text-sm`,Q=e?`text-xs`:`text-sm`,ue=e?`space-y-2`:`space-y-4`,de=e?`space-y-1.5`:`space-y-3`,$=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,L.jsxs)(`div`,{className:de,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsx)(`p`,{className:`${Z} text-text-subtle`,children:D?`Error: ${D}`:`Loading...`})]});let fe=q?x:[{value:`__default__`,label:`Auto (default)`},...x];return(0,L.jsxs)(`div`,{className:ue,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-new-chat-provider`,className:e?Z:void 0,children:`New chat provider`}),(0,L.jsxs)(v,{value:t.new_chat_provider_mode??`default`,disabled:T,onValueChange:e=>Y({new_chat_provider_mode:e}),children:[(0,L.jsx)(h,{id:`ai-new-chat-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(f,{children:[(0,L.jsx)(g,{value:`follow-focus`,children:`Follow last focused chat`}),(0,L.jsx)(g,{value:`default`,children:`Always use default provider`})]})]}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:t.new_chat_provider_mode===`follow-focus`?`New tabs follow the last chat you focused in this project, across panels. Existing tabs keep their provider.`:`New tabs always use the default provider. Existing tabs keep their provider.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-default-provider`,className:e?Z:void 0,children:`Default provider`}),(0,L.jsxs)(v,{value:t.default_provider,disabled:T,onValueChange:e=>Y({default_provider:e}),children:[(0,L.jsx)(h,{id:`ai-default-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(f,{children:G.map(e=>(0,L.jsx)(g,{value:e.id,children:e.name},e.id))})]}),t.new_chat_provider_mode===`follow-focus`&&(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Used when no chat has been focused in this project yet.`})]}),(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-share-provider-context`,className:e?Z:void 0,children:`Share rules and memory between providers`}),(0,L.jsx)(`p`,{id:`ai-share-provider-context-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Share project rules and memory, plus global instruction files, across providers. Applies from the next project-chat message. Turning off keeps context already sent.`})]}),(0,L.jsx)(m,{id:`ai-share-provider-context`,"aria-describedby":`ai-share-provider-context-description`,checked:t.share_provider_context??!0,disabled:T,onCheckedChange:e=>Y({share_provider_context:e})})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-leftover-idle`,className:e?Z:void 0,children:`Stop leftover processes after (idle minutes, 0 = log only)`}),(0,L.jsx)(u,{id:`ai-leftover-idle`,type:`number`,min:0,max:ie,defaultValue:re(t),"aria-describedby":`ai-leftover-idle-description`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let n=parseInt(e.target.value),r=isNaN(n)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),n));e.target.value=String(r??re(t)),r!==null&&Y({leftover_processes_idle_minutes:r})}},`leftover-${k}`),(0,L.jsxs)(`p`,{id:`ai-leftover-idle-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[`Servers, emulators and other processes a chat's commands started and left running are stopped once the chat has been idle this long, and at once when the chat is deleted. At 0 nothing is stopped: the server log names what `,30,` idle minutes would have stopped. Linux with systemd only.`]})]}),G.length>1&&(0,L.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:G.map(e=>(0,L.jsxs)(`button`,{onClick:()=>b(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,L.jsx)(ee,{providerId:e.id}),(0,L.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,L.jsxs)(`div`,{className:de,children:[B&&(0,L.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,L.jsxs)(`p`,{className:`${Z} text-text-secondary`,children:[V[r]??r,` is not available in chat — PPM could not start it.`]}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:B.reason}),B.nextProbeAt&&(0,L.jsxs)(`p`,{className:`text-[11px] text-text-subtle`,children:[`Checking again at `,new Date(B.nextProbeAt).toLocaleTimeString()]}),(0,L.jsxs)(l,{variant:`outline`,size:`sm`,onClick:le,disabled:R,className:`gap-1.5 cursor-pointer min-h-11 md:min-h-8`,children:[(0,L.jsx)(a,{className:`size-3.5 ${R?`animate-spin`:``}`}),R?`Checking...`:`Check again`]})]})]}),r===`codex`&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>c(`accounts`),className:`w-full flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-2 text-left cursor-pointer hover:bg-surface-elevated transition-colors`,children:[(0,L.jsx)(`span`,{className:`${Z} text-text-secondary`,children:`Codex accounts & login`}),(0,L.jsx)(i,{className:`size-3.5 text-text-subtle shrink-0`})]}),x.length>0&&(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-model`,className:e?Z:void 0,children:`Model`}),(0,L.jsxs)(v,{value:q?K?.model??x[0]?.value:K?.model||`__default__`,onValueChange:e=>X(`model`,e===`__default__`?void 0:e),disabled:C,children:[(0,L.jsx)(h,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{placeholder:C?`Loading models...`:`Select model`})}),(0,L.jsx)(f,{className:`max-h-[300px]`,children:fe.map(e=>(0,L.jsx)(g,{value:e.value,children:e.label},e.value))})]})]}),r===`codex`&&(0,L.jsx)(ae,{config:K,compact:e,saving:T,onSave:e=>Y({providers:{codex:e}})},JSON.stringify([K?.model_context_window,K?.model_auto_compact_token_limit])),q&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-base-url`,className:e?Z:void 0,children:`Base URL`}),(0,L.jsx)(u,{id:`ai-base-url`,type:`url`,defaultValue:K?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{X(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-api-key`,className:e?Z:void 0,children:`API Key / Token`}),(0,L.jsx)(u,{id:`ai-api-key`,type:`password`,defaultValue:K?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||X(`api_key`,t||void 0)}},`apikey-${r}-${k}`),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-effort`,className:e?Z:void 0,children:`Effort`}),(0,L.jsxs)(v,{value:K?.effort??`high`,onValueChange:e=>X(`effort`,e),children:[(0,L.jsx)(h,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(f,{children:oe.map(e=>(0,L.jsx)(g,{value:e.value,children:e.label},e.value))})]}),J&&(0,L.jsxs)(`div`,{role:`note`,className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,L.jsx)(`p`,{className:`${Z} text-text-secondary`,children:J.title}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:N(J.detail)})]})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-max-turns`,className:e?Z:void 0,children:`Max Turns (up to 1000, 0 = no limit)`}),(0,L.jsx)(u,{id:`ai-max-turns`,type:`number`,min:0,max:1e3,defaultValue:K?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value),n=isNaN(t)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),t));e.target.value=String(n??K?.max_turns??100),n!==null&&X(`max_turns`,n)}},`turns-${r}-${k}`),(K?.max_turns===0||(K?.max_turns??0)>500)&&(0,L.jsxs)(`p`,{className:`flex items-start gap-1.5 ${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[(0,L.jsx)(o,{className:`size-3 text-warning shrink-0 mt-px`}),`Every step is a paid model call. With a limit this high, or none, a task left running unattended can go on for hours and run up a large bill.`]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-budget`,className:e?Z:void 0,children:`Max Budget (USD)`}),(0,L.jsx)(u,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:K?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);X(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-thinking`,className:e?Z:void 0,children:`Thinking Budget (tokens)`}),(0,L.jsx)(u,{id:`ai-thinking`,type:`number`,min:0,defaultValue:K?.thinking_budget_tokens??``,placeholder:`Adaptive (model decides)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);X(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(p,{htmlFor:`ai-agent-teams`,className:e?Z:void 0,children:`Agent Teams`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,L.jsx)(m,{id:`ai-agent-teams`,checked:K?.agent_teams??!1,onCheckedChange:e=>X(`agent_teams`,e)})]}),K?.agent_teams&&(0,L.jsx)(ce,{compact:e}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(p,{htmlFor:`ai-context-1m`,className:e?Z:void 0,children:`1M Context Window`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Requires an entitled account (Max/Team/Enterprise) and an Opus 4 / Sonnet 4 model. Other accounts will error.`})]}),(0,L.jsx)(m,{id:`ai-context-1m`,checked:K?.context_1m??!1,onCheckedChange:e=>X(`context_1m`,e)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(p,{htmlFor:`ai-inherit-mcp`,className:e?Z:void 0,children:`Inherit Claude Code MCP`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Auto-load MCP servers from Claude Code's ~/.claude.json (global + per-project). Your own MCP servers override inherited ones.`})]}),(0,L.jsx)(m,{id:`ai-inherit-mcp`,checked:K?.inherit_claude_mcp??!0,onCheckedChange:e=>X(`inherit_claude_mcp`,e)})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{className:e?Z:void 0,children:`MCP sign-in`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Servers that use OAuth stay unavailable to Claude until someone signs in. Project-scoped servers are listed in the project's AI Resources panel.`}),(0,L.jsx)(`div`,{className:`-mx-2`,children:(0,L.jsx)(d,{showWhenEmpty:!0})})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-permission-mode`,className:e?Z:void 0,children:`Default Permission Mode`}),(0,L.jsxs)(v,{value:K?.permission_mode??`bypassPermissions`,onValueChange:e=>X(`permission_mode`,e),children:[(0,L.jsx)(h,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(f,{children:se.map(e=>(0,L.jsx)(g,{value:e.value,children:e.label},e.value))})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-system-prompt`,className:e?Z:void 0,children:`Additional Instructions`}),(0,L.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:K?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{X(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${k}`)]})]}),T&&(0,L.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),D&&(0,L.jsx)(`p`,{className:`text-xs text-error`,children:D})]})}function ce({compact:e}){let[t,n]=(0,I.useState)([]),[i,o]=(0,I.useState)(!1),[c,l]=(0,I.useState)(null),u=(0,I.useCallback)(async()=>{o(!0);try{n(await s.get(`/api/teams`)??[])}catch{}o(!1)},[]);(0,I.useEffect)(()=>{u()},[u]);let d=async e=>{try{await s.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),l(null)}catch{}};return t.length===0&&!i?null:(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(p,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,L.jsx)(`button`,{onClick:u,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,L.jsx)(a,{className:`size-3 ${i?`animate-spin`:``}`})})]}),t.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,L.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,L.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),c===e.name?(0,L.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,L.jsx)(`button`,{onClick:()=>d(e.name),className:`px-2 py-1 bg-error text-white rounded text-[10px]`,children:`Delete`}),(0,L.jsx)(`button`,{onClick:()=>l(null),className:`px-2 py-1 bg-panel-2 text-text rounded text-[10px]`,children:`Cancel`})]}):(0,L.jsx)(`button`,{onClick:()=>l(e.name),className:`shrink-0 text-text-subtle hover:text-error p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,L.jsx)(r,{className:`size-3.5`})})]},e.name))]})}export{F as a,y as c,k as i,O as n,N as o,A as r,M as s,H as t};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{Kr as r,gt as i,hr as a,r as o}from"./icons-C1wDt09O.js";import{r as s}from"./api-client-BnYFnEfK.js";import{t as c}from"./open-settings-DWbF5YsE.js";import{t as l}from"./button-BHGVTbam.js";import{t as u}from"./input-CReAuQTF.js";import{Bn as d,Ii as ee,Jn as f,Mr as p,Qn as m,Xn as h,Yn as g,Zn as _,qn as v}from"./index-hEtw8BzE.js";import{a as te,b as ne}from"./api-settings-BPIlTiBi.js";import{n as re,t as ie}from"./leftover-processes-Bc3fIjkK.js";function y(e){let t=/^claude-([a-z]+)((?:-\d{1,2})+)(?:-\d{8})?$/i.exec(e);if(!t)return e;let n=t[1],r=t[2].slice(1).split(`-`).join(`.`);return`${n[0].toUpperCase()}${n.slice(1)} ${r}`}var b=[`low`,`medium`,`high`,`xhigh`,`max`];function x(e){return typeof e==`string`&&b.includes(e)}function S(e){return b.indexOf(e)}function C(e){if(!e)return null;let t=e.toLowerCase();if(t===`auto`||t===`unset`)return{kind:`auto`};let n=t===`med`?`medium`:t;return x(n)?{kind:`level`,level:n}:Number.isNaN(parseInt(t,10))?null:{kind:`budget`}}function w(e,t){if(!t)return{level:e,reason:null};let n=C(t.env?.value),{observed:r}=t;if(n)return r?{level:r.applied,reason:`env`}:{level:T(n,t),reason:`env`};let i=r&&r.requested===e?r.applied:E(e,t);return i===e?{level:i,reason:null}:{level:i,reason:t.cap&&S(e)>S(t.cap.value)?`cap`:`model`}}function T(e,t){return e.kind===`level`?E(e.level,t):t.cap?e.kind===`budget`?E(`high`,t):t.cap.value===`low`?E(`low`,t):null:null}function E(e,t){if(t.supported?.length===0)return null;let n=t.cap&&S(e)>S(t.cap.value)?t.cap.value:e;return t.supported&&!t.supported.includes(n)&&(n===`xhigh`||n===`max`)?`high`:n}function D(e){if(e.file)return e.file;switch(e.source){case`userSettings`:return`~/.claude/settings.json`;case`projectSettings`:return`.claude/settings.json`;case`localSettings`:return`.claude/settings.local.json`;case`policySettings`:return`managed settings`;case`flagSettings`:return`the settings PPM passes to Claude Code`;case`environment`:return`the environment PPM runs in`}}var O=[{label:`Low`,value:`low`},{label:`Medium`,value:`medium`},{label:`High`,value:`high`,default:!0},{label:`Extra`,value:`xhigh`},{label:`Max`,value:`max`}];function k(e){return e?O.find(t=>t.value===e)?.label??e:``}function A(e,t){let n=k(t);return n?`${e} · ${n}`:e}var j=O.find(e=>e.default).value;function M(e,t){let n=x(e)?e:j;return{pick:n,...w(n,t)}}function N(e){return e.map(e=>typeof e==`string`?e:e.code).join(``)}var P=`Remove it there to use the effort picked in PPM.`;function F(e,t,n){if(!e.reason||!t)return null;let r=t.observed?.model,i=r?y(r.replace(/\[[^\]]*\]$/,``)):n,a=e.level?k(e.level):null,o=C(t.env?.value);if(e.reason===`env`&&t.env&&o){let n=[{code:`CLAUDE_CODE_EFFORT_LEVEL=${t.env.value}`},` in `,{code:D(t.env)}];if(o.kind===`auto`){let e=t.cap?`Claude Code sends ${i}'s default effort, capped at ${k(t.cap.value)}.`:a?`Claude Code sends ${i}'s default, ${a}.`:`no effort is sent, so ${i}'s default applies.`;return{title:`Effort is left to the model`,detail:[...n,` overrides the effort picked here: ${e} `,P]}}if(o.kind===`budget`)return a?{title:`Effort is set to ${a} outside PPM`,detail:[...n,` overrides the effort picked here; with a maxEffortLevel set, Claude Code runs it as ${a}. `,P]}:{title:`A thinking budget replaces the effort`,detail:[...n,` sets a thinking budget instead of an effort level, so the effort picked here is not sent. `,P]};let r=e.level===o.level?``:a?` ${i} runs it as ${a}.`:` ${i} takes no effort level, so none is sent.`;return{title:`Effort is set to ${k(o.level)} outside PPM`,detail:[...n,` overrides the effort picked here.${r} `,P]}}if(e.reason===`cap`&&t.cap){let n=e.level===t.cap.value||!a?``:` ${i} runs it as ${a}.`;return{title:`Effort is capped at ${k(t.cap.value)}`,detail:[{code:`maxEffortLevel: "${t.cap.value}"`},` in `,{code:D(t.cap)},` lowers any effort picked above it.${n}`]}}return a?{title:`Runs at ${a}`,detail:[`${k(e.pick)} isn't available for ${i}, so Claude Code runs it at ${a}.`]}:{title:`${i} takes no effort level`,detail:[`Claude Code sends no effort with ${i}, so the effort picked here has no effect.`]}}var I=e(t(),1),L=n(),R=[128e3,272e3,4e5,512e3,872e3,1e6],z=[1e5,2e5,23e4,35e4,45e4,75e4,9e5];function B({id:e,label:t,value:n,presets:r,disabled:i,compact:a,onChange:o}){let[s,c]=(0,I.useState)(!!n&&!r.includes(Number(n))),l=a?`text-[11px]`:`text-sm`;return(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(p,{htmlFor:e,className:l,children:t}),(0,L.jsxs)(`select`,{id:e,value:s?`custom`:n||`default`,disabled:i,"aria-describedby":`codex-context-help`,className:`w-full min-h-11 sm:min-h-0 rounded-md border border-input bg-background px-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 ${a?`h-7`:`h-9`} ${l}`,onChange:e=>{let t=e.target.value;c(t===`custom`),t!==`custom`&&o(t===`default`?``:t)},children:[(0,L.jsx)(`option`,{value:`default`,children:`Codex default`}),r.map(e=>(0,L.jsxs)(`option`,{value:String(e),children:[e===1e6?`1M`:`${e/1e3}K`,` tokens`]},e)),(0,L.jsx)(`option`,{value:`custom`,children:`Custom...`})]}),s&&(0,L.jsx)(u,{id:`${e}-custom`,"aria-label":`Custom ${t.toLowerCase()}`,type:`number`,min:1,step:1,required:!0,value:n,disabled:i,placeholder:`Enter tokens`,"aria-describedby":`codex-context-help`,className:`min-h-11 sm:min-h-0 ${a?`h-7 text-[11px]`:``}`,onChange:e=>o(e.target.value)})]})}function ae({config:e,compact:t,saving:n,onSave:r}){let[i,a]=(0,I.useState)(String(e?.model_context_window??``)),[o,s]=(0,I.useState)(String(e?.model_auto_compact_token_limit??``)),[c,l]=(0,I.useState)(null),u=t?`text-[11px]`:`text-sm`,d=t?`text-[9px]`:`text-[11px]`;async function ee(e){e.preventDefault();let t=i.trim()?Number(i):null,n=o.trim()?Number(o):null;if([t,n].some(e=>e!==null&&(!Number.isSafeInteger(e)||e<=0))){l(`Enter positive whole numbers of tokens, or leave blank for Codex defaults.`);return}if(t!==null&&n!==null&&n>t){l(`Auto-compact threshold must not exceed the context window.`);return}l(null),await r({model_context_window:t,model_auto_compact_token_limit:n})}return(0,L.jsxs)(`form`,{onSubmit:ee,className:`space-y-2 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(B,{id:`codex-context-window`,label:`Context window (tokens)`,value:i,presets:R,disabled:n,compact:t,onChange:e=>{a(e),l(null)}}),(0,L.jsx)(B,{id:`codex-compact-threshold`,label:`Auto-compact threshold (tokens)`,value:o,presets:z,disabled:n,compact:t,onChange:e=>{s(e),l(null)}})]}),(0,L.jsx)(`p`,{id:`codex-context-help`,className:`${d} text-muted-foreground`,children:`Choose Codex default to use Codex configuration and model defaults, or Custom to enter a value. Presets are shortcuts, not a list of limits supported by your model; increasing these values does not unlock a larger context window. Applies to new sessions and sessions resumed after a PPM restart.`}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`${u} text-error`,children:c}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`a`,{href:`https://learn.chatgpt.com/docs/config-file/config-reference`,target:`_blank`,rel:`noreferrer`,className:`${d} text-primary underline`,children:`Codex context documentation`}),(0,L.jsx)(`button`,{type:`submit`,disabled:n,className:`min-h-11 sm:min-h-0 rounded-md border border-border px-3 py-1.5 hover:bg-surface-elevated disabled:opacity-50 ${u}`,children:n?`Saving...`:`Save context settings`})]})]})}var oe=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`xhigh`,label:`Extra`},{value:`max`,label:`Max`}],se=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],V={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function H({compact:e}={}){let[t,n]=(0,I.useState)(null),[r,b]=(0,I.useState)(``),[x,S]=(0,I.useState)([]),[C,w]=(0,I.useState)(!1),[T,E]=(0,I.useState)(!1),[D,O]=(0,I.useState)(null),[k,A]=(0,I.useState)(0),[j,P]=(0,I.useState)([]),[R,z]=(0,I.useState)(!1);(0,I.useEffect)(()=>{te().then(e=>{n(e),b(e.default_provider??`claude`)}).catch(e=>O(e.message))},[]),(0,I.useEffect)(()=>{r&&s.get(`/api/settings/ai/providers/status`).then(P).catch(()=>P([]))},[r]);let B=j.find(e=>e.id===r&&!e.registered);(0,I.useEffect)(()=>{r&&(w(!0),s.get(`/api/settings/ai/providers/${r}/models`).then(S).catch(()=>S([])).finally(()=>w(!1)))},[r,!B]);let[H,U]=(0,I.useState)(null),W=t?.providers[r]?.model;(0,I.useEffect)(()=>{if(U(null),!r)return;let e=!0,t=W?`?model=${encodeURIComponent(W)}`:``;return s.get(`/api/settings/ai/providers/${r}/effort-status${t}`).then(({status:t})=>{e&&U(t)}).catch(()=>{}),()=>{e=!1}},[r,W]);let le=async()=>{z(!0);try{let e=await s.post(`/api/settings/ai/providers/${r}/probe`);P(t=>t.map(t=>t.id===e.id?e:t))}catch(e){O(e.message)}finally{z(!1)}},G=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:V[e]??e})):[],K=t?.providers[r],q=K?.type===`agent-sdk`||!K?.type&&r===`claude`,J=F(M(K?.effort,H),H,K?.model?y(K.model):`the model`),Y=async e=>{if(!t)return!1;E(!0),O(null);try{return n(await ne(e)),A(e=>e+1),!0}catch(e){return O(e.message),!1}finally{E(!1)}},X=(e,t)=>Y({providers:{[r]:{[e]:t}}}),Z=e?`text-[11px]`:`text-sm`,Q=e?`text-xs`:`text-sm`,ue=e?`space-y-2`:`space-y-4`,de=e?`space-y-1.5`:`space-y-3`,$=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,L.jsxs)(`div`,{className:de,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsx)(`p`,{className:`${Z} text-text-subtle`,children:D?`Error: ${D}`:`Loading...`})]});let fe=q?x:[{value:`__default__`,label:`Auto (default)`},...x];return(0,L.jsxs)(`div`,{className:ue,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-new-chat-provider`,className:e?Z:void 0,children:`New chat provider`}),(0,L.jsxs)(v,{value:t.new_chat_provider_mode??`default`,disabled:T,onValueChange:e=>Y({new_chat_provider_mode:e}),children:[(0,L.jsx)(h,{id:`ai-new-chat-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(f,{children:[(0,L.jsx)(g,{value:`follow-focus`,children:`Follow last focused chat`}),(0,L.jsx)(g,{value:`default`,children:`Always use default provider`})]})]}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:t.new_chat_provider_mode===`follow-focus`?`New tabs follow the last chat you focused in this project, across panels. Existing tabs keep their provider.`:`New tabs always use the default provider. Existing tabs keep their provider.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-default-provider`,className:e?Z:void 0,children:`Default provider`}),(0,L.jsxs)(v,{value:t.default_provider,disabled:T,onValueChange:e=>Y({default_provider:e}),children:[(0,L.jsx)(h,{id:`ai-default-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(f,{children:G.map(e=>(0,L.jsx)(g,{value:e.id,children:e.name},e.id))})]}),t.new_chat_provider_mode===`follow-focus`&&(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Used when no chat has been focused in this project yet.`})]}),(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-share-provider-context`,className:e?Z:void 0,children:`Share rules and memory between providers`}),(0,L.jsx)(`p`,{id:`ai-share-provider-context-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Share project rules and memory, plus global instruction files, across providers. Applies from the next project-chat message. Turning off keeps context already sent.`})]}),(0,L.jsx)(m,{id:`ai-share-provider-context`,"aria-describedby":`ai-share-provider-context-description`,checked:t.share_provider_context??!0,disabled:T,onCheckedChange:e=>Y({share_provider_context:e})})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-leftover-idle`,className:e?Z:void 0,children:`Stop leftover processes after (idle minutes, 0 = log only)`}),(0,L.jsx)(u,{id:`ai-leftover-idle`,type:`number`,min:0,max:ie,defaultValue:re(t),"aria-describedby":`ai-leftover-idle-description`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let n=parseInt(e.target.value),r=isNaN(n)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),n));e.target.value=String(r??re(t)),r!==null&&Y({leftover_processes_idle_minutes:r})}},`leftover-${k}`),(0,L.jsxs)(`p`,{id:`ai-leftover-idle-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[`Servers, emulators and other processes a chat's commands started and left running are stopped once the chat has been idle this long, and at once when the chat is deleted. At 0 nothing is stopped: the server log names what `,30,` idle minutes would have stopped. Linux with systemd only.`]})]}),G.length>1&&(0,L.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:G.map(e=>(0,L.jsxs)(`button`,{onClick:()=>b(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,L.jsx)(ee,{providerId:e.id}),(0,L.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,L.jsxs)(`div`,{className:de,children:[B&&(0,L.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,L.jsxs)(`p`,{className:`${Z} text-text-secondary`,children:[V[r]??r,` is not available in chat — PPM could not start it.`]}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:B.reason}),B.nextProbeAt&&(0,L.jsxs)(`p`,{className:`text-[11px] text-text-subtle`,children:[`Checking again at `,new Date(B.nextProbeAt).toLocaleTimeString()]}),(0,L.jsxs)(l,{variant:`outline`,size:`sm`,onClick:le,disabled:R,className:`gap-1.5 cursor-pointer min-h-11 md:min-h-8`,children:[(0,L.jsx)(a,{className:`size-3.5 ${R?`animate-spin`:``}`}),R?`Checking...`:`Check again`]})]})]}),r===`codex`&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>c(`accounts`),className:`w-full flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-2 text-left cursor-pointer hover:bg-surface-elevated transition-colors`,children:[(0,L.jsx)(`span`,{className:`${Z} text-text-secondary`,children:`Codex accounts & login`}),(0,L.jsx)(i,{className:`size-3.5 text-text-subtle shrink-0`})]}),x.length>0&&(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-model`,className:e?Z:void 0,children:`Model`}),(0,L.jsxs)(v,{value:q?K?.model??x[0]?.value:K?.model||`__default__`,onValueChange:e=>X(`model`,e===`__default__`?void 0:e),disabled:C,children:[(0,L.jsx)(h,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{placeholder:C?`Loading models...`:`Select model`})}),(0,L.jsx)(f,{className:`max-h-[300px]`,children:fe.map(e=>(0,L.jsx)(g,{value:e.value,children:e.label},e.value))})]})]}),r===`codex`&&(0,L.jsx)(ae,{config:K,compact:e,saving:T,onSave:e=>Y({providers:{codex:e}})},JSON.stringify([K?.model_context_window,K?.model_auto_compact_token_limit])),q&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-base-url`,className:e?Z:void 0,children:`Base URL`}),(0,L.jsx)(u,{id:`ai-base-url`,type:`url`,defaultValue:K?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{X(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-api-key`,className:e?Z:void 0,children:`API Key / Token`}),(0,L.jsx)(u,{id:`ai-api-key`,type:`password`,defaultValue:K?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||X(`api_key`,t||void 0)}},`apikey-${r}-${k}`),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-effort`,className:e?Z:void 0,children:`Effort`}),(0,L.jsxs)(v,{value:K?.effort??`high`,onValueChange:e=>X(`effort`,e),children:[(0,L.jsx)(h,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(f,{children:oe.map(e=>(0,L.jsx)(g,{value:e.value,children:e.label},e.value))})]}),J&&(0,L.jsxs)(`div`,{role:`note`,className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,L.jsx)(`p`,{className:`${Z} text-text-secondary`,children:J.title}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:N(J.detail)})]})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-max-turns`,className:e?Z:void 0,children:`Max Turns (up to 1000, 0 = no limit)`}),(0,L.jsx)(u,{id:`ai-max-turns`,type:`number`,min:0,max:1e3,defaultValue:K?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value),n=isNaN(t)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),t));e.target.value=String(n??K?.max_turns??100),n!==null&&X(`max_turns`,n)}},`turns-${r}-${k}`),(K?.max_turns===0||(K?.max_turns??0)>500)&&(0,L.jsxs)(`p`,{className:`flex items-start gap-1.5 ${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[(0,L.jsx)(o,{className:`size-3 text-warning shrink-0 mt-px`}),`Every step is a paid model call. With a limit this high, or none, a task left running unattended can go on for hours and run up a large bill.`]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-budget`,className:e?Z:void 0,children:`Max Budget (USD)`}),(0,L.jsx)(u,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:K?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);X(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-thinking`,className:e?Z:void 0,children:`Thinking Budget (tokens)`}),(0,L.jsx)(u,{id:`ai-thinking`,type:`number`,min:0,defaultValue:K?.thinking_budget_tokens??``,placeholder:`Adaptive (model decides)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);X(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(p,{htmlFor:`ai-agent-teams`,className:e?Z:void 0,children:`Agent Teams`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,L.jsx)(m,{id:`ai-agent-teams`,checked:K?.agent_teams??!1,onCheckedChange:e=>X(`agent_teams`,e)})]}),K?.agent_teams&&(0,L.jsx)(ce,{compact:e}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(p,{htmlFor:`ai-context-1m`,className:e?Z:void 0,children:`1M Context Window`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Requires an entitled account (Max/Team/Enterprise) and an Opus 4 / Sonnet 4 model. Other accounts will error.`})]}),(0,L.jsx)(m,{id:`ai-context-1m`,checked:K?.context_1m??!1,onCheckedChange:e=>X(`context_1m`,e)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(p,{htmlFor:`ai-inherit-mcp`,className:e?Z:void 0,children:`Inherit Claude Code MCP`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Auto-load MCP servers from Claude Code's ~/.claude.json (global + per-project). Your own MCP servers override inherited ones.`})]}),(0,L.jsx)(m,{id:`ai-inherit-mcp`,checked:K?.inherit_claude_mcp??!0,onCheckedChange:e=>X(`inherit_claude_mcp`,e)})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{className:e?Z:void 0,children:`MCP sign-in`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Servers that use OAuth stay unavailable to Claude until someone signs in. Project-scoped servers are listed in the project's AI Resources panel.`}),(0,L.jsx)(`div`,{className:`-mx-2`,children:(0,L.jsx)(d,{showWhenEmpty:!0})})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-permission-mode`,className:e?Z:void 0,children:`Default Permission Mode`}),(0,L.jsxs)(v,{value:K?.permission_mode??`bypassPermissions`,onValueChange:e=>X(`permission_mode`,e),children:[(0,L.jsx)(h,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(f,{children:se.map(e=>(0,L.jsx)(g,{value:e.value,children:e.label},e.value))})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(p,{htmlFor:`ai-system-prompt`,className:e?Z:void 0,children:`Additional Instructions`}),(0,L.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:K?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{X(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${k}`)]})]}),T&&(0,L.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),D&&(0,L.jsx)(`p`,{className:`text-xs text-error`,children:D})]})}function ce({compact:e}){let[t,n]=(0,I.useState)([]),[i,o]=(0,I.useState)(!1),[c,l]=(0,I.useState)(null),u=(0,I.useCallback)(async()=>{o(!0);try{n(await s.get(`/api/teams`)??[])}catch{}o(!1)},[]);(0,I.useEffect)(()=>{u()},[u]);let d=async e=>{try{await s.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),l(null)}catch{}};return t.length===0&&!i?null:(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(p,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,L.jsx)(`button`,{onClick:u,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,L.jsx)(a,{className:`size-3 ${i?`animate-spin`:``}`})})]}),t.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,L.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,L.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),c===e.name?(0,L.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,L.jsx)(`button`,{onClick:()=>d(e.name),className:`px-2 py-1 bg-error text-white rounded text-[10px]`,children:`Delete`}),(0,L.jsx)(`button`,{onClick:()=>l(null),className:`px-2 py-1 bg-panel-2 text-text rounded text-[10px]`,children:`Cancel`})]}):(0,L.jsx)(`button`,{onClick:()=>l(e.name),className:`shrink-0 text-text-subtle hover:text-error p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,L.jsx)(r,{className:`size-3.5`})})]},e.name))]})}export{F as a,y as c,k as i,O as n,N as o,A as r,M as s,H as t};
@@ -1 +1 @@
1
- import"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-CMpVMq3Y.js";import"./portal-container-context-Gepuvxdg.js";import"./window-store-D6EgLSfT.js";import"./panel-store-H7e9XHZF.js";import"./project-store-Bs-kiU8m.js";import"./project-framework-store-nuePqBBa.js";import"./session-list-sync-triggers-D9i1FxWd.js";import"./tab-store-NUmgzMPf.js";import"./chat-preparation-cache-Bzb-T1pm.js";import"./use-is-mobile-CL2I7hLf.js";import"./settings-categories-BY9n3BRr.js";import"./open-settings-DWbF5YsE.js";import"./button-BHGVTbam.js";import"./dialog-DnE192fh.js";import"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import"./input-CReAuQTF.js";import"./api-settings-BPIlTiBi.js";import{t as e}from"./ai-settings-section-BNiVD9D3.js";export{e as AISettingsSection};
1
+ import"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-CMpVMq3Y.js";import"./portal-container-context-Gepuvxdg.js";import"./window-store-D6EgLSfT.js";import"./panel-store-H7e9XHZF.js";import"./project-store-Bs-kiU8m.js";import"./project-framework-store-nuePqBBa.js";import"./session-list-sync-triggers-D9i1FxWd.js";import"./tab-store-NUmgzMPf.js";import"./chat-preparation-cache-Bzb-T1pm.js";import"./use-is-mobile-CL2I7hLf.js";import"./settings-categories-BY9n3BRr.js";import"./open-settings-DWbF5YsE.js";import"./button-BHGVTbam.js";import"./dialog-DnE192fh.js";import"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import"./input-CReAuQTF.js";import"./api-settings-BPIlTiBi.js";import{t as e}from"./ai-settings-section-DfsLLATF.js";export{e as AISettingsSection};