@xopcai/xopc 0.0.433 → 0.0.435
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/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/dist/browser-ext/dist/sidepanel.js +11 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-BpYGrRXw.js → activity-store-Cwn_CNwl.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DTgOSv6G.js → agent-avatar-dicebear-Cd23LnJJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BUH7ljEo.js → agent-avatar-display-ByzM7u9S.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B_FAikHA.js → agent-defaults-settings-panel-B0i37diS.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DPabZaSE.js → agent-plugin-dialog-XN-tZ-Ox.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BAPYP1Ka.js → agents-ZDA1OaLv.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-CXCAHNPj.js → agents-admin-api-B5lKH_ps.js} +1 -1
- package/dist/gateway/static/root/assets/{api-oIK4hYkJ.js → api-B9fZL-V8.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DMbimMEi.js → api-Djju8qIR.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BZ3Fy8ZR.js → app-management-settings-panel-IlyzDPJu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DsRTj1by.js → appearance-settings-BxdFGob3.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CxEKiOTA.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Bg1VTieK.js → archive-plugin-4gEvotPr.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-CLPsgcQN.js → automation-api-4fVKv9PJ.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-CKVnR4KG.js → automation-result-state-m7PeK2kl.js} +1 -1
- package/dist/gateway/static/root/assets/automation-run-list-CJOdy_R2.js +1 -0
- package/dist/gateway/static/root/assets/{automation-task-card-D27Mw66U.js → automation-task-card-DZWhCWJa.js} +3 -3
- package/dist/gateway/static/root/assets/{automations-page-DGNTJ8lN.js → automations-page-BjbM15eY.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CqurzLYX.js +9 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CuwSdCG5.js → binary-plugins-69WyJLNW.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dtl2BG3t.js → block-editor-DUONDIZR.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-uGK086ag.js → browser-automation-inputs-DL4YPCuN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Da_edNNS.js → browser-automations-page-1Aq6XmRs.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-control-api-k3OOX3bS.js → browser-control-api-yjru8E7R.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-C1bSw-Jq.js → browser-settings-page-CvwpT8Um.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DlHPLld_.js → capabilities-C7lnwKKm.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CoeuLRt6.js → capabilities-DaeQXJT4.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-B5avAOUM.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CtY-bGIi.js → capabilities-settings-panel-_9yCS78i.js} +1 -1
- package/dist/gateway/static/root/assets/capability-links-DeO34GIF.js +1 -0
- package/dist/gateway/static/root/assets/{channels-Cn1MWBL_.js → channels-CoQb4HOF.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BB0biwc7.js → chat-agents-api-BUi_7GRo.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-QSvjx4w6.js → chat-chart-block-CcVcKsDZ.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page--wcFhTjW.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Cd51G9eG.js → chat-terminal-dock-BMXJpPuH.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-CEG10uE-.js → command-palette-api-luUjQPsh.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-Bogdq9Hy.js → composer-payload-handoff-B5XNxNCb.js} +1 -1
- package/dist/gateway/static/root/assets/computer-settings-page-CWtdyEJH.js +1 -0
- package/dist/gateway/static/root/assets/connected-providers-grid-2idMtk65.js +1 -0
- package/dist/gateway/static/root/assets/connection-usage-Cm_McddI.js +1 -0
- package/dist/gateway/static/root/assets/connection-usage-guide-Ddh0bfkj.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-k2rjyjrp.js → connector-service-page-C3msXaBk.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DtvB9Cjm.js → connectors-api-NcWECWKg.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Crb6DILX.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CAankdQw.js → date-picker-Cfjq1hD_.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DjM73fir.js → desktop-pet-ChFn9v-3.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Rmh-GxHl.js → desktop-pet-settings-DvnVIv25.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-BgW2Riyk.js → dev-view-store-DQJ61P5L.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-UdzSpNa5.js → device-pairing-wizard-KxaIL-OX.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Rkw3f7lG.js → directory-picker-path-field-Drv864uE.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-Dudoj_Fz.js → discussion-annotation-sync-DfBRkWtw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DxIGAO23.js → extension-debug-page-DAlBIt_R.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-63KpX6IP.js → extension-iframe-host-Bds-5kY_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-yXNUkQDA.js → extension-marketplace-api-CZg8nBwW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C811A_Ww.js → extension-page-ZTw-oucT.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-C4jLFIgh.js → extension-provider-NKWfjpdP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-WJSw5MT0.js → extension-settings-page-CT7PPt_q.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-zE9AcaHM.js → file-preview-surface-BcLeaSNe.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-D6cc6W6E.js → gateway-config-swr-Cq-ByXL4.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BSRNLciy.js → gateway-realtime-DwMd2PCt.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CHrf6-nR.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-Unun5hRL.js → gateway-restart-DdiVzbkL.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DP-DV-e5.js → gateway-settings-1QUdNwrZ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C8g666Ja.js → gateway-startup-retry-PMJi5mX4.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BObi-1ww.js → global-defaults-api-DgzZh3wX.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CIcs7Mzy.js → home-page-Chn7YTiD.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-C2SqYNyD.js → image-generation-api-CjVpsckq.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C8ezUkOJ.js → imports-page-CJCvZFaQ.js} +1 -1
- package/dist/gateway/static/root/assets/index-8xLWo0Tt.js +11 -0
- package/dist/gateway/static/root/assets/index-iukJWzxG.css +1 -0
- package/dist/gateway/static/root/assets/install-connector-dialog-Bo06Ry3H.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BRaY4-wA.js → keyboard-shortcuts-settings-BylFJeGu.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BZtVcjF3.js → local-app-workbench-page-B3MSSFsr.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-MqP4EnJm.js → local-apps-page-BeV86rMJ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-DTq9776a.js → local-session-drafts-jgw8UGsO.js} +2 -2
- package/dist/gateway/static/root/assets/{locale-store-B6OrWgY1.js → locale-store-CAZaC05J.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-hkHBjblX.js → logs-page-BMmSsUP5.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DoX4eTM3.js → management-settings-Bu7T8ewk.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DrhYZSmg.js → markdown-view-BatP4qeK.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-BEp5E6TD.js → mcp-conversation-setup-page-rROtr0UN.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D987i9Gc.js → media-plugins-88OV72YE.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C7fckbyG.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-DXm4NS1_.js → model-selector-raBRBkN_.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-BLcha5rx.js → models-hub-cache-CzC9y3D0.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-Cl851ivY.js → note-detail-panel-BvA8Vkbm.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-D6kUDDd5.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-Ddsf7FVg.js → notes-api-zXpV6UXu.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DSwA1MU1.js → notes-page-CjYH9Kle.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-CMmu4DzH.js → oauth-api-DmxSaxM1.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-BkhnftBq.js → oauth-provider-connect-D4Gfs-Ba.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-urhQBRaN.js → page-context-capture-button-Mig3d0UX.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-BuNUerth.js → page-context-draft-C4IIZaKd.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-D7G5utVi.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-B49ueeZO.js → personal-avatar-DLa-CpaK.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-f05ceuFn.js → personal-page-BhuT79Wd.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-DLQxzPYr.js → personal-settings-panel-XSUkgcr2.js} +1 -1
- package/dist/gateway/static/root/assets/phone-dependencies-card-DYwnuVh3.js +1 -0
- package/dist/gateway/static/root/assets/phone-model-connection-2F32QTHA.js +1 -0
- package/dist/gateway/static/root/assets/phone-model-picker-DCVzIr0s.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-DJttE4id.js +1 -0
- package/dist/gateway/static/root/assets/{phone-workspace-store-DbqktZbO.js → phone-workspace-store-Dxp-KhFP.js} +1 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-tyjAjFjA.js +1 -0
- package/dist/gateway/static/root/assets/{preference-select-fields-BZWqG7pu.js → preference-select-fields-BVP3MhGK.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-DDQUsag7.js → product-automation-feedback-DbJvv92z.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BkRP_HmA.js → product-open-page-RImqlhCD.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-o2Y3VNE7.js → product-preview-content-DxSqrKsg.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-7Ohx-7OR.js → product-preview-modal-Cw8Q8Uom.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-B2RsSHya.js → project-detail-page-CuugOYfe.js} +1 -1
- package/dist/gateway/static/root/assets/{project-understanding-BIMouiYX.js → project-understanding-BMKcoUW5.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-C9R5u3tF.js → projects-page-CFsABLvs.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-BOCkRZ7X.js → providers-api-CAeXbJNF.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-C6muEHEO.js → recording-upload-CfpllTe5.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Bl2guMRg.js → registry-api-fLOqFyrz.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BceSMbCs.js → remote-access-hub-BvKOxy0L.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-CUNbPkdj.js → resource-unavailable-D15jzjV_.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-BQapekpy.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-LopLjgvu.js → runtime-tools-api-D0Nrvuqv.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-9HIPerDP.js → runtime-tools-settings-panel-CA27XgL2.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-CoMI6MB1.js → service-recommendation-list-B0RoYLVT.js} +1 -1
- package/dist/gateway/static/root/assets/session-api-CHRP5Lwf.js +1 -0
- package/dist/gateway/static/root/assets/session-channel-icon-D1ktvt1P.js +1 -0
- package/dist/gateway/static/root/assets/session-identity-label-BP7OIYth.js +1 -0
- package/dist/gateway/static/root/assets/session-manager-DRRWwKE4.js +25 -0
- package/dist/gateway/static/root/assets/{sessions-page-BT0GdXdS.js → sessions-page-uJHS3-6F.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CZ4J3Kuy.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CEorDLUp.js → settings-advanced-section-D-llwfSj.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-C2LZqBES.js → settings-mode-store-BspMKc9N.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C_Np_6qZ.js → settings-page-CedwaHM0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BAN34UQi.js → settings-page-header-LuOJvqNa.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-B5TVFBV2.js → settings-page-layout-CduQ8w4a.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-BYvTJW3_.js → setup-interaction-page-ujpPGl84.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-UY2dH-sK.js → setup-status-panel-BN2aCJUN.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-BMcXyzr2.js → share-link-dialog-CTATUaa4.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-UQ6eUM2_.js → share-preview-page-Dq0J3VgS.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DOeDN6Tm.js → shares-api-zegE8pSE.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-W8XhuAoL.js → shares-settings-DXpvsRXq.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-Do_c0d9n.js → skill-api-DCL1EN7f.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-DpHaXI2l.js → skill-list-api-Bv0mmHbu.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DDRd9IJ2.js → skill-reload-api-DPZbadiO.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CaeJVKhO.js → skills-page-DMC7Gaku.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DYWlWPJL.js → system-settings-panel-BYFUhlqG.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-De0qD7xw.js → task-detail-page-_Og3plZL.js} +3 -3
- package/dist/gateway/static/root/assets/{task-result-evidence-CICR5K1t.js → task-result-evidence-Bxm8-H0B.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-BbWUcQe7.js → terminal-panel-store-Djf9l2qZ.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-TkG5mo0p.js → theme-store-8GFVtotZ.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CYXEy4EG.js → tracing-settings-page-oWW3SBZ4.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DquDm6U2.js → tunnel-api-D-mEsSGF.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-Ot3wZ3oQ.js → understanding-activity-store-CvDjsd0I.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-C5KYFMaC.js → understanding-refresh-store-DzOZJm7A.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-1xFO4smo.js → usage-page-z-o6Uuev.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-HL8XRNR8.js → use-autosave-BVYS8UoK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-XRlQBdNF.js → use-composer-attachments-lecOV2q5.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-CW956CXS.js → use-file-preview-expanded-nd_CuFsd.js} +2 -2
- package/dist/gateway/static/root/assets/{use-personal-profile-202s6tJt.js → use-personal-profile-CQi2ZCxV.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-CjydkmH1.js → use-workspace-tree-BiaddkzX.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-OGPXx3pe.js → user-model-page-Bks1n0Nj.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CxFu4MEA.js → voice-api-key-field-BbW8NFeZ.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-MHe5Pn-A.js → voice-config-api-jSMzZWWy.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-B9xc1oK8.js → voice-input-shortcut-events-_SgYmx7X.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-CVEcB6Pe.js → voice-transcribe-api-BJCfiRFU.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-C-JoAg2D.js → work-discovery-overlay-DSTSNyU7.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-B5Kx29Ru.js → work-discovery-page-Dd_QJJvb.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DGp9cNzH.js → working-directory-picker-modal-q39BUcJ6.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-HBXn8pL9.js → workspace-api-Di2OmCvz.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-B2r9wlix.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-3cpwSG2w.js → workspace-file-preview-dialog-BUGNT765.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-D0VOFvuP.js → workspace-open-location-menu-bMSvmQW7.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BkdW2p3v.js → xopc-cloud-account-card-Bbe19Del.js} +1 -1
- package/dist/gateway/static/root/index.html +87 -85
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +33 -3
- package/dist/packages/gateway-contract/src/session-identity.js +2 -1
- package/dist/packages/gateway-contract/src/session-input-command.js +19 -2
- package/dist/packages/gateway-contract/src/specialists.js +1 -0
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.js +2 -2
- package/dist/src/agent/embedded/run-for-session.js +23 -8
- package/dist/src/agent/embedded/run-turn.js +30 -7
- package/dist/src/agent/embedded/runs.d.ts +2 -2
- package/dist/src/agent/embedded/runs.js +4 -4
- package/dist/src/agent/embedded/session-runner.js +26 -11
- package/dist/src/agent/embedded/tool-search-extension.d.ts +8 -2
- package/dist/src/agent/embedded/tool-search-extension.js +122 -30
- package/dist/src/agent/external-tools/cliProvider.d.ts +10 -9
- package/dist/src/agent/external-tools/cliProvider.js +24 -4
- package/dist/src/agent/external-tools/composio-provider.d.ts +3 -3
- package/dist/src/agent/external-tools/composio-provider.js +6 -3
- package/dist/src/agent/external-tools/discovery.d.ts +47 -0
- package/dist/src/agent/external-tools/discovery.js +56 -0
- package/dist/src/agent/external-tools/gateway-tools.js +26 -46
- package/dist/src/agent/external-tools/index.d.ts +1 -0
- package/dist/src/agent/external-tools/index.js +7 -0
- package/dist/src/agent/external-tools/personal-request-scope.d.ts +7 -0
- package/dist/src/agent/external-tools/personal-request-scope.js +83 -0
- package/dist/src/agent/external-tools/read-policy.js +5 -4
- package/dist/src/agent/external-tools/service.d.ts +2 -0
- package/dist/src/agent/external-tools/service.js +22 -3
- package/dist/src/agent/external-tools/tool-registry.d.ts +6 -0
- package/dist/src/agent/external-tools/types.d.ts +7 -2
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +3 -2
- package/dist/src/agent/orchestration/llm-turn-retry.d.ts +1 -1
- package/dist/src/agent/orchestration/llm-turn-retry.js +13 -8
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -0
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +3 -1
- package/dist/src/agent/prompt/sections/tooling.js +1 -1
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +6 -4
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
- package/dist/src/agent/tool-manuals/phone.js +4 -4
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-configuration.js +4 -2
- package/dist/src/agent/tools/computer-use-tool.js +7 -6
- package/dist/src/agent/tools/delegation-policy.js +1 -0
- package/dist/src/agent/tools/factory.js +4 -2
- package/dist/src/agent/tools/phone-use-tool.js +2 -2
- package/dist/src/agent/tools/web.js +22 -3
- package/dist/src/agent-matching/service.js +2 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/batch.d.ts +108 -0
- package/dist/src/computer/batch.js +125 -0
- package/dist/src/computer/broker.d.ts +30 -2
- package/dist/src/computer/broker.js +109 -17
- package/dist/src/computer/diagnostics.d.ts +5 -1
- package/dist/src/computer/diagnostics.js +22 -3
- package/dist/src/computer/errors.d.ts +15 -0
- package/dist/src/computer/errors.js +59 -3
- package/dist/src/computer/model-adapter.d.ts +58 -0
- package/dist/src/computer/model-adapter.js +112 -66
- package/dist/src/computer/native-errors.d.ts +2 -0
- package/dist/src/computer/native-errors.js +13 -0
- package/dist/src/computer/program-runtime.d.ts +1 -1
- package/dist/src/computer/program-runtime.js +1 -0
- package/dist/src/computer/runtime.d.ts +11 -0
- package/dist/src/computer/runtime.js +102 -34
- package/dist/src/computer/semantic-actions.js +4 -0
- package/dist/src/config/schema.d.ts +6 -0
- package/dist/src/extensions/agent-plugins/formats.js +2 -1
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -0
- package/dist/src/extensions/agent-plugins/inventory.js +4 -1
- package/dist/src/extensions/agent-plugins/validation.d.ts +1 -0
- package/dist/src/extensions/agent-plugins/validation.js +2 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/phone-dependencies.js +26 -5
- package/dist/src/gateway/hono/routes/phone-setup.js +42 -16
- package/dist/src/gateway/hono/routes/phone.js +22 -7
- package/dist/src/gateway/hono/routes/session-command-handler.js +9 -0
- package/dist/src/gateway/hono/routes/session-input-control.d.ts +3 -0
- package/dist/src/gateway/hono/routes/session-input-control.js +37 -0
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +12 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +22 -0
- package/dist/src/gateway/hono/routes/sessions.js +4 -0
- package/dist/src/gateway/service/agent-runner.js +5 -4
- package/dist/src/gateway/service/config-coordinator.d.ts +6 -0
- package/dist/src/gateway/service/session-input-coordinator.d.ts +6 -3
- package/dist/src/gateway/service/session-input-coordinator.js +47 -6
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +8 -5
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/personal-agent/capability-service.js +1 -1
- package/dist/src/personal-agent/request-access.d.ts +2 -0
- package/dist/src/personal-agent/request-access.js +22 -2
- package/dist/src/personal-agent/request-service.js +2 -2
- package/dist/src/personal-agent/specialist-capabilities.d.ts +2 -0
- package/dist/src/personal-agent/specialist-capabilities.js +9 -3
- package/dist/src/phone/adb-driver.d.ts +3 -0
- package/dist/src/phone/adb-driver.js +29 -0
- package/dist/src/phone/contracts.d.ts +14 -2
- package/dist/src/phone/contracts.js +8 -1
- package/dist/src/phone/gui-protocol.js +1 -1
- package/dist/src/phone/hdc-driver.d.ts +30 -0
- package/dist/src/phone/hdc-driver.js +331 -0
- package/dist/src/phone/hdc-video-bridge.d.ts +2 -0
- package/dist/src/phone/hdc-video-bridge.js +91 -0
- package/dist/src/phone/hdc-video-tools.d.ts +15 -0
- package/dist/src/phone/hdc-video-tools.js +123 -0
- package/dist/src/phone/hdc-video.d.ts +69 -0
- package/dist/src/phone/hdc-video.js +350 -0
- package/dist/src/phone/interactive-session.js +1 -1
- package/dist/src/phone/live-provider.d.ts +6 -0
- package/dist/src/phone/live-provider.js +1 -0
- package/dist/src/phone/model-adapter.d.ts +3 -0
- package/dist/src/phone/model-adapter.js +5 -3
- package/dist/src/phone/repository.js +2 -1
- package/dist/src/phone/runtime.d.ts +10 -4
- package/dist/src/phone/runtime.js +151 -85
- package/dist/src/phone/setup/service.d.ts +8 -6
- package/dist/src/phone/setup/service.js +33 -16
- package/dist/src/platform/client.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +1 -1
- package/dist/src/process/phone-process.d.ts +1 -1
- package/dist/src/process/phone-process.js +2 -2
- package/dist/src/runtime-tools/downloader.d.ts +1 -0
- package/dist/src/runtime-tools/downloader.js +8 -4
- package/dist/src/runtime-tools/harmony-dependencies.d.ts +24 -0
- package/dist/src/runtime-tools/harmony-dependencies.js +272 -0
- package/dist/src/runtime-tools/harmony-dependency-catalog.d.ts +4 -0
- package/dist/src/runtime-tools/harmony-dependency-catalog.js +54 -0
- package/dist/src/runtime-tools/harmony-paths.d.ts +9 -0
- package/dist/src/runtime-tools/harmony-paths.js +15 -0
- package/dist/src/runtime-tools/hdc-dependency-catalog.d.ts +8 -0
- package/dist/src/runtime-tools/hdc-dependency-catalog.js +83 -0
- package/dist/src/runtime-tools/hdc-files.d.ts +14 -0
- package/dist/src/runtime-tools/hdc-files.js +87 -0
- package/dist/src/runtime-tools/phone-dependencies.d.ts +6 -1
- package/dist/src/runtime-tools/phone-dependencies.js +20 -2
- package/dist/src/runtime-tools/phone-dependency-catalog.d.ts +10 -1
- package/dist/src/runtime-tools/phone-dependency-catalog.js +2 -0
- package/dist/src/runtime-tools/types.d.ts +1 -1
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +16 -0
- package/dist/src/storage/sqlite/session-creation-repository.js +3 -0
- package/dist/src/storage/sqlite/session-input-control-repository.d.ts +12 -0
- package/dist/src/storage/sqlite/session-input-control-repository.js +83 -0
- package/dist/src/storage/sqlite/session-input-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-input-repository.js +17 -5
- package/dist/src/storage/sqlite/session-repository.js +1 -0
- package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +14 -2
- package/dist/src/storage/sqlite/upgrades/262_session_input_control.sql +15 -0
- package/package.json +2 -2
- package/skills/tools/configure-xopc/SKILL.md +2 -2
- package/skills/tools/configure-xopc/references/phone/acceptance.md +3 -2
- package/skills/tools/configure-xopc/references/phone/dependencies.md +18 -2
- package/skills/tools/configure-xopc/references/phone/harmonyos.md +16 -0
- package/skills/tools/configure-xopc/references/phone/overview.md +2 -2
- package/skills/tools/configure-xopc/references/scene-index.md +2 -2
- package/dist/gateway/static/root/assets/apps-page-D-n71lO1.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-DWDWy-SG.js +0 -9
- package/dist/gateway/static/root/assets/capabilities-page-IcwojmJK.js +0 -2
- package/dist/gateway/static/root/assets/capability-links-DzQWK1Fh.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-CwP4OMdW.js +0 -72
- package/dist/gateway/static/root/assets/computer-settings-page-DyAlOzqY.js +0 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-D0lXg22c.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DI_Q0CKz.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BFeFfApQ.js +0 -1
- package/dist/gateway/static/root/assets/index-Cz-VjTNd.css +0 -1
- package/dist/gateway/static/root/assets/index-D1_PUrJf.js +0 -11
- package/dist/gateway/static/root/assets/install-connector-dialog-Cn4nRSyt.js +0 -1
- package/dist/gateway/static/root/assets/list-tree-B0OMswgM.js +0 -1
- package/dist/gateway/static/root/assets/messages-jwdBhfL9.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DGYRJS03.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-CEn_kPsn.js +0 -1
- package/dist/gateway/static/root/assets/phone-dependencies-card-DjmC1Z5j.js +0 -1
- package/dist/gateway/static/root/assets/phone-model-connection-BRjHSgYn.js +0 -1
- package/dist/gateway/static/root/assets/phone-model-picker-DgIiWLhR.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-DCZGCL_z.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-D4tGKip4.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-C1BKDjnu.js +0 -2
- package/dist/gateway/static/root/assets/session-api-Bfmlmn9F.js +0 -1
- package/dist/gateway/static/root/assets/session-channel-icon-SsY70Z6t.js +0 -1
- package/dist/gateway/static/root/assets/session-identity-label-B7sgG1PE.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-X4UHOjjO.js +0 -25
- package/dist/gateway/static/root/assets/settings-advanced-gate-Dk9c-Z5e.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-msZa42fU.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-CAZaC05J.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./createLucideIcon-DPHK1VkS.js";import{n as ee,r as _}from"./popover-select-CEMWIrtY.js";import{t as te}from"./circle-check-C23XjkUj.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./secret-input-Dryrns2s.js";import{t as b}from"./loader-circle-CifKLtgG.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-BI5TyibZ.js";import{t as w}from"./button-Cc4hUNTt.js";import{n as T}from"./interaction-BdhHBbYa.js";import{A as E,N as D,f as O,g as k,h as ne,j as A,k as j,p as M,w as N,z as P}from"./connectors-api-NcWECWKg.js";import{s as F}from"./form-field-width-DJw_jULe.js";import{n as I}from"./electron-env-DHOGevH3.js";import{t as L}from"./oauth-provider-connect-D4Gfs-Ba.js";import{t as re}from"./connection-usage-guide-Ddh0bfkj.js";var R=g(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function z(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}var B=n(),V=e(t(),1),H=r();async function U(e,t){let n=await c(o(e),t);if(!n.ok)throw Error(n.error??`Connection request failed.`);return n.payload}function W({definition:e,instance:t,onClose:n,onChanged:r}){let i=s(e=>e.language)===`zh`,[c,d]=(0,V.useState)(t),[g,te]=(0,V.useState)(),[v,y]=(0,V.useState)(),[S,T]=(0,V.useState)(),[E,O]=(0,V.useState)(),[k,A]=(0,V.useState)(!1),[M,P]=(0,V.useState)(),F=c?.instanceId??e.id,I=(0,V.useCallback)(async()=>{let e=await U(`/api/connectors/${encodeURIComponent(F)}/accounts`);te(e),e.authorization&&y(e.authorization)},[F]);(0,V.useEffect)(()=>{c&&I().catch(e=>P(String(e)))},[c,I]);let L=v&&[`preparing`,`awaiting_user`,`verifying`].includes(v.status);(0,V.useEffect)(()=>{if(!L||!v)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await U(`/api/connectors/authorizations/${v.id}`);if(e)return;y(t.authorization),t.authorization.status===`succeeded`&&(await I(),c&&await r(c))}catch(t){e||P(String(t))}finally{t=!1}}},i=()=>{n()},a=()=>{document.visibilityState===`visible`&&i()};i();let o=setInterval(i,1500);return window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,a),()=>{e=!0,clearInterval(o),window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,a)}},[L,v?.id,c,r,I]);let R=v?.challenge?.type===`qr_code`?v.challenge.artifactId:void 0;(0,V.useEffect)(()=>{if(!R){T(void 0);return}let e=!1,t;return a(o(`/api/connectors/authorizations/${R}/artifact`)).then(async n=>{if(!n.ok)throw Error(`QR code unavailable.`);let r=await n.blob();e||(t=URL.createObjectURL(r),T(t))}).catch(t=>{e||P(String(t))}),()=>{e=!0,t&&URL.revokeObjectURL(t)}},[R]);let z=async t=>{A(!0),P(void 0);try{let n=c??await ne(e.id,{});d(n);let r=await U(`/api/connectors/${encodeURIComponent(n.instanceId)}/authorizations`,{method:`POST`,body:JSON.stringify({accountId:t})});y(r.authorization)}catch(e){P(e instanceof Error?e.message:String(e))}finally{A(!1)}},B=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/${encodeURIComponent(F)}/policy`,{method:`PATCH`,body:JSON.stringify({maxScope:e})}),await I()}catch(e){P(String(e))}finally{A(!1)}},W=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/accounts/${encodeURIComponent(e)}`,{method:`DELETE`}),await I()}catch(e){P(String(e))}finally{A(!1)}},G=async e=>{if(c){A(!0),P(void 0);try{if(e===`remove`)await N(F),await r(c),n();else if(e===`toggle`){let e=await j(F,!c.enabled);d(e),await r(e)}else{let e=await D(F);O(e.ok?i?`验证通过,可用操作:${e.toolCount}`:`Verified: ${e.toolCount} actions`:e.error??e.action??e.status)}}catch(e){P(String(e))}finally{A(!1)}}},K=()=>{c&&r(c),n()};return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||K()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`fixed inset-0 z-50 bg-black/40`}),(0,H.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge p-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(m,{className:`font-semibold`,children:e.displayName}),(0,H.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:i?`连接账号并设置允许的操作。`:`Connect an account and choose allowed actions.`})]}),(0,H.jsx)(w,{variant:`ghost`,onClick:K,"aria-label":i?`关闭`:`Close`,children:(0,H.jsx)(x,{className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:M}):null,c&&!g?(0,H.jsx)(C,{className:`h-24 w-full`}):null,c?(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(w,{disabled:k||!!L,onClick:()=>void G(`toggle`),children:c.enabled?i?`停用`:`Disable`:i?`启用`:`Enable`}),(0,H.jsx)(w,{disabled:k||!!L||!c.enabled,onClick:()=>void G(`test`),children:i?`检查连接`:`Check connection`}),(0,H.jsx)(w,{variant:`ghost`,disabled:k||!!L,onClick:()=>void G(`remove`),children:i?`移除连接`:`Remove connection`})]}):null,c?.enabled&&g?.accounts.some(e=>e.enabled&&e.status===`active`)?(0,H.jsx)(re,{target:{kind:`connector`,id:e.id,name:e.displayName},onStart:n}):null,E?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E}):null,g?.accounts.map(e=>(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e.label??e.id}),(0,H.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:String(e.identity.openId??e.identity.botId??e.identity.userId??e.id)}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.enabled&&e.status===`active`?i?`已连接`:`Connected`:i?`已断开`:`Disconnected`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(w,{variant:`secondary`,disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(e.id),children:i?`重新连接`:`Reconnect`}),(0,H.jsx)(w,{variant:`ghost`,disabled:k||!!L||!e.enabled,onClick:()=>void W(e.id),children:i?`断开本地连接`:`Disconnect locally`})]})]},e.id)),g?.policy?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:i?`允许的操作`:`Allowed actions`}),(0,H.jsxs)(ee,{value:g.policy.maxScope,onChange:e=>void B(e.target.value),disabled:k,children:[(0,H.jsx)(_,{value:`read`,children:i?`仅查看`:`Read only`}),(0,H.jsx)(_,{value:`write`,children:i?`查看并执行操作`:`Read and write`})]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`写入操作需要确认。断开本地连接不会撤销第三方授权。`:`Writes require confirmation. Local disconnection does not revoke provider authorization.`})]}):null,v?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,"aria-live":`polite`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:v.status===`succeeded`?i?`账号验证成功`:`Account verified`:v.status===`preparing`?i?`正在准备授权…`:`Preparing authorization…`:v.status===`verifying`?i?`授权已完成,正在验证账号…`:`Authorization complete. Verifying account…`:L?i?`请完成当前步骤,返回后会自动检查结果。`:`Complete this step. We will check the result when you return.`:v.error??(i?`授权已结束,请重新连接。`:`Authorization ended. Connect again.`)}),L&&v.challenge&&v.challenge.totalSteps>1?(0,H.jsxs)(`p`,{className:`text-sm font-medium`,children:[i?`第 ${v.challenge.step} / ${v.challenge.totalSteps} 步`:`Step ${v.challenge.step} of ${v.challenge.totalSteps}`,v.challenge.step>1?i?`:上一步已完成,请打开新的授权页面继续。`:`: Previous step complete. Open the new authorization page to continue.`:i?`:完成后还需要继续授权账号。`:`: Account authorization follows this step.`]}):null,L&&v.challenge?.type===`open_url`?(0,H.jsx)(`a`,{href:v.challenge.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-accent underline`,children:i?`打开授权页面`:`Open authorization page`},v.challenge.url):null,L&&R?S?(0,H.jsx)(`img`,{src:S,alt:i?`授权二维码`:`Authorization QR code`,className:`mx-auto size-56 bg-white object-contain`}):(0,H.jsx)(C,{className:`mx-auto size-56`}):null,L?(0,H.jsx)(w,{variant:`secondary`,onClick:()=>{U(`/api/connectors/authorizations/${v.id}/cancel`,{method:`POST`}).then(()=>y({...v,status:`cancelled`,challenge:void 0})).catch(e=>P(String(e)))},children:i?`取消授权`:`Cancel authorization`}):null]}):null]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge p-4`,children:[(0,H.jsx)(w,{variant:`secondary`,onClick:K,children:i?`关闭`:`Close`}),(0,H.jsxs)(w,{disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(),children:[k?(0,H.jsx)(b,{className:`mr-2 size-4 animate-spin`}):null,i?`连接账号`:`Connect account`]})]})]})]})})}function G(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function K(e,t){return e.runtime.type===`composio`?t.connectorDescriptions[e.runtime.toolkit.toLowerCase()]??e.description:e.description}function q(e){return e instanceof Error?e.message:String(e)}function ie(e,t){let n=q(e);return/APIKey_InsufficientPermissions/i.test(n)||/["\\]?code["\\]?\s*:\s*812\b/i.test(n)||/session_management/i.test(n)&&/write access|write permission|at least ["\\]?write/i.test(n)?t.composioSessionWritePermissionRequired:n}var J={sm:{frame:`size-9 rounded-lg`,image:`size-7`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-8`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-10`,fallback:`size-5`}};function ae(e){let t=(0,B.c)(15),{connector:n,size:r,className:i}=e,a=r===void 0?`md`:r,o=n?.branding?.logoUrl,[s,c]=(0,V.useState)(!1),l=J[a],u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{c(!1)},t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=[o],t[1]=o,t[2]=d),(0,V.useEffect)(u,d);let f;t[3]!==i||t[4]!==l.frame?(f=S(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-white`,l.frame,i),t[3]=i,t[4]=l.frame,t[5]=f):f=t[5];let p=n?.displayName,m;t[6]!==l.fallback||t[7]!==l.image||t[8]!==s||t[9]!==o?(m=o&&!s?(0,H.jsx)(`img`,{src:o,alt:``,loading:`lazy`,draggable:!1,className:S(`object-contain`,l.image),onError:()=>c(!0)}):(0,H.jsx)(R,{className:S(`text-fg-muted`,l.fallback),"aria-hidden":!0}),t[6]=l.fallback,t[7]=l.image,t[8]=s,t[9]=o,t[10]=m):m=t[10];let h;return t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,H.jsx)(`span`,{className:f,title:p,children:m}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}var Y=S(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,F),oe=S(Y,`min-h-28 font-mono`);function se(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function ce(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function X({draft:e,onChange:t,onClose:n,onInstalled:r,t:a}){let{connector:o}=e,s=K(o,a),c=o.runtime.type===`composio`&&o.runtime.role===`toolkit`,g=o.runtime.type===`composio`&&o.runtime.role===`toolkit`?o.runtime.toolkit:null,j=o.understanding!=null,[N,F]=(0,V.useState)(!c),[z,B]=(0,V.useState)(null),[U,W]=(0,V.useState)(c),[q,J]=(0,V.useState)(null),[X,le]=(0,V.useState)(null),[Z,ue]=(0,V.useState)(!1),[Q,de]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!c)return;let e=!1;return O().then(t=>{e||(B(t),F(t.configured))}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||W(!1)}),()=>{e=!0}},[o.id,c]),(0,V.useEffect)(()=>{if(!g||!N)return;let e=!1;return ue(!0),M(g).then(t=>{e||le(t)}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||ue(!1)}),()=>{e=!0}},[N,g]);let fe=(0,V.useCallback)(async()=>{let n=I(),i=c&&!n?window.open(``,`_blank`):null;i&&(i.opener=null),J(null),t({...e,installing:!0,error:null,result:null,health:null});try{if(c&&!N)throw Error(a.composioSetupSignInRequired);let s=c&&g?X??await M(g):null,l=e.config.authConfigId?.trim();if(s?.requiresCustomAuthConfig&&!l)throw Error(a.composioAuthConfigRequired);if(l){let e=s?.authConfigs.find(e=>e.id===l);if(!e||e.status!==`ENABLED`||!e.isEnabledForToolRouter)throw Error(a.composioAuthConfigUnavailable)}let u={};for(let t of o.setup.config??[]){let n=ce(t.type,e.config[t.key]??``);n!==void 0&&(u[t.key]=n)}l&&(u.authConfigId=l);let d=e.store?await k(e.store.packageName,{secrets:e.secrets,config:u},e.store.version,e.store.reviewHash):await ne(o.id,{secrets:e.secrets,config:u,definition:o.source===`registry`?o:void 0}),f=null;try{if(c){let e=await A(o.id);if(!e.authorizationUrl)throw Error(`The connection service did not return an authorization URL.`);if(n){let t=await window.electronAPI?.shell?.openExternalUrl(e.authorizationUrl);if(!t?.ok)throw Error(t?.error??`Could not open the system browser.`)}else i?i.location.href=e.authorizationUrl:window.open(e.authorizationUrl,`_blank`,`noopener,noreferrer`);let t=await P(g,e.connectionId,12e4,e.attemptId);if(i?.close(),j&&Q){if(!t.accountId)throw Error(`Connector account is unavailable.`);await E(t.accountId)}}}catch(n){i?.close(),t({...e,installing:!1,result:null,health:null,error:c?ie(n,a):n instanceof Error?n.message:String(n)}),await r(d);return}if(d.materialized.type===`cli`||d.materialized.type===`mcp`)try{f=await D(d.instanceId)}catch{f=null}t({...e,installing:!1,result:d,health:f}),await r(d)}catch(n){i?.close(),t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[j,X,N,g,o,e,c,Q,t,r,a.composioAuthConfigRequired,a.composioAuthConfigUnavailable,a.composioSetupSignInRequired]),pe=X?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[],$=X?.requiresCustomAuthConfig===!0,me=N&&$&&!e.config.authConfigId?.trim();return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||n()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,H.jsxs)(p,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,c?`max-h-[calc(100dvh-2rem)] w-[min(100%-2rem,32rem)]`:`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,42rem)]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float dark:border-edge`),children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)(ae,{connector:o,size:`lg`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(m,{className:`text-base font-semibold text-fg`,children:G(a.connectDialogTitle,{name:o.displayName})}),(0,H.jsx)(u,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:s})]})]}),(0,H.jsx)(d,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:S(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,T.focusRingPanel),"aria-label":a.modalClose,children:[(0,H.jsx)(x,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,H.jsx)(`div`,{className:S(`min-h-0 overflow-y-auto px-6 py-5`,!c&&`flex-1`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&U?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,"aria-busy":`true`,"aria-label":a.composioSetupTitle,children:[(0,H.jsx)(C,{className:`h-4 w-40`}),(0,H.jsx)(C,{className:`mt-2 h-3 w-72 max-w-full`}),(0,H.jsx)(C,{className:`mt-3 h-16 w-full rounded-xl`})]}):c&&!N?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/50 p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioSetupTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.composioSetupHint}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(L,{providerId:`xopc-cloud`,displayName:`XOPC Cloud`,connected:!1,onConnected:()=>{O().then(e=>{B(e),F(e.configured)})}})}),(0,H.jsx)(i,{to:`/settings/connector-service`,onClick:n,className:`mt-3 block text-xs text-accent-fg`,children:a.composioSetupByok})]}):null,c&&j?(0,H.jsxs)(`label`,{className:`flex items-start gap-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-accent`,checked:Q,onChange:e=>de(e.currentTarget.checked)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:a.learnAfterConnect}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:a.learnAfterConnectHint})]})]}):null,c&&N&&z?.mode===`managed`?(0,H.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:$?a.composioCloudAuthUnavailable:a.composioSetupManaged}):null,c&&N&&z?.mode===`byok`?(0,H.jsxs)(`details`,{open:$,className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:a.composioAdvancedSettings}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioAuthConfigTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:$?a.composioAuthConfigRequiredHint:a.composioAuthConfigManaged})]}),z?.mode===`byok`?(0,H.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:[a.composioAuthConfigManage,(0,H.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})]}):(0,H.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:a.composioSetupManaged})]}),Z?(0,H.jsx)(C,{className:`mt-3 h-10 w-full`}):(0,H.jsxs)(ee,{className:S(Y,`mt-3`),value:e.config.authConfigId??``,onChange:n=>t({...e,config:{...e.config,authConfigId:n.currentTarget.value},error:null}),children:[$?null:(0,H.jsx)(_,{value:``,children:a.composioAuthConfigManaged}),$&&!e.config.authConfigId?(0,H.jsx)(_,{value:``,disabled:!0,children:a.composioAuthConfigSelect}):null,pe.map(e=>(0,H.jsxs)(_,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`,` · `,e.id]},e.id))]}),!Z&&$&&pe.length===0?(0,H.jsx)(`p`,{className:`mt-2 text-xs text-amber-700 dark:text-amber-300`,children:a.composioAuthConfigEmpty}):null]}):null,c&&N&&z?.mode===`byok`?(0,H.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:a.composioSessionWritePermissionHint}):null,e.store?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailPermissions}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,H.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:a.storeLocalExecDenied})]})]}):null,(o.setup.links??[]).length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-xl border border-edge bg-surface-base p-3`,children:(o.setup.links??[]).map(e=>{let t=e.external!==!1&&/^https:\/\//i.test(e.href);return(0,H.jsxs)(`a`,{href:t?e.href:`#${e.href}`,target:t?`_blank`:void 0,rel:t?`noopener noreferrer`:void 0,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent-fg hover:underline`,children:[e.label,t?(0,H.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}):null]},`${e.label}:${e.href}`)})}):null,(o.setup.secrets??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,H.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,H.jsx)(y,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:a.secretInputLabels,placeholder:n.required?a.requiredPlaceholder:a.optionalPlaceholder})]},n.key)),(o.setup.config??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,H.jsx)(`textarea`,{className:oe,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,H.jsx)(`input`,{className:Y,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,H.jsx)(b,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),a.connectingTitle]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.connectingHint})]}):null,e.error?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:e.error}):null,q?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:q}):null,e.result&&e.health?.ok?(0,H.jsx)(re,{target:{kind:`connector`,id:o.id,name:o.displayName},serverId:e.result.materialized.type===`mcp`?e.result.materialized.serverId:void 0,onStart:n}):null,e.result?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`p`,{className:`font-medium text-fg`,children:a.connectedBadge})}),(0,H.jsx)(`span`,{className:S(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?a.healthStatusHealthy:se(e.health?.status,a)})]}),(0,H.jsx)(`p`,{className:`mt-3`,children:e.health?.ok?a.connectionReady:e.health?a.connectionNeedsSetup:a.installedWithoutHealth}),e.health?.action?(0,H.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})}),(0,H.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,H.jsxs)(w,{variant:`primary`,disabled:!!e.result||e.installing||U||Z||me||c&&!N,onClick:()=>void fe(),children:[e.installing?(0,H.jsx)(b,{className:`size-4 animate-spin`}):e.result?(0,H.jsx)(te,{className:`size-4`}):(0,H.jsx)(R,{className:`size-4`}),e.result?a.connectedBadge:a.connect]})})]})]})})}function le(e){let t=(0,B.c)(2),n;return t[0]===e?n=t[1]:(n=e.draft.connector.runtime.type===`cli`?(0,H.jsx)(W,{definition:e.draft.connector,onClose:e.onClose,onChanged:e.onInstalled}):(0,H.jsx)(X,{...e}),t[0]=e,t[1]=n),n}export{G as a,R as c,K as i,ae as n,W as o,ie as r,z as s,le as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-B6OrWgY1.js";import{t as a}from"./messages-jwdBhfL9.js";import{t as o}from"./cn-0WouolD0.js";import{n as s}from"./electron-env-DHOGevH3.js";import{c,d as l,h as u,l as d,m as f,p,t as m,u as h}from"./voice-input-shortcut-events-B9xc1oK8.js";import{n as g}from"./side-chat-shortcut-BIw-1TTD.js";import{n as _,t as v}from"./settings-page-header-BAN34UQi.js";import"./settings-page-layout-B5TVFBV2.js";var y=n(),b=e(t(),1),x=r(),S=l(),C=S?`⌘`:`Ctrl`;function w(e){let t=(0,y.c)(53),{title:n,description:r,shortcut:s,otherShortcut:c,defaultShortcut:l,setShortcut:u,notice:d}=e,h=i(D),g;t[0]===h?g=t[1]:(g=a(h),t[0]=h,t[1]=g);let _=g.keyboardShortcutsSettings,[v,C]=(0,b.useState)(!1),[w,O]=(0,b.useState)(null),k,A;t[2]===v?(k=t[3],A=t[4]):(k=()=>{let e={active:v};return window.dispatchEvent(new CustomEvent(m,{detail:e})),E},A=[v],t[2]=v,t[3]=k,t[4]=A),(0,b.useEffect)(k,A);let j;t[5]!==_.quickCaptureShortcutConflict||t[6]!==c||t[7]!==v||t[8]!==u?(j=e=>{if(!v)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C(!1);return}let t=f(e.nativeEvent);if(!t)return;let n=S?`meta`:`control`;if(new Set([`${n}+k`,`${n}+n`,`${n}+b`,`${n}+,`]).has(t)||t===c){O(_.quickCaptureShortcutConflict);return}u(t),O(null),C(!1)},t[5]=_.quickCaptureShortcutConflict,t[6]=c,t[7]=v,t[8]=u,t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[10]=n,t[11]=N);let P;t[12]===r?P=t[13]:(P=(0,x.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r}),t[12]=r,t[13]=P);let F;t[14]!==N||t[15]!==P?(F=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[14]=N,t[15]=P,t[16]=F):F=t[16];let I;t[17]===s?I=t[18]:(I=p(s).map(T),t[17]=s,t[18]=I);let L;t[19]===I?L=t[20]:(L=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:I}),t[19]=I,t[20]=L);let R;t[21]!==F||t[22]!==L?(R=(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,L]}),t[21]=F,t[22]=L,t[23]=R):R=t[23];let z,B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(z=o(`rounded-lg bg-accent px-3 py-1.5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`),B=()=>{O(null),C(!0)},t[24]=z,t[25]=B):(z=t[24],B=t[25]);let V;t[26]!==_.quickCaptureShortcutChange||t[27]!==M?(V=(0,x.jsx)(`button`,{type:`button`,className:z,onClick:B,onKeyDown:M,children:_.quickCaptureShortcutChange}),t[26]=_.quickCaptureShortcutChange,t[27]=M,t[28]=V):V=t[28];let H;t[29]!==l||t[30]!==u?(H=()=>{u(l()),O(null)},t[29]=l,t[30]=u,t[31]=H):H=t[31];let U;t[32]!==_.quickCaptureShortcutReset||t[33]!==H?(U=(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:H,children:_.quickCaptureShortcutReset}),t[32]=_.quickCaptureShortcutReset,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==_.quickCaptureShortcutRecording||t[36]!==M||t[37]!==v?(W=v?(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,onKeyDown:M,onClick:()=>C(!1),children:_.quickCaptureShortcutRecording}):null,t[35]=_.quickCaptureShortcutRecording,t[36]=M,t[37]=v,t[38]=W):W=t[38];let G;t[39]!==V||t[40]!==U||t[41]!==W?(G=(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[V,U,W]}),t[39]=V,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K;t[43]===w?K=t[44]:(K=w?(0,x.jsx)(`p`,{className:`mt-2 text-sm text-danger-fg`,children:w}):null,t[43]=w,t[44]=K);let q;t[45]===d?q=t[46]:(q=d?(0,x.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-base/55 p-3`,children:d}):null,t[45]=d,t[46]=q);let J;return t[47]!==R||t[48]!==G||t[49]!==K||t[50]!==q||t[51]!==n?(J=(0,x.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-3.5 sm:px-5 sm:py-4`,"aria-label":n,children:[R,G,K,q]}),t[47]=R,t[48]=G,t[49]=K,t[50]=q,t[51]=n,t[52]=J):J=t[52],J}function T(e,t){return(0,x.jsx)(z,{children:e},`${e}-${String(t)}`)}function E(){window.dispatchEvent(new CustomEvent(m,{detail:{active:!1}}))}function D(e){return e.language}function O(){let e=(0,y.c)(8),t=i(M),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(j),s=u(A),c=d(k),l;return e[2]!==r.quickCaptureShortcutDescription||e[3]!==r.quickCaptureShortcutTitle||e[4]!==s||e[5]!==o||e[6]!==c?(l=(0,x.jsx)(w,{title:r.quickCaptureShortcutTitle,description:r.quickCaptureShortcutDescription,shortcut:o,otherShortcut:c,defaultShortcut:h,setShortcut:s}),e[2]=r.quickCaptureShortcutDescription,e[3]=r.quickCaptureShortcutTitle,e[4]=s,e[5]=o,e[6]=c,e[7]=l):l=e[7],l}function k(e){return e.shortcut}function A(e){return e.setShortcut}function j(e){return e.shortcut}function M(e){return e.language}function N(){let e=(0,y.c)(9),t=i(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=d(I),s=d(F),l=u(P),f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,x.jsx)(R,{}),e[2]=f):f=e[2];let p;return e[3]!==r.voiceInputShortcutDescription||e[4]!==r.voiceInputShortcutTitle||e[5]!==l||e[6]!==s||e[7]!==o?(p=(0,x.jsx)(w,{title:r.voiceInputShortcutTitle,description:r.voiceInputShortcutDescription,shortcut:o,otherShortcut:l,defaultShortcut:c,setShortcut:s,notice:f}),e[3]=r.voiceInputShortcutDescription,e[4]=r.voiceInputShortcutTitle,e[5]=l,e[6]=s,e[7]=o,e[8]=p):p=e[8],p}function P(e){return e.shortcut}function F(e){return e.setShortcut}function I(e){return e.shortcut}function L(e){return e.language}function R(){let e=a(i(e=>e.language)).keyboardShortcutsSettings,t=window.electronAPI?.system,n=s()&&window.electronAPI?.platform===`darwin`,[r,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{if(!n||!t)return;let e=!0,r=()=>{t.getPermissions().then(t=>{e&&c(t.accessibility===`granted`)}).catch(()=>void 0)};return r(),window.addEventListener(`focus`,r),()=>{e=!1,window.removeEventListener(`focus`,r)}},[n,t]),!n||!t?null:(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`max-w-[65ch] text-xs text-fg-muted`,children:r?e.voiceInputAccessibilityGranted:e.voiceInputAccessibilityDescription}),r?null:(0,x.jsx)(`button`,{type:`button`,disabled:l,className:o(`rounded-lg bg-surface-base/70 px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:text-fg-disabled`),onClick:async()=>{u(!0);try{let e=await t.requestAccessibility();c(e.status===`granted`)}finally{u(!1)}},children:l?e.voiceInputAccessibilityRequesting:e.voiceInputAccessibilityEnable})]})}function z(e){let t=(0,y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,x.jsx)(`kbd`,{className:`inline-flex min-w-[1.5rem] items-center justify-center rounded-md bg-surface-hover/70 px-1.5 py-0.5 font-mono text-xs font-medium text-fg-muted shadow-sm`,children:n}),t[0]=n,t[1]=r),r}function B(e){let t=(0,y.c)(14),{keys:n,label:r,note:i}=e,a;t[0]===r?a=t[1]:(a=(0,x.jsx)(`span`,{className:`text-sm text-fg`,children:r}),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i&&(0,x.jsxs)(`span`,{className:`ml-1.5 text-xs text-fg-muted`,children:[`(`,i,`)`]}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n?c=t[8]:(c=n.map(V),t[7]=n,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==s||t[12]!==l?(u=(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[s,l]}),t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function V(e){return(0,x.jsx)(z,{children:e},e)}function H(e){let t=(0,y.c)(11),{title:n,shortcuts:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=o(`rounded-xl bg-surface-hover/20 px-4 sm:px-5`),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,x.jsx)(`h2`,{className:`pb-1 pt-3.5 text-sm font-semibold text-fg sm:pt-4`,children:n}),t[1]=n,t[2]=a);let s;t[3]===r?s=t[4]:(s=r.map(U),t[3]=r,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,x.jsx)(`div`,{className:`grid gap-1 pb-3 sm:pb-4`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==a||t[8]!==c||t[9]!==n?(l=(0,x.jsxs)(`section`,{className:i,"aria-label":n,children:[a,c]}),t[7]=a,t[8]=c,t[9]=n,t[10]=l):l=t[10],l}function U(e){return(0,x.jsx)(B,{...e},e.label)}function W(){let e=(0,y.c)(139),t=i(J),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(q),c=d(K),l;if(e[2]!==r.categoryChat||e[3]!==r.categoryEditor||e[4]!==r.categoryGlobal||e[5]!==r.categoryNavigation||e[6]!==r.chatForceSend||e[7]!==r.chatNewLine||e[8]!==r.chatSend||e[9]!==r.chatToggleSideChat||e[10]!==r.chatVoiceInput||e[11]!==r.editorBulletList||e[12]!==r.editorHeading1||e[13]!==r.editorHeading2||e[14]!==r.editorHeading3||e[15]!==r.editorOrderedList||e[16]!==r.editorTaskList||e[17]!==r.globalNewChat||e[18]!==r.globalOpenSettings||e[19]!==r.globalToggleWindow||e[20]!==r.globalVoiceInput||e[21]!==r.globalVoiceInputMacNote||e[22]!==r.globalVoiceInputWindowsNote||e[23]!==r.navCloseDialog||e[24]!==r.navCommandPalette||e[25]!==r.navQuickCapture||e[26]!==r.navToggleFullscreen||e[27]!==r.navToggleSidebar||e[28]!==o||e[29]!==c){if(l=[],s()){let t=window.electronAPI?.platform===`darwin`?`Fn`:`Alt`,n=window.electronAPI?.platform===`darwin`?r.globalVoiceInputMacNote:r.globalVoiceInputWindowsNote,i;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(i=[C,`Shift`,`Space`],e[31]=i):i=e[31];let a;e[32]===r.globalToggleWindow?a=e[33]:(a={keys:i,label:r.globalToggleWindow},e[32]=r.globalToggleWindow,e[33]=a);let o;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(o=[t],e[34]=o):o=e[34];let s;e[35]!==r.globalVoiceInput||e[36]!==n?(s={keys:o,label:r.globalVoiceInput,note:n},e[35]=r.globalVoiceInput,e[36]=n,e[37]=s):s=e[37];let c;e[38]!==a||e[39]!==s?(c=[a,s],e[38]=a,e[39]=s,e[40]=c):c=e[40];let u;e[41]!==r.categoryGlobal||e[42]!==c?(u={title:r.categoryGlobal,shortcuts:c},e[41]=r.categoryGlobal,e[42]=c,e[43]=u):u=e[43],l.push(u)}let t=r.categoryNavigation,n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=[C,`N`],e[44]=n):n=e[44];let i;e[45]===r.globalNewChat?i=e[46]:(i={keys:n,label:r.globalNewChat},e[45]=r.globalNewChat,e[46]=i);let a;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(a=[C,`K`],e[47]=a):a=e[47];let u;e[48]===r.navCommandPalette?u=e[49]:(u={keys:a,label:r.navCommandPalette},e[48]=r.navCommandPalette,e[49]=u);let d;e[50]===o?d=e[51]:(d=p(o),e[50]=o,e[51]=d);let f;e[52]!==r.navQuickCapture||e[53]!==d?(f={keys:d,label:r.navQuickCapture},e[52]=r.navQuickCapture,e[53]=d,e[54]=f):f=e[54];let m;e[55]===r.navToggleSidebar?m=e[56]:(m=s()?[{keys:[C,`B`],label:r.navToggleSidebar}]:[],e[55]=r.navToggleSidebar,e[56]=m);let h;e[57]===r.navToggleFullscreen?h=e[58]:(h=s()?[{keys:[`F11`],label:r.navToggleFullscreen}]:[],e[57]=r.navToggleFullscreen,e[58]=h);let _;e[59]===r.globalOpenSettings?_=e[60]:(_=s()?[{keys:[C,`,`],label:r.globalOpenSettings}]:[],e[59]=r.globalOpenSettings,e[60]=_);let v;e[61]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`Esc`],e[61]=v):v=e[61];let y;e[62]===r.navCloseDialog?y=e[63]:(y={keys:v,label:r.navCloseDialog},e[62]=r.navCloseDialog,e[63]=y);let b;e[64]!==_||e[65]!==y||e[66]!==i||e[67]!==u||e[68]!==f||e[69]!==m||e[70]!==h?(b=[i,u,f,...m,...h,..._,y],e[64]=_,e[65]=y,e[66]=i,e[67]=u,e[68]=f,e[69]=m,e[70]=h,e[71]=b):b=e[71];let x;e[72]!==r.categoryNavigation||e[73]!==b?(x={title:t,shortcuts:b},e[72]=r.categoryNavigation,e[73]=b,e[74]=x):x=e[74],l.push(x);let S=r.categoryChat,w;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=[`Enter`],e[75]=w):w=e[75];let T;e[76]===r.chatSend?T=e[77]:(T={keys:w,label:r.chatSend},e[76]=r.chatSend,e[77]=T);let E;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(E=[`Shift`,`Enter`],e[78]=E):E=e[78];let D;e[79]===r.chatNewLine?D=e[80]:(D={keys:E,label:r.chatNewLine},e[79]=r.chatNewLine,e[80]=D);let O;e[81]===Symbol.for(`react.memo_cache_sentinel`)?(O=[C,`Enter`],e[81]=O):O=e[81];let k;e[82]===r.chatForceSend?k=e[83]:(k={keys:O,label:r.chatForceSend},e[82]=r.chatForceSend,e[83]=k);let A;e[84]===c?A=e[85]:(A=p(c),e[84]=c,e[85]=A);let j;e[86]!==r.chatVoiceInput||e[87]!==A?(j={keys:A,label:r.chatVoiceInput},e[86]=r.chatVoiceInput,e[87]=A,e[88]=j):j=e[88];let M;e[89]===Symbol.for(`react.memo_cache_sentinel`)?(M=g(window.electronAPI?.platform),e[89]=M):M=e[89];let N;e[90]===r.chatToggleSideChat?N=e[91]:(N={keys:M,label:r.chatToggleSideChat},e[90]=r.chatToggleSideChat,e[91]=N);let P;e[92]!==T||e[93]!==D||e[94]!==k||e[95]!==j||e[96]!==N?(P=[T,D,k,j,N],e[92]=T,e[93]=D,e[94]=k,e[95]=j,e[96]=N,e[97]=P):P=e[97];let F;e[98]!==r.categoryChat||e[99]!==P?(F={title:S,shortcuts:P},e[98]=r.categoryChat,e[99]=P,e[100]=F):F=e[100],l.push(F);let I;e[101]===Symbol.for(`react.memo_cache_sentinel`)?(I=[C,`Shift`,`1`],e[101]=I):I=e[101];let L;e[102]===r.editorHeading1?L=e[103]:(L={keys:I,label:r.editorHeading1},e[102]=r.editorHeading1,e[103]=L);let R;e[104]===Symbol.for(`react.memo_cache_sentinel`)?(R=[C,`Shift`,`2`],e[104]=R):R=e[104];let z;e[105]===r.editorHeading2?z=e[106]:(z={keys:R,label:r.editorHeading2},e[105]=r.editorHeading2,e[106]=z);let B;e[107]===Symbol.for(`react.memo_cache_sentinel`)?(B=[C,`Shift`,`3`],e[107]=B):B=e[107];let V;e[108]===r.editorHeading3?V=e[109]:(V={keys:B,label:r.editorHeading3},e[108]=r.editorHeading3,e[109]=V);let H;e[110]===Symbol.for(`react.memo_cache_sentinel`)?(H=[C,`Shift`,`8`],e[110]=H):H=e[110];let U;e[111]===r.editorBulletList?U=e[112]:(U={keys:H,label:r.editorBulletList},e[111]=r.editorBulletList,e[112]=U);let W;e[113]===Symbol.for(`react.memo_cache_sentinel`)?(W=[C,`Shift`,`9`],e[113]=W):W=e[113];let G;e[114]===r.editorOrderedList?G=e[115]:(G={keys:W,label:r.editorOrderedList},e[114]=r.editorOrderedList,e[115]=G);let K;e[116]===Symbol.for(`react.memo_cache_sentinel`)?(K=[C,`Shift`,`0`],e[116]=K):K=e[116];let q;e[117]===r.editorTaskList?q=e[118]:(q={keys:K,label:r.editorTaskList},e[117]=r.editorTaskList,e[118]=q);let J;e[119]!==L||e[120]!==z||e[121]!==V||e[122]!==U||e[123]!==G||e[124]!==q?(J=[L,z,V,U,G,q],e[119]=L,e[120]=z,e[121]=V,e[122]=U,e[123]=G,e[124]=q,e[125]=J):J=e[125];let Y;e[126]!==r.categoryEditor||e[127]!==J?(Y={title:r.categoryEditor,shortcuts:J},e[126]=r.categoryEditor,e[127]=J,e[128]=Y):Y=e[128],l.push(Y),e[2]=r.categoryChat,e[3]=r.categoryEditor,e[4]=r.categoryGlobal,e[5]=r.categoryNavigation,e[6]=r.chatForceSend,e[7]=r.chatNewLine,e[8]=r.chatSend,e[9]=r.chatToggleSideChat,e[10]=r.chatVoiceInput,e[11]=r.editorBulletList,e[12]=r.editorHeading1,e[13]=r.editorHeading2,e[14]=r.editorHeading3,e[15]=r.editorOrderedList,e[16]=r.editorTaskList,e[17]=r.globalNewChat,e[18]=r.globalOpenSettings,e[19]=r.globalToggleWindow,e[20]=r.globalVoiceInput,e[21]=r.globalVoiceInputMacNote,e[22]=r.globalVoiceInputWindowsNote,e[23]=r.navCloseDialog,e[24]=r.navCommandPalette,e[25]=r.navQuickCapture,e[26]=r.navToggleFullscreen,e[27]=r.navToggleSidebar,e[28]=o,e[29]=c,e[30]=l}else l=e[30];let f;e[129]!==r.pageTitle||e[130]!==r.subtitle?(f=(0,x.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[129]=r.pageTitle,e[130]=r.subtitle,e[131]=f):f=e[131];let m,h;e[132]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,x.jsx)(O,{}),h=(0,x.jsx)(N,{}),e[132]=m,e[133]=h):(m=e[132],h=e[133]);let b;e[134]===l?b=e[135]:(b=l.map(G),e[134]=l,e[135]=b);let S;return e[136]!==f||e[137]!==b?(S=(0,x.jsxs)(_,{gap:`gap-6`,children:[f,m,h,b]}),e[136]=f,e[137]=b,e[138]=S):S=e[138],S}function G(e){return(0,x.jsx)(H,{...e},e.title)}function K(e){return e.shortcut}function q(e){return e.shortcut}function J(e){return e.language}export{W as KeyboardShortcutsSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-CAZaC05J.js";import{t as a}from"./messages-C7fckbyG.js";import{t as o}from"./cn-0WouolD0.js";import{n as s}from"./electron-env-DHOGevH3.js";import{c,d as l,h as u,l as d,m as f,p,t as m,u as h}from"./voice-input-shortcut-events-_SgYmx7X.js";import{n as g}from"./side-chat-shortcut-BIw-1TTD.js";import{n as _,t as v}from"./settings-page-header-LuOJvqNa.js";import"./settings-page-layout-CduQ8w4a.js";var y=n(),b=e(t(),1),x=r(),S=l(),C=S?`⌘`:`Ctrl`;function w(e){let t=(0,y.c)(53),{title:n,description:r,shortcut:s,otherShortcut:c,defaultShortcut:l,setShortcut:u,notice:d}=e,h=i(D),g;t[0]===h?g=t[1]:(g=a(h),t[0]=h,t[1]=g);let _=g.keyboardShortcutsSettings,[v,C]=(0,b.useState)(!1),[w,O]=(0,b.useState)(null),k,A;t[2]===v?(k=t[3],A=t[4]):(k=()=>{let e={active:v};return window.dispatchEvent(new CustomEvent(m,{detail:e})),E},A=[v],t[2]=v,t[3]=k,t[4]=A),(0,b.useEffect)(k,A);let j;t[5]!==_.quickCaptureShortcutConflict||t[6]!==c||t[7]!==v||t[8]!==u?(j=e=>{if(!v)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C(!1);return}let t=f(e.nativeEvent);if(!t)return;let n=S?`meta`:`control`;if(new Set([`${n}+k`,`${n}+n`,`${n}+b`,`${n}+,`]).has(t)||t===c){O(_.quickCaptureShortcutConflict);return}u(t),O(null),C(!1)},t[5]=_.quickCaptureShortcutConflict,t[6]=c,t[7]=v,t[8]=u,t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[10]=n,t[11]=N);let P;t[12]===r?P=t[13]:(P=(0,x.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r}),t[12]=r,t[13]=P);let F;t[14]!==N||t[15]!==P?(F=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[14]=N,t[15]=P,t[16]=F):F=t[16];let I;t[17]===s?I=t[18]:(I=p(s).map(T),t[17]=s,t[18]=I);let L;t[19]===I?L=t[20]:(L=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:I}),t[19]=I,t[20]=L);let R;t[21]!==F||t[22]!==L?(R=(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,L]}),t[21]=F,t[22]=L,t[23]=R):R=t[23];let z,B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(z=o(`rounded-lg bg-accent px-3 py-1.5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`),B=()=>{O(null),C(!0)},t[24]=z,t[25]=B):(z=t[24],B=t[25]);let V;t[26]!==_.quickCaptureShortcutChange||t[27]!==M?(V=(0,x.jsx)(`button`,{type:`button`,className:z,onClick:B,onKeyDown:M,children:_.quickCaptureShortcutChange}),t[26]=_.quickCaptureShortcutChange,t[27]=M,t[28]=V):V=t[28];let H;t[29]!==l||t[30]!==u?(H=()=>{u(l()),O(null)},t[29]=l,t[30]=u,t[31]=H):H=t[31];let U;t[32]!==_.quickCaptureShortcutReset||t[33]!==H?(U=(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:H,children:_.quickCaptureShortcutReset}),t[32]=_.quickCaptureShortcutReset,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==_.quickCaptureShortcutRecording||t[36]!==M||t[37]!==v?(W=v?(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,onKeyDown:M,onClick:()=>C(!1),children:_.quickCaptureShortcutRecording}):null,t[35]=_.quickCaptureShortcutRecording,t[36]=M,t[37]=v,t[38]=W):W=t[38];let G;t[39]!==V||t[40]!==U||t[41]!==W?(G=(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[V,U,W]}),t[39]=V,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K;t[43]===w?K=t[44]:(K=w?(0,x.jsx)(`p`,{className:`mt-2 text-sm text-danger-fg`,children:w}):null,t[43]=w,t[44]=K);let q;t[45]===d?q=t[46]:(q=d?(0,x.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-base/55 p-3`,children:d}):null,t[45]=d,t[46]=q);let J;return t[47]!==R||t[48]!==G||t[49]!==K||t[50]!==q||t[51]!==n?(J=(0,x.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-3.5 sm:px-5 sm:py-4`,"aria-label":n,children:[R,G,K,q]}),t[47]=R,t[48]=G,t[49]=K,t[50]=q,t[51]=n,t[52]=J):J=t[52],J}function T(e,t){return(0,x.jsx)(z,{children:e},`${e}-${String(t)}`)}function E(){window.dispatchEvent(new CustomEvent(m,{detail:{active:!1}}))}function D(e){return e.language}function O(){let e=(0,y.c)(8),t=i(M),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(j),s=u(A),c=d(k),l;return e[2]!==r.quickCaptureShortcutDescription||e[3]!==r.quickCaptureShortcutTitle||e[4]!==s||e[5]!==o||e[6]!==c?(l=(0,x.jsx)(w,{title:r.quickCaptureShortcutTitle,description:r.quickCaptureShortcutDescription,shortcut:o,otherShortcut:c,defaultShortcut:h,setShortcut:s}),e[2]=r.quickCaptureShortcutDescription,e[3]=r.quickCaptureShortcutTitle,e[4]=s,e[5]=o,e[6]=c,e[7]=l):l=e[7],l}function k(e){return e.shortcut}function A(e){return e.setShortcut}function j(e){return e.shortcut}function M(e){return e.language}function N(){let e=(0,y.c)(9),t=i(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=d(I),s=d(F),l=u(P),f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,x.jsx)(R,{}),e[2]=f):f=e[2];let p;return e[3]!==r.voiceInputShortcutDescription||e[4]!==r.voiceInputShortcutTitle||e[5]!==l||e[6]!==s||e[7]!==o?(p=(0,x.jsx)(w,{title:r.voiceInputShortcutTitle,description:r.voiceInputShortcutDescription,shortcut:o,otherShortcut:l,defaultShortcut:c,setShortcut:s,notice:f}),e[3]=r.voiceInputShortcutDescription,e[4]=r.voiceInputShortcutTitle,e[5]=l,e[6]=s,e[7]=o,e[8]=p):p=e[8],p}function P(e){return e.shortcut}function F(e){return e.setShortcut}function I(e){return e.shortcut}function L(e){return e.language}function R(){let e=a(i(e=>e.language)).keyboardShortcutsSettings,t=window.electronAPI?.system,n=s()&&window.electronAPI?.platform===`darwin`,[r,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{if(!n||!t)return;let e=!0,r=()=>{t.getPermissions().then(t=>{e&&c(t.accessibility===`granted`)}).catch(()=>void 0)};return r(),window.addEventListener(`focus`,r),()=>{e=!1,window.removeEventListener(`focus`,r)}},[n,t]),!n||!t?null:(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`max-w-[65ch] text-xs text-fg-muted`,children:r?e.voiceInputAccessibilityGranted:e.voiceInputAccessibilityDescription}),r?null:(0,x.jsx)(`button`,{type:`button`,disabled:l,className:o(`rounded-lg bg-surface-base/70 px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:text-fg-disabled`),onClick:async()=>{u(!0);try{let e=await t.requestAccessibility();c(e.status===`granted`)}finally{u(!1)}},children:l?e.voiceInputAccessibilityRequesting:e.voiceInputAccessibilityEnable})]})}function z(e){let t=(0,y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,x.jsx)(`kbd`,{className:`inline-flex min-w-[1.5rem] items-center justify-center rounded-md bg-surface-hover/70 px-1.5 py-0.5 font-mono text-xs font-medium text-fg-muted shadow-sm`,children:n}),t[0]=n,t[1]=r),r}function B(e){let t=(0,y.c)(14),{keys:n,label:r,note:i}=e,a;t[0]===r?a=t[1]:(a=(0,x.jsx)(`span`,{className:`text-sm text-fg`,children:r}),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i&&(0,x.jsxs)(`span`,{className:`ml-1.5 text-xs text-fg-muted`,children:[`(`,i,`)`]}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n?c=t[8]:(c=n.map(V),t[7]=n,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==s||t[12]!==l?(u=(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[s,l]}),t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function V(e){return(0,x.jsx)(z,{children:e},e)}function H(e){let t=(0,y.c)(11),{title:n,shortcuts:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=o(`rounded-xl bg-surface-hover/20 px-4 sm:px-5`),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,x.jsx)(`h2`,{className:`pb-1 pt-3.5 text-sm font-semibold text-fg sm:pt-4`,children:n}),t[1]=n,t[2]=a);let s;t[3]===r?s=t[4]:(s=r.map(U),t[3]=r,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,x.jsx)(`div`,{className:`grid gap-1 pb-3 sm:pb-4`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==a||t[8]!==c||t[9]!==n?(l=(0,x.jsxs)(`section`,{className:i,"aria-label":n,children:[a,c]}),t[7]=a,t[8]=c,t[9]=n,t[10]=l):l=t[10],l}function U(e){return(0,x.jsx)(B,{...e},e.label)}function W(){let e=(0,y.c)(139),t=i(J),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(q),c=d(K),l;if(e[2]!==r.categoryChat||e[3]!==r.categoryEditor||e[4]!==r.categoryGlobal||e[5]!==r.categoryNavigation||e[6]!==r.chatForceSend||e[7]!==r.chatNewLine||e[8]!==r.chatSend||e[9]!==r.chatToggleSideChat||e[10]!==r.chatVoiceInput||e[11]!==r.editorBulletList||e[12]!==r.editorHeading1||e[13]!==r.editorHeading2||e[14]!==r.editorHeading3||e[15]!==r.editorOrderedList||e[16]!==r.editorTaskList||e[17]!==r.globalNewChat||e[18]!==r.globalOpenSettings||e[19]!==r.globalToggleWindow||e[20]!==r.globalVoiceInput||e[21]!==r.globalVoiceInputMacNote||e[22]!==r.globalVoiceInputWindowsNote||e[23]!==r.navCloseDialog||e[24]!==r.navCommandPalette||e[25]!==r.navQuickCapture||e[26]!==r.navToggleFullscreen||e[27]!==r.navToggleSidebar||e[28]!==o||e[29]!==c){if(l=[],s()){let t=window.electronAPI?.platform===`darwin`?`Fn`:`Alt`,n=window.electronAPI?.platform===`darwin`?r.globalVoiceInputMacNote:r.globalVoiceInputWindowsNote,i;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(i=[C,`Shift`,`Space`],e[31]=i):i=e[31];let a;e[32]===r.globalToggleWindow?a=e[33]:(a={keys:i,label:r.globalToggleWindow},e[32]=r.globalToggleWindow,e[33]=a);let o;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(o=[t],e[34]=o):o=e[34];let s;e[35]!==r.globalVoiceInput||e[36]!==n?(s={keys:o,label:r.globalVoiceInput,note:n},e[35]=r.globalVoiceInput,e[36]=n,e[37]=s):s=e[37];let c;e[38]!==a||e[39]!==s?(c=[a,s],e[38]=a,e[39]=s,e[40]=c):c=e[40];let u;e[41]!==r.categoryGlobal||e[42]!==c?(u={title:r.categoryGlobal,shortcuts:c},e[41]=r.categoryGlobal,e[42]=c,e[43]=u):u=e[43],l.push(u)}let t=r.categoryNavigation,n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=[C,`N`],e[44]=n):n=e[44];let i;e[45]===r.globalNewChat?i=e[46]:(i={keys:n,label:r.globalNewChat},e[45]=r.globalNewChat,e[46]=i);let a;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(a=[C,`K`],e[47]=a):a=e[47];let u;e[48]===r.navCommandPalette?u=e[49]:(u={keys:a,label:r.navCommandPalette},e[48]=r.navCommandPalette,e[49]=u);let d;e[50]===o?d=e[51]:(d=p(o),e[50]=o,e[51]=d);let f;e[52]!==r.navQuickCapture||e[53]!==d?(f={keys:d,label:r.navQuickCapture},e[52]=r.navQuickCapture,e[53]=d,e[54]=f):f=e[54];let m;e[55]===r.navToggleSidebar?m=e[56]:(m=s()?[{keys:[C,`B`],label:r.navToggleSidebar}]:[],e[55]=r.navToggleSidebar,e[56]=m);let h;e[57]===r.navToggleFullscreen?h=e[58]:(h=s()?[{keys:[`F11`],label:r.navToggleFullscreen}]:[],e[57]=r.navToggleFullscreen,e[58]=h);let _;e[59]===r.globalOpenSettings?_=e[60]:(_=s()?[{keys:[C,`,`],label:r.globalOpenSettings}]:[],e[59]=r.globalOpenSettings,e[60]=_);let v;e[61]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`Esc`],e[61]=v):v=e[61];let y;e[62]===r.navCloseDialog?y=e[63]:(y={keys:v,label:r.navCloseDialog},e[62]=r.navCloseDialog,e[63]=y);let b;e[64]!==_||e[65]!==y||e[66]!==i||e[67]!==u||e[68]!==f||e[69]!==m||e[70]!==h?(b=[i,u,f,...m,...h,..._,y],e[64]=_,e[65]=y,e[66]=i,e[67]=u,e[68]=f,e[69]=m,e[70]=h,e[71]=b):b=e[71];let x;e[72]!==r.categoryNavigation||e[73]!==b?(x={title:t,shortcuts:b},e[72]=r.categoryNavigation,e[73]=b,e[74]=x):x=e[74],l.push(x);let S=r.categoryChat,w;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=[`Enter`],e[75]=w):w=e[75];let T;e[76]===r.chatSend?T=e[77]:(T={keys:w,label:r.chatSend},e[76]=r.chatSend,e[77]=T);let E;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(E=[`Shift`,`Enter`],e[78]=E):E=e[78];let D;e[79]===r.chatNewLine?D=e[80]:(D={keys:E,label:r.chatNewLine},e[79]=r.chatNewLine,e[80]=D);let O;e[81]===Symbol.for(`react.memo_cache_sentinel`)?(O=[C,`Enter`],e[81]=O):O=e[81];let k;e[82]===r.chatForceSend?k=e[83]:(k={keys:O,label:r.chatForceSend},e[82]=r.chatForceSend,e[83]=k);let A;e[84]===c?A=e[85]:(A=p(c),e[84]=c,e[85]=A);let j;e[86]!==r.chatVoiceInput||e[87]!==A?(j={keys:A,label:r.chatVoiceInput},e[86]=r.chatVoiceInput,e[87]=A,e[88]=j):j=e[88];let M;e[89]===Symbol.for(`react.memo_cache_sentinel`)?(M=g(window.electronAPI?.platform),e[89]=M):M=e[89];let N;e[90]===r.chatToggleSideChat?N=e[91]:(N={keys:M,label:r.chatToggleSideChat},e[90]=r.chatToggleSideChat,e[91]=N);let P;e[92]!==T||e[93]!==D||e[94]!==k||e[95]!==j||e[96]!==N?(P=[T,D,k,j,N],e[92]=T,e[93]=D,e[94]=k,e[95]=j,e[96]=N,e[97]=P):P=e[97];let F;e[98]!==r.categoryChat||e[99]!==P?(F={title:S,shortcuts:P},e[98]=r.categoryChat,e[99]=P,e[100]=F):F=e[100],l.push(F);let I;e[101]===Symbol.for(`react.memo_cache_sentinel`)?(I=[C,`Shift`,`1`],e[101]=I):I=e[101];let L;e[102]===r.editorHeading1?L=e[103]:(L={keys:I,label:r.editorHeading1},e[102]=r.editorHeading1,e[103]=L);let R;e[104]===Symbol.for(`react.memo_cache_sentinel`)?(R=[C,`Shift`,`2`],e[104]=R):R=e[104];let z;e[105]===r.editorHeading2?z=e[106]:(z={keys:R,label:r.editorHeading2},e[105]=r.editorHeading2,e[106]=z);let B;e[107]===Symbol.for(`react.memo_cache_sentinel`)?(B=[C,`Shift`,`3`],e[107]=B):B=e[107];let V;e[108]===r.editorHeading3?V=e[109]:(V={keys:B,label:r.editorHeading3},e[108]=r.editorHeading3,e[109]=V);let H;e[110]===Symbol.for(`react.memo_cache_sentinel`)?(H=[C,`Shift`,`8`],e[110]=H):H=e[110];let U;e[111]===r.editorBulletList?U=e[112]:(U={keys:H,label:r.editorBulletList},e[111]=r.editorBulletList,e[112]=U);let W;e[113]===Symbol.for(`react.memo_cache_sentinel`)?(W=[C,`Shift`,`9`],e[113]=W):W=e[113];let G;e[114]===r.editorOrderedList?G=e[115]:(G={keys:W,label:r.editorOrderedList},e[114]=r.editorOrderedList,e[115]=G);let K;e[116]===Symbol.for(`react.memo_cache_sentinel`)?(K=[C,`Shift`,`0`],e[116]=K):K=e[116];let q;e[117]===r.editorTaskList?q=e[118]:(q={keys:K,label:r.editorTaskList},e[117]=r.editorTaskList,e[118]=q);let J;e[119]!==L||e[120]!==z||e[121]!==V||e[122]!==U||e[123]!==G||e[124]!==q?(J=[L,z,V,U,G,q],e[119]=L,e[120]=z,e[121]=V,e[122]=U,e[123]=G,e[124]=q,e[125]=J):J=e[125];let Y;e[126]!==r.categoryEditor||e[127]!==J?(Y={title:r.categoryEditor,shortcuts:J},e[126]=r.categoryEditor,e[127]=J,e[128]=Y):Y=e[128],l.push(Y),e[2]=r.categoryChat,e[3]=r.categoryEditor,e[4]=r.categoryGlobal,e[5]=r.categoryNavigation,e[6]=r.chatForceSend,e[7]=r.chatNewLine,e[8]=r.chatSend,e[9]=r.chatToggleSideChat,e[10]=r.chatVoiceInput,e[11]=r.editorBulletList,e[12]=r.editorHeading1,e[13]=r.editorHeading2,e[14]=r.editorHeading3,e[15]=r.editorOrderedList,e[16]=r.editorTaskList,e[17]=r.globalNewChat,e[18]=r.globalOpenSettings,e[19]=r.globalToggleWindow,e[20]=r.globalVoiceInput,e[21]=r.globalVoiceInputMacNote,e[22]=r.globalVoiceInputWindowsNote,e[23]=r.navCloseDialog,e[24]=r.navCommandPalette,e[25]=r.navQuickCapture,e[26]=r.navToggleFullscreen,e[27]=r.navToggleSidebar,e[28]=o,e[29]=c,e[30]=l}else l=e[30];let f;e[129]!==r.pageTitle||e[130]!==r.subtitle?(f=(0,x.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[129]=r.pageTitle,e[130]=r.subtitle,e[131]=f):f=e[131];let m,h;e[132]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,x.jsx)(O,{}),h=(0,x.jsx)(N,{}),e[132]=m,e[133]=h):(m=e[132],h=e[133]);let b;e[134]===l?b=e[135]:(b=l.map(G),e[134]=l,e[135]=b);let S;return e[136]!==f||e[137]!==b?(S=(0,x.jsxs)(_,{gap:`gap-6`,children:[f,m,h,b]}),e[136]=f,e[137]=b,e[138]=S):S=e[138],S}function G(e){return(0,x.jsx)(H,{...e},e.title)}function K(e){return e.shortcut}function q(e){return e.shortcut}function J(e){return e.language}export{W as KeyboardShortcutsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c}from"./locale-store-B6OrWgY1.js";import{t as ee}from"./resource-unavailable-CUNbPkdj.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./arrow-left-D880xG-P.js";import{t as _}from"./check-DUBLcKHA.js";import{t as v}from"./circle-check-C23XjkUj.js";import{t as y}from"./circle-x-DFsCKeya.js";import{t as b}from"./clock-3-DnrAnuyZ.js";import{t as te}from"./external-link-DjqjBmc3.js";import{n as x,r as S,t as C}from"./power-off-CwwQ7Gp7.js";import{t as w}from"./folder-kanban-CpLlFI1o.js";import{t as ne}from"./history-DXH_9jsE.js";import{t as T}from"./loader-circle-CifKLtgG.js";import{t as re}from"./panel-left-C8MqSXRZ.js";import{t as ie}from"./power-ZI-pBczI.js";import{t as ae}from"./refresh-cw-BRlGaq2w.js";import{t as oe}from"./rotate-ccw-JM1TBLpp.js";import{t as se}from"./shield-check-BU58siTV.js";import{t as ce}from"./sparkles-DHlfQFAF.js";import{t as le}from"./trash-2-DusmjVPV.js";import{t as ue}from"./triangle-alert-2JXFNNKU.js";import{t as de}from"./x-B_N4OPjy.js";import{t as E}from"./skeleton-BI5TyibZ.js";import{a as fe}from"./local-apps-Ck6kACsY.js";import{u as pe}from"./api-oIK4hYkJ.js";import{a as me,i as he}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-Cc4hUNTt.js";import{t as ge}from"./page-header-store-CEn_kPsn.js";import{a as _e,c as ve,d as ye,l as be,n as xe,r as Se,s as Ce,t as we,u as Te}from"./api-DMbimMEi.js";import{n as Ee,r as De,t as Oe}from"./runtime-health-D2TDFLLq.js";import{r as ke}from"./date-formatters-DukWSVwc.js";import{n as Ae,t as je}from"./tab-completion-input-CxtEp0aP.js";import{t as Me}from"./page-context-capture-button-urhQBRaN.js";var O=e(t(),1);function Ne(e){return e.replace(/^(?:例如\s*[::]?|for example\s*[::]?|e\.g\.\s*)/i,``).replace(/…$/,``).trim()}var Pe=`build-xopc-local-app`;function k(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function Fe(e){return e.find(e=>k(e)===`coder`)??null}function Ie(e,t){let n=new URLSearchParams({skill:Pe}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var Le=n(),A=r();function Re(e){let t=(0,Le.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let ee=a?`产品场景`:`Product scenarios`,l;t[0]===ee?l=t[1]:(l=(0,A.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:ee}),t[0]=ee,t[1]=l);let u=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,d;t[2]===u?d=t[3]:(d=(0,A.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f;t[4]!==l||t[5]!==d?(f=(0,A.jsxs)(`div`,{children:[l,d]}),t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=i!==null,m;t[7]===i?m=t[8]:(m=i===`all`?(0,A.jsx)(T,{className:`size-3 animate-spin`}):(0,A.jsx)(ae,{className:`size-3`}),t[7]=i,t[8]=m);let h=a?`全部重跑`:`Run all`,g;t[9]!==o||t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:p,children:[m,h]}),t[9]=o,t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==f||t[15]!==g?(_=(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[f,g]}),t[14]=f,t[15]=g,t[16]=_):_=t[16];let te=a?`产品场景验收结果`:`Product scenario acceptance results`,S;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,A.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,A.jsx)(T,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,A.jsx)(v,{className:`size-3.5 text-success`}):n===`failed`?(0,A.jsx)(y,{className:`size-3.5 text-danger`}):(0,A.jsx)(b,{className:`size-3.5 text-fg-subtle`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,A.jsx)(D,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,A.jsx)(ae,{className:`size-3`})})]}),n===`running`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,A.jsxs)(`div`,{className:`mt-1.5`,children:[(0,A.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,A.jsx)(x,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],S=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=S}else S=t[23];let C;t[30]!==te||t[31]!==S?(C=(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":te,children:S}),t[30]=te,t[31]=S,t[32]=C):C=t[32];let w;return t[33]!==_||t[34]!==C?(w=(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[_,C]}),t[33]=_,t[34]=C,t[35]=w):w=t[35],w}var ze=`allow-scripts allow-forms`;function Be(e,t){return ke(e,t)}function Ve(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function He(){let{appId:e}=i(),t=e===`new`,n=c(e=>e.language)===`zh`,r=c(e=>e.language),y=o(),{mutate:b}=me(),ke=ge(e=>e.setPageHeader),Pe=ge(e=>e.clearPageHeader),{data:k,isLoading:Le,error:He,mutate:Ue}=he(!t&&e?[`local-app`,e]:null,()=>xe(e)),{data:j,isLoading:We,mutate:Ge}=he(!t&&e?[`local-app-validation`,e]:null,()=>ye(e)),[Ke,qe]=(0,O.useState)(``),[Je,Ye]=(0,O.useState)(``),[M,N]=(0,O.useState)(!1),[Xe,P]=(0,O.useState)(null),[Ze,Qe]=(0,O.useState)(!1),[$e,et]=(0,O.useState)(!1),[tt,nt]=(0,O.useState)(0),[rt,it]=(0,O.useState)(``),[F,at]=(0,O.useState)(!1),[I,ot]=(0,O.useState)(!1),[L,R]=(0,O.useState)(`booting`),[z,st]=(0,O.useState)(null),[B,ct]=(0,O.useState)(null),[V,lt]=(0,O.useState)({}),[H,ut]=(0,O.useState)(`all`),[U,W]=(0,O.useState)(0),[dt,ft]=(0,O.useState)(0),[pt,mt]=(0,O.useState)(null),[G,ht]=(0,O.useState)(null),[gt,_t]=(0,O.useState)([]),[vt,yt]=(0,O.useState)(!1),bt=(0,O.useRef)(new Set),K=(0,O.useRef)(null),xt=(0,O.useRef)(null),St=(0,O.useRef)(null),q=(0,O.useRef)(null),J=(0,O.useRef)(``),Y=j?.acceptanceScenarios??[],X=(0,O.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>V[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,V]),Z=(0,O.useMemo)(()=>{if(!B)return null;if(!j?.acceptanceScenarioCount)return B;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...B.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:B.interactiveCount}},[B,X,j?.acceptanceScenarioCount]),Ct=(0,O.useCallback)(async(e,t)=>{let n=Fe(await pe(e.projectId));if(!n){let n=new URLSearchParams({projectId:e.projectId,...t?{draft:t}:{}});y(`/chat/new?${n}`,{state:{agentId:`coder`,forceNewChat:!0}});return}bt.current.add(n.key),y(Ie(n.key,t))},[y]),wt=(0,O.useCallback)(async(e=!0)=>{if(!k)return null;ot(!0);try{let t=await ye(k.id);return await Ge(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,ut(`all`),W(0),nt(e=>e+1)),t}catch(e){return P(e instanceof Error?e.message:String(e)),null}finally{ot(!1)}},[k,Ge]);(0,O.useEffect)(()=>{if(!k)return;let e=!1;pe(k.projectId).then(t=>{e||(bt.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!bt.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,wt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[k,wt]),(0,O.useEffect)(()=>{_t(k?.acceptanceRuns??[])},[k?.acceptanceRuns]),(0,O.useEffect)(()=>{q.current=null},[k?.id]),(0,O.useEffect)(()=>{!j?.sourceHash||q.current===j.sourceHash||(q.current=j.sourceHash,ut(`all`),W(0),nt(e=>e+1))},[k?.id,j?.sourceHash]),(0,O.useLayoutEffect)(()=>{if(!k)return;R(`booting`),st(null),ct(null),ht(null),yt(!1),J.current=``;let e=window.setTimeout(()=>R(e=>e===`failed`?e:`timeout`),7e3),t=xt.current?De(xt.current,t=>{let n=fe(t);if(n){if(n.type===`ready`){R(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),ct(n.detail),ht(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),st(n.detail),R(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[k,tt]),(0,O.useLayoutEffect)(()=>{if(!k||j?.status!==`healthy`||!Y.length){mt(null);return}let e=H===`all`?Y[U]:Y.find(e=>e.id===H),t=e?[e]:[];if(!t.length)return;mt(H),lt(e=>{if(H===`all`&&U===0)return{};let t={...e};return delete t[H],t});let r=!1,i=e=>{lt(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),mt(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=St.current?De(St.current,e=>{let t=fe(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),lt(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),H===`all`&&U+1<Y.length?(W(e=>e+1),ft(e=>e+1)):mt(null)):t.type===`error`&&(window.clearTimeout(a),i(Oe(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,k,dt,H,U,tt,j?.status,n]),(0,O.useEffect)(()=>{if(!k||!Z||!G||G!==j?.sourceHash)return;let e=`${k.id}:${G}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,yt(!0),Ce(k.id,G,Z).then(t=>{J.current===e&&_t(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,yt(!1),P(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&&yt(!1)}))},[Z,G,k,j?.sourceHash]);let Q=(0,O.useCallback)(async e=>{if(k){at(!0),P(null);try{await Ct(k,e)}catch(e){P(e instanceof Error?e.message:String(e)),at(!1)}}},[k,Ct]);(0,O.useLayoutEffect)(()=>(ke({startExtra:(0,A.jsx)(a,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回应用工坊`:`Back to App Studio`,children:(0,A.jsx)(g,{className:`size-4`})}),main:(0,A.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k?.name||(t?n?`创建应用`:`Create app`:n?`应用详情`:`App details`)}),end:k?(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(Me,{resource:{kind:`local_app`,id:k.id,revision:j?.sourceHash??``},disabled:M||F||I||!j?.sourceHash}),(0,A.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,A.jsxs)(a,{to:`/projects/${encodeURIComponent(k.projectId)}`,children:[(0,A.jsx)(w,{className:`size-4`}),n?`项目`:`Project`]})}),(0,A.jsxs)(D,{className:`h-9`,onClick:()=>void Q(),disabled:F,children:[F?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>Pe()),[k,t,M,F,I,j?.sourceHash,Pe,Q,ke,n]);async function Tt(e){e.preventDefault(),N(!0),P(null);try{let e=await we({name:Ke,idea:Je});await b(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await Ct(e,t)}catch{y(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){P(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function Et(){if(k){N(!0),P(null);try{let e=await _e(k.id);await Ue(e,{revalidate:!1}),await Ge(),await Promise.all([b(`local-apps-list`),b(`gateway-extensions-list`)]),Qe(!1)}catch(e){P(e instanceof Error?e.message:String(e))}finally{N(!1)}}}async function Dt(e){N(!0),P(null);try{let t=await e();return await Ue(t,{revalidate:!1}),await Ge(),await Promise.all([b(`local-apps-list`),b(`gateway-extensions-list`)]),!0}catch(e){return P(e instanceof Error?e.message:String(e)),!1}finally{N(!1)}}async function Ot(e){k&&await Dt(()=>be(k.id,e))}async function kt(e){k&&await Dt(()=>ve(k.id,e))}async function At(){k&&await Dt(()=>Te(k.id))&&et(!1)}async function jt(e){if(!(!k||!e.length)){P(null);try{let t=await Se(k.id,{sourceHash:j?.sourceHash,locale:n?`zh`:`en`,diagnostics:e});await Q(t.prompt)}catch(e){P(e instanceof Error?e.message:String(e))}}}function Mt(){jt([...j?.issues.map(e=>({phase:`build`,code:e.code,message:e.message}))??[],...z?[{phase:`runtime`,code:z.kind,message:Oe(z)}]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>({phase:`acceptance`,code:e.id,message:e.message}))??[],...Object.values(V).filter(e=>e.status===`failed`).map(e=>({phase:e.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${e.message}`})),...L===`timeout`?[{phase:`boot`,code:`boot_timeout`,message:`Preview did not report ready within 7 seconds.`}]:[]])}function Nt(){ut(`all`),W(0),ft(e=>e+1)}function Pt(e){ut(e),W(0),ft(e=>e+1)}function Ft(e,t){jt([{phase:t.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${t.message}`}])}let It=gt.findIndex(e=>Ve(e,G,Z)),$=It>=0?gt[It]:null,Lt=It>=0?gt[It+1]??null:gt[0]??null,Rt=Ee(Z),zt=Lt?Lt.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],Bt=j?.status===`failed`||L===`failed`||L===`timeout`||Z?.status===`failed`||Object.values(V).some(e=>e.status===`failed`),Vt=zt.filter(e=>!Rt.includes(e)).length;async function Ht(){let e=await wt(!1);if(e?.status===`healthy`&&e.sourceHash!==G){q.current=e.sourceHash??null,W(0),nt(e=>e+1);return}e?.status===`healthy`&&L===`healthy`&&Z?.status===`passed`&&$&&$.sourceHash===e.sourceHash&&Qe(!0)}return t?(0,A.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,A.jsxs)(`div`,{className:`grid w-full min-w-0 overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,A.jsxs)(`form`,{onSubmit:Tt,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,A.jsx)(ce,{className:`size-4`}),n?`告诉编程智能体你的想法`:`Tell Coder your idea`]}),(0,A.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会创建项目,并在对话中由编程智能体根据你的想法开发应用。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,A.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,A.jsx)(je,{value:Ke,onChange:e=>qe(e.target.value),suggestion:Ne(n?`例如:阅读清单`:`e.g. Reading list`),onAcceptSuggestion:qe,required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,A.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,A.jsx)(Ae,{value:Je,onChange:e=>Ye(e.target.value),suggestion:Ne(n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`),onAcceptSuggestion:Ye,required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),Xe?(0,A.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:Xe}):null,(0,A.jsxs)(D,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:M||!Ke.trim()||!Je.trim(),children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`开始开发对话`:`Continue with Coder`]})]}),(0,A.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,A.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,A.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,A.jsx)(re,{className:`size-7`})}),(0,A.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):Le?(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,A.jsx)(E,{className:`rounded-xl`}),(0,A.jsx)(E,{className:`rounded-xl`}),(0,A.jsx)(E,{className:`rounded-xl`})]}):He||!k?(0,A.jsx)(ee,{kind:`app`,missing:!He||/not found|404/i.test(String(He)),backTo:`/local-apps`,retry:()=>void Ue()}):(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,A.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,A.jsx)(ce,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,A.jsx)(`div`,{className:`mt-4 min-w-0 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:k.idea}),(0,A.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,A.jsx)(v,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续开发会打开对应项目的对话,编程智能体可以参考当前应用继续修改。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,A.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Q(rt)},children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,A.jsx)(Ae,{id:`local-app-change-request`,value:rt,onChange:e=>it(e.target.value),suggestion:Ne(n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`),onAcceptSuggestion:it,rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,A.jsxs)(D,{type:`submit`,className:`mt-2 w-full`,disabled:F||!rt.trim(),children:[F?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Q(),disabled:F,children:[(0,A.jsx)(w,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,A.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${j?.status===`failed`||L===`failed`||L===`timeout`||Z?.status===`failed`?`bg-danger`:j?.status===`healthy`&&L===`healthy`&&Z?.status===`passed`&&$?.sourceHash===j.sourceHash&&!vt?`bg-success`:`bg-fg-subtle`}`}),L===`failed`||L===`timeout`?n?`预览运行异常`:`Preview runtime issue`:j?.status===`failed`||Z?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:L===`booting`||!Z?n?`自动验收中`:`Running acceptance`:vt||$?.sourceHash!==j?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,A.jsxs)(D,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void wt(!0),disabled:I,children:[I?(0,A.jsx)(T,{className:`size-3.5 animate-spin`}):(0,A.jsx)(ae,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,A.jsx)(`iframe`,{ref:xt,title:`${k.name} preview`,src:s(k.draftPreviewUrl),sandbox:ze,className:`min-h-0 w-full flex-1 bg-white`,onError:()=>{st({kind:`script_error`,message:`Preview document failed to load`}),R(`failed`)}},tt),j?.status===`healthy`&&j.acceptanceScenarioCount>0?(0,A.jsx)(`iframe`,{ref:St,title:`${k.name} acceptance runner`,src:`${s(k.draftPreviewUrl)}?xopcAcceptance=1&xopcScenario=${encodeURIComponent(H===`all`?Y[U]?.id??``:H)}`,sandbox:ze,"aria-hidden":`true`,tabIndex:-1,className:`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`},`criteria-${tt}-${dt}-${U}`):null]}),(0,A.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.installationState===`not_installed`?n?`尚未安装`:`Not installed`:k.enabled?n?`版本 ${k.activeVersion} 正在使用`:`Version ${k.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,A.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${k.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,A.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,A.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,k.draftVersion]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:k.activeVersion?`v${k.activeVersion}`:`—`})]})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(S,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),We||I?(0,A.jsx)(T,{className:`size-3.5 animate-spin text-fg-muted`}):j?.status===`healthy`?(0,A.jsx)(v,{className:`size-4 text-success`}):(0,A.jsx)(ue,{className:`size-4 text-danger`})]}),j?(0,A.jsxs)(`div`,{className:`mt-2`,children:[(0,A.jsx)(`p`,{className:`text-xs leading-5 ${j.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:j.status===`healthy`?j.hasDraftChanges?n?`${j.changedFileCount} 个文件有改动,可以安装新版本。`:`${j.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:j.issues[0]?.message}),j.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1`,children:j.changedFiles.slice(0,4).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,j.changedFileCount>4?(0,A.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${j.changedFileCount-4} 个文件`:`${j.changedFileCount-4} more files`}):null,(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${L===`healthy`?`bg-success`:L===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${L===`failed`||L===`timeout`?`text-danger`:`text-fg-muted`}`,children:z?Oe(z):L===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:L===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${Z?.status===`passed`?`bg-success`:Z?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),Z?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:Z.checks.map(e=>(0,A.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,A.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,A.jsx)(`span`,{children:e.message})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:j?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${j.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${j.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),vt?(0,A.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(T,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):$?(0,A.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:Lt?n?`相比上次:已修复 ${Vt} 项,仍有 ${Rt.length} 项。`:`Since the previous run: ${Vt} fixed, ${Rt.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,A.jsx)(Re,{scenarios:Y,results:V,runningTarget:pt,zh:n,onRunAll:Nt,onRunScenario:Pt,onAskCoder:Ft})]}),Bt?(0,A.jsxs)(D,{className:`mt-3 w-full`,onClick:Mt,disabled:F,children:[(0,A.jsx)(x,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,A.jsx)(E,{className:`mt-2 h-12 rounded-lg`})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(se,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))})]}),(0,A.jsx)(D,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void Ht(),disabled:M||We||I||vt||j?.status===`failed`||L!==`healthy`||Z?.status!==`passed`||!$||$.sourceHash!==j?.sourceHash||k.installationState===`installed`&&j?.hasDraftChanges===!1,children:k.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),k.installationState===`installed`?(0,A.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,A.jsxs)(D,{className:`min-w-0 flex-1`,onClick:()=>void Ot(!k.enabled),disabled:M,children:[k.enabled?(0,A.jsx)(C,{className:`size-4`}):(0,A.jsx)(ie,{className:`size-4`}),k.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,A.jsx)(D,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>et(!0),disabled:M,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,A.jsx)(le,{className:`size-4`})})]}):null,(0,A.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(ne,{className:`size-4`}),n?`版本历史`:`Release history`]}),k.releases.length?(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:k.releases.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,A.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:Be(e.createdAt,r)})]}),e.isActive?null:(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void kt(e.id),disabled:M,children:[(0,A.jsx)(oe,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),Xe?(0,A.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:Xe}):null]}),(0,A.jsx)(h,{open:Ze,onOpenChange:Qe,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(p,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(m,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,A.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,A.jsx)(d,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(de,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.extensionId})]}),(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,A.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:j?.changedFileCount??0})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,A.jsxs)(`dd`,{className:`mt-1 flex items-center gap-1.5 font-medium text-success`,children:[(0,A.jsx)(v,{className:`size-3.5`}),n?`已通过并保存`:`Passed and saved`]})]})]}),j?.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-3 space-y-1`,children:j.changedFiles.slice(0,5).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,A.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,A.jsx)(_,{className:`size-4 text-success`}),e,k.installationState===`installed`&&j?.permissionDelta.added.includes(e)?(0,A.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),k.installationState===`installed`&&j?.permissionDelta.added.length?(0,A.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,A.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(d,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`primary`,onClick:()=>void Et(),disabled:M,children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(te,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,A.jsx)(h,{open:$e,onOpenChange:et,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(p,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(m,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,A.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但项目、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,A.jsx)(d,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(de,{className:`size-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,A.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(d,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void At(),disabled:M,children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(le,{className:`size-4`}),n?`卸载但保留项目`:`Uninstall and keep Project`]})]})]})]})})]})}export{He as LocalAppWorkbenchPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c}from"./locale-store-CAZaC05J.js";import{t as ee}from"./resource-unavailable-D15jzjV_.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./arrow-left-D880xG-P.js";import{t as _}from"./check-DUBLcKHA.js";import{t as v}from"./circle-check-C23XjkUj.js";import{t as y}from"./circle-x-DFsCKeya.js";import{t as b}from"./clock-3-DnrAnuyZ.js";import{t as te}from"./external-link-DjqjBmc3.js";import{n as x,r as S,t as C}from"./power-off-CwwQ7Gp7.js";import{t as w}from"./folder-kanban-CpLlFI1o.js";import{t as ne}from"./history-DXH_9jsE.js";import{t as T}from"./loader-circle-CifKLtgG.js";import{t as re}from"./panel-left-C8MqSXRZ.js";import{t as ie}from"./power-ZI-pBczI.js";import{t as ae}from"./refresh-cw-BRlGaq2w.js";import{t as oe}from"./rotate-ccw-JM1TBLpp.js";import{t as se}from"./shield-check-BU58siTV.js";import{t as ce}from"./sparkles-DHlfQFAF.js";import{t as le}from"./trash-2-DusmjVPV.js";import{t as ue}from"./triangle-alert-2JXFNNKU.js";import{t as de}from"./x-B_N4OPjy.js";import{t as E}from"./skeleton-BI5TyibZ.js";import{a as fe}from"./local-apps-Ck6kACsY.js";import{u as pe}from"./api-B9fZL-V8.js";import{a as me,i as he}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-Cc4hUNTt.js";import{t as ge}from"./page-header-store-D7G5utVi.js";import{a as _e,c as ve,d as ye,l as be,n as xe,r as Se,s as Ce,t as we,u as Te}from"./api-Djju8qIR.js";import{n as Ee,r as De,t as Oe}from"./runtime-health-D2TDFLLq.js";import{r as ke}from"./date-formatters-DukWSVwc.js";import{n as Ae,t as je}from"./tab-completion-input-CxtEp0aP.js";import{t as Me}from"./page-context-capture-button-Mig3d0UX.js";var O=e(t(),1);function Ne(e){return e.replace(/^(?:例如\s*[::]?|for example\s*[::]?|e\.g\.\s*)/i,``).replace(/…$/,``).trim()}var Pe=`build-xopc-local-app`;function k(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function Fe(e){return e.find(e=>k(e)===`coder`)??null}function Ie(e,t){let n=new URLSearchParams({skill:Pe}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var Le=n(),A=r();function Re(e){let t=(0,Le.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let ee=a?`产品场景`:`Product scenarios`,l;t[0]===ee?l=t[1]:(l=(0,A.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:ee}),t[0]=ee,t[1]=l);let u=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,d;t[2]===u?d=t[3]:(d=(0,A.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f;t[4]!==l||t[5]!==d?(f=(0,A.jsxs)(`div`,{children:[l,d]}),t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=i!==null,m;t[7]===i?m=t[8]:(m=i===`all`?(0,A.jsx)(T,{className:`size-3 animate-spin`}):(0,A.jsx)(ae,{className:`size-3`}),t[7]=i,t[8]=m);let h=a?`全部重跑`:`Run all`,g;t[9]!==o||t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:p,children:[m,h]}),t[9]=o,t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==f||t[15]!==g?(_=(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[f,g]}),t[14]=f,t[15]=g,t[16]=_):_=t[16];let te=a?`产品场景验收结果`:`Product scenario acceptance results`,S;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,A.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,A.jsx)(T,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,A.jsx)(v,{className:`size-3.5 text-success`}):n===`failed`?(0,A.jsx)(y,{className:`size-3.5 text-danger`}):(0,A.jsx)(b,{className:`size-3.5 text-fg-subtle`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,A.jsx)(D,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,A.jsx)(ae,{className:`size-3`})})]}),n===`running`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,A.jsxs)(`div`,{className:`mt-1.5`,children:[(0,A.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,A.jsx)(x,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],S=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=S}else S=t[23];let C;t[30]!==te||t[31]!==S?(C=(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":te,children:S}),t[30]=te,t[31]=S,t[32]=C):C=t[32];let w;return t[33]!==_||t[34]!==C?(w=(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[_,C]}),t[33]=_,t[34]=C,t[35]=w):w=t[35],w}var ze=`allow-scripts allow-forms`;function Be(e,t){return ke(e,t)}function Ve(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function He(){let{appId:e}=i(),t=e===`new`,n=c(e=>e.language)===`zh`,r=c(e=>e.language),y=o(),{mutate:b}=me(),ke=ge(e=>e.setPageHeader),Pe=ge(e=>e.clearPageHeader),{data:k,isLoading:Le,error:He,mutate:Ue}=he(!t&&e?[`local-app`,e]:null,()=>xe(e)),{data:j,isLoading:We,mutate:Ge}=he(!t&&e?[`local-app-validation`,e]:null,()=>ye(e)),[Ke,qe]=(0,O.useState)(``),[Je,Ye]=(0,O.useState)(``),[M,N]=(0,O.useState)(!1),[Xe,P]=(0,O.useState)(null),[Ze,Qe]=(0,O.useState)(!1),[$e,et]=(0,O.useState)(!1),[tt,nt]=(0,O.useState)(0),[rt,it]=(0,O.useState)(``),[F,at]=(0,O.useState)(!1),[I,ot]=(0,O.useState)(!1),[L,R]=(0,O.useState)(`booting`),[z,st]=(0,O.useState)(null),[B,ct]=(0,O.useState)(null),[V,lt]=(0,O.useState)({}),[H,ut]=(0,O.useState)(`all`),[U,W]=(0,O.useState)(0),[dt,ft]=(0,O.useState)(0),[pt,mt]=(0,O.useState)(null),[G,ht]=(0,O.useState)(null),[gt,_t]=(0,O.useState)([]),[vt,yt]=(0,O.useState)(!1),bt=(0,O.useRef)(new Set),K=(0,O.useRef)(null),xt=(0,O.useRef)(null),St=(0,O.useRef)(null),q=(0,O.useRef)(null),J=(0,O.useRef)(``),Y=j?.acceptanceScenarios??[],X=(0,O.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>V[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,V]),Z=(0,O.useMemo)(()=>{if(!B)return null;if(!j?.acceptanceScenarioCount)return B;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...B.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:B.interactiveCount}},[B,X,j?.acceptanceScenarioCount]),Ct=(0,O.useCallback)(async(e,t)=>{let n=Fe(await pe(e.projectId));if(!n){let n=new URLSearchParams({projectId:e.projectId,...t?{draft:t}:{}});y(`/chat/new?${n}`,{state:{agentId:`coder`,forceNewChat:!0}});return}bt.current.add(n.key),y(Ie(n.key,t))},[y]),wt=(0,O.useCallback)(async(e=!0)=>{if(!k)return null;ot(!0);try{let t=await ye(k.id);return await Ge(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,ut(`all`),W(0),nt(e=>e+1)),t}catch(e){return P(e instanceof Error?e.message:String(e)),null}finally{ot(!1)}},[k,Ge]);(0,O.useEffect)(()=>{if(!k)return;let e=!1;pe(k.projectId).then(t=>{e||(bt.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!bt.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,wt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[k,wt]),(0,O.useEffect)(()=>{_t(k?.acceptanceRuns??[])},[k?.acceptanceRuns]),(0,O.useEffect)(()=>{q.current=null},[k?.id]),(0,O.useEffect)(()=>{!j?.sourceHash||q.current===j.sourceHash||(q.current=j.sourceHash,ut(`all`),W(0),nt(e=>e+1))},[k?.id,j?.sourceHash]),(0,O.useLayoutEffect)(()=>{if(!k)return;R(`booting`),st(null),ct(null),ht(null),yt(!1),J.current=``;let e=window.setTimeout(()=>R(e=>e===`failed`?e:`timeout`),7e3),t=xt.current?De(xt.current,t=>{let n=fe(t);if(n){if(n.type===`ready`){R(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),ct(n.detail),ht(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),st(n.detail),R(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[k,tt]),(0,O.useLayoutEffect)(()=>{if(!k||j?.status!==`healthy`||!Y.length){mt(null);return}let e=H===`all`?Y[U]:Y.find(e=>e.id===H),t=e?[e]:[];if(!t.length)return;mt(H),lt(e=>{if(H===`all`&&U===0)return{};let t={...e};return delete t[H],t});let r=!1,i=e=>{lt(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),mt(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=St.current?De(St.current,e=>{let t=fe(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),lt(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),H===`all`&&U+1<Y.length?(W(e=>e+1),ft(e=>e+1)):mt(null)):t.type===`error`&&(window.clearTimeout(a),i(Oe(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,k,dt,H,U,tt,j?.status,n]),(0,O.useEffect)(()=>{if(!k||!Z||!G||G!==j?.sourceHash)return;let e=`${k.id}:${G}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,yt(!0),Ce(k.id,G,Z).then(t=>{J.current===e&&_t(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,yt(!1),P(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&&yt(!1)}))},[Z,G,k,j?.sourceHash]);let Q=(0,O.useCallback)(async e=>{if(k){at(!0),P(null);try{await Ct(k,e)}catch(e){P(e instanceof Error?e.message:String(e)),at(!1)}}},[k,Ct]);(0,O.useLayoutEffect)(()=>(ke({startExtra:(0,A.jsx)(a,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回应用工坊`:`Back to App Studio`,children:(0,A.jsx)(g,{className:`size-4`})}),main:(0,A.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k?.name||(t?n?`创建应用`:`Create app`:n?`应用详情`:`App details`)}),end:k?(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(Me,{resource:{kind:`local_app`,id:k.id,revision:j?.sourceHash??``},disabled:M||F||I||!j?.sourceHash}),(0,A.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,A.jsxs)(a,{to:`/projects/${encodeURIComponent(k.projectId)}`,children:[(0,A.jsx)(w,{className:`size-4`}),n?`项目`:`Project`]})}),(0,A.jsxs)(D,{className:`h-9`,onClick:()=>void Q(),disabled:F,children:[F?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>Pe()),[k,t,M,F,I,j?.sourceHash,Pe,Q,ke,n]);async function Tt(e){e.preventDefault(),N(!0),P(null);try{let e=await we({name:Ke,idea:Je});await b(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await Ct(e,t)}catch{y(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){P(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function Et(){if(k){N(!0),P(null);try{let e=await _e(k.id);await Ue(e,{revalidate:!1}),await Ge(),await Promise.all([b(`local-apps-list`),b(`gateway-extensions-list`)]),Qe(!1)}catch(e){P(e instanceof Error?e.message:String(e))}finally{N(!1)}}}async function Dt(e){N(!0),P(null);try{let t=await e();return await Ue(t,{revalidate:!1}),await Ge(),await Promise.all([b(`local-apps-list`),b(`gateway-extensions-list`)]),!0}catch(e){return P(e instanceof Error?e.message:String(e)),!1}finally{N(!1)}}async function Ot(e){k&&await Dt(()=>be(k.id,e))}async function kt(e){k&&await Dt(()=>ve(k.id,e))}async function At(){k&&await Dt(()=>Te(k.id))&&et(!1)}async function jt(e){if(!(!k||!e.length)){P(null);try{let t=await Se(k.id,{sourceHash:j?.sourceHash,locale:n?`zh`:`en`,diagnostics:e});await Q(t.prompt)}catch(e){P(e instanceof Error?e.message:String(e))}}}function Mt(){jt([...j?.issues.map(e=>({phase:`build`,code:e.code,message:e.message}))??[],...z?[{phase:`runtime`,code:z.kind,message:Oe(z)}]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>({phase:`acceptance`,code:e.id,message:e.message}))??[],...Object.values(V).filter(e=>e.status===`failed`).map(e=>({phase:e.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${e.message}`})),...L===`timeout`?[{phase:`boot`,code:`boot_timeout`,message:`Preview did not report ready within 7 seconds.`}]:[]])}function Nt(){ut(`all`),W(0),ft(e=>e+1)}function Pt(e){ut(e),W(0),ft(e=>e+1)}function Ft(e,t){jt([{phase:t.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${t.message}`}])}let It=gt.findIndex(e=>Ve(e,G,Z)),$=It>=0?gt[It]:null,Lt=It>=0?gt[It+1]??null:gt[0]??null,Rt=Ee(Z),zt=Lt?Lt.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],Bt=j?.status===`failed`||L===`failed`||L===`timeout`||Z?.status===`failed`||Object.values(V).some(e=>e.status===`failed`),Vt=zt.filter(e=>!Rt.includes(e)).length;async function Ht(){let e=await wt(!1);if(e?.status===`healthy`&&e.sourceHash!==G){q.current=e.sourceHash??null,W(0),nt(e=>e+1);return}e?.status===`healthy`&&L===`healthy`&&Z?.status===`passed`&&$&&$.sourceHash===e.sourceHash&&Qe(!0)}return t?(0,A.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,A.jsxs)(`div`,{className:`grid w-full min-w-0 overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,A.jsxs)(`form`,{onSubmit:Tt,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,A.jsx)(ce,{className:`size-4`}),n?`告诉编程智能体你的想法`:`Tell Coder your idea`]}),(0,A.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会创建项目,并在对话中由编程智能体根据你的想法开发应用。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,A.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,A.jsx)(je,{value:Ke,onChange:e=>qe(e.target.value),suggestion:Ne(n?`例如:阅读清单`:`e.g. Reading list`),onAcceptSuggestion:qe,required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,A.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,A.jsx)(Ae,{value:Je,onChange:e=>Ye(e.target.value),suggestion:Ne(n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`),onAcceptSuggestion:Ye,required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),Xe?(0,A.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:Xe}):null,(0,A.jsxs)(D,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:M||!Ke.trim()||!Je.trim(),children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`开始开发对话`:`Continue with Coder`]})]}),(0,A.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,A.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,A.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,A.jsx)(re,{className:`size-7`})}),(0,A.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):Le?(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,A.jsx)(E,{className:`rounded-xl`}),(0,A.jsx)(E,{className:`rounded-xl`}),(0,A.jsx)(E,{className:`rounded-xl`})]}):He||!k?(0,A.jsx)(ee,{kind:`app`,missing:!He||/not found|404/i.test(String(He)),backTo:`/local-apps`,retry:()=>void Ue()}):(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,A.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,A.jsx)(ce,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,A.jsx)(`div`,{className:`mt-4 min-w-0 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:k.idea}),(0,A.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,A.jsx)(v,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续开发会打开对应项目的对话,编程智能体可以参考当前应用继续修改。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,A.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Q(rt)},children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,A.jsx)(Ae,{id:`local-app-change-request`,value:rt,onChange:e=>it(e.target.value),suggestion:Ne(n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`),onAcceptSuggestion:it,rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,A.jsxs)(D,{type:`submit`,className:`mt-2 w-full`,disabled:F||!rt.trim(),children:[F?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Q(),disabled:F,children:[(0,A.jsx)(w,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,A.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${j?.status===`failed`||L===`failed`||L===`timeout`||Z?.status===`failed`?`bg-danger`:j?.status===`healthy`&&L===`healthy`&&Z?.status===`passed`&&$?.sourceHash===j.sourceHash&&!vt?`bg-success`:`bg-fg-subtle`}`}),L===`failed`||L===`timeout`?n?`预览运行异常`:`Preview runtime issue`:j?.status===`failed`||Z?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:L===`booting`||!Z?n?`自动验收中`:`Running acceptance`:vt||$?.sourceHash!==j?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,A.jsxs)(D,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void wt(!0),disabled:I,children:[I?(0,A.jsx)(T,{className:`size-3.5 animate-spin`}):(0,A.jsx)(ae,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,A.jsx)(`iframe`,{ref:xt,title:`${k.name} preview`,src:s(k.draftPreviewUrl),sandbox:ze,className:`min-h-0 w-full flex-1 bg-white`,onError:()=>{st({kind:`script_error`,message:`Preview document failed to load`}),R(`failed`)}},tt),j?.status===`healthy`&&j.acceptanceScenarioCount>0?(0,A.jsx)(`iframe`,{ref:St,title:`${k.name} acceptance runner`,src:`${s(k.draftPreviewUrl)}?xopcAcceptance=1&xopcScenario=${encodeURIComponent(H===`all`?Y[U]?.id??``:H)}`,sandbox:ze,"aria-hidden":`true`,tabIndex:-1,className:`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`},`criteria-${tt}-${dt}-${U}`):null]}),(0,A.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.installationState===`not_installed`?n?`尚未安装`:`Not installed`:k.enabled?n?`版本 ${k.activeVersion} 正在使用`:`Version ${k.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,A.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${k.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,A.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,A.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,k.draftVersion]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:k.activeVersion?`v${k.activeVersion}`:`—`})]})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(S,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),We||I?(0,A.jsx)(T,{className:`size-3.5 animate-spin text-fg-muted`}):j?.status===`healthy`?(0,A.jsx)(v,{className:`size-4 text-success`}):(0,A.jsx)(ue,{className:`size-4 text-danger`})]}),j?(0,A.jsxs)(`div`,{className:`mt-2`,children:[(0,A.jsx)(`p`,{className:`text-xs leading-5 ${j.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:j.status===`healthy`?j.hasDraftChanges?n?`${j.changedFileCount} 个文件有改动,可以安装新版本。`:`${j.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:j.issues[0]?.message}),j.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1`,children:j.changedFiles.slice(0,4).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,j.changedFileCount>4?(0,A.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${j.changedFileCount-4} 个文件`:`${j.changedFileCount-4} more files`}):null,(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${L===`healthy`?`bg-success`:L===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${L===`failed`||L===`timeout`?`text-danger`:`text-fg-muted`}`,children:z?Oe(z):L===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:L===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${Z?.status===`passed`?`bg-success`:Z?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),Z?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:Z.checks.map(e=>(0,A.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,A.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,A.jsx)(`span`,{children:e.message})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:j?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${j.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${j.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),vt?(0,A.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(T,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):$?(0,A.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:Lt?n?`相比上次:已修复 ${Vt} 项,仍有 ${Rt.length} 项。`:`Since the previous run: ${Vt} fixed, ${Rt.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,A.jsx)(Re,{scenarios:Y,results:V,runningTarget:pt,zh:n,onRunAll:Nt,onRunScenario:Pt,onAskCoder:Ft})]}),Bt?(0,A.jsxs)(D,{className:`mt-3 w-full`,onClick:Mt,disabled:F,children:[(0,A.jsx)(x,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,A.jsx)(E,{className:`mt-2 h-12 rounded-lg`})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(se,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))})]}),(0,A.jsx)(D,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void Ht(),disabled:M||We||I||vt||j?.status===`failed`||L!==`healthy`||Z?.status!==`passed`||!$||$.sourceHash!==j?.sourceHash||k.installationState===`installed`&&j?.hasDraftChanges===!1,children:k.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),k.installationState===`installed`?(0,A.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,A.jsxs)(D,{className:`min-w-0 flex-1`,onClick:()=>void Ot(!k.enabled),disabled:M,children:[k.enabled?(0,A.jsx)(C,{className:`size-4`}):(0,A.jsx)(ie,{className:`size-4`}),k.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,A.jsx)(D,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>et(!0),disabled:M,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,A.jsx)(le,{className:`size-4`})})]}):null,(0,A.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(ne,{className:`size-4`}),n?`版本历史`:`Release history`]}),k.releases.length?(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:k.releases.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,A.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:Be(e.createdAt,r)})]}),e.isActive?null:(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void kt(e.id),disabled:M,children:[(0,A.jsx)(oe,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),Xe?(0,A.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:Xe}):null]}),(0,A.jsx)(h,{open:Ze,onOpenChange:Qe,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(p,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(m,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,A.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,A.jsx)(d,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(de,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.extensionId})]}),(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,A.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:j?.changedFileCount??0})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,A.jsxs)(`dd`,{className:`mt-1 flex items-center gap-1.5 font-medium text-success`,children:[(0,A.jsx)(v,{className:`size-3.5`}),n?`已通过并保存`:`Passed and saved`]})]})]}),j?.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-3 space-y-1`,children:j.changedFiles.slice(0,5).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,A.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,A.jsx)(_,{className:`size-4 text-success`}),e,k.installationState===`installed`&&j?.permissionDelta.added.includes(e)?(0,A.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),k.installationState===`installed`&&j?.permissionDelta.added.length?(0,A.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,A.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(d,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`primary`,onClick:()=>void Et(),disabled:M,children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(te,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,A.jsx)(h,{open:$e,onOpenChange:et,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(p,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(m,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,A.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但项目、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,A.jsx)(d,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(de,{className:`size-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,A.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(d,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void At(),disabled:M,children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(le,{className:`size-4`}),n?`卸载但保留项目`:`Uninstall and keep Project`]})]})]})]})})]})}export{He as LocalAppWorkbenchPage};
|
package/dist/gateway/static/root/assets/{local-apps-page-MqP4EnJm.js → local-apps-page-BeV86rMJ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-CAZaC05J.js";import{t as o}from"./arrow-right-DSSvoX71.js";import{t as s}from"./box-DvYoGszj.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{i as u}from"./vendor-swr-CdRzEUwF.js";import{t as d}from"./button-Cc4hUNTt.js";import{t as f}from"./page-header-store-D7G5utVi.js";import{o as p}from"./api-Djju8qIR.js";var m=n(),h=e(t(),1),g=r();function _(){let e=(0,m.c)(20),t=a(x)===`zh`,n=f(b),r=f(y),{data:l,isLoading:_,error:S}=u(`local-apps-list`,p),C,w;e[0]!==r||e[1]!==n||e[2]!==t?(C=()=>(n({startExtra:null,main:(0,g.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`应用工坊`:`App Studio`}),end:(0,g.jsx)(d,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(c,{className:`size-4`}),t?`创建应用`:`Create app`]})})}),()=>r()),w=[r,n,t],e[0]=r,e[1]=n,e[2]=t,e[3]=C,e[4]=w):(C=e[3],w=e[4]),(0,h.useLayoutEffect)(C,w);let T=t?`创建属于你的 XOPC 应用`:`Build your own apps for XOPC`,E;e[5]===T?E=e[6]:(E=(0,g.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg`,children:T}),e[5]=T,e[6]=E);let D=t?`创建、预览并持续改进自己的工具,需要时可以添加到侧栏。`:`Create, preview, and improve your own tools, then add them to the sidebar when they are ready.`,O;e[7]===D?O=e[8]:(O=(0,g.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:D}),e[7]=D,e[8]=O);let k;e[9]!==E||e[10]!==O?(k=(0,g.jsxs)(`div`,{className:`mb-7 max-w-2xl`,children:[E,O]}),e[9]=E,e[10]=O,e[11]=k):k=e[11];let A;e[12]!==l||e[13]!==S||e[14]!==_||e[15]!==t?(A=_?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:3}).map(v)}):S?(0,g.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:S instanceof Error?S.message:String(S)}):l?.length?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>(0,g.jsxs)(i,{to:`/local-apps/${encodeURIComponent(e.id)}`,className:`group flex min-h-44 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,g.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,g.jsx)(s,{className:`size-5`})}),(0,g.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:e.installationState===`not_installed`?t?`草稿`:`Draft`:e.enabled?t?`已在侧栏`:`In sidebar`:t?`已禁用`:`Disabled`})]}),(0,g.jsx)(`h3`,{className:`mt-4 truncate text-sm font-semibold text-fg`,children:e.name}),(0,g.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.idea}),(0,g.jsxs)(`div`,{className:`mt-auto flex items-center justify-end pt-3 text-xs font-medium text-accent`,children:[t?`编辑应用`:`Edit app`,(0,g.jsx)(o,{className:`ml-1 size-3.5 transition-transform group-hover:translate-x-0.5`})]})]},e.id))}):(0,g.jsxs)(`div`,{className:`px-6 py-16 text-center`,children:[(0,g.jsx)(s,{className:`mx-auto size-8 text-fg-subtle`}),(0,g.jsx)(`h3`,{className:`mt-4 text-sm font-semibold text-fg`,children:t?`还没有应用`:`No apps yet`}),(0,g.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-fg-muted`,children:t?`描述你想解决的问题,XOPC 会创建应用草稿,并用项目保存后续开发记录。`:`Describe the problem and XOPC will create an app scaffold and an ongoing Project.`}),(0,g.jsx)(d,{asChild:!0,variant:`primary`,className:`mt-5`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(c,{className:`size-4`}),t?`创建第一个应用`:`Create your first app`]})})]}),e[12]=l,e[13]=S,e[14]=_,e[15]=t,e[16]=A):A=e[16];let j;return e[17]!==k||e[18]!==A?(j=(0,g.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel px-3 pb-8 pt-3 sm:px-5 lg:pt-4 xl:px-6`,children:(0,g.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[k,A]})}),e[17]=k,e[18]=A,e[19]=j):j=e[19],j}function v(e,t){return(0,g.jsx)(l,{className:`h-44 rounded-xl`},t)}function y(e){return e.clearPageHeader}function b(e){return e.setPageHeader}function x(e){return e.language}export{_ as LocalAppsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{l as e}from"./locale-store-
|
|
1
|
+
import{l as e}from"./locale-store-CAZaC05J.js";import{a as t,c as n,d as r,g as i,i as a,m as o,n as s,o as c,p as l,u,v as d,y as f}from"./schemas-CCWMleym.js";var p=o().regex(/^[A-Za-z0-9_-]{1,64}$/),m=l({id:p,label:o().trim().min(1).max(120),description:o().max(500).optional()}),h={id:p,header:o().trim().min(1).max(24),question:o().trim().min(1).max(1e3)},g=a(c(`type`,[l({...h,type:n(`text`)}),l({...h,type:n(`single_choice`),choices:a(m).min(2).max(10),recommendedChoiceId:p.optional()})])).min(1).max(3).superRefine((e,t)=>{new Set(e.map(e=>e.id)).size!==e.length&&t.addIssue({code:`custom`,message:`Duplicate question IDs`}),e.forEach((e,n)=>{e.type===`single_choice`&&(new Set(e.choices.map(e=>e.id)).size!==e.choices.length&&t.addIssue({code:`custom`,path:[n,`choices`],message:`Duplicate choice IDs`}),e.recommendedChoiceId&&!e.choices.some(t=>t.id===e.recommendedChoiceId)&&t.addIssue({code:`custom`,path:[n,`recommendedChoiceId`],message:`Unknown recommended choice`}))})}),_=a(l({questionId:p,choiceId:p.optional(),text:o().trim().max(2e3).optional()})).min(1).max(3);l({schemaVersion:n(2),questions:g});var v=l({clarificationVersions:a(i([n(1),n(2)])).min(1).max(2)});function y(e){if(new TextEncoder().encode(JSON.stringify(e)).byteLength>32*1024)throw Error(`Clarification exceeds 32 KiB`)}function b(e,t){let n=_.parse(t);if(y(n),n.length!==e.length||new Set(n.map(e=>e.questionId)).size!==n.length||n.some(t=>!e.some(e=>e.id===t.questionId)))throw Error(`Answer every question exactly once`);let r=e.map(e=>{let t=n.find(t=>t.questionId===e.id),r=t.text?.trim()||void 0;if(e.type===`text`&&t.choiceId)throw Error(`Unexpected choice: ${e.id}`);if(t.choiceId&&(e.type!==`single_choice`||!e.choices.some(e=>e.id===t.choiceId)))throw Error(`Unknown choice: ${e.id}`);if(!t.choiceId&&!r)throw Error(`Answer required: ${e.id}`);return{questionId:e.id,...t.choiceId?{choiceId:t.choiceId}:{},...r?{text:r}:{}}});return{answers:r,answer:e.map((e,t)=>{let n=r[t],i=e.type===`single_choice`?e.choices.find(e=>e.id===n.choiceId)?.label:void 0;return`${e.header}: ${e.question}\n${[i,n.text].filter(Boolean).join(`
|
|
2
2
|
`)}`}).join(`
|
|
3
3
|
|
|
4
|
-
`)}}var x=l({kind:s([`note`,`task`,`project`,`local_app`]),id:o().min(1).max(512),revision:o().min(1).max(128)}),S=l({version:n(1),clientInstanceId:o().uuid(),tabId:o().uuid(),sequence:u().int().nonnegative().max(2**53-1),surface:s([`web`,`electron`,`mobile`]),resourceRefs:a(x).max(20),selection:l({text:o().max(16e3),draft:t().default(!1)}).optional(),capturedAt:u().int().nonnegative().max(2**53-1)}),C=r({snapshot:S,resources:a(r({reference:x,title:o(),text:o().max(16e3),truncated:t()})).max(20),selectionTrust:n(`user-supplied`)});function w(e){let t=S.parse(e);if(new TextEncoder().encode(JSON.stringify(t)).byteLength>65536)throw Error(`App context exceeds 64 KiB`);let n=t.resourceRefs.map(e=>`${e.kind}:${e.id}`);if(new Set(n).size!==n.length)throw Error(`App context contains duplicate resources`);return t}var T=e=>new TextEncoder().encode(e).byteLength,E=a(l({kind:n(`browser_page`),sourceId:f(),version:o().regex(/^[a-f0-9]{64}$/),title:o().trim().min(1).max(512),url:d(),capturedAt:u().int().nonnegative(),documentId:o().trim().min(1).max(256),selection:o().optional(),text:o().optional(),truncated:t()}).superRefine((e,t)=>{let n=new URL(e.url);(![`http:`,`https:`].includes(n.protocol)||n.username||n.password||n.hash)&&t.addIssue({code:`custom`,path:[`url`],message:`URL must be a sanitized HTTP(S) URL`}),!e.selection?.trim()&&!e.text?.trim()&&t.addIssue({code:`custom`,message:`A browser context must include selection or page text`}),e.selection&&T(e.selection)>32768&&t.addIssue({code:`custom`,path:[`selection`],message:`Selection is too large`}),e.text&&T(e.text)>131072&&t.addIssue({code:`custom`,path:[`text`],message:`Page text is too large`})})).max(2).superRefine((e,t)=>{T(JSON.stringify(e))>262144&&t.addIssue({code:`custom`,message:`Browser contexts are too large`})}),D=l({agentId:o().trim().min(1),projectId:o().trim().min(1).nullable(),execution:l({mode:s([`local_checkout`,`managed_worktree`]),baseRef:o().trim().min(1).optional()}).nullable(),temporary:t(),model:o().trim().min(1),thinkingLevel:o().min(1)}).refine(e=>e.projectId!==null||e.execution===null,{message:`An execution environment requires a project`,path:[`execution`]}),O=l({id:o().optional(),type:o().min(1),mimeType:o().optional(),data:o().optional(),uri:o().optional(),name:o().optional(),size:u().nonnegative().optional(),workspaceRelativePath:o().optional(),durationSeconds:u().nonnegative().optional()}),k=l({version:n(1),capturedAt:u().int().nonnegative().max(2**53-1),timezone:o().min(1).max(80).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid timezone`),locale:o().min(1).max(80).refine(e=>{try{return Intl.getCanonicalLocales(e).length===1}catch{return!1}},`Invalid locale`)}),A=l({content:o(),endpointContext:k.optional(),interactionCapabilities:v.optional(),attachments:a(O).optional(),contextRefs:a(l({kind:s([`note`,`task`,`file`,`session`,`browser_tab`,`user_assertion`,`result`]),sourceId:o().trim().min(1),refId:o().regex(/^[A-Za-z0-9_-]{1,64}$/).optional(),expectedVersion:o().optional()})).max(5).optional(),browserContexts:E.optional(),appContext:S.optional()}),j=c(`type`,[l({type:n(`endpoint`),endpointId:o().min(1),token:o().min(1)}),l({type:n(`system`),source:n(`cli`)})]),M=c(`kind`,[l({kind:n(`start`),clientMessageId:o().min(1).max(128),creation:D,input:A,origin:j}),l({kind:n(`append`),clientMessageId:o().min(1).max(128),expectedTranscriptId:o().min(1).max(128),configVersion:u().int().nonnegative(),delivery:s([`next`,`steer`]),interrupt:t().optional(),input:A,origin:j})]);l({commandId:o().min(1).max(128),creation:D,purpose:s([`voice`,`session_resources`])});var N=r({operationId:o(),revision:u().int(),state:s([`preparing`,`ready`,`preparation_failed`]),lastError:o().nullable()});function P(e){if(typeof e!=`object`||!e)return JSON.stringify(e)??`null`;if(Array.isArray(e))return`[${e.map(P).join(`,`)}]`;let t=e;return`{${Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${P(t[e])}`).join(`,`)}}`}var F,I=new Set,L=new Map,R=new Map,z=new Map,B=new Map;function V(){return F??=new Promise((e,t)=>{let n=indexedDB.open(`xopc-session-drafts`,2);n.onupgradeneeded=()=>{for(let e of[`drafts`,`identities`,`commands`,`composers`])n.result.objectStoreNames.contains(e)||n.result.createObjectStore(e)},n.onsuccess=()=>e(n.result),n.onerror=()=>{F=void 0,t(n.error)}})}function H(){let t=e.getState();if(!t.conversationId)throw Error(`Sign in before opening a conversation`);return t.conversationId}function U(e){return`${H()}:${e}`}function W(e,t=e){let n=U(e),r=U(t);return{async read(){return I.has(r)?structuredClone(B.get(n)):G(`readonly`,e=>e.get(n),`composers`)},async write(e){if(I.has(r)){e===void 0?B.delete(n):B.set(n,structuredClone(e));return}e===void 0?await G(`readwrite`,e=>e.delete(n),`composers`):await G(`readwrite`,t=>t.put(e,n),`composers`)}}}async function G(e,t,n=`drafts`){let r=await V();return new Promise((i,a)=>{let o=r.transaction(n,e),s=t(o.objectStore(n));o.oncomplete=()=>i(s.result),o.onabort=()=>a(o.error??s.error??Error(`Draft persistence failed`)),o.onerror=()=>a(o.error??s.error)})}async function K(e){let t=U(e);return I.has(t)?structuredClone(L.get(t)):G(`readonly`,e=>e.get(t))}async function q(e){let t=U(e.conversationId);if(e.creation.temporary){I.add(t),L.set(t,structuredClone(e));return}I.delete(t),L.delete(t),await G(`readwrite`,n=>n.put(e,t))}async function J(e,t){let n=U(e);if(I.has(n)){z.set(n,t);return}await G(`readwrite`,e=>e.put(t,n),`identities`)}async function Y(e){let t=U(e);return I.has(t)?z.get(t):G(`readonly`,e=>e.get(t),`identities`)}async function X(e){let t=U(e);return I.has(t)?structuredClone(R.get(t)):G(`readonly`,e=>e.get(t),`commands`)}async function Z(e,t){let n=U(e);if(I.has(n)){let e=R.get(n);if(e&&P(e)!==P(t))throw Error(`Another input is awaiting confirmation`);R.set(n,structuredClone(t));return}let r=await V();await new Promise((e,i)=>{let a=r.transaction(`commands`,`readwrite`),o=a.objectStore(`commands`),s=o.get(n);s.onsuccess=()=>{let e=s.result;if(e&&P(e)!==P(t)){a.abort();return}o.put(t,n)},a.oncomplete=()=>e(),a.onabort=()=>i(Error(`Another input is awaiting confirmation`)),a.onerror=()=>i(a.error)})}async function Q(e){let
|
|
4
|
+
`)}}var x=l({kind:s([`note`,`task`,`project`,`local_app`]),id:o().min(1).max(512),revision:o().min(1).max(128)}),S=l({version:n(1),clientInstanceId:o().uuid(),tabId:o().uuid(),sequence:u().int().nonnegative().max(2**53-1),surface:s([`web`,`electron`,`mobile`]),resourceRefs:a(x).max(20),selection:l({text:o().max(16e3),draft:t().default(!1)}).optional(),capturedAt:u().int().nonnegative().max(2**53-1)}),C=r({snapshot:S,resources:a(r({reference:x,title:o(),text:o().max(16e3),truncated:t()})).max(20),selectionTrust:n(`user-supplied`)});function w(e){let t=S.parse(e);if(new TextEncoder().encode(JSON.stringify(t)).byteLength>65536)throw Error(`App context exceeds 64 KiB`);let n=t.resourceRefs.map(e=>`${e.kind}:${e.id}`);if(new Set(n).size!==n.length)throw Error(`App context contains duplicate resources`);return t}var T=e=>new TextEncoder().encode(e).byteLength,E=a(l({kind:n(`browser_page`),sourceId:f(),version:o().regex(/^[a-f0-9]{64}$/),title:o().trim().min(1).max(512),url:d(),capturedAt:u().int().nonnegative(),documentId:o().trim().min(1).max(256),selection:o().optional(),text:o().optional(),truncated:t()}).superRefine((e,t)=>{let n=new URL(e.url);(![`http:`,`https:`].includes(n.protocol)||n.username||n.password||n.hash)&&t.addIssue({code:`custom`,path:[`url`],message:`URL must be a sanitized HTTP(S) URL`}),!e.selection?.trim()&&!e.text?.trim()&&t.addIssue({code:`custom`,message:`A browser context must include selection or page text`}),e.selection&&T(e.selection)>32768&&t.addIssue({code:`custom`,path:[`selection`],message:`Selection is too large`}),e.text&&T(e.text)>131072&&t.addIssue({code:`custom`,path:[`text`],message:`Page text is too large`})})).max(2).superRefine((e,t)=>{T(JSON.stringify(e))>262144&&t.addIssue({code:`custom`,message:`Browser contexts are too large`})}),D=l({agentId:o().trim().min(1),projectId:o().trim().min(1).nullable(),execution:l({mode:s([`local_checkout`,`managed_worktree`]),baseRef:o().trim().min(1).optional()}).nullable(),temporary:t(),model:o().trim().min(1),thinkingLevel:o().min(1)}).refine(e=>e.projectId!==null||e.execution===null,{message:`An execution environment requires a project`,path:[`execution`]}),O=l({id:o().optional(),type:o().min(1),mimeType:o().optional(),data:o().optional(),uri:o().optional(),name:o().optional(),size:u().nonnegative().optional(),workspaceRelativePath:o().optional(),durationSeconds:u().nonnegative().optional()}),k=l({version:n(1),capturedAt:u().int().nonnegative().max(2**53-1),timezone:o().min(1).max(80).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid timezone`),locale:o().min(1).max(80).refine(e=>{try{return Intl.getCanonicalLocales(e).length===1}catch{return!1}},`Invalid locale`)}),A=l({content:o(),endpointContext:k.optional(),interactionCapabilities:v.optional(),attachments:a(O).optional(),contextRefs:a(l({kind:s([`note`,`task`,`file`,`session`,`browser_tab`,`user_assertion`,`result`]),sourceId:o().trim().min(1),refId:o().regex(/^[A-Za-z0-9_-]{1,64}$/).optional(),expectedVersion:o().optional()})).max(5).optional(),browserContexts:E.optional(),appContext:S.optional()}),j=c(`type`,[l({type:n(`endpoint`),endpointId:o().min(1),token:o().min(1)}),l({type:n(`system`),source:n(`cli`)})]),M=c(`kind`,[l({kind:n(`start`),clientMessageId:o().min(1).max(128),creation:D,input:A,origin:j}),l({kind:n(`append`),clientMessageId:o().min(1).max(128),expectedTranscriptId:o().min(1).max(128),configVersion:u().int().nonnegative(),controlVersion:u().int().nonnegative().optional(),execution:n(`single`).optional(),delivery:s([`next`,`steer`]),interrupt:t().optional(),input:A,origin:j})]);l({commandId:o().min(1).max(128),creation:D,purpose:s([`voice`,`session_resources`])});var N=r({operationId:o(),revision:u().int(),state:s([`preparing`,`ready`,`preparation_failed`]),lastError:o().nullable()});function P(e){if(typeof e!=`object`||!e)return JSON.stringify(e)??`null`;if(Array.isArray(e))return`[${e.map(P).join(`,`)}]`;let t=e;return`{${Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${P(t[e])}`).join(`,`)}}`}l({operationId:o().min(1).max(128),expectedTranscriptId:o().min(1).max(128),action:s([`stop`,`pause`,`resume`,`send`,`steer`]),expectedVersion:u().int().nonnegative(),inputId:o().min(1).optional(),inputVersion:u().int().positive().optional(),turnId:o().min(1).optional()});var F,I=new Set,L=new Map,R=new Map,z=new Map,B=new Map;function V(){return F??=new Promise((e,t)=>{let n=indexedDB.open(`xopc-session-drafts`,2);n.onupgradeneeded=()=>{for(let e of[`drafts`,`identities`,`commands`,`composers`])n.result.objectStoreNames.contains(e)||n.result.createObjectStore(e)},n.onsuccess=()=>e(n.result),n.onerror=()=>{F=void 0,t(n.error)}})}function H(){let t=e.getState();if(!t.conversationId)throw Error(`Sign in before opening a conversation`);return t.conversationId}function U(e){return`${H()}:${e}`}function W(e,t=e){let n=U(e),r=U(t);return{async read(){return I.has(r)?structuredClone(B.get(n)):G(`readonly`,e=>e.get(n),`composers`)},async write(e){if(I.has(r)){e===void 0?B.delete(n):B.set(n,structuredClone(e));return}e===void 0?await G(`readwrite`,e=>e.delete(n),`composers`):await G(`readwrite`,t=>t.put(e,n),`composers`)}}}async function G(e,t,n=`drafts`){let r=await V();return new Promise((i,a)=>{let o=r.transaction(n,e),s=t(o.objectStore(n));o.oncomplete=()=>i(s.result),o.onabort=()=>a(o.error??s.error??Error(`Draft persistence failed`)),o.onerror=()=>a(o.error??s.error)})}async function K(e){let t=U(e);return I.has(t)?structuredClone(L.get(t)):G(`readonly`,e=>e.get(t))}async function q(e){let t=U(e.conversationId);if(e.creation.temporary){I.add(t),L.set(t,structuredClone(e));return}I.delete(t),L.delete(t),await G(`readwrite`,n=>n.put(e,t))}async function J(e,t){let n=U(e);if(I.has(n)){z.set(n,t);return}await G(`readwrite`,e=>e.put(t,n),`identities`)}async function Y(e){let t=U(e);return I.has(t)?z.get(t):G(`readonly`,e=>e.get(t),`identities`)}async function X(e){let t=U(e);return I.has(t)?structuredClone(R.get(t)):G(`readonly`,e=>e.get(t),`commands`)}async function Z(e,t){let n=U(e);if(I.has(n)){let e=R.get(n);if(e&&P(e)!==P(t))throw Error(`Another input is awaiting confirmation`);R.set(n,structuredClone(t));return}let r=await V();await new Promise((e,i)=>{let a=r.transaction(`commands`,`readwrite`),o=a.objectStore(`commands`),s=o.get(n);s.onsuccess=()=>{let e=s.result;if(e&&P(e)!==P(t)){a.abort();return}o.put(t,n)},a.oncomplete=()=>e(),a.onabort=()=>i(Error(`Another input is awaiting confirmation`)),a.onerror=()=>i(a.error)})}async function Q(e,t){let n=U(e);if(I.has(n)){(!t||R.get(n)?.clientMessageId===t)&&R.delete(n);return}let r=await V();await new Promise((e,i)=>{let a=r.transaction(`commands`,`readwrite`),o=a.objectStore(`commands`),s=o.get(n);s.onsuccess=()=>{(!t||s.result?.clientMessageId===t)&&o.delete(n)},a.oncomplete=()=>e(),a.onabort=()=>i(a.error??Error(`Receipt persistence failed`)),a.onerror=()=>i(a.error)})}async function $(e,t){let n=U(e);if(I.has(n)){z.set(n,t),L.delete(n),R.delete(n);return}let r=await V();await new Promise((e,i)=>{let a=r.transaction([`drafts`,`identities`,`commands`],`readwrite`);a.objectStore(`identities`).put(t,n),a.objectStore(`drafts`).delete(n),a.objectStore(`commands`).delete(n),a.oncomplete=()=>e(),a.onabort=()=>i(a.error??Error(`Receipt persistence failed`)),a.onerror=()=>i(a.error)})}function ee(e){return{localDraft:!0,model:e.creation.model,thinkingLevel:e.creation.thinkingLevel,fixedModel:!1,activityDetail:{default:`on`,override:null,effective:`on`,source:`default`},effectiveWorkspacePath:``,workingDirectoryLocked:!!e.creation.projectId,workspaceSource:e.creation.projectId?`project`:`agent_default_root`,userContextMode:e.creation.temporary?`temporary`:`enabled`}}export{w as _,K as a,b,J as c,P as d,k as f,C as g,S as h,ee as i,q as l,N as m,W as n,X as o,M as p,$ as r,Y as s,Q as t,Z as u,_ as v,g as y};
|
package/dist/gateway/static/root/assets/{locale-store-B6OrWgY1.js → locale-store-CAZaC05J.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./messages-C7fckbyG.js";var r=e(t(),1),i=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},a=(e=>e?i(e):i),o=e=>e;function s(e,t=o){let n=r.useSyncExternalStore(e.subscribe,r.useCallback(()=>t(e.getState()),[e,t]),r.useCallback(()=>t(e.getInitialState()),[e,t]));return r.useDebugValue(n),n}var c=e=>{let t=a(e),n=e=>s(t,e);return Object.assign(n,t),n},l=(e=>e?c(e):c);function u(e){let t=(e??``).trim().toLowerCase().replace(/_/g,`-`);return t&&(t===`zh`||t.startsWith(`zh-`))?`zh`:`en`}function d(){if(typeof navigator>`u`)return`en`;let e=(navigator.language||navigator.languages?.[0]||``).trim();return e?u(e):`en`}function f(e){return e===`zh`?`zh-CN`:`en`}function p(e){document.documentElement.setAttribute(`lang`,f(e)),document.title=n(e).appTitle}function m(){return U.getState().language}function h(e,t,n){let r=e.trim().toLowerCase();return!!(!r||r===`http ${t}`||n&&r===n.trim().toLowerCase()||t===429&&(r===`rate_limited`||r===`too many requests`||r===`too many authentication attempts`)||t===500&&r===`internal server error`||t>=500&&(r===`provider request failed`||r===`provider_error`))}function g(e,t,r){let i=r?.trim()??``;if(i&&!h(i,e,t))return i;let a=n(m()).api;return e>=500?e===502?a.errorBadGateway:e===503?a.errorServiceUnavailable:e===504?a.errorGatewayTimeout:e===500?a.errorInternal:a.errorServer.replace(`{{status}}`,String(e)):e===404?a.errorNotFound:e===403?a.errorForbidden:e===429?a.errorRateLimited:a.errorRequest.replace(`{{status}}`,String(e))}var _=l(e=>({baseUrl:typeof window<`u`?window.location.origin:``,conversationId:void 0,tokenDialogOpen:!1,tokenExpired:!1,setBrowserSession:t=>{e({conversationId:t,tokenDialogOpen:!1,tokenExpired:!1}),window.dispatchEvent(new CustomEvent(`gateway-authenticated`))},clearBrowserSession:()=>{fetch(`/api/browser-session`,{method:`DELETE`,credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3)}).catch(()=>{}),e({conversationId:void 0})},openTokenDialog:()=>e({tokenDialogOpen:!0}),closeTokenDialog:()=>e({tokenDialogOpen:!1}),onUnauthorized:()=>{e({conversationId:void 0,tokenDialogOpen:!1,tokenExpired:!0}),window.dispatchEvent(new CustomEvent(`gateway-auth-expired`))}}));async function v(e){return fetch(`/api/browser-session`,{method:`POST`,credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3),headers:{Authorization:`Bearer ${e}`}})}async function y(){try{let e=await fetch(`/api/browser-session`,{credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3)});if(e.ok){let t=await e.json();if(t.conversationId){_.getState().setBrowserSession(t.conversationId);return}}if(e.status!==401)return;let t=window.electronAPI?.gateway?.getCredential,n=typeof t==`function`?await t():void 0;if(!n)return;let r=await v(n);if(!r.ok)return;let i=await r.json();i.conversationId&&_.getState().setBrowserSession(i.conversationId)}catch{}}var b=null,x=null;function S(){b||=new Promise(e=>{x=e})}function C(){b&&(x?.(),b=null,x=null)}typeof window<`u`&&window.addEventListener(`gateway-authenticated`,C);async function w(e,t){b&&await b;let n=new Headers(t?.headers),r=t?.body,i=typeof FormData<`u`&&r instanceof FormData;!n.has(`Content-Type`)&&!i&&n.set(`Content-Type`,`application/json`);let a=await fetch(e,{...t,credentials:`same-origin`,redirect:`error`,headers:n});return a.status===401&&(S(),_.getState().onUnauthorized()),a}async function T(e,t){let n=await w(e,t);if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message,r=g(n.status,n.statusText,t),i=n.headers.get(`Retry-After`),a=i==null?NaN:Number(i);throw Object.assign(Error(r),{status:n.status,body:e,...Number.isFinite(a)&&a>=0?{retryAfterMs:a*1e3}:{}})}return n.json()}function E(){return window.location.origin}function D(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${E()}${t}`}var O=`xopc.language`;function k(){return A()||d()}function A(){try{let e=localStorage.getItem(O);return e===`en`||e===`zh`?e:null}catch{return null}}function j(e){try{localStorage.setItem(O,e)}catch(e){console.error(`Failed to save language:`,e)}}var M,N,P,F;function I(e){return e===`en`||e===`zh`}function L(e){j(e),p(e)}function R(e){window.electronAPI?.locale?.setLanguage(e).catch(()=>{})}function z(e,t){return e?.token===t.token&&e.language===t.language}async function B(){for(;N;){let e=N;N=void 0,M=e,(await Promise.allSettled([T(D(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.language})}),T(D(`/api/user-model/assertions`),{method:`POST`,body:JSON.stringify({scope:{type:`global`},subject:{type:`user`,id:`self`},predicate:`preference.locale`,cardinality:`single`,kind:`preference`,value:e.language===`zh`?`zh-CN`:`en`,statement:e.language===`zh`?`The user prefers Chinese.`:`The user prefers English.`,volatility:`slow`,declaredImportance:.8})})])).every(e=>e.status===`fulfilled`)&&(P=e),M=void 0}}function V(){F||=B().finally(()=>{F=void 0,N&&V()})}function H(e){let t=_.getState().conversationId;if(!t)return;let n={token:t,language:e};if(z(M,n)){N=void 0;return}z(N,n)||!M&&z(P,n)||(N=n,V())}var U=l(e=>({language:k(),setLanguage:t=>{L(t),e({language:t}),R(t),H(t)}}));function W(){H(U.getState().language);let e=_.subscribe((e,t)=>{e.conversationId&&e.conversationId!==t.conversationId&&H(U.getState().language)}),t=window.electronAPI?.locale;if(!t)return e;let n=!1,r=A();r?R(r):t.getLanguage().then(e=>{n||!I(e)||(L(e),U.setState({language:e}),H(e))});let i=t.onChanged(e=>{n||!I(e)||(L(e),U.setState({language:e}),H(e))});return()=>{n=!0,i(),e()}}export{w as a,y as c,p as d,f,D as i,_ as l,U as n,T as o,l as p,k as r,v as s,W as t,g as u};
|