@hienlh/ppm 0.23.11 → 0.23.12
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 +18 -0
- package/CLAUDE.md +13 -2
- 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 +37 -1
- package/bun.lock +34 -0
- package/dist/web/assets/accounts-settings-section-CGe5ikvs.js +1 -0
- package/dist/web/assets/accounts-settings-section-CGe5ikvs.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-CGe5ikvs.js.gz +0 -0
- package/dist/web/assets/{agent-session-sheet-CBMsnl_p.js → agent-session-sheet-vBhfHYrC.js} +2 -2
- package/dist/web/assets/agent-session-sheet-vBhfHYrC.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-vBhfHYrC.js.gz +0 -0
- package/dist/web/assets/{agent-session-window-content-D9C9FA7E.js → agent-session-window-content-BxIxDN5i.js} +1 -1
- package/dist/web/assets/agent-session-window-content-BxIxDN5i.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-BxIxDN5i.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-DhUVgDEG.js → ai-resource-editor-Y8clBPRv.js} +1 -1
- package/dist/web/assets/ai-resource-editor-Y8clBPRv.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-Y8clBPRv.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-DOckWvp4.js → ai-settings-section-BB8vscte.js} +1 -1
- package/dist/web/assets/{ai-settings-section-CETpSpYd.js → ai-settings-section-Ck8uN_Bw.js} +1 -1
- package/dist/web/assets/ai-settings-section-Ck8uN_Bw.js.br +0 -0
- package/dist/web/assets/ai-settings-section-Ck8uN_Bw.js.gz +0 -0
- package/dist/web/assets/android-tab-BIOUVVoW.js +2 -0
- package/dist/web/assets/android-tab-BIOUVVoW.js.br +0 -0
- package/dist/web/assets/android-tab-BIOUVVoW.js.gz +0 -0
- package/dist/web/assets/{api-settings-JIgKfcCx.js → api-settings-D1axn9vm.js} +1 -1
- package/dist/web/assets/{appearance-settings-section-BJUiLUb7.js → appearance-settings-section-Bv5_n9lH.js} +1 -1
- package/dist/web/assets/appearance-settings-section-Bv5_n9lH.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-Bv5_n9lH.js.gz +0 -0
- package/dist/web/assets/{apps-panel-1VElRgV3.js → apps-panel-DXHF0QEv.js} +1 -1
- package/dist/web/assets/apps-panel-DXHF0QEv.js.br +0 -0
- package/dist/web/assets/apps-panel-DXHF0QEv.js.gz +0 -0
- package/dist/web/assets/{audio-preview-DYkyHu5X.js → audio-preview-DpjOKEm4.js} +1 -1
- package/dist/web/assets/audio-preview-DpjOKEm4.js.br +0 -0
- package/dist/web/assets/audio-preview-DpjOKEm4.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-4dgMNadQ.js +1 -0
- package/dist/web/assets/branch-review-tab-4dgMNadQ.js.br +0 -0
- package/dist/web/assets/branch-review-tab-4dgMNadQ.js.gz +0 -0
- package/dist/web/assets/chat-tab-Bbe_77oJ.js +15 -0
- package/dist/web/assets/chat-tab-Bbe_77oJ.js.br +0 -0
- package/dist/web/assets/chat-tab-Bbe_77oJ.js.gz +0 -0
- package/dist/web/assets/chat-tab-D3i5O3dO.js +1 -0
- package/dist/web/assets/chat-tab-D3i5O3dO.js.br +0 -0
- package/dist/web/assets/chat-tab-D3i5O3dO.js.gz +0 -0
- package/dist/web/assets/code-editor-DXsIWoQ1.js +7 -0
- package/dist/web/assets/code-editor-DXsIWoQ1.js.br +0 -0
- package/dist/web/assets/code-editor-DXsIWoQ1.js.gz +0 -0
- package/dist/web/assets/{codex-reset-credit-button-Fr45FUxi.js → codex-reset-credit-button-DRhievFQ.js} +1 -1
- package/dist/web/assets/codex-reset-credit-button-DRhievFQ.js.br +0 -0
- package/dist/web/assets/codex-reset-credit-button-DRhievFQ.js.gz +0 -0
- package/dist/web/assets/{conflict-editor-B-wdjSXI.js → conflict-editor-D_RImo_V.js} +3 -3
- package/dist/web/assets/conflict-editor-D_RImo_V.js.br +0 -0
- package/dist/web/assets/conflict-editor-D_RImo_V.js.gz +0 -0
- package/dist/web/assets/{csv-preview-B6RodObB.js → csv-preview-BuFdfLo3.js} +1 -1
- package/dist/web/assets/csv-preview-BuFdfLo3.js.br +0 -0
- package/dist/web/assets/csv-preview-BuFdfLo3.js.gz +0 -0
- package/dist/web/assets/{database-viewer-CdPBUQPY.js → database-viewer-ChcbYn9E.js} +1 -1
- package/dist/web/assets/database-viewer-ChcbYn9E.js.br +0 -0
- package/dist/web/assets/database-viewer-ChcbYn9E.js.gz +0 -0
- package/dist/web/assets/{design-settings-section-BpCpaBwL.js → design-settings-section-B_xOf51h.js} +1 -1
- package/dist/web/assets/design-settings-section-B_xOf51h.js.br +0 -0
- package/dist/web/assets/design-settings-section-B_xOf51h.js.gz +0 -0
- package/dist/web/assets/{design-skill-suggestion-DkT2E2IV.js → design-skill-suggestion-BbEDg15Z.js} +1 -1
- package/dist/web/assets/design-skill-suggestion-BbEDg15Z.js.br +0 -0
- package/dist/web/assets/design-skill-suggestion-BbEDg15Z.js.gz +0 -0
- package/dist/web/assets/{design-tab-BZb9eemI.js → design-tab-BQSYJ4cS.js} +6 -6
- package/dist/web/assets/design-tab-BQSYJ4cS.js.br +0 -0
- package/dist/web/assets/design-tab-BQSYJ4cS.js.gz +0 -0
- package/dist/web/assets/{designs-sidebar-panel-CF4tp6j-.js → designs-sidebar-panel-AiPaYfSU.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-AiPaYfSU.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-AiPaYfSU.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-BqEqwSw6.js → diff-viewer-BZ6glGK-.js} +1 -1
- package/dist/web/assets/diff-viewer-BZ6glGK-.js.br +0 -0
- package/dist/web/assets/diff-viewer-BZ6glGK-.js.gz +0 -0
- package/dist/web/assets/{edit-diff-preview-DD4HayXY.js → edit-diff-preview-D-FNLOU2.js} +1 -1
- package/dist/web/assets/edit-diff-preview-D-FNLOU2.js.br +0 -0
- package/dist/web/assets/edit-diff-preview-D-FNLOU2.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-CkA5sEdV.js → editor-language-service-4sbsdqBV.js} +1 -1
- package/dist/web/assets/editor-language-service-4sbsdqBV.js.br +0 -0
- package/dist/web/assets/editor-language-service-4sbsdqBV.js.gz +0 -0
- package/dist/web/assets/explorer-body-DbgrG1fe.js +2 -0
- package/dist/web/assets/explorer-body-DbgrG1fe.js.br +0 -0
- package/dist/web/assets/explorer-body-DbgrG1fe.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-CRJ2eMZ4.js → explorer-window-content-BCjWvHpp.js} +1 -1
- package/dist/web/assets/explorer-window-content-BCjWvHpp.js.br +0 -0
- package/dist/web/assets/explorer-window-content-BCjWvHpp.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-DwQTdCII.js → extension-manager-section-DiMF4RnT.js} +1 -1
- package/dist/web/assets/extension-manager-section-DiMF4RnT.js.br +0 -0
- package/dist/web/assets/extension-manager-section-DiMF4RnT.js.gz +0 -0
- package/dist/web/assets/{extension-webview-CMq-VTLu.js → extension-webview-Coti6Vfw.js} +1 -1
- package/dist/web/assets/extension-webview-Coti6Vfw.js.br +0 -0
- package/dist/web/assets/extension-webview-Coti6Vfw.js.gz +0 -0
- package/dist/web/assets/file-store-Cm7-pHux.js +1 -0
- package/dist/web/assets/file-store-Cm7-pHux.js.br +0 -0
- package/dist/web/assets/file-store-Cm7-pHux.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-B2lcyh-6.js → files-settings-section-ZTVwOwx0.js} +1 -1
- package/dist/web/assets/files-settings-section-ZTVwOwx0.js.br +0 -0
- package/dist/web/assets/files-settings-section-ZTVwOwx0.js.gz +0 -0
- package/dist/web/assets/{general-settings-section-Doepm2sH.js → general-settings-section-B7Hjx_fb.js} +1 -1
- package/dist/web/assets/general-settings-section-B7Hjx_fb.js.br +0 -0
- package/dist/web/assets/general-settings-section-B7Hjx_fb.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-CJakNMDc.js → git-log-panel-CbcJ_YEH.js} +1 -1
- package/dist/web/assets/git-log-panel-CbcJ_YEH.js.br +0 -0
- package/dist/web/assets/git-log-panel-CbcJ_YEH.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-C_SeOhSq.js → glide-data-grid-BfByGSf1.js} +3 -3
- package/dist/web/assets/glide-data-grid-BfByGSf1.js.br +0 -0
- package/dist/web/assets/glide-data-grid-BfByGSf1.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-DCo9OP3D.js +1 -0
- package/dist/web/assets/group-chat-tab-DCo9OP3D.js.br +0 -0
- package/dist/web/assets/group-chat-tab-DCo9OP3D.js.gz +0 -0
- package/dist/web/assets/{image-preview-C1Frlx22.js → image-preview-Cjlps7Pt.js} +1 -1
- package/dist/web/assets/index-CyDLBddf.js +52 -0
- package/dist/web/assets/index-CyDLBddf.js.br +0 -0
- package/dist/web/assets/index-CyDLBddf.js.gz +0 -0
- package/dist/web/assets/index-Dh5apC3I.css +1 -0
- package/dist/web/assets/index-Dh5apC3I.css.br +0 -0
- package/dist/web/assets/index-Dh5apC3I.css.gz +0 -0
- package/dist/web/assets/{jira-watcher-section-BmkIGQFV.js → jira-watcher-section-Dz_-sUC2.js} +1 -1
- package/dist/web/assets/keybindings-store-BTq5Z7XP.js +1 -0
- package/dist/web/assets/{keyboard-shortcuts-section-BgZe3QDr.js → keyboard-shortcuts-section-Ba5NYwlG.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-Ba5NYwlG.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-Ba5NYwlG.js.gz +0 -0
- package/dist/web/assets/{language-servers-section-CCMzgOaE.js → language-servers-section-DJJ7SFXo.js} +2 -2
- package/dist/web/assets/language-servers-section-DJJ7SFXo.js.br +0 -0
- package/dist/web/assets/language-servers-section-DJJ7SFXo.js.gz +0 -0
- package/dist/web/assets/{lsp-client-B10suuaZ.js → lsp-client-Dr3vQ1bb.js} +1 -1
- package/dist/web/assets/lsp-client-Dr3vQ1bb.js.br +0 -0
- package/dist/web/assets/lsp-client-Dr3vQ1bb.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-AHHFS3jc.js → markdown-renderer-CmnqFfTU.js} +3 -3
- package/dist/web/assets/markdown-renderer-CmnqFfTU.js.br +0 -0
- package/dist/web/assets/markdown-renderer-CmnqFfTU.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-LJdVMbGl.js +1 -0
- package/dist/web/assets/{mobile-explorer-sheet-CqCsLWSr.js → mobile-explorer-sheet-BiIhZtJ2.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-BiIhZtJ2.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-BiIhZtJ2.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-DI_hxvFV.js +1 -0
- package/dist/web/assets/new-design-dialog-DI_hxvFV.js.br +0 -0
- package/dist/web/assets/new-design-dialog-DI_hxvFV.js.gz +0 -0
- package/dist/web/assets/notification-store-9lBSplOV.js +1 -0
- package/dist/web/assets/{notifications-settings-section-CXgzH_bK.js → notifications-settings-section-0s-2OKRv.js} +1 -1
- package/dist/web/assets/notifications-settings-section-0s-2OKRv.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-0s-2OKRv.js.gz +0 -0
- package/dist/web/assets/{overview-panel-BYB8mgRE.js → overview-panel-3htxfZS2.js} +1 -1
- package/dist/web/assets/overview-panel-3htxfZS2.js.br +0 -0
- package/dist/web/assets/overview-panel-3htxfZS2.js.gz +0 -0
- package/dist/web/assets/panel-store-B6PoCwBA.js +1 -0
- package/dist/web/assets/panel-store-B6PoCwBA.js.br +0 -0
- package/dist/web/assets/panel-store-B6PoCwBA.js.gz +0 -0
- package/dist/web/assets/{performance-panel-Dpuq3g0W.js → performance-panel-V8gpnnf7.js} +2 -2
- package/dist/web/assets/performance-panel-V8gpnnf7.js.br +0 -0
- package/dist/web/assets/performance-panel-V8gpnnf7.js.gz +0 -0
- package/dist/web/assets/{postgres-viewer-DW0Gkmow.js → postgres-viewer-sWS-ogTC.js} +1 -1
- package/dist/web/assets/postgres-viewer-sWS-ogTC.js.br +0 -0
- package/dist/web/assets/postgres-viewer-sWS-ogTC.js.gz +0 -0
- package/dist/web/assets/{ppmbot-settings-section-DFtlGoW6.js → ppmbot-settings-section-CT8vvlzk.js} +1 -1
- package/dist/web/assets/ppmbot-settings-section-CT8vvlzk.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-CT8vvlzk.js.gz +0 -0
- package/dist/web/assets/{pptx-export-CNyG32Xr.js → pptx-export-Ugjv0hso.js} +4 -4
- package/dist/web/assets/pptx-export-Ugjv0hso.js.br +0 -0
- package/dist/web/assets/pptx-export-Ugjv0hso.js.gz +0 -0
- package/dist/web/assets/{problems-panel-V5zqpuXq.js → problems-panel-Gcy79pSS.js} +1 -1
- package/dist/web/assets/problems-panel-Gcy79pSS.js.br +0 -0
- package/dist/web/assets/problems-panel-Gcy79pSS.js.gz +0 -0
- package/dist/web/assets/{process-row-format-CiJJSf_V.js → process-row-format-u6y7lOee.js} +1 -1
- package/dist/web/assets/process-table-BUTIp9Oy.js +1 -0
- package/dist/web/assets/process-table-BUTIp9Oy.js.br +0 -0
- package/dist/web/assets/process-table-BUTIp9Oy.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-B7AVlTfY.js → proxy-settings-section-Buv_8y54.js} +1 -1
- package/dist/web/assets/proxy-settings-section-Buv_8y54.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-Buv_8y54.js.gz +0 -0
- package/dist/web/assets/{query-audit-section-gHmRfWKr.js → query-audit-section-N2DQtgJx.js} +1 -1
- package/dist/web/assets/query-audit-section-N2DQtgJx.js.br +0 -0
- package/dist/web/assets/query-audit-section-N2DQtgJx.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-CRvJqmaz.js +1 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-CRvJqmaz.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-CRvJqmaz.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BoYINLbJ.js +2 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BoYINLbJ.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BoYINLbJ.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DPdP0yYu.js +1 -0
- package/dist/web/assets/remote-desktop-mobile-view-DPdP0yYu.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DPdP0yYu.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-BeQ_Jrp7.js +1 -0
- package/dist/web/assets/remote-desktop-readiness-gate-BeQ_Jrp7.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-BeQ_Jrp7.js.gz +0 -0
- package/dist/web/assets/remote-desktop-settings-section-Bs4sHS3l.js +1 -0
- package/dist/web/assets/remote-desktop-settings-section-Bs4sHS3l.js.br +0 -0
- package/dist/web/assets/remote-desktop-settings-section-Bs4sHS3l.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-DDr__JxQ.js +1 -0
- package/dist/web/assets/remote-desktop-window-content-DDr__JxQ.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-DDr__JxQ.js.gz +0 -0
- package/dist/web/assets/{run-in-terminal-DKBcEGVu.js → run-in-terminal-DCBNtYHQ.js} +1 -1
- package/dist/web/assets/{schedules-settings-section-sYDAsBMO.js → schedules-settings-section-_cHX2qOa.js} +1 -1
- package/dist/web/assets/schedules-settings-section-_cHX2qOa.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-_cHX2qOa.js.gz +0 -0
- package/dist/web/assets/{send-to-chat-CCdOrKc7.js → send-to-chat-dNqNV7Y4.js} +1 -1
- package/dist/web/assets/send-to-chat-dNqNV7Y4.js.br +0 -0
- package/dist/web/assets/send-to-chat-dNqNV7Y4.js.gz +0 -0
- package/dist/web/assets/{services-panel-CKa2aP1d.js → services-panel-Dm54cnW3.js} +1 -1
- package/dist/web/assets/services-panel-Dm54cnW3.js.br +0 -0
- package/dist/web/assets/services-panel-Dm54cnW3.js.gz +0 -0
- package/dist/web/assets/settings-body-DRRQNaDA.js +1 -0
- package/dist/web/assets/settings-body-DRRQNaDA.js.br +0 -0
- package/dist/web/assets/settings-body-DRRQNaDA.js.gz +0 -0
- package/dist/web/assets/settings-section-content-DRaHfvm8.js +1 -0
- package/dist/web/assets/settings-section-content-U3mIx6hF.js +2 -0
- package/dist/web/assets/settings-section-content-U3mIx6hF.js.br +0 -0
- package/dist/web/assets/settings-section-content-U3mIx6hF.js.gz +0 -0
- package/dist/web/assets/{settings-store-DfuiLq_9.js → settings-store-Cyuo8ceh.js} +2 -2
- package/dist/web/assets/settings-store-Cyuo8ceh.js.br +0 -0
- package/dist/web/assets/settings-store-Cyuo8ceh.js.gz +0 -0
- package/dist/web/assets/settings-tab-CB_BhHTK.js +1 -0
- package/dist/web/assets/settings-window-content-CgZIMNX8.js +1 -0
- package/dist/web/assets/{slash-command-picker-CLevA_Gf.js → slash-command-picker-CQlIqMW0.js} +1 -1
- package/dist/web/assets/slash-command-picker-CQlIqMW0.js.br +0 -0
- package/dist/web/assets/slash-command-picker-CQlIqMW0.js.gz +0 -0
- package/dist/web/assets/{sql-query-editor-Db8b0jEr.js → sql-query-editor--Z4bcqd8.js} +1 -1
- package/dist/web/assets/sql-query-editor--Z4bcqd8.js.br +0 -0
- package/dist/web/assets/sql-query-editor--Z4bcqd8.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-VzYLMqkD.js → sqlite-viewer-CSmX3qaj.js} +1 -1
- package/dist/web/assets/sqlite-viewer-CSmX3qaj.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-CSmX3qaj.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-BR60W_mG.js → system-monitor-body-LannpU6H.js} +2 -2
- package/dist/web/assets/system-monitor-body-LannpU6H.js.br +0 -0
- package/dist/web/assets/system-monitor-body-LannpU6H.js.gz +0 -0
- package/dist/web/assets/system-monitor-tab-BfVucwEF.js +1 -0
- package/dist/web/assets/{system-monitor-window-content-BLw1QBXo.js → system-monitor-window-content-kLNW9Ln3.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-BL61SB5m.js → tab-host-window-content-II_FtOYM.js} +1 -1
- package/dist/web/assets/tab-host-window-content-II_FtOYM.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-II_FtOYM.js.gz +0 -0
- package/dist/web/assets/{tab-store-CbPh8CAX.js → tab-store-DCpc0g0Q.js} +1 -1
- package/dist/web/assets/{terminal-tab-B4y6at4h.js → terminal-tab-CTe2polt.js} +1 -1
- package/dist/web/assets/terminal-tab-CTe2polt.js.br +0 -0
- package/dist/web/assets/terminal-tab-CTe2polt.js.gz +0 -0
- package/dist/web/assets/{tool-cards-K0r_yxI0.js → tool-cards-rxLXbBSm.js} +5 -5
- package/dist/web/assets/tool-cards-rxLXbBSm.js.br +0 -0
- package/dist/web/assets/tool-cards-rxLXbBSm.js.gz +0 -0
- package/dist/web/assets/use-h264-canvas-decoder-BfO9QrlH.js +1 -0
- package/dist/web/assets/use-h264-canvas-decoder-BfO9QrlH.js.br +0 -0
- package/dist/web/assets/use-h264-canvas-decoder-BfO9QrlH.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-BK23icsE.js → use-inline-blame-CxZ_QWzS.js} +3 -3
- package/dist/web/assets/use-inline-blame-CxZ_QWzS.js.br +0 -0
- package/dist/web/assets/use-inline-blame-CxZ_QWzS.js.gz +0 -0
- package/dist/web/assets/{use-lsp-CRdCPCKW.js → use-lsp-gCNE5A9K.js} +1 -1
- package/dist/web/assets/use-lsp-gCNE5A9K.js.br +0 -0
- package/dist/web/assets/use-lsp-gCNE5A9K.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-CpXT2uh3.js → use-monaco-theme-DvNGcCvz.js} +1 -1
- package/dist/web/assets/{use-process-kill-BWYX03KF.js → use-process-kill-Cbiu1mbY.js} +1 -1
- package/dist/web/assets/use-process-kill-Cbiu1mbY.js.br +0 -0
- package/dist/web/assets/use-process-kill-Cbiu1mbY.js.gz +0 -0
- package/dist/web/assets/{use-websocket-CiWQKhHr.js → use-websocket-AC7EG1LK.js} +1 -1
- package/dist/web/assets/video-preview-C2Y61WUE.js +1 -0
- package/dist/web/assets/video-preview-C2Y61WUE.js.br +0 -0
- package/dist/web/assets/video-preview-C2Y61WUE.js.gz +0 -0
- package/dist/web/assets/{voice-settings-section-Ceihggqf.js → voice-settings-section-DCXZeLYI.js} +1 -1
- package/dist/web/assets/voice-settings-section-DCXZeLYI.js.br +0 -0
- package/dist/web/assets/voice-settings-section-DCXZeLYI.js.gz +0 -0
- package/dist/web/assets/{window-pip-registry-mDgwpAwP.js → window-pip-registry-9Y9LQQYS.js} +1 -1
- package/dist/web/index.html +50 -7
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/dist/web/sw.js +1 -1
- package/dist/web/sw.js.br +0 -0
- package/dist/web/sw.js.gz +0 -0
- package/docs/architecture/android-emulator-phase0-report-260921.md +310 -0
- package/docs/architecture/android-emulator-phase2-report-260921.md +163 -0
- package/docs/architecture/android-emulator-phase3-report-260921.md +203 -0
- package/docs/architecture/android-emulator-phase4-report-260921.md +191 -0
- package/docs/architecture/android-emulator-plan-260920.md +376 -0
- package/docs/architecture/plugins-and-tracing.md +48 -7
- package/package.json +4 -2
- package/scripts/gen-android-proto.ts +37 -0
- package/scripts/release.sh +3 -1
- package/src/cli/commands/chat-cmd.ts +2 -2
- package/src/providers/claude-agent-sdk-query-options.ts +28 -0
- package/src/providers/claude-agent-sdk.ts +153 -71
- package/src/providers/claude-warm-spare.ts +176 -0
- package/src/providers/provider.interface.ts +1 -0
- package/src/server/index.ts +53 -0
- package/src/server/middleware/gzip-json.ts +13 -1
- package/src/server/routes/android.ts +616 -0
- package/src/server/routes/chat.ts +31 -0
- package/src/server/routes/files.ts +52 -5
- package/src/server/routes/remote-desktop.ts +95 -2
- package/src/server/routes/trace.ts +66 -0
- package/src/server/ws/android.ts +101 -0
- package/src/server/ws/chat.ts +12 -17
- package/src/server/ws/global.ts +13 -1
- package/src/server/ws/remote-desktop.ts +6 -1
- package/src/services/android/android-apk.ts +387 -0
- package/src/services/android/android-capabilities.ts +154 -0
- package/src/services/android/android-flag.ts +12 -0
- package/src/services/android/android-grpc.ts +124 -0
- package/src/services/android/android-input.ts +129 -0
- package/src/services/android/android-logcat.ts +169 -0
- package/src/services/android/android-nonce.ts +50 -0
- package/src/services/android/android-operations.ts +124 -0
- package/src/services/android/android-screenshot.ts +53 -0
- package/src/services/android/android-session.ts +510 -0
- package/src/services/android/android-video.ts +495 -0
- package/src/services/android/avd-list.ts +131 -0
- package/src/services/android/avd-manager.ts +397 -0
- package/src/services/android/device-registry.ts +223 -0
- package/src/services/android/emulator-discovery.ts +160 -0
- package/src/services/android/emulator-launcher.ts +290 -0
- package/src/services/android/proto/emulator-controller-descriptor.ts +10 -0
- package/src/services/android/proto/emulator_controller.proto +1791 -0
- package/src/services/android/sdk-discovery.ts +178 -0
- package/src/services/android/system-images.ts +124 -0
- package/src/services/chat.service.ts +81 -4
- package/src/services/config.service.ts +1 -1
- package/src/services/file-filter.service.ts +2 -61
- package/src/services/file-glob.ts +67 -0
- package/src/services/file-index/file-index-runner.ts +169 -0
- package/src/services/file-index/file-index-worker.ts +73 -0
- package/src/services/file-index/index-search.ts +152 -0
- package/src/services/file-index/index-walk.ts +109 -0
- package/src/services/file-list-index.service.ts +189 -70
- package/src/services/file-watcher/linux-inotify.ts +238 -0
- package/src/services/file-watcher/watch-tree.ts +37 -6
- package/src/services/file-watcher.service.ts +40 -8
- package/src/services/file.service.ts +17 -6
- package/src/services/group-chat/group-chat.service.ts +1 -1
- package/src/services/jira-debug-session.service.ts +1 -1
- package/src/services/ppmbot/ppmbot-delegation.ts +1 -1
- package/src/services/ppmbot/ppmbot-service.ts +1 -1
- package/src/services/project-content-search.service.ts +45 -11
- package/src/services/proxy-agent-turn.ts +7 -3
- package/src/services/remote-desktop/mediamtx-catalog.ts +89 -0
- package/src/services/remote-desktop/mediamtx-config.ts +91 -0
- package/src/services/remote-desktop/mediamtx-install.service.ts +191 -0
- package/src/services/remote-desktop/mediamtx-paths.ts +51 -0
- package/src/services/remote-desktop/mediamtx-process.ts +152 -0
- package/src/services/remote-desktop/remote-desktop-capture-wayland.ts +312 -0
- package/src/services/remote-desktop/remote-desktop-capture.ts +60 -4
- package/src/services/remote-desktop/remote-desktop-portal.ts +529 -0
- package/src/services/remote-desktop/remote-desktop-requirements.ts +56 -20
- package/src/services/remote-desktop/remote-desktop-session.ts +77 -3
- package/src/services/remote-desktop/remote-desktop-whep-registry.ts +36 -0
- package/src/services/scheduler-runner.ts +2 -3
- package/src/services/session-trace/browser-trace-ingest.ts +131 -0
- package/src/services/session-trace/session-trace-cleanup.ts +65 -0
- package/src/services/session-trace/session-trace-db.ts +89 -0
- package/src/services/session-trace/session-trace-store.ts +132 -0
- package/src/services/session-trace/trace-coalescer.ts +86 -0
- package/src/services/session-trace/trace-recorder.ts +304 -0
- package/src/services/session-trace/trace-writer.ts +83 -0
- package/src/shared/android-avd.ts +53 -0
- package/src/shared/android-protocol.ts +184 -0
- package/src/shared/file-index-limits.ts +17 -0
- package/src/shared/session-trace.ts +61 -0
- package/src/types/chat.ts +17 -0
- package/src/types/config.ts +27 -0
- package/src/types/project.ts +9 -0
- package/src/web/app.tsx +5 -0
- package/src/web/components/android/android-apk-upload.ts +75 -0
- package/src/web/components/android/android-avd-create-dialog.tsx +305 -0
- package/src/web/components/android/android-avd-destroy-dialog.tsx +151 -0
- package/src/web/components/android/android-clipboard-panel.tsx +94 -0
- package/src/web/components/android/android-controls.tsx +128 -0
- package/src/web/components/android/android-coords.ts +99 -0
- package/src/web/components/android/android-device-list.tsx +329 -0
- package/src/web/components/android/android-install-panel.tsx +280 -0
- package/src/web/components/android/android-log-filter.ts +75 -0
- package/src/web/components/android/android-logcat-panel.tsx +214 -0
- package/src/web/components/android/android-screenshot-download.ts +56 -0
- package/src/web/components/android/android-tab.tsx +66 -0
- package/src/web/components/android/android-tools-drawer.tsx +76 -0
- package/src/web/components/android/android-viewer.tsx +200 -0
- package/src/web/components/android/android-ws-url.ts +21 -0
- package/src/web/components/android/open-android.ts +21 -0
- package/src/web/components/android/use-android-available.ts +29 -0
- package/src/web/components/android/use-android-keyboard.ts +111 -0
- package/src/web/components/android/use-android-session.ts +277 -0
- package/src/web/components/android/use-android-touch.ts +123 -0
- package/src/web/components/chat/chat-tab.tsx +28 -2
- package/src/web/components/chat/message-input.tsx +3 -5
- package/src/web/components/editor/compare-picker.tsx +12 -2
- package/src/web/components/explorer/file-tree.tsx +6 -7
- package/src/web/components/explorer/use-tree-row-dnd.ts +0 -2
- package/src/web/components/floating-window/window-content-registry.ts +8 -8
- package/src/web/components/layout/command-palette.tsx +31 -9
- package/src/web/components/layout/mobile-drawer.tsx +8 -1
- package/src/web/components/layout/nav-section-rail.tsx +8 -1
- package/src/web/components/layout/reparenting-tab.tsx +2 -2
- package/src/web/components/layout/tab-content.tsx +5 -0
- package/src/web/components/layout/tab-pool.tsx +31 -20
- package/src/web/components/remote-desktop/use-h264-canvas-decoder.ts +23 -1
- package/src/web/components/remote-desktop/use-remote-desktop-connection.ts +64 -6
- package/src/web/components/remote-desktop/use-webrtc-canvas-video.ts +255 -0
- package/src/web/components/root-error-boundary.tsx +5 -0
- package/src/web/components/settings/remote-desktop-settings-section.tsx +176 -0
- package/src/web/components/settings/settings-categories.ts +3 -0
- package/src/web/components/settings/settings-section-content.tsx +25 -18
- package/src/web/hooks/use-chat-prewarm.ts +53 -0
- package/src/web/hooks/use-chat.ts +18 -4
- package/src/web/hooks/use-file-index-invalidation.ts +7 -5
- package/src/web/hooks/use-global-events.ts +12 -1
- package/src/web/hooks/use-remote-file-search.ts +39 -0
- package/src/web/hooks/use-ui-preload.ts +38 -0
- package/src/web/index.html +43 -0
- package/src/web/lib/chunk-recovery.ts +5 -1
- package/src/web/lib/device-id.ts +39 -0
- package/src/web/lib/feature-badges.ts +2 -0
- package/src/web/lib/lazy-with-preload.tsx +43 -0
- package/src/web/lib/preload-ui.ts +60 -0
- package/src/web/lib/score-file-search.ts +27 -14
- package/src/web/lib/tab-type-icons.ts +2 -1
- package/src/web/lib/trace-boot.ts +8 -0
- package/src/web/lib/trace-client.ts +516 -0
- package/src/web/main.tsx +12 -0
- package/src/web/stores/file-store.ts +124 -18
- package/src/web/stores/panel-utils.ts +3 -0
- package/src/web/stores/tab-store.ts +2 -1
- package/src/web/stores/window-panel-persistence.ts +3 -0
- package/vite.config.ts +3 -0
- package/dist/web/assets/accounts-settings-section-DEIm-W-D.js +0 -1
- package/dist/web/assets/accounts-settings-section-DEIm-W-D.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-DEIm-W-D.js.gz +0 -0
- package/dist/web/assets/agent-session-sheet-CBMsnl_p.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-CBMsnl_p.js.gz +0 -0
- package/dist/web/assets/agent-session-window-content-D9C9FA7E.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-D9C9FA7E.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-DhUVgDEG.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-DhUVgDEG.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-CETpSpYd.js.br +0 -0
- package/dist/web/assets/ai-settings-section-CETpSpYd.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-BJUiLUb7.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-BJUiLUb7.js.gz +0 -0
- package/dist/web/assets/apps-panel-1VElRgV3.js.br +0 -0
- package/dist/web/assets/apps-panel-1VElRgV3.js.gz +0 -0
- package/dist/web/assets/audio-preview-DYkyHu5X.js.br +0 -0
- package/dist/web/assets/audio-preview-DYkyHu5X.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-DhTMSpSU.js +0 -1
- package/dist/web/assets/branch-review-tab-DhTMSpSU.js.br +0 -0
- package/dist/web/assets/branch-review-tab-DhTMSpSU.js.gz +0 -0
- package/dist/web/assets/chat-tab-Cg3BKugo.js +0 -15
- package/dist/web/assets/chat-tab-Cg3BKugo.js.br +0 -0
- package/dist/web/assets/chat-tab-Cg3BKugo.js.gz +0 -0
- package/dist/web/assets/chat-tab-tbUDK__Y.js +0 -1
- package/dist/web/assets/chat-tab-tbUDK__Y.js.br +0 -0
- package/dist/web/assets/chat-tab-tbUDK__Y.js.gz +0 -0
- package/dist/web/assets/code-editor-6ZiQehbr.js +0 -7
- package/dist/web/assets/code-editor-6ZiQehbr.js.br +0 -0
- package/dist/web/assets/code-editor-6ZiQehbr.js.gz +0 -0
- package/dist/web/assets/codex-reset-credit-button-Fr45FUxi.js.br +0 -0
- package/dist/web/assets/codex-reset-credit-button-Fr45FUxi.js.gz +0 -0
- package/dist/web/assets/conflict-editor-B-wdjSXI.js.br +0 -0
- package/dist/web/assets/conflict-editor-B-wdjSXI.js.gz +0 -0
- package/dist/web/assets/csv-preview-B6RodObB.js.br +0 -0
- package/dist/web/assets/csv-preview-B6RodObB.js.gz +0 -0
- package/dist/web/assets/database-viewer-CdPBUQPY.js.br +0 -0
- package/dist/web/assets/database-viewer-CdPBUQPY.js.gz +0 -0
- package/dist/web/assets/design-settings-section-BpCpaBwL.js.br +0 -0
- package/dist/web/assets/design-settings-section-BpCpaBwL.js.gz +0 -0
- package/dist/web/assets/design-skill-suggestion-DkT2E2IV.js.br +0 -0
- package/dist/web/assets/design-skill-suggestion-DkT2E2IV.js.gz +0 -0
- package/dist/web/assets/design-tab-BZb9eemI.js.br +0 -0
- package/dist/web/assets/design-tab-BZb9eemI.js.gz +0 -0
- package/dist/web/assets/designs-sidebar-panel-CF4tp6j-.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-CF4tp6j-.js.gz +0 -0
- package/dist/web/assets/diff-viewer-BqEqwSw6.js.br +0 -0
- package/dist/web/assets/diff-viewer-BqEqwSw6.js.gz +0 -0
- package/dist/web/assets/edit-diff-preview-DD4HayXY.js.br +0 -0
- package/dist/web/assets/edit-diff-preview-DD4HayXY.js.gz +0 -0
- package/dist/web/assets/editor-language-service-CkA5sEdV.js.br +0 -0
- package/dist/web/assets/editor-language-service-CkA5sEdV.js.gz +0 -0
- package/dist/web/assets/explorer-body-Ds7oKuz7.js +0 -2
- package/dist/web/assets/explorer-body-Ds7oKuz7.js.br +0 -0
- package/dist/web/assets/explorer-body-Ds7oKuz7.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-CRJ2eMZ4.js.br +0 -0
- package/dist/web/assets/explorer-window-content-CRJ2eMZ4.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-DwQTdCII.js.br +0 -0
- package/dist/web/assets/extension-manager-section-DwQTdCII.js.gz +0 -0
- package/dist/web/assets/extension-webview-CMq-VTLu.js.br +0 -0
- package/dist/web/assets/extension-webview-CMq-VTLu.js.gz +0 -0
- package/dist/web/assets/file-store-DY1_0nzY.js +0 -1
- package/dist/web/assets/file-store-DY1_0nzY.js.br +0 -0
- package/dist/web/assets/file-store-DY1_0nzY.js.gz +0 -0
- package/dist/web/assets/files-settings-section-B2lcyh-6.js.br +0 -0
- package/dist/web/assets/files-settings-section-B2lcyh-6.js.gz +0 -0
- package/dist/web/assets/general-settings-section-Doepm2sH.js.br +0 -0
- package/dist/web/assets/general-settings-section-Doepm2sH.js.gz +0 -0
- package/dist/web/assets/git-log-panel-CJakNMDc.js.br +0 -0
- package/dist/web/assets/git-log-panel-CJakNMDc.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-C_SeOhSq.js.br +0 -0
- package/dist/web/assets/glide-data-grid-C_SeOhSq.js.gz +0 -0
- package/dist/web/assets/group-chat-tab--by1xCQW.js +0 -1
- package/dist/web/assets/group-chat-tab--by1xCQW.js.br +0 -0
- package/dist/web/assets/group-chat-tab--by1xCQW.js.gz +0 -0
- package/dist/web/assets/index-DhWjx5iR.js +0 -52
- package/dist/web/assets/index-DhWjx5iR.js.br +0 -0
- package/dist/web/assets/index-DhWjx5iR.js.gz +0 -0
- package/dist/web/assets/index-oIvYSKTT.css +0 -1
- package/dist/web/assets/index-oIvYSKTT.css.br +0 -0
- package/dist/web/assets/index-oIvYSKTT.css.gz +0 -0
- package/dist/web/assets/keybindings-store-30LYZU0l.js +0 -1
- package/dist/web/assets/keyboard-shortcuts-section-BgZe3QDr.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-BgZe3QDr.js.gz +0 -0
- package/dist/web/assets/language-servers-section-CCMzgOaE.js.br +0 -0
- package/dist/web/assets/language-servers-section-CCMzgOaE.js.gz +0 -0
- package/dist/web/assets/lsp-client-B10suuaZ.js.br +0 -0
- package/dist/web/assets/lsp-client-B10suuaZ.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-AHHFS3jc.js.br +0 -0
- package/dist/web/assets/markdown-renderer-AHHFS3jc.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-DxnXtBoj.js +0 -1
- package/dist/web/assets/mobile-explorer-sheet-CqCsLWSr.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-CqCsLWSr.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-B9tgnQXq.js +0 -1
- package/dist/web/assets/new-design-dialog-B9tgnQXq.js.br +0 -0
- package/dist/web/assets/new-design-dialog-B9tgnQXq.js.gz +0 -0
- package/dist/web/assets/notification-store-HUVzO_bp.js +0 -1
- package/dist/web/assets/notifications-settings-section-CXgzH_bK.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-CXgzH_bK.js.gz +0 -0
- package/dist/web/assets/overview-panel-BYB8mgRE.js.br +0 -0
- package/dist/web/assets/overview-panel-BYB8mgRE.js.gz +0 -0
- package/dist/web/assets/panel-store-CWHPmHwj.js +0 -1
- package/dist/web/assets/panel-store-CWHPmHwj.js.br +0 -0
- package/dist/web/assets/panel-store-CWHPmHwj.js.gz +0 -0
- package/dist/web/assets/performance-panel-Dpuq3g0W.js.br +0 -0
- package/dist/web/assets/performance-panel-Dpuq3g0W.js.gz +0 -0
- package/dist/web/assets/postgres-viewer-DW0Gkmow.js.br +0 -0
- package/dist/web/assets/postgres-viewer-DW0Gkmow.js.gz +0 -0
- package/dist/web/assets/ppmbot-settings-section-DFtlGoW6.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-DFtlGoW6.js.gz +0 -0
- package/dist/web/assets/pptx-export-CNyG32Xr.js.br +0 -0
- package/dist/web/assets/pptx-export-CNyG32Xr.js.gz +0 -0
- package/dist/web/assets/problems-panel-V5zqpuXq.js.br +0 -0
- package/dist/web/assets/problems-panel-V5zqpuXq.js.gz +0 -0
- package/dist/web/assets/process-table-DAj46HIl.js +0 -1
- package/dist/web/assets/process-table-DAj46HIl.js.br +0 -0
- package/dist/web/assets/process-table-DAj46HIl.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-B7AVlTfY.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-B7AVlTfY.js.gz +0 -0
- package/dist/web/assets/query-audit-section-gHmRfWKr.js.br +0 -0
- package/dist/web/assets/query-audit-section-gHmRfWKr.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-Cgoznh8L.js +0 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-Cgoznh8L.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-Cgoznh8L.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-X12QbPhO.js +0 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-X12QbPhO.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-X12QbPhO.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DsSHawSK.js +0 -1
- package/dist/web/assets/remote-desktop-mobile-view-DsSHawSK.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DsSHawSK.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CHiQEd9Q.js +0 -1
- package/dist/web/assets/remote-desktop-readiness-gate-CHiQEd9Q.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CHiQEd9Q.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-BnznIby3.js +0 -1
- package/dist/web/assets/remote-desktop-window-content-BnznIby3.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-BnznIby3.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-sYDAsBMO.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-sYDAsBMO.js.gz +0 -0
- package/dist/web/assets/send-to-chat-CCdOrKc7.js.br +0 -0
- package/dist/web/assets/send-to-chat-CCdOrKc7.js.gz +0 -0
- package/dist/web/assets/services-panel-CKa2aP1d.js.br +0 -0
- package/dist/web/assets/services-panel-CKa2aP1d.js.gz +0 -0
- package/dist/web/assets/settings-body-CEIF8lkl.js +0 -2
- package/dist/web/assets/settings-body-CEIF8lkl.js.br +0 -0
- package/dist/web/assets/settings-body-CEIF8lkl.js.gz +0 -0
- package/dist/web/assets/settings-store-DfuiLq_9.js.br +0 -0
- package/dist/web/assets/settings-store-DfuiLq_9.js.gz +0 -0
- package/dist/web/assets/settings-tab-Du5AUPni.js +0 -1
- package/dist/web/assets/settings-window-content-BTflfLez.js +0 -1
- package/dist/web/assets/slash-command-picker-CLevA_Gf.js.br +0 -0
- package/dist/web/assets/slash-command-picker-CLevA_Gf.js.gz +0 -0
- package/dist/web/assets/sql-query-editor-Db8b0jEr.js.br +0 -0
- package/dist/web/assets/sql-query-editor-Db8b0jEr.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-VzYLMqkD.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-VzYLMqkD.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-BR60W_mG.js.br +0 -0
- package/dist/web/assets/system-monitor-body-BR60W_mG.js.gz +0 -0
- package/dist/web/assets/system-monitor-tab-BYpantE2.js +0 -1
- package/dist/web/assets/tab-host-window-content-BL61SB5m.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-BL61SB5m.js.gz +0 -0
- package/dist/web/assets/terminal-tab-B4y6at4h.js.br +0 -0
- package/dist/web/assets/terminal-tab-B4y6at4h.js.gz +0 -0
- package/dist/web/assets/tool-cards-K0r_yxI0.js.br +0 -0
- package/dist/web/assets/tool-cards-K0r_yxI0.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-BK23icsE.js.br +0 -0
- package/dist/web/assets/use-inline-blame-BK23icsE.js.gz +0 -0
- package/dist/web/assets/use-lsp-CRdCPCKW.js.br +0 -0
- package/dist/web/assets/use-lsp-CRdCPCKW.js.gz +0 -0
- package/dist/web/assets/use-process-kill-BWYX03KF.js.br +0 -0
- package/dist/web/assets/use-process-kill-BWYX03KF.js.gz +0 -0
- package/dist/web/assets/video-preview-DugVkMB7.js +0 -1
- package/dist/web/assets/video-preview-DugVkMB7.js.br +0 -0
- package/dist/web/assets/video-preview-DugVkMB7.js.gz +0 -0
- package/dist/web/assets/voice-settings-section-Ceihggqf.js.br +0 -0
- package/dist/web/assets/voice-settings-section-Ceihggqf.js.gz +0 -0
- /package/dist/web/assets/{__vite-browser-external-B_XMEguz.js → __vite-browser-external-C5mXParC.js} +0 -0
- /package/dist/web/assets/{agent-session-sheet-store-DO682WSg.js → agent-session-sheet-store-_OeezCXB.js} +0 -0
- /package/dist/web/assets/{api-settings-CpO8SPk9.js → api-settings-Cc_CpfmC.js} +0 -0
- /package/dist/web/assets/{api-settings-CpO8SPk9.js.br → api-settings-Cc_CpfmC.js.br} +0 -0
- /package/dist/web/assets/{api-settings-CpO8SPk9.js.gz → api-settings-Cc_CpfmC.js.gz} +0 -0
- /package/dist/web/assets/{api-themes-CJipDH_l.js → api-themes-BtMBSjuM.js} +0 -0
- /package/dist/web/assets/{can-open-in-ppm-Bw_xiOXX.js → can-open-in-ppm-DeE2-kd5.js} +0 -0
- /package/dist/web/assets/{can-open-in-ppm-Bw_xiOXX.js.br → can-open-in-ppm-DeE2-kd5.js.br} +0 -0
- /package/dist/web/assets/{can-open-in-ppm-Bw_xiOXX.js.gz → can-open-in-ppm-DeE2-kd5.js.gz} +0 -0
- /package/dist/web/assets/{csv-parser-DcRWxcNV.js → csv-parser-CoxPdyLw.js} +0 -0
- /package/dist/web/assets/{csv-parser-DcRWxcNV.js.br → csv-parser-CoxPdyLw.js.br} +0 -0
- /package/dist/web/assets/{csv-parser-DcRWxcNV.js.gz → csv-parser-CoxPdyLw.js.gz} +0 -0
- /package/dist/web/assets/{design-export-client-CHffN3DM.js → design-export-client-BfdZB7xK.js} +0 -0
- /package/dist/web/assets/{design-export-client-CHffN3DM.js.br → design-export-client-BfdZB7xK.js.br} +0 -0
- /package/dist/web/assets/{design-export-client-CHffN3DM.js.gz → design-export-client-BfdZB7xK.js.gz} +0 -0
- /package/dist/web/assets/{design-responsive-dialog-DSCpv6O1.js → design-responsive-dialog-BiYy3ibS.js} +0 -0
- /package/dist/web/assets/{design-responsive-dialog-DSCpv6O1.js.br → design-responsive-dialog-BiYy3ibS.js.br} +0 -0
- /package/dist/web/assets/{design-responsive-dialog-DSCpv6O1.js.gz → design-responsive-dialog-BiYy3ibS.js.gz} +0 -0
- /package/dist/web/assets/{design-system-status-label-B_0I_3a8.js → design-system-status-label-ekiLyjKn.js} +0 -0
- /package/dist/web/assets/{docx-preview-B3eJyY2y.js → docx-preview-Dt6RQpfA.js} +0 -0
- /package/dist/web/assets/{docx-preview-B3eJyY2y.js.br → docx-preview-Dt6RQpfA.js.br} +0 -0
- /package/dist/web/assets/{docx-preview-B3eJyY2y.js.gz → docx-preview-Dt6RQpfA.js.gz} +0 -0
- /package/dist/web/assets/{editor-font-BNwo7zo5.js → editor-font-CBszn6vt.js} +0 -0
- /package/dist/web/assets/{format-bytes-CRZfxO2J.js → format-bytes-FQmpZ25A.js} +0 -0
- /package/dist/web/assets/{image-gallery-DC3gRAqk.js → image-gallery-B16hO6Ab.js} +0 -0
- /package/dist/web/assets/{image-preview-geometry-DN3DZQp0.js → image-preview-geometry-D4Ihz4UV.js} +0 -0
- /package/dist/web/assets/{lib-B9k5tn9s.js → lib-6APiJkU3.js} +0 -0
- /package/dist/web/assets/{lib-B9k5tn9s.js.br → lib-6APiJkU3.js.br} +0 -0
- /package/dist/web/assets/{lib-B9k5tn9s.js.gz → lib-6APiJkU3.js.gz} +0 -0
- /package/dist/web/assets/{libesm-5f7T4AHA.js → libesm-5wREk7JN.js} +0 -0
- /package/dist/web/assets/{libesm-5f7T4AHA.js.br → libesm-5wREk7JN.js.br} +0 -0
- /package/dist/web/assets/{libesm-5f7T4AHA.js.gz → libesm-5wREk7JN.js.gz} +0 -0
- /package/dist/web/assets/{media-url-CCGOIxzS.js → media-url-CrT-qulZ.js} +0 -0
- /package/dist/web/assets/{metric-chart-canvas-CjFbZuhk.js → metric-chart-canvas-D7f-LQ8x.js} +0 -0
- /package/dist/web/assets/{metric-chart-canvas-CjFbZuhk.js.br → metric-chart-canvas-D7f-LQ8x.js.br} +0 -0
- /package/dist/web/assets/{metric-chart-canvas-CjFbZuhk.js.gz → metric-chart-canvas-D7f-LQ8x.js.gz} +0 -0
- /package/dist/web/assets/{monaco-dotenv-language-Bwq3gQsi.js → monaco-dotenv-language-DbSss7YR.js} +0 -0
- /package/dist/web/assets/{onboarding-entry-CuH1Kqwu.js → onboarding-entry-CGFdGLLP.js} +0 -0
- /package/dist/web/assets/{onboarding-entry-CuH1Kqwu.js.br → onboarding-entry-CGFdGLLP.js.br} +0 -0
- /package/dist/web/assets/{onboarding-entry-CuH1Kqwu.js.gz → onboarding-entry-CGFdGLLP.js.gz} +0 -0
- /package/dist/web/assets/{pdf-preview-X8bdpfE9.js → pdf-preview-B8A4T-ES.js} +0 -0
- /package/dist/web/assets/{pdf-preview-X8bdpfE9.js.br → pdf-preview-B8A4T-ES.js.br} +0 -0
- /package/dist/web/assets/{pdf-preview-X8bdpfE9.js.gz → pdf-preview-B8A4T-ES.js.gz} +0 -0
- /package/dist/web/assets/{separator-DMu7VFQa.js → separator-dHj3Km--.js} +0 -0
- /package/dist/web/assets/{sortable-header-CipIP7aH.js → sortable-header-BOa8o7NJ.js} +0 -0
- /package/dist/web/assets/{sortable-header-CipIP7aH.js.br → sortable-header-BOa8o7NJ.js.br} +0 -0
- /package/dist/web/assets/{sortable-header-CipIP7aH.js.gz → sortable-header-BOa8o7NJ.js.gz} +0 -0
- /package/dist/web/assets/{use-blob-url-DjuRQWnR.js → use-blob-url-BC69n15x.js} +0 -0
- /package/dist/web/assets/{vendor-xterm-Be4L1NHd.js → vendor-xterm-CfasyE0m.js} +0 -0
- /package/dist/web/assets/{vendor-xterm-Be4L1NHd.js.br → vendor-xterm-CfasyE0m.js.br} +0 -0
- /package/dist/web/assets/{vendor-xterm-Be4L1NHd.js.gz → vendor-xterm-CfasyE0m.js.gz} +0 -0
|
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-P9Ym7hCv.js";import{Jt as r,O as i,U as a,j as o,r as s,tn as c}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{n as l}from"./utils-btZ8C8-R.js";import{t as u}from"./panel-store-
|
|
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-P9Ym7hCv.js";import{Jt as r,O as i,U as a,j as o,r as s,tn as c}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{n as l}from"./utils-btZ8C8-R.js";import{t as u}from"./panel-store-B6PoCwBA.js";import"./window-store-vo1N70nK.js";import{i as d}from"./project-store-CCimwgGF.js";import"./session-list-sync-triggers-ATvz-1g3.js";import{n as f}from"./use-is-mobile-BClDZJP5.js";import{t as p}from"./file-icons-CK0J4QSy.js";import{J as m,X as h,Y as g,Z as _,bn as v,q as y}from"./index-CyDLBddf.js";var b=e(t(),1),x=n();function S(){let e=_(v(e=>e.files)),t=d(e=>e.activeProject?.name??null),n=f(),[r,c]=(0,b.useState)(new Set),[S,D]=(0,b.useState)(``),O=(0,b.useMemo)(()=>y(e,t),[e,t]),k=(0,b.useMemo)(()=>{let e=h(O),t=S.trim().toLowerCase();return t?e.map(e=>({...e,diagnostics:e.filePath.toLowerCase().includes(t)?e.diagnostics:e.diagnostics.filter(e=>C(e,t))})).filter(e=>e.diagnostics.length>0):e},[O,S]),A=(0,b.useMemo)(()=>m(O),[O]),j=k.reduce((e,t)=>e+t.diagnostics.length,0);function M(e,t){let{grid:n,focusedPanelId:r,openTab:i}=u.getState(),a=n.flat(),o=a.includes(r)?r:a[0];i({type:`editor`,title:e.filePath.split(`/`).pop()??e.filePath,metadata:{filePath:e.filePath,projectName:e.projectName,lineNumber:t.range.start.line+1},projectId:e.projectName,closable:!0},o)}function N(e){c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return Object.keys(O).length===0?(0,x.jsxs)(`div`,{className:`p-4 space-y-2`,children:[(0,x.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`No problems have been detected in the open files.`}),(0,x.jsx)(`p`,{className:`text-[11px] text-text-subtle/70 leading-relaxed`,children:`Diagnostics come from the language server for each file you open, so a file that has never been opened is not checked.`})]}):(0,x.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,x.jsxs)(`div`,{className:`shrink-0 p-2 space-y-2 border-b border-border-soft`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-text-3`,children:[(0,x.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(a,{className:`size-3 text-error`}),A.errors]}),(0,x.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(s,{className:`size-3 text-warning`}),A.warnings]}),(0,x.jsxs)(`span`,{className:`ml-auto text-text-subtle`,children:[k.length,` file`,k.length===1?``:`s`]})]}),(0,x.jsx)(`input`,{value:S,onChange:e=>D(e.target.value),placeholder:`Filter problems`,className:l(`w-full rounded border border-border bg-surface px-2 text-xs outline-none focus:border-primary`,n?`min-h-11`:`py-1`)})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:[j===0&&(0,x.jsxs)(`p`,{className:`p-4 text-xs text-text-subtle`,children:[`No problems match “`,S.trim(),`”.`]}),k.map(e=>{let t=g(e.projectName,e.filePath),a=r.has(t);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>N(t),className:l(`w-full flex items-center gap-1 px-2 text-left hover:bg-surface-elevated transition-colors`,n?`min-h-11`:`py-1`),children:[a?(0,x.jsx)(o,{className:`size-3 shrink-0 text-text-subtle`}):(0,x.jsx)(i,{className:`size-3 shrink-0 text-text-subtle`}),(0,x.jsx)(p,{name:e.filePath,className:`size-3.5`}),(0,x.jsx)(`span`,{className:`text-xs truncate`,children:e.filePath.split(`/`).pop()}),(0,x.jsx)(`span`,{className:`text-[10px] text-text-subtle truncate min-w-0`,children:E(e.filePath)}),(0,x.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-surface-elevated px-1.5 text-[10px] text-text-3`,children:e.diagnostics.length})]}),!a&&e.diagnostics.map((t,r)=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>M(e,t),title:t.message,className:l(`w-full flex items-start gap-1.5 pl-6 pr-2 text-left hover:bg-surface-elevated transition-colors`,n?`min-h-11 py-2`:`py-0.5`),children:[(0,x.jsx)(w,{severity:t.severity}),(0,x.jsx)(`span`,{className:l(`flex-1 min-w-0 text-xs text-text-2`,n?`break-words`:`truncate`),children:t.message}),(0,x.jsxs)(`span`,{className:`shrink-0 text-[10px] text-text-subtle font-mono pt-px`,children:[T(t),t.range.start.line+1,`:`,t.range.start.character+1]})]},`${t.range.start.line}:${t.range.start.character}:${r}`))]},t)})]})]})}function C(e,t){return e.message.toLowerCase().includes(t)||(e.source?.toLowerCase().includes(t)??!1)||String(e.code??``).toLowerCase().includes(t)}function w({severity:e}){return e===2?(0,x.jsx)(s,{className:`size-3 shrink-0 text-warning mt-px`}):e===3?(0,x.jsx)(r,{className:`size-3 shrink-0 text-info mt-px`}):e===4?(0,x.jsx)(c,{className:`size-3 shrink-0 text-text-subtle mt-px`}):(0,x.jsx)(a,{className:`size-3 shrink-0 text-error mt-px`})}function T(e){return e.source?e.code===void 0?`${e.source} `:`${e.source}(${e.code}) `:``}function E(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}export{S as ProblemsPanel};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./format-bytes-
|
|
1
|
+
import{r as e,t}from"./format-bytes-FQmpZ25A.js";function n(e){return e>80?`text-error`:e>50?`text-warning`:`text-success`}function r(e){if(!e)return``;let t=Math.round((Date.now()-e)/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function i(e,n){return e===void 0&&n===void 0?`—`:`↓ ${t(e??0)} ↑ ${t(n??0)}`}function a(t){return t===void 0?`—`:e(t)}function o(e,n){return e===void 0&&n===void 0?`—`:`↓ ${t(e??0)} ↑ ${t(n??0)}`}function s(t,n,r=!0){let i=t===void 0?`—`:`${t.toFixed(0)}%`;return r?t===void 0&&n===void 0?`—`:`${i} · ${n===void 0?`—`:e(n)}`:i}function c(e,t){if(!(e===void 0&&t===void 0))return(e??0)+(t??0)}export{o as a,s as i,r as n,a as o,i as r,c as s,n as t};
|
|
@@ -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-P9Ym7hCv.js";import{Jr as r,O as i,j as a,ur as o}from"./icons-CO_II6D-.js";import{O as s,a as c,r as l}from"./api-client-F5Zi1sR0.js";import{n as u}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-7OX80HDB.js";import{n as d}from"./use-is-mobile-BClDZJP5.js";import"./button-DeAyLH9U.js";import{a as f,n as p,o as m,t as h}from"./dialog-Bocc0Fgb.js";import{t as g}from"./mobile-bottom-sheet-D4UyOatB.js";import"./use-visual-viewport-BGpcMnIx.js";import{_n as _,dn as v,gn as y,hn as b,ln as x,mn as S,un as C,vn as w,yn as ee}from"./index-CyDLBddf.js";import{r as T}from"./format-bytes-FQmpZ25A.js";import{a as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./process-row-format-u6y7lOee.js";import{r as N,t as te}from"./use-process-kill-Cbiu1mbY.js";import{n as P,r as ne,t as F}from"./sortable-header-BOa8o7NJ.js";var I=e(t(),1),L=[`swap`,`disk`,`gpu`,`net`],R={cpu:64,ram:80,swap:80,disk:120,gpu:90,net:120},z=`minmax(0,1fr)`,B=`44px`;function V(e){return e===`swap`||e===`disk`||e===`gpu`||e===`net`}function H(e){return Math.round(Math.min(400,Math.max(48,e)))}function U(e,t){let n=t[e];return typeof n==`number`&&Number.isFinite(n)?H(n):R[e]}function re(e,t,n={}){let r=L.filter(t=>e[t]),i=V(t)&&e[t]?t:null,a=e=>`${U(e,n)}px`,o=[z,a(`cpu`),a(`ram`)];return{wideTemplate:[...o,...r.map(a),B].join(` `),narrowTemplate:[...o,...i?[a(i)]:[],B].join(` `),columns:e,narrowExtra:i}}var W=`grid-cols-[var(--sysmon-grid-n)] @lg:grid-cols-[var(--sysmon-grid-w)]`;function G(e){return{"--sysmon-grid-n":e.narrowTemplate,"--sysmon-grid-w":e.wideTemplate}}function K(e,t){return e.narrowExtra===t?`block`:`hidden @lg:block`}var q=n(),J=150;function Y({mode:e,onModeChange:t,ppmOnly:n,onPpmOnlyChange:r,onQueryChange:i}){let[a,s]=(0,I.useState)(``),c=(0,I.useRef)(null);return(0,I.useEffect)(()=>(c.current&&clearTimeout(c.current),c.current=setTimeout(()=>i(a),J),()=>{c.current&&clearTimeout(c.current)}),[a]),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-2 border-b border-border shrink-0`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 min-w-[140px]`,children:[(0,q.jsx)(o,{className:`absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-text-subtle`}),(0,q.jsx)(`input`,{type:`text`,value:a,onChange:e=>s(e.target.value),placeholder:`Search processes`,"aria-label":`Search processes`,"data-testid":`sysmon-process-search`,className:`w-full min-h-11 md:min-h-8 pl-7 pr-2 text-sm rounded-md border border-border bg-transparent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>t(e===`grouped`?`flat`:`grouped`),"aria-pressed":e===`flat`,"data-testid":`sysmon-toggle-flat`,className:`min-h-11 md:min-h-8 px-3 text-xs rounded-md border border-border hover:bg-surface-hover transition-colors`,children:e===`flat`?`Flat`:`Grouped`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-pressed":n,"data-testid":`sysmon-filter-ppm`,className:u(`min-h-11 md:min-h-8 px-3 text-xs rounded-md border transition-colors`,n?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-surface-hover`),children:`PPM only`})]})}function ie({sortKey:e,sortDir:t,grid:n,onSort:r,resize:i}){let a={activeKey:e,activeDir:t,onClick:r,resize:i};return(0,q.jsxs)(`div`,{role:`row`,className:u(`grid gap-1 px-3 py-1.5 text-[11px] text-text-subtle border-b border-border sticky top-0 bg-background z-10`,W),children:[(0,q.jsx)(F,{label:`Process`,field:`name`,...a,resize:void 0,align:`left`,testId:`sysmon-sort-name`}),(0,q.jsx)(F,{label:`CPU`,field:`cpu`,...a,resizeKey:`cpu`,testId:`sysmon-sort-cpu`}),(0,q.jsx)(F,{label:`RAM`,field:`ram`,...a,resizeKey:`ram`,testId:`sysmon-sort-ram`}),n.columns.swap&&(0,q.jsx)(F,{label:`Swap`,field:`swap`,...a,resizeKey:`swap`,testId:`sysmon-col-swap`,className:K(n,`swap`)}),n.columns.disk&&(0,q.jsx)(F,{label:`Disk`,field:`disk`,...a,resizeKey:`disk`,testId:`sysmon-col-disk`,className:K(n,`disk`)}),n.columns.gpu&&(0,q.jsx)(F,{label:`GPU`,field:`gpu`,...a,resizeKey:`gpu`,testId:`sysmon-col-gpu`,className:K(n,`gpu`)}),n.columns.net&&(0,q.jsx)(F,{label:`Net`,field:`net`,...a,resizeKey:`net`,testId:`sysmon-col-net`,className:K(n,`net`)}),(0,q.jsx)(`span`,{})]})}function ae({totals:e,grid:t,gpuUtilPercent:n}){return(0,q.jsxs)(`div`,{className:u(`grid gap-1 px-3 py-1.5 text-xs font-medium border-t border-border shrink-0`,W),"data-testid":`sysmon-total`,"data-process-count":e.count,children:[(0,q.jsxs)(`span`,{className:`truncate`,children:[`Total (`,e.count,` processes)`]}),(0,q.jsxs)(`span`,{className:u(`text-right`,M(e.cpu)),children:[e.cpu.toFixed(1),`%`]}),(0,q.jsx)(`span`,{className:`text-right text-text-secondary`,children:T(e.ramMB)}),t.columns.swap&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(t,`swap`)),children:k(e.swapMB)}),t.columns.disk&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(t,`disk`)),children:A(e.diskReadBps,e.diskWriteBps)}),t.columns.gpu&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(t,`gpu`)),children:D(n,e.gpuMemMB,t.columns.gpuMemory!==!1)}),t.columns.net&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(t,`net`)),children:E(e.netInBps,e.netOutBps)}),(0,q.jsx)(`span`,{})]})}var oe=`Protected: this app contains a PPM or OS-critical process — cannot be ended as a whole.`;function se({group:e,expanded:t,grid:n,killProtected:o,onToggle:s,onKillClick:c}){let l=t?i:a;return(0,q.jsxs)(`div`,{className:`grid items-center gap-1 min-h-11 md:min-h-7 px-3 text-xs cursor-pointer hover:bg-surface-hover transition-colors group/proc grid-cols-[var(--sysmon-grid-n)] @lg:grid-cols-[var(--sysmon-grid-w)]`,onClick:()=>s(e.key),"data-testid":`sysmon-group-row`,"data-group-key":e.key,"data-count":e.count,"data-disk-bps":j(e.diskReadBps,e.diskWriteBps),"data-gpu-pct":e.gpuPct,"data-net-bps":j(e.netInBps,e.netOutBps),children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(e.key)},"aria-expanded":t,"aria-label":`${t?`Collapse`:`Expand`} ${e.label}`,"data-testid":`sysmon-group-expand`,className:`flex items-center justify-center size-11 md:size-7 -ml-2 shrink-0`,children:(0,q.jsx)(l,{className:`size-3.5 text-text-subtle`})}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),(0,q.jsxs)(`span`,{className:`text-text-subtle shrink-0`,children:[`(`,e.count,`)`]})]}),(0,q.jsxs)(`span`,{className:u(`text-right`,M(e.cpu)),children:[e.cpu.toFixed(1),`%`]}),(0,q.jsx)(`span`,{className:`text-right text-text-secondary`,children:T(e.ramMB)}),n.columns.swap&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`swap`)),children:k(e.swapMB)}),n.columns.disk&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`disk`)),children:A(e.diskReadBps,e.diskWriteBps)}),n.columns.gpu&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`gpu`)),children:D(e.gpuPct,e.gpuMemMB,n.columns.gpuMemory!==!1)}),n.columns.net&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`net`)),children:E(e.netInBps,e.netOutBps)}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c(e)},disabled:o,"aria-label":`End ${e.label} and its ${e.count} processes`,title:o?oe:`End ${e.label} (${e.count} processes)`,"data-testid":`sysmon-group-kill-btn`,className:u(`flex items-center justify-center size-11 md:size-7 rounded transition-all`,`can-hover:opacity-0 can-hover:group-hover/proc:opacity-100`,o?`opacity-40 cursor-not-allowed`:`hover:bg-error/20 hover:text-error active:bg-error/30`),children:(0,q.jsx)(r,{className:`size-3.5`})})})]})}var ce=`Protected: PPM or OS-critical process — cannot be ended.`;function le({proc:e,indent:t,grid:n,onKillClick:i}){return(0,q.jsxs)(`div`,{className:`grid items-center gap-1 min-h-11 md:min-h-7 px-3 text-xs group/proc hover:bg-surface-hover transition-colors grid-cols-[var(--sysmon-grid-n)] @lg:grid-cols-[var(--sysmon-grid-w)]`,"data-testid":`sysmon-process-row`,"data-pid":e.pid,"data-ppm":e.ppm,"data-protected":e.protected,"data-swap-mb":e.swapMB,"data-disk-bps":j(e.diskReadBps,e.diskWriteBps),"data-gpu-pct":e.gpuPct,"data-net-bps":j(e.netInBps,e.netOutBps),children:[(0,q.jsxs)(`div`,{className:u(`flex items-start gap-1.5 min-w-0`,t&&`pl-6`),children:[(0,q.jsx)(`span`,{className:`text-text-subtle shrink-0`,children:e.pid}),(0,q.jsx)(`span`,{className:`truncate text-text-secondary`,title:e.startedAt?`${e.command}\nRunning ${O(e.startedAt)}`:e.command,children:e.command})]}),(0,q.jsxs)(`span`,{className:u(`text-right`,M(e.cpu)),children:[e.cpu.toFixed(1),`%`]}),(0,q.jsx)(`span`,{className:`text-right text-text-secondary`,children:T(e.ramMB)}),n.columns.swap&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`swap`)),children:k(e.swapMB)}),n.columns.disk&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`disk`)),children:A(e.diskReadBps,e.diskWriteBps)}),n.columns.gpu&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`gpu`)),children:D(e.gpuPct,e.gpuMemMB,n.columns.gpuMemory!==!1)}),n.columns.net&&(0,q.jsx)(`span`,{className:u(`text-right text-text-secondary tabular-nums truncate`,K(n,`net`)),children:E(e.netInBps,e.netOutBps)}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),i(e)},disabled:e.protected,"aria-label":`End process ${e.name} (${e.pid})`,title:e.protected?ce:`End process ${e.name}`,"data-testid":`sysmon-kill-btn`,className:u(`flex items-center justify-center size-11 md:size-7 rounded transition-all`,`can-hover:opacity-0 can-hover:group-hover/proc:opacity-100`,e.protected?`opacity-40 cursor-not-allowed`:`hover:bg-error/20 hover:text-error active:bg-error/30`),children:(0,q.jsx)(r,{className:`size-3.5`})})})]})}var ue={STOP:`Suspend (SIGSTOP)`,CONT:`Continue (SIGCONT)`,TERM:`Terminate (SIGTERM)`,KILL:`Kill (SIGKILL)`,HUP:`Hang up (SIGHUP)`,INT:`Interrupt (SIGINT)`,USR1:`User signal 1`,USR2:`User signal 2`},de=[`KILL`,`STOP`];async function fe(e){let t=c(),n={"Content-Type":`application/json`,"X-PPM-Request":`1`};t&&(n.Authorization=`Bearer ${t}`);let r=await fetch(`/api/system/resources/signal`,{method:`POST`,headers:n,body:JSON.stringify(e)}),i;try{i=await r.json()}catch{throw Error(r.ok?`Empty response from server`:`Server error (HTTP ${r.status})`)}if(i.ok===!1)throw Error(i.error??`HTTP ${r.status}`);return i.data}function pe(e,t,n){return{pid:e.pid,startedAt:e.startedAt,signal:t,tree:n}}function me(){let[e,t]=(0,I.useState)(null);return{send:(0,I.useCallback)(async(e,n,r=!1)=>{t(e.pid);try{let t=(await fe(pe(e,n,r))).signalled.length;s.success(t>1?`Sent SIG${n} to ${e.name} and ${t-1} child processes`:`Sent SIG${n} to ${e.name} (${e.pid})`)}catch(t){s.error(t instanceof Error?t.message:`Could not signal ${e.name}`)}finally{t(null)}},[]),pending:e}}function he({proc:e,signals:t,onDetails:n,onKill:r,onSignal:i,children:a}){return(0,q.jsxs)(x,{children:[(0,q.jsx)(w,{asChild:!0,children:(0,q.jsx)(`div`,{className:`select-none`,children:a})}),(0,q.jsxs)(C,{children:[(0,q.jsx)(v,{onSelect:()=>n(e),children:`Details…`}),t.length>0&&(0,q.jsxs)(b,{children:[(0,q.jsx)(_,{children:`Send signal`}),(0,q.jsx)(y,{children:t.map(t=>(0,q.jsx)(v,{variant:de.includes(t)?`destructive`:void 0,disabled:e.protected,onSelect:()=>{e.protected||i(e,t,!1)},children:ue[t]},t))})]}),(0,q.jsx)(S,{}),(0,q.jsx)(v,{variant:`destructive`,disabled:e.protected,onSelect:()=>{e.protected||r(e)},children:`End process`}),e.protected&&(0,q.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-text-subtle max-w-64`,children:`PPM or OS-critical process — it cannot be ended or signalled.`})]})]})}function ge(e){return e>0?new Date(e).toLocaleString():`—`}function _e({pid:e,name:t,onClose:n}){let r=d(),[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(null);if((0,I.useEffect)(()=>{if(e===null){a(null),s(null);return}let t=!0;return a(null),s(null),l.get(`/api/system/resources/process/${e}`).then(e=>{t&&a(e)}).catch(e=>{t&&s(e instanceof Error?e.message:`Could not read the process`)}),()=>{t=!1}},[e]),e===null)return null;let c=(0,q.jsxs)(`div`,{className:`space-y-3`,"data-testid":`sysmon-process-details`,"data-pid":e,children:[o&&(0,q.jsx)(`p`,{className:`text-sm text-error`,children:o}),!o&&i===null&&(0,q.jsx)(`p`,{className:`text-sm text-text-subtle`,children:`Reading /proc…`}),i&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-xs`,children:[(0,q.jsx)(X,{label:`PID`,value:i.pid}),(0,q.jsx)(X,{label:`Parent PID`,value:i.ppid}),(0,q.jsx)(X,{label:`User`,value:i.user}),(0,q.jsx)(X,{label:`State`,value:i.state}),(0,q.jsx)(X,{label:`Threads`,value:i.threads}),(0,q.jsx)(X,{label:`Nice`,value:i.nice}),(0,q.jsx)(X,{label:`Started`,value:ge(i.startedAt)}),(0,q.jsx)(X,{label:`Control group`,value:i.cgroup})]}),(0,q.jsx)(Z,{label:`Executable`,value:i.exe}),(0,q.jsx)(Z,{label:`Working directory`,value:i.cwd}),(0,q.jsx)(Z,{label:`Command line`,value:i.command,mono:!0})]})]});return r?(0,q.jsx)(g,{open:!0,onClose:n,children:(0,q.jsxs)(`div`,{className:`px-4 pb-4 space-y-3`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold break-all`,children:t}),c]})}):(0,q.jsx)(h,{open:!0,onOpenChange:e=>!e&&n(),children:(0,q.jsxs)(p,{className:`sm:max-w-xl`,children:[(0,q.jsx)(f,{children:(0,q.jsx)(m,{className:`break-all`,children:t})}),c]})})}function X({label:e,value:t}){let n=t===null||t===``?`—`:String(t);return(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`dt`,{className:`text-text-subtle`,children:e}),(0,q.jsx)(`dd`,{className:`truncate`,title:n,children:n})]})}function Z({label:e,value:t,mono:n}){return(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`p`,{className:`text-[11px] text-text-subtle`,children:e}),(0,q.jsx)(`p`,{className:`text-xs break-all ${n?`font-mono`:``}`,children:t??`—`})]})}var Q=`ppm-sysmon-col-widths`;function ve(){try{let e=localStorage.getItem(Q);if(!e)return{};let t=JSON.parse(e),n={};for(let e of[`cpu`,`ram`,`disk`,`gpu`,`net`]){let r=t[e];typeof r==`number`&&Number.isFinite(r)&&(n[e]=H(r))}return n}catch{return{}}}function $(e){try{Object.keys(e).length===0?localStorage.removeItem(Q):localStorage.setItem(Q,JSON.stringify(e))}catch{}}function ye(){let[e,t]=(0,I.useState)(()=>typeof localStorage>`u`?{}:ve()),n=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let e=e=>{let r=n.current;if(!r)return;let i=H(r.startWidth+(e.clientX-r.startX));t(e=>e[r.key]===i?e:{...e,[r.key]:i})},r=()=>{n.current&&(n.current=null,document.body.style.cursor=``,t(e=>($(e),e)))};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,r),window.addEventListener(`pointercancel`,r),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r)}},[]),{widths:e,begin:(0,I.useCallback)((t,r)=>{r.preventDefault(),n.current={key:t,startX:r.clientX,startWidth:U(t,e)},document.body.style.cursor=`col-resize`},[e]),reset:(0,I.useCallback)(e=>{t(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return $(r),r})},[])}}var be={disk:!1,gpu:!1,net:!1};function xe({snapshot:e}){let t=d(),n=(0,I.useRef)(null),[r,i]=(0,I.useState)(`grouped`),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(null),[f,p]=(0,I.useState)(`desc`),[m,h]=(0,I.useState)(()=>new Set),{pendingKill:g,groupProtected:_,requestKillProcess:v,requestKillGroup:y,confirmKill:b,cancelKill:x}=te(e),{send:S}=me(),[C,w]=(0,I.useState)(null),T=e.signals??[],{widths:E,begin:D,reset:O}=ye(),{rows:k,totals:A}=(0,I.useMemo)(()=>P({processes:e.processes,groups:e.groups,mode:r,ppmOnly:a,query:s,sortKey:l,sortDir:f,expanded:m}),[e.processes,e.groups,r,a,s,l,f,m]),j=e.processColumns??be,M=(0,I.useMemo)(()=>re(j,l,E),[j,l,E]),F=e.system.gpus[0]?.utilPercent,L=ee({count:k.length,getScrollElement:()=>n.current,estimateSize:()=>t?44:28,overscan:12}),R=(0,I.useCallback)(e=>{let[t,n]=ne(l,f,e);u(t),p(n)},[l,f]),z=(0,I.useCallback)(e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return(0,q.jsxs)(`div`,{className:`h-full flex flex-col min-h-0 @container`,style:G(M),"data-testid":`sysmon-processes`,"data-row-count":k.length,children:[(0,q.jsx)(Y,{mode:r,onModeChange:i,ppmOnly:a,onPpmOnlyChange:o,onQueryChange:c}),(0,q.jsx)(ie,{sortKey:l,sortDir:f,grid:M,onSort:R,resize:{onResizeStart:D,onResizeReset:O}}),(0,q.jsx)(`div`,{ref:n,className:`flex-1 min-h-0 overflow-y-auto`,children:(0,q.jsx)(`div`,{style:{height:L.getTotalSize(),position:`relative`},children:L.getVirtualItems().map(e=>{let t=k[e.index];return t?(0,q.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,transform:`translateY(${e.start}px)`},children:t.kind===`group`?(0,q.jsx)(se,{group:t.group,expanded:t.expanded,grid:M,killProtected:_.get(t.group.key)??!0,onToggle:z,onKillClick:y}):(0,q.jsx)(he,{proc:t.proc,signals:T,onDetails:w,onKill:v,onSignal:(e,t,n)=>void S(e,t,n),children:(0,q.jsx)(le,{proc:t.proc,indent:t.indent,grid:M,onKillClick:v})})},t.kind===`group`?t.group.key:`p:${t.proc.pid}`):null})})}),(0,q.jsx)(ae,{totals:A,grid:M,gpuUtilPercent:F}),(0,q.jsx)(N,{target:g,onConfirm:b,onCancel:x}),(0,q.jsx)(_e,{pid:C?.pid??null,name:C?.name??``,onClose:()=>w(null)})]})}export{xe as ProcessTable};
|
|
Binary file
|
|
Binary file
|
package/dist/web/assets/{proxy-settings-section-B7AVlTfY.js → proxy-settings-section-Buv_8y54.js}
RENAMED
|
@@ -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-P9Ym7hCv.js";import{St as r,Yn as i,ir as a,nt as o,un as s}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import"./portal-container-context-NFSuymMu.js";import"./chat-preparation-cache-BUCR58h4.js";import{t as c}from"./button-DeAyLH9U.js";import{a as l,n as u,o as d,r as f,s as p,t as m}from"./dialog-Bocc0Fgb.js";import{t as h}from"./input-CG8PS8mS.js";import{Ft as g,Rn as _,Tt as v}from"./index-DhWjx5iR.js";import{C as y,a as b,d as x}from"./api-settings-CpO8SPk9.js";var S=e(t(),1),C=[{value:`claude-opus-5-5`,label:`Claude Opus 5.5`,hint:`balanced, recommended`},{value:`claude-fable-5-1`,label:`Claude Fable 5.1`,hint:`flagship`},{value:`claude-opus-5`,label:`Claude Opus 5`,hint:`most powerful`},{value:`claude-fable-5`,label:`Claude Fable 5`,hint:`flagship`},{value:`claude-opus-4-8`,label:`Claude Opus 4.8`,hint:`powerful`},{value:`claude-opus-4-7`,label:`Claude Opus 4.7`,hint:`powerful`},{value:`claude-opus-4-6`,label:`Claude Opus 4.6`,hint:`powerful`},{value:`claude-sonnet-5`,label:`Claude Sonnet 5`,hint:`fast`},{value:`claude-sonnet-4-6`,label:`Claude Sonnet 4.6`,hint:`fast`},{value:`claude-haiku-4-5`,label:`Claude Haiku 4.5`,hint:`cheap`}];C.map(e=>e.value);function w(e,t){return`${e}/proxy${t?`/${t}`:``}`}function T(e,t){let n=w(e,t);return{anthropicBase:n,openAiBase:`${n}/v1`,anthropicMessages:`${n}/v1/messages`,openAiChatCompletions:`${n}/v1/chat/completions`,models:`${n}/v1/models`,imagesGenerations:t?`${n}/v1/images/generations`:null,imagesEdits:t?`${n}/v1/images/edits`:null}}var E=n(),D=`Hello! Reply briefly.`,O=`claude-opus-5-5`;function k(e){let[t,n]=(0,S.useState)(!1);return(0,E.jsxs)(m,{open:t,onOpenChange:n,children:[(0,E.jsx)(p,{asChild:!0,children:(0,E.jsxs)(c,{variant:`outline`,size:`sm`,className:`h-7 text-[11px] gap-1.5 cursor-pointer`,children:[(0,E.jsx)(r,{className:`size-3`}),`Test`]})}),(0,E.jsxs)(u,{className:`sm:max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,E.jsxs)(l,{children:[(0,E.jsx)(d,{className:`text-sm`,children:`Test Proxy`}),(0,E.jsx)(f,{className:`text-[11px]`,children:`Send a test request and inspect the raw response.`})]}),t&&(0,E.jsx)(A,{...e})]})]})}function A({authKey:e,baseUrl:t,provider:n}){let[r,a]=(0,S.useState)(`anthropic`),[o,l]=(0,S.useState)(D),[u,d]=(0,S.useState)(n?``:O),[f,p]=(0,S.useState)(!0),[m,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(null),[b,x]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),A=(0,S.useRef)(null),j=(0,S.useRef)(null);(0,S.useEffect)(()=>{A.current?.select()},[]),(0,S.useEffect)(()=>{j.current&&(j.current.scrollTop=j.current.scrollHeight)},[v]);let M=e=>{a(e),y(null),x(null),k(null)},N=async()=>{_(!0),y(null),x(null),k(null);let i=Date.now(),a=r===`openai`,s=T(t,n),c=a?s.openAiChatCompletions:s.anthropicMessages,l=JSON.stringify({...u?{model:u}:{},max_tokens:256,stream:f,messages:[{role:`user`,content:o}]}),d={"Content-Type":`application/json`};a?d.Authorization=`Bearer ${e}`:(d[`x-api-key`]=e,d[`anthropic-version`]=`2023-06-01`);try{let e=await fetch(c,{method:`POST`,headers:d,body:l});if(!e.ok){let t=await e.text();x(`HTTP ${e.status}: ${t}`),_(!1),k(Date.now()-i);return}if(f){let t=e.body?.getReader();if(!t){x(`No response body`),_(!1);return}let n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0}),y(r)}k(Date.now()-i)}else{let t=await e.text();try{y(JSON.stringify(JSON.parse(t),null,2))}catch{y(t)}k(Date.now()-i)}}catch(e){x(e.message)}finally{_(!1),k(e=>e??Date.now()-i)}};return(0,E.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5 min-w-0`,children:[(0,E.jsx)(g,{className:`text-[11px]`,children:`Auth Style`}),(0,E.jsx)(`div`,{className:`flex gap-1`,children:[`anthropic`,`openai`].map(e=>(0,E.jsx)(`button`,{onClick:()=>M(e),className:`flex-1 h-8 rounded-md text-[11px] font-medium border transition-colors cursor-pointer ${r===e?`bg-primary text-primary-foreground border-primary`:`bg-muted text-muted-foreground border-transparent hover:bg-muted/80`}`,children:e===`anthropic`?`Anthropic`:`OpenAI`},e))}),(0,E.jsxs)(`p`,{className:`text-[9px] text-muted-foreground break-all`,children:[r===`anthropic`?`x-api-key header`:`Authorization: Bearer header`,` · `,(0,E.jsx)(`code`,{children:`/proxy${n?`/${n}`:``}/v1/${r===`anthropic`?`messages`:`chat/completions`}`})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(g,{className:`text-[11px]`,children:`Model`}),n?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(h,{value:u,onChange:e=>d(e.target.value),placeholder:`leave empty to let the provider choose`,className:`h-8 text-[11px] font-mono`}),(0,E.jsxs)(`p`,{className:`text-[9px] text-muted-foreground`,children:[`Names come from `,(0,E.jsxs)(`code`,{children:[`GET /proxy/`,n,`/v1/models`]}),`.`]})]}):(0,E.jsx)(`select`,{value:u,onChange:e=>d(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-[11px]`,children:C.map(e=>(0,E.jsx)(`option`,{value:e.value,children:e.value},e.value))})]}),(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(g,{className:`text-[11px]`,children:`Streaming`}),(0,E.jsx)(`div`,{className:`flex gap-1`,children:[!0,!1].map(e=>(0,E.jsx)(`button`,{onClick:()=>p(e),className:`h-7 px-3 rounded-md text-[11px] font-medium border transition-colors cursor-pointer ${f===e?`bg-primary text-primary-foreground border-primary`:`bg-muted text-muted-foreground border-transparent hover:bg-muted/80`}`,children:e?`Stream`:`JSON`},String(e)))})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(g,{className:`text-[11px]`,children:`Message`}),(0,E.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,E.jsx)(h,{ref:A,value:o,onChange:e=>l(e.target.value),placeholder:`Type a test message...`,className:`h-9 text-[11px] flex-1 min-w-0`,onKeyDown:e=>{e.key===`Enter`&&!m&&N()}}),(0,E.jsxs)(c,{size:`sm`,className:`h-9 px-3 cursor-pointer shrink-0`,onClick:N,disabled:m||!o.trim(),children:[m?(0,E.jsx)(s,{className:`size-3.5 animate-spin`}):(0,E.jsx)(i,{className:`size-3.5`}),(0,E.jsx)(`span`,{className:`ml-1 text-[11px]`,children:m?`...`:`Send`})]})]})]}),(v||b)&&(0,E.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(g,{className:`text-[10px] text-muted-foreground`,children:`Raw Response`}),w!=null&&(0,E.jsxs)(`span`,{className:`text-[9px] font-mono text-muted-foreground`,children:[(w/1e3).toFixed(1),`s`]})]}),b?(0,E.jsx)(`pre`,{className:`text-[9px] font-mono bg-error/10 text-error p-2 rounded overflow-auto max-h-52 whitespace-pre-wrap break-all`,children:b}):(0,E.jsx)(`pre`,{ref:j,className:`text-[9px] font-mono bg-muted p-2 rounded overflow-auto max-h-52 whitespace-pre-wrap break-all`,children:v})]})]})}function j(){let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)([]);(0,S.useEffect)(()=>{b().then(e=>r(Object.keys(e.providers??{}).filter(e=>e!==`mock`&&e!==`claude`))).catch(()=>r([]))},[]);let[i,s]=(0,S.useState)(null),[l,u]=(0,S.useState)(!0),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(null),[C,w]=(0,S.useState)(null);(0,S.useEffect)(()=>{u(!0),x().then(s).catch(e=>m(e.message)).finally(()=>u(!1))},[]);let D=async e=>{f(!0),m(null);try{s(await y(e))}catch(e){m(e.message)}finally{f(!1)}},O=(e,t)=>{_(e),w(t),setTimeout(()=>w(null),2e3)};if(l||!i)return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`h3`,{className:`text-xs font-medium text-text-secondary`,children:`API Proxy`}),(0,E.jsx)(`p`,{className:`text-[11px] text-text-subtle`,children:p?`Error: ${p}`:`Loading...`})]});let A=!!i.authKey,j=!!i.tunnelUrl,M=i.localEndpoint.replace(/\/proxy\/v1\/messages$/,``),N=T(j?i.tunnelUrl:M,e),P=N.anthropicMessages,F=N.openAiChatCompletions,I=`ANTHROPIC_BASE_URL=${N.anthropicBase}\nANTHROPIC_API_KEY=${i.authKey}`,L=`OPENAI_BASE_URL=${N.openAiBase}\nOPENAI_API_KEY=${i.authKey}`;return(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsx)(`div`,{className:`space-y-1.5`,children:(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Expose your accounts as an API that speaks both the Anthropic and OpenAI formats, so most SDKs need only a new base URL. The default path answers from your Claude accounts; pick a provider below to run its agent instead, which also unlocks image generation.`})}),(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,E.jsx)(g,{className:`text-xs`,children:`Enable Proxy`}),(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Accept API requests under /proxy`})]}),(0,E.jsx)(v,{checked:i.enabled,onCheckedChange:e=>D({enabled:e}),disabled:d})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(g,{className:`text-[11px]`,children:`Auth Key`}),A?(0,E.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,E.jsx)(h,{readOnly:!0,value:i.authKey,className:`h-7 text-[11px] font-mono flex-1`}),(0,E.jsx)(c,{variant:`outline`,size:`sm`,className:`h-7 px-2 cursor-pointer shrink-0`,onClick:()=>O(i.authKey,`key`),children:C===`key`?`Copied!`:(0,E.jsx)(o,{className:`size-3`})}),(0,E.jsx)(c,{variant:`outline`,size:`sm`,className:`h-7 px-2 cursor-pointer shrink-0`,onClick:()=>D({generateKey:!0}),disabled:d,children:(0,E.jsx)(a,{className:`size-3`})})]}):(0,E.jsx)(c,{variant:`outline`,size:`sm`,className:`h-7 text-xs cursor-pointer`,onClick:()=>D({generateKey:!0}),disabled:d,children:`Generate Auth Key`}),(0,E.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Use as Bearer token or x-api-key when calling the proxy.`})]}),i.enabled&&A&&(0,E.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3 bg-muted/30`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(`h4`,{className:`text-[11px] font-medium`,children:`Connection Info`}),(0,E.jsx)(k,{authKey:i.authKey,baseUrl:window.location.origin,provider:e})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(g,{className:`text-[10px] text-muted-foreground`,children:`Provider`}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:[{id:``,label:`Claude (default)`},...n.map(e=>({id:e,label:e}))].map(n=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),className:`text-[10px] px-2.5 min-h-[36px] rounded-md border transition-colors cursor-pointer ${e===n.id?`border-primary bg-primary/15`:`border-border bg-muted/40 hover:bg-muted`}`,children:n.label},n.id||`default`))}),e&&(0,E.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Runs the `,e,` agent per request (read-only sandbox, one turn). Slower than the default path.`]})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(g,{className:`text-[10px] text-muted-foreground`,children:`Anthropic Endpoint`}),(0,E.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,E.jsx)(`code`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded flex-1 truncate`,children:P}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 cursor-pointer shrink-0`,onClick:()=>O(P,`anthropic`),children:C===`anthropic`?`Copied!`:(0,E.jsx)(o,{className:`size-3`})})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(g,{className:`text-[10px] text-muted-foreground`,children:`OpenAI-Compatible Endpoint`}),(0,E.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,E.jsx)(`code`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded flex-1 truncate`,children:F}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 cursor-pointer shrink-0`,onClick:()=>O(F,`openai`),children:C===`openai`?`Copied!`:(0,E.jsx)(o,{className:`size-3`})})]})]}),N.imagesGenerations&&N.imagesEdits&&(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(g,{className:`text-[10px] text-muted-foreground`,children:`Image Endpoints`}),(0,E.jsx)(`code`,{className:`block text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded truncate`,children:N.imagesGenerations}),(0,E.jsx)(`code`,{className:`block text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded truncate`,children:N.imagesEdits})]}),!j&&(0,E.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Start a Cloudflare tunnel (Share) to get a public URL.`}),(0,E.jsxs)(`div`,{className:`space-y-1 pt-1`,children:[(0,E.jsx)(g,{className:`text-[10px] text-muted-foreground`,children:`Anthropic Format`}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`pre`,{className:`text-[9px] font-mono bg-muted p-2 rounded overflow-x-auto whitespace-pre`,children:I}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`absolute top-1 right-1 h-5 px-1 cursor-pointer`,onClick:()=>O(I,`anthropic-env`),children:C===`anthropic-env`?`Copied!`:(0,E.jsx)(o,{className:`size-2.5`})})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(g,{className:`text-[10px] text-muted-foreground`,children:`OpenAI Format`}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`pre`,{className:`text-[9px] font-mono bg-muted p-2 rounded overflow-x-auto whitespace-pre`,children:L}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`absolute top-1 right-1 h-5 px-1 cursor-pointer`,onClick:()=>O(L,`openai-env`),children:C===`openai-env`?`Copied!`:(0,E.jsx)(o,{className:`size-2.5`})})]})]}),(0,E.jsx)(`div`,{className:`flex items-center gap-3 pt-1`,children:(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`Requests served: `,(0,E.jsx)(`span`,{className:`font-mono`,children:i.requestCount})]})})]}),d&&(0,E.jsx)(`p`,{className:`text-[11px] text-text-subtle`,children:`Saving...`}),p&&(0,E.jsx)(`p`,{className:`text-[11px] text-error`,children:p})]})}export{j as ProxySettingsSection};
|
|
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-P9Ym7hCv.js";import{St as r,Yn as i,ir as a,nt as o,un as s}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import"./portal-container-context-NFSuymMu.js";import"./chat-preparation-cache-BUCR58h4.js";import{t as c}from"./button-DeAyLH9U.js";import{a as l,n as u,o as d,r as f,s as p,t as m}from"./dialog-Bocc0Fgb.js";import{t as h}from"./input-CG8PS8mS.js";import{Et as g,Lt as _,Vn as v}from"./index-CyDLBddf.js";import{C as y,a as b,d as x}from"./api-settings-Cc_CpfmC.js";var S=e(t(),1),C=[{value:`claude-opus-5-5`,label:`Claude Opus 5.5`,hint:`balanced, recommended`},{value:`claude-fable-5-1`,label:`Claude Fable 5.1`,hint:`flagship`},{value:`claude-opus-5`,label:`Claude Opus 5`,hint:`most powerful`},{value:`claude-fable-5`,label:`Claude Fable 5`,hint:`flagship`},{value:`claude-opus-4-8`,label:`Claude Opus 4.8`,hint:`powerful`},{value:`claude-opus-4-7`,label:`Claude Opus 4.7`,hint:`powerful`},{value:`claude-opus-4-6`,label:`Claude Opus 4.6`,hint:`powerful`},{value:`claude-sonnet-5`,label:`Claude Sonnet 5`,hint:`fast`},{value:`claude-sonnet-4-6`,label:`Claude Sonnet 4.6`,hint:`fast`},{value:`claude-haiku-4-5`,label:`Claude Haiku 4.5`,hint:`cheap`}];C.map(e=>e.value);function w(e,t){return`${e}/proxy${t?`/${t}`:``}`}function T(e,t){let n=w(e,t);return{anthropicBase:n,openAiBase:`${n}/v1`,anthropicMessages:`${n}/v1/messages`,openAiChatCompletions:`${n}/v1/chat/completions`,models:`${n}/v1/models`,imagesGenerations:t?`${n}/v1/images/generations`:null,imagesEdits:t?`${n}/v1/images/edits`:null}}var E=n(),D=`Hello! Reply briefly.`,O=`claude-opus-5-5`;function k(e){let[t,n]=(0,S.useState)(!1);return(0,E.jsxs)(m,{open:t,onOpenChange:n,children:[(0,E.jsx)(p,{asChild:!0,children:(0,E.jsxs)(c,{variant:`outline`,size:`sm`,className:`h-7 text-[11px] gap-1.5 cursor-pointer`,children:[(0,E.jsx)(r,{className:`size-3`}),`Test`]})}),(0,E.jsxs)(u,{className:`sm:max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,E.jsxs)(l,{children:[(0,E.jsx)(d,{className:`text-sm`,children:`Test Proxy`}),(0,E.jsx)(f,{className:`text-[11px]`,children:`Send a test request and inspect the raw response.`})]}),t&&(0,E.jsx)(A,{...e})]})]})}function A({authKey:e,baseUrl:t,provider:n}){let[r,a]=(0,S.useState)(`anthropic`),[o,l]=(0,S.useState)(D),[u,d]=(0,S.useState)(n?``:O),[f,p]=(0,S.useState)(!0),[m,g]=(0,S.useState)(!1),[v,y]=(0,S.useState)(null),[b,x]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),A=(0,S.useRef)(null),j=(0,S.useRef)(null);(0,S.useEffect)(()=>{A.current?.select()},[]),(0,S.useEffect)(()=>{j.current&&(j.current.scrollTop=j.current.scrollHeight)},[v]);let M=e=>{a(e),y(null),x(null),k(null)},N=async()=>{g(!0),y(null),x(null),k(null);let i=Date.now(),a=r===`openai`,s=T(t,n),c=a?s.openAiChatCompletions:s.anthropicMessages,l=JSON.stringify({...u?{model:u}:{},max_tokens:256,stream:f,messages:[{role:`user`,content:o}]}),d={"Content-Type":`application/json`};a?d.Authorization=`Bearer ${e}`:(d[`x-api-key`]=e,d[`anthropic-version`]=`2023-06-01`);try{let e=await fetch(c,{method:`POST`,headers:d,body:l});if(!e.ok){let t=await e.text();x(`HTTP ${e.status}: ${t}`),g(!1),k(Date.now()-i);return}if(f){let t=e.body?.getReader();if(!t){x(`No response body`),g(!1);return}let n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0}),y(r)}k(Date.now()-i)}else{let t=await e.text();try{y(JSON.stringify(JSON.parse(t),null,2))}catch{y(t)}k(Date.now()-i)}}catch(e){x(e.message)}finally{g(!1),k(e=>e??Date.now()-i)}};return(0,E.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5 min-w-0`,children:[(0,E.jsx)(_,{className:`text-[11px]`,children:`Auth Style`}),(0,E.jsx)(`div`,{className:`flex gap-1`,children:[`anthropic`,`openai`].map(e=>(0,E.jsx)(`button`,{onClick:()=>M(e),className:`flex-1 h-8 rounded-md text-[11px] font-medium border transition-colors cursor-pointer ${r===e?`bg-primary text-primary-foreground border-primary`:`bg-muted text-muted-foreground border-transparent hover:bg-muted/80`}`,children:e===`anthropic`?`Anthropic`:`OpenAI`},e))}),(0,E.jsxs)(`p`,{className:`text-[9px] text-muted-foreground break-all`,children:[r===`anthropic`?`x-api-key header`:`Authorization: Bearer header`,` · `,(0,E.jsx)(`code`,{children:`/proxy${n?`/${n}`:``}/v1/${r===`anthropic`?`messages`:`chat/completions`}`})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(_,{className:`text-[11px]`,children:`Model`}),n?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(h,{value:u,onChange:e=>d(e.target.value),placeholder:`leave empty to let the provider choose`,className:`h-8 text-[11px] font-mono`}),(0,E.jsxs)(`p`,{className:`text-[9px] text-muted-foreground`,children:[`Names come from `,(0,E.jsxs)(`code`,{children:[`GET /proxy/`,n,`/v1/models`]}),`.`]})]}):(0,E.jsx)(`select`,{value:u,onChange:e=>d(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-[11px]`,children:C.map(e=>(0,E.jsx)(`option`,{value:e.value,children:e.value},e.value))})]}),(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(_,{className:`text-[11px]`,children:`Streaming`}),(0,E.jsx)(`div`,{className:`flex gap-1`,children:[!0,!1].map(e=>(0,E.jsx)(`button`,{onClick:()=>p(e),className:`h-7 px-3 rounded-md text-[11px] font-medium border transition-colors cursor-pointer ${f===e?`bg-primary text-primary-foreground border-primary`:`bg-muted text-muted-foreground border-transparent hover:bg-muted/80`}`,children:e?`Stream`:`JSON`},String(e)))})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(_,{className:`text-[11px]`,children:`Message`}),(0,E.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,E.jsx)(h,{ref:A,value:o,onChange:e=>l(e.target.value),placeholder:`Type a test message...`,className:`h-9 text-[11px] flex-1 min-w-0`,onKeyDown:e=>{e.key===`Enter`&&!m&&N()}}),(0,E.jsxs)(c,{size:`sm`,className:`h-9 px-3 cursor-pointer shrink-0`,onClick:N,disabled:m||!o.trim(),children:[m?(0,E.jsx)(s,{className:`size-3.5 animate-spin`}):(0,E.jsx)(i,{className:`size-3.5`}),(0,E.jsx)(`span`,{className:`ml-1 text-[11px]`,children:m?`...`:`Send`})]})]})]}),(v||b)&&(0,E.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(_,{className:`text-[10px] text-muted-foreground`,children:`Raw Response`}),w!=null&&(0,E.jsxs)(`span`,{className:`text-[9px] font-mono text-muted-foreground`,children:[(w/1e3).toFixed(1),`s`]})]}),b?(0,E.jsx)(`pre`,{className:`text-[9px] font-mono bg-error/10 text-error p-2 rounded overflow-auto max-h-52 whitespace-pre-wrap break-all`,children:b}):(0,E.jsx)(`pre`,{ref:j,className:`text-[9px] font-mono bg-muted p-2 rounded overflow-auto max-h-52 whitespace-pre-wrap break-all`,children:v})]})]})}function j(){let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)([]);(0,S.useEffect)(()=>{b().then(e=>r(Object.keys(e.providers??{}).filter(e=>e!==`mock`&&e!==`claude`))).catch(()=>r([]))},[]);let[i,s]=(0,S.useState)(null),[l,u]=(0,S.useState)(!0),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(null),[C,w]=(0,S.useState)(null);(0,S.useEffect)(()=>{u(!0),x().then(s).catch(e=>m(e.message)).finally(()=>u(!1))},[]);let D=async e=>{f(!0),m(null);try{s(await y(e))}catch(e){m(e.message)}finally{f(!1)}},O=(e,t)=>{v(e),w(t),setTimeout(()=>w(null),2e3)};if(l||!i)return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`h3`,{className:`text-xs font-medium text-text-secondary`,children:`API Proxy`}),(0,E.jsx)(`p`,{className:`text-[11px] text-text-subtle`,children:p?`Error: ${p}`:`Loading...`})]});let A=!!i.authKey,j=!!i.tunnelUrl,M=i.localEndpoint.replace(/\/proxy\/v1\/messages$/,``),N=T(j?i.tunnelUrl:M,e),P=N.anthropicMessages,F=N.openAiChatCompletions,I=`ANTHROPIC_BASE_URL=${N.anthropicBase}\nANTHROPIC_API_KEY=${i.authKey}`,L=`OPENAI_BASE_URL=${N.openAiBase}\nOPENAI_API_KEY=${i.authKey}`;return(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsx)(`div`,{className:`space-y-1.5`,children:(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Expose your accounts as an API that speaks both the Anthropic and OpenAI formats, so most SDKs need only a new base URL. The default path answers from your Claude accounts; pick a provider below to run its agent instead, which also unlocks image generation.`})}),(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,E.jsx)(_,{className:`text-xs`,children:`Enable Proxy`}),(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Accept API requests under /proxy`})]}),(0,E.jsx)(g,{checked:i.enabled,onCheckedChange:e=>D({enabled:e}),disabled:d})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(_,{className:`text-[11px]`,children:`Auth Key`}),A?(0,E.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,E.jsx)(h,{readOnly:!0,value:i.authKey,className:`h-7 text-[11px] font-mono flex-1`}),(0,E.jsx)(c,{variant:`outline`,size:`sm`,className:`h-7 px-2 cursor-pointer shrink-0`,onClick:()=>O(i.authKey,`key`),children:C===`key`?`Copied!`:(0,E.jsx)(o,{className:`size-3`})}),(0,E.jsx)(c,{variant:`outline`,size:`sm`,className:`h-7 px-2 cursor-pointer shrink-0`,onClick:()=>D({generateKey:!0}),disabled:d,children:(0,E.jsx)(a,{className:`size-3`})})]}):(0,E.jsx)(c,{variant:`outline`,size:`sm`,className:`h-7 text-xs cursor-pointer`,onClick:()=>D({generateKey:!0}),disabled:d,children:`Generate Auth Key`}),(0,E.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Use as Bearer token or x-api-key when calling the proxy.`})]}),i.enabled&&A&&(0,E.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3 bg-muted/30`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(`h4`,{className:`text-[11px] font-medium`,children:`Connection Info`}),(0,E.jsx)(k,{authKey:i.authKey,baseUrl:window.location.origin,provider:e})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(_,{className:`text-[10px] text-muted-foreground`,children:`Provider`}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:[{id:``,label:`Claude (default)`},...n.map(e=>({id:e,label:e}))].map(n=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),className:`text-[10px] px-2.5 min-h-[36px] rounded-md border transition-colors cursor-pointer ${e===n.id?`border-primary bg-primary/15`:`border-border bg-muted/40 hover:bg-muted`}`,children:n.label},n.id||`default`))}),e&&(0,E.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Runs the `,e,` agent per request (read-only sandbox, one turn). Slower than the default path.`]})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(_,{className:`text-[10px] text-muted-foreground`,children:`Anthropic Endpoint`}),(0,E.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,E.jsx)(`code`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded flex-1 truncate`,children:P}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 cursor-pointer shrink-0`,onClick:()=>O(P,`anthropic`),children:C===`anthropic`?`Copied!`:(0,E.jsx)(o,{className:`size-3`})})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(_,{className:`text-[10px] text-muted-foreground`,children:`OpenAI-Compatible Endpoint`}),(0,E.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,E.jsx)(`code`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded flex-1 truncate`,children:F}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 cursor-pointer shrink-0`,onClick:()=>O(F,`openai`),children:C===`openai`?`Copied!`:(0,E.jsx)(o,{className:`size-3`})})]})]}),N.imagesGenerations&&N.imagesEdits&&(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(_,{className:`text-[10px] text-muted-foreground`,children:`Image Endpoints`}),(0,E.jsx)(`code`,{className:`block text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded truncate`,children:N.imagesGenerations}),(0,E.jsx)(`code`,{className:`block text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded truncate`,children:N.imagesEdits})]}),!j&&(0,E.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Start a Cloudflare tunnel (Share) to get a public URL.`}),(0,E.jsxs)(`div`,{className:`space-y-1 pt-1`,children:[(0,E.jsx)(_,{className:`text-[10px] text-muted-foreground`,children:`Anthropic Format`}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`pre`,{className:`text-[9px] font-mono bg-muted p-2 rounded overflow-x-auto whitespace-pre`,children:I}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`absolute top-1 right-1 h-5 px-1 cursor-pointer`,onClick:()=>O(I,`anthropic-env`),children:C===`anthropic-env`?`Copied!`:(0,E.jsx)(o,{className:`size-2.5`})})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(_,{className:`text-[10px] text-muted-foreground`,children:`OpenAI Format`}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`pre`,{className:`text-[9px] font-mono bg-muted p-2 rounded overflow-x-auto whitespace-pre`,children:L}),(0,E.jsx)(c,{variant:`ghost`,size:`sm`,className:`absolute top-1 right-1 h-5 px-1 cursor-pointer`,onClick:()=>O(L,`openai-env`),children:C===`openai-env`?`Copied!`:(0,E.jsx)(o,{className:`size-2.5`})})]})]}),(0,E.jsx)(`div`,{className:`flex items-center gap-3 pt-1`,children:(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`Requests served: `,(0,E.jsx)(`span`,{className:`font-mono`,children:i.requestCount})]})})]}),d&&(0,E.jsx)(`p`,{className:`text-[11px] text-text-subtle`,children:`Saving...`}),p&&(0,E.jsx)(`p`,{className:`text-[11px] text-error`,children:p})]})}export{j as ProxySettingsSection};
|
|
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-P9Ym7hCv.js";import{Mr as r,un as i}from"./icons-CO_II6D-.js";import{O as a}from"./api-client-F5Zi1sR0.js";import"./chat-preparation-cache-BUCR58h4.js";import{t as o}from"./button-DeAyLH9U.js";import{t as s}from"./input-CG8PS8mS.js";import{f as c,n as l,w as u}from"./api-settings-
|
|
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-P9Ym7hCv.js";import{Mr as r,un as i}from"./icons-CO_II6D-.js";import{O as a}from"./api-client-F5Zi1sR0.js";import"./chat-preparation-cache-BUCR58h4.js";import{t as o}from"./button-DeAyLH9U.js";import{t as s}from"./input-CG8PS8mS.js";import{f as c,n as l,w as u}from"./api-settings-Cc_CpfmC.js";var d=e(t(),1),f=n();function p(e){return e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function m(){let[e,t]=(0,d.useState)(null),[n,m]=(0,d.useState)(``),[h,g]=(0,d.useState)(``),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(!1);function x(e){t(e),m(String(e.retention_days)),g(String(e.max_size_mb))}(0,d.useEffect)(()=>{c().then(x).catch(e=>a.error(`Could not load audit settings`,{description:e.message}))},[]);async function S(){v(!0);try{x(await u({retention_days:Number(n),max_size_mb:Number(h)})),a.success(`Audit retention updated`)}catch(e){a.error(`Could not save`,{description:e.message})}finally{v(!1)}}async function C(){if(confirm(`Delete every recorded query? This cannot be undone.`)){b(!0);try{await l(),x(await c()),a.success(`Query audit log cleared`)}catch(e){a.error(`Could not clear the log`,{description:e.message})}finally{b(!1)}}}if(!e)return(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground`,children:(0,f.jsx)(i,{className:`size-4 animate-spin`})});let w=n!==String(e.retention_days)||h!==String(e.max_size_mb);return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Every statement run from the SQL editor, the data grid and the `,(0,f.jsx)(`code`,{children:`ppm db`}),` CLI is recorded, together with a sample of the result. Entries are pruned once they pass either limit below — whichever comes first.`]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`label`,{className:`space-y-1`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium`,children:`Keep for (days)`}),(0,f.jsx)(s,{type:`number`,min:1,value:n,onChange:e=>m(e.target.value),className:`h-8 text-xs`})]}),(0,f.jsxs)(`label`,{className:`space-y-1`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium`,children:`Max size (MB)`}),(0,f.jsx)(s,{type:`number`,min:10,value:h,onChange:e=>g(e.target.value),className:`h-8 text-xs`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,f.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.entry_count.toLocaleString(),` entries · `,p(e.size_bytes),` on disk`]}),(0,f.jsx)(o,{size:`sm`,className:`h-8 text-xs`,disabled:!w||_,onClick:S,children:_?(0,f.jsx)(i,{className:`size-3.5 animate-spin`}):`Save`})]}),(0,f.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-8 w-full gap-1.5 text-xs text-destructive`,disabled:y||e.entry_count===0,onClick:C,children:[y?(0,f.jsx)(i,{className:`size-3.5 animate-spin`}):(0,f.jsx)(r,{className:`size-3.5`}),`Clear all recorded queries`]})]})}export{m as QueryAuditSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -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{Ar as r,G as i,Jr as a,W as o}from"./icons-CO_II6D-.js";import{a as s,r as c}from"./api-client-F5Zi1sR0.js";import{E as l,t as u}from"./settings-store-Cyuo8ceh.js";import{n as d}from"./utils-btZ8C8-R.js";import{t as f}from"./ws-auth-Ytui7dXP.js";import{et as p}from"./index-CyDLBddf.js";import{n as m}from"./use-h264-canvas-decoder-BfO9QrlH.js";import{r as h}from"./run-in-terminal-DCBNtYHQ.js";function g(e,t,n=`8081`){let r=f(`/ws/remote-desktop`),i=e.protocol===`https:`?`wss:`:`ws:`;return t&&e.protocol!==`https:`?`ws://${e.hostname}:${n}${r}`:`${i}//${e.host}${r}`}var _=e(t(),1),v=400,y=25,b=6e3;function x(e,{onFailure:t}={}){let[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(null),[o,c]=(0,_.useState)({width:0,height:0}),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(0),p=(0,_.useRef)(0),m=(0,_.useRef)(null),h=(0,_.useRef)(null),g=(0,_.useRef)(0),v=(0,_.useRef)(t);v.current=t;let y=(0,_.useCallback)(()=>{g.current+=1,m.current&&=(clearInterval(m.current),null),h.current&&=(clearTimeout(h.current),null);try{l.current?.close()}catch{}l.current=null;let e=u.current;e&&(e.srcObject=null,e.remove(),u.current=null),d.current=null},[]),x=(0,_.useCallback)(()=>{y(),r(`idle`),a(null)},[y]);return{status:n,errorMessage:i,start:(0,_.useCallback)(t=>{y();let n=g.current,i=()=>n!==g.current,o=!1,_=(e,t=`error`)=>{i()||o||(o=!0,r(t),a(e),v.current?.())};if(typeof RTCPeerConnection>`u`){_(`This browser has no WebRTC support.`,`unsupported`);return}let x=document.createElement(`video`);x.autoplay=!0,x.muted=!0,x.playsInline=!0,x.setAttribute(`aria-hidden`,`true`),x.style.cssText=`position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none`,document.body.appendChild(x),u.current=x;let w=()=>{if(i())return;let t=e.current;t&&x.videoWidth>0&&((t.width!==x.videoWidth||t.height!==x.videoHeight)&&(t.width=x.videoWidth,t.height=x.videoHeight,c({width:x.videoWidth,height:x.videoHeight})),d.current||=t.getContext(`2d`),d.current?.drawImage(x,0,0,t.width,t.height),f.current+=1),T()},T=()=>typeof x.requestVideoFrameCallback==`function`?x.requestVideoFrameCallback(()=>w()):requestAnimationFrame(()=>w()),E=new RTCPeerConnection({iceServers:[]});l.current=E,E.addTransceiver(`video`,{direction:`recvonly`}),E.ontrack=e=>{let t=new MediaStream;t.addTrack(e.track),x.srcObject=t,x.play().catch(()=>{}),T()},E.onconnectionstatechange=()=>{i()||(E.connectionState===`connected`&&(h.current&&=(clearTimeout(h.current),null),r(`ready`),a(null)),E.connectionState===`failed`&&_(`The WebRTC connection failed.`))},m.current=setInterval(async()=>{if(!(i()||!l.current))try{(await l.current.getStats()).forEach(e=>{e.type===`inbound-rtp`&&e.kind===`video`&&(p.current=e.bytesReceived??0)})}catch{}},1e3),(async()=>{try{if(await E.setLocalDescription(await E.createOffer()),await S(E),i())return;let e=s(),n=await C(t,E.localDescription.sdp,e,i);if(i())return;if(!n){_(`The host's WebRTC relay never produced a stream.`);return}if(await E.setRemoteDescription({type:`answer`,sdp:n}),i()||E.connectionState===`connected`)return;h.current=setTimeout(()=>{h.current=null,E.connectionState!==`connected`&&_(`The WebRTC connection did not come up.`)},b)}catch(e){_(e.message)}})()},[e,y]),stop:x,getFrameCount:()=>f.current,getTotalBytes:()=>p.current,frameSize:o}}function S(e){return e.iceGatheringState===`complete`?Promise.resolve():new Promise(t=>{let n=()=>{e.iceGatheringState===`complete`&&(e.removeEventListener(`icegatheringstatechange`,n),t())};e.addEventListener(`icegatheringstatechange`,n),setTimeout(()=>{e.removeEventListener(`icegatheringstatechange`,n),t()},2e3)})}async function C(e,t,n,r){for(let i=0;i<y;i++){if(r())return null;let i=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/sdp`,...n?{Authorization:`Bearer ${n}`}:{},"x-ppm-client":`web`},body:t});if(i.ok)return await i.text();if(i.status!==404&&i.status!==502)throw Error(`the host refused the WebRTC handshake (${i.status})`);await new Promise(e=>setTimeout(e,v))}return null}function w(e){return e.code===`KeyV`&&(e.ctrlKey||e.metaKey)}function T(e){return(e.code===`KeyC`||e.code===`KeyX`)&&(e.ctrlKey||e.metaKey)}function E(e){let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:0;left:-9999px;opacity:0`,t.setAttribute(`aria-hidden`,`true`),document.body.appendChild(t);let n=document.activeElement,r=!1;try{t.focus({preventScroll:!0}),t.setSelectionRange(0,e.length),t.select(),r=document.execCommand(`copy`)}catch{r=!1}t.remove();try{n?.focus({preventScroll:!0})}catch{}return r}async function ee(e){try{return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),!0):!1}catch{return!1}}var D=120,O=400;function te(){let e=(0,_.useRef)(null),t=(0,_.useRef)(null),n=(0,_.useRef)(null),r=(0,_.useRef)(0),i=(0,_.useRef)(0),[a,o]=(0,_.useState)(`idle`),s=(0,_.useCallback)(()=>{try{t.current?.close()}catch{}t.current=null,n.current=null;let a=e.current;e.current=null,a&&a.close().catch(()=>{}),r.current=0,i.current=0,o(e=>e===`unsupported`?e:`idle`)},[]),c=(0,_.useCallback)(t=>{let i=e.current;if(!i){t.close();return}let a=t.numberOfFrames,o=t.numberOfChannels,s=i.createBuffer(o,a,t.sampleRate);for(let e=0;e<o;e++){let n=new Float32Array(a);t.copyTo(n,{planeIndex:e,format:`f32-planar`}),s.copyToChannel(n,e)}t.close();let c=i.currentTime,l=(r.current-c)*1e3;(l<0||l>O)&&(r.current=c+D/1e3);let u=i.createBufferSource();u.buffer=s,u.connect(i.destination),n.current&&u.connect(n.current),u.start(r.current),r.current+=s.duration},[]),l=(0,_.useCallback)(async(a,l)=>{if(typeof AudioDecoder>`u`||typeof AudioContext>`u`){o(`unsupported`);return}s();let u=new AudioContext({sampleRate:l,latencyHint:`interactive`});e.current=u,u.state===`suspended`&&await u.resume().catch(()=>{}),n.current=u.createMediaStreamDestination();let d=new AudioDecoder({output:c,error:()=>{try{t.current?.reset()}catch{}}});try{d.configure({codec:`opus`,sampleRate:l,numberOfChannels:a})}catch{o(`unsupported`);return}t.current=d,r.current=0,i.current=0,o(`playing`)},[c,s]),u=(0,_.useCallback)(e=>{let n=t.current;if(!n||n.state!==`configured`)return;let r=i.current;i.current+=2e4;try{n.decode(new EncodedAudioChunk({type:`key`,timestamp:r,data:e}))}catch{}},[]),d=(0,_.useCallback)(()=>n.current?n.current.stream.getAudioTracks():[],[]);return(0,_.useEffect)(()=>()=>s(),[s]),{status:a,configure:l,decodePacket:u,reset:s,getTracks:d}}var ne=5e3,re=2,k=`ppm.remoteDesktop.webrtcUnusable`;function ie(){try{return sessionStorage.getItem(k)===`1`}catch{return!1}}function ae(){try{sessionStorage.setItem(k,`1`)}catch{}}function A(e,{displayId:t}={}){let n=(0,_.useRef)(null),r=(0,_.useRef)(0),[i,a]=(0,_.useState)(`connecting`),[o,s]=(0,_.useState)(null),[d,f]=(0,_.useState)(0),[p,h]=(0,_.useState)(()=>({preset:l(u.getState().remoteDesktopQuality)??`balanced`,held:1})),v=(0,_.useRef)(l(u.getState().remoteDesktopQuality)),[y,b]=(0,_.useState)(null),S=(0,_.useRef)(null),C=u(e=>e.remoteDesktopShowCursor),w=u(e=>e.remoteDesktopClipboardSync),T=(0,_.useRef)(C),E=(0,_.useRef)(w);(0,_.useEffect)(()=>{T.current=C},[C]),(0,_.useEffect)(()=>{E.current=w},[w]);let D=(0,_.useRef)(u.getState().remoteDesktopCodec),[O,k]=(0,_.useState)(D.current),A=m(e),j=(0,_.useRef)(!1),M=x(e,{onFailure:(0,_.useCallback)(()=>{typeof VideoDecoder>`u`||j.current||(j.current=!0,ae(),f(e=>e+1))},[])}),[N,P]=(0,_.useState)(`websocket`),F=te(),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(!1),[oe,B]=(0,_.useState)(null),[V,H]=(0,_.useState)(null),[U,W]=(0,_.useState)(null),[G,K]=(0,_.useState)(null),q=(0,_.useCallback)(e=>{let t=n.current;t?.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},[]),J=(0,_.useCallback)(e=>{let t=l(e.preset);t&&h({preset:t,held:typeof e.held==`number`&&e.held>0&&e.held<1?e.held:1})},[]),Y=(0,_.useCallback)(e=>{if(e!==`custom`)return{type:`quality`,preset:e};let t=u.getState();return{type:`quality`,preset:`custom`,percent:t.remoteDesktopCustomQualityPercent,fps:t.remoteDesktopCustomFps}},[]),X=(0,_.useCallback)(e=>{v.current=e,u.getState().setRemoteDesktopQuality(e),q(Y(e))},[Y,q]),Z=(0,_.useCallback)((e,t)=>{let n=u.getState();n.setRemoteDesktopCustomQuality(e,t),n.setRemoteDesktopQuality(`custom`),v.current=`custom`,q(Y(`custom`))},[Y,q]),Q=(0,_.useCallback)(e=>{B(null),q({type:`privacy`,enabled:e})},[q]),$=(0,_.useCallback)(e=>{L(e),e||F.reset(),q({type:`audio`,enabled:e})},[F,q]),se=(0,_.useCallback)(e=>{D.current=e,u.getState().setRemoteDesktopCodec(e),k(e),e&&q({type:`codec`,encoder:e})},[q]),ce=(0,_.useCallback)(e=>{K(null),q({type:`resolution`,modeId:e})},[q]),le=(0,_.useCallback)(e=>{T.current=e,u.getState().setRemoteDesktopShowCursor(e),q({type:`cursor`,show:e})},[q]),ue=(0,_.useCallback)((e,t,n=!1)=>{q({type:`clipboard`,text:e,paste:t,shift:n})},[q]),de=(0,_.useCallback)(()=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{S.current=null,q({type:`clipboardRead`})},350)},[q]),fe=(0,_.useCallback)(()=>b(null),[]);(0,_.useEffect)(()=>()=>{S.current&&clearTimeout(S.current)},[]),(0,_.useEffect)(()=>{let e=!1,i=null;a(`connecting`),s(null),P(`websocket`),z(!1),B(null),r.current=0,A.reset(),(async()=>{let o;try{o=(await c.post(`/api/remote-desktop/session`)).nonce}catch(t){e||(a(`error`),s(t.message));return}if(e)return;let l=g(window.location,!1,void 0),u=new WebSocket(l);u.binaryType=`arraybuffer`,n.current=u,u.onopen=()=>{u.send(JSON.stringify({type:`auth`,nonce:o,...t?{displayId:t}:{},cursor:T.current,...D.current?{codec:D.current}:{},webrtc:!(j.current||ie())})),v.current&&u.send(JSON.stringify(Y(v.current))),i=setInterval(()=>q({type:`ping`}),ne)},u.onmessage=t=>{if(typeof t.data==`string`){let n;try{n=JSON.parse(t.data)}catch{return}if(n.type===`webrtc`&&typeof n.whepPath==`string`)P(`webrtc`),J(n),k(typeof n.encoder==`string`?n.encoder:null),M.start(n.whepPath),a(`streaming`);else if(n.type===`config`&&typeof n.codec==`string`)J(n),k(typeof n.encoder==`string`?n.encoder:null),A.configure(n.codec).then(()=>{e||a(`streaming`)});else if(n.type===`quality`)J(n);else if(n.type===`codec`)k(typeof n.encoder==`string`?n.encoder:null);else if(n.type===`resolution`)H(typeof n.modeId==`string`?n.modeId:null),W(typeof n.original==`string`?n.original:null),K(null);else if(n.type===`resolutionError`)K(typeof n.message==`string`?n.message:`The host refused the mode.`);else if(n.type===`privacy`)z(n.enabled===!0),B(typeof n.reason==`string`?n.reason:null);else if(n.type===`audio`){let e=n.enabled===!0;if(L(e),!e){F.reset();return}let t=typeof n.channels==`number`?n.channels:2,r=typeof n.sampleRate==`number`?n.sampleRate:48e3;F.configure(t,r)}else if(n.type===`clipboard`&&typeof n.text==`string`){if(!E.current)return;let t=n.text;ee(t).then(n=>{!n&&!e&&b(t)})}else n.type===`error`&&(a(`error`),s(typeof n.message==`string`?n.message:`Server error`));return}let n=new Uint8Array(t.data);if(!(n.length<1)){if(r.current+=n.length,n[0]===re){F.decodePacket(n.subarray(1));return}A.decodeAccessUnit(n.subarray(1),n[0]===1)}},u.onerror=()=>{e||(a(`error`),s(`WebSocket error`))},u.onclose=()=>{e||a(e=>e===`error`?e:`closed`)}})();let o=()=>{if(document.hidden||e)return;let t=n.current;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`ping`})):f(e=>e+1)};return document.addEventListener(`visibilitychange`,o),()=>{e=!0,document.removeEventListener(`visibilitychange`,o),i&&clearInterval(i);try{n.current?.close()}catch{}n.current=null;try{A.reset()}catch{}try{M.stop()}catch{}try{F.reset()}catch{}}},[d,t]);let pe=(0,_.useCallback)(()=>f(e=>e+1),[]),me=(0,_.useCallback)(()=>N===`webrtc`?M.getTotalBytes():r.current,[N,M]);return{connState:i,errorMessage:o,transport:N,decoderStatus:N===`webrtc`?M.status:A.status,decoderErrorMessage:N===`webrtc`?M.errorMessage:A.errorMessage,sendMessage:q,reconnect:pe,getTotalBytes:me,getFrameCount:N===`webrtc`?M.getFrameCount:A.getFrameCount,frameSize:N===`webrtc`?M.frameSize:A.frameSize,quality:p,setQuality:X,setCustomQuality:Z,showCursor:C,setShowCursor:le,codec:O,setCodec:se,audioOn:I,setAudioOn:$,getAudioTracks:F.getTracks,privacyOn:R,privacyError:oe,setPrivacyOn:Q,hostModeId:V,hostOriginalModeId:U,resolutionError:G,setHostMode:ce,pendingHostClipboard:y,clearHostClipboard:fe,sendClipboard:ue,requestHostClipboard:de}}function j(e){return Math.min(Math.max(e,0),1)}function M(e,t,n){let r=n.width>0?(e-n.left)/n.width:0,i=n.height>0?(t-n.top)/n.height:0;return{xFrac:j(r),yFrac:j(i)}}function N(e,t,n,r){let i=r.scale||1,a=n.left+n.width/2,o=n.top+n.height/2;return M(a+(e-a-r.panX)/i,o+(t-o-r.panY)/i,n)}function P(e,t,n){if(t<=0||n<=0||e.width<=0||e.height<=0)return e;let r=e.width/e.height,i=t/n;if(i>r){let t=e.width/i;return{left:e.left,top:e.top+(e.height-t)/2,width:e.width,height:t}}let a=e.height*i;return{left:e.left+(e.width-a)/2,top:e.top,width:a,height:e.height}}function F(e){let t=new Map;for(let n of e){if(n.width<=0||n.height<=0)continue;let e=`${n.width}x${n.height}`,r=t.get(e);(!r||I(n,r))&&t.set(e,n)}return[...t.values()].sort((e,t)=>t.width*t.height-e.width*e.height||t.refresh-e.refresh).map(e=>({id:e.id,width:e.width,height:e.height,refresh:e.refresh,current:e.current,preferred:e.preferred}))}function I(e,t){return e.current===t.current?e.preferred===t.preferred?e.refresh>t.refresh:e.preferred:e.current}function L(e,t,n){if(!t||t.width<=0||t.height<=0)return null;let r=e.filter(e=>e.width===t.width&&e.height===t.height);if(r.length===0)return null;let i=e.find(e=>e.id===n)??e.find(e=>e.current)??null;return i&&i.width===t.width&&i.height===t.height?null:r.reduce((e,t)=>I(t,e)?t:e)}function R(){if(typeof window>`u`||!window.screen)return null;let e=Math.round(window.screen.width),t=Math.round(window.screen.height);return e>0&&t>0?{width:e,height:t}:null}function z(e){let t=`${e.width} × ${e.height}`;return e.refresh>0?`${t} · ${e.refresh} Hz`:t}var oe=[`video/mp4;codecs=avc1.42E01E,mp4a.40.2`,`video/mp4`,`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`];function B(e=e=>typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported(e)){return typeof MediaRecorder>`u`?null:oe.find(e)??null}function V(e){return e.startsWith(`video/mp4`)?`mp4`:`webm`}function H(e,t=new Date){let n=e=>String(e).padStart(2,`0`);return`ppm-remote-${`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}_${n(t.getHours())}-${n(t.getMinutes())}-${n(t.getSeconds())}`}.${e}`}function U(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.rel=`noopener`,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e4)}async function W(e){if(!e||e.width===0||e.height===0)return!1;let t=await new Promise(t=>e.toBlob(t,`image/png`));return t?(U(t,H(`png`)),!0):!1}function G(e,t){let n=(0,_.useRef)(null),r=(0,_.useRef)([]),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(0),c=(0,_.useRef)(null);c.current===null&&(c.current=B());let l=(0,_.useCallback)(()=>{n.current?.stop()},[]),u=(0,_.useCallback)(()=>{let i=e.current,o=c.current;if(!i||!o||n.current)return;let l=i.captureStream();for(let e of t?.()??[])l.addTrack(e);let u;try{u=new MediaRecorder(l,{mimeType:o})}catch{return}r.current=[],u.ondataavailable=e=>{e.data.size>0&&r.current.push(e.data)},u.onstop=()=>{let e=new Blob(r.current,{type:o});r.current=[],n.current=null,a(!1),s(0),e.size>0&&U(e,H(V(o)))},u.start(1e3),n.current=u,a(!0),s(0)},[e,t]),d=(0,_.useCallback)(()=>{n.current?l():u()},[u,l]);return(0,_.useEffect)(()=>{if(!i)return;let e=Date.now(),t=setInterval(()=>{let t=Date.now()-e;s(Math.floor(t/1e3)),t>=72e5&&l()},1e3);return()=>clearInterval(t)},[i,l]),(0,_.useEffect)(()=>()=>{n.current?.stop()},[]),{recording:i,elapsedSec:o,supported:c.current!==null,toggle:d}}var K={fps:0,kbps:0};function q(e,t){let n=t.atMs-e.atMs;if(n<=0)return K;let r=n/1e3,i=Math.max(0,t.frameCount-e.frameCount),a=Math.max(0,t.totalBytes-e.totalBytes);return{fps:i/r,kbps:a/1024/r}}var J=n(),Y=500;function X({canvasRef:e,getFrameCount:t,getTotalBytes:n,positionClassName:r=`left-1 top-1`}){let i=u(e=>e.remoteDesktopStatsVisible),[a,o]=(0,_.useState)({fps:0,kbps:0,width:0,height:0}),s=(0,_.useRef)({frameCount:0,totalBytes:0,atMs:0});return(0,_.useEffect)(()=>{if(!i)return;s.current={frameCount:t(),totalBytes:n(),atMs:performance.now()};let r=setInterval(()=>{let r={frameCount:t(),totalBytes:n(),atMs:performance.now()},{fps:i,kbps:a}=q(s.current,r);s.current=r;let c=e.current;o({fps:i,kbps:a,width:c?.width??0,height:c?.height??0})},Y);return()=>clearInterval(r)},[i,e,t,n]),i?(0,J.jsxs)(`div`,{className:`pointer-events-none absolute z-40 rounded bg-black/60 px-1.5 py-0.5 font-mono text-[10px] text-white/80 ${r}`,"data-testid":`remote-desktop-stats-overlay`,children:[Math.round(a.fps),` fps · `,Math.round(a.kbps),` KB/s · `,a.width,`×`,a.height]}):null}function Z(){let{caps:e}=p(!1),t=e?.displays??[],[n,r]=(0,_.useState)(void 0),i=t.find(e=>e.id===n)??t.find(e=>e.primary)??t[0];return{displays:t,displayId:n,current:i,select:r,next:(0,_.useCallback)(()=>{t.length<2||r(t[(t.findIndex(e=>e.id===i?.id)+1)%t.length]?.id)},[t,i])}}function Q({pendingText:e,onDismiss:t,missingToolAction:n,onDismissMissingTool:a,positionClassName:s=`absolute bottom-2 left-1/2 max-w-[92%] -translate-x-1/2`}){let[c,l]=(0,_.useState)(!1);return e===null?n==null?null:(0,J.jsxs)($,{onDismiss:a??(()=>{}),testId:`remote-desktop-clipboard-missing-tool`,positionClassName:s,children:[(0,J.jsx)(o,{className:`size-4 shrink-0 text-amber-300`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:`The host has no clipboard tool installed.`}),n.kind===`terminal`&&(0,J.jsxs)(`button`,{type:`button`,onClick:()=>h(n.command),title:n.command,className:`inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded bg-white/15 px-2.5 text-xs hover:bg-white/25`,children:[(0,J.jsx)(r,{className:`size-3.5`}),` `,n.label]})]}):(0,J.jsxs)($,{onDismiss:t,testId:`remote-desktop-clipboard-pending`,positionClassName:s,children:[(0,J.jsx)(i,{className:`size-4 shrink-0 text-emerald-400`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[c?`Could not copy — select the text manually:`:`Copied on the host:`,(0,J.jsx)(`span`,{className:`ml-1 text-white/60`,children:se(e)})]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>{E(e)?t():l(!0)},className:`min-h-8 shrink-0 rounded bg-white/15 px-2.5 text-xs hover:bg-white/25`,"data-testid":`remote-desktop-clipboard-copy`,children:`Copy here`})]})}function $({children:e,onDismiss:t,testId:n,positionClassName:r}){return(0,J.jsxs)(`div`,{className:d(`z-50 flex items-center gap-2 rounded-lg border border-white/10 bg-black/85 px-3 py-2 text-xs text-white shadow-lg`,r),"data-testid":n,children:[e,(0,J.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Dismiss`,className:`flex size-8 shrink-0 items-center justify-center rounded text-white/60 hover:bg-white/10 hover:text-white`,children:(0,J.jsx)(a,{className:`size-3.5`})})]})}function se(e){let t=e.replace(/\s+/g,` `).trim();return t.length>60?`${t.slice(0,60)}…`:t}export{W as a,F as c,N as d,P as f,w as h,G as i,z as l,T as m,Z as n,L as o,A as p,X as r,R as s,Q as t,M as u};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-desktop-mobile-view-DPdP0yYu.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-CyDLBddf.js","assets/preload-helper-BEFjQwLd.js","assets/vendor-ui-P9Ym7hCv.js","assets/vendor-markdown-QKPNiWEd.js","assets/button-DeAyLH9U.js","assets/utils-btZ8C8-R.js","assets/createLucideIcon-DBXq3G0e.js","assets/api-client-F5Zi1sR0.js","assets/react-CzUPVyyG.js","assets/file-store-Cm7-pHux.js","assets/panel-store-B6PoCwBA.js","assets/session-list-sync-triggers-ATvz-1g3.js","assets/project-store-CCimwgGF.js","assets/window-store-vo1N70nK.js","assets/settings-store-Cyuo8ceh.js","assets/window-pip-registry-9Y9LQQYS.js","assets/onboarding-quick-orientation-DPHYFMbA.js","assets/dialog-Bocc0Fgb.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-BClDZJP5.js","assets/format-file-meta-Drxf2J-k.js","assets/fs-api-IX9SHt5k.js","assets/context-menu-7OX80HDB.js","assets/input-CG8PS8mS.js","assets/mobile-bottom-sheet-D4UyOatB.js","assets/use-visual-viewport-BGpcMnIx.js","assets/scroll-area-sjOeAfoD.js","assets/chat-preparation-cache-BUCR58h4.js","assets/file-icons-CK0J4QSy.js","assets/format-date-BMtvCeb9.js","assets/git-repo-store-B_u5RzIM.js","assets/ws-auth-Ytui7dXP.js","assets/tab-store-DCpc0g0Q.js","assets/apply-theme-Cc_cmrD5.js","assets/resolve-theme-STMsK2vc.js","assets/index-Dh5apC3I.css","assets/remote-desktop-clipboard-notice-CRvJqmaz.js","assets/use-h264-canvas-decoder-BfO9QrlH.js","assets/run-in-terminal-DCBNtYHQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{_t as r}from"./vendor-ui-P9Ym7hCv.js";import"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import"./settings-store-Cyuo8ceh.js";import{t as i}from"./preload-helper-BEFjQwLd.js";import{n as a}from"./portal-container-context-NFSuymMu.js";import"./panel-store-B6PoCwBA.js";import"./window-store-vo1N70nK.js";import"./project-store-CCimwgGF.js";import"./session-list-sync-triggers-ATvz-1g3.js";import{tt as o}from"./index-CyDLBddf.js";import"./run-in-terminal-DCBNtYHQ.js";import{n as s,t as c}from"./remote-desktop-readiness-gate-BeQ_Jrp7.js";var l=e(t(),1),u=e(r(),1),d=n(),f=(0,l.lazy)(()=>i(()=>import(`./remote-desktop-mobile-view-DPdP0yYu.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])));function p(){let e=o(e=>e.isOpen),t=o(e=>e.close),n=a();return e?(0,u.createPortal)((0,d.jsx)(`div`,{className:`fixed inset-0 z-[45] bg-black`,"data-testid":`remote-desktop-mobile-sheet`,children:(0,d.jsx)(s,{onCancel:t,children:(0,d.jsx)(c,{onCancel:t,children:(0,d.jsx)(l.Suspense,{fallback:(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-text-2`,children:`Loading…`}),children:(0,d.jsx)(f,{onClose:t})})})})}),n??document.getElementById(`root`)??document.body):null}export{p as RemoteDesktopMobileSheet};
|
|
Binary file
|
|
Binary file
|
|
@@ -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-P9Ym7hCv.js";import{En as r,Gr as i,Gt as a,Jr as o,Mn as s,Nt as c,On as l,Qt as u,Ur as d,W as f,or as p,pr as m,ti as h,ut as g,xr as _,z as v,zt as y}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{D as b,T as x,t as S}from"./settings-store-Cyuo8ceh.js";import{n as C}from"./utils-btZ8C8-R.js";import"./panel-store-B6PoCwBA.js";import"./window-store-vo1N70nK.js";import"./project-store-CCimwgGF.js";import"./session-list-sync-triggers-ATvz-1g3.js";import{t as w}from"./use-visual-viewport-BGpcMnIx.js";import"./ws-auth-Ytui7dXP.js";import{et as ee}from"./index-CyDLBddf.js";import"./use-h264-canvas-decoder-BfO9QrlH.js";import"./run-in-terminal-DCBNtYHQ.js";import{a as T,c as te,d as E,f as D,i as ne,n as re,o as O,p as k,r as A,s as ie,t as j}from"./remote-desktop-clipboard-notice-CRvJqmaz.js";var M=e(t(),1);function ae(e,t,n=10,r=300){let i=Math.hypot(t.x-e.x,t.y-e.y),a=t.t-e.t;return i<=n&&a<=r}function oe(e,t,n=15){return Math.abs(t-e)>n?`pinch`:`scroll`}function N(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function P(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function F(e,t,n){return Math.min(Math.max(e,t),n)}function I(e,t,n){return[{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!0},{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!1}]}function se(e,t,n){return{start:{x:e,y:t,t:performance.now()},last:{x:e,y:t},moved:!1,rect:n}}function ce(e,t,n,r,i,a){let o=Math.hypot(t-e.start.x,n-e.start.y);if(r===`touch`){if(!e.moved&&o>10){e.moved=!0;let r=E(e.start.x,e.start.y,e.rect,i);return e.last={x:t,y:n},{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!0}}}if(e.last={x:t,y:n},!e.moved)return{};let r=E(t,n,e.rect,i);return{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:null,down:null}}}let s=(t-e.last.x)/i.scale,c=(n-e.last.y)/i.scale;return o>10&&(e.moved=!0),e.last={x:t,y:n},{cursor:{xFrac:F(a.xFrac+s/e.rect.width,0,1),yFrac:F(a.yFrac+c/e.rect.height,0,1)},sendCursorMove:!0}}function L(e,t,n,r,i,a){let o={x:t,y:n,t:performance.now()},s=ae(e.start,o,10,300);if(r===`touch`){let r=E(t,n,e.rect,i);return!e.moved&&s?I(r.xFrac,r.yFrac,`left`):e.moved?[{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!1}]:[]}return!e.moved&&s?I(a.xFrac,a.yFrac,`left`):[]}function R(e,t,n){let r=P(e,t);return{startDistance:N(e,t),startMid:r,lastMid:r,startScale:n,startTime:performance.now(),gesture:null}}function le(e,t,n,r){let i=N(t,n),a=P(t,n);if(e.gesture===null){let t=Math.abs(i-e.startDistance),n=N(e.startMid,a);if(t>15)e.gesture=oe(e.startDistance,i,15);else if(n>15)e.gesture=`scroll`;else return e.lastMid=a,{}}let o;if(e.gesture===`pinch`)o={transform:{scale:F(e.startScale*(i/e.startDistance),1,4),panX:r.panX,panY:r.panY}};else if(r.scale>1.01){let t=a.x-e.lastMid.x,n=a.y-e.lastMid.y;o={transform:{scale:r.scale,panX:r.panX+t,panY:r.panY+n}}}else o={wheelDeltaPx:a.y-e.lastMid.y};return e.lastMid=a,o}function z(e,t,n){if(e.gesture===null&&performance.now()-e.startTime<=300){let r=E(e.lastMid.x,e.lastMid.y,t,n);return I(r.xFrac,r.yFrac,`right`)}return[]}var B={scale:1,panX:0,panY:0},ue=40,de=120;function fe({containerRef:e,canvasRef:t,mode:n,sendMessage:r,enabled:i}){let[a,o]=(0,M.useState)(B),[s,c]=(0,M.useState)({xFrac:.5,yFrac:.5}),l=(0,M.useRef)(a),u=(0,M.useRef)(s),d=(0,M.useRef)(n);d.current=n;let f=(0,M.useRef)({transform:null,cursor:null,sendCursorMove:!1,wheelPx:0}),p=(0,M.useRef)(0),m=(0,M.useCallback)(()=>{p.current=0;let e=f.current;e.transform&&=(l.current=e.transform,o(e.transform),null),e.cursor&&(u.current=e.cursor,c(e.cursor),e.sendCursorMove&&r({type:`pointer`,xFrac:e.cursor.xFrac,yFrac:e.cursor.yFrac,button:null,down:null}),e.cursor=null,e.sendCursorMove=!1),e.wheelPx!==0&&(r({type:`wheel`,dy:-(e.wheelPx/ue)*de}),e.wheelPx=0)},[r]),h=(0,M.useCallback)(()=>{p.current||=requestAnimationFrame(m)},[m]),g=(0,M.useCallback)(()=>{l.current=B,o(B)},[]);return(0,M.useEffect)(()=>{let n=e.current;if(!n||!i)return;let a=null,o=null,s=e=>e.forEach(r),c=()=>{let e=n.getBoundingClientRect(),r=t.current;return!r||!r.width||!r.height?e:D(e,r.width,r.height)},m=e=>{e.preventDefault(),e.stopPropagation();let t=c();if(e.touches.length===1){o=null;let n=e.touches[0];a=se(n.clientX,n.clientY,t)}else if(e.touches.length===2){a=null;let[t,n]=[e.touches[0],e.touches[1]];o=R({x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current.scale)}else a=null,o=null},g=e=>{if(e.preventDefault(),e.stopPropagation(),a&&e.touches.length===1){let t=e.touches[0],n=ce(a,t.clientX,t.clientY,d.current,l.current,u.current);n.message&&r(n.message),n.cursor&&(u.current=n.cursor,f.current.cursor=n.cursor,f.current.sendCursorMove=!!n.sendCursorMove,h());return}if(o&&e.touches.length===2){let[t,n]=[e.touches[0],e.touches[1]],r=le(o,{x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current);r.transform&&(l.current=r.transform,f.current.transform=r.transform,h()),r.wheelDeltaPx&&(f.current.wheelPx+=r.wheelDeltaPx,h())}},_=e=>{e.preventDefault(),e.stopPropagation();let t=e.changedTouches[0];if(a){let e=t?t.clientX:a.last.x,n=t?t.clientY:a.last.y;s(L(a,e,n,d.current,l.current,u.current)),a=null}o&&=(s(z(o,c(),l.current)),null)},v=e=>{e.stopPropagation(),a?.moved&&d.current===`touch`&&s(L(a,a.last.x,a.last.y,`touch`,l.current,u.current)),a=null,o=null};return n.addEventListener(`touchstart`,m,{passive:!1}),n.addEventListener(`touchmove`,g,{passive:!1}),n.addEventListener(`touchend`,_,{passive:!1}),n.addEventListener(`touchcancel`,v,{passive:!1}),()=>{p.current&&cancelAnimationFrame(p.current),n.removeEventListener(`touchstart`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,_),n.removeEventListener(`touchcancel`,v)}},[e,t,i,r,h]),{transform:a,virtualCursor:n===`mouse`?s:null,resetZoom:g}}function V(e,t,n){let r=e=>{n({type:`key`,code:e,down:!0}),n({type:`key`,code:e,down:!1})};switch(e){case`insertText`:return t&&n({type:`text`,text:t}),!0;case`insertLineBreak`:case`insertParagraph`:return r(`Enter`),!0;case`deleteContentBackward`:return r(`Backspace`),!0;case`deleteContentForward`:return r(`Delete`),!0;default:return!1}}function pe(e,t,n){let r=(0,M.useRef)(null);return(0,M.useEffect)(()=>{let i=r.current;if(!i||!t)return;let a=()=>e({type:`releaseAll`}),o=e=>e.code!==``&&e.key!==`Unidentified`,s=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!0}))},c=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!1}))},l=t=>{V(t.inputType,t.data,e)&&t.preventDefault()},u=t=>{t.data&&e({type:`text`,text:t.data}),i.value=``},d=e=>{let t=e.clipboardData?.getData(`text/plain`);!t||!n||(e.preventDefault(),n(t))},f=()=>a(),p=()=>{document.hidden&&a()};return i.addEventListener(`keydown`,s),i.addEventListener(`keyup`,c),i.addEventListener(`beforeinput`,l),i.addEventListener(`compositionend`,u),i.addEventListener(`paste`,d),i.addEventListener(`blur`,f),document.addEventListener(`visibilitychange`,p),()=>{i.removeEventListener(`keydown`,s),i.removeEventListener(`keyup`,c),i.removeEventListener(`beforeinput`,l),i.removeEventListener(`compositionend`,u),i.removeEventListener(`paste`,d),i.removeEventListener(`blur`,f),document.removeEventListener(`visibilitychange`,p),a()}},[t,e,n]),{inputRef:r,show:(0,M.useCallback)(()=>r.current?.focus(),[])}}var H=n();function U({onClick:e,label:t,active:n,children:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":t,className:C(`flex min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg py-1.5 text-[10px]`,`text-white/80 active:bg-white/10 transition-colors`,n&&`bg-white/15 text-white`),children:[r,(0,H.jsx)(`span`,{children:t})]})}function me({displayLabel:e,onNextDisplay:t,qualityLabel:n,onNextQuality:a,mode:c,onToggleMode:l,onOpenKeyboard:d,onResetZoom:f,settingsOpen:p,onToggleSettings:g,onClose:_}){return(0,H.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 border-t border-white/10 bg-black/90 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5`,"data-testid":`remote-desktop-mobile-toolbar`,children:[(0,H.jsx)(U,{onClick:l,label:c===`mouse`?`Mouse`:`Touch`,active:!0,children:c===`mouse`?(0,H.jsx)(s,{className:`size-5`}):(0,H.jsx)(y,{className:`size-5`})}),(0,H.jsx)(U,{onClick:d,label:`Keyboard`,children:(0,H.jsx)(u,{className:`size-5`})}),(0,H.jsx)(U,{onClick:f,label:`Reset zoom`,children:(0,H.jsx)(h,{className:`size-5`})}),e!==null&&(0,H.jsx)(U,{onClick:t,label:e.length>10?`${e.slice(0,9)}…`:e,children:(0,H.jsx)(r,{className:`size-5`})}),(0,H.jsx)(U,{onClick:a,label:n,children:(0,H.jsx)(i,{className:`size-5`})}),(0,H.jsx)(U,{onClick:g,label:`More`,active:p,children:(0,H.jsx)(m,{className:`size-5`})}),(0,H.jsx)(U,{onClick:_,label:`Close`,children:(0,H.jsx)(o,{className:`size-5`})})]})}function W(e){return(e.includes(`ControlLeft`)||e.includes(`MetaLeft`))&&(e.includes(`KeyC`)||e.includes(`KeyX`))}var G=[{label:`Ctrl`,code:`ControlLeft`},{label:`Alt`,code:`AltLeft`},{label:`Shift`,code:`ShiftLeft`},{label:`Win`,code:`MetaLeft`}],K=[{label:`Esc`,code:`Escape`},{label:`Tab`,code:`Tab`},{label:`←`,code:`ArrowLeft`},{label:`↑`,code:`ArrowUp`},{label:`↓`,code:`ArrowDown`},{label:`→`,code:`ArrowRight`}],q=[{label:`Ctrl+C`,codes:[`ControlLeft`,`KeyC`]},{label:`Ctrl+V`,codes:[`ControlLeft`,`KeyV`]},{label:`Ctrl+Z`,codes:[`ControlLeft`,`KeyZ`]},{label:`Ctrl+A`,codes:[`ControlLeft`,`KeyA`]},{label:`Alt+Tab`,codes:[`AltLeft`,`Tab`]},{label:`Ctrl+Alt+Del`,codes:[`ControlLeft`,`AltLeft`,`Delete`]}];function J({onClick:e,active:t,className:n,children:r}){return(0,H.jsx)(`button`,{type:`button`,onClick:e,className:C(`min-h-11 min-w-11 shrink-0 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-white/80`,`active:bg-white/15 transition-colors`,t&&`bg-primary text-primary-foreground`,n),children:r})}function he({sendMessage:e,onCopyCombo:t}){let[n,r]=(0,M.useState)(new Set),i=(0,M.useRef)(n);i.current=n,(0,M.useEffect)(()=>()=>{i.current.forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);let a=(0,M.useCallback)(t=>{r(n=>{let r=n.has(t);e({type:`key`,code:t,down:!r});let i=new Set(n);return r?i.delete(t):i.add(t),i})},[e]),o=(0,M.useCallback)(t=>{e({type:`key`,code:t,down:!0}),e({type:`key`,code:t,down:!1})},[e]),s=(0,M.useCallback)(n=>{n.forEach(t=>e({type:`key`,code:t,down:!0})),[...n].reverse().forEach(t=>e({type:`key`,code:t,down:!1})),W(n)&&t?.()},[e,t]);return(0,H.jsxs)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-t border-white/10 bg-black/90 px-2 py-1.5`,"data-testid":`remote-desktop-mobile-key-bar`,children:[G.map(e=>(0,H.jsx)(J,{onClick:()=>a(e.code),active:n.has(e.code),children:e.label},e.code)),(0,H.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),K.map(e=>(0,H.jsx)(J,{onClick:()=>o(e.code),children:e.label},e.code)),(0,H.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),q.map(e=>(0,H.jsx)(J,{onClick:()=>s(e.codes),children:e.label},e.label))]})}function Y({icon:e,label:t,hint:n,checked:r,onToggle:i,testId:a,disabled:o}){return(0,H.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:o,onClick:i,"data-testid":a,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-white/80 active:bg-white/10 disabled:opacity-50`,children:[(0,H.jsx)(`span`,{className:`shrink-0 opacity-80`,children:e}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-xs`,children:t}),n&&(0,H.jsx)(`span`,{className:`block truncate text-[10px] text-white/45`,children:n})]}),(0,H.jsx)(`span`,{className:C(`relative h-5 w-9 shrink-0 rounded-full transition-colors`,r?`bg-primary`:`bg-white/20`),children:(0,H.jsx)(`span`,{className:C(`absolute top-0.5 size-4 rounded-full bg-white transition-all`,r?`left-[1.125rem]`:`left-0.5`)})})]})}function ge({statsVisible:e,onToggleStats:t,showCursor:n,onSetShowCursor:r,clipboardEnabled:i,onSetClipboardEnabled:o,audioOn:l,audioReason:u,onSetAudioOn:p,privacyOn:m,privacyReason:h,onSetPrivacyOn:y,hostModes:b,hostModeId:x,hostOriginalModeId:S,onSetHostMode:w,canResizeHost:ee,resolutionError:T,recording:E,recordingSupported:D,onToggleRecording:ne,onScreenshot:re}){let k=(0,M.useMemo)(()=>te(b),[b]),A=(0,M.useMemo)(()=>ie(),[]),j=(0,M.useMemo)(()=>O(b,A,x),[b,A,x]);return(0,H.jsxs)(`div`,{className:`mx-2 mb-1 space-y-0.5 rounded-xl border border-white/10 bg-black/90 p-1`,"data-testid":`remote-desktop-mobile-settings`,children:[(0,H.jsx)(Y,{icon:(0,H.jsx)(c,{className:`size-4`}),label:`Quality monitor`,checked:e,onToggle:t,testId:`remote-desktop-mobile-stats-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(s,{className:`size-4`}),label:`Show remote cursor`,hint:`Restarts the stream`,checked:n,onToggle:()=>r(!n),testId:`remote-desktop-mobile-cursor-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(f,{className:`size-4`}),label:`Sync clipboard`,hint:`Off: Ctrl+V pastes the host's own clipboard`,checked:i,onToggle:()=>o(!i),testId:`remote-desktop-mobile-clipboard-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(d,{className:`size-4`}),label:`Play host audio`,hint:u??void 0,checked:l,disabled:u!==null,onToggle:()=>p(!l),testId:`remote-desktop-mobile-audio-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(g,{className:`size-4`}),label:`Privacy mode`,hint:h??`Blocks the host's own keyboard and mouse`,checked:m,disabled:h!==null&&!m,onToggle:()=>y(!m),testId:`remote-desktop-mobile-privacy-toggle`}),ee&&k.length>1&&(0,H.jsxs)(`div`,{className:`px-3 pt-1`,children:[(0,H.jsx)(`div`,{className:`pb-1.5 text-[10px] uppercase tracking-wide text-white/40`,children:`Resolution`}),(0,H.jsxs)(`div`,{className:`flex max-h-28 flex-wrap gap-1.5 overflow-y-auto`,children:[S&&S!==x&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>w(S),"data-testid":`remote-desktop-mobile-resolution-original`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Original`}),j&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>w(j.id),"data-testid":`remote-desktop-mobile-resolution-fit-local`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Fit local`}),k.map(e=>{let t=(x??k.find(e=>e.current)?.id)===e.id;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>w(e.id),"data-testid":`remote-desktop-mobile-resolution-${e.width}x${e.height}`,className:C(`min-h-9 rounded-md px-2.5 py-1 text-[11px] tabular-nums`,t?`bg-white/25 text-white`:`bg-white/10 text-white/70 active:bg-white/20`),children:[e.width,`×`,e.height]},e.id)})]}),T&&(0,H.jsx)(`div`,{className:`pt-1.5 text-[10px] leading-tight text-red-400`,children:T})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:re,"data-testid":`remote-desktop-mobile-screenshot`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:[(0,H.jsx)(a,{className:`size-4 opacity-80`}),` Save screenshot`]}),D&&(0,H.jsx)(`button`,{type:`button`,onClick:ne,"data-testid":`remote-desktop-mobile-record`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:E?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{className:`size-4 text-red-500`}),` Stop recording`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(v,{className:`size-4 opacity-80`}),` Start recording`]})})]})}function X({onClose:e}){let t=(0,M.useRef)(null),n=(0,M.useRef)(null),[r,i]=(0,M.useState)(`mouse`),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(!1),u=re(),{connState:d,errorMessage:f,decoderStatus:m,decoderErrorMessage:h,sendMessage:g,reconnect:_,getTotalBytes:v,getFrameCount:y,quality:C,setQuality:te,showCursor:E,setShowCursor:O,audioOn:ie,setAudioOn:ae,getAudioTracks:oe,privacyOn:N,privacyError:P,setPrivacyOn:F,hostModeId:I,hostOriginalModeId:se,resolutionError:ce,setHostMode:L,pendingHostClipboard:R,clearHostClipboard:le,sendClipboard:z,requestHostClipboard:B}=k(n,{displayId:u.displayId}),ue=S(e=>e.remoteDesktopStatsVisible),de=S(e=>e.toggleRemoteDesktopStatsVisible),V=S(e=>e.remoteDesktopClipboardSync),U=S(e=>e.setRemoteDesktopClipboardSync),W=S(e=>e.remoteDesktopQuality),G=d===`streaming`,{transform:K,virtualCursor:q,resetZoom:J}=fe({containerRef:t,canvasRef:n,mode:r,sendMessage:g,enabled:G}),[Y,X]=(0,M.useState)(!1),_e=(0,M.useCallback)(e=>{X(!0),z(e,!0)},[z]),{caps:Z}=ee(!1),Q=ne(n,oe),{inputRef:ve,show:ye}=pe(g,G,V?_e:void 0),$=w(!0)?.keyboardInset??0,be=(0,M.useCallback)(()=>i(e=>e===`mouse`?`touch`:`mouse`),[]),xe=(0,M.useCallback)(()=>{ye(),o(!0)},[ye]),Se=m===`unsupported`?h:d===`error`?f:d===`closed`?`Disconnected`:d===`connecting`?`Connecting…`:null,Ce={transform:`translate(${K.panX}px, ${K.panY}px) scale(${K.scale})`},we=`${(q?.xFrac??.5)*100}%`,Te=`${(q?.yFrac??.5)*100}%`;if(q&&t.current&&n.current?.width&&n.current.height){let e=t.current.getBoundingClientRect(),r=D({left:0,top:0,width:e.width,height:e.height},n.current.width,n.current.height);we=`${r.left+q.xFrac*r.width}px`,Te=`${r.top+q.yFrac*r.height}px`}return(0,H.jsxs)(`div`,{className:`relative h-full w-full bg-black`,"data-testid":`remote-desktop-mobile-view`,"data-conn-state":d,children:[(0,H.jsxs)(`div`,{ref:t,className:`absolute inset-x-0 top-0 flex items-center justify-center overflow-hidden`,style:{touchAction:`none`,bottom:$},"data-testid":`remote-desktop-mobile-stage-container`,children:[(0,H.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center`,style:Ce,children:[(0,H.jsx)(`canvas`,{ref:n,"data-testid":`remote-desktop-canvas`,className:`block h-full w-full min-h-0 min-w-0 object-contain outline-none`}),r===`mouse`&&q&&G&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute rounded-full border-2 border-white bg-primary shadow-[0_0_0_1px_rgba(0,0,0,0.6)]`,style:{left:we,top:Te,width:14,height:14,transform:`translate(-50%, -50%) scale(${1/K.scale})`},"data-testid":`remote-desktop-virtual-cursor`})]}),Se&&(0,H.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,H.jsx)(l,{className:`size-6 opacity-70`}),(0,H.jsx)(`span`,{className:`max-w-sm px-4 text-center`,children:Se}),(d===`error`||d===`closed`)&&m!==`unsupported`&&(0,H.jsxs)(`button`,{onClick:_,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,H.jsx)(p,{className:`size-3.5`}),` Reconnect`]})]}),(0,H.jsx)(`input`,{ref:ve,type:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`absolute size-px opacity-0`,"aria-hidden":`true`,tabIndex:-1,onBlur:()=>o(!1),"data-testid":`remote-desktop-virtual-keyboard-input`})]}),(0,H.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0`,style:$>0?{transform:`translateY(-${$}px)`}:void 0,"data-testid":`remote-desktop-mobile-bottom-bar`,children:[(0,H.jsx)(j,{pendingText:R,onDismiss:le,missingToolAction:Y&&Z&&!Z.clipboard.available?Z.clipboard.action:null,onDismissMissingTool:()=>X(!1),positionClassName:`mx-2 mb-1 max-w-[calc(100%-1rem)]`}),s&&(0,H.jsx)(ge,{statsVisible:ue,onToggleStats:de,showCursor:E,onSetShowCursor:O,clipboardEnabled:V,onSetClipboardEnabled:U,audioOn:ie,audioReason:Z&&!Z.audio.available?Z.audio.reason:null,onSetAudioOn:ae,privacyOn:N,privacyReason:P??(Z&&!Z.privacy.available?Z.privacy.reason:null),hostModes:Z?.resolutions?.modes??[],hostModeId:I,hostOriginalModeId:se,onSetHostMode:L,canResizeHost:Z?.inputReady??!1,resolutionError:ce,onSetPrivacyOn:F,recording:Q.recording,recordingSupported:Q.supported,onToggleRecording:Q.toggle,onScreenshot:()=>void T(n.current)}),a&&(0,H.jsx)(he,{sendMessage:g,onCopyCombo:V?B:void 0}),(0,H.jsx)(me,{displayLabel:u.displays.length>1?u.current?.label??null:null,onNextDisplay:u.next,qualityLabel:b(W),onNextQuality:()=>te(x(W)),mode:r,onToggleMode:be,onOpenKeyboard:xe,onResetZoom:J,settingsOpen:s,onToggleSettings:()=>c(e=>!e),onClose:e})]}),(0,H.jsx)(A,{canvasRef:n,getFrameCount:y,getTotalBytes:v,positionClassName:`left-1 top-[calc(env(safe-area-inset-top,0px)+2.75rem)]`})]})}export{X as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -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{Ar as r,Dn as i,E as a,ct as o,hr as s,un as c,z as l}from"./icons-CO_II6D-.js";import{t as u}from"./settings-store-Cyuo8ceh.js";import{et as d}from"./index-CyDLBddf.js";import{r as f}from"./run-in-terminal-DCBNtYHQ.js";var p=e(t(),1),m=n();function h({onCancel:e,children:t}){let n=u(e=>e.remoteDesktopWarningDismissed),r=u(e=>e.setRemoteDesktopWarningDismissed),[a,o]=(0,p.useState)(!1),[c,l]=(0,p.useState)(!1);if(n||a)return(0,m.jsx)(m.Fragment,{children:t});let d=()=>{c&&r(!0),o(!0)};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-warning-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(i,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`Remote Desktop`}),(0,m.jsx)(`span`,{className:`ml-auto rounded-full bg-amber-500/20 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-300`,children:`Beta`})]}),(0,m.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm text-white/80`,children:[(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`span`,{children:[`This streams the host's `,(0,m.jsx)(`strong`,{children:`whole screen`}),` and lets you `,(0,m.jsx)(`strong`,{children:`move its mouse and type`}),` as if you were sitting at it. Anything you do here happens on the real desktop.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Anyone signed in to this PPM can do the same. Avoid opening it over a public share link you don't fully trust; a private network (Tailscale, LAN) is safer.`})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Still beta: the host must be unlocked with an active session, UAC prompts stay hidden, and a person at the host will fight you for the cursor.`})]})]}),(0,m.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`size-4 accent-primary`,"data-testid":`remote-desktop-warning-dont-show`}),`Don't show this again`]}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,"data-testid":`remote-desktop-warning-cancel`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,onClick:d,className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`remote-desktop-warning-continue`,children:`Continue`})]})]})})}function g({onCancel:e,children:t}){let[n,r]=(0,p.useState)(!1),{caps:a,failed:o,runHostAction:s}=d(!n);if(n||a?.videoReady&&a.inputReady)return(0,m.jsx)(m.Fragment,{children:t});let l=a?.requirements.filter(e=>!e.ok)??[],u=!!a?.videoReady&&!a.inputReady,h=t=>{f(t),e()};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-readiness-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(i,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`This host needs a few things`})]}),!a&&!o&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(c,{className:`size-4 animate-spin`}),` Checking the host…`]}),o&&(0,m.jsx)(`p`,{className:`text-sm text-red-300`,children:`Could not reach the host's remote-desktop service.`}),(0,m.jsx)(`ul`,{className:`flex flex-col gap-3`,children:a?.requirements.map(e=>(0,m.jsx)(_,{req:e,onHostAction:s,onTerminal:h},e.id))}),l.length>0&&(0,m.jsx)(`p`,{className:`text-xs text-white/50`,children:`Re-checking every few seconds — this updates by itself once fixed.`}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,disabled:!a?.videoReady,onClick:()=>r(!0),className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40`,"data-testid":`remote-desktop-readiness-continue`,children:u?`Continue (view only)`:`Continue`})]})]})})}function _({req:e,...t}){return(0,m.jsxs)(`li`,{className:`flex gap-2`,"data-testid":`remote-desktop-requirement-${e.id}`,"data-ok":e.ok,children:[e.ok?(0,m.jsx)(a,{className:`mt-0.5 size-4 shrink-0 text-emerald-400`}):(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.title,!e.ok&&(0,m.jsx)(`span`,{className:`ml-2 text-xs font-normal text-white/50`,children:e.gates===`video`?`required`:`for mouse & keyboard`})]}),!e.ok&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`text-sm text-white/70`,children:e.detail}),(0,m.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions.map(n=>(0,m.jsx)(v,{action:n,reqId:e.id,...t},n.label))})]})]})]})}function v({action:e,reqId:t,onHostAction:n,onTerminal:i}){let a=`inline-flex min-h-11 items-center gap-1.5 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`;return e.kind===`terminal`?(0,m.jsxs)(`button`,{type:`button`,className:a,onClick:()=>i(e.command),title:e.command,children:[(0,m.jsx)(r,{className:`size-4`}),` `,e.label]}):e.kind===`link`?(0,m.jsxs)(`a`,{className:a,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,m.jsx)(o,{className:`size-4`}),` `,e.label]}):(0,m.jsx)(`button`,{type:`button`,className:a,onClick:()=>void n(t,e.action),children:e.label})}export{h as n,g as t};
|
|
Binary file
|
|
Binary file
|
|
@@ -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-P9Ym7hCv.js";import{En as r,Mr as i,st as a,un as o,w as s}from"./icons-CO_II6D-.js";import{O as c,r as l}from"./api-client-F5Zi1sR0.js";import{t as u}from"./button-DeAyLH9U.js";import{t as d}from"./separator-dHj3Km--.js";var f=e(t(),1),p=n(),m=e=>`${Math.round(e/1e6)} MB`;function h(){let[e,t]=(0,f.useState)(null),[n,h]=(0,f.useState)(!1),g=(0,f.useRef)(null),_=(0,f.useCallback)(async()=>{try{t(await l.get(`/api/remote-desktop/relay`))}catch{}},[]);(0,f.useEffect)(()=>{_()},[_]);let v=!!e?.job&&!e.job.done;(0,f.useEffect)(()=>{if(v)return g.current=setTimeout(()=>void _(),700),()=>{g.current&&clearTimeout(g.current)}},[v,e,_]);let y=async()=>{h(!0);try{await l.post(`/api/remote-desktop/relay/install`),await _()}catch(e){c.error(`Could not start the download`,{description:e instanceof Error?e.message:String(e)})}finally{h(!1)}},b=async()=>{h(!0);try{await l.post(`/api/remote-desktop/relay/uninstall`),await _()}catch(e){c.error(`Could not remove the relay`,{description:e instanceof Error?e.message:String(e)})}finally{h(!1)}},x=e?.job??null,S=x&&x.totalBytes>0?Math.round(x.receivedBytes/x.totalBytes*100):null,C=typeof window<`u`&&!window.isSecureContext;return(0,p.jsxs)(`div`,{className:`space-y-6`,children:[(0,p.jsxs)(`section`,{className:`space-y-3`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h3`,{className:`text-sm font-medium`,children:`WebRTC relay`}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:`Streams the desktop over WebRTC instead of a WebSocket. It repackages the video this host already encoded — it never re-encodes, so the picture and the CPU cost are unchanged.`})]}),C&&(0,p.jsxs)(`p`,{className:`rounded-md bg-muted px-4 py-3 text-xs leading-relaxed`,children:[`You are reading this over plain HTTP. Browsers only expose the WebCodecs video decoder on HTTPS or localhost, so `,(0,p.jsx)(`strong`,{children:`Remote Desktop cannot show a picture on this address`}),` without the relay. Installing it fixes that; so does reaching PPM through its HTTPS tunnel.`]}),!e?.available&&!e?.installed&&(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:[`MediaMTX publishes no build for this platform. You can install it yourself and put`,(0,p.jsx)(`code`,{className:`mx-1 rounded bg-muted px-1 py-0.5`,children:`mediamtx`}),`on this host's PATH — PPM generates its own configuration either way.`]}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[e?.installed?(0,p.jsx)(s,{className:`size-4 text-emerald-500`}):(0,p.jsx)(r,{className:`size-4 text-muted-foreground`}),(0,p.jsx)(`span`,{children:e?.installed?e.source===`system`?`Installed on this host (not by PPM)`:`Installed — MediaMTX ${e.pinnedVersion}`:`Not installed`})]}),(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-2 sm:ml-auto`,children:[!e?.installed&&e?.available&&(0,p.jsx)(u,{onClick:y,disabled:n||v,className:`min-h-11 px-4`,children:v?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o,{className:`size-4 animate-spin`}),`Downloading`,S===null?``:` ${S}%`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(a,{className:`size-4`}),`Install`]})}),e?.installed&&e.source===`bundled`&&(0,p.jsxs)(u,{variant:`outline`,onClick:b,disabled:n||v,className:`min-h-11 px-4`,children:[(0,p.jsx)(i,{className:`size-4`}),`Remove`]})]})]}),v&&x&&(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[m(x.receivedBytes),x.totalBytes>0?` of ${m(x.totalBytes)}`:``]}),x?.error&&(0,p.jsx)(`p`,{className:`text-xs text-destructive`,children:x.error}),e?.path&&(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:e.path})]}),(0,p.jsx)(d,{}),(0,p.jsxs)(`section`,{className:`space-y-2`,children:[(0,p.jsx)(`h3`,{className:`text-sm font-medium`,children:`What changes when it is on`}),(0,p.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-xs text-muted-foreground leading-relaxed`,children:[(0,p.jsx)(`li`,{children:`The picture works on a plain-HTTP LAN address, not only over HTTPS or localhost.`}),(0,p.jsx)(`li`,{children:`A lost packet costs one retransmission instead of stalling the whole stream.`}),(0,p.jsx)(`li`,{children:`Keyboard, mouse, clipboard and host audio keep using the same WebSocket.`}),(0,p.jsx)(`li`,{children:`Video leaves this host on its own UDP port, protected by per-session credentials.`})]})]})]})}export{h as RemoteDesktopSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -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-P9Ym7hCv.js";import{En as r,Gt as i,Nt as a,On as o,Tn as s,Zn as c,or as l,pr as u,ut as d,xr as f,z as p}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{C as m,a as h,c as g,d as _,f as v,i as y,l as b,m as x,n as S,o as ee,p as C,r as te,s as w,t as T,u as ne,w as re}from"./settings-store-Cyuo8ceh.js";import{n as ie}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-B6PoCwBA.js";import{t as E}from"./window-store-vo1N70nK.js";import"./project-store-CCimwgGF.js";import"./session-list-sync-triggers-ATvz-1g3.js";import{t as D}from"./button-DeAyLH9U.js";import{a as O,i as ae,n as k,o as A,r as j,t as M}from"./dialog-Bocc0Fgb.js";import"./ws-auth-Ytui7dXP.js";import{An as N,Cn as P,Dn as F,En as I,Mn as L,On as R,Sn as z,Tn as B,et as oe,jn as V,kn as H,wn as U,xn as W}from"./index-CyDLBddf.js";import"./use-h264-canvas-decoder-BfO9QrlH.js";import"./run-in-terminal-DCBNtYHQ.js";import{n as G,t as K}from"./remote-desktop-readiness-gate-BeQ_Jrp7.js";import{a as se,c as ce,h as q,i as le,l as ue,m as J,n as de,o as Y,p as fe,r as pe,s as me,t as he,u as X}from"./remote-desktop-clipboard-notice-CRvJqmaz.js";var Z=e(t(),1);function ge(e,t,n,r){let i=(0,Z.useCallback)((n,r,i,a)=>{let o=e.current;if(!o)return;let{xFrac:s,yFrac:c}=X(n,r,o.getBoundingClientRect());t({type:`pointer`,xFrac:s,yFrac:c,button:i,down:a})},[e,t]);(0,Z.useEffect)(()=>{let a=e.current;if(!a||!n)return;let o=e=>e===0?`left`:e===2?`right`:null,s=()=>t({type:`releaseAll`}),c=null,l=0,u=()=>{l=0,c&&=(i(c.x,c.y,null,null),null)},d=()=>{l&&=(cancelAnimationFrame(l),0),c&&=(i(c.x,c.y,null,null),null)},f=e=>{e.preventDefault(),a.setPointerCapture(e.pointerId),a.focus(),d(),i(e.clientX,e.clientY,o(e.button),!0)},p=e=>{c={x:e.clientX,y:e.clientY},l||=requestAnimationFrame(u)},m=e=>{d(),i(e.clientX,e.clientY,o(e.button),!1)},h=e=>e.preventDefault(),g=!1,_=e=>{if(r&&q(e)){g=e.shiftKey;return}e.preventDefault(),t({type:`key`,code:e.code,down:!0}),r&&J(e)&&r.onCopyCombo()},v=e=>{r&&q(e)||(e.preventDefault(),t({type:`key`,code:e.code,down:!1}))},y=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`);t&&r?.onPasteText(t,g),g=!1},b=()=>{document.hidden&&s()};return a.tabIndex=0,a.addEventListener(`pointerdown`,f),a.addEventListener(`pointermove`,p),a.addEventListener(`pointerup`,m),a.addEventListener(`contextmenu`,h),a.addEventListener(`keydown`,_),a.addEventListener(`keyup`,v),a.addEventListener(`paste`,y),a.addEventListener(`blur`,s),document.addEventListener(`visibilitychange`,b),()=>{l&&cancelAnimationFrame(l),a.removeEventListener(`pointerdown`,f),a.removeEventListener(`pointermove`,p),a.removeEventListener(`pointerup`,m),a.removeEventListener(`contextmenu`,h),a.removeEventListener(`keydown`,_),a.removeEventListener(`keyup`,v),a.removeEventListener(`blur`,s),document.removeEventListener(`visibilitychange`,b)}},[e,n,i,t,r])}var Q={h264_nvenc:`NVIDIA NVENC`,h264_qsv:`Intel QuickSync`,h264_vaapi:`VAAPI (GPU)`,h264_amf:`AMD AMF`,h264_videotoolbox:`Apple VideoToolbox`,libx264:`Software (x264)`};function _e(e){return Object.hasOwn(Q,e)?Q[e]:e}var $=n(),ve=`flex size-7 shrink-0 items-center justify-center rounded bg-black/40 text-white/70 outline-none hover:bg-black/60 hover:text-white data-[state=open]:bg-black/70 data-[state=open]:text-white`;function ye({displays:e,currentDisplayId:t,onSelectDisplay:n,quality:o,qualityChoice:s,onSetQuality:c,onOpenCustomQuality:l,codecs:h,codec:g,onSetCodec:_,hostModes:v,hostModeId:b,hostOriginalModeId:x,onSetHostMode:S,canResizeHost:ee,resolutionError:C,viewStyle:w,customScale:T,onSetViewStyle:ne,onSetCustomScale:E,showCursor:D,onSetShowCursor:O,audioOn:ae,audioReason:k,onSetAudioOn:A,privacyOn:j,privacyReason:M,privacyCanBlank:oe,onSetPrivacyOn:G,recording:K,recordingElapsedSec:se,recordingSupported:q,onToggleRecording:le,onScreenshot:J,clipboardEnabled:de,onSetClipboardEnabled:fe,statsVisible:pe,onToggleStats:he}){let X=(0,Z.useMemo)(()=>ce(v),[v]),ge=(0,Z.useMemo)(()=>me(),[]),Q=(0,Z.useMemo)(()=>Y(v,ge,b),[v,ge,b]),ye=!!(x&&x!==b),Se=t??e.find(e=>e.primary)?.id??e[0]?.id??``;return(0,$.jsxs)(`div`,{className:`absolute right-1 top-1 z-40 flex items-center gap-1`,"data-testid":`remote-desktop-toolbar`,children:[e.length>1&&(0,$.jsxs)(W,{children:[(0,$.jsx)(L,{className:ve,"aria-label":`Display`,title:`Display`,children:(0,$.jsx)(r,{className:`size-3.5`})}),(0,$.jsxs)(P,{align:`end`,className:`w-64`,children:[(0,$.jsx)(B,{children:`Display`}),(0,$.jsx)(I,{value:Se,onValueChange:n,children:e.map(e=>(0,$.jsxs)(F,{value:e.id,"data-testid":`remote-desktop-display-${e.id}`,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))})]})]}),(0,$.jsxs)(W,{children:[(0,$.jsx)(L,{className:ve,"aria-label":`Display settings`,title:`Display settings`,"data-testid":`remote-desktop-settings-trigger`,children:(0,$.jsx)(u,{className:`size-3.5`})}),(0,$.jsxs)(P,{align:`end`,className:`w-64`,children:[(0,$.jsx)(B,{children:`Scale`}),(0,$.jsx)(I,{value:w,onValueChange:e=>ne(e),children:y.map(e=>(0,$.jsx)(F,{value:e,"data-testid":`remote-desktop-view-style-${e}`,children:te[e]},e))}),w===`custom`&&(0,$.jsx)(xe,{scale:T,onSet:E}),(0,$.jsx)(R,{}),(0,$.jsxs)(H,{children:[(0,$.jsxs)(V,{"data-testid":`remote-desktop-quality-submenu`,children:[`Image quality`,o.held<1&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,"data-testid":`remote-desktop-quality-held`,children:[Math.round(o.held*100),`% — link limited`]})]}),(0,$.jsx)(N,{className:`w-56`,children:(0,$.jsxs)(I,{value:s,onValueChange:e=>e===`custom`?l():c(e),children:[re.map(e=>(0,$.jsx)(F,{value:e,"data-testid":`remote-desktop-quality-${e}`,children:m[e].label},e)),(0,$.jsx)(F,{value:`custom`,"data-testid":`remote-desktop-quality-custom`,children:`Custom…`})]})})]}),h.length>1&&(0,$.jsxs)(H,{children:[(0,$.jsx)(V,{"data-testid":`remote-desktop-codec-submenu`,children:`Codec`}),(0,$.jsx)(N,{className:`w-56`,children:(0,$.jsxs)(I,{value:g??`auto`,onValueChange:e=>_(e===`auto`?null:e),children:[(0,$.jsxs)(F,{value:`auto`,children:[`Auto · `,_e(h[0])]}),h.map(e=>(0,$.jsx)(F,{value:e,"data-testid":`remote-desktop-codec-${e}`,children:_e(e)},e))]})})]}),ee&&X.length>1&&(0,$.jsxs)(H,{children:[(0,$.jsx)(V,{"data-testid":`remote-desktop-resolution-submenu`,children:`Resolution`}),(0,$.jsxs)(N,{className:`max-h-80 w-56 overflow-y-auto`,children:[ye&&x&&(0,$.jsx)(U,{onSelect:()=>S(x),"data-testid":`remote-desktop-resolution-original`,children:`Original`}),Q&&(0,$.jsxs)(U,{onSelect:()=>S(Q.id),"data-testid":`remote-desktop-resolution-fit-local`,children:[`Fit local `,Q.width,`×`,Q.height]}),(ye||Q)&&(0,$.jsx)(R,{}),(0,$.jsx)(I,{value:b??X.find(e=>e.current)?.id??``,onValueChange:S,children:X.map(e=>(0,$.jsxs)(F,{value:e.id,"data-testid":`remote-desktop-resolution-${e.width}x${e.height}`,children:[ue(e),e.preferred&&(0,$.jsx)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:`native`})]},e.id))}),C&&(0,$.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] leading-tight text-destructive`,children:C})]})]}),(0,$.jsx)(R,{}),(0,$.jsx)(z,{checked:D,onCheckedChange:O,"data-testid":`remote-desktop-show-cursor`,children:`Show remote cursor`}),(0,$.jsx)(z,{checked:de,onCheckedChange:fe,"data-testid":`remote-desktop-clipboard-toggle`,children:`Sync clipboard`}),(0,$.jsx)(z,{checked:ae,disabled:k!==null,onCheckedChange:A,"data-testid":`remote-desktop-audio-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Play host audio`}),k&&(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:k})]})}),(0,$.jsx)(R,{}),(0,$.jsx)(z,{checked:j,disabled:M!==null&&!j,onCheckedChange:G,"data-testid":`remote-desktop-privacy-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Privacy mode`}),(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:M??(oe?`Blocks the host's keyboard and mouse, and blanks its screen`:`Blocks the host's keyboard and mouse (its screen stays on)`)})]})}),(0,$.jsx)(R,{}),(0,$.jsxs)(U,{onSelect:J,"data-testid":`remote-desktop-screenshot`,children:[(0,$.jsx)(i,{className:`size-3.5`}),` Save screenshot`]}),q&&(0,$.jsx)(U,{onSelect:le,"data-testid":`remote-desktop-record`,children:K?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{className:`size-3.5 text-red-500`}),` Stop recording · `,be(se)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-3.5`}),` Start recording`]})})]})]}),j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>G(!1),title:`Privacy mode is on — click to release the host`,"aria-label":`Turn privacy mode off`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-amber-500/85 px-1.5 text-[10px] font-medium text-black hover:bg-amber-400`,"data-testid":`remote-desktop-privacy-indicator`,children:[(0,$.jsx)(d,{className:`size-3`}),` Host locked`]}),K&&(0,$.jsxs)(`button`,{type:`button`,onClick:le,title:`Stop recording`,"aria-label":`Stop recording`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-red-600/80 px-1.5 text-[10px] font-medium tabular-nums text-white hover:bg-red-600`,"data-testid":`remote-desktop-recording-indicator`,children:[(0,$.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-white`}),be(se)]}),(0,$.jsx)(`button`,{type:`button`,onClick:he,"aria-label":`Toggle stats overlay`,"aria-pressed":pe,title:`Quality monitor`,className:ie(ve,pe&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,$.jsx)(a,{className:`size-3.5`})})]})}function be(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t>0?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function xe({scale:e,onSet:t}){let[n,r]=(0,Z.useState)(null),i=(0,Z.useRef)(null),a=w(Math.round(ee(e)*100)),o=n??a,l=g(o);(0,Z.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let u=e=>{r(e),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r(null),t(e/100)},300)},d=e=>t=>{t.preventDefault(),u(w(o+e*1))},f=`flex size-6 shrink-0 items-center justify-center rounded hover:bg-accent disabled:opacity-40`;return(0,$.jsx)(`div`,{className:`px-2 py-1.5`,"data-testid":`remote-desktop-zoom-row`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(-1),disabled:o<=5,"aria-label":`Decrease`,children:(0,$.jsx)(s,{className:`size-3.5`})}),(0,$.jsxs)(`span`,{className:`relative flex-1 py-2.5`,children:[(0,$.jsx)(`input`,{type:`range`,min:0,max:1,step:1/(S-5),value:l,"aria-label":`Scale`,"aria-valuetext":`${o}%`,"data-testid":`remote-desktop-zoom-slider`,onKeyDown:e=>e.stopPropagation(),onChange:e=>u(b(ne(Number(e.target.value)))),className:`h-1 w-full cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`pointer-events-none absolute top-0 -translate-x-1/2 rounded bg-primary px-1.5 text-[10px] leading-4 tabular-nums text-primary-foreground`,style:{left:`${l*100}%`},"data-testid":`remote-desktop-zoom-value`,children:[o,`%`]})]}),(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(1),disabled:o>=S,"aria-label":`Increase`,children:(0,$.jsx)(c,{className:`size-3.5`})})]})})}var Se=400;function Ce({open:e,onOpenChange:t,percent:n,fps:r,more:i,onSetMore:a,onCommit:o,frameSize:s}){let[c,l]=(0,Z.useState)(n),[u,d]=(0,Z.useState)(r),f=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{e&&(l(n),d(r))},[e,n,r]),(0,Z.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=i?_:100,m=(e,t)=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>o(e,t),Se)},h=e=>{let t=C(e,i);l(t),m(t,u)},g=e=>{let t=v(e);d(t),m(c,t)},y=e=>{a(e);let t=C(c,e);t!==c&&(l(t),m(t,u))},b=x(c,s.width,s.height);return(0,$.jsx)(M,{open:e,onOpenChange:t,children:(0,$.jsxs)(k,{className:`sm:max-w-md`,"data-testid":`remote-desktop-custom-quality-dialog`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(A,{children:`Custom image quality`}),(0,$.jsx)(j,{children:s.width>0?`${c}% of the base rate for ${s.width}×${s.height} — about ${(b/1e3).toFixed(1)} Mbit/s`:`Waiting for the first frame`})]}),(0,$.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:10,max:p,step:1,value:Math.min(c,p),onChange:e=>h(Number(e.target.value)),"aria-label":`Bitrate`,"data-testid":`remote-desktop-custom-bitrate`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:[c,`%`]}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`Bitrate`}),(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>y(e.target.checked),"data-testid":`remote-desktop-custom-more`,className:`size-3.5 accent-primary`}),`More`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:5,max:120,step:1,value:u,onChange:e=>g(Number(e.target.value)),"aria-label":`FPS`,"data-testid":`remote-desktop-custom-fps`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsx)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:u}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`FPS`}),(0,$.jsx)(`span`,{className:`w-[4.25rem] shrink-0`,"aria-hidden":!0})]})]}),(0,$.jsx)(ae,{children:(0,$.jsx)(D,{onClick:()=>t(!1),children:`Close`})})]})})}function we({id:e}){let t=E(e=>e.close),n=(0,Z.useCallback)(()=>t(e),[t,e]);return(0,$.jsx)(G,{onCancel:n,children:(0,$.jsx)(K,{onCancel:n,children:(0,$.jsx)(Te,{})})})}function Te(){let e=(0,Z.useRef)(null),t=de(),{connState:n,errorMessage:r,decoderStatus:i,decoderErrorMessage:a,sendMessage:s,reconnect:c,getFrameCount:u,getTotalBytes:d,frameSize:f,quality:p,setQuality:m,setCustomQuality:g,showCursor:_,setShowCursor:v,codec:y,setCodec:b,audioOn:x,setAudioOn:S,getAudioTracks:ee,privacyOn:C,privacyError:te,setPrivacyOn:w,hostModeId:ne,hostOriginalModeId:re,resolutionError:E,setHostMode:D,pendingHostClipboard:O,clearHostClipboard:ae,sendClipboard:k,requestHostClipboard:A}=fe(e,{displayId:t.displayId}),j=T(e=>e.remoteDesktopStatsVisible),M=T(e=>e.toggleRemoteDesktopStatsVisible),N=T(e=>e.remoteDesktopViewStyle),P=T(e=>e.remoteDesktopCustomScale),F=T(e=>e.setRemoteDesktopViewStyle),I=T(e=>e.setRemoteDesktopCustomScale),L=T(e=>e.remoteDesktopClipboardSync),R=T(e=>e.remoteDesktopQuality),z=T(e=>e.remoteDesktopCustomQualityPercent),B=T(e=>e.remoteDesktopCustomFps),V=T(e=>e.remoteDesktopCustomQualityMore),H=T(e=>e.setRemoteDesktopCustomQualityMore),[U,W]=(0,Z.useState)(!1),G=T(e=>e.setRemoteDesktopClipboardSync),{caps:K}=oe(!1),[ce,q]=(0,Z.useState)(!1),ue=(0,Z.useMemo)(()=>L?{onPasteText:(e,t)=>{q(!0),k(e,!0,t)},onCopyCombo:A}:void 0,[L,k,A]);ge(e,s,n===`streaming`,ue);let J=le(e,ee),Y=h(N,P,f),me=i===`unsupported`?a:n===`error`?r:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,$.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,$.jsx)(`div`,{className:ie(`flex h-full w-full`,Y?`overflow-auto`:`overflow-hidden`),children:(0,$.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,"data-view-style":N,className:ie(`m-auto outline-none`,!Y&&`max-h-full max-w-full`),style:Y?{width:Y.width,height:Y.height}:void 0})}),(0,$.jsx)(pe,{canvasRef:e,getFrameCount:u,getTotalBytes:d}),(0,$.jsx)(ye,{displays:t.displays,currentDisplayId:t.current?.id,onSelectDisplay:t.select,quality:p,qualityChoice:R,onSetQuality:m,onOpenCustomQuality:()=>W(!0),codecs:K?.encoders??[],codec:y,onSetCodec:b,hostModes:K?.resolutions?.modes??[],hostModeId:ne,hostOriginalModeId:re,onSetHostMode:D,canResizeHost:K?.inputReady??!1,resolutionError:E,viewStyle:N,customScale:P,onSetViewStyle:F,onSetCustomScale:I,showCursor:_,onSetShowCursor:v,audioOn:x,audioReason:K&&!K.audio.available?K.audio.reason:null,onSetAudioOn:S,privacyOn:C,privacyReason:te??(K&&!K.privacy.available?K.privacy.reason:null),privacyCanBlank:K?.privacy?.canBlank??!1,onSetPrivacyOn:w,recording:J.recording,recordingElapsedSec:J.elapsedSec,recordingSupported:J.supported,onToggleRecording:J.toggle,onScreenshot:()=>void se(e.current),clipboardEnabled:L,onSetClipboardEnabled:G,statsVisible:j,onToggleStats:M}),(0,$.jsx)(he,{pendingText:O,onDismiss:ae,missingToolAction:ce&&K&&!K.clipboard.available?K.clipboard.action:null,onDismissMissingTool:()=>q(!1)}),(0,$.jsx)(Ce,{open:U,onOpenChange:W,percent:z,fps:B,more:V,onSetMore:H,onCommit:g,frameSize:f}),me&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,$.jsx)(o,{className:`size-6 opacity-70`}),(0,$.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:me}),(n===`error`||n===`closed`)&&i!==`unsupported`&&(0,$.jsxs)(`button`,{onClick:c,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,$.jsx)(l,{className:`size-3.5`}),` Reconnect`]})]})]})}export{we as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./panel-store-
|
|
1
|
+
import{t as e}from"./panel-store-B6PoCwBA.js";var t=`ppm:run-in-terminal`,n=`ppm:run-in-terminal:ack`;function r(e){return e.replace(/^[ \t]*\$[ \t]+/gm,``).replace(/\s+$/,``)}function i(i,a){let o=r(i);if(!o)return;let s=!1,c=()=>{s=!0};window.addEventListener(n,c),window.dispatchEvent(new CustomEvent(t,{detail:{command:o,projectName:a}})),window.removeEventListener(n,c),!s&&e.getState().openInDock({type:`terminal`,title:`Terminal`,projectId:a??null,closable:!0,metadata:{...a?{projectName:a}:{},pendingCommand:o}})}export{t as n,i as r,n as t};
|
|
@@ -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-P9Ym7hCv.js";import{Mr as r,O as i,Qn as a,S as o,Wn as s,Yn as c,Zn as l,j as u}from"./icons-CO_II6D-.js";import{O as d,r as f}from"./api-client-F5Zi1sR0.js";import{n as p}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-7OX80HDB.js";import{n as m}from"./use-is-mobile-BClDZJP5.js";import{t as h}from"./button-DeAyLH9U.js";import{a as ee,n as g,o as _,t as v}from"./dialog-Bocc0Fgb.js";import{t as te}from"./mobile-bottom-sheet-D4UyOatB.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as y}from"./input-CG8PS8mS.js";import{t as b}from"./scroll-area-sjOeAfoD.js";import{Ct as x,St as S,Tt as C,bt as w,cn as T,fn as E,gn as D,ln as O,sn as k,wt as A,xt as j}from"./index-DhWjx5iR.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await f.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await f.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:p(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[o,l]=(0,M.useState)(!1),[m,h]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(k,{children:[(0,I.jsx)(D,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>l(!o),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[o?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(T,{children:[(0,I.jsxs)(O,{onClick:async()=>{try{let t=await f.post(`/api/schedules/${e.id}/run-now`);d.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),l(!0),h(e=>e+1)}catch(e){d.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(c,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(O,{onClick:async()=>{try{await f.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){d.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(a,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(O,{onClick:t,children:[(0,I.jsx)(s,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(E,{}),(0,I.jsxs)(O,{variant:`destructive`,onClick:async()=>{try{await f.del(`/api/schedules/${e.id}`),d.success(`Schedule deleted`),n()}catch(e){d.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(r,{className:`size-3.5`}),` Delete`]})]})]}),o&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},m)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=m(),[a,o]=(0,M.useState)(()=>$(t)),[s,c]=(0,M.useState)([]),[l,u]=(0,M.useState)(!1),[d,p]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),p(null),f.get(`/api/projects`).then(c).catch(()=>c([])))},[e,t]);let T=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),E=(e,t)=>o(n=>({...n,[e]:t})),D=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(y,{value:a.name,onChange:e=>E(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(y,{value:a.cron_expr,onChange:e=>E(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:T?`Next: ${T.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(w,{value:a.project_path,onValueChange:e=>E(`project_path`,e),children:[(0,I.jsx)(x,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(A,{placeholder:`Select project`})}),(0,I.jsx)(j,{children:s.map(e=>(0,I.jsx)(S,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>E(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(w,{value:a.permission_mode,onValueChange:e=>E(`permission_mode`,e),children:[(0,I.jsx)(x,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(A,{})}),(0,I.jsx)(j,{children:le.map(e=>(0,I.jsx)(S,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(y,{type:`number`,min:1,value:a.max_turns,onChange:e=>E(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(y,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>E(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(C,{checked:a.enabled,onCheckedChange:e=>E(`enabled`,e)})]}),d&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:d}),(0,I.jsx)(h,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){p(`Name, project, and prompt are required`);return}if(!T){p(`Invalid cron expression`);return}u(!0),p(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await f.patch(`/api/schedules/${t.id}`,e):await f.post(`/api/schedules`,e),r(),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(!1)}},disabled:l,className:`w-full min-h-11 cursor-pointer`,children:l?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(te,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:O}),(0,I.jsx)(b,{className:`flex-1 min-h-0 px-3 pb-3`,children:D})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(g,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(_,{className:`text-sm`,children:O})}),D]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),c=()=>{s(null),i(!0)},u=e=>{s(e),i(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>u(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
|
|
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-P9Ym7hCv.js";import{Mr as r,O as i,Qn as a,S as o,Wn as s,Yn as c,Zn as l,j as u}from"./icons-CO_II6D-.js";import{O as d,r as f}from"./api-client-F5Zi1sR0.js";import{n as p}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-7OX80HDB.js";import{n as m}from"./use-is-mobile-BClDZJP5.js";import{t as h}from"./button-DeAyLH9U.js";import{a as ee,n as g,o as _,t as v}from"./dialog-Bocc0Fgb.js";import{t as te}from"./mobile-bottom-sheet-D4UyOatB.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as y}from"./input-CG8PS8mS.js";import{t as b}from"./scroll-area-sjOeAfoD.js";import{Ct as x,Et as S,St as C,Tt as w,dn as T,ln as E,mn as D,un as O,vn as k,wt as A,xt as j}from"./index-CyDLBddf.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await f.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await f.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:p(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[o,l]=(0,M.useState)(!1),[m,h]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(E,{children:[(0,I.jsx)(k,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>l(!o),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[o?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(O,{children:[(0,I.jsxs)(T,{onClick:async()=>{try{let t=await f.post(`/api/schedules/${e.id}/run-now`);d.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),l(!0),h(e=>e+1)}catch(e){d.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(c,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(T,{onClick:async()=>{try{await f.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){d.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(a,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(T,{onClick:t,children:[(0,I.jsx)(s,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(D,{}),(0,I.jsxs)(T,{variant:`destructive`,onClick:async()=>{try{await f.del(`/api/schedules/${e.id}`),d.success(`Schedule deleted`),n()}catch(e){d.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(r,{className:`size-3.5`}),` Delete`]})]})]}),o&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},m)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=m(),[a,o]=(0,M.useState)(()=>$(t)),[s,c]=(0,M.useState)([]),[l,u]=(0,M.useState)(!1),[d,p]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),p(null),f.get(`/api/projects`).then(c).catch(()=>c([])))},[e,t]);let T=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),E=(e,t)=>o(n=>({...n,[e]:t})),D=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(y,{value:a.name,onChange:e=>E(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(y,{value:a.cron_expr,onChange:e=>E(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:T?`Next: ${T.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(j,{value:a.project_path,onValueChange:e=>E(`project_path`,e),children:[(0,I.jsx)(A,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(w,{placeholder:`Select project`})}),(0,I.jsx)(C,{children:s.map(e=>(0,I.jsx)(x,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>E(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(j,{value:a.permission_mode,onValueChange:e=>E(`permission_mode`,e),children:[(0,I.jsx)(A,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(w,{})}),(0,I.jsx)(C,{children:le.map(e=>(0,I.jsx)(x,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(y,{type:`number`,min:1,value:a.max_turns,onChange:e=>E(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(y,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>E(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(S,{checked:a.enabled,onCheckedChange:e=>E(`enabled`,e)})]}),d&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:d}),(0,I.jsx)(h,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){p(`Name, project, and prompt are required`);return}if(!T){p(`Invalid cron expression`);return}u(!0),p(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await f.patch(`/api/schedules/${t.id}`,e):await f.post(`/api/schedules`,e),r(),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(!1)}},disabled:l,className:`w-full min-h-11 cursor-pointer`,children:l?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(te,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:O}),(0,I.jsx)(b,{className:`flex-1 min-h-0 px-3 pb-3`,children:D})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(g,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(_,{className:`text-sm`,children:O})}),D]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),c=()=>{s(null),i(!0)},u=e=>{s(e),i(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>u(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./panel-store-
|
|
1
|
+
import{t as e}from"./panel-store-B6PoCwBA.js";var t=`ppm:send-to-chat`,n=`ppm:send-to-chat:ack`;function r(e){return typeof e.metadata?.lastActiveAt==`number`?e.metadata.lastActiveAt:-1}function i(t){let{panels:n,focusedPanelId:i}=e.getState(),a=Object.values(n).flatMap(e=>e.tabs.filter(e=>e.type===`chat`).map(t=>({tab:t,selected:e.activeTabId===t.id,focusedPanel:e.id===i})));if(a.length===0)return null;let o=t?a.filter(e=>e.tab.projectId===t||e.tab.metadata?.projectName===t):[],s=o.length>0?o:a,c=e=>[e.selected?e.focusedPanel?2:1:0,r(e.tab)];return s.reduce((e,t)=>{let[n,r]=[c(e),c(t)];for(let i=0;i<n.length;i++)if(n[i]!==r[i])return n[i]>r[i]?e:t;return e}).tab.id}function a(r){let{text:a,label:o,projectName:s}=r;if(!a.trim())return;let c=r.newTab?null:i(s),l=e.getState();if(c){l.setActiveTab(c);let e=!1,r=()=>{e=!0};if(window.addEventListener(n,r),window.dispatchEvent(new CustomEvent(t,{detail:{text:a,label:o,projectName:s,targetTabId:c}})),window.removeEventListener(n,r),e)return;let i=Object.values(l.panels).flatMap(e=>e.tabs).find(e=>e.id===c);l.updateTab(c,{metadata:{...i?.metadata,pendingMessage:a}});return}l.openTab({type:`chat`,title:`Chat`,projectId:null,metadata:{...s?{projectName:s}:{},pendingMessage:a,...r.imageDataUrl?{pendingAttachmentDataUrl:r.imageDataUrl,pendingAttachmentName:r.imageName}:{}},closable:!0})}export{t as n,a as r,n as t};
|