@hienlh/ppm 0.25.7 → 0.25.9
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 +24 -0
- package/CLAUDE.md +4 -1
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/cli-reference.md +1 -0
- package/assets/skills/ppm/references/http-api.md +5 -1
- package/dist/web/assets/{accounts-settings-section-Dj-tqgLP.js → accounts-settings-section-DhBlsQzP.js} +1 -1
- package/dist/web/assets/accounts-settings-section-DhBlsQzP.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-DhBlsQzP.js.gz +0 -0
- package/dist/web/assets/{agent-session-sheet-ES6BGGHr.js → agent-session-sheet-2HfUDC-0.js} +2 -2
- package/dist/web/assets/agent-session-sheet-2HfUDC-0.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-2HfUDC-0.js.gz +0 -0
- package/dist/web/assets/{agent-session-window-content-D1Qz_Jtj.js → agent-session-window-content-D37AX2th.js} +1 -1
- package/dist/web/assets/agent-session-window-content-D37AX2th.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-D37AX2th.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-C1xHoS9l.js → ai-resource-editor-DgkupdEI.js} +1 -1
- package/dist/web/assets/ai-resource-editor-DgkupdEI.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-DgkupdEI.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-D0LobmFN.js → ai-settings-section-Bs_mVtS1.js} +1 -1
- package/dist/web/assets/ai-settings-section-Bs_mVtS1.js.br +0 -0
- package/dist/web/assets/ai-settings-section-Bs_mVtS1.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-B2s5uYmr.js → ai-settings-section-Ck4dnd02.js} +1 -1
- package/dist/web/assets/ai-settings-section-Ck4dnd02.js.br +0 -0
- package/dist/web/assets/ai-settings-section-Ck4dnd02.js.gz +0 -0
- package/dist/web/assets/{android-tab-JEd1TSF7.js → android-tab-BpxQioxH.js} +1 -1
- package/dist/web/assets/android-tab-BpxQioxH.js.br +0 -0
- package/dist/web/assets/android-tab-BpxQioxH.js.gz +0 -0
- package/dist/web/assets/{antigravity-usage-view-CCOvhebf.js → antigravity-usage-view-xdhN5XdB.js} +1 -1
- package/dist/web/assets/antigravity-usage-view-xdhN5XdB.js.br +0 -0
- package/dist/web/assets/antigravity-usage-view-xdhN5XdB.js.gz +0 -0
- package/dist/web/assets/{appearance-settings-section-DO6hc-od.js → appearance-settings-section-DOaGMSCI.js} +1 -1
- package/dist/web/assets/appearance-settings-section-DOaGMSCI.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-DOaGMSCI.js.gz +0 -0
- package/dist/web/assets/{apps-panel-DcTJU6vR.js → apps-panel-DRpPppmQ.js} +1 -1
- package/dist/web/assets/apps-panel-DRpPppmQ.js.br +0 -0
- package/dist/web/assets/apps-panel-DRpPppmQ.js.gz +0 -0
- package/dist/web/assets/{assistant-name-store-DunABllt.js → assistant-name-store-DSoH_0w2.js} +1 -1
- package/dist/web/assets/assistant-name-store-DSoH_0w2.js.br +0 -0
- package/dist/web/assets/assistant-name-store-DSoH_0w2.js.gz +0 -0
- package/dist/web/assets/assistant-settings-DjNfKU_I.js +1 -0
- package/dist/web/assets/assistant-settings-DjNfKU_I.js.br +0 -0
- package/dist/web/assets/assistant-settings-DjNfKU_I.js.gz +0 -0
- package/dist/web/assets/{assistant-settings-section-B2Ku9p0H.js → assistant-settings-section-CspPAsYK.js} +2 -2
- package/dist/web/assets/assistant-settings-section-CspPAsYK.js.br +0 -0
- package/dist/web/assets/assistant-settings-section-CspPAsYK.js.gz +0 -0
- package/dist/web/assets/{assistant-tab-C7PHbtlQ.js → assistant-tab-B-nFPdEz.js} +1 -1
- package/dist/web/assets/assistant-tab-B-nFPdEz.js.br +0 -0
- package/dist/web/assets/assistant-tab-B-nFPdEz.js.gz +0 -0
- package/dist/web/assets/{background-output-store-D2KAitP3.js → background-output-store-Cqsu1Pe8.js} +1 -1
- package/dist/web/assets/background-output-store-Cqsu1Pe8.js.br +0 -0
- package/dist/web/assets/background-output-store-Cqsu1Pe8.js.gz +0 -0
- package/dist/web/assets/{branch-review-tab-BTkWVfIx.js → branch-review-tab-WfOaOP_G.js} +1 -1
- package/dist/web/assets/branch-review-tab-WfOaOP_G.js.br +0 -0
- package/dist/web/assets/branch-review-tab-WfOaOP_G.js.gz +0 -0
- package/dist/web/assets/{build-message-with-attachments-CRWLGa4Y.js → build-message-with-attachments-Ct69HqZU.js} +1 -1
- package/dist/web/assets/build-message-with-attachments-Ct69HqZU.js.br +0 -0
- package/dist/web/assets/build-message-with-attachments-Ct69HqZU.js.gz +0 -0
- package/dist/web/assets/chat-tab-DVqxIrOQ.js +1 -0
- package/dist/web/assets/chat-tab-DVqxIrOQ.js.br +0 -0
- package/dist/web/assets/chat-tab-DVqxIrOQ.js.gz +0 -0
- package/dist/web/assets/{chat-tab-edXhE4lm.js → chat-tab-HgJWDRBc.js} +7 -7
- package/dist/web/assets/chat-tab-HgJWDRBc.js.br +0 -0
- package/dist/web/assets/chat-tab-HgJWDRBc.js.gz +0 -0
- package/dist/web/assets/{close-window-C-DU_r5Y.js → close-window-Dq__FGE2.js} +1 -1
- package/dist/web/assets/{code-editor-B1hoVvoe.js → code-editor-BaR3rDbO.js} +4 -4
- package/dist/web/assets/code-editor-BaR3rDbO.js.br +0 -0
- package/dist/web/assets/code-editor-BaR3rDbO.js.gz +0 -0
- package/dist/web/assets/{conflict-editor-CiGF-H8E.js → conflict-editor-nXN6-RxH.js} +1 -1
- package/dist/web/assets/conflict-editor-nXN6-RxH.js.br +0 -0
- package/dist/web/assets/conflict-editor-nXN6-RxH.js.gz +0 -0
- package/dist/web/assets/{connection-form-tab-DfrYYyqN.js → connection-form-tab-D92Gz678.js} +1 -1
- package/dist/web/assets/connection-form-tab-D92Gz678.js.br +0 -0
- package/dist/web/assets/connection-form-tab-D92Gz678.js.gz +0 -0
- package/dist/web/assets/{csv-preview-PhPn1H22.js → csv-preview-lwYkZ9cg.js} +1 -1
- package/dist/web/assets/csv-preview-lwYkZ9cg.js.br +0 -0
- package/dist/web/assets/csv-preview-lwYkZ9cg.js.gz +0 -0
- package/dist/web/assets/{database-drivers-section-C2iSgtsK.js → database-drivers-section-CltuRsxs.js} +1 -1
- package/dist/web/assets/database-drivers-section-CltuRsxs.js.br +0 -0
- package/dist/web/assets/database-drivers-section-CltuRsxs.js.gz +0 -0
- package/dist/web/assets/{db-connection-config-FJf8q_kG.js → db-connection-config-BHSrmiMw.js} +1 -1
- package/dist/web/assets/db-connection-config-BHSrmiMw.js.br +0 -0
- package/dist/web/assets/db-connection-config-BHSrmiMw.js.gz +0 -0
- package/dist/web/assets/{db-explorer-store-DiyDlsSd.js → db-explorer-store-DAKKs0KL.js} +1 -1
- package/dist/web/assets/db-explorer-store-DAKKs0KL.js.br +0 -0
- package/dist/web/assets/db-explorer-store-DAKKs0KL.js.gz +0 -0
- package/dist/web/assets/{db-tab-parts-CFvFJKsW.js → db-tab-parts-Dy3kOGYH.js} +1 -1
- package/dist/web/assets/db-tab-parts-Dy3kOGYH.js.br +0 -0
- package/dist/web/assets/db-tab-parts-Dy3kOGYH.js.gz +0 -0
- package/dist/web/assets/{design-settings-section-C3rGRKd9.js → design-settings-section-jPJjJWJh.js} +1 -1
- package/dist/web/assets/design-settings-section-jPJjJWJh.js.br +0 -0
- package/dist/web/assets/design-settings-section-jPJjJWJh.js.gz +0 -0
- package/dist/web/assets/{design-tab-CujDONDO.js → design-tab-CGW8BijH.js} +1 -1
- package/dist/web/assets/design-tab-CGW8BijH.js.br +0 -0
- package/dist/web/assets/{design-tab-CujDONDO.js.gz → design-tab-CGW8BijH.js.gz} +0 -0
- package/dist/web/assets/{designs-sidebar-panel-BmzMD8PY.js → designs-sidebar-panel-QrVE8jSE.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-QrVE8jSE.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-QrVE8jSE.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-BradW_q7.js → diff-viewer-CCQdWctH.js} +1 -1
- package/dist/web/assets/diff-viewer-CCQdWctH.js.br +0 -0
- package/dist/web/assets/diff-viewer-CCQdWctH.js.gz +0 -0
- package/dist/web/assets/{docx-preview-CrfPGFGk.js → docx-preview-CVU5A7EZ.js} +1 -1
- package/dist/web/assets/docx-preview-CVU5A7EZ.js.br +0 -0
- package/dist/web/assets/docx-preview-CVU5A7EZ.js.gz +0 -0
- package/dist/web/assets/{editor-dialog-CIIhsxqp.js → editor-dialog-6ncYhc1Z.js} +1 -1
- package/dist/web/assets/editor-dialog-6ncYhc1Z.js.br +0 -0
- package/dist/web/assets/editor-dialog-6ncYhc1Z.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-stDe-8Hh.js → editor-language-service-ChXwk6wX.js} +1 -1
- package/dist/web/assets/editor-language-service-ChXwk6wX.js.br +0 -0
- package/dist/web/assets/editor-language-service-ChXwk6wX.js.gz +0 -0
- package/dist/web/assets/{explorer-body-DslJEPu8.js → explorer-body-7Br-CQoY.js} +1 -1
- package/dist/web/assets/explorer-body-7Br-CQoY.js.br +0 -0
- package/dist/web/assets/explorer-body-7Br-CQoY.js.gz +0 -0
- package/dist/web/assets/{explorer-model-Daztib0H.js → explorer-model-RlqYdmjO.js} +1 -1
- package/dist/web/assets/explorer-model-RlqYdmjO.js.br +0 -0
- package/dist/web/assets/explorer-model-RlqYdmjO.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-Cujhxewh.js → explorer-window-content-4vGpVPQM.js} +1 -1
- package/dist/web/assets/explorer-window-content-4vGpVPQM.js.br +0 -0
- package/dist/web/assets/explorer-window-content-4vGpVPQM.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-DVYKtRbp.js → extension-manager-section-CanZCuQR.js} +1 -1
- package/dist/web/assets/extension-manager-section-CanZCuQR.js.br +0 -0
- package/dist/web/assets/extension-manager-section-CanZCuQR.js.gz +0 -0
- package/dist/web/assets/{extension-webview-CYKu8RhB.js → extension-webview-ARXd_mtd.js} +1 -1
- package/dist/web/assets/extension-webview-ARXd_mtd.js.br +0 -0
- package/dist/web/assets/extension-webview-ARXd_mtd.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-DQn2QDq8.js → files-settings-section-Cib0msno.js} +1 -1
- package/dist/web/assets/files-settings-section-Cib0msno.js.br +0 -0
- package/dist/web/assets/files-settings-section-Cib0msno.js.gz +0 -0
- package/dist/web/assets/{general-settings-section-CnZIAqkr.js → general-settings-section-BN6oaQ92.js} +1 -1
- package/dist/web/assets/general-settings-section-BN6oaQ92.js.br +0 -0
- package/dist/web/assets/general-settings-section-BN6oaQ92.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-C91xwW-U.js → git-log-panel-eXoJomtc.js} +1 -1
- package/dist/web/assets/git-log-panel-eXoJomtc.js.br +0 -0
- package/dist/web/assets/git-log-panel-eXoJomtc.js.gz +0 -0
- package/dist/web/assets/{git-review-tab-WpaSXeje.js → git-review-tab-BiD3RJB8.js} +1 -1
- package/dist/web/assets/git-review-tab-BiD3RJB8.js.br +0 -0
- package/dist/web/assets/git-review-tab-BiD3RJB8.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-sts6YE2c.js → glide-data-grid-Bz-vsE_o.js} +1 -1
- package/dist/web/assets/glide-data-grid-Bz-vsE_o.js.br +0 -0
- package/dist/web/assets/glide-data-grid-Bz-vsE_o.js.gz +0 -0
- package/dist/web/assets/{grid-save-dialog-jjma4-nR.js → grid-save-dialog-CPRtoshz.js} +1 -1
- package/dist/web/assets/grid-save-dialog-CPRtoshz.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-CPRtoshz.js.gz +0 -0
- package/dist/web/assets/{group-chat-tab-ze6sWOA9.js → group-chat-tab-CeWhfzpc.js} +1 -1
- package/dist/web/assets/group-chat-tab-CeWhfzpc.js.br +0 -0
- package/dist/web/assets/group-chat-tab-CeWhfzpc.js.gz +0 -0
- package/dist/web/assets/{impexp-tab-ClR7MjKN.js → impexp-tab-CHTpOlnv.js} +1 -1
- package/dist/web/assets/impexp-tab-CHTpOlnv.js.br +0 -0
- package/dist/web/assets/impexp-tab-CHTpOlnv.js.gz +0 -0
- package/dist/web/assets/index--wNHkCER.css +1 -0
- package/dist/web/assets/index--wNHkCER.css.br +0 -0
- package/dist/web/assets/index--wNHkCER.css.gz +0 -0
- package/dist/web/assets/{index-DdWNTpRC.js → index-Dh1mYjGB.js} +6 -6
- package/dist/web/assets/index-Dh1mYjGB.js.br +0 -0
- package/dist/web/assets/index-Dh1mYjGB.js.gz +0 -0
- package/dist/web/assets/{jira-watcher-section-CfNmK06d.js → jira-watcher-section-O1pqq3r-.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-DQq6Hr5R.js → keyboard-shortcuts-section-BkM6WVw7.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-BkM6WVw7.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-BkM6WVw7.js.gz +0 -0
- package/dist/web/assets/{language-servers-section-B8DlpKwG.js → language-servers-section-C30YGy0O.js} +2 -2
- package/dist/web/assets/language-servers-section-C30YGy0O.js.br +0 -0
- package/dist/web/assets/language-servers-section-C30YGy0O.js.gz +0 -0
- package/dist/web/assets/{logs-app-BSb7y8Ub.js → logs-app-APP6HqFH.js} +1 -1
- package/dist/web/assets/logs-app-APP6HqFH.js.br +0 -0
- package/dist/web/assets/logs-app-APP6HqFH.js.gz +0 -0
- package/dist/web/assets/logs-tab-CtIfyNVb.js +1 -0
- package/dist/web/assets/{logs-window-content-9Ntbw6Pa.js → logs-window-content-DK-vD9MT.js} +1 -1
- package/dist/web/assets/{lsp-client-BcS52GK3.js → lsp-client-BxakJW6N.js} +1 -1
- package/dist/web/assets/lsp-client-BxakJW6N.js.br +0 -0
- package/dist/web/assets/lsp-client-BxakJW6N.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-DFsnIuyJ.js +1 -0
- package/dist/web/assets/markdown-renderer-DFsnIuyJ.js.br +0 -0
- package/dist/web/assets/markdown-renderer-DFsnIuyJ.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-DyR-2m0n.js → markdown-renderer-zFXR5DWA.js} +1 -1
- package/dist/web/assets/markdown-renderer-zFXR5DWA.js.br +0 -0
- package/dist/web/assets/markdown-renderer-zFXR5DWA.js.gz +0 -0
- package/dist/web/assets/{mobile-explorer-sheet-CDkiK9ss.js → mobile-explorer-sheet-COJvYEed.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-COJvYEed.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-COJvYEed.js.gz +0 -0
- package/dist/web/assets/{model-thinking-selector-helpers-B9R_GCmG.js → model-thinking-selector-helpers-Dn3xr9jh.js} +1 -1
- package/dist/web/assets/model-thinking-selector-helpers-Dn3xr9jh.js.br +0 -0
- package/dist/web/assets/model-thinking-selector-helpers-Dn3xr9jh.js.gz +0 -0
- package/dist/web/assets/{new-design-dialog-CEheObfH.js → new-design-dialog-Dz-RwGZ8.js} +1 -1
- package/dist/web/assets/new-design-dialog-Dz-RwGZ8.js.br +0 -0
- package/dist/web/assets/new-design-dialog-Dz-RwGZ8.js.gz +0 -0
- package/dist/web/assets/{notifications-settings-section--wueiusr.js → notifications-settings-section-DGgHD7TI.js} +1 -1
- package/dist/web/assets/notifications-settings-section-DGgHD7TI.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-DGgHD7TI.js.gz +0 -0
- package/dist/web/assets/{onboarding-entry-BnyHu8g-.js → onboarding-entry-DSHiWY-1.js} +1 -1
- package/dist/web/assets/onboarding-entry-DSHiWY-1.js.br +0 -0
- package/dist/web/assets/onboarding-entry-DSHiWY-1.js.gz +0 -0
- package/dist/web/assets/{open-assistant-CIClEfBP.js → open-assistant-DFwSXZhe.js} +1 -1
- package/dist/web/assets/open-assistant-DFwSXZhe.js.br +0 -0
- package/dist/web/assets/open-assistant-DFwSXZhe.js.gz +0 -0
- package/dist/web/assets/open-assistant-Dpnb3wdw.js +1 -0
- package/dist/web/assets/{open-db-tabs-hq8ISs9i.js → open-db-tabs-CBwb8PII.js} +1 -1
- package/dist/web/assets/open-db-tabs-CBwb8PII.js.br +0 -0
- package/dist/web/assets/open-db-tabs-CBwb8PII.js.gz +0 -0
- package/dist/web/assets/{open-logs-CrdQYlxl.js → open-logs-DeqC63FG.js} +1 -1
- package/dist/web/assets/open-manager-chat-Bz5dVmhs.js +1 -0
- package/dist/web/assets/{open-manager-chat-Bq9rYZkX.js → open-manager-chat-Cjyg1epx.js} +1 -1
- package/dist/web/assets/open-manager-chat-Cjyg1epx.js.br +0 -0
- package/dist/web/assets/open-manager-chat-Cjyg1epx.js.gz +0 -0
- package/dist/web/assets/{open-ppm-tab-8o5Mp2VL.js → open-ppm-tab-CsbF9oE1.js} +1 -1
- package/dist/web/assets/open-ppm-tab-CsbF9oE1.js.br +0 -0
- package/dist/web/assets/open-ppm-tab-CsbF9oE1.js.gz +0 -0
- package/dist/web/assets/{open-settings-CO64bJ_7.js → open-settings-B4ZjUYGC.js} +1 -1
- package/dist/web/assets/{open-settings-DnGfgkEL.js → open-settings-BhfeWCNQ.js} +1 -1
- package/dist/web/assets/{panel-store-BVDYuCvt.js → panel-store-C8BMiE6r.js} +1 -1
- package/dist/web/assets/panel-store-C8BMiE6r.js.br +0 -0
- package/dist/web/assets/panel-store-C8BMiE6r.js.gz +0 -0
- package/dist/web/assets/{patch-tab-metadata-DrKrCjLH.js → patch-tab-metadata-Dedq9hZv.js} +1 -1
- package/dist/web/assets/{performance-panel-CKT9071S.js → performance-panel-CCQnvwJ7.js} +1 -1
- package/dist/web/assets/performance-panel-CCQnvwJ7.js.br +0 -0
- package/dist/web/assets/performance-panel-CCQnvwJ7.js.gz +0 -0
- package/dist/web/assets/{ppm-tools-DkXwX2Et.js → ppm-tools-BPerUg3f.js} +1 -1
- package/dist/web/assets/ppm-tools-BPerUg3f.js.br +0 -0
- package/dist/web/assets/ppm-tools-BPerUg3f.js.gz +0 -0
- package/dist/web/assets/{problems-panel-3DmEaBKD.js → problems-panel-VmQUHLZv.js} +1 -1
- package/dist/web/assets/problems-panel-VmQUHLZv.js.br +0 -0
- package/dist/web/assets/problems-panel-VmQUHLZv.js.gz +0 -0
- package/dist/web/assets/{process-table-CJAoXA5W.js → process-table-DPuXZ6CK.js} +1 -1
- package/dist/web/assets/process-table-DPuXZ6CK.js.br +0 -0
- package/dist/web/assets/process-table-DPuXZ6CK.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-2l86_w2k.js → proxy-settings-section-DdPyGg2u.js} +1 -1
- package/dist/web/assets/proxy-settings-section-DdPyGg2u.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-DdPyGg2u.js.gz +0 -0
- package/dist/web/assets/{query-tab-B94Pr_zx.js → query-tab-BXbngz82.js} +1 -1
- package/dist/web/assets/query-tab-BXbngz82.js.br +0 -0
- package/dist/web/assets/query-tab-BXbngz82.js.gz +0 -0
- package/dist/web/assets/release-notes-window-content-C-PC0q7L.js +1 -0
- package/dist/web/assets/{remote-access-settings-section-a8AImvR6.js → remote-access-settings-section-D1R8jvN9.js} +1 -1
- package/dist/web/assets/remote-access-settings-section-D1R8jvN9.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-D1R8jvN9.js.gz +0 -0
- package/dist/web/assets/{remote-access-tab-store-BZ6vf17_.js → remote-access-tab-store-CG1VJnPs.js} +1 -1
- package/dist/web/assets/{remote-desktop-clipboard-notice-DFn1nxw8.js → remote-desktop-clipboard-notice-B0MnrjM4.js} +1 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-B0MnrjM4.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-B0MnrjM4.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-sheet-BWS190GJ.js → remote-desktop-mobile-sheet-D38sSjuc.js} +2 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-D38sSjuc.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-D38sSjuc.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-Byw7sIXV.js → remote-desktop-mobile-view-D-pa1C4C.js} +1 -1
- package/dist/web/assets/remote-desktop-mobile-view-D-pa1C4C.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-D-pa1C4C.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-readiness-gate-CNw85fJW.js → remote-desktop-readiness-gate-DCpDGAtF.js} +1 -1
- package/dist/web/assets/remote-desktop-readiness-gate-DCpDGAtF.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-DCpDGAtF.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-window-content-D-hkqiGt.js → remote-desktop-window-content-CKHxtiHU.js} +1 -1
- package/dist/web/assets/remote-desktop-window-content-CKHxtiHU.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-CKHxtiHU.js.gz +0 -0
- package/dist/web/assets/{rename-object-dialog-DMjr26AG.js → rename-object-dialog-1taaGARn.js} +1 -1
- package/dist/web/assets/rename-object-dialog-1taaGARn.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-1taaGARn.js.gz +0 -0
- package/dist/web/assets/{review-address-setup-CjN4yI9s.js → review-address-setup-BRFEv3UA.js} +1 -1
- package/dist/web/assets/review-address-setup-BRFEv3UA.js.br +0 -0
- package/dist/web/assets/review-address-setup-BRFEv3UA.js.gz +0 -0
- package/dist/web/assets/{review-code-BPChqugN.js → review-code-A6WVkP7z.js} +1 -1
- package/dist/web/assets/review-code-A6WVkP7z.js.br +0 -0
- package/dist/web/assets/review-code-A6WVkP7z.js.gz +0 -0
- package/dist/web/assets/{run-in-terminal-D2tpbSVS.js → run-in-terminal-BnEB05OP.js} +1 -1
- package/dist/web/assets/{run-in-terminal-button-CtLSkimO.js → run-in-terminal-button-BJ3UIUws.js} +1 -1
- package/dist/web/assets/{save-as-dialog-DZabqzFG.js → save-as-dialog-BMv5KHbl.js} +1 -1
- package/dist/web/assets/save-as-dialog-BMv5KHbl.js.br +0 -0
- package/dist/web/assets/save-as-dialog-BMv5KHbl.js.gz +0 -0
- package/dist/web/assets/{schedule-script-editor-CmbffDN5.js → schedule-script-editor-CuLx2MPo.js} +1 -1
- package/dist/web/assets/schedule-script-editor-CuLx2MPo.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-CuLx2MPo.js.gz +0 -0
- package/dist/web/assets/{schedules-settings-section-C9buhsq2.js → schedules-settings-section-BGcUBTRM.js} +3 -3
- package/dist/web/assets/schedules-settings-section-BGcUBTRM.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-BGcUBTRM.js.gz +0 -0
- package/dist/web/assets/{send-to-chat-oE-JUerN.js → send-to-chat-B06CjX1D.js} +1 -1
- package/dist/web/assets/send-to-chat-B06CjX1D.js.br +0 -0
- package/dist/web/assets/send-to-chat-B06CjX1D.js.gz +0 -0
- package/dist/web/assets/{session-changes-chip-BieRAjqg.js → session-changes-chip-68_naS4f.js} +1 -1
- package/dist/web/assets/session-changes-chip-68_naS4f.js.br +0 -0
- package/dist/web/assets/session-changes-chip-68_naS4f.js.gz +0 -0
- package/dist/web/assets/session-collab-9n55N5Yi.js +1 -0
- package/dist/web/assets/{session-collab-client-DU-Iuwkh.js → session-collab-client-C4uwh8A0.js} +2 -2
- package/dist/web/assets/session-collab-client-C4uwh8A0.js.br +0 -0
- package/dist/web/assets/session-collab-client-C4uwh8A0.js.gz +0 -0
- package/dist/web/assets/{session-review-tab-Du1h3fb7.js → session-review-tab-BdH44KcC.js} +1 -1
- package/dist/web/assets/session-review-tab-BdH44KcC.js.br +0 -0
- package/dist/web/assets/session-review-tab-BdH44KcC.js.gz +0 -0
- package/dist/web/assets/{session-turns-Brf8WhTP.js → session-turns-DEshbSCb.js} +1 -1
- package/dist/web/assets/session-turns-DEshbSCb.js.br +0 -0
- package/dist/web/assets/session-turns-DEshbSCb.js.gz +0 -0
- package/dist/web/assets/{settings-body-CSXclIUd.js → settings-body-BYkCIY46.js} +1 -1
- package/dist/web/assets/settings-body-BYkCIY46.js.br +0 -0
- package/dist/web/assets/settings-body-BYkCIY46.js.gz +0 -0
- package/dist/web/assets/{settings-rows-Db0TK6_7.js → settings-rows-BABnqdiK.js} +1 -1
- package/dist/web/assets/settings-rows-BABnqdiK.js.br +0 -0
- package/dist/web/assets/settings-rows-BABnqdiK.js.gz +0 -0
- package/dist/web/assets/{settings-section-content-B2x1KNB9.js → settings-section-content-DoJCTLK4.js} +1 -1
- package/dist/web/assets/{settings-section-content-DIPL9pgs.js → settings-section-content-lSCLLiRK.js} +2 -2
- package/dist/web/assets/settings-section-content-lSCLLiRK.js.br +0 -0
- package/dist/web/assets/settings-section-content-lSCLLiRK.js.gz +0 -0
- package/dist/web/assets/settings-store-DjuCPpqK.js +45 -0
- package/dist/web/assets/settings-store-DjuCPpqK.js.br +0 -0
- package/dist/web/assets/settings-store-DjuCPpqK.js.gz +0 -0
- package/dist/web/assets/{settings-tab-Br5JjR6T.js → settings-tab-BSQfIEPz.js} +1 -1
- package/dist/web/assets/{settings-window-content-Na7uO5UI.js → settings-window-content-Cxaw8e78.js} +1 -1
- package/dist/web/assets/{sql-object-tab-CVOIYxsK.js → sql-object-tab-BseOvGuw.js} +1 -1
- package/dist/web/assets/sql-object-tab-BseOvGuw.js.br +0 -0
- package/dist/web/assets/sql-object-tab-BseOvGuw.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-gYzT8mK_.js → sqlite-viewer-BK112-XZ.js} +1 -1
- package/dist/web/assets/sqlite-viewer-BK112-XZ.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-BK112-XZ.js.gz +0 -0
- package/dist/web/assets/{storage-settings-section-kLoWvAiE.js → storage-settings-section-BnqKLxgx.js} +1 -1
- package/dist/web/assets/storage-settings-section-BnqKLxgx.js.br +0 -0
- package/dist/web/assets/storage-settings-section-BnqKLxgx.js.gz +0 -0
- package/dist/web/assets/{structure-save-dialog-DKX27TZj.js → structure-save-dialog-DG7OENmO.js} +1 -1
- package/dist/web/assets/structure-save-dialog-DG7OENmO.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-DG7OENmO.js.gz +0 -0
- package/dist/web/assets/{structure-tab-B7nUzq1k.js → structure-tab-DrI9AgAe.js} +1 -1
- package/dist/web/assets/structure-tab-DrI9AgAe.js.br +0 -0
- package/dist/web/assets/structure-tab-DrI9AgAe.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-ISqdObYR.js → system-monitor-body-BRg06F77.js} +2 -2
- package/dist/web/assets/system-monitor-body-BRg06F77.js.br +0 -0
- package/dist/web/assets/system-monitor-body-BRg06F77.js.gz +0 -0
- package/dist/web/assets/system-monitor-tab-BpOpuLL9.js +1 -0
- package/dist/web/assets/{system-monitor-window-content-C-o618OT.js → system-monitor-window-content-KfkaVpDc.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-DruWYAe4.js → tab-host-window-content-Cd5tvEFg.js} +1 -1
- package/dist/web/assets/tab-host-window-content-Cd5tvEFg.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-Cd5tvEFg.js.gz +0 -0
- package/dist/web/assets/{tab-store-DrKCCcn0.js → tab-store-QBa8a8Ea.js} +1 -1
- package/dist/web/assets/{table-tab-Dfdj2oUR.js → table-tab-CD7Qac-8.js} +1 -1
- package/dist/web/assets/table-tab-CD7Qac-8.js.br +0 -0
- package/dist/web/assets/table-tab-CD7Qac-8.js.gz +0 -0
- package/dist/web/assets/{telegram-bot-token-field-DAlWvisV.js → telegram-bot-token-field-C41HjvH4.js} +1 -1
- package/dist/web/assets/telegram-bot-token-field-C41HjvH4.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-C41HjvH4.js.gz +0 -0
- package/dist/web/assets/{terminal-tab-DftSyAN_.js → terminal-tab-Vb7aINIY.js} +1 -1
- package/dist/web/assets/terminal-tab-Vb7aINIY.js.br +0 -0
- package/dist/web/assets/terminal-tab-Vb7aINIY.js.gz +0 -0
- package/dist/web/assets/{tool-cards-DtIbRB5W.js → tool-cards-BdQzObMQ.js} +3 -3
- package/dist/web/assets/tool-cards-BdQzObMQ.js.br +0 -0
- package/dist/web/assets/tool-cards-BdQzObMQ.js.gz +0 -0
- package/dist/web/assets/{tools-settings-section-7VXtk6zh.js → tools-settings-section-OY7q-Zhf.js} +1 -1
- package/dist/web/assets/tools-settings-section-OY7q-Zhf.js.br +0 -0
- package/dist/web/assets/tools-settings-section-OY7q-Zhf.js.gz +0 -0
- package/dist/web/assets/use-assistant-sessions-3oXMiFYH.js +1 -0
- package/dist/web/assets/use-assistant-sessions-3oXMiFYH.js.br +0 -0
- package/dist/web/assets/use-assistant-sessions-3oXMiFYH.js.gz +0 -0
- package/dist/web/assets/{use-assistant-telegram-binding-BDrv3xPb.js → use-assistant-telegram-binding-6aINJEG2.js} +1 -1
- package/dist/web/assets/use-assistant-telegram-binding-6aINJEG2.js.br +0 -0
- package/dist/web/assets/use-assistant-telegram-binding-6aINJEG2.js.gz +0 -0
- package/dist/web/assets/{use-db-read-CRBKwyT0.js → use-db-read-CYyXlrHg.js} +1 -1
- package/dist/web/assets/use-db-read-CYyXlrHg.js.br +0 -0
- package/dist/web/assets/use-db-read-CYyXlrHg.js.gz +0 -0
- package/dist/web/assets/{use-db-tab-Ba601MmM.js → use-db-tab-CJCQHAda.js} +1 -1
- package/dist/web/assets/use-db-tab-CJCQHAda.js.br +0 -0
- package/dist/web/assets/use-db-tab-CJCQHAda.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-Dtf0igmc.js → use-inline-blame-Bq7r7fR2.js} +1 -1
- package/dist/web/assets/use-inline-blame-Bq7r7fR2.js.br +0 -0
- package/dist/web/assets/use-inline-blame-Bq7r7fR2.js.gz +0 -0
- package/dist/web/assets/{use-lsp-DpckRfpY.js → use-lsp-COwyy852.js} +1 -1
- package/dist/web/assets/use-lsp-COwyy852.js.br +0 -0
- package/dist/web/assets/use-lsp-COwyy852.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-LNAN16lw.js → use-monaco-theme-ADh3jLKW.js} +1 -1
- package/dist/web/assets/{use-process-kill-qtE7lYOh.js → use-process-kill-DKxuw25F.js} +1 -1
- package/dist/web/assets/use-process-kill-DKxuw25F.js.br +0 -0
- package/dist/web/assets/use-process-kill-DKxuw25F.js.gz +0 -0
- package/dist/web/assets/{use-sql-schema-info-Bmg281GG.js → use-sql-schema-info-CIzHL0f_.js} +1 -1
- package/dist/web/assets/use-sql-schema-info-CIzHL0f_.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-CIzHL0f_.js.gz +0 -0
- package/dist/web/assets/{use-websocket-BMYxcPK5.js → use-websocket-D3WN8hb_.js} +1 -1
- package/dist/web/assets/{user-message-parse-CQHAZlXx.js → user-message-parse-CfOxGzPd.js} +1 -1
- package/dist/web/assets/user-message-parse-CfOxGzPd.js.br +0 -0
- package/dist/web/assets/user-message-parse-CfOxGzPd.js.gz +0 -0
- package/dist/web/assets/{voice-settings-section-DU4upkvs.js → voice-settings-section-ow83QJOS.js} +1 -1
- package/dist/web/assets/voice-settings-section-ow83QJOS.js.br +0 -0
- package/dist/web/assets/voice-settings-section-ow83QJOS.js.gz +0 -0
- package/dist/web/assets/{web-preview-tab-PKyBaE63.js → web-preview-tab-CStu-3Sp.js} +1 -1
- package/dist/web/assets/web-preview-tab-CStu-3Sp.js.br +0 -0
- package/dist/web/assets/web-preview-tab-CStu-3Sp.js.gz +0 -0
- package/dist/web/assets/{xlsx-preview-D8-XSrk6.js → xlsx-preview-BlU_ki6D.js} +1 -1
- package/dist/web/assets/xlsx-preview-BlU_ki6D.js.br +0 -0
- package/dist/web/assets/xlsx-preview-BlU_ki6D.js.gz +0 -0
- package/dist/web/index.html +26 -26
- 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 +41 -6
- package/docs/architecture/ppm-assistant.md +153 -4
- package/package.json +1 -1
- package/src/cli/commands/restart.ts +30 -3
- package/src/cli/commands/stop.ts +19 -0
- package/src/index.ts +1 -0
- package/src/server/index.ts +13 -0
- package/src/server/routes/design-shots.ts +27 -0
- package/src/server/ws/chat-inject.ts +3 -4
- package/src/server/ws/chat-user-words.ts +9 -1
- package/src/server/ws/chat.ts +28 -0
- package/src/services/assistant/assistant-settings.service.ts +2 -1
- package/src/services/assistant/assistant-turn-provenance.ts +36 -5
- package/src/services/assistant-cards/assistant-cards-db.ts +43 -3
- package/src/services/assistant-cards/assistant-cards-outbound-db.ts +14 -3
- package/src/services/assistant-cards/assistant-cards-startup.ts +3 -0
- package/src/services/assistant-cards/assistant-cards.service.ts +18 -3
- package/src/services/assistant-cards/card-reply-actions.ts +15 -2
- package/src/services/assistant-cards/card-reply-followup-tracker.ts +403 -0
- package/src/services/assistant-cards/card-reply-followup.ts +121 -0
- package/src/services/assistant-cards/forward-verbatim-env.ts +2 -0
- package/src/services/assistant-cards/forward-verbatim.ts +29 -5
- package/src/services/assistant-cards/manager-report-env.ts +7 -0
- package/src/services/assistant-cards/manager-report-tool.ts +35 -2
- package/src/services/assistant-hub/assistant-hub-startup.ts +9 -0
- package/src/services/assistant-managers/manager-context-entry.ts +19 -0
- package/src/services/assistant-telegram/assistant-telegram-card-followups.ts +134 -0
- package/src/services/assistant-telegram/assistant-telegram-card-kinds.ts +5 -0
- package/src/services/assistant-telegram/assistant-telegram-card-photos.ts +51 -0
- package/src/services/assistant-telegram/assistant-telegram-card-replies.ts +11 -4
- package/src/services/assistant-telegram/assistant-telegram-followup-format.ts +81 -0
- package/src/services/assistant-telegram/assistant-telegram-manager-cards.ts +8 -1
- package/src/services/assistant-telegram/assistant-telegram.service.ts +5 -0
- package/src/services/assistant-wake/assistant-wake-queue.ts +15 -1
- package/src/services/assistant-wake/wake-news-text.ts +18 -7
- package/src/services/chat-control/collab-deciding-input.ts +14 -0
- package/src/services/design/shots/design-shots.service.ts +247 -0
- package/src/services/design/shots/headless-browser.ts +280 -0
- package/src/services/log-rotate.ts +21 -0
- package/src/services/notification-format.ts +1 -0
- package/src/services/restart-news/interrupted-chats.ts +234 -0
- package/src/services/restart-news/ordered-stop-note.ts +69 -0
- package/src/services/restart-news/restart-news-lifecycle.ts +161 -0
- package/src/services/restart-news/restart-news-run.ts +55 -0
- package/src/services/restart-news/restart-news-source.ts +240 -0
- package/src/services/restart-news/restart-news-text.ts +154 -0
- package/src/services/restart-news/server-run-log.ts +115 -0
- package/src/services/restart-news/start-reason.ts +128 -0
- package/src/services/restart-news/supervisor-start-reason.ts +138 -0
- package/src/services/session-collab/assistant-send-guards-live.ts +31 -5
- package/src/services/session-collab/assistant-send-guards.ts +5 -5
- package/src/services/session-collab/collab-assistant-hooks.ts +5 -2
- package/src/services/session-collab/collab-caller-policy.ts +3 -2
- package/src/services/session-collab/collab-context.ts +42 -6
- package/src/services/session-collab/collab-create.ts +37 -19
- package/src/services/session-collab/collab-deliver.ts +30 -5
- package/src/services/session-collab/collab-design-shot.ts +86 -0
- package/src/services/session-collab/collab-env.ts +26 -8
- package/src/services/session-collab/collab-send-manager.ts +3 -3
- package/src/services/session-collab/session-collab-endpoint.ts +3 -1
- package/src/services/session-collab/session-collab-tool.ts +13 -2
- package/src/services/supervisor-self-replace-wait.ts +45 -0
- package/src/services/supervisor.ts +175 -63
- package/src/services/telegram/telegram-bot-client.ts +79 -0
- package/src/services/windows-process-tree.ts +155 -32
- package/src/shared/assistant-cards.ts +28 -0
- package/src/shared/assistant-limits.ts +23 -0
- package/src/shared/assistant-provenance.ts +26 -2
- package/src/shared/assistant-settings.ts +10 -0
- package/src/shared/assistant-wake-news.ts +14 -2
- package/src/shared/chat-from-session.ts +10 -1
- package/src/shared/restart-news.ts +140 -0
- package/src/shared/session-collab.ts +5 -1
- package/src/web/components/assistant/cards/card-images.tsx +65 -0
- package/src/web/components/assistant/cards/card-shell.tsx +12 -0
- package/src/web/components/assistant/cards/decision-card.tsx +2 -0
- package/src/web/components/assistant/cards/outcome-card.tsx +2 -0
- package/src/web/components/chat/collab-approval-card.tsx +6 -0
- package/src/web/components/settings/assistant/assistant-digest-quiet-section.tsx +28 -10
- package/src/web/components/settings/tools-settings-section.tsx +4 -0
- package/src/web/lib/assistant-settings-api.ts +4 -4
- package/src/web/lib/session-collab-tool-call.ts +4 -3
- package/dist/web/assets/accounts-settings-section-Dj-tqgLP.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-Dj-tqgLP.js.gz +0 -0
- package/dist/web/assets/agent-session-sheet-ES6BGGHr.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-ES6BGGHr.js.gz +0 -0
- package/dist/web/assets/agent-session-window-content-D1Qz_Jtj.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-D1Qz_Jtj.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-C1xHoS9l.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-C1xHoS9l.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-B2s5uYmr.js.br +0 -0
- package/dist/web/assets/ai-settings-section-B2s5uYmr.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-D0LobmFN.js.br +0 -0
- package/dist/web/assets/ai-settings-section-D0LobmFN.js.gz +0 -0
- package/dist/web/assets/android-tab-JEd1TSF7.js.br +0 -0
- package/dist/web/assets/android-tab-JEd1TSF7.js.gz +0 -0
- package/dist/web/assets/antigravity-usage-view-CCOvhebf.js.br +0 -0
- package/dist/web/assets/antigravity-usage-view-CCOvhebf.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-DO6hc-od.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-DO6hc-od.js.gz +0 -0
- package/dist/web/assets/apps-panel-DcTJU6vR.js.br +0 -0
- package/dist/web/assets/apps-panel-DcTJU6vR.js.gz +0 -0
- package/dist/web/assets/assistant-name-store-DunABllt.js.br +0 -0
- package/dist/web/assets/assistant-name-store-DunABllt.js.gz +0 -0
- package/dist/web/assets/assistant-settings-D0Ro1s7r.js +0 -1
- package/dist/web/assets/assistant-settings-D0Ro1s7r.js.br +0 -0
- package/dist/web/assets/assistant-settings-D0Ro1s7r.js.gz +0 -0
- package/dist/web/assets/assistant-settings-section-B2Ku9p0H.js.br +0 -0
- package/dist/web/assets/assistant-settings-section-B2Ku9p0H.js.gz +0 -0
- package/dist/web/assets/assistant-tab-C7PHbtlQ.js.br +0 -0
- package/dist/web/assets/assistant-tab-C7PHbtlQ.js.gz +0 -0
- package/dist/web/assets/background-output-store-D2KAitP3.js.br +0 -0
- package/dist/web/assets/background-output-store-D2KAitP3.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-BTkWVfIx.js.br +0 -0
- package/dist/web/assets/branch-review-tab-BTkWVfIx.js.gz +0 -0
- package/dist/web/assets/build-message-with-attachments-CRWLGa4Y.js.br +0 -0
- package/dist/web/assets/build-message-with-attachments-CRWLGa4Y.js.gz +0 -0
- package/dist/web/assets/chat-tab-BeGzYhAz.js +0 -1
- package/dist/web/assets/chat-tab-BeGzYhAz.js.br +0 -0
- package/dist/web/assets/chat-tab-BeGzYhAz.js.gz +0 -0
- package/dist/web/assets/chat-tab-edXhE4lm.js.br +0 -0
- package/dist/web/assets/chat-tab-edXhE4lm.js.gz +0 -0
- package/dist/web/assets/code-editor-B1hoVvoe.js.br +0 -0
- package/dist/web/assets/code-editor-B1hoVvoe.js.gz +0 -0
- package/dist/web/assets/conflict-editor-CiGF-H8E.js.br +0 -0
- package/dist/web/assets/conflict-editor-CiGF-H8E.js.gz +0 -0
- package/dist/web/assets/connection-form-tab-DfrYYyqN.js.br +0 -0
- package/dist/web/assets/connection-form-tab-DfrYYyqN.js.gz +0 -0
- package/dist/web/assets/csv-preview-PhPn1H22.js.br +0 -0
- package/dist/web/assets/csv-preview-PhPn1H22.js.gz +0 -0
- package/dist/web/assets/database-drivers-section-C2iSgtsK.js.br +0 -0
- package/dist/web/assets/database-drivers-section-C2iSgtsK.js.gz +0 -0
- package/dist/web/assets/db-connection-config-FJf8q_kG.js.br +0 -0
- package/dist/web/assets/db-connection-config-FJf8q_kG.js.gz +0 -0
- package/dist/web/assets/db-explorer-store-DiyDlsSd.js.br +0 -0
- package/dist/web/assets/db-explorer-store-DiyDlsSd.js.gz +0 -0
- package/dist/web/assets/db-tab-parts-CFvFJKsW.js.br +0 -0
- package/dist/web/assets/db-tab-parts-CFvFJKsW.js.gz +0 -0
- package/dist/web/assets/design-settings-section-C3rGRKd9.js.br +0 -0
- package/dist/web/assets/design-settings-section-C3rGRKd9.js.gz +0 -0
- package/dist/web/assets/design-tab-CujDONDO.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-BmzMD8PY.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-BmzMD8PY.js.gz +0 -0
- package/dist/web/assets/diff-viewer-BradW_q7.js.br +0 -0
- package/dist/web/assets/diff-viewer-BradW_q7.js.gz +0 -0
- package/dist/web/assets/docx-preview-CrfPGFGk.js.br +0 -0
- package/dist/web/assets/docx-preview-CrfPGFGk.js.gz +0 -0
- package/dist/web/assets/editor-dialog-CIIhsxqp.js.br +0 -0
- package/dist/web/assets/editor-dialog-CIIhsxqp.js.gz +0 -0
- package/dist/web/assets/editor-language-service-stDe-8Hh.js.br +0 -0
- package/dist/web/assets/editor-language-service-stDe-8Hh.js.gz +0 -0
- package/dist/web/assets/explorer-body-DslJEPu8.js.br +0 -0
- package/dist/web/assets/explorer-body-DslJEPu8.js.gz +0 -0
- package/dist/web/assets/explorer-model-Daztib0H.js.br +0 -0
- package/dist/web/assets/explorer-model-Daztib0H.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-Cujhxewh.js.br +0 -0
- package/dist/web/assets/explorer-window-content-Cujhxewh.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-DVYKtRbp.js.br +0 -0
- package/dist/web/assets/extension-manager-section-DVYKtRbp.js.gz +0 -0
- package/dist/web/assets/extension-webview-CYKu8RhB.js.br +0 -0
- package/dist/web/assets/extension-webview-CYKu8RhB.js.gz +0 -0
- package/dist/web/assets/files-settings-section-DQn2QDq8.js.br +0 -0
- package/dist/web/assets/files-settings-section-DQn2QDq8.js.gz +0 -0
- package/dist/web/assets/general-settings-section-CnZIAqkr.js.br +0 -0
- package/dist/web/assets/general-settings-section-CnZIAqkr.js.gz +0 -0
- package/dist/web/assets/git-log-panel-C91xwW-U.js.br +0 -0
- package/dist/web/assets/git-log-panel-C91xwW-U.js.gz +0 -0
- package/dist/web/assets/git-review-tab-WpaSXeje.js.br +0 -0
- package/dist/web/assets/git-review-tab-WpaSXeje.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-sts6YE2c.js.br +0 -0
- package/dist/web/assets/glide-data-grid-sts6YE2c.js.gz +0 -0
- package/dist/web/assets/grid-save-dialog-jjma4-nR.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-jjma4-nR.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-ze6sWOA9.js.br +0 -0
- package/dist/web/assets/group-chat-tab-ze6sWOA9.js.gz +0 -0
- package/dist/web/assets/impexp-tab-ClR7MjKN.js.br +0 -0
- package/dist/web/assets/impexp-tab-ClR7MjKN.js.gz +0 -0
- package/dist/web/assets/index-B28_HhQI.css +0 -1
- package/dist/web/assets/index-B28_HhQI.css.br +0 -0
- package/dist/web/assets/index-B28_HhQI.css.gz +0 -0
- package/dist/web/assets/index-DdWNTpRC.js.br +0 -0
- package/dist/web/assets/index-DdWNTpRC.js.gz +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-DQq6Hr5R.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-DQq6Hr5R.js.gz +0 -0
- package/dist/web/assets/language-servers-section-B8DlpKwG.js.br +0 -0
- package/dist/web/assets/language-servers-section-B8DlpKwG.js.gz +0 -0
- package/dist/web/assets/logs-app-BSb7y8Ub.js.br +0 -0
- package/dist/web/assets/logs-app-BSb7y8Ub.js.gz +0 -0
- package/dist/web/assets/logs-tab-DNtMgRwA.js +0 -1
- package/dist/web/assets/lsp-client-BcS52GK3.js.br +0 -0
- package/dist/web/assets/lsp-client-BcS52GK3.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-DyR-2m0n.js.br +0 -0
- package/dist/web/assets/markdown-renderer-DyR-2m0n.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-pHQ_XZui.js +0 -1
- package/dist/web/assets/markdown-renderer-pHQ_XZui.js.br +0 -0
- package/dist/web/assets/markdown-renderer-pHQ_XZui.js.gz +0 -0
- package/dist/web/assets/mobile-explorer-sheet-CDkiK9ss.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-CDkiK9ss.js.gz +0 -0
- package/dist/web/assets/model-thinking-selector-helpers-B9R_GCmG.js.br +0 -0
- package/dist/web/assets/model-thinking-selector-helpers-B9R_GCmG.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-CEheObfH.js.br +0 -0
- package/dist/web/assets/new-design-dialog-CEheObfH.js.gz +0 -0
- package/dist/web/assets/notifications-settings-section--wueiusr.js.br +0 -0
- package/dist/web/assets/notifications-settings-section--wueiusr.js.gz +0 -0
- package/dist/web/assets/onboarding-entry-BnyHu8g-.js.br +0 -0
- package/dist/web/assets/onboarding-entry-BnyHu8g-.js.gz +0 -0
- package/dist/web/assets/open-assistant-CIClEfBP.js.br +0 -0
- package/dist/web/assets/open-assistant-CIClEfBP.js.gz +0 -0
- package/dist/web/assets/open-assistant-DL7Uhfi1.js +0 -1
- package/dist/web/assets/open-db-tabs-hq8ISs9i.js.br +0 -0
- package/dist/web/assets/open-db-tabs-hq8ISs9i.js.gz +0 -0
- package/dist/web/assets/open-manager-chat-Bq9rYZkX.js.br +0 -0
- package/dist/web/assets/open-manager-chat-Bq9rYZkX.js.gz +0 -0
- package/dist/web/assets/open-manager-chat-DqvuUigC.js +0 -1
- package/dist/web/assets/open-ppm-tab-8o5Mp2VL.js.br +0 -0
- package/dist/web/assets/open-ppm-tab-8o5Mp2VL.js.gz +0 -0
- package/dist/web/assets/panel-store-BVDYuCvt.js.br +0 -0
- package/dist/web/assets/panel-store-BVDYuCvt.js.gz +0 -0
- package/dist/web/assets/performance-panel-CKT9071S.js.br +0 -0
- package/dist/web/assets/performance-panel-CKT9071S.js.gz +0 -0
- package/dist/web/assets/ppm-tools-DkXwX2Et.js.br +0 -0
- package/dist/web/assets/ppm-tools-DkXwX2Et.js.gz +0 -0
- package/dist/web/assets/problems-panel-3DmEaBKD.js.br +0 -0
- package/dist/web/assets/problems-panel-3DmEaBKD.js.gz +0 -0
- package/dist/web/assets/process-table-CJAoXA5W.js.br +0 -0
- package/dist/web/assets/process-table-CJAoXA5W.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-2l86_w2k.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-2l86_w2k.js.gz +0 -0
- package/dist/web/assets/query-tab-B94Pr_zx.js.br +0 -0
- package/dist/web/assets/query-tab-B94Pr_zx.js.gz +0 -0
- package/dist/web/assets/release-notes-window-content-Cb02dQ0z.js +0 -1
- package/dist/web/assets/remote-access-settings-section-a8AImvR6.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-a8AImvR6.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-DFn1nxw8.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-DFn1nxw8.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BWS190GJ.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BWS190GJ.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-Byw7sIXV.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-Byw7sIXV.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CNw85fJW.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CNw85fJW.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-D-hkqiGt.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-D-hkqiGt.js.gz +0 -0
- package/dist/web/assets/rename-object-dialog-DMjr26AG.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-DMjr26AG.js.gz +0 -0
- package/dist/web/assets/review-address-setup-CjN4yI9s.js.br +0 -0
- package/dist/web/assets/review-address-setup-CjN4yI9s.js.gz +0 -0
- package/dist/web/assets/review-code-BPChqugN.js.br +0 -0
- package/dist/web/assets/review-code-BPChqugN.js.gz +0 -0
- package/dist/web/assets/save-as-dialog-DZabqzFG.js.br +0 -0
- package/dist/web/assets/save-as-dialog-DZabqzFG.js.gz +0 -0
- package/dist/web/assets/schedule-script-editor-CmbffDN5.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-CmbffDN5.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-C9buhsq2.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-C9buhsq2.js.gz +0 -0
- package/dist/web/assets/send-to-chat-oE-JUerN.js.br +0 -0
- package/dist/web/assets/send-to-chat-oE-JUerN.js.gz +0 -0
- package/dist/web/assets/session-changes-chip-BieRAjqg.js.br +0 -0
- package/dist/web/assets/session-changes-chip-BieRAjqg.js.gz +0 -0
- package/dist/web/assets/session-collab-client-DU-Iuwkh.js.br +0 -0
- package/dist/web/assets/session-collab-client-DU-Iuwkh.js.gz +0 -0
- package/dist/web/assets/session-collab-rL-aatJP.js +0 -1
- package/dist/web/assets/session-review-tab-Du1h3fb7.js.br +0 -0
- package/dist/web/assets/session-review-tab-Du1h3fb7.js.gz +0 -0
- package/dist/web/assets/session-turns-Brf8WhTP.js.br +0 -0
- package/dist/web/assets/session-turns-Brf8WhTP.js.gz +0 -0
- package/dist/web/assets/settings-body-CSXclIUd.js.br +0 -0
- package/dist/web/assets/settings-body-CSXclIUd.js.gz +0 -0
- package/dist/web/assets/settings-rows-Db0TK6_7.js.br +0 -0
- package/dist/web/assets/settings-rows-Db0TK6_7.js.gz +0 -0
- package/dist/web/assets/settings-section-content-DIPL9pgs.js.br +0 -0
- package/dist/web/assets/settings-section-content-DIPL9pgs.js.gz +0 -0
- package/dist/web/assets/settings-store-DBwLfOkD.js +0 -45
- package/dist/web/assets/settings-store-DBwLfOkD.js.br +0 -0
- package/dist/web/assets/settings-store-DBwLfOkD.js.gz +0 -0
- package/dist/web/assets/sql-object-tab-CVOIYxsK.js.br +0 -0
- package/dist/web/assets/sql-object-tab-CVOIYxsK.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-gYzT8mK_.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-gYzT8mK_.js.gz +0 -0
- package/dist/web/assets/storage-settings-section-kLoWvAiE.js.br +0 -0
- package/dist/web/assets/storage-settings-section-kLoWvAiE.js.gz +0 -0
- package/dist/web/assets/structure-save-dialog-DKX27TZj.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-DKX27TZj.js.gz +0 -0
- package/dist/web/assets/structure-tab-B7nUzq1k.js.br +0 -0
- package/dist/web/assets/structure-tab-B7nUzq1k.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-ISqdObYR.js.br +0 -0
- package/dist/web/assets/system-monitor-body-ISqdObYR.js.gz +0 -0
- package/dist/web/assets/system-monitor-tab-BJcFebE0.js +0 -1
- package/dist/web/assets/tab-host-window-content-DruWYAe4.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-DruWYAe4.js.gz +0 -0
- package/dist/web/assets/table-tab-Dfdj2oUR.js.br +0 -0
- package/dist/web/assets/table-tab-Dfdj2oUR.js.gz +0 -0
- package/dist/web/assets/telegram-bot-token-field-DAlWvisV.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-DAlWvisV.js.gz +0 -0
- package/dist/web/assets/terminal-tab-DftSyAN_.js.br +0 -0
- package/dist/web/assets/terminal-tab-DftSyAN_.js.gz +0 -0
- package/dist/web/assets/tool-cards-DtIbRB5W.js.br +0 -0
- package/dist/web/assets/tool-cards-DtIbRB5W.js.gz +0 -0
- package/dist/web/assets/tools-settings-section-7VXtk6zh.js.br +0 -0
- package/dist/web/assets/tools-settings-section-7VXtk6zh.js.gz +0 -0
- package/dist/web/assets/use-assistant-sessions-ad7CX4sq.js +0 -1
- package/dist/web/assets/use-assistant-sessions-ad7CX4sq.js.br +0 -0
- package/dist/web/assets/use-assistant-sessions-ad7CX4sq.js.gz +0 -0
- package/dist/web/assets/use-assistant-telegram-binding-BDrv3xPb.js.br +0 -0
- package/dist/web/assets/use-assistant-telegram-binding-BDrv3xPb.js.gz +0 -0
- package/dist/web/assets/use-db-read-CRBKwyT0.js.br +0 -0
- package/dist/web/assets/use-db-read-CRBKwyT0.js.gz +0 -0
- package/dist/web/assets/use-db-tab-Ba601MmM.js.br +0 -0
- package/dist/web/assets/use-db-tab-Ba601MmM.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-Dtf0igmc.js.br +0 -0
- package/dist/web/assets/use-inline-blame-Dtf0igmc.js.gz +0 -0
- package/dist/web/assets/use-lsp-DpckRfpY.js.br +0 -0
- package/dist/web/assets/use-lsp-DpckRfpY.js.gz +0 -0
- package/dist/web/assets/use-process-kill-qtE7lYOh.js.br +0 -0
- package/dist/web/assets/use-process-kill-qtE7lYOh.js.gz +0 -0
- package/dist/web/assets/use-sql-schema-info-Bmg281GG.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-Bmg281GG.js.gz +0 -0
- package/dist/web/assets/user-message-parse-CQHAZlXx.js.br +0 -0
- package/dist/web/assets/user-message-parse-CQHAZlXx.js.gz +0 -0
- package/dist/web/assets/voice-settings-section-DU4upkvs.js.br +0 -0
- package/dist/web/assets/voice-settings-section-DU4upkvs.js.gz +0 -0
- package/dist/web/assets/web-preview-tab-PKyBaE63.js.br +0 -0
- package/dist/web/assets/web-preview-tab-PKyBaE63.js.gz +0 -0
- package/dist/web/assets/xlsx-preview-D8-XSrk6.js.br +0 -0
- package/dist/web/assets/xlsx-preview-D8-XSrk6.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.25.9] - 2026-11-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Open a Design chat from any chat**: `create_session` takes a design, and `send_to_session` reaches Design chats; the Design tab shows those messages live.
|
|
8
|
+
- **`design_screenshot`** photographs a design's variants, and a manager's card can carry them, sent to Telegram as photos.
|
|
9
|
+
- **A manager's answer to your card reply comes back where you replied**, under the card on Telegram or in PPM, even while Telegram is quiet.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **A card reply that asks a question or rests on a wrong assumption is not an OK**: every manager answers it and asks again with a new card.
|
|
14
|
+
|
|
15
|
+
## [0.25.8] - 2026-11-15
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **The PPM Assistant is told after every PPM restart** (upgrade, crash, watchdog, manual or boot) why it restarted, the versions before and after, and which chats it cut off mid-turn in every project, so it can ask each project's manager to resume them; switch it in Settings → PPM Assistant.
|
|
20
|
+
- `ppm restart --reason "<text>"` records why you restarted.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- **An upgrade no longer takes PPM down**: a reused Windows process id could make the supervisor kill its own edge, tunnel and new supervisor; a server-tree kill now never reaches them, and a new supervisor that dies brings the old one back to restart the server.
|
|
25
|
+
- The previous `ppm.err.log` is kept as `ppm.err.log.1` when PPM starts.
|
|
26
|
+
|
|
3
27
|
## [0.25.7] - 2026-11-15
|
|
4
28
|
|
|
5
29
|
### Added
|
package/CLAUDE.md
CHANGED
|
@@ -275,6 +275,7 @@ Related: `configService.save()`/`set()` throw when `load()` has not run, because
|
|
|
275
275
|
|
|
276
276
|
- **The chat sidebar's session list read every Codex transcript on disk, synchronously, on every request**: `GET /chat/sessions` asks every provider, and Codex finds a project's sessions by reading the head of each rollout in each account's sessions tree, which holds every project's rollouts (5,262 files / 5.4 GB on the dev host). Done with `readSync` per request, that was 10.9 s of stopped event loop for one project with the files out of the OS cache, and the sidebar lists two or three projects at once — so the server froze 35–90 s at a time, many times a day (`Event loop stalled … cause=blocked`, main thread `waiting/Executive`), taking the usage panel, chat history and health probe down with it. The tell was in the log: nearly every stall had a `/chat/sessions` request whose duration matched the stall to within a second. `codex-rollout-index.ts` now keeps each rollout's header keyed by path and re-reads a file only when its size or mtime moves, reads asynchronously, shares one pass between concurrent callers and reads titles only for the page returned (two projects at once: 135 ms, longest event-loop block ~30 ms). Any new reader of that tree should go through it rather than `readSessionMeta`, which is for single lookups.
|
|
277
277
|
- **The SDK's `getSessionMessages` reads the whole transcript, however little you need from it**: past 5 MB it scans every byte for the last `compact_boundary` (1 MB reads on Bun's pool threads) and then `JSON.parse`s all that follows. The streaming loop's tool_result fallback used to fire on the frames that follow a tool_use inside its own response (`content_block_stop`, `message_delta`, `message_stop`), i.e. on every tool call before the tool had even run, and it yielded each result twice. One 7-day session's 1.47 GB transcript was read back every ~8 s: the server's RSS swung 4.9→12.8 GB, its main thread sat at 96% and requests hit Bun's 10 s timeout. The fallback now waits for a new response (`message_start`, or an assistant frame of another message id). Measured over 3 tool calls on a 401 MB transcript, peak RSS went 1466 MB → 203 MB. Keep it off every per-event path: `readCompactions` with no window still reads the whole file. `claude-agent-sdk.test.ts` "tool results" pins both halves of the fallback. Its "skip what precedes the boundary" is also void in practice: a boundary carrying `preservedSegment`/`preservedMessages` (every current auto-compaction) never resets the scan, so a 1.77 GB transcript was read whole on each chat open (8.5 s, +5.7 GB RSS) for 31 messages. Every call now goes through `readSessionMessages` (`src/providers/claude-transcript-tail.ts`), which reads backward to the newest boundary plus the records it preserves and hands that range to the SDK as a `sessionStore` — same answer, byte for byte on the 60 largest local transcripts. When comparing against the SDK from a script outside the repo, import `node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs` by path: a bare import from `/tmp` makes Bun auto-install another SDK version, whose output differs.
|
|
278
|
+
- **On Windows a parent PID is a claim about a process that may no longer exist, so never walk a tree by parent PID alone**: Windows does not reparent, and the edge, the tunnel and a self-replaced supervisor all keep naming the supervisor that started them long after it exits. The server tree churns PIDs fast (git, shells, MCP servers), so one of its processes eventually gets that dead supervisor's PID, and a walk by parent PID then lists the edge, the tunnel and the *running* supervisor as server descendants. That is exactly what happened on the 0.25.6 → 0.25.7 upgrade (14/11/2026): `snapshotServerDescendants` had recorded all three, stopping the server for the upgrade reaped them, the supervisor killed itself mid-self-replace, and PPM stayed down 11 minutes with no log line saying why. `descendantsByLineage` (`windows-process-tree.ts`) only accepts a child that started no earlier than its parent. The supervisor's kills of the server tree — the stop before an upgrade, the health-check kill and `shutdown()` — go through `killTreeByLineage` (blocking `killTreeByLineageSync` in `shutdown()`), and the reap (`reapTrackedDescendants`) walks the same lineage. They kill the server itself even when the process list cannot be read, spare the supervisor, its ancestors, the edge, the tunnel and the share host, and do not use `taskkill /T`, which walks parent PIDs as they stand. `killProcessTree` (`taskkill /T`) is still used elsewhere: port-holder kills, the `ppm start` stale-status cleanup, the codex and cloudflared helpers. Two related guards: a self-replace gives up the moment its new supervisor exits, even one that already wrote its PID to status.json (it used to wait 30 s and trust that PID), and a server stopped while `shuttingDown` is not counted as a crash. `ppm start` keeps the previous `ppm.err.log` as `ppm.err.log.1`, because `Start-Process -RedirectStandardError` truncates it. For a supervisor started by `ppm start`, that file is the only record left when it dies without a log line; a self-replaced supervisor writes its stderr into `ppm.log` instead. The first upgrade onto this code still runs the old supervisor's reap against whatever its tracked file holds.
|
|
278
279
|
- **Bun before 1.3.11 on Windows leaks every idle helper thread, so PPM must not run on it**: JavaScriptCore's helper threads exit after 10 s idle and come back with the next bit of work, and those releases (measured: 1.2.23, 1.3.9, 1.3.10) never close their handles. Any process on a timer longer than that churns them, and the supervisor reached 7,352 dead `Thread` handles and 15.4 GB of private bytes (484 fully committed 32 MB segments) against a 1.4 GB working set in 37 hours. A script that only sleeps in 15 s gaps leaks ~8 handles a cycle on 1.3.10 and none on 1.3.11–1.4.4. `bun-runtime-advisory.ts` WARNs at start on a runtime measured to leak, and `scripts/release.sh` refuses to build with one, because `bun build --compile` embeds the builder's own runtime in every binary. Releases use 1.3.12: 1.3.13 rejects TLS over an existing socket (the SSH-tunnel database path, `tls-identity-check.test.ts`), and from 1.4.1–1.4.4 `node:child_process` no longer goes through `Bun.spawn`, which blinds the memory monitor's spawn tracker (`memory-watchdog.test.ts`). 1.3.12 fixed the handles, **not the memory**: each idle exit still keeps a fully committed 32 MB block. A probe that allocates and forces a GC every 11 s gained 7–10 blocks in 54–59 cycles on 1.3.12, the same work every 2 s gained none in 328, and 1.4.4 gained none at 11 s (flat at 90 MB). Private bytes climb while RSS stays put, so measure commit, never RSS. Every long-lived Bun process leaks this way: the server ~180 MB/h idle, the supervisor ~250–330 MB/h, and worst of all the edge, which every upgrade adopts instead of replacing (5.7 GB after 34 h, 144 blocks). So on Windows the edge hands its port to a fresh copy once its private bytes have been over 1.5 GB for two readings in a row and the moment is quiet (at most `EDGE_RECYCLE_QUIET_CONNECTIONS` clients open; `PPM_EDGE_RECYCLE_MB`, `0` = off). It closes the listener and its few clients and exits 75. The supervisor starts the successor from that exit event (a ~70 ms gap, measured), or, for an adopted edge with no exit handle, from a 250 ms watch it starts once its own 10 s reading sees the edge over the limit. The second reading, a minute after the first, makes it all but certain the supervisor's own reading saw the edge over the limit before it exits; with the edge exiting at its first over-limit reading and the supervisor reading once a minute, an adopted edge's recycle was often taken for a crash. `adoptEdge` replaces an edge already over the limit instead of adopting it, but kills it only when netstat names it as the port's listener (`isPpmProcess` matches any command line containing "ppm"); see `edge-recycle-policy.ts`. Off Windows nothing reports commit per process, so nothing is recycled there. When timing Bun versions here, run every binary from the same folder: one outside `~/.bun/bin` is Defender-scanned and reads new files 25–50x slower. How to inspect a leaking Windows process without tools: `docs/lessons-learned.md`.
|
|
279
280
|
- **A process with little CPU during a stall was not necessarily starved**: the Windows autostart task once ran at the Task Scheduler's default priority 7, which also means memory priority 2 and I/O priority Low for the supervisor and every child it spawns. The server's main thread then sat in `PageIn` waits for 20-60s on an idle machine (13% CPU) until the health check killed it, while the lag monitor logged `cause=starved`. The task is now priority 5, both processes raise themselves at start (`process-priority.ts`, logged as a `WARN` when it fires), the lag monitor says `cause=blocked` when cores were free, and a failed health probe logs the server's main-thread wait from the supervisor (`process-thread-snapshot.ts`). See `docs/lessons-learned.md`.
|
|
280
281
|
- **On Windows every child PPM spawned kept a copy of every socket PPM had open, so a connection the server closed never closed**: Bun 1.3.10 creates its sockets inheritable — the `Bun.serve` listener, every accepted connection, `fetch`'s outgoing ones — and `Bun.spawn` creates children with handle inheritance on; `node:child_process` (the Agent SDK's Claude CLI on Windows, codex, git) goes through `Bun.spawn`. Measured with a handle dump of the server's PowerShell child: it held the server's listener and both open client connections, by address. `closesocket` then drops one handle of several, no FIN goes out, and the browser reuses what it still thinks is a live keep-alive connection: a reload after the server spawned a long-lived child hung **44 s** waiting on the old page's `DELETE /api/system/resources/stream/…` (2/2 runs; 72-78 ms with the fix) — the "blank page after a chat cold-starts Claude" report. Inherited handles stay inheritable, so they pass to grandchildren too. Clearing the flag on the listener is not enough (an accepted socket is created inheritable again), and identifying sockets first is not safe: `getsockopt` on an inheritable synchronous pipe that another thread is blocked reading never returned. `src/services/windows-socket-inheritance.ts` therefore wraps `Bun.spawn`/`Bun.spawnSync` once at startup (`src/index.ts`, `__serve__`, the supervisor) and clears `HANDLE_FLAG_INHERIT` on every handle except stdin/stdout/stderr before each spawn — a handle-table call that touches no object (0.25 ms clearing 101 handles, 0.02 ms after); libuv still duplicates the child's own stdio as inheritable inside the spawn. Not covered, and not needed today: `Bun.$` does not go through `Bun.spawn` (only `ppm report` uses it), and bun-pty's ConPTY spawn does not inherit (measured). A spawn from a Worker would not be wrapped, and one running concurrently with a sweep could lose its stdio — PPM spawns only from the main thread; keep it that way. To check a process: duplicate its handles into a probe and ask each `getsockname`/`getpeername` (with a timeout per handle — see the pipe hang above); `handle.exe` needs admin. `tests/unit/services/windows-socket-inheritance.test.ts` fails without the guard (no EOF in 8 s while the child lives).
|
|
@@ -292,6 +293,7 @@ Related: `configService.save()`/`set()` throw when `load()` has not run, because
|
|
|
292
293
|
- **An Assistant → session message keeps origin `session`**: main's guards key on that origin — waiting for a starting consumer, the refusal of a provider that cannot take a mid-turn message, from-session decoding — and a new origin would skip all three silently. The sender is marked in the from-session block (`kind: "assistant"`), and the manager-only provenance block decodes only on such a message.
|
|
293
294
|
- **A `permissionMode` sent with a server-side message into an existing chat overwrites that chat's own mode**: a mode on `chatControl().sendUserMessage` starts the chat's subprocess in it (`liveMode`), and every later turn of that subprocess, the user's included, runs in it. A server sender that means "in the chat's own mode" must send none — the old prompt schedule sent `bypassPermissions` by default. `chatControl` refuses one outright for origin `schedule`.
|
|
294
295
|
- **Only the server writes `ppm-…-v1` blocks**: `<ppm-assistant-provenance-v1>` and `<ppm-user-words-v1>` are encoded by the server alone (`forward-verbatim.ts` for the user's words, with a source test for a second writer); every other door — a session-tool body, every `report_to_assistant` field, Telegram text including the user's own forwards, notebook text and the rules file — breaks their markers, and `deliverToSession` defuses any PPM-looking tag (`neutralizePpmTags`), because a model reads them loosely.
|
|
296
|
+
- **The manager's answer to a card reply is the turn its client id names, never "the next turn end" — and Claude never names a reply pushed into a running turn**: words forwarded from a card can be queued behind a running turn, and a schedule or another chat's message can run turns in between, so the next `turn_ended` of the manager chat is often someone else's answer. `forwardUserWords` chooses the `card-<uuid>` id *before* the send (a provider can name the turn before `deliverUserWords` returns) and `card-reply-followup-tracker.ts` waits for the `turn_started` carrying it. The bundled CLI runs `UserPromptSubmit` only for a prompt that opens a turn, so an `inserted` reply is never named: it is judged **once**, at the first turn end after it went in, and answered after the 3 s grace only if the chat is idle and `liveState().turnId` is still that turn — any turn PPM started in between sends nothing (`turnId` moves only for prompts PPM pushed; a task-notification or CLI-continuation turn leaves it unchanged, but what is sent is still the snapshot of the first turn end, so no later turn's text can leak), because a re-judged later turn once sent a schedule's answer to the user's phone. The answer is every top-level block from the reply on: a turn that opened no card sends every block in order; in one that did, lines that only confirm a tool call ("Card sent.") are dropped and other short lines only beside a longer block (a short real answer after the card, "Được anh.", must survive), and the last block is kept whole under the cap. A stopped or failed turn sends no text (a Telegram reply gets one "stopped" line) — and a Stop on the first turn of a fresh Claude subprocess arrives as `outcome: "done"` with `cancelledBy` set, which counts as stopped. Each reply resolves its chat id once (`canonical` is a database lookup) and the stream path asks a set, since every event of every chat passes through it. A reply typed on Telegram rings for 30 min after it whatever "quiet while I'm at PPM" says (`assistant-telegram-card-followups.ts`). A reply or a bare OK to the answer's message goes to the card replied to, never to a new card the answer named: routing it there let an "ok, noted" on a "stopped" notice or on a card held in quiet hours approve a decision the user never saw.
|
|
295
297
|
- **The e2e image runs Node 20 and ships no browser**: `ppm-e2e-chromium` has no global `WebSocket` and no `node:sqlite` in Node (a script that needs them runs only on Node 22.5+, so the manager-loop e2e types into chats through a fixture route instead), and `playwright-core` must be launched with `executablePath: process.env.PPM_PLAYWRIGHT_EXECUTABLE`. Two traps for any scripted fixture as well: the chat composer holds a phone and a desktop `textarea[aria-label="Message"]`, so select `:visible`; and "Set as manager chat" finds a chat with no provider row through the Claude provider's `getSessionInfoById`, which a scripted provider must implement or the dialog says "No Claude chat with that id".
|
|
296
298
|
- **use-stick-to-bottom watches the content, not the container, and reads every unexplained upward scroll as the reader**: when the chat's scroller gets taller while following (the composer shrinking after a multi-line message, the queue stack or a footer bar going away, a phone keyboard closing), the browser clamps `scrollTop` to the new maximum. The library's scroll handler sees `scrollTop` decrease with no content resize to explain it and escapes the lock, although the view is still at the bottom, so the reply grows out of sight until the reader scrolls down. The clamp's scroll event can arrive before or after the container's ResizeObserver report, depending on whether a layout was forced earlier. `message-list.tsx` re-locks from both ends, 2 ms after the event, i.e. after the library's own 1 ms look. Step 7 of `tests/e2e/chat-queue-e2e.mjs` fails without it (gap 150 px). Its wheel handler never fires here: it walks up to an element whose computed `overflow` is exactly `auto`/`scroll`, and the chat's `overflow-x-hidden overflow-y-auto` computes to `hidden auto`.
|
|
297
299
|
- **A design kit carries the app shell's `html, body` rules, and with a long page they stop the wheel**: PPM's own `overscroll-behavior: none` + `height: 100dvh` came along into `designs/kit/app.css`. A design overrides the height with `body { overflow: auto }`, which makes `body` a scroll container with nothing to scroll, and under `none` Chrome passes no wheel on from it to the viewport. The scrollbar still drags, so "it scrolls" passes a click test. `SCROLL_CHAIN_STYLE` (`preview/design-preview-html.ts`) goes after the bridge on every canvas and reviewer page. Headless Chromium hides scrollbars unless launched without `--hide-scrollbars`, and the bug only shows with the kit's CSS loaded: a copied design without `systems/`, `system-default/` and `kit/` scrolls fine.
|
|
@@ -374,12 +376,13 @@ Before planning or implementing a new feature, read `docs/project-roadmap.md` to
|
|
|
374
376
|
- `src/services/assistant/` + `src/services/assistant-mcp/` — the PPM Assistant, a chat that operates PPM itself on Claude and Codex. Sessions live in the reserved project `__assistant__` (`src/shared/assistant-project.ts`), which only the chat path resolves (`src/server/helpers/resolve-chat-project.ts`) to a work dir per database (`assistant-work-dir.ts`); `isAssistantSession` (`assistant-session.ts`) reads `session_metadata.assistant`, the migrated id's mark or that work dir. Policy: `assistant-tool-policy.ts` (Claude PreToolUse + `canUseTool`, reads unasked only inside registered projects and outside `assistant-private-paths.ts`), `ASSISTANT_PERMISSION` (`codex-permission-map.ts`). Isolation: `assistant-settings.service.ts` behind `/api/assistant/settings` (shape in `src/shared/assistant-settings.ts`), Claude `settingSources: []` + `strictMcpConfig` (`assistantMcpServers`), Codex `assistantSessionConfig` (`codex-thread-params.ts`) + `codex-assistant-mcp-guard.ts`; `assistant-instructions.ts`, and `assistant-ui-summary.ts` for the screen summary inside `<ppm-shared-context>`. Tools: `/api/assistant-mcp` (`assistant-mcp-endpoint.ts`, before auth, per-session tokens, names in `src/shared/assistant-tool-names.ts`); screen tools go through a strict device broker (`assistant-ui-tools.ts` on `createDeviceBroker`, `deliverToChattingDevice` in `src/server/ws/chat.ts`, protocol `src/shared/assistant-ui-protocol.ts`), approvals through `assistant-approval-broker.ts` + `assistant-approval-summary.ts` onto the session's one card (`src/server/ws/chat-pending-approval.ts`), unasked SQL through `assistant-sql-safety.ts` + `assistant-sql-reach-check.ts`. Git, schedule and tunnel tools are families (`assistant-tool-family.ts`; `assistant-{git,schedule,tunnel}-*.ts`, names in `src/shared/assistant-{git,schedule,tunnel}-tool-names.ts`) that call the UI's own routes in-process through `assistant-route-call.ts`, so a change keeps `git:changed`, the discard Undo journal, the `?repo=` check and `schedules:changed`; it skips auth, so each family's `*_ROUTES` allowlist (templates from the leaf `assistant-route-rules.ts`, never regexes) is the boundary — a new route is a deliberate edit there. Browser: `src/web/components/assistant/` (`open-assistant.ts`: `tab-host` window on desktop, tab below `md`), `src/web/lib/assistant-ui/` (answers `assistant_ui`), the command registry `src/web/lib/commands/` (palette, keybindings and `ui_run_command`), `markdown-external-resources.ts` + `markdown-assistant-allowlist.ts` (no auto-loaded resources), Settings pane `settings/assistant-settings-section.tsx`. Docs `docs/architecture/ppm-assistant.md`; e2e `PPM_PLAYWRIGHT_MODULE=<playwright>/index.mjs node tests/e2e/assistant-e2e.mjs` (scripted provider `tests/e2e/fixtures/assistant-server.ts`)
|
|
375
377
|
- `src/services/chat-control/` + `src/services/assistant-hub/` + `src/services/assistant-watch/` + `src/services/assistant-telegram/` — the PPM Assistant's hub, which replaced the PPMBot coordinator (and the `ppm bot` CLI). `chat-control/chat-control.ts` is `chatControl()`, registered by `src/server/ws/chat.ts`: send a user message, answer a card, stop a turn, read live state with no browser attached, through the same core the socket handler runs; `chat-lifecycle.ts` is the bus emitted even when no client is connected (listeners only record or enqueue); `approval-deciding-input.ts` is the one builder of what a person must see to decide a card. `assistant-hub/assistant-hub-startup.ts` is `startAssistantHub()`, called by both `src/server/index.ts` and the e2e fixture; `chat-attention.service.ts` backs `chats_attention`; `assistant-hub-db.ts` owns the binding and watch tables (migration 62). Tools `assistant-mcp/assistant-hub-tools.ts` (`chats_attention`, `chat_answer_approval`, `ppm_cli_reference`) and `assistant-watch-tools.ts`; opening and messaging chats is PPM's session tools under an Assistant caller policy (`src/services/session-collab/collab-caller-policy.ts`, `collab-send-assistant.ts`). Watches: `assistant-watch/assistant-watch.service.ts` (wake turns that may not ask for anything; cards relayed, never a model turn). Telegram: `assistant-telegram/assistant-telegram.service.ts` (bridge: a connected private chat is a second window onto one Assistant session), `-relay.ts` (watched chats' cards and reports), `-card-format.ts` (Allow only when the whole deciding input fits). Routes `src/server/routes/assistant-telegram.ts` (`/api/assistant/telegram`) and `/api/settings/clawbot*` in `settings.ts`; UI `settings/assistant-telegram-settings.tsx`, deep link `src/web/lib/assistant-deep-link.ts` (`/assistant?session=<provider>/<id>`). Docs `docs/architecture/ppm-assistant.md` → Telegram, Watches; integration `tests/integration/assistant-telegram-{bridge,relay}.test.ts`, `assistant-watch-flow.test.ts`
|
|
376
378
|
- `src/services/assistant-managers/` + `assistant-cards/` + `assistant-wake/` + `assistant-digest/` + `assistant-notes/` — the PPM Assistant over per-project **manager chats** (docs `docs/architecture/ppm-assistant.md` → Manager chats, Reports and cards, Morning digest, Notebook, Threat model). `assistant-managers/`: the `manager_chats` table and its in-memory answers (`manager-chats.service.ts`: one Claude chat per project, keyed by `projectKey`), the rules file `.ppm/manager.md` (`manager-rules-file.ts` writes it and `.ppm/.gitignore`; `manager-rules-guard.ts` checks it at every manager turn start — ordered line diff, held changes kept off disk, `manager-rules-check.ts` the one Haiku `completeOnce` per plain addition, failing closed) and `manager-context-entry.ts` (the rules as a shared-context entry, never the system prompt). The card-free send to a manager is `session-collab/collab-send-manager.ts` (provenance block `src/shared/assistant-provenance.ts`, budgets and quiet hours `assistant-send-guards.ts`, all limits in `src/shared/assistant-limits.ts`). `assistant-cards/`: `report_to_assistant` (`manager-report-tool.ts`), what PPM sees in a manager chat (`manager-signals.ts`), rules and budget cards (`assistant-event-cards.ts`), the `assistant_cards` table and its compare-and-set transitions, Telegram outbound with the quiet-hours hold (`card-outbound.ts`), OK and replies (`card-reply-actions.ts`; the user's words block is written only by `forward-verbatim.ts`). `assistant-wake/`: the injectable clock (`assistant-clock.ts`) every schedule here reads, and the wake queue, the one door through which PPM starts an Assistant turn (capped per hour, held in quiet hours unless urgent). `assistant-digest/`: one timer per day on that clock, asks sent `later`, the run written before the first ask. `assistant-notes/`: the notebook (user lines locked, unattended writes Unverified). Routes `src/server/routes/assistant-{managers,manager-rules,cards,notes,settings}.ts` under `/api/assistant`; UI `src/web/components/assistant/` (the window, chips, cards) and `src/web/components/settings/assistant/` (the Settings pane). e2e `tests/e2e/assistant-manager-loop-e2e.mjs` (fixture `assistant-server.ts` with `PPM_ASSISTANT_MANAGER_LOOP=1` → `assistant-manager-fixture.ts`: a clock the script moves, a scripted rules check; Node 20 in `ppm-e2e-chromium`)
|
|
379
|
+
- `src/services/restart-news/` — after every server start, one wake turn tells the main PPM Assistant session why PPM restarted and which chats were cut off mid-turn (docs `docs/architecture/ppm-assistant.md` → Restart news). The supervisor names each spawn in `PPM_START_REASON`/`PPM_START_DETAIL` (decided by the pure, table-tested `supervisor-start-reason.ts`; `start-reason.ts`; `ppm restart --reason` leaves `.restart-reason` for its next manual spawn); the server keeps a per-database run log (`restart-news-run.ts` + `server-run-log.ts`, config row `server_run_log`), so a run with no clean stop reads as a crash — unless the supervisor left `.server-stop.<pid>.json` before stopping it (`ordered-stop-note.ts`: on Windows it always hard-kills, so the server never writes its own stop); `interrupted-chats.ts` reads the cut-off turns from the session trace, which `ppm.db`, `ppm.dev.db` and the CLI share, so only sessions this database places in a registered project count; `restart-news-source.ts` is the wake source (config row `assistant_restart_news`, merged until told, urgent only with cut-off chats: `RESTART_NEWS_URGENT_WHEN`); `restart-news-text.ts` the entry. While that turn runs, a message to a manager whose project has cut-off chats in the news carries the provenance reason `restart` with those chats' ids (`restartChats`), and the manager may resume only those (`manager-context-entry.ts`); only those messages pass quiet hours (`assistantQuietNow`). Setting `assistant.restart_news`
|
|
377
380
|
- `src/services/design/share/` — design share links (docs `docs/architecture/workspace-and-ui.md` → Design mode → Share links): `design-share-code.ts` (derived codes), `design-share-links.service.ts` + `design-share-links-store.ts` + `design-share-resolve.ts` (links, pinned snapshots, status), `design-share-comments.service.ts` (a reviewer's view of the threads, 304 ETags), `design-share-rate-limit.ts` + `design-share-client-key.ts`, `design-share-address.ts` (the review address when on, else PPM's tunnel; the review address itself is `src/services/share-host/`), `design-share-notifier.ts` (`design_review`); allow-list `preview/design-guest-alias.ts`, guest bridge `bridge/guest-bridge.ts`, replies in `design-comment-replies.service.ts`. Owner routes `src/server/routes/design-shares.ts` (`/api/project/:name/designs/:slug/shares`) and `design-share-address.ts` (`/api/design-shares/address`); reviewer routes `src/server/routes/design-share-guest*.ts` on `/s/<code>`; owner UI `src/web/components/design/share/`; reviewer page `src/web/design-share-page/`, built by `vite.share.config.ts` inside `build:web`. e2e `PPM_PLAYWRIGHT_MODULE=<playwright>/index.mjs node tests/e2e/design-share-e2e.mjs` and `tests/e2e/design-comment-threads-e2e.mjs`; Markdown/Mermaid/docx sanitising `tests/e2e/markdown-sanitize-e2e.mjs`
|
|
378
381
|
- `src/services/tab-tools-mcp/` — the AI's tab tools, `open_file` (optional `line`), `open_preview`, `open_url`, `read_terminal` and `run_in_terminal`, given to every chat that is not a design session while any is on in Settings → Tools (`ai.ppm_tools`, decided by `src/shared/ppm-tools.ts`; `open_file`/`open_preview` never switched there follow the older single switch `ai.tab_tools`, the other three default on, so the server reaches every chat by default); Claude's claude.ai Artifact tools are turned off while `open_preview` is on (`CLAUDE_CODE_DISABLE_ARTIFACT=1`), and a call to a tool turned off since is refused at the endpoint (`unavailable` in `mcp-http-endpoint.ts`), because a chat keeps the tools it started with. `/api/tab-tools-mcp` (`tab-tools-mcp-endpoint.ts`, mounted before auth) is built from the same parts as `/api/design-mcp`: `src/services/mcp-http-endpoint.ts` (JSON-only Streamable HTTP, a request with an `Origin` refused, 64 KB cap) and `src/services/mcp-session-tokens.ts` (per-session capability tokens, memory only, looked up by SHA-256); `tab-tools-mcp-tokens.ts` binds a token to the session id alone, so a warm spare's token is the one its session's turns mint. `tab-target.ts` resolves the agent's `path` under the editor's own read rules, and `tab-open-broker.ts` sends `tab_open` over the chat WebSocket and waits for the first `tab_open_result` (8 s for a file, 40 s for a page; 4 calls in flight and 20 a minute per session) — `deliverTabOpen` in `src/server/ws/chat.ts` picks the device that sent the turn's message, else every device showing the chat, and never buffers it for replay. Protocol and the per-provider tool names in `src/shared/tab-open-protocol.ts`; provider wiring `tabToolsMcpServers` (`claude-agent-sdk-query-options.ts`) and `tabToolsMcpConfig`/`tabToolsMcpEnv` (`codex-thread-params.ts`), from the access `chatService.prepareSendOptions` mints. Browser: `src/web/lib/open-ai-tab.ts` (answers `tab_open` from `use-chat.ts`: opens the tab, waits for the page, runs its check), `ai-tab-placement.ts` (pure: beside the chat on a desktop, the whole screen on a phone), `html-preview-loads.ts` (which preview shows which page, by load), `tab-tool-call.ts` + `src/web/components/chat/tab-tool-card.tsx` (the card and its Open button). The three tools that take no file: `open-url-tool.ts` (host servers only; an existing forward, else a private Tailscale forward it starts, else the address itself, which `openAiUrlTab` accepts only on a page loaded from loopback), `terminal-tools.ts` (`read_terminal` over the chat's project terminals plus the ones it opened; `run_in_terminal` starts the shell, has the device dock it via `openAiTerminal`, types one checked line with no newline) and `terminal-text.ts` (the raw buffer replayed through `@xterm/headless` into the lines the screen shows); their card is `src/web/components/chat/device-tool-card.tsx`. The HTML preview route serves the design canvas's CSP (`buildDesignCsp`, so the design CDNs load) and injects `design/bridge/html-preview-bridge.ts`, the design bridge's core plus its self-check. Docs `docs/architecture/ai-chat-and-providers.md` → AI tab tools; e2e `PPM_PLAYWRIGHT_MODULE=<playwright>/index.mjs node tests/e2e/ai-tab-tools-e2e.mjs` (scripted provider in `tests/e2e/fixtures/tab-tools-server.ts`, which also mounts the terminal socket; `PPM_TAB_TOOLS_WEB_DIR` reuses a scratch build; a stand-in `tailscale` on its `PATH` keeps `open_url` off the real tailnet) and `tests/e2e/html-preview-cdn-check-e2e.mjs`. Full design: `docs/architecture/ai-tab-tools.md`
|
|
379
382
|
- `src/services/db-ai-tools/` — the AI chat's database tools, `db_query` (read-only), `open_query` (a Query tab holding a script the user runs) and `db_execute` (a change, once, after the user approves it with PPM's password), on the saved connections with *Available to the AI chat* on, each tool on or off in Settings → Tools (`ai.ppm_tools`, all three on by default; `src/shared/ppm-tools.ts`). `db_query` names only the change tools that are on (`dbChangeHint`). `/api/db-tools-mcp` (`db-ai-tools-endpoint.ts`, mounted before auth) is built like `/api/tab-tools-mcp`: `mcp-http-endpoint.ts` + per-session tokens (`db-ai-tools-tokens.ts`). `db-ai-tools-tool.ts` holds the tool definitions and limits, `db-ai-connections.ts` which connections (light on purpose: `chat.service.ts` imports it, and the CLI loads `chat.service.ts`), `db-ai-target.ts` the adapter config with the *tool's* `readonly`, `db-ai-run.ts` the runs (`QueryScriptRun` for reads, `runApprovedScript` for one approved transaction), `db-ai-format.ts` rows as fenced untrusted data, `db-approval-broker.ts` the wait for the user's answer. Shared names and the approval's shape in `src/shared/db-ai-tools.ts`; the password check in `src/services/ppm-password.ts`. Chat side: `announcePpmApproval` / `ppmApprovalResolved` in `src/server/ws/chat.ts`, onto the session's approval slot (`chat-pending-approval.ts`, origin `ppm`; shared with the session tools' cards through `chat-ppm-approvals.ts`); the answer route `POST /api/db/ai-approvals/:requestId` in `src/server/routes/database.ts`. Browser: `src/web/components/chat/db-execute-approval-card.tsx`, `db-tool-card.tsx` + `src/web/lib/db-tool-call.ts`, `openAiQueryTab` in `src/web/lib/open-ai-tab.ts`, and the Query tab's *Run with write access (once)* (`write-once-dialog.tsx`, `writeOnce` on `/query/script`). Docs `docs/architecture/ai-chat-and-providers.md` → AI database tools; e2e `PPM_PLAYWRIGHT_MODULE=<playwright>/index.mjs node tests/e2e/ai-db-tools-e2e.mjs` (scripted provider in `tests/e2e/fixtures/db-tools-server.ts`; `PPM_DB_TOOLS_WEB_DIR` reuses a scratch build).
|
|
380
383
|
- `src/services/agent-transcript/` — one hub per `(providerId, sessionId)` streaming an Agent card's or teammate's own transcript live over `/ws/global`, independent of the chat WebSocket and of whether the root turn is still running. `session-ownership.ts` proves the session belongs to the caller's project before any file is named; `agent-transcript-sources.ts` resolves a card/teammate to the exact file(s), including Codex descendants via `session_meta.parent_thread_id`; `agent-transcript-session-hub.ts` + `agent-transcript-hub.ts` are the per-session tail/page/cursor loop, `agent-transcript-session-hub-activity.ts` the separate "who is running" feed. Protocol in `src/shared/agent-transcript-protocol.ts`; UI entry points `src/web/components/chat/{agent-card-summary,agent-session-window-content,agent-session-sheet,running-agents-bar}.tsx` via `use-agent-session-stream.ts`/`use-agent-activity.ts`; docs `docs/architecture/ai-chat-and-providers.md` → Agent session transcripts
|
|
381
384
|
- `src/services/notification.service.ts` — notifications, configured in Settings → Notifications. `broadcast(type, payload, { stillUnseen })` drops a switched-off event, waits `delay_seconds` (one pending per session: a newer event replaces it) and sends only if `stillUnseen()` still holds — the chat is still unread, and for an approval the same request is still pending (`src/server/ws/chat.ts`); schedules and Jira pass none and always send. `deliver` fans out to push, Telegram and ntfy, plus PPM Cloud's `sendNotification`, which is inert in the server process because that connection lives in the supervisor. Settings shape and defaults in `src/shared/notification-settings.ts`, text and links in `notification-format.ts`. Push is standard Web Push with no dependency, `src/services/web-push/` (VAPID ES256 + RFC 8291 aes128gcm on WebCrypto; keys and subscriptions are the config rows `web_push_vapid` / `web_push_subscriptions` and never reach a browser); the browser half is `src/web/sw.ts` (`push`, and `notificationclick` → `src/web/sw-notification-click.ts`, which hands the session to an open window through `src/web/hooks/use-notification-clicks.ts`) and `src/web/lib/web-push-{support,client}.ts`. Telegram sends through `telegram-notification.service.ts` to the chats in the `telegram_notify_chats` config row, and to nobody else: the PPM Assistant's Telegram side has a bot and chats of its own (`telegram-bots.ts` — the `ppmbot_telegram` row and `clawbot_paired_chats`, names kept from PPMBot so nobody reconnects; both rows sit outside `CONFIG_TABLE_KEYS` like the VAPID key, and an install that shared one bot is split once, on first read). The one-tap Connect link is `telegram-connect.service.ts`, one per bot owner, which polls a bot itself unless the Assistant's Telegram bridge is reading that bot (`assistantBridgeReading`; Telegram allows one `getUpdates` reader per bot; the bots are compared by id, the digits before the token's colon). Every Telegram call goes through `src/services/telegram/` (one Bot API client whose base URL can be overridden only to a loopback address, and the Telegram HTML formatter), faked in tests by `tests/helpers/fake-telegram-bot-api.ts`. ntfy is `ntfy-notification.service.ts`: one JSON publish per notification (the header form cannot carry a non-ASCII title), the config row `ntfy` with its token in `SECRET_CONFIG_KEYS`, dropped when Settings saves a different server so it is not sent to the new one (`PUT /ntfy`; `ppm config set ntfy.server` does not drop it). Both channels take their link back into PPM from `notification-link.ts`: the tunnel URL, else the Tailscale Service address, else localhost — never the LAN address, which is plain HTTP on an insecure origin where the browser withholds every permission PPM asks for. Routes `src/server/routes/notifications.ts` (`/api/notifications/*`), UI `src/web/components/settings/notifications-settings-section.tsx` + `telegram-bot-token-field.tsx` + `ntfy-server-form.tsx`, fake ntfy for tests `tests/helpers/fake-ntfy-server.ts`
|
|
382
|
-
- `src/services/session-collab/` + `src/server/ws/chat-inject.ts` — session collaboration: a chat's AI opens other PPM sessions and messages any session of its project through `create_session`, `send_to_session` and `session_status` on `/api/sessions-mcp` (MCP server `ppm-sessions` / Codex `ppm_sessions`, mounted before auth, per-session capability tokens in `session-collab-tokens.ts`, minted by `chatService.prepareSendOptions`; never for design
|
|
385
|
+
- `src/services/session-collab/` + `src/server/ws/chat-inject.ts` — session collaboration: a chat's AI opens other PPM sessions and messages any session of its project through `create_session`, `send_to_session` and `session_status` on `/api/sessions-mcp` (MCP server `ppm-sessions` / Codex `ppm_sessions`, mounted before auth, per-session capability tokens in `session-collab-tokens.ts`, minted by `chatService.prepareSendOptions`; never for Design chats, which may still be created with `create_session { design }` and messaged — they answer in their reply, which a wait hands back). `design_screenshot` on the same server renders a design's variants to PNG with a headless Chrome/Edge on the host (`src/services/design/shots/`, DevTools over `--remote-debugging-pipe` except on Windows where Bun cannot pass the pipe fds, kept 7 days, served at `/api/design-shots/<id>.png` behind the login), and `report_to_assistant { images }` puts them on a card that Telegram gets as photos (`assistant-telegram-card-photos.ts`); e2e `tests/e2e/collab-design-sessions-e2e.mjs`. `session-collab-endpoint.ts` resolves the caller from its token to its canonical id and project, then rate-limits (`collab-rate-limit.ts`) and dispatches to `collab-create.ts` / `collab-send.ts` / `collab-status.ts`; the rules take one `CollabEnv` (`collab-context.ts`, production `collab-env.ts`) so they are unit-tested without a server. `collab-waits.ts` is the wait registry (first of reply / turn end / timeout / cancel wins), `collab-approval-broker.ts` the create, pair-limit and escalation cards (answered at `POST /api/sessions-collab/approvals/:id`, shown through the generalized slot in `src/server/ws/chat-ppm-approvals.ts`), `pair-counter.ts` the per-pair counts and grants (sidecar `<ppm dir>/session-collab/pairs.json`), `session-links.service.ts` the `spawned_by`/`spawn_depth` columns and `linkedSessions()`. `chat-inject.ts`'s `deliverToSession` is the server's own door into a session — the browser path's `ensureSessionEntry`/`submitToSession` under the same per-session lock — reporting `inserted`/`queued`/`started` truthfully; no route exposes it. Shared shapes `src/shared/session-collab.ts`, settings `src/shared/session-collab-settings.ts` (`ai.session_collab`), the message block `src/shared/chat-from-session.ts`; routes `src/server/routes/session-collab.ts` (approvals, `…/sessions/:id/links`, `…/stop-children`). UI `src/web/components/chat/{from-session-bubble,session-collab-tool-card,linked-sessions-bar,linked-session-chip,spawned-session-badge,collab-approval-card}.tsx`, state `src/web/stores/session-collab-store.ts` + `src/web/hooks/use-linked-sessions.ts`. Docs `docs/architecture/ai-chat-and-providers.md` → Session collaboration; e2e `tests/e2e/session-collab-e2e.mjs` (run it in the image from `tests/e2e/docker/Dockerfile`)
|
|
383
386
|
- `src/services/session-turns/` — cross-session turn references: one chat points at single turns of other Claude/Codex sessions (chips) and its AI reads them (`search_sessions`, `list_session_turns`, `read_session_turns` on `/api/tab-tools-mcp`). `session-turn-index.service.ts` resolves a session only through `assertSessionInProject` and scans it incrementally (`turn-index-claude.ts`, `turn-index-codex.ts`, cached by `turn-index-cache.ts`), `session-turn-reader.ts` reads turns by byte range and answers `stale` rather than another turn, `stamp-message-turns.ts` puts `turnId`/`turnN` on every history message, `turn-grant-ledger.ts` is the only thing that lets the AI read another project's turn (written by the chat socket from a browser send's `turnRefs`, `<ppm dir>/session-turn-grants/`), `turn-access.ts` enforces it, `turn-render.ts` renders a turn without raw tool output, `session-search.ts` searches `search-index-v3.db`. Routes `src/server/routes/chat-session-turns.ts` (`/turns`, `/turns/:turnId`) and `chat-turn-window.ts` (`/turn-window`); the tools in `src/services/tab-tools-mcp/session-history-*.ts`; block codec `src/shared/chat-turn-ref.ts` + `chat-message-blocks.ts`; real-prompt predicate `src/shared/user-prompt-kind.ts`. UI: `copy-turn-link-button.tsx`, `turn-ref-chip.tsx`, `use-composer-turn-refs.ts`, `turn-binding-store.ts`, `open-turn-ref.ts`, and the history window (`chat-history-window.tsx`, `use-history-window.ts`, `use-scroll-anchor-pin.ts`, `use-chat-turn-jump.ts`). Docs `docs/architecture/ai-chat-and-providers.md` → Session turn references and `workspace-and-ui.md` → Turn links, chips and the history window; e2e `PPM_PLAYWRIGHT_MODULE=<playwright-core>/index.mjs node tests/e2e/session-turn-refs-e2e.mjs`
|
|
384
387
|
- `src/services/feature-intros.service.ts` — the tour's "PPM has new features" step: a new feature that stays off until the install says Turn on or Turn off, asked once per install, not per browser. The registry is `FEATURE_INTROS` in `src/shared/feature-intros.ts` (adding a feature is one entry with a new, never-reused `id`); the state is the config key `feature_intros` behind `/api/feature-intros` (`src/server/routes/feature-intros.ts`), and every change goes out as `feature-intros:changed` on `/ws/global`. The answer itself is explicit switches in `ai.ppm_tools`: `ppmToolOn` keeps an introduced feature's tools off until one of its switches is set, so every server path agrees with no extra state, and a switch saved in Settings → Tools counts as the answer. An install is "in use" once it has a chat session (projects do not count: `ppm init` adds every git repo it finds); an install in use gets the step at once and no basic-tour offer, a new one after its tour. One skip counts per feature per 12 hours, three leave it off and NEW in Settings → Tools, and a late answer never overwrites a feature already decided. UI `src/web/components/onboarding/onboarding-feature-intro.tsx` (mounted by `onboarding-root.tsx`), `src/web/stores/feature-intros-store.ts`, `src/web/lib/onboarding/feature-intros-client.ts`, `src/web/components/settings/use-new-feature-tools.ts`; docs `docs/architecture/workspace-and-ui.md` → "PPM has new features"; e2e `node tests/e2e/feature-intros-e2e.mjs` (capped Docker image, one fresh install per scenario). An e2e fixture that seeds a project or chat must answer the question at startup (`answerFeatureIntro(id, …)`), or the step covers what it clicks
|
|
385
388
|
- `src/services/session-file-baselines/` — the session review (the changes chip in the chat footer and the block-by-block Review tab): `session-file-baselines.service.ts` keeps each file's state from before the session's first write (`<ppm dir>/session-baselines/<session id>/`, first capture wins, 5 MB cap, credential paths never copied, 30-day prune), `session-file-changes.service.ts` compares it with the disk (git HEAD only as a fallback inside the project), keeps each session's list between asks to work out again only the files whose `stat` stamp moved, and pushes the rows of a file a call just wrote (`session-file-writes.ts`, `session:file-changes` on `/ws/global`), `reverse-unified-diff.ts` works a Codex patch's "before" out, `shell-change-tracker.ts` brackets each Claude shell command with `git status`, `session-review-marks.ts` keeps what the user marked reviewed (a snapshot per file under `<session dir>/reviewed/`, written only at the version the browser showed; a file changed after its mark is diffed against the mark). Blocks are cut by `src/shared/review-blocks.ts`, shared because the server cuts them again from the disk before acting on a key the browser sent; `session-review-blocks.ts` records the kept ones per base hash, and `session-review-actions.ts` keeps, reopens and reverts blocks or whole files on disk (`/file-changes/answer`, refused as `stale` unless the file is at the version drawn) and undoes any answer all-or-nothing from its journal (`/file-changes/undo`). `session-file-history.ts` logs each file's state just before and after every call that writes it (`<session dir>/history/`, as line deltas), `session-file-blame.ts` replays that log to name the calls behind each block, and `session-turn-revert.ts` puts a turn's calls back where their lines are still intact (`/file-changes/revert-turn`: a preview first, then `stale` unless every file is at the previewed version). Captured by the Claude PreToolUse file-write hook and the shell hooks around each `Bash` call (`buildToolHooks` in `claude-agent-sdk-query-options.ts`) and by `codex-file-baselines.ts`. Routes `src/server/routes/chat-file-changes.ts`, shapes `src/shared/session-file-changes.ts`; UI `src/web/components/chat/session-changes-chip.tsx` + `session-change-row.tsx`, and `src/web/components/session-review/` (`review-desktop.tsx`, `review-phone.tsx` below `md`, `review-code.tsx` for the blocks and their turn chips, `review-tokens.tsx` for shiki colours), the chat's per-answer pill and tray `src/web/components/chat/turn-change-{rollup,tray,sheet,review}.tsx` over `src/web/hooks/use-turn-review.ts` + `src/web/lib/turn-review.ts` (the list reaches them through `session-changes-context.tsx`), turns from `src/web/lib/session-turns.ts` through `src/web/stores/session-turns-store.ts` (published by the chat, read by `use-session-turns.ts` when no chat is open), Show in chat through `src/web/stores/chat-jump-store.ts`, state `src/web/hooks/use-session-review.ts` over the pure `src/web/lib/session-review-model.ts`, data `src/web/hooks/use-session-file-changes.ts` + `src/web/lib/session-file-changes{,-client}.ts`; docs `docs/architecture/session-changes-and-review.md`; e2e `bun tests/e2e/session-changes-e2e.mjs`
|
|
@@ -83,4 +83,4 @@ This skill covers the `ppm` CLI, its HTTP API, and its config DB. It does **not*
|
|
|
83
83
|
- Third-party extensions (inspect via `ppm ext list`).
|
|
84
84
|
- The Claude Agent SDK internals (separate skill).
|
|
85
85
|
|
|
86
|
-
<!-- Generated for PPM v0.25.
|
|
86
|
+
<!-- Generated for PPM v0.25.9 at build time. Re-run `ppm export skill --install` to refresh. -->
|
|
@@ -1876,6 +1876,7 @@ Restart the server (keeps tunnel alive)
|
|
|
1876
1876
|
|
|
1877
1877
|
**Options:**
|
|
1878
1878
|
- `--force` — Force resume from paused state
|
|
1879
|
+
- `--reason <text>` — Why PPM is restarted (watchdog, recycle, or free text); the PPM Assistant is told
|
|
1879
1880
|
|
|
1880
1881
|
## `ppm restore`
|
|
1881
1882
|
|
|
@@ -246,6 +246,10 @@ JSON responses are wrapped: `{ "ok": true, "data": … }` or `{ "ok": false, "er
|
|
|
246
246
|
|
|
247
247
|
- `GET /api/design-shares/address`
|
|
248
248
|
|
|
249
|
+
## /api/design-shots
|
|
250
|
+
|
|
251
|
+
- `GET /api/design-shots/:file`
|
|
252
|
+
|
|
249
253
|
## /api/extensions
|
|
250
254
|
|
|
251
255
|
- `POST /api/extensions/commands/execute`
|
|
@@ -843,4 +847,4 @@ Authenticate with `?token=<token>` (see Authentication).
|
|
|
843
847
|
- `/ws/android`
|
|
844
848
|
- `/ws/project/<project>/<type>/<id>` — `<type>`: `terminal`, `chat`, `group`, `lsp` (for `chat`, `<id>` is the session id)
|
|
845
849
|
|
|
846
|
-
<!-- Generated from src/server/routes/ for PPM v0.25.
|
|
850
|
+
<!-- Generated from src/server/routes/ for PPM v0.25.9 -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-WX6NXGTJ.js";import"./vendor-ui-XWGn718B.js";import{At as r,J as i,Qr as a,Sn as o,_r as s,gr as c,gt as l,ht as u,lr as d,qr as f,ui as p,un as m,ut as h,wn as g,wr as _}from"./icons-CXY5ue_g.js";import{a as v,r as y}from"./api-client-vI7TyFOL.js";import{n as b}from"./utils-DMiycH3O.js";import"./portal-container-context-tAk8C8AE.js";import{i as x,n as S,t as C}from"./tooltip-CCx1ynhU.js";import{t as w}from"./mobile-bottom-sheet-CR0IYSBI.js";import"./use-visual-viewport-CFeFggvP.js";import{n as T}from"./use-is-mobile-_O8suyE-.js";import{r as E,t as D}from"./button-BCTqB-tu.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./dialog-CoO-z2qj.js";import"./chat-preparation-cache-BjKMLTNJ.js";import"./provider-logos-m5ZC_yzc.js";import{t as P}from"./provider-selector-DcPsEA72.js";import{r as F}from"./clipboard-SyUe4kh-.js";import{t as I}from"./input-CcBfRi6-.js";import{S as L,a as R,b as z,g as B,h as ee,m as te,o as ne,r as V,v as re,y as H}from"./api-settings-D4cXrjrY.js";import{Fn as ie,In as ae,Ln as U,Mn as W,Nn as G,Pn as K,vr as q}from"./index-DdWNTpRC.js";import{C as oe,_ as J,a as se,b as ce,c as le,d as ue,f as Y,g as de,i as X,l as fe,m as Z,n as pe,o as me,p as he,r as ge,s as _e,t as ve,v as ye}from"./antigravity-usage-view-CCOvhebf.js";var Q=e(t(),1),$=n(),be=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],xe=Array.from({length:24},(e,t)=>t);function Se(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function Ce(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function we(e){return xe.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 Te(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,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[a,s]=(0,Q.useState)(`5h`);(0,Q.useEffect)(()=>{i(!0),te(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let c=(0,Q.useMemo)(()=>t?Se(t,a):null,[t,a]),l=(0,Q.useMemo)(()=>c?Ce(c):[],[c]),u=(0,Q.useMemo)(()=>c?we(c):[],[c]),d=Math.max(...l,.01);if(Math.max(...u,.01),r)return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,$.jsx)(o,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,$.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let f=t.length,p=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,$.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,$.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,$.jsx)(`button`,{onClick:()=>s(`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,$.jsx)(`button`,{onClick:()=>s(`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,$.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,p,`d (`,f,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,$.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:be.map((e,t)=>{let n=l[t]??0;return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,$.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Ee(n)}`,style:{width:`${Math.round(n/d*100)}%`}})}),(0,$.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,$.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:xe.map(e=>{let t=u[e]??0;return(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,$.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${Te(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),c&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[be.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),xe.map(n=>{let r=c[t][n];return(0,$.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${Te(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,$.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,$.jsx)(`span`,{className:`w-4 shrink-0`}),xe.map(e=>(0,$.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,$.jsx)(`span`,{children:`Low`}),(0,$.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,$.jsx)(`span`,{children:`High`}),(0,$.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,$.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,$.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,$.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,$.jsx)(p,{className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,$.jsxs)(`span`,{className:`contents`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,$.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,$.jsx)(De,{accountId:t})]})}function ke({display:e,onConfirm:t,onCancel:n}){let r=T(),i=(0,$.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,$.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,$.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,$.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,$.jsx)(D,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,$.jsx)(D,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,$.jsx)(w,{open:!0,onClose:n,children:(0,$.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,$.jsx)(N,{open:!0,onOpenChange:e=>{e||n()},children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsx)(j,{className:`text-sm`,children:`Remove account`})}),i]})})}var Ae=80;function je({current:e,onSave:t,onCancel:n}){let r=T(),[i,a]=(0,Q.useState)(e),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d=i.trim(),f=!!d&&d!==e&&!s,p=async()=>{if(f){c(!0),u(null);try{await t(d)}catch(e){u(e.message||`Could not rename the account`),c(!1)}}},m=()=>{s||n()},h=(0,$.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,$.jsx)(I,{autoFocus:!0,value:i,maxLength:Ae,onChange:e=>a(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),l&&(0,$.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:l}),(0,$.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,$.jsx)(D,{type:`button`,variant:`outline`,onClick:m,disabled:s,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,$.jsxs)(D,{type:`submit`,disabled:!f,className:`min-h-11 md:min-h-9`,children:[s&&(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,$.jsx)(w,{open:!0,onClose:m,children:(0,$.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),h]})}):(0,$.jsx)(N,{open:!0,onOpenChange:e=>{e||m()},children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsx)(j,{className:`text-sm`,children:`Rename account`})}),h]})})}function Me(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 Ne({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:i}){let a=n.filter(e=>e.hasRefreshToken),[s,c]=(0,Q.useState)(new Set),[l,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,_]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1);e&&!x&&(c(r?new Set([r]):new Set(a.map(e=>e.id))),S(!0)),!e&&x&&S(!1);function C(){t(!1),d(``),p(!1),_(!1)}async function w(e){if(s.size===0)return;b(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=v();r&&(n.Authorization=`Bearer ${r}`);let a=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:f,refreshBeforeExport:m})});if(!a.ok){let e=await a.json();throw Error(e.error??`Export failed: ${a.status}`)}let o=await a.text();e&&await F(o)?i?.(`Backup copied to clipboard!`):(Me(o),i?.(`Backup downloaded.`)),C()}catch{}b(!1)}let T=s.size>0&&!y;return(0,$.jsx)(N,{open:e,onOpenChange:e=>{e||C()},children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(g,{className:`size-3.5`}),` Export Accounts`]}),(0,$.jsx)(M,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,$.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===a.length?new Set:new Set(a.map(e=>e.id))),children:s.size===a.length?`Deselect all`:`Select all`})]}),a.length===0?(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,$.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:a.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.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,$.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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(q,{className:`text-xs`,children:[`Password `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>d(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>p(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,$.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:m,onChange:e=>_(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,$.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,$.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):m?(0,$.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,$.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,$.jsxs)(k,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:C,children:`Cancel`}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!0),children:[(0,$.jsx)(h,{className:`size-3 mr-1`}),` Copy`]}),(0,$.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!1),children:y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Pe({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,Q.useState)(``),[a,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null);function f(){t(!1),i(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await ee({data:r.trim(),password:a.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,$.jsx)(N,{open:e,onOpenChange:e=>{e||f()},children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(g,{className:`size-3.5`}),` Import Accounts`]}),(0,$.jsx)(M,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`text-xs`,children:`Backup data`}),(0,$.jsx)(`textarea`,{value:r,onChange:e=>i(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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(q,{className:`text-xs`,children:[`Password `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:a,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,$.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,$.jsxs)(k,{children:[(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,$.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var Fe=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Ie(e){return Fe?.addEventListener(`change`,e),()=>Fe?.removeEventListener(`change`,e)}function Le(){return Fe?.matches??!0}function Re(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(!0);return(0,Q.useEffect)(()=>{r(!0),ne().then(t).finally(()=>r(!1))},[]),n?(0,$.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,$.jsxs)(W,{value:e.strategy,onValueChange:async e=>{t(await L({strategy:e}))},children:[(0,$.jsx)(ie,{className:`w-full h-9 text-xs`,children:(0,$.jsx)(ae,{})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(K,{value:`round-robin`,children:`Round-robin`}),(0,$.jsx)(K,{value:`fill-first`,children:`Fill-first`}),(0,$.jsx)(K,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,$.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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,$.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 L({maxRetry:n}))}}),(0,$.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,$.jsx)(U,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await L({cooldownEnabled:e}))}})]}),(0,$.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,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,$.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,$.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function ze({open:e,onOpenChange:t}){let n=(0,Q.useSyncExternalStore)(Ie,Le);return e?n?(0,$.jsx)(N,{open:e,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsxs)(j,{className:`text-sm flex items-center gap-2`,children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation & Retry`]})}),(0,$.jsx)(Re,{})]})}):(0,$.jsxs)($.Fragment,{children:[(0,$.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,$.jsxs)(`div`,{className:b(`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,$.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,$.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation & Retry`]}),(0,$.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,$.jsx)(p,{className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,$.jsx)(Re,{})})]})]}):null}var Be=E(`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 Ve({className:e,variant:t,...n}){return(0,$.jsx)(`div`,{className:b(Be({variant:t}),e),...n})}function He(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function Ue({accounts:e}){let[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!1),[a,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(new Map),u=e.filter(e=>e.hasRefreshToken);async function d(){if(u.length!==0){i(!0);try{let e=await H(u.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 f(e,t){l(t=>new Map(t).set(e,{loading:!0}));try{let n=await z(t);l(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){l(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function p(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 m(){for(let e of t)for(let t of e.items)for(let n of p(e,t))n.token&&f(n.key,n.token)}return(0,$.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,$.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.`}),u.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(U,{id:`sim-include-refresh`,checked:a,onCheckedChange:s,className:`cursor-pointer`}),(0,$.jsx)(q,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,$.jsx)(D,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void d(),children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:m,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,$.jsx)(Ve,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,$.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,$.jsx)(Ve,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),p(e,t).map(e=>{let t=c.get(e.key);return(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,$.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:He(e.expires)}),e.token?(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void f(e.key,e.token),children:t?.loading?(0,$.jsx)(o,{className:`size-3 animate-spin`}):`Test`}):(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,$.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 We(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 Ge({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,Q.useState)(new Map),[s,c]=(0,Q.useState)(!1);async function l(e){a(t=>new Map(t).set(e,{loading:!0}));try{let t=await re(e,s);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 u(){for(let e of n.filter(e=>e.expiresAt!==null))l(e.id)}return(0,$.jsx)(N,{open:e,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,$.jsx)(M,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,$.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(U,{id:`token-test-refresh`,checked:s,onCheckedChange:c,className:`cursor-pointer`}),(0,$.jsx)(q,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:u,children:`Test all`})]})]}),n.length===0&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,$.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,$.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:We(e.expiresAt)})]}),(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void l(e.id),children:t?.loading?(0,$.jsx)(o,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,$.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,$.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,$.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,$.jsx)(Ue,{accounts:n})]}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function Ke(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:s,flashIds:c,reload:l}=he(),[f,p]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(void 0);function j(e){l(),e&&p(e)}async function M(e,t){g(e);try{await B(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){p(e.message)}g(null),l()}async function N(){if(v){try{await V(v.id),p(`Account "${v.display}" removed.`),l()}catch(e){p(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){b&&(await B(b.id,{label:e}),x(null),p(`Account renamed to "${e}".`),l())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(_e,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void l(),refreshing:s,disabled:i,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),O(`add`)},children:[(0,$.jsx)(d,{className:`size-4`}),` Add account`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{T(null),O(`export`)},children:[(0,$.jsx)(u,{className:`size-4`}),` Export`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`import`),children:[(0,$.jsx)(a,{className:`size-4`}),` Import`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`rotation`),children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`token-test`),children:[(0,$.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,$.jsx)(le,{message:f,onDismiss:()=>p(null)}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,ce(new Date(I).getTime())]})]}),i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,$.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,$.jsx)(se,{children:e.map(e=>(0,$.jsx)(ge,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:h===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>x({id:e,current:t}),onExport:e=>{T(e),O(`export`)},onViewProfile:(e,t)=>C({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),O(`add`)},flash:c.has(e.accountId)},e.accountId))})]}),S&&(0,$.jsx)(Oe,{profile:S.profile,accountId:S.accountId,onClose:()=>C(null)}),v&&(0,$.jsx)(ke,{display:v.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),b&&(0,$.jsx)(je,{current:b.current,onSave:P,onCancel:()=>x(null)}),(0,$.jsx)(ye,{open:E===`add`,onOpenChange:e=>{O(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:k}),(0,$.jsx)(Ne,{open:E===`export`,onOpenChange:e=>{O(e?`export`:null),e||T(null)},accounts:t,preselectId:w,onMessage:p}),(0,$.jsx)(Pe,{open:E===`import`,onOpenChange:e=>O(e?`import`:null),onSuccess:j}),(0,$.jsx)(ze,{open:E===`rotation`,onOpenChange:e=>O(e?`rotation`:null)}),(0,$.jsx)(Ge,{open:E===`token-test`,onOpenChange:e=>O(e?`token-test`:null),accounts:t})]})}function qe({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:i,onExport:s,onImport:c,error:l}){let d=(0,Q.useRef)(null),f=e===`export`;return(0,$.jsx)(N,{open:e!==null,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(g,{className:`size-4`}),` `,f?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,$.jsx)(M,{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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,$.jsx)(I,{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,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,$.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,$.jsx)(`input`,{ref:d,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&c(t)}}),(0,$.jsxs)(k,{children:[(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsxs)(D,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||i,onClick:()=>f?s():d.current?.click(),children:[i?(0,$.jsx)(o,{className:`size-3.5 animate-spin`}):f?(0,$.jsx)(u,{className:`size-3.5`}):(0,$.jsx)(a,{className:`size-3.5`}),f?`Download backup`:`Choose file`]})]})]})})}var Je=[{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 Ye({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,$.jsx)(N,{open:e,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(j,{className:`text-sm`,children:`Codex Rotation`}),(0,$.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:Je.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`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,$.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function Xe(e){return e==null?null:Math.round(e*100)}function Ze({usage:e}){let t=e.session==null&&e.weekly==null;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,$.jsx)(ue,{label:`5-Hour Session`,pct:Xe(e.fiveHour),reset:oe(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,$.jsx)(ue,{label:`Weekly`,pct:Xe(e.sevenDay),reset:oe(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function Qe(e){let t=e=>Math.round((e??0)*100)>=100;return t(e.session?.utilization)||t(e.weekly?.utilization)}function $e(e){return Qe(e)&&(e.resetCredits?.available??0)>0}var et={reset:e=>`${e}: limits reset to 0%. The weekly reset date now counts from your next use.`,nothingToReset:e=>`${e}: nothing needed resetting, so the reset was kept.`,noCredit:e=>`${e} has no free reset left.`,alreadyRedeemed:e=>`${e}: that reset had already been used.`};function tt(e){return e?new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null}function nt({account:e,usage:t,onDone:n}){let r=T(),[i,a]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1);if(!$e(t))return null;let u=t.resetCredits;async function d(){l(!0);try{let t=await y.post(`/api/codex-accounts/${e.id}/reset-credit`);n(et[t.outcome]?.(e.label)??`${e.label}: ${t.outcome}`)}catch(e){n(e.message||`Could not use the reset`)}finally{l(!1),a(!1)}}let f=tt(t.weekly?.resetsAt),p=tt(u.nextExpiresAt),m=(0,$.jsxs)(`div`,{className:`space-y-3`,"data-testid":`codex-reset-credit-confirm`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Use 1 of `,(0,$.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,u.available,` free reset`,u.available===1?``:`s`,`?`]}),(0,$.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,$.jsxs)(`li`,{children:[u.title??`Full reset`,`: the 5-hour and weekly usage go back to 0% now.`]}),(0,$.jsxs)(`li`,{children:[`The weekly reset date moves: the next one is about 7 days after you continue using Codex`,f?`, not ${f} as now`:``,`. You do not also get that one.`]}),p&&(0,$.jsxs)(`li`,{children:[`This spends the reset that expires first (`,p,`).`]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,$.jsx)(D,{variant:`outline`,onClick:()=>a(!1),disabled:c,className:`min-h-11`,children:`Keep it`}),(0,$.jsxs)(D,{onClick:()=>void d(),disabled:c,className:`min-h-11 gap-1.5`,children:[c?(0,$.jsx)(o,{className:`size-4 animate-spin`}):(0,$.jsx)(s,{className:`size-4`}),`Use reset`]})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`min-h-11 md:min-h-0 md:h-7 gap-1 px-2 text-[11px] cursor-pointer border-primary/40 text-primary`,onClick:()=>a(!0),disabled:c,children:[(0,$.jsx)(s,{className:`size-3.5`}),` Use reset`]}),i&&(r?(0,$.jsx)(w,{open:!0,onClose:()=>{c||a(!1)},children:(0,$.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Use a free reset`}),m]})}):(0,$.jsx)(N,{open:!0,onOpenChange:e=>{!e&&!c&&a(!1)},children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsx)(j,{className:`text-sm`,children:`Use a free reset`})}),m]})}))]})}var rt=1440*60*1e3,it=7,at=5;function ot(e,t=Date.now()){if(!e||e.windowHours!==168)return null;let n=new Date(e.resetsAt).getTime();if(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=n-it*rt;if(t<r)return null;let i=Math.min(it-1,Math.floor((t-r)/rt)),a=0;for(let e=0;e<=i;e++){let t=new Date(r+e*rt).getUTCDay();t!==0&&t!==6&&a++}let o=a/at;return{day:a,cap:o,used:e.utilization,blocked:e.utilization>=o}}function st(){let[e,t]=(0,Q.useState)(null),n=de(()=>t(null)),[r,s]=(0,Q.useState)(null);return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(_e,{description:(0,$.jsxs)($.Fragment,{children:[`Each Codex account keeps its own login (`,(0,$.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,$.jsx)(d,{className:`size-4`}),` Add account`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,$.jsx)(u,{className:`size-4`}),` Export`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,$.jsx)(a,{className:`size-4`}),` Import`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation`]})]})}),(0,$.jsx)(le,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,$.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,$.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,$.jsx)(se,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,$.jsxs)(me,{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,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,$.jsx)(fe,{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`?()=>s(e):void 0,children:`Sign in again`}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),Y(e.planType)&&(0,$.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:Y(e.planType)}),(0,$.jsx)(U,{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,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.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,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(S,{side:`top`,children:`Remove account`})]})]}),(0,$.jsx)(Ze,{usage:t}),t.resetCredits&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,$.jsx)(X,{credits:t.resetCredits}),(0,$.jsx)(nt,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=ot(t.weekly);return r?(0,$.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,$.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,$.jsx)(`span`,{children:`Daily guard`}),(0,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,$.jsx)(i,{className:`size-3.5`})})}),(0,$.jsx)(S,{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,$.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,$.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,$.jsx)(U,{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,$.jsx)(J,{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,$.jsx)(qe,{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,$.jsx)(Z,{account:r,onClose:()=>s(null),onDone:()=>void n.load()}),(0,$.jsx)(Ye,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var ct=[{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 lt(e){return e==null?null:Math.round(e*100)}function ut(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)(`round-robin`),[i,a]=(0,Q.useState)({}),[s,u]=(0,Q.useState)(!0),[p,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(new Set),[E,P]=(0,Q.useState)(null),[F,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(``),[B,ee]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(!1),[V,re]=(0,Q.useState)(``),[H,ie]=(0,Q.useState)(!1),[ae,W]=(0,Q.useState)(null),G=(0,Q.useRef)(0),K=(0,Q.useRef)(!1),J=(0,Q.useRef)(!1),Y=(0,Q.useRef)(null),de=(0,Q.useRef)(null),X=(0,Q.useCallback)(async()=>{u(!0),v(null);try{let e=await y.get(`/api/antigravity-accounts`);t(e.accounts),r(e.strategy),a(await y.get(`/api/antigravity-accounts/usage`))}catch(e){v(e.message)}finally{u(!1)}},[]);(0,Q.useEffect)(()=>{X()},[X]);let fe=(0,Q.useCallback)(()=>{G.current+=1,K.current=!1,J.current=!1,de.current?.(),de.current=null;let e=Y.current;Y.current=null,e&&y.del(`/api/antigravity-accounts/login/${e}`).catch(()=>{})},[]);(0,Q.useEffect)(()=>fe,[fe]);let Z=(0,Q.useCallback)(()=>{fe(),ee(null),ne(!1),re(``),ie(!1)},[fe]),he=(0,Q.useCallback)(()=>{Z(),W(null),z(``),L(null),P(null)},[Z]),ge=(0,Q.useCallback)(e=>{let t=Date.now()+61e4,n=!1,r;de.current=()=>{n=!0,clearTimeout(r)};let i=async()=>{if(n)return;let a=null;try{a=await y.get(`/api/antigravity-accounts/login/${e}/status`)}catch{}if(!n){if(a?.state===`done`){Y.current=null,Z(),W(null),z(``),L(null),P(null),h(`Antigravity Google account connected.`),await X();return}if(a?.state===`error`||Date.now()>t){Y.current=null,Z(),W(a?.state===`error`?a.error??`Login failed.`:`Login timed out.`);return}r=setTimeout(i,2e3)}};i()},[X,Z]),ye=(0,Q.useCallback)(async e=>{if(K.current||Y.current||J.current)return;K.current=!0;let t=++G.current;ne(!0),W(null);try{let n=await y.post(`/api/antigravity-accounts/login`,{...R.trim()?{label:R.trim()}:{},...e?{accountId:e.id}:{}});if(t!==G.current){y.del(`/api/antigravity-accounts/login/${n.id}`).catch(()=>{});return}Y.current=n.id,ee(n),ge(n.id)}catch(e){t===G.current&&W(e.message)}finally{t===G.current&&(K.current=!1,ne(!1))}},[R,ge]),be=(0,Q.useCallback)(async()=>{if(!B||!V.trim()||J.current)return;let e=G.current;J.current=!0,ie(!0),W(null);try{let t=await y.post(`/api/antigravity-accounts/login/${B.id}/callback`,{code:V.trim()});if(e!==G.current)return;if(t?.state===`error`){Y.current=null,Z(),W(t.error??`Login failed.`);return}if(t?.state!==`done`)return;Y.current=null,Z(),z(``),L(null),P(null),h(`Antigravity Google account connected.`),await X()}catch(t){e===G.current&&(Y.current=null,Z(),W(t.message))}finally{e===G.current&&(J.current=!1,ie(!1))}},[B,V,X,Z]),xe=(0,Q.useCallback)(async(e,n)=>{T(t=>new Set(t).add(e)),v(null);try{let r=n===`disabled`?`active`:`disabled`;await y.patch(`/api/antigravity-accounts/${e}`,{status:r}),t(t=>t.map(t=>t.id===e?{...t,status:r}:t))}catch(e){v(e.message)}finally{T(t=>{let n=new Set(t);return n.delete(e),n})}},[]),Se=(0,Q.useCallback)(async e=>{v(null);try{await y.del(`/api/antigravity-accounts/${e}`),t(t=>t.filter(t=>t.id!==e))}catch(e){v(e.message)}},[]),Ce=(0,Q.useCallback)(async e=>{v(null);try{await y.put(`/api/antigravity-accounts/strategy`,{strategy:e}),r(e)}catch(e){v(e.message)}},[]),we=(0,Q.useCallback)(e=>{L(e),z(e.label),P(`add`)},[]);return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(_e,{description:(0,$.jsxs)($.Fragment,{children:[`Each Antigravity account keeps its own Google OAuth login (`,(0,$.jsx)(`code`,{children:`~/.ppm/antigravity-accounts`}),`) alongside your local IDE login (`,(0,$.jsx)(`code`,{children:`~/.gemini`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void X(),refreshing:s,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{L(null),z(``),P(`add`)},children:[(0,$.jsx)(d,{className:`size-4`}),` Add account`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>P(`rotation`),children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation`]})]})}),(0,$.jsx)(le,{message:p??g,onDismiss:()=>{h(null),v(null)}}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Antigravity Accounts`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.replace(`-`,` `)})]}),s&&e.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,$.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Antigravity accounts yet.`}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Click `,(0,$.jsx)(`strong`,{children:`Add account`}),` to sign in with Google, or start Antigravity Desktop to auto-detect your local account.`]})]}):(0,$.jsx)(se,{children:e.map(e=>{let t=ve(i[e.id]??{}),n=t.session==null&&t.weekly==null&&(!t.weeklyScoped||t.weeklyScoped.length===0),r=e.id===`default`;return(0,$.jsxs)(me,{dense:!0,className:`min-w-[320px] shrink-0 snap-start`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.label}),e.email&&e.email!==e.label&&(0,$.jsx)(`div`,{className:`text-[11px] text-text-subtle truncate`,children:e.email})]}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:r?`~/.gemini`:`Google`}),e.planType&&(0,$.jsx)(`span`,{className:`text-[10px] font-medium text-primary bg-primary/10 border border-primary/20 rounded px-1.5 py-0.5 shrink-0`,children:e.planType}),(0,$.jsx)(U,{checked:e.status!==`disabled`,onCheckedChange:()=>void xe(e.id,e.status),disabled:w.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),!r&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>we(e),"aria-label":`Sign in again`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors shrink-0`,children:(0,$.jsx)(c,{className:`size-3.5`})})}),(0,$.jsx)(S,{side:`top`,children:`Sign in again`})]}),(0,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>void Se(e.id),"aria-label":`Remove account`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(S,{side:`top`,children:`Remove account`})]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(n||t.session!=null)&&(0,$.jsx)(ue,{label:`Gemini · 5-Hour Session`,pct:lt(t.fiveHour),reset:oe(t.session),resetsAt:t.session?.resetsAt}),(n||t.weekly!=null)&&(0,$.jsx)(ue,{label:`Gemini · Weekly`,pct:lt(t.sevenDay),reset:oe(t.weekly),resetsAt:t.weekly?.resetsAt}),t.weeklyScoped?.map(e=>(0,$.jsx)(ue,{label:e.label,pct:lt(e.utilization),reset:oe(e),resetsAt:e.resetsAt},e.label))]}),t.lastFetchedAt&&pe(t.lastFetchedAt)&&(0,$.jsxs)(`p`,{className:`text-[10px] text-warning`,children:[`Last read `,ce(Date.parse(t.lastFetchedAt)),`. Neither agy nor the Antigravity app has answered since.`]})]},e.id)})})]}),(0,$.jsx)(N,{open:E===`add`,onOpenChange:e=>{e||he()},children:(0,$.jsxs)(A,{className:`sm:max-w-md max-h-[90dvh] overflow-y-auto`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(j,{className:`text-sm`,children:F?`Sign in again — ${F.label}`:`Add Antigravity Account`}),(0,$.jsx)(M,{className:`text-xs leading-relaxed`,children:F?`Sign in with Google to refresh this account's OAuth credentials.`:`Sign in with a Google account using Antigravity's OAuth PKCE flow. Each account is stored in its own isolated directory.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[!F&&(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{htmlFor:`agy-label`,className:`text-xs`,children:`Label (optional)`}),(0,$.jsx)(I,{id:`agy-label`,placeholder:`e.g. Personal, Work, Shopee 2`,value:R,onChange:e=>z(e.target.value),disabled:te||H,className:`text-xs`})]}),(0,$.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2.5`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium`,children:`Google OAuth Sign-In`}),B?(0,$.jsxs)(`div`,{className:`space-y-2.5 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`a`,{href:B.authUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 font-medium text-primary hover:underline`,children:[(0,$.jsx)(l,{className:`size-3.5`}),` Open Google Sign-In page`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{Z(),W(null)},disabled:H,className:`text-[11px] text-muted-foreground hover:text-foreground underline cursor-pointer`,children:`Start over`})]}),(0,$.jsxs)(`p`,{className:`text-muted-foreground leading-relaxed`,children:[`1. Open the link above and sign in with your Google account.`,(0,$.jsx)(`br`,{}),`2. Copy the authorization code (or the full callback URL) shown after signing in and paste it below:`]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{htmlFor:`agy-auth-code`,className:`text-xs`,children:`Authorization Code or Callback URL`}),(0,$.jsx)(I,{id:`agy-auth-code`,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:`4/0A... or https://antigravity.google/oauth-callback?code=...`,value:V,onChange:e=>re(e.target.value),disabled:H,className:`text-xs font-mono`})]}),(0,$.jsxs)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void be(),disabled:!V.trim()||H,children:[H&&(0,$.jsx)(o,{className:`size-3.5 animate-spin`}),`Verify & Save Account`]})]}):(0,$.jsx)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void ye(F),disabled:te,children:te?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Generating Google sign-in link...`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4`}),` Sign in with Google`]})})]})]}),ae&&(0,$.jsx)(`div`,{role:`alert`,className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:ae}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:he,children:`Cancel`})})]})}),(0,$.jsx)(N,{open:E===`rotation`,onOpenChange:e=>P(e?`rotation`:null),children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(j,{className:`text-sm`,children:`Antigravity Rotation`}),(0,$.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your enabled Antigravity accounts.`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:ct.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ce(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`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,$.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>P(null),children:`Done`})})]})})]})}var dt=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`},{id:`antigravity`,label:`Antigravity`}];function ft(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(`claude`);(0,Q.useEffect)(()=>{let e=!1;return R().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let i=dt.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,$.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,$.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,$.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,$.jsx)(P,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,$.jsx)(Ke,{}):n===`codex`?(0,$.jsx)(st,{}):(0,$.jsx)(ut,{})]})}export{ft as AccountsSettingsSection};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-WX6NXGTJ.js";import"./vendor-ui-XWGn718B.js";import{At as r,J as i,Qr as a,Sn as o,_r as s,gr as c,gt as l,ht as u,lr as d,qr as f,ui as p,un as m,ut as h,wn as g,wr as _}from"./icons-CXY5ue_g.js";import{a as v,r as y}from"./api-client-vI7TyFOL.js";import{n as b}from"./utils-DMiycH3O.js";import"./portal-container-context-tAk8C8AE.js";import{i as x,n as S,t as C}from"./tooltip-CCx1ynhU.js";import{t as w}from"./mobile-bottom-sheet-CR0IYSBI.js";import"./use-visual-viewport-CFeFggvP.js";import{n as T}from"./use-is-mobile-_O8suyE-.js";import{r as E,t as D}from"./button-BCTqB-tu.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./dialog-CoO-z2qj.js";import"./chat-preparation-cache-BjKMLTNJ.js";import"./provider-logos-m5ZC_yzc.js";import{t as P}from"./provider-selector-DcPsEA72.js";import{r as F}from"./clipboard-SyUe4kh-.js";import{t as I}from"./input-CcBfRi6-.js";import{S as L,a as R,b as z,g as B,h as ee,m as te,o as ne,r as V,v as re,y as H}from"./api-settings-D4cXrjrY.js";import{Fn as ie,In as ae,Ln as U,Mn as W,Nn as G,Pn as K,vr as q}from"./index-Dh1mYjGB.js";import{C as oe,_ as J,a as se,b as ce,c as le,d as ue,f as Y,g as de,i as X,l as fe,m as Z,n as pe,o as me,p as he,r as ge,s as _e,t as ve,v as ye}from"./antigravity-usage-view-xdhN5XdB.js";var Q=e(t(),1),$=n(),be=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],xe=Array.from({length:24},(e,t)=>t);function Se(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function Ce(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function we(e){return xe.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 Te(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,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[a,s]=(0,Q.useState)(`5h`);(0,Q.useEffect)(()=>{i(!0),te(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let c=(0,Q.useMemo)(()=>t?Se(t,a):null,[t,a]),l=(0,Q.useMemo)(()=>c?Ce(c):[],[c]),u=(0,Q.useMemo)(()=>c?we(c):[],[c]),d=Math.max(...l,.01);if(Math.max(...u,.01),r)return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,$.jsx)(o,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,$.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let f=t.length,p=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,$.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,$.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,$.jsx)(`button`,{onClick:()=>s(`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,$.jsx)(`button`,{onClick:()=>s(`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,$.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,p,`d (`,f,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,$.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:be.map((e,t)=>{let n=l[t]??0;return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,$.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Ee(n)}`,style:{width:`${Math.round(n/d*100)}%`}})}),(0,$.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,$.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:xe.map(e=>{let t=u[e]??0;return(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,$.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${Te(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),c&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[be.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),xe.map(n=>{let r=c[t][n];return(0,$.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${Te(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,$.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,$.jsx)(`span`,{className:`w-4 shrink-0`}),xe.map(e=>(0,$.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,$.jsx)(`span`,{children:`Low`}),(0,$.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,$.jsx)(`span`,{children:`High`}),(0,$.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,$.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,$.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,$.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,$.jsx)(p,{className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,$.jsxs)(`span`,{className:`contents`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,$.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,$.jsx)(De,{accountId:t})]})}function ke({display:e,onConfirm:t,onCancel:n}){let r=T(),i=(0,$.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,$.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,$.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,$.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,$.jsx)(D,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,$.jsx)(D,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,$.jsx)(w,{open:!0,onClose:n,children:(0,$.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,$.jsx)(N,{open:!0,onOpenChange:e=>{e||n()},children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsx)(j,{className:`text-sm`,children:`Remove account`})}),i]})})}var Ae=80;function je({current:e,onSave:t,onCancel:n}){let r=T(),[i,a]=(0,Q.useState)(e),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d=i.trim(),f=!!d&&d!==e&&!s,p=async()=>{if(f){c(!0),u(null);try{await t(d)}catch(e){u(e.message||`Could not rename the account`),c(!1)}}},m=()=>{s||n()},h=(0,$.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,$.jsx)(I,{autoFocus:!0,value:i,maxLength:Ae,onChange:e=>a(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),l&&(0,$.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:l}),(0,$.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,$.jsx)(D,{type:`button`,variant:`outline`,onClick:m,disabled:s,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,$.jsxs)(D,{type:`submit`,disabled:!f,className:`min-h-11 md:min-h-9`,children:[s&&(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,$.jsx)(w,{open:!0,onClose:m,children:(0,$.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),h]})}):(0,$.jsx)(N,{open:!0,onOpenChange:e=>{e||m()},children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsx)(j,{className:`text-sm`,children:`Rename account`})}),h]})})}function Me(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 Ne({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:i}){let a=n.filter(e=>e.hasRefreshToken),[s,c]=(0,Q.useState)(new Set),[l,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,_]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1);e&&!x&&(c(r?new Set([r]):new Set(a.map(e=>e.id))),S(!0)),!e&&x&&S(!1);function C(){t(!1),d(``),p(!1),_(!1)}async function w(e){if(s.size===0)return;b(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=v();r&&(n.Authorization=`Bearer ${r}`);let a=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:f,refreshBeforeExport:m})});if(!a.ok){let e=await a.json();throw Error(e.error??`Export failed: ${a.status}`)}let o=await a.text();e&&await F(o)?i?.(`Backup copied to clipboard!`):(Me(o),i?.(`Backup downloaded.`)),C()}catch{}b(!1)}let T=s.size>0&&!y;return(0,$.jsx)(N,{open:e,onOpenChange:e=>{e||C()},children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(g,{className:`size-3.5`}),` Export Accounts`]}),(0,$.jsx)(M,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,$.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===a.length?new Set:new Set(a.map(e=>e.id))),children:s.size===a.length?`Deselect all`:`Select all`})]}),a.length===0?(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,$.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:a.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.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,$.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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(q,{className:`text-xs`,children:[`Password `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>d(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>p(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,$.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:m,onChange:e=>_(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,$.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,$.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):m?(0,$.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,$.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,$.jsxs)(k,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:C,children:`Cancel`}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!0),children:[(0,$.jsx)(h,{className:`size-3 mr-1`}),` Copy`]}),(0,$.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!1),children:y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Pe({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,Q.useState)(``),[a,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null);function f(){t(!1),i(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await ee({data:r.trim(),password:a.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,$.jsx)(N,{open:e,onOpenChange:e=>{e||f()},children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(g,{className:`size-3.5`}),` Import Accounts`]}),(0,$.jsx)(M,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`text-xs`,children:`Backup data`}),(0,$.jsx)(`textarea`,{value:r,onChange:e=>i(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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(q,{className:`text-xs`,children:[`Password `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:a,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,$.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,$.jsxs)(k,{children:[(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,$.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var Fe=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Ie(e){return Fe?.addEventListener(`change`,e),()=>Fe?.removeEventListener(`change`,e)}function Le(){return Fe?.matches??!0}function Re(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(!0);return(0,Q.useEffect)(()=>{r(!0),ne().then(t).finally(()=>r(!1))},[]),n?(0,$.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,$.jsxs)(W,{value:e.strategy,onValueChange:async e=>{t(await L({strategy:e}))},children:[(0,$.jsx)(ie,{className:`w-full h-9 text-xs`,children:(0,$.jsx)(ae,{})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(K,{value:`round-robin`,children:`Round-robin`}),(0,$.jsx)(K,{value:`fill-first`,children:`Fill-first`}),(0,$.jsx)(K,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,$.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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,$.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 L({maxRetry:n}))}}),(0,$.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,$.jsx)(U,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await L({cooldownEnabled:e}))}})]}),(0,$.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,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,$.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,$.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function ze({open:e,onOpenChange:t}){let n=(0,Q.useSyncExternalStore)(Ie,Le);return e?n?(0,$.jsx)(N,{open:e,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsxs)(j,{className:`text-sm flex items-center gap-2`,children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation & Retry`]})}),(0,$.jsx)(Re,{})]})}):(0,$.jsxs)($.Fragment,{children:[(0,$.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,$.jsxs)(`div`,{className:b(`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,$.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,$.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation & Retry`]}),(0,$.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,$.jsx)(p,{className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,$.jsx)(Re,{})})]})]}):null}var Be=E(`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 Ve({className:e,variant:t,...n}){return(0,$.jsx)(`div`,{className:b(Be({variant:t}),e),...n})}function He(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function Ue({accounts:e}){let[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!1),[a,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(new Map),u=e.filter(e=>e.hasRefreshToken);async function d(){if(u.length!==0){i(!0);try{let e=await H(u.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 f(e,t){l(t=>new Map(t).set(e,{loading:!0}));try{let n=await z(t);l(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){l(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function p(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 m(){for(let e of t)for(let t of e.items)for(let n of p(e,t))n.token&&f(n.key,n.token)}return(0,$.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,$.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.`}),u.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(U,{id:`sim-include-refresh`,checked:a,onCheckedChange:s,className:`cursor-pointer`}),(0,$.jsx)(q,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,$.jsx)(D,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void d(),children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:m,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,$.jsx)(Ve,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,$.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,$.jsx)(Ve,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),p(e,t).map(e=>{let t=c.get(e.key);return(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,$.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:He(e.expires)}),e.token?(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void f(e.key,e.token),children:t?.loading?(0,$.jsx)(o,{className:`size-3 animate-spin`}):`Test`}):(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,$.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 We(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 Ge({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,Q.useState)(new Map),[s,c]=(0,Q.useState)(!1);async function l(e){a(t=>new Map(t).set(e,{loading:!0}));try{let t=await re(e,s);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 u(){for(let e of n.filter(e=>e.expiresAt!==null))l(e.id)}return(0,$.jsx)(N,{open:e,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,$.jsx)(M,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,$.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(U,{id:`token-test-refresh`,checked:s,onCheckedChange:c,className:`cursor-pointer`}),(0,$.jsx)(q,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:u,children:`Test all`})]})]}),n.length===0&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,$.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,$.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:We(e.expiresAt)})]}),(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void l(e.id),children:t?.loading?(0,$.jsx)(o,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,$.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,$.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,$.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,$.jsx)(Ue,{accounts:n})]}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function Ke(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:s,flashIds:c,reload:l}=he(),[f,p]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(void 0);function j(e){l(),e&&p(e)}async function M(e,t){g(e);try{await B(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){p(e.message)}g(null),l()}async function N(){if(v){try{await V(v.id),p(`Account "${v.display}" removed.`),l()}catch(e){p(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){b&&(await B(b.id,{label:e}),x(null),p(`Account renamed to "${e}".`),l())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(_e,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void l(),refreshing:s,disabled:i,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),O(`add`)},children:[(0,$.jsx)(d,{className:`size-4`}),` Add account`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{T(null),O(`export`)},children:[(0,$.jsx)(u,{className:`size-4`}),` Export`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`import`),children:[(0,$.jsx)(a,{className:`size-4`}),` Import`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`rotation`),children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`token-test`),children:[(0,$.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,$.jsx)(le,{message:f,onDismiss:()=>p(null)}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,ce(new Date(I).getTime())]})]}),i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,$.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,$.jsx)(se,{children:e.map(e=>(0,$.jsx)(ge,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:h===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>x({id:e,current:t}),onExport:e=>{T(e),O(`export`)},onViewProfile:(e,t)=>C({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),O(`add`)},flash:c.has(e.accountId)},e.accountId))})]}),S&&(0,$.jsx)(Oe,{profile:S.profile,accountId:S.accountId,onClose:()=>C(null)}),v&&(0,$.jsx)(ke,{display:v.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),b&&(0,$.jsx)(je,{current:b.current,onSave:P,onCancel:()=>x(null)}),(0,$.jsx)(ye,{open:E===`add`,onOpenChange:e=>{O(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:k}),(0,$.jsx)(Ne,{open:E===`export`,onOpenChange:e=>{O(e?`export`:null),e||T(null)},accounts:t,preselectId:w,onMessage:p}),(0,$.jsx)(Pe,{open:E===`import`,onOpenChange:e=>O(e?`import`:null),onSuccess:j}),(0,$.jsx)(ze,{open:E===`rotation`,onOpenChange:e=>O(e?`rotation`:null)}),(0,$.jsx)(Ge,{open:E===`token-test`,onOpenChange:e=>O(e?`token-test`:null),accounts:t})]})}function qe({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:i,onExport:s,onImport:c,error:l}){let d=(0,Q.useRef)(null),f=e===`export`;return(0,$.jsx)(N,{open:e!==null,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(g,{className:`size-4`}),` `,f?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,$.jsx)(M,{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,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,$.jsx)(I,{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,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,$.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,$.jsx)(`input`,{ref:d,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&c(t)}}),(0,$.jsxs)(k,{children:[(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsxs)(D,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||i,onClick:()=>f?s():d.current?.click(),children:[i?(0,$.jsx)(o,{className:`size-3.5 animate-spin`}):f?(0,$.jsx)(u,{className:`size-3.5`}):(0,$.jsx)(a,{className:`size-3.5`}),f?`Download backup`:`Choose file`]})]})]})})}var Je=[{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 Ye({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,$.jsx)(N,{open:e,onOpenChange:t,children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(j,{className:`text-sm`,children:`Codex Rotation`}),(0,$.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:Je.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`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,$.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function Xe(e){return e==null?null:Math.round(e*100)}function Ze({usage:e}){let t=e.session==null&&e.weekly==null;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,$.jsx)(ue,{label:`5-Hour Session`,pct:Xe(e.fiveHour),reset:oe(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,$.jsx)(ue,{label:`Weekly`,pct:Xe(e.sevenDay),reset:oe(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function Qe(e){let t=e=>Math.round((e??0)*100)>=100;return t(e.session?.utilization)||t(e.weekly?.utilization)}function $e(e){return Qe(e)&&(e.resetCredits?.available??0)>0}var et={reset:e=>`${e}: limits reset to 0%. The weekly reset date now counts from your next use.`,nothingToReset:e=>`${e}: nothing needed resetting, so the reset was kept.`,noCredit:e=>`${e} has no free reset left.`,alreadyRedeemed:e=>`${e}: that reset had already been used.`};function tt(e){return e?new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null}function nt({account:e,usage:t,onDone:n}){let r=T(),[i,a]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1);if(!$e(t))return null;let u=t.resetCredits;async function d(){l(!0);try{let t=await y.post(`/api/codex-accounts/${e.id}/reset-credit`);n(et[t.outcome]?.(e.label)??`${e.label}: ${t.outcome}`)}catch(e){n(e.message||`Could not use the reset`)}finally{l(!1),a(!1)}}let f=tt(t.weekly?.resetsAt),p=tt(u.nextExpiresAt),m=(0,$.jsxs)(`div`,{className:`space-y-3`,"data-testid":`codex-reset-credit-confirm`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Use 1 of `,(0,$.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,u.available,` free reset`,u.available===1?``:`s`,`?`]}),(0,$.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,$.jsxs)(`li`,{children:[u.title??`Full reset`,`: the 5-hour and weekly usage go back to 0% now.`]}),(0,$.jsxs)(`li`,{children:[`The weekly reset date moves: the next one is about 7 days after you continue using Codex`,f?`, not ${f} as now`:``,`. You do not also get that one.`]}),p&&(0,$.jsxs)(`li`,{children:[`This spends the reset that expires first (`,p,`).`]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,$.jsx)(D,{variant:`outline`,onClick:()=>a(!1),disabled:c,className:`min-h-11`,children:`Keep it`}),(0,$.jsxs)(D,{onClick:()=>void d(),disabled:c,className:`min-h-11 gap-1.5`,children:[c?(0,$.jsx)(o,{className:`size-4 animate-spin`}):(0,$.jsx)(s,{className:`size-4`}),`Use reset`]})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`min-h-11 md:min-h-0 md:h-7 gap-1 px-2 text-[11px] cursor-pointer border-primary/40 text-primary`,onClick:()=>a(!0),disabled:c,children:[(0,$.jsx)(s,{className:`size-3.5`}),` Use reset`]}),i&&(r?(0,$.jsx)(w,{open:!0,onClose:()=>{c||a(!1)},children:(0,$.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Use a free reset`}),m]})}):(0,$.jsx)(N,{open:!0,onOpenChange:e=>{!e&&!c&&a(!1)},children:(0,$.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,$.jsx)(O,{children:(0,$.jsx)(j,{className:`text-sm`,children:`Use a free reset`})}),m]})}))]})}var rt=1440*60*1e3,it=7,at=5;function ot(e,t=Date.now()){if(!e||e.windowHours!==168)return null;let n=new Date(e.resetsAt).getTime();if(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=n-it*rt;if(t<r)return null;let i=Math.min(it-1,Math.floor((t-r)/rt)),a=0;for(let e=0;e<=i;e++){let t=new Date(r+e*rt).getUTCDay();t!==0&&t!==6&&a++}let o=a/at;return{day:a,cap:o,used:e.utilization,blocked:e.utilization>=o}}function st(){let[e,t]=(0,Q.useState)(null),n=de(()=>t(null)),[r,s]=(0,Q.useState)(null);return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(_e,{description:(0,$.jsxs)($.Fragment,{children:[`Each Codex account keeps its own login (`,(0,$.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,$.jsx)(d,{className:`size-4`}),` Add account`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,$.jsx)(u,{className:`size-4`}),` Export`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,$.jsx)(a,{className:`size-4`}),` Import`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation`]})]})}),(0,$.jsx)(le,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,$.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,$.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,$.jsx)(se,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,$.jsxs)(me,{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,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,$.jsx)(fe,{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`?()=>s(e):void 0,children:`Sign in again`}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),Y(e.planType)&&(0,$.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:Y(e.planType)}),(0,$.jsx)(U,{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,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.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,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(S,{side:`top`,children:`Remove account`})]})]}),(0,$.jsx)(Ze,{usage:t}),t.resetCredits&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,$.jsx)(X,{credits:t.resetCredits}),(0,$.jsx)(nt,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=ot(t.weekly);return r?(0,$.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,$.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,$.jsx)(`span`,{children:`Daily guard`}),(0,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,$.jsx)(i,{className:`size-3.5`})})}),(0,$.jsx)(S,{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,$.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,$.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,$.jsx)(U,{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,$.jsx)(J,{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,$.jsx)(qe,{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,$.jsx)(Z,{account:r,onClose:()=>s(null),onDone:()=>void n.load()}),(0,$.jsx)(Ye,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var ct=[{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 lt(e){return e==null?null:Math.round(e*100)}function ut(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)(`round-robin`),[i,a]=(0,Q.useState)({}),[s,u]=(0,Q.useState)(!0),[p,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(new Set),[E,P]=(0,Q.useState)(null),[F,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(``),[B,ee]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(!1),[V,re]=(0,Q.useState)(``),[H,ie]=(0,Q.useState)(!1),[ae,W]=(0,Q.useState)(null),G=(0,Q.useRef)(0),K=(0,Q.useRef)(!1),J=(0,Q.useRef)(!1),Y=(0,Q.useRef)(null),de=(0,Q.useRef)(null),X=(0,Q.useCallback)(async()=>{u(!0),v(null);try{let e=await y.get(`/api/antigravity-accounts`);t(e.accounts),r(e.strategy),a(await y.get(`/api/antigravity-accounts/usage`))}catch(e){v(e.message)}finally{u(!1)}},[]);(0,Q.useEffect)(()=>{X()},[X]);let fe=(0,Q.useCallback)(()=>{G.current+=1,K.current=!1,J.current=!1,de.current?.(),de.current=null;let e=Y.current;Y.current=null,e&&y.del(`/api/antigravity-accounts/login/${e}`).catch(()=>{})},[]);(0,Q.useEffect)(()=>fe,[fe]);let Z=(0,Q.useCallback)(()=>{fe(),ee(null),ne(!1),re(``),ie(!1)},[fe]),he=(0,Q.useCallback)(()=>{Z(),W(null),z(``),L(null),P(null)},[Z]),ge=(0,Q.useCallback)(e=>{let t=Date.now()+61e4,n=!1,r;de.current=()=>{n=!0,clearTimeout(r)};let i=async()=>{if(n)return;let a=null;try{a=await y.get(`/api/antigravity-accounts/login/${e}/status`)}catch{}if(!n){if(a?.state===`done`){Y.current=null,Z(),W(null),z(``),L(null),P(null),h(`Antigravity Google account connected.`),await X();return}if(a?.state===`error`||Date.now()>t){Y.current=null,Z(),W(a?.state===`error`?a.error??`Login failed.`:`Login timed out.`);return}r=setTimeout(i,2e3)}};i()},[X,Z]),ye=(0,Q.useCallback)(async e=>{if(K.current||Y.current||J.current)return;K.current=!0;let t=++G.current;ne(!0),W(null);try{let n=await y.post(`/api/antigravity-accounts/login`,{...R.trim()?{label:R.trim()}:{},...e?{accountId:e.id}:{}});if(t!==G.current){y.del(`/api/antigravity-accounts/login/${n.id}`).catch(()=>{});return}Y.current=n.id,ee(n),ge(n.id)}catch(e){t===G.current&&W(e.message)}finally{t===G.current&&(K.current=!1,ne(!1))}},[R,ge]),be=(0,Q.useCallback)(async()=>{if(!B||!V.trim()||J.current)return;let e=G.current;J.current=!0,ie(!0),W(null);try{let t=await y.post(`/api/antigravity-accounts/login/${B.id}/callback`,{code:V.trim()});if(e!==G.current)return;if(t?.state===`error`){Y.current=null,Z(),W(t.error??`Login failed.`);return}if(t?.state!==`done`)return;Y.current=null,Z(),z(``),L(null),P(null),h(`Antigravity Google account connected.`),await X()}catch(t){e===G.current&&(Y.current=null,Z(),W(t.message))}finally{e===G.current&&(J.current=!1,ie(!1))}},[B,V,X,Z]),xe=(0,Q.useCallback)(async(e,n)=>{T(t=>new Set(t).add(e)),v(null);try{let r=n===`disabled`?`active`:`disabled`;await y.patch(`/api/antigravity-accounts/${e}`,{status:r}),t(t=>t.map(t=>t.id===e?{...t,status:r}:t))}catch(e){v(e.message)}finally{T(t=>{let n=new Set(t);return n.delete(e),n})}},[]),Se=(0,Q.useCallback)(async e=>{v(null);try{await y.del(`/api/antigravity-accounts/${e}`),t(t=>t.filter(t=>t.id!==e))}catch(e){v(e.message)}},[]),Ce=(0,Q.useCallback)(async e=>{v(null);try{await y.put(`/api/antigravity-accounts/strategy`,{strategy:e}),r(e)}catch(e){v(e.message)}},[]),we=(0,Q.useCallback)(e=>{L(e),z(e.label),P(`add`)},[]);return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(_e,{description:(0,$.jsxs)($.Fragment,{children:[`Each Antigravity account keeps its own Google OAuth login (`,(0,$.jsx)(`code`,{children:`~/.ppm/antigravity-accounts`}),`) alongside your local IDE login (`,(0,$.jsx)(`code`,{children:`~/.gemini`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void X(),refreshing:s,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{L(null),z(``),P(`add`)},children:[(0,$.jsx)(d,{className:`size-4`}),` Add account`]}),(0,$.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>P(`rotation`),children:[(0,$.jsx)(_,{className:`size-4`}),` Rotation`]})]})}),(0,$.jsx)(le,{message:p??g,onDismiss:()=>{h(null),v(null)}}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:`Antigravity Accounts`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.replace(`-`,` `)})]}),s&&e.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,$.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Antigravity accounts yet.`}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Click `,(0,$.jsx)(`strong`,{children:`Add account`}),` to sign in with Google, or start Antigravity Desktop to auto-detect your local account.`]})]}):(0,$.jsx)(se,{children:e.map(e=>{let t=ve(i[e.id]??{}),n=t.session==null&&t.weekly==null&&(!t.weeklyScoped||t.weeklyScoped.length===0),r=e.id===`default`;return(0,$.jsxs)(me,{dense:!0,className:`min-w-[320px] shrink-0 snap-start`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.label}),e.email&&e.email!==e.label&&(0,$.jsx)(`div`,{className:`text-[11px] text-text-subtle truncate`,children:e.email})]}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:r?`~/.gemini`:`Google`}),e.planType&&(0,$.jsx)(`span`,{className:`text-[10px] font-medium text-primary bg-primary/10 border border-primary/20 rounded px-1.5 py-0.5 shrink-0`,children:e.planType}),(0,$.jsx)(U,{checked:e.status!==`disabled`,onCheckedChange:()=>void xe(e.id,e.status),disabled:w.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),!r&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>we(e),"aria-label":`Sign in again`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors shrink-0`,children:(0,$.jsx)(c,{className:`size-3.5`})})}),(0,$.jsx)(S,{side:`top`,children:`Sign in again`})]}),(0,$.jsxs)(C,{children:[(0,$.jsx)(x,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>void Se(e.id),"aria-label":`Remove account`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(S,{side:`top`,children:`Remove account`})]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(n||t.session!=null)&&(0,$.jsx)(ue,{label:`Gemini · 5-Hour Session`,pct:lt(t.fiveHour),reset:oe(t.session),resetsAt:t.session?.resetsAt}),(n||t.weekly!=null)&&(0,$.jsx)(ue,{label:`Gemini · Weekly`,pct:lt(t.sevenDay),reset:oe(t.weekly),resetsAt:t.weekly?.resetsAt}),t.weeklyScoped?.map(e=>(0,$.jsx)(ue,{label:e.label,pct:lt(e.utilization),reset:oe(e),resetsAt:e.resetsAt},e.label))]}),t.lastFetchedAt&&pe(t.lastFetchedAt)&&(0,$.jsxs)(`p`,{className:`text-[10px] text-warning`,children:[`Last read `,ce(Date.parse(t.lastFetchedAt)),`. Neither agy nor the Antigravity app has answered since.`]})]},e.id)})})]}),(0,$.jsx)(N,{open:E===`add`,onOpenChange:e=>{e||he()},children:(0,$.jsxs)(A,{className:`sm:max-w-md max-h-[90dvh] overflow-y-auto`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(j,{className:`text-sm`,children:F?`Sign in again — ${F.label}`:`Add Antigravity Account`}),(0,$.jsx)(M,{className:`text-xs leading-relaxed`,children:F?`Sign in with Google to refresh this account's OAuth credentials.`:`Sign in with a Google account using Antigravity's OAuth PKCE flow. Each account is stored in its own isolated directory.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[!F&&(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{htmlFor:`agy-label`,className:`text-xs`,children:`Label (optional)`}),(0,$.jsx)(I,{id:`agy-label`,placeholder:`e.g. Personal, Work, Shopee 2`,value:R,onChange:e=>z(e.target.value),disabled:te||H,className:`text-xs`})]}),(0,$.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2.5`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium`,children:`Google OAuth Sign-In`}),B?(0,$.jsxs)(`div`,{className:`space-y-2.5 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`a`,{href:B.authUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 font-medium text-primary hover:underline`,children:[(0,$.jsx)(l,{className:`size-3.5`}),` Open Google Sign-In page`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{Z(),W(null)},disabled:H,className:`text-[11px] text-muted-foreground hover:text-foreground underline cursor-pointer`,children:`Start over`})]}),(0,$.jsxs)(`p`,{className:`text-muted-foreground leading-relaxed`,children:[`1. Open the link above and sign in with your Google account.`,(0,$.jsx)(`br`,{}),`2. Copy the authorization code (or the full callback URL) shown after signing in and paste it below:`]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{htmlFor:`agy-auth-code`,className:`text-xs`,children:`Authorization Code or Callback URL`}),(0,$.jsx)(I,{id:`agy-auth-code`,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:`4/0A... or https://antigravity.google/oauth-callback?code=...`,value:V,onChange:e=>re(e.target.value),disabled:H,className:`text-xs font-mono`})]}),(0,$.jsxs)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void be(),disabled:!V.trim()||H,children:[H&&(0,$.jsx)(o,{className:`size-3.5 animate-spin`}),`Verify & Save Account`]})]}):(0,$.jsx)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void ye(F),disabled:te,children:te?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{className:`size-4 animate-spin`}),` Generating Google sign-in link...`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4`}),` Sign in with Google`]})})]})]}),ae&&(0,$.jsx)(`div`,{role:`alert`,className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:ae}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:he,children:`Cancel`})})]})}),(0,$.jsx)(N,{open:E===`rotation`,onOpenChange:e=>P(e?`rotation`:null),children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(j,{className:`text-sm`,children:`Antigravity Rotation`}),(0,$.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your enabled Antigravity accounts.`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:ct.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ce(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`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,$.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,$.jsx)(k,{children:(0,$.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>P(null),children:`Done`})})]})})]})}var dt=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`},{id:`antigravity`,label:`Antigravity`}];function ft(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(`claude`);(0,Q.useEffect)(()=>{let e=!1;return R().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let i=dt.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,$.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,$.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,$.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,$.jsx)(P,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(o,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,$.jsx)(Ke,{}):n===`codex`?(0,$.jsx)(st,{}):(0,$.jsx)(ut,{})]})}export{ft 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-WX6NXGTJ.js";import"./vendor-ui-XWGn718B.js";import{ui as r}from"./icons-CXY5ue_g.js";import{t as i}from"./preload-helper-uTix4PVD.js";import"./portal-container-context-tAk8C8AE.js";import{t as a}from"./mobile-bottom-sheet-CR0IYSBI.js";import"./use-visual-viewport-CFeFggvP.js";import{t as o}from"./agent-session-sheet-store-uxRCMO7m.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-D37AX2th.js","assets/rolldown-runtime-C5c2KzVm.js","assets/vendor-ui-XWGn718B.js","assets/vendor-markdown-WX6NXGTJ.js","assets/utils-DMiycH3O.js","assets/libesm-DtVH87tT.js","assets/api-client-vI7TyFOL.js","assets/open-ppm-tab-CsbF9oE1.js","assets/settings-store-DjuCPpqK.js","assets/preload-helper-uTix4PVD.js","assets/react-DcQQAZIk.js","assets/settings-events-DwkLDkzD.js","assets/window-store-CUC3goyK.js","assets/minimal-mode-DDuML1Oi.js","assets/panel-store-C8BMiE6r.js","assets/session-list-sync-triggers-TcIGY5Gf.js","assets/project-store-CqelYf-s.js","assets/project-framework-store-B-WxvTpu.js","assets/open-assistant-DFwSXZhe.js","assets/patch-tab-metadata-Dedq9hZv.js","assets/open-settings-B4ZjUYGC.js","assets/settings-categories-Y3jjEzYq.js","assets/icons-CXY5ue_g.js","assets/use-is-mobile-_O8suyE-.js","assets/tab-store-QBa8a8Ea.js","assets/design-tab-metadata-DfslGXRv.js","assets/chat-jump-store-DinYYGGj.js","assets/tool-cards-BdQzObMQ.js","assets/index-Dh1mYjGB.js","assets/button-BCTqB-tu.js","assets/createLucideIcon-eJ-vX0nK.js","assets/extension-icons-ybU3E-fL.js","assets/git-commit-horizontal-Dd_uNUhV.js","assets/background-output-store-Cqsu1Pe8.js","assets/open-db-tabs-CBwb8PII.js","assets/explorer-model-RlqYdmjO.js","assets/db-connection-config-BHSrmiMw.js","assets/db-types-zK7v68L_.js","assets/db-explorer-store-DAKKs0KL.js","assets/db-drivers-B-KtKQnu.js","assets/open-logs-DeqC63FG.js","assets/use-explorer-open-state-CUkj-Dq5.js","assets/remote-access-tab-store-CG1VJnPs.js","assets/use-is-touch-only-CsQzu0T-.js","assets/git-repo-store-CTm3j9tg.js","assets/extension-store-BA3neLjA.js","assets/keybindings-store-D88QDyfS.js","assets/build-message-with-attachments-Ct69HqZU.js","assets/close-window-Dq__FGE2.js","assets/model-thinking-selector-helpers-Dn3xr9jh.js","assets/dialog-CoO-z2qj.js","assets/portal-container-context-tAk8C8AE.js","assets/input-CcBfRi6-.js","assets/mobile-bottom-sheet-CR0IYSBI.js","assets/use-visual-viewport-CFeFggvP.js","assets/ppm-tools-BPerUg3f.js","assets/tab-open-protocol-BUpI8eRV.js","assets/split-sql-statements-Vmj3uOWf.js","assets/session-collab-9n55N5Yi.js","assets/file-store-D4_OlIcj.js","assets/slash-command-picker-B2ckAVNi.js","assets/user-message-parse-CfOxGzPd.js","assets/assistant-name-store-DSoH_0w2.js","assets/assistant-persona-B781SaSV.js","assets/provider-selector-DcPsEA72.js","assets/chat-preparation-cache-BjKMLTNJ.js","assets/provider-logos-m5ZC_yzc.js","assets/use-coarse-long-press-DK5QuzCK.js","assets/adaptive-context-menu-xX3GYsY2.js","assets/start-ellipsis-BmXdXC0j.js","assets/tooltip-CCx1ynhU.js","assets/api-settings-D4cXrjrY.js","assets/format-date-DJ_k51mc.js","assets/image-gallery-J7t6M0LS.js","assets/session-collab-client-C4uwh8A0.js","assets/send-to-chat-B06CjX1D.js","assets/notification-store-6S918LfB.js","assets/unsaved-grid-rows-store-CVKm9pb0.js","assets/use-assistant-telegram-binding-6aINJEG2.js","assets/impexp-state-XddrW0ht.js","assets/design-canvas-check-DoJFnvkp.js","assets/sql-identifiers-CzF5oBAB.js","assets/format-file-meta-x6OUDfb9.js","assets/fs-api-ZCc4I_Do.js","assets/dropdown-menu-cKkDmlOg.js","assets/scroll-area-DqE4p3pX.js","assets/use-git-repo-B0bQeLpv.js","assets/clipboard-SyUe4kh-.js","assets/file-icons-DFW8l2IL.js","assets/global-ws-channel-C5DnLfQG.js","assets/ws-auth-Bh6IMZdH.js","assets/streaming-store-mU2NFGwZ.js","assets/apply-theme-BU63HGCw.js","assets/resolve-theme-CCeC2iWE.js","assets/index--wNHkCER.css","assets/agent-session-sheet-store-uxRCMO7m.js","assets/image-preview-geometry-RIr_he1m.js","assets/markdown-context-CrpXiAXV.js","assets/use-blob-url-wwGVIzzV.js","assets/html-preview-loads-D-HBaNoF.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-WX6NXGTJ.js";import"./vendor-ui-XWGn718B.js";import{ui as r}from"./icons-CXY5ue_g.js";import{t as i}from"./preload-helper-uTix4PVD.js";import"./portal-container-context-tAk8C8AE.js";import{t as a}from"./mobile-bottom-sheet-CR0IYSBI.js";import"./use-visual-viewport-CFeFggvP.js";import{t as o}from"./agent-session-sheet-store-uxRCMO7m.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-D37AX2th.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99])));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"./settings-store-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./settings-store-DjuCPpqK.js";import{D as t,E as n}from"./vendor-markdown-WX6NXGTJ.js";import"./vendor-ui-XWGn718B.js";import{L as r,P as i,Sn as a}from"./icons-CXY5ue_g.js";import{y as o}from"./api-client-vI7TyFOL.js";import{n as s}from"./utils-DMiycH3O.js";import"./window-store-CUC3goyK.js";import"./panel-store-C8BMiE6r.js";import"./project-store-CqelYf-s.js";import"./project-framework-store-B-WxvTpu.js";import"./session-list-sync-triggers-TcIGY5Gf.js";import"./tab-store-QBa8a8Ea.js";import{n as c}from"./use-coarse-long-press-DK5QuzCK.js";import"./chat-jump-store-DinYYGGj.js";import"./use-is-mobile-_O8suyE-.js";import"./settings-categories-Y3jjEzYq.js";import"./open-settings-B4ZjUYGC.js";import"./patch-tab-metadata-Dedq9hZv.js";import"./open-assistant-DFwSXZhe.js";import"./open-ppm-tab-CsbF9oE1.js";import"./session-collab-client-C4uwh8A0.js";import"./session-collab-9n55N5Yi.js";import"./notification-store-6S918LfB.js";import"./chat-preparation-cache-BjKMLTNJ.js";import"./provider-logos-m5ZC_yzc.js";import"./provider-selector-DcPsEA72.js";import"./file-store-D4_OlIcj.js";import"./streaming-store-mU2NFGwZ.js";import"./fs-api-ZCc4I_Do.js";import{n as l,r as u}from"./global-ws-channel-C5DnLfQG.js";import"./image-gallery-J7t6M0LS.js";import"./tab-open-protocol-BUpI8eRV.js";import"./design-canvas-check-DoJFnvkp.js";import{_ as d,a as f,i as p,t as m}from"./tool-cards-BdQzObMQ.js";import"./libesm-DtVH87tT.js";import{t as h}from"./markdown-context-CrpXiAXV.js";import"./use-blob-url-wwGVIzzV.js";import"./agent-session-sheet-store-uxRCMO7m.js";var g=e(t(),1),_=2e3;function v(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-_):n}function y(){return`ats-${Math.random().toString(36).slice(2,10)}`}function b(e){let{projectName:t,providerId:n,sessionId:r,source:i,fallbackEvents:a}=e,[o,s]=(0,g.useState)([]),[c,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(!0),[_,b]=(0,g.useState)(null);(0,g.useEffect)(()=>{let e=y(),a=[],o;s([]),d(!1),p(!1),h(!0),b(null);let c=()=>{u(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=v(a,n),o=n.cursor,s(a),d(n.available),p(n.running),h(!1),b(null))},m=t=>{let n=t.detail;n.subId===e&&(d(!1),h(!1),b(n.code))};window.addEventListener(`agent-transcript:events`,f),window.addEventListener(`agent-transcript:error`,m);let g=l(c);return c(),()=>{window.removeEventListener(`agent-transcript:events`,f),window.removeEventListener(`agent-transcript:error`,m),g(),u(JSON.stringify({type:`agent-transcript:unsubscribe`,subId:e}))}},[JSON.stringify([t,n,r,i])]);let x=(0,g.useMemo)(()=>o.map(e=>e.ev),[o]);return{events:c?x:a??[],available:c,running:f,loading:m,error:_}}var x=n();function S(e){return e.filter(e=>e.type===`tool_use`).length}function C({status:e}){return e===`loading`?null:e===`running`?(0,x.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-primary shrink-0`,children:[(0,x.jsx)(a,{className:`size-2.5 animate-spin`}),` running`]}):e===`failed`?(0,x.jsx)(`span`,{className:`text-[10px] text-error shrink-0`,children:`failed`}):(0,x.jsx)(`span`,{className:`text-[10px] text-success shrink-0`,children:`done`})}function w({payload:e}){let t=e??{},n=t.sessionId?p(t.sessionId,t.source):``,l=f(e=>n?e.entries[n]:void 0),{events:u,available:_,running:v,loading:y,error:w}=b({projectName:t.projectName,providerId:t.providerId,sessionId:t.sessionId,source:t.source,fallbackEvents:l}),[T,E]=(0,g.useState)(!1),D=c(),O=(0,g.useMemo)(()=>S(u),[u]),k=u[u.length-1],A=!v&&!!k&&k.type===`tool_result`&&!!k.isError,j=y?`loading`:v?`running`:A?`failed`:`done`;return(0,x.jsx)(h.Provider,{value:o(t.projectName),children:(0,x.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface @container`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,x.jsx)(`span`,{className:`truncate text-xs font-medium`,children:t.title??`Agent session`}),u.length>0&&(0,x.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:d(O)}),(0,x.jsx)(C,{status:j}),!_&&!y&&(0,x.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,x.jsxs)(`div`,{className:`border-b border-border/30 shrink-0`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>E(e=>!e),className:s(`flex w-full items-center gap-1.5 px-3 py-1.5 text-[11px] text-text-subtle hover:text-foreground`,D?`min-h-[44px]`:`min-h-[28px]`),children:[T?(0,x.jsx)(i,{className:`size-3`}):(0,x.jsx)(r,{className:`size-3`}),`Prompt`]}),T&&(0,x.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-text-secondary whitespace-pre-wrap select-text`,children:t.prompt})]}),y&&u.length===0?(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,x.jsx)(a,{className:`size-3 animate-spin`}),`Loading session…`]}):u.length===0?(0,x.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle px-4 text-center`,children:w?`Could not load this session`:`No recorded steps`}):(0,x.jsx)(m,{events:u,projectName:t.projectName,variant:`window`,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})})}export{w as default};
|
|
Binary file
|
|
Binary file
|