@hienlh/ppm 0.23.22 → 0.23.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/CLAUDE.md +3 -1
- package/README.md +1 -1
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/http-api.md +2 -1
- package/dist/web/assets/{accounts-settings-section-CiNmIj02.js → accounts-settings-section-Cg-LncY6.js} +1 -1
- package/dist/web/assets/accounts-settings-section-Cg-LncY6.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-Cg-LncY6.js.gz +0 -0
- package/dist/web/assets/{agent-session-sheet-DRR36PDA.js → agent-session-sheet-DMdV8GOu.js} +2 -2
- package/dist/web/assets/agent-session-sheet-DMdV8GOu.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-DMdV8GOu.js.gz +0 -0
- package/dist/web/assets/{agent-session-window-content-DMhy16BM.js → agent-session-window-content-CYg58J-V.js} +1 -1
- package/dist/web/assets/agent-session-window-content-CYg58J-V.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-CYg58J-V.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-BG8boPw7.js → ai-resource-editor-BvEnn0Z_.js} +1 -1
- package/dist/web/assets/ai-resource-editor-BvEnn0Z_.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-BvEnn0Z_.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-De5dYWlC.js → ai-settings-section-Bo-nf2rY.js} +1 -1
- package/dist/web/assets/ai-settings-section-DAqiu_11.js +1 -0
- package/dist/web/assets/ai-settings-section-DAqiu_11.js.br +0 -0
- package/dist/web/assets/ai-settings-section-DAqiu_11.js.gz +0 -0
- package/dist/web/assets/{android-tab-lHDxD93G.js → android-tab-C-wmlFc0.js} +1 -1
- package/dist/web/assets/android-tab-C-wmlFc0.js.br +0 -0
- package/dist/web/assets/android-tab-C-wmlFc0.js.gz +0 -0
- package/dist/web/assets/{appearance-settings-section-DO-ZyoMj.js → appearance-settings-section-CYqX6BGh.js} +1 -1
- package/dist/web/assets/appearance-settings-section-CYqX6BGh.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-CYqX6BGh.js.gz +0 -0
- package/dist/web/assets/{apps-panel-CH-0CHYY.js → apps-panel-D1VTBxgC.js} +1 -1
- package/dist/web/assets/apps-panel-D1VTBxgC.js.br +0 -0
- package/dist/web/assets/apps-panel-D1VTBxgC.js.gz +0 -0
- package/dist/web/assets/{branch-review-tab-CdGtvekz.js → branch-review-tab-BG6vxSsC.js} +1 -1
- package/dist/web/assets/branch-review-tab-BG6vxSsC.js.br +0 -0
- package/dist/web/assets/branch-review-tab-BG6vxSsC.js.gz +0 -0
- package/dist/web/assets/chat-tab-BAwGLGyR.js +19 -0
- package/dist/web/assets/chat-tab-BAwGLGyR.js.br +0 -0
- package/dist/web/assets/chat-tab-BAwGLGyR.js.gz +0 -0
- package/dist/web/assets/{chat-tab-DMqWnFIo.js → chat-tab-BJ0Mi2sd.js} +1 -1
- package/dist/web/assets/chat-tab-BJ0Mi2sd.js.br +0 -0
- package/dist/web/assets/chat-tab-BJ0Mi2sd.js.gz +0 -0
- package/dist/web/assets/{code-editor-BCv8ONNS.js → code-editor-DuwbwTpM.js} +4 -4
- package/dist/web/assets/code-editor-DuwbwTpM.js.br +0 -0
- package/dist/web/assets/code-editor-DuwbwTpM.js.gz +0 -0
- package/dist/web/assets/{codex-reset-credit-button-CGMbIHak.js → codex-reset-credit-button-tIwfnf2G.js} +1 -1
- package/dist/web/assets/codex-reset-credit-button-tIwfnf2G.js.br +0 -0
- package/dist/web/assets/{codex-reset-credit-button-CGMbIHak.js.gz → codex-reset-credit-button-tIwfnf2G.js.gz} +0 -0
- package/dist/web/assets/{conflict-editor-3WmzqBlW.js → conflict-editor-D2n-hQqs.js} +1 -1
- package/dist/web/assets/conflict-editor-D2n-hQqs.js.br +0 -0
- package/dist/web/assets/conflict-editor-D2n-hQqs.js.gz +0 -0
- package/dist/web/assets/{connection-form-tab-BoWucvAe.js → connection-form-tab-DYqPNq_-.js} +1 -1
- package/dist/web/assets/connection-form-tab-DYqPNq_-.js.br +0 -0
- package/dist/web/assets/connection-form-tab-DYqPNq_-.js.gz +0 -0
- package/dist/web/assets/{csv-preview-BCgGsy7F.js → csv-preview-Xh3Z6BS5.js} +1 -1
- package/dist/web/assets/csv-preview-Xh3Z6BS5.js.br +0 -0
- package/dist/web/assets/csv-preview-Xh3Z6BS5.js.gz +0 -0
- package/dist/web/assets/{db-tab-parts-o6QMHBbA.js → db-tab-parts-Dqnb3GCP.js} +1 -1
- package/dist/web/assets/db-tab-parts-Dqnb3GCP.js.br +0 -0
- package/dist/web/assets/db-tab-parts-Dqnb3GCP.js.gz +0 -0
- package/dist/web/assets/{design-settings-section-seo6SdSk.js → design-settings-section-DNNWgxF9.js} +1 -1
- package/dist/web/assets/design-settings-section-DNNWgxF9.js.br +0 -0
- package/dist/web/assets/design-settings-section-DNNWgxF9.js.gz +0 -0
- package/dist/web/assets/{design-tab-B-f_b2LM.js → design-tab-BoAdSpZZ.js} +1 -1
- package/dist/web/assets/design-tab-BoAdSpZZ.js.br +0 -0
- package/dist/web/assets/design-tab-BoAdSpZZ.js.gz +0 -0
- package/dist/web/assets/{designs-sidebar-panel-CVT_TQP7.js → designs-sidebar-panel-BKw7HFAz.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-BKw7HFAz.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-BKw7HFAz.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-y9uBp_8u.js → diff-viewer-CRmfCAZX.js} +1 -1
- package/dist/web/assets/diff-viewer-CRmfCAZX.js.br +0 -0
- package/dist/web/assets/diff-viewer-CRmfCAZX.js.gz +0 -0
- package/dist/web/assets/{docx-preview-Dn_x3Inm.js → docx-preview-zIrtL09u.js} +1 -1
- package/dist/web/assets/docx-preview-zIrtL09u.js.br +0 -0
- package/dist/web/assets/docx-preview-zIrtL09u.js.gz +0 -0
- package/dist/web/assets/{editor-dialog-BwNXSajD.js → editor-dialog-jMYvXVla.js} +1 -1
- package/dist/web/assets/editor-dialog-jMYvXVla.js.br +0 -0
- package/dist/web/assets/editor-dialog-jMYvXVla.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-XA_TnPLN.js → editor-language-service-Yb-61Bro.js} +1 -1
- package/dist/web/assets/editor-language-service-Yb-61Bro.js.br +0 -0
- package/dist/web/assets/editor-language-service-Yb-61Bro.js.gz +0 -0
- package/dist/web/assets/{explorer-body-DukR7zM9.js → explorer-body-C6qKehmd.js} +1 -1
- package/dist/web/assets/explorer-body-C6qKehmd.js.br +0 -0
- package/dist/web/assets/explorer-body-C6qKehmd.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-BjTZ44S3.js → explorer-window-content-B9P8grrY.js} +1 -1
- package/dist/web/assets/explorer-window-content-B9P8grrY.js.br +0 -0
- package/dist/web/assets/explorer-window-content-B9P8grrY.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-C4WD1BPQ.js → extension-manager-section-C45v1QtG.js} +1 -1
- package/dist/web/assets/extension-manager-section-C45v1QtG.js.br +0 -0
- package/dist/web/assets/extension-manager-section-C45v1QtG.js.gz +0 -0
- package/dist/web/assets/{extension-webview-CV2ujflc.js → extension-webview-DIxM-xkH.js} +1 -1
- package/dist/web/assets/extension-webview-DIxM-xkH.js.br +0 -0
- package/dist/web/assets/extension-webview-DIxM-xkH.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-hS5ixQ8o.js → files-settings-section-DeVlzKXd.js} +1 -1
- package/dist/web/assets/files-settings-section-DeVlzKXd.js.br +0 -0
- package/dist/web/assets/files-settings-section-DeVlzKXd.js.gz +0 -0
- package/dist/web/assets/format-date-CkyHzZLA.js +1 -0
- package/dist/web/assets/{general-settings-section-BnKYY0AA.js → general-settings-section-CLVDIEym.js} +1 -1
- package/dist/web/assets/general-settings-section-CLVDIEym.js.br +0 -0
- package/dist/web/assets/general-settings-section-CLVDIEym.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-JiWfR5xv.js → git-log-panel-D3Q9NRll.js} +1 -1
- package/dist/web/assets/git-log-panel-D3Q9NRll.js.br +0 -0
- package/dist/web/assets/git-log-panel-D3Q9NRll.js.gz +0 -0
- package/dist/web/assets/{git-review-tab-DgvcY__Q.js → git-review-tab-ORgiYbva.js} +1 -1
- package/dist/web/assets/git-review-tab-ORgiYbva.js.br +0 -0
- package/dist/web/assets/git-review-tab-ORgiYbva.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-r1MKxDjz.js → glide-data-grid-CtWl1BTk.js} +1 -1
- package/dist/web/assets/glide-data-grid-CtWl1BTk.js.br +0 -0
- package/dist/web/assets/glide-data-grid-CtWl1BTk.js.gz +0 -0
- package/dist/web/assets/{grid-save-dialog-Fa0yA-Ep.js → grid-save-dialog-eV25Mqpg.js} +1 -1
- package/dist/web/assets/grid-save-dialog-eV25Mqpg.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-eV25Mqpg.js.gz +0 -0
- package/dist/web/assets/{group-chat-tab-B2Q8yqSX.js → group-chat-tab-CYmbYXN2.js} +1 -1
- package/dist/web/assets/group-chat-tab-CYmbYXN2.js.br +0 -0
- package/dist/web/assets/group-chat-tab-CYmbYXN2.js.gz +0 -0
- package/dist/web/assets/{impexp-tab-B8Ht4l32.js → impexp-tab-D2OKxpFq.js} +1 -1
- package/dist/web/assets/impexp-tab-D2OKxpFq.js.br +0 -0
- package/dist/web/assets/impexp-tab-D2OKxpFq.js.gz +0 -0
- package/dist/web/assets/{index-BtAn_krv.js → index-D8QDpdgs.js} +7 -7
- package/dist/web/assets/index-D8QDpdgs.js.br +0 -0
- package/dist/web/assets/index-D8QDpdgs.js.gz +0 -0
- package/dist/web/assets/{jira-watcher-section--ibKZfBs.js → jira-watcher-section-B3OaMlim.js} +1 -1
- package/dist/web/assets/{keybindings-store-Cwxl4tHv.js → keybindings-store-C_aRhBu4.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-aoiLpWwf.js → keyboard-shortcuts-section-DXRyKrSy.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-DXRyKrSy.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-DXRyKrSy.js.gz +0 -0
- package/dist/web/assets/{language-servers-section-BkGAezo6.js → language-servers-section-BTs9iuZc.js} +2 -2
- package/dist/web/assets/language-servers-section-BTs9iuZc.js.br +0 -0
- package/dist/web/assets/language-servers-section-BTs9iuZc.js.gz +0 -0
- package/dist/web/assets/{logs-app-DYgPtmjm.js → logs-app-BlhVTOYN.js} +1 -1
- package/dist/web/assets/logs-app-BlhVTOYN.js.br +0 -0
- package/dist/web/assets/logs-app-BlhVTOYN.js.gz +0 -0
- package/dist/web/assets/{logs-tab-BbDosK63.js → logs-tab-kqNARbz0.js} +1 -1
- package/dist/web/assets/{logs-window-content-CEXAyv-f.js → logs-window-content-UUCJJCqG.js} +1 -1
- package/dist/web/assets/{lsp-client-CIcphNmU.js → lsp-client-BTlK_8lb.js} +1 -1
- package/dist/web/assets/lsp-client-BTlK_8lb.js.br +0 -0
- package/dist/web/assets/lsp-client-BTlK_8lb.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-BNzQeoAO.js → markdown-renderer-ClGxDien.js} +1 -1
- package/dist/web/assets/{markdown-renderer-dk1w3goH.js → markdown-renderer-DpsToFFB.js} +1 -1
- package/dist/web/assets/markdown-renderer-DpsToFFB.js.br +0 -0
- package/dist/web/assets/markdown-renderer-DpsToFFB.js.gz +0 -0
- package/dist/web/assets/{mobile-explorer-sheet-D4lPZQZc.js → mobile-explorer-sheet-CybJbScN.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-CybJbScN.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-CybJbScN.js.gz +0 -0
- package/dist/web/assets/{new-design-dialog-CIq7xspW.js → new-design-dialog-9WTgcJoj.js} +1 -1
- package/dist/web/assets/new-design-dialog-9WTgcJoj.js.br +0 -0
- package/dist/web/assets/new-design-dialog-9WTgcJoj.js.gz +0 -0
- package/dist/web/assets/{notification-store-Rv36noYX.js → notification-store-CPVq5ec5.js} +1 -1
- package/dist/web/assets/{notifications-settings-section-CoWMtXCC.js → notifications-settings-section-xrYII-pL.js} +1 -1
- package/dist/web/assets/notifications-settings-section-xrYII-pL.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-xrYII-pL.js.gz +0 -0
- package/dist/web/assets/{ppmbot-settings-section-Ct0UwA6T.js → ppmbot-settings-section-Bc46iDP9.js} +1 -1
- package/dist/web/assets/ppmbot-settings-section-Bc46iDP9.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-Bc46iDP9.js.gz +0 -0
- package/dist/web/assets/{problems-panel-D-HT-0PE.js → problems-panel-D49-Xkzd.js} +1 -1
- package/dist/web/assets/problems-panel-D49-Xkzd.js.br +0 -0
- package/dist/web/assets/problems-panel-D49-Xkzd.js.gz +0 -0
- package/dist/web/assets/{process-table-CXN0s4Pq.js → process-table-NxYTZ0n9.js} +1 -1
- package/dist/web/assets/process-table-NxYTZ0n9.js.br +0 -0
- package/dist/web/assets/process-table-NxYTZ0n9.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-e6WWzP8n.js → proxy-settings-section-Exx7cQc4.js} +1 -1
- package/dist/web/assets/proxy-settings-section-Exx7cQc4.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-Exx7cQc4.js.gz +0 -0
- package/dist/web/assets/{query-tab-C7C67t8F.js → query-tab-BWtJPuxw.js} +1 -1
- package/dist/web/assets/query-tab-BWtJPuxw.js.br +0 -0
- package/dist/web/assets/query-tab-BWtJPuxw.js.gz +0 -0
- package/dist/web/assets/{remote-access-settings-section-gGoATCF9.js → remote-access-settings-section-C4K__DNW.js} +1 -1
- package/dist/web/assets/remote-access-settings-section-C4K__DNW.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-C4K__DNW.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-clipboard-notice-D5KjvMZx.js → remote-desktop-clipboard-notice-DQyysBwL.js} +1 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-DQyysBwL.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-DQyysBwL.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-sheet-CY_DsGXZ.js → remote-desktop-mobile-sheet-DZtEFmgf.js} +2 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-DZtEFmgf.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-DZtEFmgf.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-DdpI-RF8.js → remote-desktop-mobile-view-VW7HdPUX.js} +1 -1
- package/dist/web/assets/remote-desktop-mobile-view-VW7HdPUX.js.br +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-DdpI-RF8.js.gz → remote-desktop-mobile-view-VW7HdPUX.js.gz} +0 -0
- package/dist/web/assets/{remote-desktop-readiness-gate-WIyCCAv5.js → remote-desktop-readiness-gate-B3tuP9Kt.js} +1 -1
- package/dist/web/assets/remote-desktop-readiness-gate-B3tuP9Kt.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-B3tuP9Kt.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-window-content-BMORZLZt.js → remote-desktop-window-content-n0NoDCaE.js} +1 -1
- package/dist/web/assets/remote-desktop-window-content-n0NoDCaE.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-n0NoDCaE.js.gz +0 -0
- package/dist/web/assets/{rename-object-dialog-pIgWe_AL.js → rename-object-dialog-rLTW4A55.js} +1 -1
- package/dist/web/assets/rename-object-dialog-rLTW4A55.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-rLTW4A55.js.gz +0 -0
- package/dist/web/assets/{review-code-oTNcTYlI.js → review-code-DNfsaNO1.js} +1 -1
- package/dist/web/assets/review-code-DNfsaNO1.js.br +0 -0
- package/dist/web/assets/review-code-DNfsaNO1.js.gz +0 -0
- package/dist/web/assets/{save-as-dialog-CnPLGTaL.js → save-as-dialog-BSz8WrNZ.js} +1 -1
- package/dist/web/assets/save-as-dialog-BSz8WrNZ.js.br +0 -0
- package/dist/web/assets/save-as-dialog-BSz8WrNZ.js.gz +0 -0
- package/dist/web/assets/{schedules-settings-section-CREqHG_i.js → schedules-settings-section-DqUZ-H2K.js} +1 -1
- package/dist/web/assets/schedules-settings-section-DqUZ-H2K.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-DqUZ-H2K.js.gz +0 -0
- package/dist/web/assets/{session-review-tab-nFVJYYJH.js → session-review-tab-DKtrFb9y.js} +1 -1
- package/dist/web/assets/session-review-tab-DKtrFb9y.js.br +0 -0
- package/dist/web/assets/session-review-tab-DKtrFb9y.js.gz +0 -0
- package/dist/web/assets/{settings-body-DNzH0wOQ.js → settings-body-C42xA9Dw.js} +1 -1
- package/dist/web/assets/settings-body-C42xA9Dw.js.br +0 -0
- package/dist/web/assets/settings-body-C42xA9Dw.js.gz +0 -0
- package/dist/web/assets/{settings-rows-D02_4sDY.js → settings-rows-C7ZatT9O.js} +1 -1
- package/dist/web/assets/settings-rows-C7ZatT9O.js.br +0 -0
- package/dist/web/assets/settings-rows-C7ZatT9O.js.gz +0 -0
- package/dist/web/assets/{settings-section-content-DWopMfmq.js → settings-section-content-B_iXJpcK.js} +2 -2
- package/dist/web/assets/settings-section-content-B_iXJpcK.js.br +0 -0
- package/dist/web/assets/settings-section-content-B_iXJpcK.js.gz +0 -0
- package/dist/web/assets/settings-section-content-rxfQEQ66.js +1 -0
- package/dist/web/assets/{settings-tab-Cg0v5kO7.js → settings-tab-PRw6OpEb.js} +1 -1
- package/dist/web/assets/{settings-window-content-CqhwxJJn.js → settings-window-content-WITQsGfW.js} +1 -1
- package/dist/web/assets/{slash-command-picker-Bcizxvbh.js → slash-command-picker-DmDs8nOj.js} +1 -1
- package/dist/web/assets/slash-command-picker-DmDs8nOj.js.br +0 -0
- package/dist/web/assets/slash-command-picker-DmDs8nOj.js.gz +0 -0
- package/dist/web/assets/{sql-object-tab-b1Z2zVBm.js → sql-object-tab-D6P4hzkb.js} +1 -1
- package/dist/web/assets/sql-object-tab-D6P4hzkb.js.br +0 -0
- package/dist/web/assets/sql-object-tab-D6P4hzkb.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-DhPv28tq.js → sqlite-viewer-mUitnzHB.js} +1 -1
- package/dist/web/assets/sqlite-viewer-mUitnzHB.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-mUitnzHB.js.gz +0 -0
- package/dist/web/assets/{structure-save-dialog-sGUpqs8D.js → structure-save-dialog-CmbNlmBY.js} +1 -1
- package/dist/web/assets/structure-save-dialog-CmbNlmBY.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-CmbNlmBY.js.gz +0 -0
- package/dist/web/assets/{structure-tab-Bo2OmDOc.js → structure-tab-DCPNuFTe.js} +1 -1
- package/dist/web/assets/structure-tab-DCPNuFTe.js.br +0 -0
- package/dist/web/assets/structure-tab-DCPNuFTe.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-C475Et9u.js → system-monitor-body-BhxyqSqu.js} +2 -2
- package/dist/web/assets/system-monitor-body-BhxyqSqu.js.br +0 -0
- package/dist/web/assets/system-monitor-body-BhxyqSqu.js.gz +0 -0
- package/dist/web/assets/{system-monitor-tab-Cm52yoW8.js → system-monitor-tab-B_miogQI.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-YYsGHxZF.js → system-monitor-window-content-8IogR6tR.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-BKI6QoDa.js → tab-host-window-content-BWHQjgWZ.js} +1 -1
- package/dist/web/assets/tab-host-window-content-BWHQjgWZ.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-BWHQjgWZ.js.gz +0 -0
- package/dist/web/assets/{table-tab-D-nKWMJR.js → table-tab-E3YMueu_.js} +1 -1
- package/dist/web/assets/table-tab-E3YMueu_.js.br +0 -0
- package/dist/web/assets/{table-tab-D-nKWMJR.js.gz → table-tab-E3YMueu_.js.gz} +0 -0
- package/dist/web/assets/{telegram-bot-token-field-BeNS2X2k.js → telegram-bot-token-field-CwW24m62.js} +1 -1
- package/dist/web/assets/telegram-bot-token-field-CwW24m62.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-CwW24m62.js.gz +0 -0
- package/dist/web/assets/{terminal-tab-BbP753Ab.js → terminal-tab-BAe5cWEL.js} +1 -1
- package/dist/web/assets/terminal-tab-BAe5cWEL.js.br +0 -0
- package/dist/web/assets/terminal-tab-BAe5cWEL.js.gz +0 -0
- package/dist/web/assets/{tool-cards-Dh8Ekn2W.js → tool-cards-DrCiSH2r.js} +2 -2
- package/dist/web/assets/tool-cards-DrCiSH2r.js.br +0 -0
- package/dist/web/assets/tool-cards-DrCiSH2r.js.gz +0 -0
- package/dist/web/assets/{tools-settings-section-DGZRIULE.js → tools-settings-section-S-vBr2af.js} +1 -1
- package/dist/web/assets/tools-settings-section-S-vBr2af.js.br +0 -0
- package/dist/web/assets/tools-settings-section-S-vBr2af.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-BxwM-Wkj.js → use-inline-blame-BzVaaCCt.js} +1 -1
- package/dist/web/assets/use-inline-blame-BzVaaCCt.js.br +0 -0
- package/dist/web/assets/use-inline-blame-BzVaaCCt.js.gz +0 -0
- package/dist/web/assets/{use-lsp-BqvwRKmM.js → use-lsp-BwDL9Fqk.js} +1 -1
- package/dist/web/assets/use-lsp-BwDL9Fqk.js.br +0 -0
- package/dist/web/assets/use-lsp-BwDL9Fqk.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-DU0EpDHH.js → use-monaco-theme-DljSc3Xo.js} +1 -1
- package/dist/web/assets/{use-process-kill-CVN_c4KF.js → use-process-kill-YDcDqDtG.js} +1 -1
- package/dist/web/assets/use-process-kill-YDcDqDtG.js.br +0 -0
- package/dist/web/assets/use-process-kill-YDcDqDtG.js.gz +0 -0
- package/dist/web/assets/{use-sql-schema-info-C0wBmR6-.js → use-sql-schema-info-cAI0vn7d.js} +1 -1
- package/dist/web/assets/use-sql-schema-info-cAI0vn7d.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-cAI0vn7d.js.gz +0 -0
- package/dist/web/assets/{use-websocket-K0OUXbbY.js → use-websocket-Djo_ruX_.js} +1 -1
- package/dist/web/assets/{web-preview-tab-DOgLv8Gt.js → web-preview-tab-DXy0hRef.js} +1 -1
- package/dist/web/assets/web-preview-tab-DXy0hRef.js.br +0 -0
- package/dist/web/assets/web-preview-tab-DXy0hRef.js.gz +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/dist/web/sw.js +1 -1
- package/dist/web/sw.js.br +0 -0
- package/dist/web/sw.js.gz +0 -0
- package/docs/architecture/ai-chat-and-providers.md +29 -0
- package/docs/lessons-learned.md +14 -4
- package/package.json +1 -1
- package/src/providers/claude-agent-sdk-query-options.ts +13 -2
- package/src/providers/claude-agent-sdk.ts +112 -30
- package/src/providers/claude-approval-queue.ts +75 -0
- package/src/providers/claude-effort-status.ts +211 -0
- package/src/server/routes/chat.ts +17 -0
- package/src/server/routes/settings.ts +16 -0
- package/src/server/ws/chat-effort-status.ts +73 -0
- package/src/server/ws/chat.ts +30 -3
- package/src/shared/effort-status.ts +128 -0
- package/src/types/api.ts +3 -1
- package/src/types/chat.ts +8 -0
- package/src/web/components/chat/chat-scroll-nav.tsx +12 -8
- package/src/web/components/chat/chat-tab.tsx +15 -11
- package/src/web/components/chat/message-action-bar.tsx +19 -4
- package/src/web/components/chat/message-input.tsx +6 -0
- package/src/web/components/chat/message-list.tsx +55 -21
- package/src/web/components/chat/message-user-bubble.tsx +2 -2
- package/src/web/components/chat/model-thinking-selector-helpers.ts +79 -0
- package/src/web/components/chat/model-thinking-selector.tsx +36 -10
- package/src/web/components/chat/session-changes-context.tsx +29 -1
- package/src/web/components/layout/reparenting-tab.tsx +53 -14
- package/src/web/components/settings/ai-settings-section.tsx +32 -0
- package/src/web/hooks/use-chat.ts +16 -0
- package/src/web/hooks/use-effort-status.ts +46 -0
- package/src/web/hooks/use-relative-time-tick.ts +35 -0
- package/src/web/hooks/use-session-file-changes.ts +5 -1
- package/src/web/hooks/use-tab-overflow.ts +26 -13
- package/src/web/lib/format-date.ts +6 -1
- package/dist/web/assets/accounts-settings-section-CiNmIj02.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-CiNmIj02.js.gz +0 -0
- package/dist/web/assets/agent-session-sheet-DRR36PDA.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-DRR36PDA.js.gz +0 -0
- package/dist/web/assets/agent-session-window-content-DMhy16BM.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-DMhy16BM.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-BG8boPw7.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-BG8boPw7.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-DMGM1hYx.js +0 -1
- package/dist/web/assets/ai-settings-section-DMGM1hYx.js.br +0 -0
- package/dist/web/assets/ai-settings-section-DMGM1hYx.js.gz +0 -0
- package/dist/web/assets/android-tab-lHDxD93G.js.br +0 -0
- package/dist/web/assets/android-tab-lHDxD93G.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-DO-ZyoMj.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-DO-ZyoMj.js.gz +0 -0
- package/dist/web/assets/apps-panel-CH-0CHYY.js.br +0 -0
- package/dist/web/assets/apps-panel-CH-0CHYY.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-CdGtvekz.js.br +0 -0
- package/dist/web/assets/branch-review-tab-CdGtvekz.js.gz +0 -0
- package/dist/web/assets/chat-tab-DMqWnFIo.js.br +0 -0
- package/dist/web/assets/chat-tab-DMqWnFIo.js.gz +0 -0
- package/dist/web/assets/chat-tab-DzWpwPFb.js +0 -19
- package/dist/web/assets/chat-tab-DzWpwPFb.js.br +0 -0
- package/dist/web/assets/chat-tab-DzWpwPFb.js.gz +0 -0
- package/dist/web/assets/code-editor-BCv8ONNS.js.br +0 -0
- package/dist/web/assets/code-editor-BCv8ONNS.js.gz +0 -0
- package/dist/web/assets/codex-reset-credit-button-CGMbIHak.js.br +0 -0
- package/dist/web/assets/conflict-editor-3WmzqBlW.js.br +0 -0
- package/dist/web/assets/conflict-editor-3WmzqBlW.js.gz +0 -0
- package/dist/web/assets/connection-form-tab-BoWucvAe.js.br +0 -0
- package/dist/web/assets/connection-form-tab-BoWucvAe.js.gz +0 -0
- package/dist/web/assets/csv-preview-BCgGsy7F.js.br +0 -0
- package/dist/web/assets/csv-preview-BCgGsy7F.js.gz +0 -0
- package/dist/web/assets/db-tab-parts-o6QMHBbA.js.br +0 -0
- package/dist/web/assets/db-tab-parts-o6QMHBbA.js.gz +0 -0
- package/dist/web/assets/design-settings-section-seo6SdSk.js.br +0 -0
- package/dist/web/assets/design-settings-section-seo6SdSk.js.gz +0 -0
- package/dist/web/assets/design-tab-B-f_b2LM.js.br +0 -0
- package/dist/web/assets/design-tab-B-f_b2LM.js.gz +0 -0
- package/dist/web/assets/designs-sidebar-panel-CVT_TQP7.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-CVT_TQP7.js.gz +0 -0
- package/dist/web/assets/diff-viewer-y9uBp_8u.js.br +0 -0
- package/dist/web/assets/diff-viewer-y9uBp_8u.js.gz +0 -0
- package/dist/web/assets/docx-preview-Dn_x3Inm.js.br +0 -0
- package/dist/web/assets/docx-preview-Dn_x3Inm.js.gz +0 -0
- package/dist/web/assets/editor-dialog-BwNXSajD.js.br +0 -0
- package/dist/web/assets/editor-dialog-BwNXSajD.js.gz +0 -0
- package/dist/web/assets/editor-language-service-XA_TnPLN.js.br +0 -0
- package/dist/web/assets/editor-language-service-XA_TnPLN.js.gz +0 -0
- package/dist/web/assets/explorer-body-DukR7zM9.js.br +0 -0
- package/dist/web/assets/explorer-body-DukR7zM9.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-BjTZ44S3.js.br +0 -0
- package/dist/web/assets/explorer-window-content-BjTZ44S3.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-C4WD1BPQ.js.br +0 -0
- package/dist/web/assets/extension-manager-section-C4WD1BPQ.js.gz +0 -0
- package/dist/web/assets/extension-webview-CV2ujflc.js.br +0 -0
- package/dist/web/assets/extension-webview-CV2ujflc.js.gz +0 -0
- package/dist/web/assets/files-settings-section-hS5ixQ8o.js.br +0 -0
- package/dist/web/assets/files-settings-section-hS5ixQ8o.js.gz +0 -0
- package/dist/web/assets/format-date-CSHaU2wN.js +0 -1
- package/dist/web/assets/general-settings-section-BnKYY0AA.js.br +0 -0
- package/dist/web/assets/general-settings-section-BnKYY0AA.js.gz +0 -0
- package/dist/web/assets/git-log-panel-JiWfR5xv.js.br +0 -0
- package/dist/web/assets/git-log-panel-JiWfR5xv.js.gz +0 -0
- package/dist/web/assets/git-review-tab-DgvcY__Q.js.br +0 -0
- package/dist/web/assets/git-review-tab-DgvcY__Q.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-r1MKxDjz.js.br +0 -0
- package/dist/web/assets/glide-data-grid-r1MKxDjz.js.gz +0 -0
- package/dist/web/assets/grid-save-dialog-Fa0yA-Ep.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-Fa0yA-Ep.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-B2Q8yqSX.js.br +0 -0
- package/dist/web/assets/group-chat-tab-B2Q8yqSX.js.gz +0 -0
- package/dist/web/assets/impexp-tab-B8Ht4l32.js.br +0 -0
- package/dist/web/assets/impexp-tab-B8Ht4l32.js.gz +0 -0
- package/dist/web/assets/index-BtAn_krv.js.br +0 -0
- package/dist/web/assets/index-BtAn_krv.js.gz +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-aoiLpWwf.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-aoiLpWwf.js.gz +0 -0
- package/dist/web/assets/language-servers-section-BkGAezo6.js.br +0 -0
- package/dist/web/assets/language-servers-section-BkGAezo6.js.gz +0 -0
- package/dist/web/assets/logs-app-DYgPtmjm.js.br +0 -0
- package/dist/web/assets/logs-app-DYgPtmjm.js.gz +0 -0
- package/dist/web/assets/lsp-client-CIcphNmU.js.br +0 -0
- package/dist/web/assets/lsp-client-CIcphNmU.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-dk1w3goH.js.br +0 -0
- package/dist/web/assets/markdown-renderer-dk1w3goH.js.gz +0 -0
- package/dist/web/assets/mobile-explorer-sheet-D4lPZQZc.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-D4lPZQZc.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-CIq7xspW.js.br +0 -0
- package/dist/web/assets/new-design-dialog-CIq7xspW.js.gz +0 -0
- package/dist/web/assets/notifications-settings-section-CoWMtXCC.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-CoWMtXCC.js.gz +0 -0
- package/dist/web/assets/ppmbot-settings-section-Ct0UwA6T.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-Ct0UwA6T.js.gz +0 -0
- package/dist/web/assets/problems-panel-D-HT-0PE.js.br +0 -0
- package/dist/web/assets/problems-panel-D-HT-0PE.js.gz +0 -0
- package/dist/web/assets/process-table-CXN0s4Pq.js.br +0 -0
- package/dist/web/assets/process-table-CXN0s4Pq.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-e6WWzP8n.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-e6WWzP8n.js.gz +0 -0
- package/dist/web/assets/query-tab-C7C67t8F.js.br +0 -0
- package/dist/web/assets/query-tab-C7C67t8F.js.gz +0 -0
- package/dist/web/assets/remote-access-settings-section-gGoATCF9.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-gGoATCF9.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-D5KjvMZx.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-D5KjvMZx.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-CY_DsGXZ.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-CY_DsGXZ.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DdpI-RF8.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-WIyCCAv5.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-WIyCCAv5.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-BMORZLZt.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-BMORZLZt.js.gz +0 -0
- package/dist/web/assets/rename-object-dialog-pIgWe_AL.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-pIgWe_AL.js.gz +0 -0
- package/dist/web/assets/review-code-oTNcTYlI.js.br +0 -0
- package/dist/web/assets/review-code-oTNcTYlI.js.gz +0 -0
- package/dist/web/assets/save-as-dialog-CnPLGTaL.js.br +0 -0
- package/dist/web/assets/save-as-dialog-CnPLGTaL.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-CREqHG_i.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-CREqHG_i.js.gz +0 -0
- package/dist/web/assets/session-review-tab-nFVJYYJH.js.br +0 -0
- package/dist/web/assets/session-review-tab-nFVJYYJH.js.gz +0 -0
- package/dist/web/assets/settings-body-DNzH0wOQ.js.br +0 -0
- package/dist/web/assets/settings-body-DNzH0wOQ.js.gz +0 -0
- package/dist/web/assets/settings-rows-D02_4sDY.js.br +0 -0
- package/dist/web/assets/settings-rows-D02_4sDY.js.gz +0 -0
- package/dist/web/assets/settings-section-content-BYW_9mHv.js +0 -1
- package/dist/web/assets/settings-section-content-DWopMfmq.js.br +0 -0
- package/dist/web/assets/settings-section-content-DWopMfmq.js.gz +0 -0
- package/dist/web/assets/slash-command-picker-Bcizxvbh.js.br +0 -0
- package/dist/web/assets/slash-command-picker-Bcizxvbh.js.gz +0 -0
- package/dist/web/assets/sql-object-tab-b1Z2zVBm.js.br +0 -0
- package/dist/web/assets/sql-object-tab-b1Z2zVBm.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-DhPv28tq.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-DhPv28tq.js.gz +0 -0
- package/dist/web/assets/structure-save-dialog-sGUpqs8D.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-sGUpqs8D.js.gz +0 -0
- package/dist/web/assets/structure-tab-Bo2OmDOc.js.br +0 -0
- package/dist/web/assets/structure-tab-Bo2OmDOc.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-C475Et9u.js.br +0 -0
- package/dist/web/assets/system-monitor-body-C475Et9u.js.gz +0 -0
- package/dist/web/assets/tab-host-window-content-BKI6QoDa.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-BKI6QoDa.js.gz +0 -0
- package/dist/web/assets/table-tab-D-nKWMJR.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-BeNS2X2k.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-BeNS2X2k.js.gz +0 -0
- package/dist/web/assets/terminal-tab-BbP753Ab.js.br +0 -0
- package/dist/web/assets/terminal-tab-BbP753Ab.js.gz +0 -0
- package/dist/web/assets/tool-cards-Dh8Ekn2W.js.br +0 -0
- package/dist/web/assets/tool-cards-Dh8Ekn2W.js.gz +0 -0
- package/dist/web/assets/tools-settings-section-DGZRIULE.js.br +0 -0
- package/dist/web/assets/tools-settings-section-DGZRIULE.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-BxwM-Wkj.js.br +0 -0
- package/dist/web/assets/use-inline-blame-BxwM-Wkj.js.gz +0 -0
- package/dist/web/assets/use-lsp-BqvwRKmM.js.br +0 -0
- package/dist/web/assets/use-lsp-BqvwRKmM.js.gz +0 -0
- package/dist/web/assets/use-process-kill-CVN_c4KF.js.br +0 -0
- package/dist/web/assets/use-process-kill-CVN_c4KF.js.gz +0 -0
- package/dist/web/assets/use-sql-schema-info-C0wBmR6-.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-C0wBmR6-.js.gz +0 -0
- package/dist/web/assets/web-preview-tab-DOgLv8Gt.js.br +0 -0
- package/dist/web/assets/web-preview-tab-DOgLv8Gt.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.23.24] - 2026-10-31
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **A chat could send one of your earlier messages again by itself, and act on it.** When a Claude process died, PPM restarted it and re-sent a message to get going again — but it had already thrown away the record of what the chat was doing, so it reached back to the message that *opened* the chat, sometimes hours old, and handed it to Claude as if you had just typed it. On 30 October two chats in different projects replayed their opening instruction within a second of each other after the same crash. A replayed instruction runs for real, so one that published, deployed or changed a database would have done it a second time. A restart now resumes a turn that was interrupted, re-sends your message only when nothing of it had reached Claude yet, and sends nothing at all when the chat was simply idle.
|
|
8
|
+
|
|
9
|
+
## [0.23.23] - 2026-10-30
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Long chats no longer slow down while the AI is answering**: since 0.23.13 every streamed update, ten a second, redrew the whole conversation and parsed all of its Markdown again, so the longer the chat the slower PPM got. Only the message being written is redrawn now, and opening a chat draws each message once instead of twice.
|
|
14
|
+
- **Switching projects no longer loads more of every chat's history each time**: a chat came back scrolled to its top after its project was switched away, which read as the reader scrolling up and fetched another page of older messages on every switch back — so each switch made the next one slower. Chats now come back where you left them.
|
|
15
|
+
- **Switching tabs and projects and typing a `/` command are quicker in long chats**: the row of actions under each answer no longer redraws whenever anything in the chat changes, the tab bar no longer forces the whole page to be laid out each time its tabs change, and the message navigator no longer measures the conversation while it is closed. Times like "5m ago" now update by themselves.
|
|
16
|
+
- **A question from Claude often showed only after the chat was stopped.** Claude Code asks with an AskUserQuestion card, or for a tool approval outside bypass mode, and then sends nothing until it is answered, but PPM handed the question to the chat only when Claude Code's next message arrived. When that never came, the chat sat on "thinking" until it was cancelled, and the card appeared for a turn already over — 7 of the 10 questions in one week's session trace. The question now shows the moment Claude Code asks.
|
|
17
|
+
|
|
18
|
+
- **The chat's effort said High while every Claude turn ran at Max.** Claude Code lets `CLAUDE_CODE_EFFORT_LEVEL` override the effort PPM asks for, from the environment or from the `env` block of a Claude Code settings file such as `~/.claude/settings.json`, and a `maxEffortLevel` there caps it; neither showed in PPM. The model chip now shows the effort the turns actually run at, with a warning sign when something outside PPM decides it, and its picker says what overrides your pick and where it is set — `CLAUDE_CODE_EFFORT_LEVEL=max in ~/.claude/settings.json`, say — while keeping your pick for when it is removed. It also says when the model cannot run the level picked: Extra and Max run as High on a model without them, and Haiku takes no effort level at all. The answer comes from the Claude Code process at the start of each turn; before a chat's first message PPM reads the same settings files. **Settings → AI Provider** shows the same warning under the default Effort.
|
|
19
|
+
|
|
3
20
|
## [0.23.22] - 2026-10-30
|
|
4
21
|
|
|
5
22
|
### Added
|
package/CLAUDE.md
CHANGED
|
@@ -84,7 +84,7 @@ Related: `configService.save()`/`set()` throw when `load()` has not run, because
|
|
|
84
84
|
- **SDK .env poisoning**: Projects with `ANTHROPIC_API_KEY` in `.env` break SDK tool execution. Provider neutralizes these vars. See `docs/lessons-learned.md`.
|
|
85
85
|
- **File watching**: never `fs.watch(dir, { recursive: true })` on a project root — on Linux that is one inotify watch per subdirectory, `node_modules` included (it once cost 359k watches). Ignored dirs must be pruned at registration time via `src/services/file-watcher/watch-tree.ts`.
|
|
86
86
|
- **A file change marks the flat file index stale, and must never make a request walk the project**: `buildIndex` used to walk with `readdirSync` on the main thread while every change dropped the cache and the explorer refetched `/files/index` 300 ms later. nxsys-workspace (181k entries, 22 MB of JSON) is a 6.2 s walk, so a session writing test artefacts into it kept the event loop stopped back to back until the supervisor's health check (5 s timeout, three strikes) killed the server — and every Claude session under it. Now the walk yields every 256 entries on `setTimeout(0)` (`setImmediate` costs 0.002 ms a yield against 1.09 ms, but starved HTTP to a 16 ms p50 against 1.4 ms), a stale list is rebuilt behind the one held, a request waits for that rebuild at most `REBUILD_GRACE_MS` (1 s — enough that an ordinary project answers fresh and a file just created is in the palette on its first open), and `files:index-changed` goes out only when the rebuilt paths differ. The browser does not refetch on a change either: `file:changed` and `files:index-changed` set `indexStale`, and `ensureIndex` refreshes when the palette, the compare picker or the @-picker opens. Two traps. A rebuild runs only when a request asks for one, so a change landing mid-walk is walked again only if a request saw it (`rewalk`) — rebuilding on a timer would keep a core busy for as long as a session keeps writing. And a first walk that no longer stops the server can outlast **Bun.serve's default 10 s idle timeout** (14 s on a busy scratch server), which cuts the request off with the list nearly built; the route calls `server.timeout(req, 30)` through `c.env`, the server `app.fetch(req, server)` passed.
|
|
87
|
-
- **Project Claude settings**: `.claude/settings.local.json`
|
|
87
|
+
- **Project Claude settings**: a project's `.claude/settings.local.json` is never loaded into a chat — `CLAUDE_SETTING_SOURCES` lists `user` and `project` only. Its deny rules would hide tools even under `bypassPermissions` and its `env` can move the chat onto another API key, and the empty `settings` PPM also passes cancels neither, so the source list is the guard. It keeps out that one file only: the project's own `.claude/settings.json` is loaded and can deny tools and set `env` just the same.
|
|
88
88
|
- **Transcript images live in two places**: the base64 payload sits at `message.content[].content[]` inside a tool result, but Claude Code also writes an image-shaped record at the top-level `toolUseResult` field carrying no payload. An assertion like "no `"type":"image"` remains" must be scoped to the former, or it fails against correct code.
|
|
89
89
|
- **Plugin items are named by location, not frontmatter**: Claude Code registers a plugin's skills and commands as `<plugin>:<path>` (`ak-engineer:ak-debug`) and only honours the frontmatter `name` for agents. Kits that self-namespace instead — AgentKit ships `name: ak:debug` — publish a name nothing can resolve. `slash-discovery` mirrors that rule and keeps the declared name as an alias; `src/server/ws/chat.ts` rewrites the alias to the canonical name before the message reaches the SDK.
|
|
90
90
|
- **Codex runs one turn per thread and swallows the second**: a `turn/start` issued while a turn is running does not error — it resolves with the **already-running** turn (same id, `status: "inProgress"`) and discards the new input, so a mid-turn follow-up vanished with nothing to log. `turn/interrupt` is the only way to cut a turn short, and it needs `{threadId, turnId}` (`threadId` alone is rejected); the turn id comes from the `turn/started` notification. A mid-turn follow-up goes in with **`turn/steer`** instead (`{threadId, expectedTurnId, input}`, codex ≥ 0.157): the model reads it at its next step boundary — after the current tool call or message, not after the whole task — and codex emits it as a `userMessage` item in the same turn. Only what cannot be steered (`later`, `now`, an unnamed turn, a compaction, a refused steer) waits in `pendingTurns` for `turn/completed`, which is also what an interrupted turn reports. Before steering existed every follow-up was queued, so a message typed mid-task sat unread until the task ended.
|
|
@@ -185,6 +185,7 @@ Related: `configService.save()`/`set()` throw when `load()` has not run, because
|
|
|
185
185
|
- **Wi-Fi on macOS: `system_profiler` scans, CoreWLAN does not, and the SSID is not PPM's to read**: `system_profiler SPAirPortDataType` looks like a query and is a **scan** — 3.8 s of wall time, and ping to the router went from max 73 ms to 135 ms while it ran, a network hitch on the machine being monitored. `CWWiFiClient.sharedWiFiClient().interface()` over the Objective-C runtime answers RSSI, noise, transmit rate, channel and band in 5–10 ms without scanning (`wifi-darwin.ts`: every id a u64, each message guarded by `class_respondsToSelector`, each read in its own autorelease pool). The SSID is nil without the Location permission, which a server process cannot obtain, so that row stays an em dash.
|
|
186
186
|
- **Whisper invents speech out of silence, and in Vietnamese it invents the same YouTube outro every time**: six seconds of digital silence transcribes as "Hãy subscribe cho kênh Ghiền Mì Gõ Để không bỏ lỡ những video hấp dẫn" on both `small` and `large-v3-turbo`, and pink noise as "Cảm ơn các bạn đã theo dõi và hẹn gặp lại." — so the Silero VAD model (885 KB) is downloaded beside every speech model and `--vad` is not a tuning knob: with it both come back empty, and in 0.3s rather than seconds. Four more traps in the same install. The browser's own recording is **not** a format whisper.cpp can read — Chrome records Opus in WebM, Firefox Opus in Ogg, Safari AAC in MP4, while whisper reads wav/flac/mp3/Vorbis-ogg — so the conversion is done in the browser (`recordingToWav`, an `OfflineAudioContext` at 16 kHz, which is also what makes the upload 32 KB/s), because doing it on the host would mean requiring ffmpeg there as well. The published Linux build needs **glibc 2.34** and GCC 11's libstdc++, so on an older host (Ubuntu 20.04 is 2.31) every file downloads fine and only the first sentence fails — the installer runs `whisper-cli --help` once so that surfaces as an install error naming the cause. macOS has **no** CLI in the release at all (its asset is an xcframework, a library for Swift apps), so a Mac installs Homebrew's `whisper.cpp` and PPM looks for `whisper-cli` at `/opt/homebrew/bin` and `/usr/local/bin` as well as on PATH — a launchd-started PPM has neither prefix in its PATH. And whisper.cpp defaults to **4 threads**, which is worth raising and worth capping: on a 24-thread i9-12900K a 10s clip took 12.0s at 4 threads, 8.1s at 8, 5.6s at 16 and 5.4s at 24. The VAD is not quite the end of it either: it stops every non-speech clip measured here (silence, white noise at four levels, 50 Hz hum, a 440 Hz tone, brown noise, typing, a cough, a breath, room tone — each of which *without* it comes back as that same one sentence, byte for byte), but a live install still produced it, so `whisper-hallucinations.ts` drops the invented sentence by whole segment — `-nt` prints one line per segment, which is what makes dropping one safe when real speech sits either side. The two knobs that look like the fix are not: `--suppress-nst` changes nothing at all, and `-nth 0.3` empties the invented sentence **and** a perfectly clear 10s dictation with it.
|
|
187
187
|
- **MCP sign-in works in SDK mode, through methods `sdk.d.ts` does not declare**: a server the CLI reports as `needs-auth` (an HTTP server with OAuth such as Vanta, every plugin connector) used to be unusable from PPM because the CLI's `/mcp` screen does not exist without a terminal — and the model, reading the CLI's own "this session is non-interactive" hint, told users to go and open one. The `Query` object in fact carries `mcpAuthenticate(name, redirectUri?)` and `mcpSubmitOAuthCallbackUrl(name, url)` (in `sdk.mjs`, stripped from the typings), and a **prompt-less** streaming `query()` answers them — and `mcpServerStatus()` — in about a second with no model call. `src/services/mcp-oauth/` runs each sign-in in a subprocess of its own, and that process has to outlive the dialog's request: with the default `redirectScheme: "localhost"` the CLI's callback listener lives *inside* it, so closing it early strands the browser on a dead page. An https origin gets `redirectUri` pointed at PPM's public `GET /api/mcp-auth/callback` instead, which is what makes a phone over a tunnel work (Vanta accepts it); plain http falls back to the localhost listener plus a paste box. Four traps. The tokens land in the CLI's shared credential store, so a *running* chat still reports the server `needs-auth` until `reconnectMcpServer` is called in it — `chat-mcp-sign-in-sync.ts` does that, and drops an idle subprocess that still cannot see them. claude.ai connectors (`claude.ai <name>`, scope `claudeai`) answer "Server not found" to `mcp_authenticate` in SDK mode, so the UI sends them to claude.ai's connector settings rather than starting a flow that cannot succeed. The expiry timer only starts once there is a link, so `mcpAuthenticate` and the status probe's reads are wrapped in `withTimeout` — a CLI that never answers would otherwise hold its subprocess for as long as PPM runs, and every caller shares the probe. And in an e2e, Bun's `fetch` reuses a pooled socket the server has already closed after a long idle stretch, so a request silently never arrives: that read as a hung sign-in until the server log showed no `starting sign-in` line for it — `tests/e2e/mcp-sign-in-e2e.mjs` sends `Connection: close`. `tests/unit/services/mcp-oauth-flows.test.ts` greps `sdk.mjs` for the undeclared methods so an SDK upgrade that renames them fails a test rather than the button.
|
|
188
|
+
- **PPM's effort pick is only Claude Code's `--effort`, and three things outrank it**: `CLAUDE_CODE_EFFORT_LEVEL`, from the environment or the `env` block of *any* settings file (measured by the CLI's own answer: a settings file beats the environment — `low` exported under a user setting of `max` gives `max`); a `maxEffortLevel` in any settings file, lowest wins; and the model, which runs Extra/Max as High where it lacks them and takes none at all on Haiku. A user with `"env": { "CLAUDE_CODE_EFFORT_LEVEL": "max" }` in `~/.claude/settings.json` ran every chat at Max under a picker that said High. Only the CLI knows the result: `Query.getSettings()` (in `sdk.mjs`, not in `sdk.d.ts`; `claude-effort-status.test.ts` pins it) answers `applied.effort` plus the settings `sources` in a few ms, while the `system/init` message's `effort` field is absent for SDK sessions — so `ws/chat.ts` asks at every turn's `init` (`chat-effort-status.ts`), and before a session's first turn `claude-effort-status.ts` reads the settings files the chat loads (`CLAUDE_SETTING_SOURCES`), which cannot see managed settings or an organization's per-model cap. `applied.effort` is the session's level, not what a single request carries: some models (Opus 5) clamp it to High per request while thinking is off, and that shows nowhere.
|
|
188
189
|
|
|
189
190
|
- **A design canvas trusts a message for its nonce, not its source, and the frame only ever proposes writes**: a `sandbox="allow-scripts"` frame can still navigate itself, and the page it lands on *is* the iframe's `contentWindow`, so an `event.source` check alone accepts a foreign page. The parent also requires the per-load nonce (`?n=`), the bridge blocks link clicks and `navigate` in the frame, and `connect-src` own-source plus the 3 s liveness reload are the boundary (`'unsafe-eval'` adds nothing `'unsafe-inline'` does not). A shell `frame-src` would hard-block self-navigation but also stop html-preview frames following external links; that decision is still open, so no shell header is sent. A `transform-commit` is written only if `design-transform-proposal.ts` finds Move on, the parent's own target, the `ready` gen and `navigator.userActivation.isActive`, and the server then re-checks gen and tag and rate-limits. The same parent-window rule is why a design never goes into picture-in-picture (`NON_PIP_TAB_TYPES`): in PiP the iframe's parent would be the PiP window. A floating window keeps the iframe in the main document, which is why a design may (and on a desktop by default does) open in one.
|
|
190
191
|
- **A design canvas reloads by getting a new `src`, and every `ready` is a new document**: the frame's origin is opaque, so `location.reload()` is not the parent's to call; `use-design-canvas.ts` sets a new URL with a new nonce. The tab pool reparenting the iframe (a split, a moved tab) reloads it too, with the *same* `src` and nonce, so frame-side state must be restored from `bridge.onReplay` on every `ready`, not once. `data-ppm-id` is the start-tag offset in one version of the file: valid only with the `gen` it came with, and a comment whose text cannot be found again is Detached rather than guessed.
|
|
@@ -204,6 +205,7 @@ Related: `configService.save()`/`set()` throw when `load()` has not run, because
|
|
|
204
205
|
- **The pre-migration database snapshot is skipped whenever `CURRENT_SCHEMA_VERSION` lags the migrations**: `backupBeforeMigrations` returns early for a database already at that version, and the constant sat at 47 while migrations reached 49, so a database at 47 ran 48 and 49 with no snapshot. Bump it with every migration; `db-session-design-slug.test.ts` asserts a migrated database ends at it.
|
|
205
206
|
- **A PreToolUse hook verdict needs `hookSpecificOutput.hookEventName: "PreToolUse"`**: the bundled CLI reads `permissionDecision` only when the event name matches ("Hook returned incorrect event name" otherwise), so without it a Deny the user clicked did not block the tool. `preToolUseDecision()` in `claude-agent-sdk-query-options.ts` builds every verdict.
|
|
206
207
|
- **A chat subprocess cannot renew its own sign-in, so PPM renews while the account is quiet**: the token reaches the CLI as `CLAUDE_CODE_OAUTH_TOKEN`, which carries no refresh token, and on a 401 the CLI deliberately keeps a user-supplied token rather than adopting one from disk. Its two renewal hooks are closed to PPM: the SDK's `getOAuthToken` callback (undeclared in `sdk.d.ts`) is registered only when `CLAUDE_CODE_ENTRYPOINT` is `claude-desktop`, `local-agent` or `claude-vscode` — PPM sends `ppm`, and borrowing another client's label would misreport it to Anthropic — and the rotated-token file is the hard-coded cloud path `/home/claude/.claude/remote/.oauth_token`, cached after the first read. Renewing revokes the previous token, so a renewal used to cut whichever turn was running (a 401, the provider rebuilding the subprocess, every subagent inside it dying, "Token refreshed — retrying" in the chat). `src/server/ws/chat-token-rotation.ts` renews inside two hours of expiry only while no turn, approval or background work runs on that account, and drops idle subprocesses still holding a replaced token (`liveSubprocessCredentials()` on the provider). Verify with `tests/e2e/token-rotation-e2e.mjs`, which runs the real CLI against `fixtures/fake-anthropic-api.ts`.
|
|
208
|
+
- **An approval the Claude CLI asks for must wake the turn's loop, never wait for the next SDK message**: the CLI sends a control request and then nothing at all until it is answered. A queue handed out "when the next message arrives" therefore hung whenever the turn's last message was processed before `canUseTool` ran. The AskUserQuestion card stayed behind a thinking spinner until the user cancelled (17 minutes in one trace), and appeared only after the abort. `ApprovalQueue.alongside()` (`src/providers/claude-approval-queue.ts`) is what the loop iterates. Anything raised from the CLI's callbacks has to go through it. A mock CLI that emits a status after asking (as `cliFactory` in `claude-agent-sdk.test.ts` does) hides the bug, which is why `an approval the CLI is waiting on` sends nothing after the tool_use.
|
|
207
209
|
- **Playwright's `evaluate` is a user gesture, and so is every poll**: `navigator.userActivation.isActive` turns true for about 5 s after a `frame.evaluate`, in the parent too, so a "no gesture" test that polls for its result re-arms the activation it is testing and the forged write goes through. `design-mode-e2e.mjs` posts the forgery from a page timer 7 s after the last evaluate and reads the outcome from console messages, which Playwright observes without touching either document.
|
|
208
210
|
- **pptxgenjs 4.x takes `rectRadius` in inches**: its typings say 0–1, but the writer converts inches into OOXML's fraction of the shorter side, so a fraction gives almost square corners. `pptx-slide-mapper.ts` converts px to inches and clamps to half the shorter side.
|
|
209
211
|
- **A browser-cache hydrator in a lazy chunk registers after boot hydration has finished**: `hydrateProjectCache` (`src/web/lib/browser-cache/project-cache-hydration.ts`) runs once per project at boot and on `switchProject`, but `slash-items-cache.ts` loaded only with the lazy chat chunk, so it registered after the project was already marked hydrated. Its IndexedDB copy was never read, and the `/` list waited for the network after every reload, while every unit test passed. Registration now runs a late hydrator for projects that are already hydrated, and `app.tsx` imports the slash cache eagerly. A new cache owner needs the same check. Related: a new chat tab is resolved in `panel-store.openTab` rather than in the gate, because the gate's `pending` is a prop and anything it does in render or in an effect lands after the first paint.
|
package/README.md
CHANGED
|
@@ -308,7 +308,7 @@ For architecture details, API reference, and contribution guidelines, see the [d
|
|
|
308
308
|
|
|
309
309
|
- **SDK .env poisoning**: Projects with `ANTHROPIC_API_KEY` in `.env` can break SDK tool execution. PPM neutralizes these vars automatically.
|
|
310
310
|
- **Claude CLI discovery**: PPM looks for the `claude` CLI on PATH, in the usual install locations, and in the `cli/` folder shipped beside the binary. If none is found, point at it with `PPM_CLAUDE_CLI=/path/to/claude`.
|
|
311
|
-
- **Project Claude settings**: a project's `.claude/settings.local.json` can restrict tools even under bypass permissions; PPM
|
|
311
|
+
- **Project Claude settings**: a project's `.claude/settings.local.json` can restrict tools even under bypass permissions; PPM leaves that file out of its chats so chat tools keep working.
|
|
312
312
|
|
|
313
313
|
---
|
|
314
314
|
|
|
@@ -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.
|
|
76
|
+
<!-- Generated for PPM v0.23.24 at build time. Re-run `ppm export skill --install` to refresh. -->
|
|
@@ -323,6 +323,7 @@ _Base URL: `http://localhost:8080` (default; override via `ppm config set port <
|
|
|
323
323
|
- `GET /api/settings/ai/providers/status`
|
|
324
324
|
- `POST /api/settings/ai/providers/:id/probe`
|
|
325
325
|
- `GET /api/settings/ai/providers/:id/models`
|
|
326
|
+
- `GET /api/settings/ai/providers/:id/effort-status`
|
|
326
327
|
- `GET /api/settings/keybindings`
|
|
327
328
|
- `PUT /api/settings/keybindings`
|
|
328
329
|
- `GET /api/settings/telegram`
|
|
@@ -490,4 +491,4 @@ _Base URL: `http://localhost:8080` (default; override via `ppm config set port <
|
|
|
490
491
|
- `ws://<host>/ws/terminal` — PTY terminal multiplexer
|
|
491
492
|
- `ws://<host>/ws/extensions` — extension host channel
|
|
492
493
|
|
|
493
|
-
<!-- Generated from src/server/routes/ for PPM v0.23.
|
|
494
|
+
<!-- Generated from src/server/routes/ for PPM v0.23.24 -->
|
|
@@ -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-BwyIKaTT.js";import{a as h}from"./api-client-xQDlhUTu.js";import{n as g}from"./utils-Bslrbb-G.js";import"./portal-container-context-NBi-KGK0.js";import"./chat-preparation-cache-190LLyy7.js";import{n as _}from"./use-is-mobile-VRV9eZy1.js";import{r as v}from"./clipboard-D-VCry-F.js";import{r as y,t as b}from"./button-C9ZXWb3b.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./dialog-Dn_2tuYa.js";import{t as D}from"./mobile-bottom-sheet-DArbIyrD.js";import"./use-visual-viewport-MmugpRg-.js";import{t as O}from"./input-C3oVNCMq.js";import{Ai as k,Er as A,Gi as j,Gn as M,Hn as N,Kn as P,Ui as F,Un as I,Vn as ee,Wi as L,Wn as te}from"./index-BtAn_krv.js";import{_ as ne,a as re,h as ie,m as ae,o as oe,p as se,r as ce,v as le,x as R,y as ue}from"./api-settings-vmIRFNwZ.js";import{_ as de,a as fe,b as pe,c as me,d as he,g as z,h as B,l as ge,m as _e,n as ve,o as ye,p as V,r as be,s as H,t as xe,u as Se,x as U,y as W}from"./codex-reset-credit-button-CGMbIHak.js";var G=e(t(),1),K=n(),q=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],J=Array.from({length:24},(e,t)=>t);function Ce(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 we(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 Te(e){return J.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 Y(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 Ee(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function De({accountId:e}){let[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(!0),[a,o]=(0,G.useState)(`5h`);(0,G.useEffect)(()=>{i(!0),se(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,G.useMemo)(()=>t?Ce(t,a):null,[t,a]),c=(0,G.useMemo)(()=>s?we(s):[],[s]),l=(0,G.useMemo)(()=>s?Te(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,K.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,K.jsx)(m,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,K.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,K.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,K.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,K.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,K.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,K.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,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,K.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:q.map((e,t)=>{let n=c[t]??0;return(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,K.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,K.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Ee(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,K.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,K.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:J.map(e=>{let t=l[e]??0;return(0,K.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,K.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${Y(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[q.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),J.map(n=>{let r=s[t][n];return(0,K.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${Y(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,K.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,K.jsx)(`span`,{className:`w-4 shrink-0`}),J.map(e=>(0,K.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,K.jsx)(`span`,{children:`Low`}),(0,K.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,K.jsx)(`span`,{children:`High`}),(0,K.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,K.jsx)(`span`,{children:`No data`})]})]})}function Oe({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,K.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,K.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,K.jsx)(d,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,K.jsxs)(`span`,{className:`contents`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,K.jsx)(De,{accountId:t})]})}function ke({display:e,onConfirm:t,onCancel:n}){let r=_(),i=(0,K.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,K.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,K.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,K.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,K.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,K.jsx)(b,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,K.jsx)(b,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,K.jsx)(D,{open:!0,onClose:n,children:(0,K.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,K.jsx)(E,{open:!0,onOpenChange:e=>{e||n()},children:(0,K.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,K.jsx)(x,{children:(0,K.jsx)(w,{className:`text-sm`,children:`Remove account`})}),i]})})}function Ae(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 je({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:a}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,G.useState)(new Set),[l,d]=(0,G.useState)(``),[f,g]=(0,G.useState)(!1),[_,y]=(0,G.useState)(!1),[D,k]=(0,G.useState)(!1),[j,M]=(0,G.useState)(!1);e&&!j&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),M(!0)),!e&&j&&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!`):(Ae(o),a?.(`Backup downloaded.`)),N()}catch{}k(!1)}let F=s.size>0&&!D;return(0,K.jsx)(E,{open:e,onOpenChange:e=>{e||N()},children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(i,{className:`size-3.5`}),` Export Accounts`]}),(0,K.jsx)(T,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,K.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,K.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,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,K.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.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,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(A,{className:`text-xs`,children:[`Password `,(0,K.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>g(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,K.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:_,onChange:e=>y(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,K.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,K.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):_?(0,K.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,K.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,K.jsxs)(S,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:N,children:`Cancel`}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!0),children:[(0,K.jsx)(p,{className:`size-3 mr-1`}),` Copy`]}),(0,K.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!1),children:D?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Me({open:e,onOpenChange:t,onSuccess:n}){let[r,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null);function f(){t(!1),a(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await ae({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,K.jsx)(E,{open:e,onOpenChange:e=>{e||f()},children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(i,{className:`size-3.5`}),` Import Accounts`]}),(0,K.jsx)(T,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(A,{className:`text-xs`,children:`Backup data`}),(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(A,{className:`text-xs`,children:[`Password `,(0,K.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,K.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,K.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,K.jsxs)(S,{children:[(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,K.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var X=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Ne(e){return X?.addEventListener(`change`,e),()=>X?.removeEventListener(`change`,e)}function Pe(){return X?.matches??!0}function Z(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{r(!0),oe().then(t).finally(()=>r(!1))},[]),n?(0,K.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,K.jsxs)(ee,{value:e.strategy,onValueChange:async e=>{t(await R({strategy:e}))},children:[(0,K.jsx)(te,{className:`w-full h-9 text-xs`,children:(0,K.jsx)(M,{})}),(0,K.jsxs)(N,{children:[(0,K.jsx)(I,{value:`round-robin`,children:`Round-robin`}),(0,K.jsx)(I,{value:`fill-first`,children:`Fill-first`}),(0,K.jsx)(I,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,K.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 R({maxRetry:n}))}}),(0,K.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,K.jsx)(P,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await R({cooldownEnabled:e}))}})]}),(0,K.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,K.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,K.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,K.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,K.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function Fe({open:e,onOpenChange:t}){let n=(0,G.useSyncExternalStore)(Ne,Pe);return e?n?(0,K.jsx)(E,{open:e,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,K.jsx)(x,{children:(0,K.jsxs)(w,{className:`text-sm flex items-center gap-2`,children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation & Retry`]})}),(0,K.jsx)(Z,{})]})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.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,K.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,K.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,K.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,K.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation & Retry`]}),(0,K.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,K.jsx)(d,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,K.jsx)(Z,{})})]})]}):null}var Ie=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 Q({className:e,variant:t,...n}){return(0,K.jsx)(`div`,{className:g(Ie({variant:t}),e),...n})}function Le(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function Re({accounts:e}){let[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(new Map),l=e.filter(e=>e.hasRefreshToken);async function u(){if(l.length!==0){i(!0);try{let e=await le(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 ue(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,K.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,K.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,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(P,{id:`sim-include-refresh`,checked:a,onCheckedChange:o,className:`cursor-pointer`}),(0,K.jsx)(A,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,K.jsx)(b,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void u(),children:r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,K.jsx)(Q,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,K.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,K.jsx)(Q,{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,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,K.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Le(e.expires)}),e.token?(0,K.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,K.jsx)(m,{className:`size-3 animate-spin`}):`Test`}):(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,K.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 ze(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 Be({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,G.useState)(new Map),[o,s]=(0,G.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,K.jsx)(E,{open:e,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,K.jsx)(T,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,K.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(P,{id:`token-test-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,K.jsx)(A,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:l,children:`Test all`})]})]}),n.length===0&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,K.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,K.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ze(e.expiresAt)})]}),(0,K.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,K.jsx)(m,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,K.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,K.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,K.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,K.jsx)(Re,{accounts:n})]}),(0,K.jsx)(S,{children:(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function Ve(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:o,flashIds:s,reload:d}=ge(),[p,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[T,E]=(0,G.useState)(null),[D,O]=(0,G.useState)(void 0);function k(e){d(),e&&h(e)}async function A(e,t){_(e);try{await ie(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){h(e.message)}_(null),d()}async function j(){if(v){try{await ce(v.id),h(`Account "${v.display}" removed.`),d()}catch(e){h(`Failed to remove: ${e.message}`)}y(null)}}let M=new Map(t.map(e=>[e.id,e])),N=e[0]?.usage.lastFetchedAt;return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(B,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void d(),refreshing:o,disabled:i,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{O(void 0),E(`add`)},children:[(0,K.jsx)(l,{className:`size-4`}),` Add account`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{w(null),E(`export`)},children:[(0,K.jsx)(u,{className:`size-4`}),` Export`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`import`),children:[(0,K.jsx)(c,{className:`size-4`}),` Import`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`rotation`),children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`token-test`),children:[(0,K.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,K.jsx)(z,{message:p,onDismiss:()=>h(null)}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),N&&(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,pe(new Date(N).getTime())]})]}),i?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,K.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,K.jsx)(V,{children:e.map(e=>(0,K.jsx)(Se,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:M.get(e.accountId),onToggle:A,toggling:g===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onExport:e=>{w(e),E(`export`)},onViewProfile:(e,t)=>S({profile:e,accountId:t}),onReauth:()=>{O({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),E(`add`)},flash:s.has(e.accountId)},e.accountId))})]}),x&&(0,K.jsx)(Oe,{profile:x.profile,accountId:x.accountId,onClose:()=>S(null)}),v&&(0,K.jsx)(ke,{display:v.display,onConfirm:()=>void j(),onCancel:()=>y(null)}),(0,K.jsx)(me,{open:T===`add`,onOpenChange:e=>{E(e?`add`:null),e||O(void 0)},onSuccess:k,signInAgainFor:D}),(0,K.jsx)(je,{open:T===`export`,onOpenChange:e=>{E(e?`export`:null),e||w(null)},accounts:t,preselectId:C,onMessage:h}),(0,K.jsx)(Me,{open:T===`import`,onOpenChange:e=>E(e?`import`:null),onSuccess:k}),(0,K.jsx)(Fe,{open:T===`rotation`,onOpenChange:e=>E(e?`rotation`:null)}),(0,K.jsx)(Be,{open:T===`token-test`,onOpenChange:e=>E(e?`token-test`:null),accounts:t})]})}function He({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:a,onExport:o,onImport:s,error:l}){let d=(0,G.useRef)(null),f=e===`export`;return(0,K.jsx)(E,{open:e!==null,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(i,{className:`size-4`}),` `,f?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(A,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,K.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,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,K.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,K.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,K.jsxs)(S,{children:[(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,K.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,K.jsx)(m,{className:`size-3.5 animate-spin`}):f?(0,K.jsx)(u,{className:`size-3.5`}):(0,K.jsx)(c,{className:`size-3.5`}),f?`Download backup`:`Choose file`]})]})]})})}var Ue=[{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 We({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,K.jsx)(E,{open:e,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsx)(w,{className:`text-sm`,children:`Codex Rotation`}),(0,K.jsx)(T,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:Ue.map(e=>(0,K.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,K.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,K.jsx)(S,{children:(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function $(e){return e==null?null:Math.round(e*100)}function Ge({usage:e}){let t=e.session==null&&e.weekly==null;return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,K.jsx)(W,{label:`5-Hour Session`,pct:$(e.fiveHour),reset:U(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,K.jsx)(W,{label:`Weekly`,pct:$(e.sevenDay),reset:U(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function Ke(){let[e,t]=(0,G.useState)(null),n=fe(()=>t(null)),[r,i]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(B,{description:(0,K.jsxs)(K.Fragment,{children:[`Each Codex account keeps its own login (`,(0,K.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,K.jsx)(l,{className:`size-4`}),` Add account`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,K.jsx)(u,{className:`size-4`}),` Export`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,K.jsx)(c,{className:`size-4`}),` Import`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation`]})]})}),(0,K.jsx)(z,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,K.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,K.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,K.jsx)(V,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,K.jsxs)(_e,{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,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,K.jsx)(de,{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,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),H(e.planType)&&(0,K.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:H(e.planType)}),(0,K.jsx)(P,{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,K.jsxs)(F,{children:[(0,K.jsx)(j,{asChild:!0,children:(0,K.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,K.jsx)(s,{className:`size-4`})})}),(0,K.jsx)(L,{side:`top`,children:`Remove account`})]})]}),(0,K.jsx)(Ge,{usage:t}),t.resetCredits&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,K.jsx)(he,{credits:t.resetCredits}),(0,K.jsx)(xe,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=ye(t.weekly);return r?(0,K.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,K.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,K.jsx)(`span`,{children:`Daily guard`}),(0,K.jsxs)(F,{children:[(0,K.jsx)(j,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,K.jsx)(o,{className:`size-3.5`})})}),(0,K.jsx)(L,{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,K.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,K.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,K.jsx)(P,{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,K.jsx)(be,{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,K.jsx)(He,{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,K.jsx)(ve,{account:r,onClose:()=>i(null),onDone:()=>void n.load()}),(0,K.jsx)(We,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var qe=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}];function Je(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(`claude`);(0,G.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=qe.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,K.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,K.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,K.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,K.jsx)(k,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,K.jsx)(Ve,{}):(0,K.jsx)(Ke,{})]})}export{Je 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-BwyIKaTT.js";import{a as h}from"./api-client-xQDlhUTu.js";import{n as g}from"./utils-Bslrbb-G.js";import"./portal-container-context-NBi-KGK0.js";import"./chat-preparation-cache-190LLyy7.js";import{n as _}from"./use-is-mobile-VRV9eZy1.js";import{r as v}from"./clipboard-D-VCry-F.js";import{r as y,t as b}from"./button-C9ZXWb3b.js";import{a as x,i as S,n as C,o as w,r as T,t as E}from"./dialog-Dn_2tuYa.js";import{t as D}from"./mobile-bottom-sheet-DArbIyrD.js";import"./use-visual-viewport-MmugpRg-.js";import{t as O}from"./input-C3oVNCMq.js";import{Ai as k,Er as A,Gi as j,Gn as M,Hn as N,Kn as P,Ui as F,Un as I,Vn as ee,Wi as L,Wn as te}from"./index-D8QDpdgs.js";import{_ as ne,a as re,h as ie,m as ae,o as oe,p as se,r as ce,v as le,x as R,y as ue}from"./api-settings-vmIRFNwZ.js";import{_ as de,a as fe,b as pe,c as me,d as he,g as z,h as B,l as ge,m as _e,n as ve,o as ye,p as V,r as be,s as H,t as xe,u as Se,x as U,y as W}from"./codex-reset-credit-button-tIwfnf2G.js";var G=e(t(),1),K=n(),q=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],J=Array.from({length:24},(e,t)=>t);function Ce(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 we(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 Te(e){return J.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 Y(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 Ee(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function De({accountId:e}){let[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(!0),[a,o]=(0,G.useState)(`5h`);(0,G.useEffect)(()=>{i(!0),se(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,G.useMemo)(()=>t?Ce(t,a):null,[t,a]),c=(0,G.useMemo)(()=>s?we(s):[],[s]),l=(0,G.useMemo)(()=>s?Te(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,K.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,K.jsx)(m,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,K.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,K.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,K.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,K.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,K.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,K.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,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,K.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:q.map((e,t)=>{let n=c[t]??0;return(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,K.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,K.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Ee(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,K.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,K.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:J.map(e=>{let t=l[e]??0;return(0,K.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,K.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${Y(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[q.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),J.map(n=>{let r=s[t][n];return(0,K.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${Y(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,K.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,K.jsx)(`span`,{className:`w-4 shrink-0`}),J.map(e=>(0,K.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,K.jsx)(`span`,{children:`Low`}),(0,K.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,K.jsx)(`span`,{children:`High`}),(0,K.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,K.jsx)(`span`,{children:`No data`})]})]})}function Oe({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,K.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,K.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,K.jsx)(d,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,K.jsxs)(`span`,{className:`contents`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,K.jsx)(De,{accountId:t})]})}function ke({display:e,onConfirm:t,onCancel:n}){let r=_(),i=(0,K.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,K.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,K.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,K.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,K.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,K.jsx)(b,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,K.jsx)(b,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,K.jsx)(D,{open:!0,onClose:n,children:(0,K.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,K.jsx)(E,{open:!0,onOpenChange:e=>{e||n()},children:(0,K.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,K.jsx)(x,{children:(0,K.jsx)(w,{className:`text-sm`,children:`Remove account`})}),i]})})}function Ae(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 je({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:a}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,G.useState)(new Set),[l,d]=(0,G.useState)(``),[f,g]=(0,G.useState)(!1),[_,y]=(0,G.useState)(!1),[D,k]=(0,G.useState)(!1),[j,M]=(0,G.useState)(!1);e&&!j&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),M(!0)),!e&&j&&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!`):(Ae(o),a?.(`Backup downloaded.`)),N()}catch{}k(!1)}let F=s.size>0&&!D;return(0,K.jsx)(E,{open:e,onOpenChange:e=>{e||N()},children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(i,{className:`size-3.5`}),` Export Accounts`]}),(0,K.jsx)(T,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,K.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,K.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,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,K.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.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,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(A,{className:`text-xs`,children:[`Password `,(0,K.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>g(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,K.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:_,onChange:e=>y(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,K.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,K.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):_?(0,K.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,K.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,K.jsxs)(S,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:N,children:`Cancel`}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!0),children:[(0,K.jsx)(p,{className:`size-3 mr-1`}),` Copy`]}),(0,K.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!1),children:D?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Me({open:e,onOpenChange:t,onSuccess:n}){let[r,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null);function f(){t(!1),a(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await ae({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,K.jsx)(E,{open:e,onOpenChange:e=>{e||f()},children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(i,{className:`size-3.5`}),` Import Accounts`]}),(0,K.jsx)(T,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(A,{className:`text-xs`,children:`Backup data`}),(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(A,{className:`text-xs`,children:[`Password `,(0,K.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,K.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,K.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,K.jsxs)(S,{children:[(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,K.jsx)(b,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var X=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Ne(e){return X?.addEventListener(`change`,e),()=>X?.removeEventListener(`change`,e)}function Pe(){return X?.matches??!0}function Z(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{r(!0),oe().then(t).finally(()=>r(!1))},[]),n?(0,K.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,K.jsxs)(ee,{value:e.strategy,onValueChange:async e=>{t(await R({strategy:e}))},children:[(0,K.jsx)(te,{className:`w-full h-9 text-xs`,children:(0,K.jsx)(M,{})}),(0,K.jsxs)(N,{children:[(0,K.jsx)(I,{value:`round-robin`,children:`Round-robin`}),(0,K.jsx)(I,{value:`fill-first`,children:`Fill-first`}),(0,K.jsx)(I,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,K.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 R({maxRetry:n}))}}),(0,K.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,K.jsx)(P,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await R({cooldownEnabled:e}))}})]}),(0,K.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,K.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,K.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,K.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,K.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function Fe({open:e,onOpenChange:t}){let n=(0,G.useSyncExternalStore)(Ne,Pe);return e?n?(0,K.jsx)(E,{open:e,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,K.jsx)(x,{children:(0,K.jsxs)(w,{className:`text-sm flex items-center gap-2`,children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation & Retry`]})}),(0,K.jsx)(Z,{})]})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.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,K.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,K.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,K.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,K.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation & Retry`]}),(0,K.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,K.jsx)(d,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,K.jsx)(Z,{})})]})]}):null}var Ie=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 Q({className:e,variant:t,...n}){return(0,K.jsx)(`div`,{className:g(Ie({variant:t}),e),...n})}function Le(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function Re({accounts:e}){let[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(new Map),l=e.filter(e=>e.hasRefreshToken);async function u(){if(l.length!==0){i(!0);try{let e=await le(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 ue(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,K.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,K.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,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(P,{id:`sim-include-refresh`,checked:a,onCheckedChange:o,className:`cursor-pointer`}),(0,K.jsx)(A,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,K.jsx)(b,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void u(),children:r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,K.jsx)(Q,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,K.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,K.jsx)(Q,{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,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,K.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Le(e.expires)}),e.token?(0,K.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,K.jsx)(m,{className:`size-3 animate-spin`}):`Test`}):(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,K.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 ze(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 Be({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,G.useState)(new Map),[o,s]=(0,G.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,K.jsx)(E,{open:e,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,K.jsx)(T,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,K.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(P,{id:`token-test-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,K.jsx)(A,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:l,children:`Test all`})]})]}),n.length===0&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,K.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,K.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ze(e.expiresAt)})]}),(0,K.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,K.jsx)(m,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,K.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,K.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,K.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,K.jsx)(Re,{accounts:n})]}),(0,K.jsx)(S,{children:(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function Ve(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:o,flashIds:s,reload:d}=ge(),[p,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[T,E]=(0,G.useState)(null),[D,O]=(0,G.useState)(void 0);function k(e){d(),e&&h(e)}async function A(e,t){_(e);try{await ie(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){h(e.message)}_(null),d()}async function j(){if(v){try{await ce(v.id),h(`Account "${v.display}" removed.`),d()}catch(e){h(`Failed to remove: ${e.message}`)}y(null)}}let M=new Map(t.map(e=>[e.id,e])),N=e[0]?.usage.lastFetchedAt;return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(B,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void d(),refreshing:o,disabled:i,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{O(void 0),E(`add`)},children:[(0,K.jsx)(l,{className:`size-4`}),` Add account`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{w(null),E(`export`)},children:[(0,K.jsx)(u,{className:`size-4`}),` Export`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`import`),children:[(0,K.jsx)(c,{className:`size-4`}),` Import`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`rotation`),children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`token-test`),children:[(0,K.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,K.jsx)(z,{message:p,onDismiss:()=>h(null)}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),N&&(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,pe(new Date(N).getTime())]})]}),i?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,K.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,K.jsx)(V,{children:e.map(e=>(0,K.jsx)(Se,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:M.get(e.accountId),onToggle:A,toggling:g===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onExport:e=>{w(e),E(`export`)},onViewProfile:(e,t)=>S({profile:e,accountId:t}),onReauth:()=>{O({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),E(`add`)},flash:s.has(e.accountId)},e.accountId))})]}),x&&(0,K.jsx)(Oe,{profile:x.profile,accountId:x.accountId,onClose:()=>S(null)}),v&&(0,K.jsx)(ke,{display:v.display,onConfirm:()=>void j(),onCancel:()=>y(null)}),(0,K.jsx)(me,{open:T===`add`,onOpenChange:e=>{E(e?`add`:null),e||O(void 0)},onSuccess:k,signInAgainFor:D}),(0,K.jsx)(je,{open:T===`export`,onOpenChange:e=>{E(e?`export`:null),e||w(null)},accounts:t,preselectId:C,onMessage:h}),(0,K.jsx)(Me,{open:T===`import`,onOpenChange:e=>E(e?`import`:null),onSuccess:k}),(0,K.jsx)(Fe,{open:T===`rotation`,onOpenChange:e=>E(e?`rotation`:null)}),(0,K.jsx)(Be,{open:T===`token-test`,onOpenChange:e=>E(e?`token-test`:null),accounts:t})]})}function He({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:a,onExport:o,onImport:s,error:l}){let d=(0,G.useRef)(null),f=e===`export`;return(0,K.jsx)(E,{open:e!==null,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsxs)(w,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(i,{className:`size-4`}),` `,f?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(A,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,K.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,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,K.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,K.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,K.jsxs)(S,{children:[(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,K.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,K.jsx)(m,{className:`size-3.5 animate-spin`}):f?(0,K.jsx)(u,{className:`size-3.5`}):(0,K.jsx)(c,{className:`size-3.5`}),f?`Download backup`:`Choose file`]})]})]})})}var Ue=[{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 We({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,K.jsx)(E,{open:e,onOpenChange:t,children:(0,K.jsxs)(C,{className:`sm:max-w-md`,children:[(0,K.jsxs)(x,{children:[(0,K.jsx)(w,{className:`text-sm`,children:`Codex Rotation`}),(0,K.jsx)(T,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:Ue.map(e=>(0,K.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,K.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,K.jsx)(S,{children:(0,K.jsx)(b,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function $(e){return e==null?null:Math.round(e*100)}function Ge({usage:e}){let t=e.session==null&&e.weekly==null;return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,K.jsx)(W,{label:`5-Hour Session`,pct:$(e.fiveHour),reset:U(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,K.jsx)(W,{label:`Weekly`,pct:$(e.sevenDay),reset:U(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function Ke(){let[e,t]=(0,G.useState)(null),n=fe(()=>t(null)),[r,i]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(B,{description:(0,K.jsxs)(K.Fragment,{children:[`Each Codex account keeps its own login (`,(0,K.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(b,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,K.jsx)(l,{className:`size-4`}),` Add account`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,K.jsx)(u,{className:`size-4`}),` Export`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,K.jsx)(c,{className:`size-4`}),` Import`]}),(0,K.jsxs)(b,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,K.jsx)(a,{className:`size-4`}),` Rotation`]})]})}),(0,K.jsx)(z,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,K.jsx)(f,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,K.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,K.jsx)(V,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,K.jsxs)(_e,{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,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,K.jsx)(de,{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,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),H(e.planType)&&(0,K.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:H(e.planType)}),(0,K.jsx)(P,{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,K.jsxs)(F,{children:[(0,K.jsx)(j,{asChild:!0,children:(0,K.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,K.jsx)(s,{className:`size-4`})})}),(0,K.jsx)(L,{side:`top`,children:`Remove account`})]})]}),(0,K.jsx)(Ge,{usage:t}),t.resetCredits&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,K.jsx)(he,{credits:t.resetCredits}),(0,K.jsx)(xe,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=ye(t.weekly);return r?(0,K.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,K.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,K.jsx)(`span`,{children:`Daily guard`}),(0,K.jsxs)(F,{children:[(0,K.jsx)(j,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,K.jsx)(o,{className:`size-3.5`})})}),(0,K.jsx)(L,{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,K.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,K.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,K.jsx)(P,{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,K.jsx)(be,{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,K.jsx)(He,{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,K.jsx)(ve,{account:r,onClose:()=>i(null),onDone:()=>void n.load()}),(0,K.jsx)(We,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var qe=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}];function Je(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(`claude`);(0,G.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=qe.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,K.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,K.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,K.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,K.jsx)(k,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,K.jsx)(Ve,{}):(0,K.jsx)(Ke,{})]})}export{Je as AccountsSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-
|
|
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-BwyIKaTT.js";import{t as i}from"./preload-helper-CM8YhcCa.js";import"./portal-container-context-NBi-KGK0.js";import{t as a}from"./mobile-bottom-sheet-DArbIyrD.js";import"./use-visual-viewport-MmugpRg-.js";import{t as o}from"./agent-session-sheet-store-BAfLnsLX.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-CYg58J-V.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-D8QDpdgs.js","assets/preload-helper-CM8YhcCa.js","assets/vendor-ui-BTSIXzhZ.js","assets/vendor-markdown-C-P1aR4p.js","assets/button-C9ZXWb3b.js","assets/utils-Bslrbb-G.js","assets/createLucideIcon-D9_fdOKS.js","assets/file-diff-CcDhJkXB.js","assets/git-commit-horizontal-BPdj2L1i.js","assets/api-client-xQDlhUTu.js","assets/react-BZ0kba1-.js","assets/open-db-tabs-CtWIWHOa.js","assets/window-store-DqX_qmkQ.js","assets/panel-store-BJhazigC.js","assets/session-list-sync-triggers-DtJI5KF0.js","assets/project-store-BLGl9IAO.js","assets/project-framework-store-DwLxaRan.js","assets/explorer-model-BtJN4MZ9.js","assets/db-sidebar-reveal-_qw0CliT.js","assets/settings-store-B4mLp19V.js","assets/use-is-mobile-VRV9eZy1.js","assets/db-types-CNhENouW.js","assets/tab-store-D5I52eLN.js","assets/use-db-driver-installed-anzWkGi5.js","assets/impexp-state-BWKOuRGj.js","assets/file-store-BQ41vIs5.js","assets/sql-identifiers-DDISwQor.js","assets/db-explorer-store-BmpvDHz6.js","assets/onboarding-quick-orientation-CTHtIRib.js","assets/dialog-Dn_2tuYa.js","assets/portal-container-context-NBi-KGK0.js","assets/icons-BwyIKaTT.js","assets/format-file-meta-DdYtk07C.js","assets/fs-api-CFtQzsIJ.js","assets/open-settings-EXR4zoZG.js","assets/settings-categories-Ajj4ui27.js","assets/adaptive-context-menu-C4jNSORA.js","assets/context-menu-BCuZYfWC.js","assets/mobile-bottom-sheet-DArbIyrD.js","assets/use-visual-viewport-MmugpRg-.js","assets/dropdown-menu-BQidk_OJ.js","assets/input-C3oVNCMq.js","assets/scroll-area-DOlQJGZp.js","assets/start-ellipsis-CU8GkxaV.js","assets/chat-preparation-cache-190LLyy7.js","assets/clipboard-D-VCry-F.js","assets/file-icons-JInFtBVl.js","assets/format-date-CkyHzZLA.js","assets/git-repo-store-CKB5fdNP.js","assets/patch-tab-metadata-C92YkrRX.js","assets/ws-auth-CbF6GqxP.js","assets/apply-theme-ORrEdHKT.js","assets/resolve-theme-BqoL27BW.js","assets/index-BACBJm4i.css","assets/libesm-B6LsX5wH.js","assets/tool-cards-DrCiSH2r.js","assets/db-ai-tools-CVbbW_MZ.js","assets/split-sql-statements-DcAeXbk_.js","assets/agent-session-sheet-store-BAfLnsLX.js","assets/image-preview-geometry-CCq8rio7.js","assets/use-blob-url-Clm7wbB_.js","assets/html-preview-loads-CMWBC-iv.js","assets/image-gallery-BuxSgBug.js","assets/design-canvas-check-BIHc2d_k.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-BwyIKaTT.js";import{t as i}from"./preload-helper-CM8YhcCa.js";import"./portal-container-context-NBi-KGK0.js";import{t as a}from"./mobile-bottom-sheet-DArbIyrD.js";import"./use-visual-viewport-MmugpRg-.js";import{t as o}from"./agent-session-sheet-store-BAfLnsLX.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-CYg58J-V.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])));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};
|
|
Binary file
|
|
Binary file
|
|
@@ -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-BwyIKaTT.js";import"./api-client-xQDlhUTu.js";import{n as o}from"./utils-Bslrbb-G.js";import"./window-store-DqX_qmkQ.js";import"./panel-store-BJhazigC.js";import"./project-store-BLGl9IAO.js";import"./project-framework-store-DwLxaRan.js";import"./session-list-sync-triggers-DtJI5KF0.js";import"./tab-store-D5I52eLN.js";import"./file-store-BQ41vIs5.js";import"./use-is-mobile-VRV9eZy1.js";import"./fs-api-CFtQzsIJ.js";import{F as s,I as c,Xr as l}from"./index-
|
|
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-BwyIKaTT.js";import"./api-client-xQDlhUTu.js";import{n as o}from"./utils-Bslrbb-G.js";import"./window-store-DqX_qmkQ.js";import"./panel-store-BJhazigC.js";import"./project-store-BLGl9IAO.js";import"./project-framework-store-DwLxaRan.js";import"./session-list-sync-triggers-DtJI5KF0.js";import"./tab-store-D5I52eLN.js";import"./file-store-BQ41vIs5.js";import"./use-is-mobile-VRV9eZy1.js";import"./fs-api-CFtQzsIJ.js";import{F as s,I as c,Xr as l}from"./index-D8QDpdgs.js";import"./agent-session-sheet-store-BAfLnsLX.js";import"./libesm-B6LsX5wH.js";import{f as u,l as d,t as f,u as p}from"./tool-cards-DrCiSH2r.js";import"./use-blob-url-Clm7wbB_.js";import"./design-canvas-check-BIHc2d_k.js";import"./db-ai-tools-CVbbW_MZ.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};
|
|
Binary file
|
|
Binary file
|
|
@@ -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-BwyIKaTT.js";import{k as c}from"./api-client-xQDlhUTu.js";import"./settings-store-B4mLp19V.js";import{n as l}from"./utils-Bslrbb-G.js";import{Bn as u,In as d,J as f,Ln as p,Rn as m,Y as h,zn as g}from"./index-
|
|
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-BwyIKaTT.js";import{k as c}from"./api-client-xQDlhUTu.js";import"./settings-store-B4mLp19V.js";import{n as l}from"./utils-Bslrbb-G.js";import{Bn as u,In as d,J as f,Ln as p,Rn as m,Y as h,zn as g}from"./index-D8QDpdgs.js";import{t as _}from"./use-monaco-theme-DljSc3Xo.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),g(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 u(t,e,T),k(e),D(e),c.success(`Saved`),m.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=p[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)(d,{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)(h,{beforeMount:f,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};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import"./icons-BwyIKaTT.js";import"./api-client-xQDlhUTu.js";import"./settings-store-B4mLp19V.js";import"./portal-container-context-NBi-KGK0.js";import"./window-store-DqX_qmkQ.js";import"./panel-store-BJhazigC.js";import"./project-store-BLGl9IAO.js";import"./project-framework-store-DwLxaRan.js";import"./session-list-sync-triggers-DtJI5KF0.js";import"./tab-store-D5I52eLN.js";import"./chat-preparation-cache-190LLyy7.js";import"./use-is-mobile-VRV9eZy1.js";import"./settings-categories-Ajj4ui27.js";import"./open-settings-EXR4zoZG.js";import"./button-C9ZXWb3b.js";import"./dialog-Dn_2tuYa.js";import"./mobile-bottom-sheet-DArbIyrD.js";import"./use-visual-viewport-MmugpRg-.js";import"./input-C3oVNCMq.js";import"./api-settings-vmIRFNwZ.js";import{t as e}from"./ai-settings-section-
|
|
1
|
+
import"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import"./icons-BwyIKaTT.js";import"./api-client-xQDlhUTu.js";import"./settings-store-B4mLp19V.js";import"./portal-container-context-NBi-KGK0.js";import"./window-store-DqX_qmkQ.js";import"./panel-store-BJhazigC.js";import"./project-store-BLGl9IAO.js";import"./project-framework-store-DwLxaRan.js";import"./session-list-sync-triggers-DtJI5KF0.js";import"./tab-store-D5I52eLN.js";import"./chat-preparation-cache-190LLyy7.js";import"./use-is-mobile-VRV9eZy1.js";import"./settings-categories-Ajj4ui27.js";import"./open-settings-EXR4zoZG.js";import"./button-C9ZXWb3b.js";import"./dialog-Dn_2tuYa.js";import"./mobile-bottom-sheet-DArbIyrD.js";import"./use-visual-viewport-MmugpRg-.js";import"./input-C3oVNCMq.js";import"./api-settings-vmIRFNwZ.js";import{t as e}from"./ai-settings-section-DAqiu_11.js";export{e as AISettingsSection};
|
|
@@ -0,0 +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-BwyIKaTT.js";import{r as s}from"./api-client-xQDlhUTu.js";import{t as c}from"./open-settings-EXR4zoZG.js";import{t as l}from"./button-C9ZXWb3b.js";import{t as u}from"./input-C3oVNCMq.js";import{Ai as d,Er as f,Gn as p,Hn as m,Kn as h,Pn as ee,Un as g,Vn as _,Wn as v}from"./index-D8QDpdgs.js";import{a as te,b as ne}from"./api-settings-vmIRFNwZ.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 re(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 F=e(t(),1),I=n(),L=[128e3,272e3,4e5,512e3,872e3,1e6],R=[1e5,2e5,23e4,35e4,45e4,75e4,9e5];function z({id:e,label:t,value:n,presets:r,disabled:i,compact:a,onChange:o}){let[s,c]=(0,F.useState)(!!n&&!r.includes(Number(n))),l=a?`text-[11px]`:`text-sm`;return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(f,{htmlFor:e,className:l,children:t}),(0,I.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,I.jsx)(`option`,{value:`default`,children:`Codex default`}),r.map(e=>(0,I.jsxs)(`option`,{value:String(e),children:[e===1e6?`1M`:`${e/1e3}K`,` tokens`]},e)),(0,I.jsx)(`option`,{value:`custom`,children:`Custom...`})]}),s&&(0,I.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 ie({config:e,compact:t,saving:n,onSave:r}){let[i,a]=(0,F.useState)(String(e?.model_context_window??``)),[o,s]=(0,F.useState)(String(e?.model_auto_compact_token_limit??``)),[c,l]=(0,F.useState)(null),u=t?`text-[11px]`:`text-sm`,d=t?`text-[9px]`:`text-[11px]`;async function f(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,I.jsxs)(`form`,{onSubmit:f,className:`space-y-2 rounded-md border border-border p-3`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(z,{id:`codex-context-window`,label:`Context window (tokens)`,value:i,presets:L,disabled:n,compact:t,onChange:e=>{a(e),l(null)}}),(0,I.jsx)(z,{id:`codex-compact-threshold`,label:`Auto-compact threshold (tokens)`,value:o,presets:R,disabled:n,compact:t,onChange:e=>{s(e),l(null)}})]}),(0,I.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,I.jsx)(`p`,{role:`alert`,className:`${u} text-error`,children:c}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.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,I.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 ae=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`xhigh`,label:`Extra`},{value:`max`,label:`Max`}],oe=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],B={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function V({compact:e}={}){let[t,n]=(0,F.useState)(null),[r,b]=(0,F.useState)(``),[x,S]=(0,F.useState)([]),[C,w]=(0,F.useState)(!1),[T,E]=(0,F.useState)(!1),[D,O]=(0,F.useState)(null),[k,A]=(0,F.useState)(0),[j,P]=(0,F.useState)([]),[L,R]=(0,F.useState)(!1);(0,F.useEffect)(()=>{te().then(e=>{n(e),b(e.default_provider??`claude`)}).catch(e=>O(e.message))},[]),(0,F.useEffect)(()=>{r&&s.get(`/api/settings/ai/providers/status`).then(P).catch(()=>P([]))},[r]);let z=j.find(e=>e.id===r&&!e.registered);(0,F.useEffect)(()=>{r&&(w(!0),s.get(`/api/settings/ai/providers/${r}/models`).then(S).catch(()=>S([])).finally(()=>w(!1)))},[r,!z]);let[V,H]=(0,F.useState)(null),U=t?.providers[r]?.model;(0,F.useEffect)(()=>{if(H(null),!r)return;let e=!0,t=U?`?model=${encodeURIComponent(U)}`:``;return s.get(`/api/settings/ai/providers/${r}/effort-status${t}`).then(({status:t})=>{e&&H(t)}).catch(()=>{}),()=>{e=!1}},[r,U]);let ce=async()=>{R(!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{R(!1)}},W=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:B[e]??e})):[],G=t?.providers[r],K=G?.type===`agent-sdk`||!G?.type&&r===`claude`,q=re(M(G?.effort,V),V,G?.model?y(G.model):`the model`),J=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)}},Y=(e,t)=>J({providers:{[r]:{[e]:t}}}),X=e?`text-[11px]`:`text-sm`,Z=e?`text-xs`:`text-sm`,le=e?`space-y-2`:`space-y-4`,Q=e?`space-y-1.5`:`space-y-3`,$=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,I.jsxs)(`div`,{className:Q,children:[(0,I.jsx)(`h3`,{className:`${Z} font-medium text-text-secondary`,children:`AI Settings`}),(0,I.jsx)(`p`,{className:`${X} text-text-subtle`,children:D?`Error: ${D}`:`Loading...`})]});let ue=K?x:[{value:`__default__`,label:`Auto (default)`},...x];return(0,I.jsxs)(`div`,{className:le,children:[(0,I.jsx)(`h3`,{className:`${Z} font-medium text-text-secondary`,children:`AI Settings`}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-new-chat-provider`,className:e?X:void 0,children:`New chat provider`}),(0,I.jsxs)(_,{value:t.new_chat_provider_mode??`default`,disabled:T,onValueChange:e=>J({new_chat_provider_mode:e}),children:[(0,I.jsx)(v,{id:`ai-new-chat-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(p,{})}),(0,I.jsxs)(m,{children:[(0,I.jsx)(g,{value:`follow-focus`,children:`Follow last focused chat`}),(0,I.jsx)(g,{value:`default`,children:`Always use default provider`})]})]}),(0,I.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,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-default-provider`,className:e?X:void 0,children:`Default provider`}),(0,I.jsxs)(_,{value:t.default_provider,disabled:T,onValueChange:e=>J({default_provider:e}),children:[(0,I.jsx)(v,{id:`ai-default-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(p,{})}),(0,I.jsx)(m,{children:W.map(e=>(0,I.jsx)(g,{value:e.id,children:e.name},e.id))})]}),t.new_chat_provider_mode===`follow-focus`&&(0,I.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Used when no chat has been focused in this project yet.`})]}),(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border p-3`,children:[(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-share-provider-context`,className:e?X:void 0,children:`Share rules and memory between providers`}),(0,I.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,I.jsx)(h,{id:`ai-share-provider-context`,"aria-describedby":`ai-share-provider-context-description`,checked:t.share_provider_context??!0,disabled:T,onCheckedChange:e=>J({share_provider_context:e})})]}),W.length>1&&(0,I.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:W.map(e=>(0,I.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,I.jsx)(d,{providerId:e.id}),(0,I.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,I.jsxs)(`div`,{className:Q,children:[z&&(0,I.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,I.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,I.jsxs)(`p`,{className:`${X} text-text-secondary`,children:[B[r]??r,` is not available in chat — PPM could not start it.`]}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:z.reason}),z.nextProbeAt&&(0,I.jsxs)(`p`,{className:`text-[11px] text-text-subtle`,children:[`Checking again at `,new Date(z.nextProbeAt).toLocaleTimeString()]}),(0,I.jsxs)(l,{variant:`outline`,size:`sm`,onClick:ce,disabled:L,className:`gap-1.5 cursor-pointer min-h-11 md:min-h-8`,children:[(0,I.jsx)(a,{className:`size-3.5 ${L?`animate-spin`:``}`}),L?`Checking...`:`Check again`]})]})]}),r===`codex`&&(0,I.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,I.jsx)(`span`,{className:`${X} text-text-secondary`,children:`Codex accounts & login`}),(0,I.jsx)(i,{className:`size-3.5 text-text-subtle shrink-0`})]}),x.length>0&&(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-model`,className:e?X:void 0,children:`Model`}),(0,I.jsxs)(_,{value:K?G?.model??x[0]?.value:G?.model||`__default__`,onValueChange:e=>Y(`model`,e===`__default__`?void 0:e),disabled:C,children:[(0,I.jsx)(v,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(p,{placeholder:C?`Loading models...`:`Select model`})}),(0,I.jsx)(m,{className:`max-h-[300px]`,children:ue.map(e=>(0,I.jsx)(g,{value:e.value,children:e.label},e.value))})]})]}),r===`codex`&&(0,I.jsx)(ie,{config:G,compact:e,saving:T,onSave:e=>J({providers:{codex:e}})},JSON.stringify([G?.model_context_window,G?.model_auto_compact_token_limit])),K&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-base-url`,className:e?X:void 0,children:`Base URL`}),(0,I.jsx)(u,{id:`ai-base-url`,type:`url`,defaultValue:G?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{Y(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${k}`)]}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-api-key`,className:e?X:void 0,children:`API Key / Token`}),(0,I.jsx)(u,{id:`ai-api-key`,type:`password`,defaultValue:G?.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(`••••`)||Y(`api_key`,t||void 0)}},`apikey-${r}-${k}`),(0,I.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,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-effort`,className:e?X:void 0,children:`Effort`}),(0,I.jsxs)(_,{value:G?.effort??`high`,onValueChange:e=>Y(`effort`,e),children:[(0,I.jsx)(v,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(p,{})}),(0,I.jsx)(m,{children:ae.map(e=>(0,I.jsx)(g,{value:e.value,children:e.label},e.value))})]}),q&&(0,I.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,I.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,I.jsx)(`p`,{className:`${X} text-text-secondary`,children:q.title}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:N(q.detail)})]})]})]}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-max-turns`,className:e?X:void 0,children:`Max Turns (1-500)`}),(0,I.jsx)(u,{id:`ai-max-turns`,type:`number`,min:1,max:500,defaultValue:G?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);isNaN(t)||Y(`max_turns`,t)}},`turns-${r}-${k}`)]}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-budget`,className:e?X:void 0,children:`Max Budget (USD)`}),(0,I.jsx)(u,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:G?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);Y(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${k}`)]}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-thinking`,className:e?X:void 0,children:`Thinking Budget (tokens)`}),(0,I.jsx)(u,{id:`ai-thinking`,type:`number`,min:0,defaultValue:G?.thinking_budget_tokens??``,placeholder:`Adaptive (model decides)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);Y(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${k}`)]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(f,{htmlFor:`ai-agent-teams`,className:e?X:void 0,children:`Agent Teams`}),(0,I.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,I.jsx)(h,{id:`ai-agent-teams`,checked:G?.agent_teams??!1,onCheckedChange:e=>Y(`agent_teams`,e)})]}),G?.agent_teams&&(0,I.jsx)(se,{compact:e}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(f,{htmlFor:`ai-context-1m`,className:e?X:void 0,children:`1M Context Window`}),(0,I.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,I.jsx)(h,{id:`ai-context-1m`,checked:G?.context_1m??!1,onCheckedChange:e=>Y(`context_1m`,e)})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(f,{htmlFor:`ai-inherit-mcp`,className:e?X:void 0,children:`Inherit Claude Code MCP`}),(0,I.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,I.jsx)(h,{id:`ai-inherit-mcp`,checked:G?.inherit_claude_mcp??!0,onCheckedChange:e=>Y(`inherit_claude_mcp`,e)})]}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{className:e?X:void 0,children:`MCP sign-in`}),(0,I.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,I.jsx)(`div`,{className:`-mx-2`,children:(0,I.jsx)(ee,{showWhenEmpty:!0})})]})]}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-permission-mode`,className:e?X:void 0,children:`Default Permission Mode`}),(0,I.jsxs)(_,{value:G?.permission_mode??`bypassPermissions`,onValueChange:e=>Y(`permission_mode`,e),children:[(0,I.jsx)(v,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(p,{})}),(0,I.jsx)(m,{children:oe.map(e=>(0,I.jsx)(g,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:$,children:[(0,I.jsx)(f,{htmlFor:`ai-system-prompt`,className:e?X:void 0,children:`Additional Instructions`}),(0,I.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:G?.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=>{Y(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${k}`)]})]}),T&&(0,I.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),D&&(0,I.jsx)(`p`,{className:`text-xs text-error`,children:D})]})}function se({compact:e}){let[t,n]=(0,F.useState)([]),[i,o]=(0,F.useState)(!1),[c,l]=(0,F.useState)(null),u=(0,F.useCallback)(async()=>{o(!0);try{n(await s.get(`/api/teams`)??[])}catch{}o(!1)},[]);(0,F.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,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(f,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,I.jsx)(`button`,{onClick:u,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,I.jsx)(a,{className:`size-3 ${i?`animate-spin`:``}`})})]}),t.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,I.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,I.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,I.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,I.jsx)(`button`,{onClick:()=>d(e.name),className:`px-2 py-1 bg-error text-white rounded text-[10px]`,children:`Delete`}),(0,I.jsx)(`button`,{onClick:()=>l(null),className:`px-2 py-1 bg-panel-2 text-text rounded text-[10px]`,children:`Cancel`})]}):(0,I.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,I.jsx)(r,{className:`size-3.5`})})]},e.name))]})}export{re as a,y as c,k as i,O as n,N as o,A as r,M as s,V as t};
|
|
Binary file
|
|
Binary file
|