@hienlh/ppm 0.23.4 → 0.23.6
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 +11 -0
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/cli-reference.md +4 -4
- package/assets/skills/ppm/references/http-api.md +2 -1
- package/dist/web/assets/accounts-settings-section-DUVO32SQ.js +1 -0
- package/dist/web/assets/accounts-settings-section-DUVO32SQ.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-DUVO32SQ.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-DKcsVDle.js → ai-resource-editor-Dn_wB-o5.js} +1 -1
- package/dist/web/assets/ai-resource-editor-Dn_wB-o5.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-Dn_wB-o5.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-D7zJ-hCO.js → ai-settings-section-CEbW8jRy.js} +1 -1
- package/dist/web/assets/ai-settings-section-CEbW8jRy.js.br +0 -0
- package/dist/web/assets/ai-settings-section-CEbW8jRy.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-OPqC2bYG.js → ai-settings-section-D-mwEYFZ.js} +1 -1
- package/dist/web/assets/{appearance-settings-section-DL466x83.js → appearance-settings-section-tw6TpFb6.js} +1 -1
- package/dist/web/assets/appearance-settings-section-tw6TpFb6.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-tw6TpFb6.js.gz +0 -0
- package/dist/web/assets/{branch-review-tab-Dag86n_R.js → branch-review-tab-MBuMWp_i.js} +1 -1
- package/dist/web/assets/branch-review-tab-MBuMWp_i.js.br +0 -0
- package/dist/web/assets/branch-review-tab-MBuMWp_i.js.gz +0 -0
- package/dist/web/assets/{chat-tab-QFDhzzBZ.js → chat-tab-DVvnqhw6.js} +1 -1
- package/dist/web/assets/chat-tab-DVvnqhw6.js.br +0 -0
- package/dist/web/assets/chat-tab-DVvnqhw6.js.gz +0 -0
- package/dist/web/assets/chat-tab-DaEHva22.js +15 -0
- package/dist/web/assets/chat-tab-DaEHva22.js.br +0 -0
- package/dist/web/assets/chat-tab-DaEHva22.js.gz +0 -0
- package/dist/web/assets/{code-editor-K-IN8VwJ.js → code-editor-Bu9lhTVp.js} +3 -3
- package/dist/web/assets/code-editor-Bu9lhTVp.js.br +0 -0
- package/dist/web/assets/code-editor-Bu9lhTVp.js.gz +0 -0
- package/dist/web/assets/codex-reset-credit-button-CbmE5mRX.js +1 -0
- package/dist/web/assets/codex-reset-credit-button-CbmE5mRX.js.br +0 -0
- package/dist/web/assets/codex-reset-credit-button-CbmE5mRX.js.gz +0 -0
- package/dist/web/assets/{conflict-editor-qMGJH0Bx.js → conflict-editor-BA3y-qSH.js} +1 -1
- package/dist/web/assets/conflict-editor-BA3y-qSH.js.br +0 -0
- package/dist/web/assets/conflict-editor-BA3y-qSH.js.gz +0 -0
- package/dist/web/assets/{csv-preview-D2I742dl.js → csv-preview-BioxkrQF.js} +1 -1
- package/dist/web/assets/csv-preview-BioxkrQF.js.br +0 -0
- package/dist/web/assets/csv-preview-BioxkrQF.js.gz +0 -0
- package/dist/web/assets/{database-viewer-Bz4LjgIa.js → database-viewer-BSoJ0E6p.js} +1 -1
- package/dist/web/assets/database-viewer-BSoJ0E6p.js.br +0 -0
- package/dist/web/assets/database-viewer-BSoJ0E6p.js.gz +0 -0
- package/dist/web/assets/{design-tab-C987MtMR.js → design-tab-iU2CviE3.js} +1 -1
- package/dist/web/assets/design-tab-iU2CviE3.js.br +0 -0
- package/dist/web/assets/design-tab-iU2CviE3.js.gz +0 -0
- package/dist/web/assets/{designs-sidebar-panel-CapP1yXq.js → designs-sidebar-panel-DHh5QsH9.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-DHh5QsH9.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-DHh5QsH9.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-CdXi7cZN.js → diff-viewer-lctWoSmG.js} +1 -1
- package/dist/web/assets/diff-viewer-lctWoSmG.js.br +0 -0
- package/dist/web/assets/diff-viewer-lctWoSmG.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-Zle_PZV8.js → editor-language-service-fPG56hQO.js} +1 -1
- package/dist/web/assets/editor-language-service-fPG56hQO.js.br +0 -0
- package/dist/web/assets/editor-language-service-fPG56hQO.js.gz +0 -0
- package/dist/web/assets/{explorer-body-DHMQR1Rk.js → explorer-body-BgF7FsxI.js} +1 -1
- package/dist/web/assets/explorer-body-BgF7FsxI.js.br +0 -0
- package/dist/web/assets/explorer-body-BgF7FsxI.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-Df40nQBk.js → explorer-window-content-C21w_7lf.js} +1 -1
- package/dist/web/assets/explorer-window-content-C21w_7lf.js.br +0 -0
- package/dist/web/assets/explorer-window-content-C21w_7lf.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-B2nZzJ2b.js → extension-manager-section-rbkXsZVR.js} +1 -1
- package/dist/web/assets/extension-manager-section-rbkXsZVR.js.br +0 -0
- package/dist/web/assets/extension-manager-section-rbkXsZVR.js.gz +0 -0
- package/dist/web/assets/{extension-webview-BGoDxkdF.js → extension-webview-uPO0WgCq.js} +1 -1
- package/dist/web/assets/extension-webview-uPO0WgCq.js.br +0 -0
- package/dist/web/assets/extension-webview-uPO0WgCq.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-DC3OzzOl.js → files-settings-section-CT7mDb0L.js} +1 -1
- package/dist/web/assets/files-settings-section-CT7mDb0L.js.br +0 -0
- package/dist/web/assets/files-settings-section-CT7mDb0L.js.gz +0 -0
- package/dist/web/assets/{general-settings-section-i41W43ER.js → general-settings-section-DANPfMRN.js} +1 -1
- package/dist/web/assets/general-settings-section-DANPfMRN.js.br +0 -0
- package/dist/web/assets/general-settings-section-DANPfMRN.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-DHzPIkJg.js → git-log-panel-BJPkLiEw.js} +1 -1
- package/dist/web/assets/git-log-panel-BJPkLiEw.js.br +0 -0
- package/dist/web/assets/git-log-panel-BJPkLiEw.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-Dj4vrDvj.js → glide-data-grid-R4PcAntf.js} +1 -1
- package/dist/web/assets/glide-data-grid-R4PcAntf.js.br +0 -0
- package/dist/web/assets/glide-data-grid-R4PcAntf.js.gz +0 -0
- package/dist/web/assets/{group-chat-tab-DfwZb-fI.js → group-chat-tab-BXMdo8w9.js} +1 -1
- package/dist/web/assets/group-chat-tab-BXMdo8w9.js.br +0 -0
- package/dist/web/assets/group-chat-tab-BXMdo8w9.js.gz +0 -0
- package/dist/web/assets/{index-jG9mLs-J.js → index-C8nGqkKN.js} +5 -5
- package/dist/web/assets/index-C8nGqkKN.js.br +0 -0
- package/dist/web/assets/index-C8nGqkKN.js.gz +0 -0
- package/dist/web/assets/{index-DMA-So69.css → index-DvClbTQx.css} +1 -1
- package/dist/web/assets/index-DvClbTQx.css.br +0 -0
- package/dist/web/assets/{index-DMA-So69.css.gz → index-DvClbTQx.css.gz} +0 -0
- package/dist/web/assets/{jira-watcher-section-BJ9edGEP.js → jira-watcher-section-DHRoyWcG.js} +1 -1
- package/dist/web/assets/{keybindings-store-BlapkC6O.js → keybindings-store-BGKlQQAv.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-CxdGSNGr.js → keyboard-shortcuts-section-BKej4mUf.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-BKej4mUf.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-BKej4mUf.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-ok96IgnS.js → markdown-renderer-BHtYqkYZ.js} +1 -1
- package/dist/web/assets/markdown-renderer-BHtYqkYZ.js.br +0 -0
- package/dist/web/assets/markdown-renderer-BHtYqkYZ.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-DJ9EVU1B.js → markdown-renderer-vDNuKjel.js} +1 -1
- package/dist/web/assets/{mobile-explorer-sheet-Cc03LUKy.js → mobile-explorer-sheet-DtvxS7-r.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-DtvxS7-r.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-DtvxS7-r.js.gz +0 -0
- package/dist/web/assets/{new-design-dialog-Drkjb_LI.js → new-design-dialog-DS_XrpTG.js} +1 -1
- package/dist/web/assets/new-design-dialog-DS_XrpTG.js.br +0 -0
- package/dist/web/assets/new-design-dialog-DS_XrpTG.js.gz +0 -0
- package/dist/web/assets/{notification-store-DCyxho0O.js → notification-store-Dnnj20Ky.js} +1 -1
- package/dist/web/assets/{ppmbot-settings-section-C8PFlvaq.js → ppmbot-settings-section-D8AES1BA.js} +1 -1
- package/dist/web/assets/ppmbot-settings-section-D8AES1BA.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-D8AES1BA.js.gz +0 -0
- package/dist/web/assets/{problems-panel-CFYO0Ro3.js → problems-panel-DTBG4beI.js} +1 -1
- package/dist/web/assets/problems-panel-DTBG4beI.js.br +0 -0
- package/dist/web/assets/problems-panel-DTBG4beI.js.gz +0 -0
- package/dist/web/assets/{process-table-BVeRguFg.js → process-table-D_gR2XA6.js} +1 -1
- package/dist/web/assets/process-table-D_gR2XA6.js.br +0 -0
- package/dist/web/assets/process-table-D_gR2XA6.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-BcHIEANE.js → proxy-settings-section-CqtmbeRj.js} +1 -1
- package/dist/web/assets/proxy-settings-section-CqtmbeRj.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-CqtmbeRj.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-clipboard-notice-BGsp0edA.js → remote-desktop-clipboard-notice-Djt6cpNL.js} +1 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-Djt6cpNL.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-Djt6cpNL.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-sheet-DxkmF8qb.js → remote-desktop-mobile-sheet-BQxhJUkm.js} +2 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-BQxhJUkm.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BQxhJUkm.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-DMD0M9Jh.js → remote-desktop-mobile-view-DGnT8RY7.js} +1 -1
- package/dist/web/assets/remote-desktop-mobile-view-DGnT8RY7.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DGnT8RY7.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-readiness-gate-CsZCCRJI.js → remote-desktop-readiness-gate-DNJF8TcF.js} +1 -1
- package/dist/web/assets/remote-desktop-readiness-gate-DNJF8TcF.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-DNJF8TcF.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-window-content-DrHw_vwY.js → remote-desktop-window-content-Ds0DKmM0.js} +1 -1
- package/dist/web/assets/remote-desktop-window-content-Ds0DKmM0.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-Ds0DKmM0.js.gz +0 -0
- package/dist/web/assets/{schedules-settings-section-Ci0O2Ng6.js → schedules-settings-section-BKoPovy2.js} +1 -1
- package/dist/web/assets/schedules-settings-section-BKoPovy2.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-BKoPovy2.js.gz +0 -0
- package/dist/web/assets/{settings-body-B6JGOIYb.js → settings-body-k2qPgRFe.js} +2 -2
- package/dist/web/assets/settings-body-k2qPgRFe.js.br +0 -0
- package/dist/web/assets/settings-body-k2qPgRFe.js.gz +0 -0
- package/dist/web/assets/{settings-tab-CIQM4fNE.js → settings-tab-Bb23VdBu.js} +1 -1
- package/dist/web/assets/{settings-window-content-BGNNz-E5.js → settings-window-content-ClarWusz.js} +1 -1
- package/dist/web/assets/{sql-query-editor-4iCGE4h2.js → sql-query-editor-BjIMi9Wk.js} +1 -1
- package/dist/web/assets/sql-query-editor-BjIMi9Wk.js.br +0 -0
- package/dist/web/assets/sql-query-editor-BjIMi9Wk.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-CK6DulYk.js → sqlite-viewer-BNcA6Irq.js} +1 -1
- package/dist/web/assets/sqlite-viewer-BNcA6Irq.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-BNcA6Irq.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-J9JtvAWV.js → system-monitor-body-D0T3ggt2.js} +2 -2
- package/dist/web/assets/system-monitor-body-D0T3ggt2.js.br +0 -0
- package/dist/web/assets/system-monitor-body-D0T3ggt2.js.gz +0 -0
- package/dist/web/assets/{system-monitor-tab-DjBeRE81.js → system-monitor-tab-I1Igmoey.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-BT7-ugFx.js → system-monitor-window-content-C5SeUv1H.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-CWBaWKjA.js → tab-host-window-content-CIRGNCvi.js} +1 -1
- package/dist/web/assets/tab-host-window-content-CIRGNCvi.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-CIRGNCvi.js.gz +0 -0
- package/dist/web/assets/{team-member-sheet-Br6mrxrw.js → team-member-sheet-CwXpLi3X.js} +2 -2
- package/dist/web/assets/team-member-sheet-CwXpLi3X.js.br +0 -0
- package/dist/web/assets/team-member-sheet-CwXpLi3X.js.gz +0 -0
- package/dist/web/assets/{team-member-window-content-CwCy7ZWf.js → team-member-window-content-4swiiDz7.js} +1 -1
- package/dist/web/assets/team-member-window-content-4swiiDz7.js.br +0 -0
- package/dist/web/assets/team-member-window-content-4swiiDz7.js.gz +0 -0
- package/dist/web/assets/{terminal-tab-BW14RpCb.js → terminal-tab-BGcdtMMT.js} +1 -1
- package/dist/web/assets/terminal-tab-BGcdtMMT.js.br +0 -0
- package/dist/web/assets/terminal-tab-BGcdtMMT.js.gz +0 -0
- package/dist/web/assets/{tool-cards-CgOBEUnb.js → tool-cards-D0-krtA2.js} +2 -2
- package/dist/web/assets/tool-cards-D0-krtA2.js.br +0 -0
- package/dist/web/assets/tool-cards-D0-krtA2.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-Bzjfru4n.js → use-inline-blame-pKaXyGU-.js} +1 -1
- package/dist/web/assets/use-inline-blame-pKaXyGU-.js.br +0 -0
- package/dist/web/assets/use-inline-blame-pKaXyGU-.js.gz +0 -0
- package/dist/web/assets/{use-lsp-hGdjL2hV.js → use-lsp-71azTXQz.js} +1 -1
- package/dist/web/assets/use-lsp-71azTXQz.js.br +0 -0
- package/dist/web/assets/use-lsp-71azTXQz.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-rH6epJYA.js → use-monaco-theme-C88KphGx.js} +1 -1
- package/dist/web/assets/{use-websocket-QwURkjpV.js → use-websocket-Chk9guIU.js} +1 -1
- package/dist/web/assets/{video-preview-P9T-ZVdN.js → video-preview-DxEX-uGo.js} +1 -1
- package/dist/web/assets/video-preview-DxEX-uGo.js.br +0 -0
- package/dist/web/assets/video-preview-DxEX-uGo.js.gz +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/dist/web/sw.js +1 -1
- package/dist/web/sw.js.br +0 -0
- package/dist/web/sw.js.gz +0 -0
- package/package.json +1 -1
- package/src/providers/codex-app-server/codex-history.ts +43 -5
- package/src/providers/codex-app-server/codex-provider.ts +11 -5
- package/src/providers/codex-app-server/codex-reset-credit.ts +49 -0
- package/src/server/routes/codex-accounts.ts +14 -0
- package/src/server/ws/chat.ts +22 -3
- package/src/services/codex-reset-credit.service.ts +70 -0
- package/src/shared/usage-extra.ts +19 -0
- package/src/types/chat.ts +2 -0
- package/src/web/components/chat/codex-usage-panel.tsx +4 -0
- package/src/web/components/settings/accounts/account-card.tsx +5 -1
- package/src/web/components/settings/accounts/account-usage-extras.tsx +3 -2
- package/src/web/components/settings/accounts/codex-accounts-section.tsx +3 -1
- package/src/web/components/settings/accounts/codex-reset-credit-button.tsx +120 -0
- package/dist/web/assets/accounts-settings-section-CgG5P3Jm.js +0 -1
- package/dist/web/assets/accounts-settings-section-CgG5P3Jm.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-CgG5P3Jm.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-DKcsVDle.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-DKcsVDle.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-D7zJ-hCO.js.br +0 -0
- package/dist/web/assets/ai-settings-section-D7zJ-hCO.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-DL466x83.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-DL466x83.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-Dag86n_R.js.br +0 -0
- package/dist/web/assets/branch-review-tab-Dag86n_R.js.gz +0 -0
- package/dist/web/assets/chat-tab-CcYZLXls.js +0 -15
- package/dist/web/assets/chat-tab-CcYZLXls.js.br +0 -0
- package/dist/web/assets/chat-tab-CcYZLXls.js.gz +0 -0
- package/dist/web/assets/chat-tab-QFDhzzBZ.js.br +0 -0
- package/dist/web/assets/chat-tab-QFDhzzBZ.js.gz +0 -0
- package/dist/web/assets/code-editor-K-IN8VwJ.js.br +0 -0
- package/dist/web/assets/code-editor-K-IN8VwJ.js.gz +0 -0
- package/dist/web/assets/codex-sign-in-again-dialog-C8JvblLG.js +0 -1
- package/dist/web/assets/codex-sign-in-again-dialog-C8JvblLG.js.br +0 -0
- package/dist/web/assets/codex-sign-in-again-dialog-C8JvblLG.js.gz +0 -0
- package/dist/web/assets/conflict-editor-qMGJH0Bx.js.br +0 -0
- package/dist/web/assets/conflict-editor-qMGJH0Bx.js.gz +0 -0
- package/dist/web/assets/csv-preview-D2I742dl.js.br +0 -0
- package/dist/web/assets/csv-preview-D2I742dl.js.gz +0 -0
- package/dist/web/assets/database-viewer-Bz4LjgIa.js.br +0 -0
- package/dist/web/assets/database-viewer-Bz4LjgIa.js.gz +0 -0
- package/dist/web/assets/design-tab-C987MtMR.js.br +0 -0
- package/dist/web/assets/design-tab-C987MtMR.js.gz +0 -0
- package/dist/web/assets/designs-sidebar-panel-CapP1yXq.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-CapP1yXq.js.gz +0 -0
- package/dist/web/assets/diff-viewer-CdXi7cZN.js.br +0 -0
- package/dist/web/assets/diff-viewer-CdXi7cZN.js.gz +0 -0
- package/dist/web/assets/editor-language-service-Zle_PZV8.js.br +0 -0
- package/dist/web/assets/editor-language-service-Zle_PZV8.js.gz +0 -0
- package/dist/web/assets/explorer-body-DHMQR1Rk.js.br +0 -0
- package/dist/web/assets/explorer-body-DHMQR1Rk.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-Df40nQBk.js.br +0 -0
- package/dist/web/assets/explorer-window-content-Df40nQBk.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-B2nZzJ2b.js.br +0 -0
- package/dist/web/assets/extension-manager-section-B2nZzJ2b.js.gz +0 -0
- package/dist/web/assets/extension-webview-BGoDxkdF.js.br +0 -0
- package/dist/web/assets/extension-webview-BGoDxkdF.js.gz +0 -0
- package/dist/web/assets/files-settings-section-DC3OzzOl.js.br +0 -0
- package/dist/web/assets/files-settings-section-DC3OzzOl.js.gz +0 -0
- package/dist/web/assets/general-settings-section-i41W43ER.js.br +0 -0
- package/dist/web/assets/general-settings-section-i41W43ER.js.gz +0 -0
- package/dist/web/assets/git-log-panel-DHzPIkJg.js.br +0 -0
- package/dist/web/assets/git-log-panel-DHzPIkJg.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-Dj4vrDvj.js.br +0 -0
- package/dist/web/assets/glide-data-grid-Dj4vrDvj.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-DfwZb-fI.js.br +0 -0
- package/dist/web/assets/group-chat-tab-DfwZb-fI.js.gz +0 -0
- package/dist/web/assets/index-DMA-So69.css.br +0 -0
- package/dist/web/assets/index-jG9mLs-J.js.br +0 -0
- package/dist/web/assets/index-jG9mLs-J.js.gz +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-CxdGSNGr.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-CxdGSNGr.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-ok96IgnS.js.br +0 -0
- package/dist/web/assets/markdown-renderer-ok96IgnS.js.gz +0 -0
- package/dist/web/assets/mobile-explorer-sheet-Cc03LUKy.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-Cc03LUKy.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-Drkjb_LI.js.br +0 -0
- package/dist/web/assets/new-design-dialog-Drkjb_LI.js.gz +0 -0
- package/dist/web/assets/ppmbot-settings-section-C8PFlvaq.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-C8PFlvaq.js.gz +0 -0
- package/dist/web/assets/problems-panel-CFYO0Ro3.js.br +0 -0
- package/dist/web/assets/problems-panel-CFYO0Ro3.js.gz +0 -0
- package/dist/web/assets/process-table-BVeRguFg.js.br +0 -0
- package/dist/web/assets/process-table-BVeRguFg.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-BcHIEANE.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-BcHIEANE.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-BGsp0edA.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-BGsp0edA.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-DxkmF8qb.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-DxkmF8qb.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DMD0M9Jh.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DMD0M9Jh.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CsZCCRJI.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CsZCCRJI.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-DrHw_vwY.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-DrHw_vwY.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-Ci0O2Ng6.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-Ci0O2Ng6.js.gz +0 -0
- package/dist/web/assets/settings-body-B6JGOIYb.js.br +0 -0
- package/dist/web/assets/settings-body-B6JGOIYb.js.gz +0 -0
- package/dist/web/assets/sql-query-editor-4iCGE4h2.js.br +0 -3
- package/dist/web/assets/sql-query-editor-4iCGE4h2.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-CK6DulYk.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-CK6DulYk.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-J9JtvAWV.js.br +0 -0
- package/dist/web/assets/system-monitor-body-J9JtvAWV.js.gz +0 -0
- package/dist/web/assets/tab-host-window-content-CWBaWKjA.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-CWBaWKjA.js.gz +0 -0
- package/dist/web/assets/team-member-sheet-Br6mrxrw.js.br +0 -0
- package/dist/web/assets/team-member-sheet-Br6mrxrw.js.gz +0 -0
- package/dist/web/assets/team-member-window-content-CwCy7ZWf.js.br +0 -0
- package/dist/web/assets/team-member-window-content-CwCy7ZWf.js.gz +0 -0
- package/dist/web/assets/terminal-tab-BW14RpCb.js.br +0 -0
- package/dist/web/assets/terminal-tab-BW14RpCb.js.gz +0 -0
- package/dist/web/assets/tool-cards-CgOBEUnb.js.br +0 -0
- package/dist/web/assets/tool-cards-CgOBEUnb.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-Bzjfru4n.js.br +0 -0
- package/dist/web/assets/use-inline-blame-Bzjfru4n.js.gz +0 -0
- package/dist/web/assets/use-lsp-hGdjL2hV.js.br +0 -0
- package/dist/web/assets/use-lsp-hGdjL2hV.js.gz +0 -0
- package/dist/web/assets/video-preview-P9T-ZVdN.js.br +0 -0
- package/dist/web/assets/video-preview-P9T-ZVdN.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.23.6] - 2026-09-28
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- A "Use reset" button on a Codex account card spends one of its free rate-limit resets, offered only once a limit is reached and after a confirmation that the weekly reset date will move.
|
|
7
|
+
|
|
8
|
+
## [0.23.5] - 2026-09-27
|
|
9
|
+
|
|
10
|
+
### Improved
|
|
11
|
+
- New Codex chats reply about 2.5 s sooner, and starting one no longer freezes the whole server for a couple of seconds.
|
|
12
|
+
- The Codex session list loads about 4x faster.
|
|
13
|
+
|
|
3
14
|
## [0.23.4] - 2026-09-27
|
|
4
15
|
|
|
5
16
|
### Improved
|
|
@@ -71,4 +71,4 @@ This skill covers the `ppm` CLI, its HTTP API, and its config DB. It does **not*
|
|
|
71
71
|
- Third-party extensions (inspect via `ppm ext list`).
|
|
72
72
|
- The Claude Agent SDK internals (separate skill).
|
|
73
73
|
|
|
74
|
-
<!-- Generated for PPM v0.23.
|
|
74
|
+
<!-- Generated for PPM v0.23.6 at build time. Re-run `ppm export skill --install` to refresh. -->
|
|
@@ -781,7 +781,7 @@ Show recent runs for a schedule
|
|
|
781
781
|
Manage and inspect discovered skills & commands
|
|
782
782
|
|
|
783
783
|
**Options:**
|
|
784
|
-
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release
|
|
784
|
+
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
|
|
785
785
|
|
|
786
786
|
**Usage:** `ppm skills [options] [command]`
|
|
787
787
|
|
|
@@ -791,7 +791,7 @@ List all discovered skills and commands
|
|
|
791
791
|
|
|
792
792
|
**Options:**
|
|
793
793
|
- `--json` — JSON output
|
|
794
|
-
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release
|
|
794
|
+
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
|
|
795
795
|
|
|
796
796
|
### `ppm skills search`
|
|
797
797
|
|
|
@@ -799,7 +799,7 @@ Fuzzy search skills and commands
|
|
|
799
799
|
|
|
800
800
|
**Options:**
|
|
801
801
|
- `--json` — JSON output
|
|
802
|
-
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release
|
|
802
|
+
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
|
|
803
803
|
|
|
804
804
|
**Usage:** `ppm skills search [options] <query>`
|
|
805
805
|
|
|
@@ -809,7 +809,7 @@ Show detailed info for a specific skill
|
|
|
809
809
|
|
|
810
810
|
**Options:**
|
|
811
811
|
- `--json` — JSON output
|
|
812
|
-
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release
|
|
812
|
+
- `--project <path>` — Project path (default: `"C:\\Users\\PC\\ppm-release"`)
|
|
813
813
|
|
|
814
814
|
**Usage:** `ppm skills info [options] <name>`
|
|
815
815
|
|
|
@@ -67,6 +67,7 @@ _Base URL: `http://localhost:8080` (default; override via `ppm config set port <
|
|
|
67
67
|
- `GET /api/codex-accounts/usage`
|
|
68
68
|
- `POST /api/codex-accounts/pick`
|
|
69
69
|
- `PATCH /api/codex-accounts/:id`
|
|
70
|
+
- `POST /api/codex-accounts/:id/reset-credit`
|
|
70
71
|
- `PUT /api/codex-accounts/strategy`
|
|
71
72
|
- `POST /api/codex-accounts/api-key`
|
|
72
73
|
- `POST /api/codex-accounts/device-login`
|
|
@@ -359,4 +360,4 @@ _Base URL: `http://localhost:8080` (default; override via `ppm config set port <
|
|
|
359
360
|
- `ws://<host>/ws/terminal` — PTY terminal multiplexer
|
|
360
361
|
- `ws://<host>/ws/extensions` — extension host channel
|
|
361
362
|
|
|
362
|
-
<!-- Generated from src/server/routes/ for PPM v0.23.
|
|
363
|
+
<!-- Generated from src/server/routes/ for PPM v0.23.6 -->
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Jr as r,Lr as i,Mr as a,St as o,V as s,Zn as c,Zt as l,fn as u,fr as d,nt as f,st as p,un as m}from"./icons-CO_II6D-.js";import{r as h}from"./api-client-c8YOpTlT.js";import{n as g}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./chat-preparation-cache-BSIQGiWx.js";import{n as _}from"./use-is-mobile-BClDZJP5.js";import{n as v,t as y}from"./button-Ci9EUgqd.js";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./dialog-B8clVkyi.js";import{t as E}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as D}from"./input-CG8PS8mS.js";import{$n as O,Qn as k,Rn as A,Sn as j,Zn as M,bt as N,ct as P,dt as F,ft as I,lt as L,st as ee,ut as te}from"./index-C8nGqkKN.js";import{_ as ne,a as re,h as ie,m as ae,o as oe,p as se,r as ce,v as le,x as R,y as ue}from"./api-settings-BmvNoCbn.js";import{_ as de,a as fe,b as pe,c as me,d as he,g as z,h as B,l as ge,m as _e,n as ve,o as ye,p as V,r as be,s as H,t as xe,u as Se,x as U,y as W}from"./codex-reset-credit-button-CbmE5mRX.js";var G=e(t(),1),K=n(),q=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],J=Array.from({length:24},(e,t)=>t);function Ce(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function we(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function Te(e){return J.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function Y(e){return e===0?`bg-surface-elevated`:e<.3?`bg-success/30`:e<.5?`bg-success/60`:e<.7?`bg-warning/50`:e<.9?`bg-warning/80`:`bg-error/80`}function Ee(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function De({accountId:e}){let[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(!0),[a,o]=(0,G.useState)(`5h`);(0,G.useEffect)(()=>{i(!0),se(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,G.useMemo)(()=>t?Ce(t,a):null,[t,a]),c=(0,G.useMemo)(()=>s?we(s):[],[s]),l=(0,G.useMemo)(()=>s?Te(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,K.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,K.jsx)(m,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,K.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let d=t.length,f=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,K.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,K.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,K.jsx)(`button`,{onClick:()=>o(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,K.jsx)(`button`,{onClick:()=>o(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,K.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,f,`d (`,d,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,K.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:q.map((e,t)=>{let n=c[t]??0;return(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,K.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,K.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Ee(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,K.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,K.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:J.map(e=>{let t=l[e]??0;return(0,K.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,K.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${Y(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[q.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),J.map(n=>{let r=s[t][n];return(0,K.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${Y(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,K.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,K.jsx)(`span`,{className:`w-4 shrink-0`}),J.map(e=>(0,K.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,K.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,K.jsx)(`span`,{children:`Low`}),(0,K.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,K.jsx)(`span`,{children:`High`}),(0,K.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,K.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,K.jsx)(`span`,{children:`No data`})]})]})}function Oe({profile:e,accountId:t,onClose:n}){let i=[[`Name`,e.account?.display_name],[`Email`,e.account?.email],[`Org`,e.organization?.name],[`Type`,e.organization?.organization_type],[`Tier`,e.organization?.rate_limit_tier],[`Status`,e.organization?.subscription_status]];return(0,K.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,K.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,K.jsx)(r,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:i.map(([e,t])=>t?(0,K.jsxs)(`span`,{className:`contents`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,K.jsx)(De,{accountId:t})]})}function ke({display:e,onConfirm:t,onCancel:n}){let r=_(),i=(0,K.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,K.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,K.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,K.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`The stored token is deleted from this machine. Any export you already made keeps working.`}),(0,K.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,K.jsx)(y,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,K.jsx)(y,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,K.jsx)(E,{open:!0,onClose:n,children:(0,K.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,K.jsx)(T,{open:!0,onOpenChange:e=>{e||n()},children:(0,K.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,K.jsx)(b,{children:(0,K.jsx)(C,{className:`text-sm`,children:`Remove account`})}),i]})})}function Ae(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function je({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:i}){let a=n.filter(e=>e.hasRefreshToken),[o,s]=(0,G.useState)(new Set),[c,l]=(0,G.useState)(``),[d,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(!1),[E,O]=(0,G.useState)(!1),[k,A]=(0,G.useState)(!1);e&&!k&&(s(r?new Set([r]):new Set(a.map(e=>e.id))),A(!0)),!e&&k&&A(!1);function M(){t(!1),l(``),g(!1),v(!1)}async function P(e){if(o.size===0)return;O(!0);let t=c.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=h();r&&(n.Authorization=`Bearer ${r}`);let a=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...o],includeRefreshToken:d,refreshBeforeExport:_})});if(!a.ok){let e=await a.json();throw Error(e.error??`Export failed: ${a.status}`)}let s=await a.text();e&&await j(s)?i?.(`Backup copied to clipboard!`):(Ae(s),i?.(`Backup downloaded.`)),M()}catch{}O(!1)}let F=o.size>0&&!E;return(0,K.jsx)(T,{open:e,onOpenChange:e=>{e||M()},children:(0,K.jsxs)(S,{className:`sm:max-w-md`,children:[(0,K.jsxs)(b,{children:[(0,K.jsxs)(C,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(u,{className:`size-3.5`}),` Export Accounts`]}),(0,K.jsx)(w,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,K.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,K.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>s(o.size===a.length?new Set:new Set(a.map(e=>e.id))),children:o.size===a.length?`Deselect all`:`Select all`})]}),a.length===0?(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,K.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:a.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:o.has(e.id),onChange:t=>{let n=new Set(o);t.target.checked?n.add(e.id):n.delete(e.id),s(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,K.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(N,{className:`text-xs`,children:[`Password `,(0,K.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,K.jsx)(D,{type:`password`,placeholder:`Leave empty for default`,value:c,onChange:e=>l(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:d,onChange:e=>g(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,K.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:_,onChange:e=>v(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,K.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),d?(0,K.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):_?(0,K.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,K.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,K.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,K.jsxs)(x,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:M,children:`Cancel`}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!0),children:[(0,K.jsx)(f,{className:`size-3 mr-1`}),` Copy`]}),(0,K.jsx)(y,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!F,onClick:()=>P(!1),children:E?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(p,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Me({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(!1),[l,d]=(0,G.useState)(null);function f(){t(!1),i(``),o(``),d(null)}async function p(){if(r.trim()){c(!0),d(null);try{let e=await ae({data:r.trim(),password:a.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}c(!1)}}return(0,K.jsx)(T,{open:e,onOpenChange:e=>{e||f()},children:(0,K.jsxs)(S,{className:`sm:max-w-md`,children:[(0,K.jsxs)(b,{children:[(0,K.jsxs)(C,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(u,{className:`size-3.5`}),` Import Accounts`]}),(0,K.jsx)(w,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(N,{className:`text-xs`,children:`Backup data`}),(0,K.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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(N,{className:`text-xs`,children:[`Password `,(0,K.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,K.jsx)(D,{type:`password`,placeholder:`Leave empty for default`,value:a,onChange:e=>o(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),l&&(0,K.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,K.jsxs)(x,{children:[(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,K.jsx)(y,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||s,onClick:p,children:s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var X=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Ne(e){return X?.addEventListener(`change`,e),()=>X?.removeEventListener(`change`,e)}function Pe(){return X?.matches??!0}function Z(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{r(!0),oe().then(t).finally(()=>r(!1))},[]),n?(0,K.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,K.jsxs)(ee,{value:e.strategy,onValueChange:async e=>{t(await R({strategy:e}))},children:[(0,K.jsx)(te,{className:`w-full h-9 text-xs`,children:(0,K.jsx)(F,{})}),(0,K.jsxs)(P,{children:[(0,K.jsx)(L,{value:`round-robin`,children:`Round-robin`}),(0,K.jsx)(L,{value:`fill-first`,children:`Fill-first`}),(0,K.jsx)(L,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,K.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,K.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await R({maxRetry:n}))}}),(0,K.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,K.jsx)(I,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await R({cooldownEnabled:e}))}})]}),(0,K.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Park a failing account (rate limit / usage limit / auth error) until it recovers. Off: accounts stay selectable — rotation still skips accounts already ≥95% on the 5-hour limit.`})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,K.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,K.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,K.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function Fe({open:e,onOpenChange:t}){let n=(0,G.useSyncExternalStore)(Ne,Pe);return e?n?(0,K.jsx)(T,{open:e,onOpenChange:t,children:(0,K.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,K.jsx)(b,{children:(0,K.jsxs)(C,{className:`text-sm flex items-center gap-2`,children:[(0,K.jsx)(d,{className:`size-4`}),` Rotation & Retry`]})}),(0,K.jsx)(Z,{})]})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,K.jsxs)(`div`,{className:g(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,K.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,K.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,K.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,K.jsx)(d,{className:`size-4`}),` Rotation & Retry`]}),(0,K.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,K.jsx)(r,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,K.jsx)(Z,{})})]})]}):null}var Ie=v(`inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground shadow`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground shadow`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function Q({className:e,variant:t,...n}){return(0,K.jsx)(`div`,{className:g(Ie({variant:t}),e),...n})}function Le(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function Re({accounts:e}){let[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(new Map),l=e.filter(e=>e.hasRefreshToken);async function u(){if(l.length!==0){i(!0);try{let e=await le(l.map(e=>e.id),a);n(t=>[...t,{round:t.length+1,time:new Date().toLocaleTimeString(),includeRefresh:a,items:e}])}catch{}i(!1)}}async function d(e,t){c(t=>new Map(t).set(e,{loading:!0}));try{let n=await ue(t);c(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){c(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function f(e,t){return[{key:`r${e.round}-pre-${t.id}`,label:`Pre-export`,token:t.preExportTokenFull,preview:t.preExportToken,expires:t.preExportExpires},{key:`r${e.round}-exp-${t.id}`,label:`Exported`,token:t.exportedTokenFull,preview:t.exportedToken,expires:t.exportedExpires},{key:`r${e.round}-post-${t.id}`,label:`Post-export`,token:t.postExportTokenFull,preview:t.postExportToken,expires:t.postExportExpires}]}function p(){for(let e of t)for(let t of e.items)for(let n of f(e,t))n.token&&d(n.key,n.token)}return(0,K.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,K.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every run appends a round. Earlier rounds are kept so tokens can be compared across runs.`}),l.length===0?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(I,{id:`sim-include-refresh`,checked:a,onCheckedChange:o,className:`cursor-pointer`}),(0,K.jsx)(N,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,K.jsx)(y,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void u(),children:r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(m,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:p,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,K.jsx)(Q,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,K.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,K.jsx)(Q,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),f(e,t).map(e=>{let t=s.get(e.key);return(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,K.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Le(e.expires)}),e.token?(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void d(e.key,e.token),children:t?.loading?(0,K.jsx)(m,{className:`size-3 animate-spin`}):`Test`}):(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,K.jsx)(`span`,{className:`text-[10px] font-medium shrink-0 ${t.status?.startsWith(`valid`)?`text-success`:`text-error`}`,children:t.status})]},e.key)})]},`r${e.round}-${t.id}`))]},e.round))]})]})}function ze(e){let t=Math.floor(Date.now()/1e3),n=Math.floor(Math.abs(e-t)/60);return e>t?`${n}m left`:`expired ${n}m ago`}function Be({open:e,onOpenChange:t,accounts:n}){let[r,i]=(0,G.useState)(new Map),[a,s]=(0,G.useState)(!1);async function c(e){i(t=>new Map(t).set(e,{loading:!0}));try{let t=await ne(e,a);i(n=>new Map(n).set(e,{loading:!1,result:t}))}catch(t){i(n=>new Map(n).set(e,{loading:!1,error:t.message}))}}function l(){for(let e of n.filter(e=>e.expiresAt!==null))c(e.id)}return(0,K.jsx)(T,{open:e,onOpenChange:t,children:(0,K.jsxs)(S,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,K.jsxs)(b,{children:[(0,K.jsxs)(C,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(o,{className:`size-4`}),` Token Test`]}),(0,K.jsx)(w,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,K.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(I,{id:`token-test-refresh`,checked:a,onCheckedChange:s,className:`cursor-pointer`}),(0,K.jsx)(N,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:l,children:`Test all`})]})]}),n.length===0&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,K.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=r.get(e.id),n=t?.result?.accessToken.status;return(0,K.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ze(e.expiresAt)})]}),(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void c(e.id),children:t?.loading?(0,K.jsx)(m,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,K.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,K.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,K.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,K.jsx)(Re,{accounts:n})]}),(0,K.jsx)(x,{children:(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function Ve(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:r,refreshing:a,flashIds:s,reload:u}=ge(),[f,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,b]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[T,E]=(0,G.useState)(null),[D,O]=(0,G.useState)(void 0);function k(e){u(),e&&h(e)}async function A(e,t){_(e);try{await ie(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){h(e.message)}_(null),u()}async function j(){if(v){try{await ce(v.id),h(`Account "${v.display}" removed.`),u()}catch(e){h(`Failed to remove: ${e.message}`)}b(null)}}let M=new Map(t.map(e=>[e.id,e])),N=e[0]?.usage.lastFetchedAt;return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(B,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void u(),refreshing:a,disabled:r,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(y,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{O(void 0),E(`add`)},children:[(0,K.jsx)(c,{className:`size-4`}),` Add account`]}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{w(null),E(`export`)},children:[(0,K.jsx)(p,{className:`size-4`}),` Export`]}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`import`),children:[(0,K.jsx)(i,{className:`size-4`}),` Import`]}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`rotation`),children:[(0,K.jsx)(d,{className:`size-4`}),` Rotation`]}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>E(`token-test`),children:[(0,K.jsx)(o,{className:`size-4`}),` Token test`]})]})}),(0,K.jsx)(z,{message:f,onDismiss:()=>h(null)}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),N&&(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,pe(new Date(N).getTime())]})]}),r?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,K.jsx)(l,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,K.jsx)(V,{children:e.map(e=>(0,K.jsx)(Se,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:M.get(e.accountId),onToggle:A,toggling:g===e.accountId,onDelete:(e,t)=>b({id:e,display:t}),onExport:e=>{w(e),E(`export`)},onViewProfile:(e,t)=>S({profile:e,accountId:t}),onReauth:()=>{O(e.accountLabel??e.accountId.slice(0,8)),E(`add`)},flash:s.has(e.accountId)},e.accountId))})]}),x&&(0,K.jsx)(Oe,{profile:x.profile,accountId:x.accountId,onClose:()=>S(null)}),v&&(0,K.jsx)(ke,{display:v.display,onConfirm:()=>void j(),onCancel:()=>b(null)}),(0,K.jsx)(me,{open:T===`add`,onOpenChange:e=>{E(e?`add`:null),e||O(void 0)},onSuccess:k,signInAgainFor:D}),(0,K.jsx)(je,{open:T===`export`,onOpenChange:e=>{E(e?`export`:null),e||w(null)},accounts:t,preselectId:C,onMessage:h}),(0,K.jsx)(Me,{open:T===`import`,onOpenChange:e=>E(e?`import`:null),onSuccess:k}),(0,K.jsx)(Fe,{open:T===`rotation`,onOpenChange:e=>E(e?`rotation`:null)}),(0,K.jsx)(Be,{open:T===`token-test`,onOpenChange:e=>E(e?`token-test`:null),accounts:t})]})}function He({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:a,onExport:o,onImport:s,error:c}){let l=(0,G.useRef)(null),d=e===`export`;return(0,K.jsx)(T,{open:e!==null,onOpenChange:t,children:(0,K.jsxs)(S,{className:`sm:max-w-md`,children:[(0,K.jsxs)(b,{children:[(0,K.jsxs)(C,{className:`text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(u,{className:`size-4`}),` `,d?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,K.jsx)(w,{className:`text-xs leading-relaxed`,children:d?`Writes a password-encrypted file containing each account's login.`:`Reads a backup file. The password must be the one it was exported with.`})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(N,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,K.jsx)(D,{id:`codex-backup-password`,type:`password`,placeholder:d?`Choose a password`:`Password used for the export`,value:n,onChange:e=>r(e.target.value),className:`text-xs`,autoComplete:d?`new-password`:`current-password`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),c&&(0,K.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:c}),(0,K.jsx)(`input`,{ref:l,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,K.jsxs)(x,{children:[(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,K.jsxs)(y,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||a,onClick:()=>d?o():l.current?.click(),children:[a?(0,K.jsx)(m,{className:`size-3.5 animate-spin`}):d?(0,K.jsx)(p,{className:`size-3.5`}):(0,K.jsx)(i,{className:`size-3.5`}),d?`Download backup`:`Choose file`]})]})]})})}var Ue=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function We({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,K.jsx)(T,{open:e,onOpenChange:t,children:(0,K.jsxs)(S,{className:`sm:max-w-md`,children:[(0,K.jsxs)(b,{children:[(0,K.jsx)(C,{className:`text-sm`,children:`Codex Rotation`}),(0,K.jsx)(w,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:Ue.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:g(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,K.jsx)(x,{children:(0,K.jsx)(y,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function $(e){return e==null?null:Math.round(e*100)}function Ge({usage:e}){let t=e.session==null&&e.weekly==null;return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,K.jsx)(W,{label:`5-Hour Session`,pct:$(e.fiveHour),reset:U(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,K.jsx)(W,{label:`Weekly`,pct:$(e.sevenDay),reset:U(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function Ke(){let[e,t]=(0,G.useState)(null),n=fe(()=>t(null)),[r,o]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(B,{description:(0,K.jsxs)(K.Fragment,{children:[`Each Codex account keeps its own login (`,(0,K.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(y,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,K.jsx)(c,{className:`size-4`}),` Add account`]}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,K.jsx)(p,{className:`size-4`}),` Export`]}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,K.jsx)(i,{className:`size-4`}),` Import`]}),(0,K.jsxs)(y,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,K.jsx)(d,{className:`size-4`}),` Rotation`]})]})}),(0,K.jsx)(z,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,K.jsx)(l,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,K.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,K.jsx)(V,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,K.jsxs)(_e,{dense:!0,className:`min-w-[300px] shrink-0 snap-start${e.signedOut?` opacity-60`:``}`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,K.jsx)(de,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`Codex rejected this account's login (revoked or expired), so no turn can run on it and it is skipped. The usage shown is the last reading. Click to sign in again — the account keeps its settings and chats.`,onClick:e.type===`chatgpt`?()=>o(e):void 0,children:`Sign in again`}),(0,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),H(e.planType)&&(0,K.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:H(e.planType)}),(0,K.jsx)(I,{checked:e.status!==`disabled`,onCheckedChange:()=>void n.toggle(e.id,e.status??`active`),disabled:n.toggling.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),(0,K.jsxs)(M,{children:[(0,K.jsx)(O,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,onClick:()=>void n.remove(e.id),"aria-label":`Remove account`,className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,K.jsx)(a,{className:`size-4`})})}),(0,K.jsx)(k,{side:`top`,children:`Remove account`})]})]}),(0,K.jsx)(Ge,{usage:t}),t.resetCredits&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,K.jsx)(he,{credits:t.resetCredits}),(0,K.jsx)(xe,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=ye(t.weekly);return r?(0,K.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${e.dailyGuardEnabled&&r.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,K.jsx)(`span`,{children:`Daily guard`}),(0,K.jsxs)(M,{children:[(0,K.jsx)(O,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,K.jsx)(s,{className:`size-3.5`})})}),(0,K.jsx)(k,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays. Turn it off any time to use the remaining quota freely.`})]})]}),(0,K.jsx)(`p`,{className:`text-[10px] tabular-nums ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-subtle`}`,children:e.dailyGuardEnabled&&r.blocked?`${Math.round(r.used*100)}% used / ${Math.round(r.cap*100)}% daily cap. New turns paused.`:`Weekday ${r.day}/5, ${Math.round(r.cap*100)}% daily cap`})]}),(0,K.jsxs)(`span`,{className:`hidden`,title:`Weekday ${r.day}/5: hold weekly usage at or below ${Math.round(r.cap*100)}% to last until reset.`,children:[`Daily guard `,e.dailyGuardEnabled?`· Weekday ${r.day}/5 cap ${Math.round(r.cap*100)}%`:``]}),(0,K.jsx)(I,{checked:!!e.dailyGuardEnabled,onCheckedChange:()=>void n.toggleDailyGuard(e.id,!!e.dailyGuardEnabled),disabled:n.toggling.has(e.id),"aria-label":e.dailyGuardEnabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}):null})()]},e.id)})})]}),(0,K.jsx)(be,{open:e===`add`,onOpenChange:e=>{e||n.cancelLogin(),t(e?`add`:null)},label:n.label,onLabelChange:n.setLabel,apiKey:n.apiKey,onApiKeyChange:n.setApiKey,adding:n.adding,onAddApiKey:()=>void n.addApiKey(),deviceWaiting:n.deviceWaiting,onStartDevice:()=>void n.startDevice(),device:n.device,browser:n.browser,onStartBrowser:()=>void n.startBrowser(),loginStarting:n.loginStarting,callbackUrl:n.callbackUrl,onCallbackUrlChange:n.setCallbackUrl,submittingCallback:n.submittingCallback,onSubmitCallback:()=>void n.submitCallback(),error:n.err}),(0,K.jsx)(He,{mode:e===`export`?`export`:e===`import`?`import`:null,onOpenChange:e=>{e||t(null)},password:n.backupPassword,onPasswordChange:n.setBackupPassword,busy:n.exporting||n.importing,onExport:()=>void n.doExport(),onImport:e=>void n.doImport(e),error:n.err}),r&&(0,K.jsx)(ve,{account:r,onClose:()=>o(null),onDone:()=>void n.load()}),(0,K.jsx)(We,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var qe=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}];function Je(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(`claude`);(0,G.useEffect)(()=>{let e=!1;return re().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let i=qe.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,K.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,K.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,K.jsxs)(`button`,{onClick:()=>r(e.id),"data-testid":`accounts-tab-${e.id}`,"aria-current":n===e.id?`page`:void 0,className:`flex items-center gap-1.5 px-3 py-2 text-xs rounded-t transition-colors cursor-pointer ${n===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,K.jsx)(A,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(m,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,K.jsx)(Ve,{}):(0,K.jsx)(Ke,{})]})}export{Je as AccountsSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Fr as r,fn as i,r as a,sr as o,un as s}from"./icons-CO_II6D-.js";import{s as c}from"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import{n as l}from"./utils-btZ8C8-R.js";import{C as u,S as d,at as f,it as p,nt as m,ot as h,rt as g}from"./index-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Fr as r,fn as i,r as a,sr as o,un as s}from"./icons-CO_II6D-.js";import{s as c}from"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import{n as l}from"./utils-btZ8C8-R.js";import{C as u,S as d,at as f,it as p,nt as m,ot as h,rt as g}from"./index-C8nGqkKN.js";import{t as _}from"./use-monaco-theme-C88KphGx.js";var v=e(t(),1),y=n();function b({metadata:e}){let t=e?.filePath,n=e?.name,l=e?.resourceType??`skill`,b=e?.scope??`user`,S=e?.readOnly===!0,C=e?.shadowed===!0,w=e?.shadowedBy,T=e?.project??``,[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!0),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(!1),I=_(),L=(0,v.useRef)(``),R=E!==O;(0,v.useEffect)(()=>{let e=!1;return j(!0),N(null),f(t,T).then(t=>{e||(D(t.content),k(t.content),L.current=t.content)}).catch(t=>{e||N(t.message)}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,T]);let z=(0,v.useCallback)(async()=>{if(S||P)return;let e=L.current;if(e!==O){F(!0);try{await h(t,e,T),k(e),D(e),c.success(`Saved`),p.getState().reload()}catch(e){c.error(e.message)}finally{F(!1)}}},[t,T,O,S,P]);(0,v.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[z]);let B=g[l];return(0,y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,y.jsx)(B,{className:`size-4 text-text-subtle`}),(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:n}),(0,y.jsx)(m,{scope:b}),R&&!S&&(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary`,title:`Unsaved changes`}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsxs)(`span`,{className:`hidden sm:block text-[11px] text-text-subtle`,children:[l,` · markdown`]}),!S&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`button`,{onClick:()=>D(O),disabled:!R||P,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-text-secondary hover:bg-surface-elevated disabled:opacity-40`,children:[(0,y.jsx)(r,{className:`size-3.5`}),` Revert`]}),(0,y.jsxs)(`button`,{onClick:()=>void z(),disabled:!R||P,className:`flex items-center gap-1 rounded bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,children:[P?(0,y.jsx)(s,{className:`size-3.5 animate-spin`}):(0,y.jsx)(o,{className:`size-3.5`}),` Save`]})]})]}),S&&(0,y.jsx)(x,{icon:i,tone:`muted`,children:`Bundled resource — read-only. Duplicate it (from the AI Resources panel) to make an editable copy.`}),C&&w&&(0,y.jsxs)(x,{icon:a,tone:`warn`,children:[`This `,l,` is overridden by another “`,w.name,`” from a higher-priority source (`,w.source,`). It is currently inactive.`]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1`,children:A?(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,y.jsx)(s,{className:`size-5 animate-spin text-primary`})}):M?(0,y.jsx)(`div`,{className:`p-6 text-center text-sm text-destructive`,children:M}):(0,y.jsx)(u,{beforeMount:d,height:`100%`,language:`markdown`,theme:I,value:E,onChange:e=>{let t=e??``;L.current=t,D(t)},options:{readOnly:S,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,lineNumbers:`on`}})})]})}function x({icon:e,tone:t,children:n}){return(0,y.jsxs)(`div`,{className:l(`flex items-start gap-2 px-3 py-2 text-[12px] shrink-0 border-b border-border`,t===`warn`?`bg-amber-500/10 text-amber-300`:`bg-surface-elevated text-text-secondary`),children:[(0,y.jsx)(e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,y.jsx)(`span`,{children:n})]})}export{b as AiResourceEditor};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{Mr as r,ct as i,ir as a}from"./icons-CO_II6D-.js";import{n as o}from"./api-client-c8YOpTlT.js";import{t as s}from"./input-CG8PS8mS.js";import{On as c,Rn as l,bt as u,ct as d,dt as f,et as p,ft as m,lt as h,st as g,ut as _}from"./index-jG9mLs-J.js";import{a as v,b as y}from"./api-settings-BmvNoCbn.js";var b=e(t(),1),x=n(),S=[128e3,272e3,4e5,512e3,872e3,1e6],C=[1e5,2e5,23e4,35e4,45e4,75e4,9e5];function w({id:e,label:t,value:n,presets:r,disabled:i,compact:a,onChange:o}){let[c,l]=(0,b.useState)(!!n&&!r.includes(Number(n))),d=a?`text-[11px]`:`text-sm`;return(0,x.jsxs)(`div`,{className:`space-y-1`,children:[(0,x.jsx)(u,{htmlFor:e,className:d,children:t}),(0,x.jsxs)(`select`,{id:e,value:c?`custom`:n||`default`,disabled:i,"aria-describedby":`codex-context-help`,className:`w-full min-h-11 sm:min-h-0 rounded-md border border-input bg-background px-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 ${a?`h-7`:`h-9`} ${d}`,onChange:e=>{let t=e.target.value;l(t===`custom`),t!==`custom`&&o(t===`default`?``:t)},children:[(0,x.jsx)(`option`,{value:`default`,children:`Codex default`}),r.map(e=>(0,x.jsxs)(`option`,{value:String(e),children:[e===1e6?`1M`:`${e/1e3}K`,` tokens`]},e)),(0,x.jsx)(`option`,{value:`custom`,children:`Custom...`})]}),c&&(0,x.jsx)(s,{id:`${e}-custom`,"aria-label":`Custom ${t.toLowerCase()}`,type:`number`,min:1,step:1,required:!0,value:n,disabled:i,placeholder:`Enter tokens`,"aria-describedby":`codex-context-help`,className:`min-h-11 sm:min-h-0 ${a?`h-7 text-[11px]`:``}`,onChange:e=>o(e.target.value)})]})}function T({config:e,compact:t,saving:n,onSave:r}){let[i,a]=(0,b.useState)(String(e?.model_context_window??``)),[o,s]=(0,b.useState)(String(e?.model_auto_compact_token_limit??``)),[c,l]=(0,b.useState)(null),u=t?`text-[11px]`:`text-sm`,d=t?`text-[9px]`:`text-[11px]`;async function f(e){e.preventDefault();let t=i.trim()?Number(i):null,n=o.trim()?Number(o):null;if([t,n].some(e=>e!==null&&(!Number.isSafeInteger(e)||e<=0))){l(`Enter positive whole numbers of tokens, or leave blank for Codex defaults.`);return}if(t!==null&&n!==null&&n>t){l(`Auto-compact threshold must not exceed the context window.`);return}l(null),await r({model_context_window:t,model_auto_compact_token_limit:n})}return(0,x.jsxs)(`form`,{onSubmit:f,className:`space-y-2 rounded-md border border-border p-3`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,x.jsx)(w,{id:`codex-context-window`,label:`Context window (tokens)`,value:i,presets:S,disabled:n,compact:t,onChange:e=>{a(e),l(null)}}),(0,x.jsx)(w,{id:`codex-compact-threshold`,label:`Auto-compact threshold (tokens)`,value:o,presets:C,disabled:n,compact:t,onChange:e=>{s(e),l(null)}})]}),(0,x.jsx)(`p`,{id:`codex-context-help`,className:`${d} text-muted-foreground`,children:`Choose Codex default to use Codex configuration and model defaults, or Custom to enter a value. Presets are shortcuts, not a list of limits supported by your model; increasing these values does not unlock a larger context window. Applies to new sessions and sessions resumed after a PPM restart.`}),c&&(0,x.jsx)(`p`,{role:`alert`,className:`${u} text-error`,children:c}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(`a`,{href:`https://learn.chatgpt.com/docs/config-file/config-reference`,target:`_blank`,rel:`noreferrer`,className:`${d} text-primary underline`,children:`Codex context documentation`}),(0,x.jsx)(`button`,{type:`submit`,disabled:n,className:`min-h-11 sm:min-h-0 rounded-md border border-border px-3 py-1.5 hover:bg-surface-elevated disabled:opacity-50 ${u}`,children:n?`Saving...`:`Save context settings`})]})]})}var E=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`xhigh`,label:`Extra`},{value:`max`,label:`Max`}],D=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],O={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function k({compact:e}={}){let[t,n]=(0,b.useState)(null),[r,a]=(0,b.useState)(``),[S,C]=(0,b.useState)([]),[w,k]=(0,b.useState)(!1),[j,M]=(0,b.useState)(!1),[N,P]=(0,b.useState)(null),[F,I]=(0,b.useState)(0);(0,b.useEffect)(()=>{v().then(e=>{n(e),a(e.default_provider??`claude`)}).catch(e=>P(e.message))},[]),(0,b.useEffect)(()=>{r&&(k(!0),o.get(`/api/settings/ai/providers/${r}/models`).then(C).catch(()=>C([])).finally(()=>k(!1)))},[r]);let L=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:O[e]??e})):[],R=t?.providers[r],z=R?.type===`agent-sdk`||!R?.type&&r===`claude`,B=async e=>{if(!t)return!1;M(!0),P(null);try{return n(await y(e)),I(e=>e+1),!0}catch(e){return P(e.message),!1}finally{M(!1)}},V=(e,t)=>B({providers:{[r]:{[e]:t}}}),H=e?`text-[11px]`:`text-sm`,U=e?`text-xs`:`text-sm`,W=e?`space-y-2`:`space-y-4`,G=e?`space-y-1.5`:`space-y-3`,K=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,x.jsxs)(`div`,{className:G,children:[(0,x.jsx)(`h3`,{className:`${U} font-medium text-text-secondary`,children:`AI Settings`}),(0,x.jsx)(`p`,{className:`${H} text-text-subtle`,children:N?`Error: ${N}`:`Loading...`})]});let q=z?S:[{value:`__default__`,label:`Auto (default)`},...S];return(0,x.jsxs)(`div`,{className:W,children:[(0,x.jsx)(`h3`,{className:`${U} font-medium text-text-secondary`,children:`AI Settings`}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-new-chat-provider`,className:e?H:void 0,children:`New chat provider`}),(0,x.jsxs)(g,{value:t.new_chat_provider_mode??`default`,disabled:j,onValueChange:e=>B({new_chat_provider_mode:e}),children:[(0,x.jsx)(_,{id:`ai-new-chat-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsxs)(d,{children:[(0,x.jsx)(h,{value:`follow-focus`,children:`Follow last focused chat`}),(0,x.jsx)(h,{value:`default`,children:`Always use default provider`})]})]}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:t.new_chat_provider_mode===`follow-focus`?`New tabs follow the last chat you focused in this project, across panels. Existing tabs keep their provider.`:`New tabs always use the default provider. Existing tabs keep their provider.`})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-default-provider`,className:e?H:void 0,children:`Default provider`}),(0,x.jsxs)(g,{value:t.default_provider,disabled:j,onValueChange:e=>B({default_provider:e}),children:[(0,x.jsx)(_,{id:`ai-default-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsx)(d,{children:L.map(e=>(0,x.jsx)(h,{value:e.id,children:e.name},e.id))})]}),t.new_chat_provider_mode===`follow-focus`&&(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Used when no chat has been focused in this project yet.`})]}),(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border p-3`,children:[(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-share-provider-context`,className:e?H:void 0,children:`Share rules and memory between providers`}),(0,x.jsx)(`p`,{id:`ai-share-provider-context-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Share project rules and memory, plus global instruction files, across providers. Applies from the next project-chat message. Turning off keeps context already sent.`})]}),(0,x.jsx)(m,{id:`ai-share-provider-context`,"aria-describedby":`ai-share-provider-context-description`,checked:t.share_provider_context??!0,disabled:j,onCheckedChange:e=>B({share_provider_context:e})})]}),L.length>1&&(0,x.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:L.map(e=>(0,x.jsxs)(`button`,{onClick:()=>a(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,x.jsx)(l,{providerId:e.id}),(0,x.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,x.jsxs)(`div`,{className:G,children:[r===`codex`&&(0,x.jsxs)(`button`,{type:`button`,onClick:()=>c(`accounts`),className:`w-full flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-2 text-left cursor-pointer hover:bg-surface-elevated transition-colors`,children:[(0,x.jsx)(`span`,{className:`${H} text-text-secondary`,children:`Codex accounts & login`}),(0,x.jsx)(i,{className:`size-3.5 text-text-subtle shrink-0`})]}),S.length>0&&(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-model`,className:e?H:void 0,children:`Model`}),(0,x.jsxs)(g,{value:z?R?.model??S[0]?.value:R?.model||`__default__`,onValueChange:e=>V(`model`,e===`__default__`?void 0:e),disabled:w,children:[(0,x.jsx)(_,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{placeholder:w?`Loading models...`:`Select model`})}),(0,x.jsx)(d,{className:`max-h-[300px]`,children:q.map(e=>(0,x.jsx)(h,{value:e.value,children:e.label},e.value))})]})]}),r===`codex`&&(0,x.jsx)(T,{config:R,compact:e,saving:j,onSave:e=>B({providers:{codex:e}})},JSON.stringify([R?.model_context_window,R?.model_auto_compact_token_limit])),z&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-base-url`,className:e?H:void 0,children:`Base URL`}),(0,x.jsx)(s,{id:`ai-base-url`,type:`url`,defaultValue:R?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{V(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-api-key`,className:e?H:void 0,children:`API Key / Token`}),(0,x.jsx)(s,{id:`ai-api-key`,type:`password`,defaultValue:R?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||V(`api_key`,t||void 0)}},`apikey-${r}-${F}`),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-effort`,className:e?H:void 0,children:`Effort`}),(0,x.jsxs)(g,{value:R?.effort??`high`,onValueChange:e=>V(`effort`,e),children:[(0,x.jsx)(_,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsx)(d,{children:E.map(e=>(0,x.jsx)(h,{value:e.value,children:e.label},e.value))})]})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-max-turns`,className:e?H:void 0,children:`Max Turns (1-500)`}),(0,x.jsx)(s,{id:`ai-max-turns`,type:`number`,min:1,max:500,defaultValue:R?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);isNaN(t)||V(`max_turns`,t)}},`turns-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-budget`,className:e?H:void 0,children:`Max Budget (USD)`}),(0,x.jsx)(s,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:R?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);V(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-thinking`,className:e?H:void 0,children:`Thinking Budget (tokens)`}),(0,x.jsx)(s,{id:`ai-thinking`,type:`number`,min:0,defaultValue:R?.thinking_budget_tokens??``,placeholder:`Adaptive (model decides)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);V(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(u,{htmlFor:`ai-agent-teams`,className:e?H:void 0,children:`Agent Teams`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,x.jsx)(m,{id:`ai-agent-teams`,checked:R?.agent_teams??!1,onCheckedChange:e=>V(`agent_teams`,e)})]}),R?.agent_teams&&(0,x.jsx)(A,{compact:e}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(u,{htmlFor:`ai-context-1m`,className:e?H:void 0,children:`1M Context Window`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Requires an entitled account (Max/Team/Enterprise) and an Opus 4 / Sonnet 4 model. Other accounts will error.`})]}),(0,x.jsx)(m,{id:`ai-context-1m`,checked:R?.context_1m??!1,onCheckedChange:e=>V(`context_1m`,e)})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(u,{htmlFor:`ai-inherit-mcp`,className:e?H:void 0,children:`Inherit Claude Code MCP`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Auto-load MCP servers from Claude Code's ~/.claude.json (global + per-project). Your own MCP servers override inherited ones.`})]}),(0,x.jsx)(m,{id:`ai-inherit-mcp`,checked:R?.inherit_claude_mcp??!0,onCheckedChange:e=>V(`inherit_claude_mcp`,e)})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{className:e?H:void 0,children:`MCP sign-in`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Servers that use OAuth stay unavailable to Claude until someone signs in. Project-scoped servers are listed in the project's AI Resources panel.`}),(0,x.jsx)(`div`,{className:`-mx-2`,children:(0,x.jsx)(p,{showWhenEmpty:!0})})]})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-permission-mode`,className:e?H:void 0,children:`Default Permission Mode`}),(0,x.jsxs)(g,{value:R?.permission_mode??`bypassPermissions`,onValueChange:e=>V(`permission_mode`,e),children:[(0,x.jsx)(_,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsx)(d,{children:D.map(e=>(0,x.jsx)(h,{value:e.value,children:e.label},e.value))})]})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-system-prompt`,className:e?H:void 0,children:`Additional Instructions`}),(0,x.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:R?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{V(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${F}`)]})]}),j&&(0,x.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),N&&(0,x.jsx)(`p`,{className:`text-xs text-error`,children:N})]})}function A({compact:e}){let[t,n]=(0,b.useState)([]),[i,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),d=(0,b.useCallback)(async()=>{s(!0);try{n(await o.get(`/api/teams`)??[])}catch{}s(!1)},[]);(0,b.useEffect)(()=>{d()},[d]);let f=async e=>{try{await o.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),l(null)}catch{}};return t.length===0&&!i?null:(0,x.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(u,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,x.jsx)(`button`,{onClick:d,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,x.jsx)(a,{className:`size-3 ${i?`animate-spin`:``}`})})]}),t.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,x.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,x.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),c===e.name?(0,x.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,x.jsx)(`button`,{onClick:()=>f(e.name),className:`px-2 py-1 bg-error text-white rounded text-[10px]`,children:`Delete`}),(0,x.jsx)(`button`,{onClick:()=>l(null),className:`px-2 py-1 bg-panel-2 text-text rounded text-[10px]`,children:`Cancel`})]}):(0,x.jsx)(`button`,{onClick:()=>l(e.name),className:`shrink-0 text-text-subtle hover:text-error p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,x.jsx)(r,{className:`size-3.5`})})]},e.name))]})}export{k as t};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{Mr as r,ct as i,ir as a}from"./icons-CO_II6D-.js";import{n as o}from"./api-client-c8YOpTlT.js";import{t as s}from"./input-CG8PS8mS.js";import{On as c,Rn as l,bt as u,ct as d,dt as f,et as p,ft as m,lt as h,st as g,ut as _}from"./index-C8nGqkKN.js";import{a as v,b as y}from"./api-settings-BmvNoCbn.js";var b=e(t(),1),x=n(),S=[128e3,272e3,4e5,512e3,872e3,1e6],C=[1e5,2e5,23e4,35e4,45e4,75e4,9e5];function w({id:e,label:t,value:n,presets:r,disabled:i,compact:a,onChange:o}){let[c,l]=(0,b.useState)(!!n&&!r.includes(Number(n))),d=a?`text-[11px]`:`text-sm`;return(0,x.jsxs)(`div`,{className:`space-y-1`,children:[(0,x.jsx)(u,{htmlFor:e,className:d,children:t}),(0,x.jsxs)(`select`,{id:e,value:c?`custom`:n||`default`,disabled:i,"aria-describedby":`codex-context-help`,className:`w-full min-h-11 sm:min-h-0 rounded-md border border-input bg-background px-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 ${a?`h-7`:`h-9`} ${d}`,onChange:e=>{let t=e.target.value;l(t===`custom`),t!==`custom`&&o(t===`default`?``:t)},children:[(0,x.jsx)(`option`,{value:`default`,children:`Codex default`}),r.map(e=>(0,x.jsxs)(`option`,{value:String(e),children:[e===1e6?`1M`:`${e/1e3}K`,` tokens`]},e)),(0,x.jsx)(`option`,{value:`custom`,children:`Custom...`})]}),c&&(0,x.jsx)(s,{id:`${e}-custom`,"aria-label":`Custom ${t.toLowerCase()}`,type:`number`,min:1,step:1,required:!0,value:n,disabled:i,placeholder:`Enter tokens`,"aria-describedby":`codex-context-help`,className:`min-h-11 sm:min-h-0 ${a?`h-7 text-[11px]`:``}`,onChange:e=>o(e.target.value)})]})}function T({config:e,compact:t,saving:n,onSave:r}){let[i,a]=(0,b.useState)(String(e?.model_context_window??``)),[o,s]=(0,b.useState)(String(e?.model_auto_compact_token_limit??``)),[c,l]=(0,b.useState)(null),u=t?`text-[11px]`:`text-sm`,d=t?`text-[9px]`:`text-[11px]`;async function f(e){e.preventDefault();let t=i.trim()?Number(i):null,n=o.trim()?Number(o):null;if([t,n].some(e=>e!==null&&(!Number.isSafeInteger(e)||e<=0))){l(`Enter positive whole numbers of tokens, or leave blank for Codex defaults.`);return}if(t!==null&&n!==null&&n>t){l(`Auto-compact threshold must not exceed the context window.`);return}l(null),await r({model_context_window:t,model_auto_compact_token_limit:n})}return(0,x.jsxs)(`form`,{onSubmit:f,className:`space-y-2 rounded-md border border-border p-3`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,x.jsx)(w,{id:`codex-context-window`,label:`Context window (tokens)`,value:i,presets:S,disabled:n,compact:t,onChange:e=>{a(e),l(null)}}),(0,x.jsx)(w,{id:`codex-compact-threshold`,label:`Auto-compact threshold (tokens)`,value:o,presets:C,disabled:n,compact:t,onChange:e=>{s(e),l(null)}})]}),(0,x.jsx)(`p`,{id:`codex-context-help`,className:`${d} text-muted-foreground`,children:`Choose Codex default to use Codex configuration and model defaults, or Custom to enter a value. Presets are shortcuts, not a list of limits supported by your model; increasing these values does not unlock a larger context window. Applies to new sessions and sessions resumed after a PPM restart.`}),c&&(0,x.jsx)(`p`,{role:`alert`,className:`${u} text-error`,children:c}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(`a`,{href:`https://learn.chatgpt.com/docs/config-file/config-reference`,target:`_blank`,rel:`noreferrer`,className:`${d} text-primary underline`,children:`Codex context documentation`}),(0,x.jsx)(`button`,{type:`submit`,disabled:n,className:`min-h-11 sm:min-h-0 rounded-md border border-border px-3 py-1.5 hover:bg-surface-elevated disabled:opacity-50 ${u}`,children:n?`Saving...`:`Save context settings`})]})]})}var E=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`xhigh`,label:`Extra`},{value:`max`,label:`Max`}],D=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],O={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function k({compact:e}={}){let[t,n]=(0,b.useState)(null),[r,a]=(0,b.useState)(``),[S,C]=(0,b.useState)([]),[w,k]=(0,b.useState)(!1),[j,M]=(0,b.useState)(!1),[N,P]=(0,b.useState)(null),[F,I]=(0,b.useState)(0);(0,b.useEffect)(()=>{v().then(e=>{n(e),a(e.default_provider??`claude`)}).catch(e=>P(e.message))},[]),(0,b.useEffect)(()=>{r&&(k(!0),o.get(`/api/settings/ai/providers/${r}/models`).then(C).catch(()=>C([])).finally(()=>k(!1)))},[r]);let L=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:O[e]??e})):[],R=t?.providers[r],z=R?.type===`agent-sdk`||!R?.type&&r===`claude`,B=async e=>{if(!t)return!1;M(!0),P(null);try{return n(await y(e)),I(e=>e+1),!0}catch(e){return P(e.message),!1}finally{M(!1)}},V=(e,t)=>B({providers:{[r]:{[e]:t}}}),H=e?`text-[11px]`:`text-sm`,U=e?`text-xs`:`text-sm`,W=e?`space-y-2`:`space-y-4`,G=e?`space-y-1.5`:`space-y-3`,K=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,x.jsxs)(`div`,{className:G,children:[(0,x.jsx)(`h3`,{className:`${U} font-medium text-text-secondary`,children:`AI Settings`}),(0,x.jsx)(`p`,{className:`${H} text-text-subtle`,children:N?`Error: ${N}`:`Loading...`})]});let q=z?S:[{value:`__default__`,label:`Auto (default)`},...S];return(0,x.jsxs)(`div`,{className:W,children:[(0,x.jsx)(`h3`,{className:`${U} font-medium text-text-secondary`,children:`AI Settings`}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-new-chat-provider`,className:e?H:void 0,children:`New chat provider`}),(0,x.jsxs)(g,{value:t.new_chat_provider_mode??`default`,disabled:j,onValueChange:e=>B({new_chat_provider_mode:e}),children:[(0,x.jsx)(_,{id:`ai-new-chat-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsxs)(d,{children:[(0,x.jsx)(h,{value:`follow-focus`,children:`Follow last focused chat`}),(0,x.jsx)(h,{value:`default`,children:`Always use default provider`})]})]}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:t.new_chat_provider_mode===`follow-focus`?`New tabs follow the last chat you focused in this project, across panels. Existing tabs keep their provider.`:`New tabs always use the default provider. Existing tabs keep their provider.`})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-default-provider`,className:e?H:void 0,children:`Default provider`}),(0,x.jsxs)(g,{value:t.default_provider,disabled:j,onValueChange:e=>B({default_provider:e}),children:[(0,x.jsx)(_,{id:`ai-default-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsx)(d,{children:L.map(e=>(0,x.jsx)(h,{value:e.id,children:e.name},e.id))})]}),t.new_chat_provider_mode===`follow-focus`&&(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Used when no chat has been focused in this project yet.`})]}),(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border p-3`,children:[(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-share-provider-context`,className:e?H:void 0,children:`Share rules and memory between providers`}),(0,x.jsx)(`p`,{id:`ai-share-provider-context-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Share project rules and memory, plus global instruction files, across providers. Applies from the next project-chat message. Turning off keeps context already sent.`})]}),(0,x.jsx)(m,{id:`ai-share-provider-context`,"aria-describedby":`ai-share-provider-context-description`,checked:t.share_provider_context??!0,disabled:j,onCheckedChange:e=>B({share_provider_context:e})})]}),L.length>1&&(0,x.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:L.map(e=>(0,x.jsxs)(`button`,{onClick:()=>a(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,x.jsx)(l,{providerId:e.id}),(0,x.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,x.jsxs)(`div`,{className:G,children:[r===`codex`&&(0,x.jsxs)(`button`,{type:`button`,onClick:()=>c(`accounts`),className:`w-full flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-2 text-left cursor-pointer hover:bg-surface-elevated transition-colors`,children:[(0,x.jsx)(`span`,{className:`${H} text-text-secondary`,children:`Codex accounts & login`}),(0,x.jsx)(i,{className:`size-3.5 text-text-subtle shrink-0`})]}),S.length>0&&(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-model`,className:e?H:void 0,children:`Model`}),(0,x.jsxs)(g,{value:z?R?.model??S[0]?.value:R?.model||`__default__`,onValueChange:e=>V(`model`,e===`__default__`?void 0:e),disabled:w,children:[(0,x.jsx)(_,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{placeholder:w?`Loading models...`:`Select model`})}),(0,x.jsx)(d,{className:`max-h-[300px]`,children:q.map(e=>(0,x.jsx)(h,{value:e.value,children:e.label},e.value))})]})]}),r===`codex`&&(0,x.jsx)(T,{config:R,compact:e,saving:j,onSave:e=>B({providers:{codex:e}})},JSON.stringify([R?.model_context_window,R?.model_auto_compact_token_limit])),z&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-base-url`,className:e?H:void 0,children:`Base URL`}),(0,x.jsx)(s,{id:`ai-base-url`,type:`url`,defaultValue:R?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{V(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-api-key`,className:e?H:void 0,children:`API Key / Token`}),(0,x.jsx)(s,{id:`ai-api-key`,type:`password`,defaultValue:R?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||V(`api_key`,t||void 0)}},`apikey-${r}-${F}`),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-effort`,className:e?H:void 0,children:`Effort`}),(0,x.jsxs)(g,{value:R?.effort??`high`,onValueChange:e=>V(`effort`,e),children:[(0,x.jsx)(_,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsx)(d,{children:E.map(e=>(0,x.jsx)(h,{value:e.value,children:e.label},e.value))})]})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-max-turns`,className:e?H:void 0,children:`Max Turns (1-500)`}),(0,x.jsx)(s,{id:`ai-max-turns`,type:`number`,min:1,max:500,defaultValue:R?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);isNaN(t)||V(`max_turns`,t)}},`turns-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-budget`,className:e?H:void 0,children:`Max Budget (USD)`}),(0,x.jsx)(s,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:R?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);V(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-thinking`,className:e?H:void 0,children:`Thinking Budget (tokens)`}),(0,x.jsx)(s,{id:`ai-thinking`,type:`number`,min:0,defaultValue:R?.thinking_budget_tokens??``,placeholder:`Adaptive (model decides)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);V(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${F}`)]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(u,{htmlFor:`ai-agent-teams`,className:e?H:void 0,children:`Agent Teams`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,x.jsx)(m,{id:`ai-agent-teams`,checked:R?.agent_teams??!1,onCheckedChange:e=>V(`agent_teams`,e)})]}),R?.agent_teams&&(0,x.jsx)(A,{compact:e}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(u,{htmlFor:`ai-context-1m`,className:e?H:void 0,children:`1M Context Window`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Requires an entitled account (Max/Team/Enterprise) and an Opus 4 / Sonnet 4 model. Other accounts will error.`})]}),(0,x.jsx)(m,{id:`ai-context-1m`,checked:R?.context_1m??!1,onCheckedChange:e=>V(`context_1m`,e)})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(u,{htmlFor:`ai-inherit-mcp`,className:e?H:void 0,children:`Inherit Claude Code MCP`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Auto-load MCP servers from Claude Code's ~/.claude.json (global + per-project). Your own MCP servers override inherited ones.`})]}),(0,x.jsx)(m,{id:`ai-inherit-mcp`,checked:R?.inherit_claude_mcp??!0,onCheckedChange:e=>V(`inherit_claude_mcp`,e)})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{className:e?H:void 0,children:`MCP sign-in`}),(0,x.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Servers that use OAuth stay unavailable to Claude until someone signs in. Project-scoped servers are listed in the project's AI Resources panel.`}),(0,x.jsx)(`div`,{className:`-mx-2`,children:(0,x.jsx)(p,{showWhenEmpty:!0})})]})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-permission-mode`,className:e?H:void 0,children:`Default Permission Mode`}),(0,x.jsxs)(g,{value:R?.permission_mode??`bypassPermissions`,onValueChange:e=>V(`permission_mode`,e),children:[(0,x.jsx)(_,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,x.jsx)(f,{})}),(0,x.jsx)(d,{children:D.map(e=>(0,x.jsx)(h,{value:e.value,children:e.label},e.value))})]})]}),(0,x.jsxs)(`div`,{className:K,children:[(0,x.jsx)(u,{htmlFor:`ai-system-prompt`,className:e?H:void 0,children:`Additional Instructions`}),(0,x.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:R?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{V(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${F}`)]})]}),j&&(0,x.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),N&&(0,x.jsx)(`p`,{className:`text-xs text-error`,children:N})]})}function A({compact:e}){let[t,n]=(0,b.useState)([]),[i,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),d=(0,b.useCallback)(async()=>{s(!0);try{n(await o.get(`/api/teams`)??[])}catch{}s(!1)},[]);(0,b.useEffect)(()=>{d()},[d]);let f=async e=>{try{await o.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),l(null)}catch{}};return t.length===0&&!i?null:(0,x.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(u,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,x.jsx)(`button`,{onClick:d,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,x.jsx)(a,{className:`size-3 ${i?`animate-spin`:``}`})})]}),t.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,x.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,x.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),c===e.name?(0,x.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,x.jsx)(`button`,{onClick:()=>f(e.name),className:`px-2 py-1 bg-error text-white rounded text-[10px]`,children:`Delete`}),(0,x.jsx)(`button`,{onClick:()=>l(null),className:`px-2 py-1 bg-panel-2 text-text rounded text-[10px]`,children:`Cancel`})]}):(0,x.jsx)(`button`,{onClick:()=>l(e.name),className:`shrink-0 text-text-subtle hover:text-error p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,x.jsx)(r,{className:`size-3.5`})})]},e.name))]})}export{k as t};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./tab-store-DqeaGhhE.js";import"./chat-preparation-cache-BSIQGiWx.js";import"./use-is-mobile-BClDZJP5.js";import"./button-Ci9EUgqd.js";import"./dialog-B8clVkyi.js";import"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import"./input-CG8PS8mS.js";import"./api-settings-BmvNoCbn.js";import{t as e}from"./ai-settings-section-
|
|
1
|
+
import"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./tab-store-DqeaGhhE.js";import"./chat-preparation-cache-BSIQGiWx.js";import"./use-is-mobile-BClDZJP5.js";import"./button-Ci9EUgqd.js";import"./dialog-B8clVkyi.js";import"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import"./input-CG8PS8mS.js";import"./api-settings-BmvNoCbn.js";import{t as e}from"./ai-settings-section-CEbW8jRy.js";export{e as AISettingsSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{c as r,l as i,s as a,u as o}from"./vendor-ui-BHh12_0v.js";import{Mr as s,Qr as c,Zn as l,qr as u,w as d}from"./icons-CO_II6D-.js";import{s as f}from"./api-client-c8YOpTlT.js";import{t as p}from"./settings-store-Br5c1efC.js";import{n as m}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import{n as h}from"./use-is-mobile-BClDZJP5.js";import{n as g,t as _}from"./button-Ci9EUgqd.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-B8clVkyi.js";import{t as w}from"./input-CG8PS8mS.js";import{n as T,r as E,t as D}from"./resolve-theme-STMsK2vc.js";import{A as O,M as k,ft as A,rn as j,v as M}from"./index-jG9mLs-J.js";import{t as N}from"./separator-sQj04Ari.js";var P=n();function F(){let e=p(e=>e.themeStyle),t=p(e=>e.themeMode),n=p(e=>e.customThemeId),r=p(e=>e.customThemes),i=p(e=>e.setThemeStyle),a=p(e=>e.setThemeMode),o=D(e,t,r,n);return(0,P.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:T.map(e=>{let t=E[e];if(!t)return null;let n=o.id===e;return(0,P.jsxs)(`button`,{onClick:()=>{i(t.style),a(t.mode)},className:m(`relative flex items-center gap-2 rounded-lg border p-2 text-left transition-colors min-h-11`,n?`border-primary ring-[3px] ring-accent-wash`:`border-border hover:bg-accent/40`),children:[(0,P.jsx)(k,{swatch:t.swatch}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-xs font-medium text-text`,children:t.name.replace(/ (Dark|Light)$/,``)}),(0,P.jsx)(`span`,{className:`block text-[10px] text-text-3 capitalize`,children:t.mode})]}),n&&(0,P.jsx)(d,{className:`absolute top-1 right-1 size-3.5 text-primary`})]},e)})})}var I=e(t(),1);function L({className:e,orientation:t=`horizontal`,...n}){return(0,P.jsx)(i,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:m(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var R=g(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function z({className:e,variant:t=`default`,...n}){return(0,P.jsx)(r,{"data-slot":`tabs-list`,"data-variant":t,className:m(R({variant:t}),e),...n})}function B({className:e,...t}){return(0,P.jsx)(o,{"data-slot":`tabs-trigger`,className:m(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function V({className:e,...t}){return(0,P.jsx)(a,{"data-slot":`tabs-content`,className:m(`flex-1 outline-none`,e),...t})}function H({open:e,onOpenChange:t}){let n=p(e=>e.importThemeFrom),r=p(e=>e.setCustomTheme),[i,a]=(0,I.useState)(`url`),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(``),[m,h]=(0,I.useState)(!1),g=()=>{s(``),l(``),d(``),a(`url`)},T=async()=>{let e=i===`url`?o.trim():c.trim();if(!e){f.error(`Nothing to import`);return}h(!0);try{let a=await n({source:i===`url`?`url`:i===`upload`?`upload`:`json`,value:e,name:u.trim()||void 0});f.success(a.length>1?`Imported ${a.length} themes`:`Imported "${a[0]?.name}"`),a[0]&&r(a[0].id),g(),t(!1)}catch(e){f.error(e.message||`Import failed`)}finally{h(!1)}},E=async e=>{if(e)try{l(await e.text()),d(e.name.replace(/\.json$/i,``))}catch{f.error(`Could not read file`)}};return(0,P.jsx)(C,{open:e,onOpenChange:t,children:(0,P.jsxs)(b,{className:`max-w-md`,children:[(0,P.jsxs)(v,{children:[(0,P.jsx)(x,{children:`Import theme`}),(0,P.jsx)(S,{className:`text-text-3`,children:`Import a VSCode color theme. Single-mode themes apply to both dark and light.`})]}),(0,P.jsxs)(L,{value:i,onValueChange:e=>a(e),children:[(0,P.jsxs)(z,{className:`w-full`,children:[(0,P.jsx)(B,{value:`url`,className:`flex-1`,children:`URL`}),(0,P.jsx)(B,{value:`json`,className:`flex-1`,children:`Paste JSON`}),(0,P.jsx)(B,{value:`upload`,className:`flex-1`,children:`Upload`})]}),(0,P.jsxs)(V,{value:`url`,className:`space-y-2 pt-2`,children:[(0,P.jsx)(w,{placeholder:`https://…/theme.json or Marketplace .vsix URL`,value:o,onChange:e=>s(e.target.value)}),(0,P.jsx)(`p`,{className:`text-[11px] text-text-3`,children:`Only https URLs; private/internal addresses are blocked.`})]}),(0,P.jsx)(V,{value:`json`,className:`pt-2`,children:(0,P.jsx)(`textarea`,{className:`w-full h-40 rounded-md border border-border bg-surface p-2 text-xs font-mono text-text focus:outline-none focus:border-ring`,placeholder:`{ "name": "My Theme", "type": "dark", "colors": { … }, "tokenColors": [ … ] }`,value:c,onChange:e=>l(e.target.value)})}),(0,P.jsxs)(V,{value:`upload`,className:`space-y-2 pt-2`,children:[(0,P.jsx)(`input`,{type:`file`,accept:`.json,application/json`,onChange:e=>E(e.target.files?.[0]),className:`block w-full text-xs text-text-2 file:mr-3 file:rounded file:border file:border-border file:bg-panel-2 file:px-2 file:py-1 file:text-text`}),c&&(0,P.jsxs)(`p`,{className:`text-[11px] text-success`,children:[`File loaded (`,c.length,` chars)`]})]})]}),(0,P.jsx)(w,{placeholder:`Optional name`,value:u,onChange:e=>d(e.target.value)}),(0,P.jsxs)(y,{children:[(0,P.jsx)(_,{variant:`outline`,onClick:()=>t(!1),disabled:m,children:`Cancel`}),(0,P.jsx)(_,{onClick:T,disabled:m,children:m?`Importing…`:`Import`})]})]})})}function U(){let e=p(e=>e.customThemes),t=p(e=>e.themeStyle),n=p(e=>e.customThemeId),r=p(e=>e.setCustomTheme),i=p(e=>e.deleteCustomTheme),[a,o]=(0,I.useState)(!1);return(0,P.jsxs)(`section`,{className:`space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Imported themes`}),(0,P.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 gap-1 text-xs`,onClick:()=>o(!0),children:[(0,P.jsx)(l,{className:`size-3.5`}),` Import`]})]}),e.length===0?(0,P.jsx)(`p`,{className:`text-[11px] text-text-3`,children:`No imported themes yet. Import a VSCode theme from a URL, .vsix, or JSON.`}):(0,P.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>{let a=t===`custom`&&n===e.id;return(0,P.jsxs)(`li`,{className:m(`flex items-center gap-2 rounded-md border px-2 py-1.5`,a?`border-primary bg-primary/10`:`border-border`),children:[(0,P.jsx)(k,{swatch:e.swatch}),(0,P.jsxs)(`button`,{className:`flex-1 min-w-0 text-left`,onClick:()=>r(e.id),children:[(0,P.jsx)(`span`,{className:`block truncate text-xs text-text`,children:e.name}),(0,P.jsx)(`span`,{className:`block text-[10px] text-text-3`,children:e.mode})]}),a&&(0,P.jsx)(d,{className:`size-4 text-primary shrink-0`}),(0,P.jsx)(`button`,{className:`text-text-3 hover:text-error transition-colors shrink-0`,title:`Delete`,onClick:()=>void i(e.id),children:(0,P.jsx)(s,{className:`size-3.5`})})]},e.id)})}),(0,P.jsx)(H,{open:a,onOpenChange:o})]})}var W=[{value:`default`,label:`Default`},{value:`boxed`,label:`Boxed`},{value:`pill`,label:`Pill`}],G=[{value:`auto`,label:`Auto`},{value:`windows`,label:`Windows`},{value:`macos`,label:`macOS`}];function K({options:e,value:t,onChange:n}){return(0,P.jsx)(`div`,{className:`flex gap-2`,children:e.map(e=>(0,P.jsx)(_,{variant:t===e.value?`default`:`outline`,onClick:()=>n(e.value),className:m(`flex-1 cursor-pointer`,t===e.value&&`ring-2 ring-primary`),children:e.label},e.value))})}function q(){let{theme:e,setTheme:t,tabWrap:n,toggleTabWrap:r,editorTabStyle:i,setEditorTabStyle:a,explorerSkin:o,setExplorerSkin:s}=p(j(e=>({theme:e.themeMode,setTheme:e.setThemeMode,tabWrap:e.tabWrap,toggleTabWrap:e.toggleTabWrap,editorTabStyle:e.editorTabStyle,setEditorTabStyle:e.setEditorTabStyle,explorerSkin:e.explorerSkin,setExplorerSkin:e.setExplorerSkin}))),{wordWrap:l,toggleWordWrap:d,mobileWordWrap:f,toggleMobileWordWrap:g,lspEnabled:v,setLspEnabled:y}=p(j(e=>({wordWrap:e.wordWrap,toggleWordWrap:e.toggleWordWrap,mobileWordWrap:e.mobileWordWrap,toggleMobileWordWrap:e.toggleMobileWordWrap,lspEnabled:e.lspEnabled,setLspEnabled:e.setLspEnabled}))),b=h(),x=M();return(0,P.jsxs)(`div`,{className:`space-y-6`,children:[(0,P.jsxs)(`section`,{className:`space-y-3`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-medium`,children:`Theme`}),(0,P.jsx)(F,{}),(0,P.jsx)(`div`,{className:`flex gap-2`,children:O.map(n=>{let r=n.icon;return(0,P.jsxs)(_,{variant:e===n.value?`default`:`outline`,onClick:()=>t(n.value),className:m(`flex-1 gap-2 cursor-pointer`,e===n.value&&`ring-2 ring-primary`),children:[(0,P.jsx)(r,{className:`size-4`}),n.label]},n.value)})})]}),(0,P.jsx)(N,{}),(0,P.jsx)(U,{}),(0,P.jsx)(N,{}),(0,P.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,P.jsx)(u,{className:`size-4 text-muted-foreground shrink-0`}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Wrap Tabs`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Stack tabs in rows instead of scrolling`})]})]}),(0,P.jsx)(A,{checked:n,onCheckedChange:r})]}),(0,P.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,P.jsx)(u,{className:`size-4 text-muted-foreground shrink-0`}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Word Wrap`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b?`Wrap long lines instead of scrolling sideways (this device)`:`Wrap long lines in the editor (Alt+Z)`})]})]}),(0,P.jsx)(A,{checked:b?f:l,onCheckedChange:()=>b?g():d()})]}),(0,P.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,P.jsx)(c,{className:`size-4 text-muted-foreground shrink-0`}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Language Server`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:x?`Off on a touch device — it runs a server process per project`:`Completions, hover, F12, rename and quick fix (this device)`})]})]}),(0,P.jsx)(A,{checked:v&&!x,disabled:x,onCheckedChange:y})]}),(0,P.jsxs)(`section`,{className:`space-y-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-medium`,children:`Tab Style`}),(0,P.jsx)(K,{options:W,value:i,onChange:a})]}),(0,P.jsxs)(`section`,{className:`space-y-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-medium`,children:`Explorer Skin`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Chrome the OS File Explorer window wears. Auto follows the host platform.`}),(0,P.jsx)(K,{options:G,value:o,onChange:s})]})]})}export{q as AppearanceSettingsSection};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{c as r,l as i,s as a,u as o}from"./vendor-ui-BHh12_0v.js";import{Mr as s,Qr as c,Zn as l,qr as u,w as d}from"./icons-CO_II6D-.js";import{s as f}from"./api-client-c8YOpTlT.js";import{t as p}from"./settings-store-Br5c1efC.js";import{n as m}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import{n as h}from"./use-is-mobile-BClDZJP5.js";import{n as g,t as _}from"./button-Ci9EUgqd.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-B8clVkyi.js";import{t as w}from"./input-CG8PS8mS.js";import{n as T,r as E,t as D}from"./resolve-theme-STMsK2vc.js";import{A as O,M as k,ft as A,rn as j,v as M}from"./index-C8nGqkKN.js";import{t as N}from"./separator-sQj04Ari.js";var P=n();function F(){let e=p(e=>e.themeStyle),t=p(e=>e.themeMode),n=p(e=>e.customThemeId),r=p(e=>e.customThemes),i=p(e=>e.setThemeStyle),a=p(e=>e.setThemeMode),o=D(e,t,r,n);return(0,P.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:T.map(e=>{let t=E[e];if(!t)return null;let n=o.id===e;return(0,P.jsxs)(`button`,{onClick:()=>{i(t.style),a(t.mode)},className:m(`relative flex items-center gap-2 rounded-lg border p-2 text-left transition-colors min-h-11`,n?`border-primary ring-[3px] ring-accent-wash`:`border-border hover:bg-accent/40`),children:[(0,P.jsx)(k,{swatch:t.swatch}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-xs font-medium text-text`,children:t.name.replace(/ (Dark|Light)$/,``)}),(0,P.jsx)(`span`,{className:`block text-[10px] text-text-3 capitalize`,children:t.mode})]}),n&&(0,P.jsx)(d,{className:`absolute top-1 right-1 size-3.5 text-primary`})]},e)})})}var I=e(t(),1);function L({className:e,orientation:t=`horizontal`,...n}){return(0,P.jsx)(i,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:m(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var R=g(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function z({className:e,variant:t=`default`,...n}){return(0,P.jsx)(r,{"data-slot":`tabs-list`,"data-variant":t,className:m(R({variant:t}),e),...n})}function B({className:e,...t}){return(0,P.jsx)(o,{"data-slot":`tabs-trigger`,className:m(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function V({className:e,...t}){return(0,P.jsx)(a,{"data-slot":`tabs-content`,className:m(`flex-1 outline-none`,e),...t})}function H({open:e,onOpenChange:t}){let n=p(e=>e.importThemeFrom),r=p(e=>e.setCustomTheme),[i,a]=(0,I.useState)(`url`),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(``),[m,h]=(0,I.useState)(!1),g=()=>{s(``),l(``),d(``),a(`url`)},T=async()=>{let e=i===`url`?o.trim():c.trim();if(!e){f.error(`Nothing to import`);return}h(!0);try{let a=await n({source:i===`url`?`url`:i===`upload`?`upload`:`json`,value:e,name:u.trim()||void 0});f.success(a.length>1?`Imported ${a.length} themes`:`Imported "${a[0]?.name}"`),a[0]&&r(a[0].id),g(),t(!1)}catch(e){f.error(e.message||`Import failed`)}finally{h(!1)}},E=async e=>{if(e)try{l(await e.text()),d(e.name.replace(/\.json$/i,``))}catch{f.error(`Could not read file`)}};return(0,P.jsx)(C,{open:e,onOpenChange:t,children:(0,P.jsxs)(b,{className:`max-w-md`,children:[(0,P.jsxs)(v,{children:[(0,P.jsx)(x,{children:`Import theme`}),(0,P.jsx)(S,{className:`text-text-3`,children:`Import a VSCode color theme. Single-mode themes apply to both dark and light.`})]}),(0,P.jsxs)(L,{value:i,onValueChange:e=>a(e),children:[(0,P.jsxs)(z,{className:`w-full`,children:[(0,P.jsx)(B,{value:`url`,className:`flex-1`,children:`URL`}),(0,P.jsx)(B,{value:`json`,className:`flex-1`,children:`Paste JSON`}),(0,P.jsx)(B,{value:`upload`,className:`flex-1`,children:`Upload`})]}),(0,P.jsxs)(V,{value:`url`,className:`space-y-2 pt-2`,children:[(0,P.jsx)(w,{placeholder:`https://…/theme.json or Marketplace .vsix URL`,value:o,onChange:e=>s(e.target.value)}),(0,P.jsx)(`p`,{className:`text-[11px] text-text-3`,children:`Only https URLs; private/internal addresses are blocked.`})]}),(0,P.jsx)(V,{value:`json`,className:`pt-2`,children:(0,P.jsx)(`textarea`,{className:`w-full h-40 rounded-md border border-border bg-surface p-2 text-xs font-mono text-text focus:outline-none focus:border-ring`,placeholder:`{ "name": "My Theme", "type": "dark", "colors": { … }, "tokenColors": [ … ] }`,value:c,onChange:e=>l(e.target.value)})}),(0,P.jsxs)(V,{value:`upload`,className:`space-y-2 pt-2`,children:[(0,P.jsx)(`input`,{type:`file`,accept:`.json,application/json`,onChange:e=>E(e.target.files?.[0]),className:`block w-full text-xs text-text-2 file:mr-3 file:rounded file:border file:border-border file:bg-panel-2 file:px-2 file:py-1 file:text-text`}),c&&(0,P.jsxs)(`p`,{className:`text-[11px] text-success`,children:[`File loaded (`,c.length,` chars)`]})]})]}),(0,P.jsx)(w,{placeholder:`Optional name`,value:u,onChange:e=>d(e.target.value)}),(0,P.jsxs)(y,{children:[(0,P.jsx)(_,{variant:`outline`,onClick:()=>t(!1),disabled:m,children:`Cancel`}),(0,P.jsx)(_,{onClick:T,disabled:m,children:m?`Importing…`:`Import`})]})]})})}function U(){let e=p(e=>e.customThemes),t=p(e=>e.themeStyle),n=p(e=>e.customThemeId),r=p(e=>e.setCustomTheme),i=p(e=>e.deleteCustomTheme),[a,o]=(0,I.useState)(!1);return(0,P.jsxs)(`section`,{className:`space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Imported themes`}),(0,P.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 gap-1 text-xs`,onClick:()=>o(!0),children:[(0,P.jsx)(l,{className:`size-3.5`}),` Import`]})]}),e.length===0?(0,P.jsx)(`p`,{className:`text-[11px] text-text-3`,children:`No imported themes yet. Import a VSCode theme from a URL, .vsix, or JSON.`}):(0,P.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>{let a=t===`custom`&&n===e.id;return(0,P.jsxs)(`li`,{className:m(`flex items-center gap-2 rounded-md border px-2 py-1.5`,a?`border-primary bg-primary/10`:`border-border`),children:[(0,P.jsx)(k,{swatch:e.swatch}),(0,P.jsxs)(`button`,{className:`flex-1 min-w-0 text-left`,onClick:()=>r(e.id),children:[(0,P.jsx)(`span`,{className:`block truncate text-xs text-text`,children:e.name}),(0,P.jsx)(`span`,{className:`block text-[10px] text-text-3`,children:e.mode})]}),a&&(0,P.jsx)(d,{className:`size-4 text-primary shrink-0`}),(0,P.jsx)(`button`,{className:`text-text-3 hover:text-error transition-colors shrink-0`,title:`Delete`,onClick:()=>void i(e.id),children:(0,P.jsx)(s,{className:`size-3.5`})})]},e.id)})}),(0,P.jsx)(H,{open:a,onOpenChange:o})]})}var W=[{value:`default`,label:`Default`},{value:`boxed`,label:`Boxed`},{value:`pill`,label:`Pill`}],G=[{value:`auto`,label:`Auto`},{value:`windows`,label:`Windows`},{value:`macos`,label:`macOS`}];function K({options:e,value:t,onChange:n}){return(0,P.jsx)(`div`,{className:`flex gap-2`,children:e.map(e=>(0,P.jsx)(_,{variant:t===e.value?`default`:`outline`,onClick:()=>n(e.value),className:m(`flex-1 cursor-pointer`,t===e.value&&`ring-2 ring-primary`),children:e.label},e.value))})}function q(){let{theme:e,setTheme:t,tabWrap:n,toggleTabWrap:r,editorTabStyle:i,setEditorTabStyle:a,explorerSkin:o,setExplorerSkin:s}=p(j(e=>({theme:e.themeMode,setTheme:e.setThemeMode,tabWrap:e.tabWrap,toggleTabWrap:e.toggleTabWrap,editorTabStyle:e.editorTabStyle,setEditorTabStyle:e.setEditorTabStyle,explorerSkin:e.explorerSkin,setExplorerSkin:e.setExplorerSkin}))),{wordWrap:l,toggleWordWrap:d,mobileWordWrap:f,toggleMobileWordWrap:g,lspEnabled:v,setLspEnabled:y}=p(j(e=>({wordWrap:e.wordWrap,toggleWordWrap:e.toggleWordWrap,mobileWordWrap:e.mobileWordWrap,toggleMobileWordWrap:e.toggleMobileWordWrap,lspEnabled:e.lspEnabled,setLspEnabled:e.setLspEnabled}))),b=h(),x=M();return(0,P.jsxs)(`div`,{className:`space-y-6`,children:[(0,P.jsxs)(`section`,{className:`space-y-3`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-medium`,children:`Theme`}),(0,P.jsx)(F,{}),(0,P.jsx)(`div`,{className:`flex gap-2`,children:O.map(n=>{let r=n.icon;return(0,P.jsxs)(_,{variant:e===n.value?`default`:`outline`,onClick:()=>t(n.value),className:m(`flex-1 gap-2 cursor-pointer`,e===n.value&&`ring-2 ring-primary`),children:[(0,P.jsx)(r,{className:`size-4`}),n.label]},n.value)})})]}),(0,P.jsx)(N,{}),(0,P.jsx)(U,{}),(0,P.jsx)(N,{}),(0,P.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,P.jsx)(u,{className:`size-4 text-muted-foreground shrink-0`}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Wrap Tabs`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Stack tabs in rows instead of scrolling`})]})]}),(0,P.jsx)(A,{checked:n,onCheckedChange:r})]}),(0,P.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,P.jsx)(u,{className:`size-4 text-muted-foreground shrink-0`}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Word Wrap`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b?`Wrap long lines instead of scrolling sideways (this device)`:`Wrap long lines in the editor (Alt+Z)`})]})]}),(0,P.jsx)(A,{checked:b?f:l,onCheckedChange:()=>b?g():d()})]}),(0,P.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,P.jsx)(c,{className:`size-4 text-muted-foreground shrink-0`}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Language Server`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:x?`Off on a touch device — it runs a server process per project`:`Completions, hover, F12, rename and quick fix (this device)`})]})]}),(0,P.jsx)(A,{checked:v&&!x,disabled:x,onCheckedChange:y})]}),(0,P.jsxs)(`section`,{className:`space-y-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-medium`,children:`Tab Style`}),(0,P.jsx)(K,{options:W,value:i,onChange:a})]}),(0,P.jsxs)(`section`,{className:`space-y-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-medium`,children:`Explorer Skin`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Chrome the OS File Explorer window wears. Auto follows the host platform.`}),(0,P.jsx)(K,{options:G,value:o,onChange:s})]})]})}export{q as AppearanceSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{O as r,ir as i,j as a,on as o,u as s,un as c,vt as l,w as u}from"./icons-CO_II6D-.js";import{n as d}from"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import"./portal-container-context-NFSuymMu.js";import"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import{n as f}from"./use-is-mobile-BClDZJP5.js";import"./git-repo-store-DSypNj19.js";import{t as p}from"./button-Ci9EUgqd.js";import{t as m}from"./file-icons-gx_FBOXY.js";import{t as h}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as g}from"./scroll-area-XonvWYn_.js";import{Gt as ee,_t as te,gt as ne,ht as _,vt as re,yt as ie}from"./index-jG9mLs-J.js";import"./use-monaco-theme-rH6epJYA.js";import"./use-inline-blame-Bzjfru4n.js";import{DiffViewer as ae}from"./diff-viewer-CdXi7cZN.js";var v=e(t(),1),y=`ppm:branch-review`,b=`${y}:recent`,x=20;function oe(e,t,n){return`${y}:${e}:${t}:${n}`}function S(e,t){return e[t.path]===t.blob}function se(e,t){let n={...e};return S(e,t)?delete n[t.path]:n[t.path]=t.blob,n}function C(e,t,n){if(!n)return{};let r={...e};for(let e of t)r[e.path]=e.blob;return r}function w(e,t){return t.reduce((t,n)=>t+(S(e,n)?1:0),0)}function T(e,t){let n=new Set(t.map(e=>e.path)),r={};for(let[t,i]of Object.entries(e))n.has(t)&&(r[t]=i);return r}function E(e){return e.find(e=>!e.binary)??e[0]??null}function ce(e,t,n){if(t.length===0)return null;let r=n?t.findIndex(e=>e.path===n)+1:0;for(let n=0;n<t.length;n++){let i=t[(r+n)%t.length];if(i&&!S(e,i))return i}return null}function le(e){try{let t=localStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n))typeof t==`string`&&(r[e]=t);return r}catch{return{}}}function D(e,t,n=x){let r=[t,...e.filter(e=>e!==t)];return{recent:r.slice(0,n),evicted:r.slice(n)}}function O(){try{let e=JSON.parse(localStorage.getItem(b)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function k(e,t){try{if(Object.keys(t).length===0){localStorage.removeItem(e);let t=O().filter(t=>t!==e);localStorage.setItem(b,JSON.stringify(t));return}localStorage.setItem(e,JSON.stringify(t));let{recent:n,evicted:r}=D(O(),e);for(let e of r)localStorage.removeItem(e);localStorage.setItem(b,JSON.stringify(n))}catch{}}var A=n(),j={M:`text-warning`,A:`text-success`,D:`text-error`,R:`text-primary`,C:`text-accent-2`,T:`text-text-3`};function M({children:e}){return(0,A.jsx)(`span`,{dir:`rtl`,className:`truncate text-left min-w-0 flex-1`,children:(0,A.jsx)(`bdi`,{children:e})})}function N(e){let{node:t,depth:n,byPath:i,reviewed:o,selectedPath:s,collapsed:c,onToggleCollapse:l,onSelect:d,onToggleReviewed:f}=e,p=t.file?i.get(t.fullPath):void 0;if(!p){let i=c.has(t.fullPath);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,"data-testid":`branch-review-folder`,className:`w-full flex items-center gap-1 px-2 py-1 text-xs min-h-11 md:min-h-0 hover:bg-surface-hover text-left`,style:{paddingLeft:n*14+8},onClick:()=>l(t.fullPath),children:[i?(0,A.jsx)(a,{className:`size-3 shrink-0`}):(0,A.jsx)(r,{className:`size-3 shrink-0`}),(0,A.jsx)(`span`,{className:`truncate text-text-2`,children:t.name})]}),!i&&t.children.map(t=>(0,A.jsx)(N,{...e,node:t,depth:n+1},t.fullPath))]})}let h=S(o,p),g=s===p.path;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 pr-2 py-1 text-xs cursor-pointer border-l-2 min-h-11 md:min-h-0 hover:bg-surface-hover ${g?`bg-primary/10 border-primary`:`border-transparent`}`,style:{paddingLeft:n*14+6},onClick:()=>d(p.path),"aria-current":g?`true`:void 0,"data-testid":`branch-review-file`,"data-path":p.path,"data-selected":g?`true`:`false`,"data-reviewed":h?`true`:`false`,children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":h?`Mark ${p.path} unreviewed`:`Mark ${p.path} reviewed`,"data-testid":`branch-review-check`,className:`size-11 md:size-4 shrink-0 flex items-center justify-center`,onClick:e=>{e.stopPropagation(),f(p)},children:(0,A.jsx)(`span`,{"data-testid":`branch-review-check-box`,className:`size-4 rounded border flex items-center justify-center ${h?`bg-primary border-primary text-primary-foreground`:`border-border`}`,children:h&&(0,A.jsx)(u,{className:`size-3`})})}),(0,A.jsx)(m,{name:t.name,className:`size-3.5 shrink-0`}),(0,A.jsx)(M,{children:t.name}),(0,A.jsx)(`span`,{className:`shrink-0 font-mono ${j[p.status]}`,children:p.status}),p.binary?(0,A.jsx)(`span`,{className:`shrink-0 text-text-3 italic`,children:`bin`}):(0,A.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[10px]`,children:[(0,A.jsxs)(`span`,{className:`text-success`,children:[`+`,p.additions]}),` `,(0,A.jsxs)(`span`,{className:`text-error`,children:[`-`,p.deletions]})]})]})}function ue(e,t){let n=e.filter(e=>!e.remote&&e.name!==t);return n.find(e=>e.name===`main`)?.name??n.find(e=>e.name===`master`)?.name??n[0]?.name??``}function P({metadata:e}){let t=e?.projectName,n=ee(t),r=f(),[a,u]=(0,v.useState)([]),[m,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,D]=(0,v.useState)(null),[O,j]=(0,v.useState)(null),[P,F]=(0,v.useState)({}),[de,I]=(0,v.useState)(new Set),[L,R]=(0,v.useState)(!1),[z,B]=(0,v.useState)(null),[V,H]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!t||!n.repo)return;let e=!1;return d.get(n.gitUrl(`/branches`)).then(t=>{if(e)return;u(t);let n=t.find(e=>e.current)?.name;x(e=>e||n||``),y(e=>e||ue(t,n))}).catch(t=>!e&&B(t instanceof Error?t.message:`Could not list branches`)),()=>{e=!0}},[t,n]);let U=(0,v.useRef)(null),W=(0,v.useCallback)(async()=>{if(!t||!n.repo||!m||!b)return;U.current?.abort();let e=new AbortController;U.current=e,R(!0),B(null);try{let t=new URLSearchParams({base:m,head:b}),r=await d.get(n.gitUrl(`/branch-diff?${t}`),{signal:e.signal});if(e.signal.aborted)return;D(r),j(e=>e&&r.files.some(t=>t.path===e)?e:E(r.files)?.path??null)}catch(t){if(e.signal.aborted)return;D(null),B(t instanceof Error?t.message:`Could not compare these branches`)}finally{e.signal.aborted||R(!1)}},[t,n,m,b]);(0,v.useEffect)(()=>(W(),()=>U.current?.abort()),[W]);let G=t&&m&&b?oe(t,m,b):null;(0,v.useEffect)(()=>{I(new Set)},[G]),(0,v.useEffect)(()=>{F(G?le(G):{})},[G]);let K=S&&S.base===m&&S.head===b?S:null;(0,v.useEffect)(()=>{!G||!K||F(e=>{let t=T(e,K.files);return Object.keys(t).length!==Object.keys(e).length&&k(G,t),t})},[G,K]);let q=(0,v.useCallback)(e=>{F(e),G&&k(G,e)},[G]),J=K?.files??[],Y=(0,v.useMemo)(()=>new Map(J.map(e=>[e.path,e])),[J]),X=(0,v.useMemo)(()=>w(P,J),[P,J]),fe=(0,v.useMemo)(()=>ne(_(J.map(e=>({path:e.path,status:e.status===`T`?`M`:e.status})))),[J]),Z=O?Y.get(O)??null:null,Q=(0,v.useCallback)(()=>{let e=ce(P,J,O);e&&(j(e.path),H(!1))},[P,J,O]);if(n.noRepo)return(0,A.jsx)(te,{onReload:n.reload});if(n.needsPick)return(0,A.jsx)(ie,{repos:n.repos,onChoose:n.choose});let $=(0,A.jsx)(g,{className:`h-full`,children:(0,A.jsxs)(`div`,{className:`py-1`,children:[J.length===0&&!L&&(0,A.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-text-3`,children:z?`—`:`These branches have identical trees.`}),fe.map(e=>(0,A.jsx)(N,{node:e,depth:0,byPath:Y,reviewed:P,selectedPath:O,collapsed:de,onToggleCollapse:e=>I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:e=>{j(e),H(!1)},onToggleReviewed:e=>q(se(P,e))},e.fullPath)),!!K?.omitted&&(0,A.jsxs)(`div`,{className:`px-3 py-3 text-center text-xs text-text-3`,children:[K.omitted.toLocaleString(),` more `,K.omitted===1?`file`:`files`,` not listed.`]})]})});return(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-bg`,children:[n.isNested&&n.repo&&(0,A.jsx)(re,{repo:n.repo,repos:n.repos,onChoose:n.choose}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 border-b border-border shrink-0 flex-wrap`,children:[(0,A.jsx)(`select`,{value:m,onChange:e=>y(e.target.value),"aria-label":`Base branch`,"data-testid":`branch-review-base`,className:`h-7 max-w-[38%] rounded-md border border-border bg-panel px-2 text-xs min-w-0`,children:a.map(e=>(0,A.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,A.jsx)(s,{className:`size-3.5 text-text-3 shrink-0`}),(0,A.jsx)(`select`,{value:b,onChange:e=>x(e.target.value),"aria-label":`Branch to review`,"data-testid":`branch-review-head`,className:`h-7 max-w-[38%] rounded-md border border-border bg-panel px-2 text-xs min-w-0`,children:a.map(e=>(0,A.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,A.jsxs)(`span`,{className:`text-xs text-text-2 tabular-nums`,"data-testid":`branch-review-progress`,children:[X,`/`,J.length,` reviewed`]}),(0,A.jsx)(p,{variant:`ghost`,size:`icon-xs`,title:X===J.length&&J.length>0?`Clear all`:`Mark all reviewed`,disabled:J.length===0,onClick:()=>q(C(P,J,X!==J.length)),children:(0,A.jsx)(o,{className:`size-3.5`})}),(0,A.jsx)(p,{variant:`ghost`,size:`icon-xs`,title:`Reload`,onClick:()=>void W(),children:(0,A.jsx)(i,{className:L?`animate-spin`:``})})]})]}),z&&(0,A.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0`,children:z}),(0,A.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[!r&&(0,A.jsx)(`div`,{className:`w-72 shrink-0 border-r border-border flex flex-col min-h-0`,children:$}),(0,A.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col`,children:Z?(0,A.jsx)(ae,{metadata:{filePath:n.projectFile(Z.path),projectName:t,ref1:K?.mergeBase,ref2:K?.headCommit}},`${Z.path}:${K?.mergeBase}:${K?.headCommit}`):(0,A.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-3`,children:L?(0,A.jsx)(c,{className:`size-4 animate-spin`}):`Nothing to review.`})})]}),r&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border p-2 shrink-0`,children:[(0,A.jsxs)(p,{variant:`secondary`,size:`sm`,className:`flex-1 min-h-11`,onClick:()=>H(!0),children:[(0,A.jsx)(l,{className:`size-4`}),J.length,` files`]}),(0,A.jsx)(p,{variant:`secondary`,size:`sm`,className:`flex-1 min-h-11`,onClick:Q,children:`Next unreviewed`})]}),r&&(0,A.jsx)(h,{open:V,onClose:()=>H(!1),children:(0,A.jsx)(`div`,{className:`max-h-[70vh] overflow-hidden flex flex-col`,children:$})}),!r&&Z&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border px-2 py-1 shrink-0`,children:[(0,A.jsx)(M,{children:Z.path}),(0,A.jsx)(p,{variant:`ghost`,size:`xs`,onClick:Q,children:`Next unreviewed`})]})]})}export{P as BranchReviewTab};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{O as r,ir as i,j as a,on as o,u as s,un as c,vt as l,w as u}from"./icons-CO_II6D-.js";import{n as d}from"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import"./portal-container-context-NFSuymMu.js";import"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import{n as f}from"./use-is-mobile-BClDZJP5.js";import"./git-repo-store-DSypNj19.js";import{t as p}from"./button-Ci9EUgqd.js";import{t as m}from"./file-icons-gx_FBOXY.js";import{t as h}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as g}from"./scroll-area-XonvWYn_.js";import{Gt as ee,_t as te,gt as ne,ht as _,vt as re,yt as ie}from"./index-C8nGqkKN.js";import"./use-monaco-theme-C88KphGx.js";import"./use-inline-blame-pKaXyGU-.js";import{DiffViewer as ae}from"./diff-viewer-lctWoSmG.js";var v=e(t(),1),y=`ppm:branch-review`,b=`${y}:recent`,x=20;function oe(e,t,n){return`${y}:${e}:${t}:${n}`}function S(e,t){return e[t.path]===t.blob}function se(e,t){let n={...e};return S(e,t)?delete n[t.path]:n[t.path]=t.blob,n}function C(e,t,n){if(!n)return{};let r={...e};for(let e of t)r[e.path]=e.blob;return r}function w(e,t){return t.reduce((t,n)=>t+(S(e,n)?1:0),0)}function T(e,t){let n=new Set(t.map(e=>e.path)),r={};for(let[t,i]of Object.entries(e))n.has(t)&&(r[t]=i);return r}function E(e){return e.find(e=>!e.binary)??e[0]??null}function ce(e,t,n){if(t.length===0)return null;let r=n?t.findIndex(e=>e.path===n)+1:0;for(let n=0;n<t.length;n++){let i=t[(r+n)%t.length];if(i&&!S(e,i))return i}return null}function le(e){try{let t=localStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n))typeof t==`string`&&(r[e]=t);return r}catch{return{}}}function D(e,t,n=x){let r=[t,...e.filter(e=>e!==t)];return{recent:r.slice(0,n),evicted:r.slice(n)}}function O(){try{let e=JSON.parse(localStorage.getItem(b)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function k(e,t){try{if(Object.keys(t).length===0){localStorage.removeItem(e);let t=O().filter(t=>t!==e);localStorage.setItem(b,JSON.stringify(t));return}localStorage.setItem(e,JSON.stringify(t));let{recent:n,evicted:r}=D(O(),e);for(let e of r)localStorage.removeItem(e);localStorage.setItem(b,JSON.stringify(n))}catch{}}var A=n(),j={M:`text-warning`,A:`text-success`,D:`text-error`,R:`text-primary`,C:`text-accent-2`,T:`text-text-3`};function M({children:e}){return(0,A.jsx)(`span`,{dir:`rtl`,className:`truncate text-left min-w-0 flex-1`,children:(0,A.jsx)(`bdi`,{children:e})})}function N(e){let{node:t,depth:n,byPath:i,reviewed:o,selectedPath:s,collapsed:c,onToggleCollapse:l,onSelect:d,onToggleReviewed:f}=e,p=t.file?i.get(t.fullPath):void 0;if(!p){let i=c.has(t.fullPath);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,"data-testid":`branch-review-folder`,className:`w-full flex items-center gap-1 px-2 py-1 text-xs min-h-11 md:min-h-0 hover:bg-surface-hover text-left`,style:{paddingLeft:n*14+8},onClick:()=>l(t.fullPath),children:[i?(0,A.jsx)(a,{className:`size-3 shrink-0`}):(0,A.jsx)(r,{className:`size-3 shrink-0`}),(0,A.jsx)(`span`,{className:`truncate text-text-2`,children:t.name})]}),!i&&t.children.map(t=>(0,A.jsx)(N,{...e,node:t,depth:n+1},t.fullPath))]})}let h=S(o,p),g=s===p.path;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 pr-2 py-1 text-xs cursor-pointer border-l-2 min-h-11 md:min-h-0 hover:bg-surface-hover ${g?`bg-primary/10 border-primary`:`border-transparent`}`,style:{paddingLeft:n*14+6},onClick:()=>d(p.path),"aria-current":g?`true`:void 0,"data-testid":`branch-review-file`,"data-path":p.path,"data-selected":g?`true`:`false`,"data-reviewed":h?`true`:`false`,children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":h?`Mark ${p.path} unreviewed`:`Mark ${p.path} reviewed`,"data-testid":`branch-review-check`,className:`size-11 md:size-4 shrink-0 flex items-center justify-center`,onClick:e=>{e.stopPropagation(),f(p)},children:(0,A.jsx)(`span`,{"data-testid":`branch-review-check-box`,className:`size-4 rounded border flex items-center justify-center ${h?`bg-primary border-primary text-primary-foreground`:`border-border`}`,children:h&&(0,A.jsx)(u,{className:`size-3`})})}),(0,A.jsx)(m,{name:t.name,className:`size-3.5 shrink-0`}),(0,A.jsx)(M,{children:t.name}),(0,A.jsx)(`span`,{className:`shrink-0 font-mono ${j[p.status]}`,children:p.status}),p.binary?(0,A.jsx)(`span`,{className:`shrink-0 text-text-3 italic`,children:`bin`}):(0,A.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[10px]`,children:[(0,A.jsxs)(`span`,{className:`text-success`,children:[`+`,p.additions]}),` `,(0,A.jsxs)(`span`,{className:`text-error`,children:[`-`,p.deletions]})]})]})}function ue(e,t){let n=e.filter(e=>!e.remote&&e.name!==t);return n.find(e=>e.name===`main`)?.name??n.find(e=>e.name===`master`)?.name??n[0]?.name??``}function P({metadata:e}){let t=e?.projectName,n=ee(t),r=f(),[a,u]=(0,v.useState)([]),[m,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,D]=(0,v.useState)(null),[O,j]=(0,v.useState)(null),[P,F]=(0,v.useState)({}),[de,I]=(0,v.useState)(new Set),[L,R]=(0,v.useState)(!1),[z,B]=(0,v.useState)(null),[V,H]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!t||!n.repo)return;let e=!1;return d.get(n.gitUrl(`/branches`)).then(t=>{if(e)return;u(t);let n=t.find(e=>e.current)?.name;x(e=>e||n||``),y(e=>e||ue(t,n))}).catch(t=>!e&&B(t instanceof Error?t.message:`Could not list branches`)),()=>{e=!0}},[t,n]);let U=(0,v.useRef)(null),W=(0,v.useCallback)(async()=>{if(!t||!n.repo||!m||!b)return;U.current?.abort();let e=new AbortController;U.current=e,R(!0),B(null);try{let t=new URLSearchParams({base:m,head:b}),r=await d.get(n.gitUrl(`/branch-diff?${t}`),{signal:e.signal});if(e.signal.aborted)return;D(r),j(e=>e&&r.files.some(t=>t.path===e)?e:E(r.files)?.path??null)}catch(t){if(e.signal.aborted)return;D(null),B(t instanceof Error?t.message:`Could not compare these branches`)}finally{e.signal.aborted||R(!1)}},[t,n,m,b]);(0,v.useEffect)(()=>(W(),()=>U.current?.abort()),[W]);let G=t&&m&&b?oe(t,m,b):null;(0,v.useEffect)(()=>{I(new Set)},[G]),(0,v.useEffect)(()=>{F(G?le(G):{})},[G]);let K=S&&S.base===m&&S.head===b?S:null;(0,v.useEffect)(()=>{!G||!K||F(e=>{let t=T(e,K.files);return Object.keys(t).length!==Object.keys(e).length&&k(G,t),t})},[G,K]);let q=(0,v.useCallback)(e=>{F(e),G&&k(G,e)},[G]),J=K?.files??[],Y=(0,v.useMemo)(()=>new Map(J.map(e=>[e.path,e])),[J]),X=(0,v.useMemo)(()=>w(P,J),[P,J]),fe=(0,v.useMemo)(()=>ne(_(J.map(e=>({path:e.path,status:e.status===`T`?`M`:e.status})))),[J]),Z=O?Y.get(O)??null:null,Q=(0,v.useCallback)(()=>{let e=ce(P,J,O);e&&(j(e.path),H(!1))},[P,J,O]);if(n.noRepo)return(0,A.jsx)(te,{onReload:n.reload});if(n.needsPick)return(0,A.jsx)(ie,{repos:n.repos,onChoose:n.choose});let $=(0,A.jsx)(g,{className:`h-full`,children:(0,A.jsxs)(`div`,{className:`py-1`,children:[J.length===0&&!L&&(0,A.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-text-3`,children:z?`—`:`These branches have identical trees.`}),fe.map(e=>(0,A.jsx)(N,{node:e,depth:0,byPath:Y,reviewed:P,selectedPath:O,collapsed:de,onToggleCollapse:e=>I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:e=>{j(e),H(!1)},onToggleReviewed:e=>q(se(P,e))},e.fullPath)),!!K?.omitted&&(0,A.jsxs)(`div`,{className:`px-3 py-3 text-center text-xs text-text-3`,children:[K.omitted.toLocaleString(),` more `,K.omitted===1?`file`:`files`,` not listed.`]})]})});return(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-bg`,children:[n.isNested&&n.repo&&(0,A.jsx)(re,{repo:n.repo,repos:n.repos,onChoose:n.choose}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 border-b border-border shrink-0 flex-wrap`,children:[(0,A.jsx)(`select`,{value:m,onChange:e=>y(e.target.value),"aria-label":`Base branch`,"data-testid":`branch-review-base`,className:`h-7 max-w-[38%] rounded-md border border-border bg-panel px-2 text-xs min-w-0`,children:a.map(e=>(0,A.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,A.jsx)(s,{className:`size-3.5 text-text-3 shrink-0`}),(0,A.jsx)(`select`,{value:b,onChange:e=>x(e.target.value),"aria-label":`Branch to review`,"data-testid":`branch-review-head`,className:`h-7 max-w-[38%] rounded-md border border-border bg-panel px-2 text-xs min-w-0`,children:a.map(e=>(0,A.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,A.jsxs)(`span`,{className:`text-xs text-text-2 tabular-nums`,"data-testid":`branch-review-progress`,children:[X,`/`,J.length,` reviewed`]}),(0,A.jsx)(p,{variant:`ghost`,size:`icon-xs`,title:X===J.length&&J.length>0?`Clear all`:`Mark all reviewed`,disabled:J.length===0,onClick:()=>q(C(P,J,X!==J.length)),children:(0,A.jsx)(o,{className:`size-3.5`})}),(0,A.jsx)(p,{variant:`ghost`,size:`icon-xs`,title:`Reload`,onClick:()=>void W(),children:(0,A.jsx)(i,{className:L?`animate-spin`:``})})]})]}),z&&(0,A.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0`,children:z}),(0,A.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[!r&&(0,A.jsx)(`div`,{className:`w-72 shrink-0 border-r border-border flex flex-col min-h-0`,children:$}),(0,A.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col`,children:Z?(0,A.jsx)(ae,{metadata:{filePath:n.projectFile(Z.path),projectName:t,ref1:K?.mergeBase,ref2:K?.headCommit}},`${Z.path}:${K?.mergeBase}:${K?.headCommit}`):(0,A.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-3`,children:L?(0,A.jsx)(c,{className:`size-4 animate-spin`}):`Nothing to review.`})})]}),r&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border p-2 shrink-0`,children:[(0,A.jsxs)(p,{variant:`secondary`,size:`sm`,className:`flex-1 min-h-11`,onClick:()=>H(!0),children:[(0,A.jsx)(l,{className:`size-4`}),J.length,` files`]}),(0,A.jsx)(p,{variant:`secondary`,size:`sm`,className:`flex-1 min-h-11`,onClick:Q,children:`Next unreviewed`})]}),r&&(0,A.jsx)(h,{open:V,onClose:()=>H(!1),children:(0,A.jsx)(`div`,{className:`max-h-[70vh] overflow-hidden flex flex-col`,children:$})}),!r&&Z&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border px-2 py-1 shrink-0`,children:[(0,A.jsx)(M,{children:Z.path}),(0,A.jsx)(p,{variant:`ghost`,size:`xs`,onClick:Q,children:`Next unreviewed`})]})]})}export{P as BranchReviewTab};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import{t as e}from"./chat-tab-
|
|
1
|
+
import"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import{t as e}from"./chat-tab-DaEHva22.js";import"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import"./tab-store-DqeaGhhE.js";import"./context-menu-CjYTq8DI.js";import"./chat-preparation-cache-BSIQGiWx.js";import"./file-store-D9KE0kQC.js";import"./use-is-mobile-BClDZJP5.js";import"./onboarding-quick-orientation-DIhWv1CN.js";import"./button-Ci9EUgqd.js";import"./dialog-B8clVkyi.js";import"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import"./input-CG8PS8mS.js";import"./ws-auth-kXgsX2Js.js";import"./use-websocket-Chk9guIU.js";import"./api-settings-BmvNoCbn.js";import"./tool-cards-D0-krtA2.js";import"./use-blob-url-CmavyEP8.js";import"./libesm-DVoOUgb7.js";import"./onboarding-entry-CmUqv1kl.js";import"./use-open-team-member-B0eUOKKj.js";import"./send-to-chat-CyZ37y5J.js";import"./ai-settings-section-CEbW8jRy.js";import"./codex-reset-credit-button-CbmE5mRX.js";export{e as ChatTab};
|
|
Binary file
|
|
Binary file
|