@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
|
@@ -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{i,n as ee,o as a}from"./locale-store-B6OrWgY1.js";import{a as te,i as ne,n as o,o as re,r as ie,s as ae,t as oe}from"./dist-BGTk37IG.js";import{t as s}from"./popover-select-CEMWIrtY.js";import{t as se}from"./secret-input-Dryrns2s.js";import{t as c}from"./skeleton-BI5TyibZ.js";import{i as l}from"./vendor-swr-CdRzEUwF.js";import{t as u}from"./button-Cc4hUNTt.js";import{t as ce}from"./sliding-tab-list-DuQyViqe.js";import{t as d}from"./number-input-El7Szeln.js";import{n as le,t as ue}from"./settings-page-header-BAN34UQi.js";import"./settings-page-layout-B5TVFBV2.js";import{n as f,t as p}from"./use-autosave-HL8XRNR8.js";var m=e(t(),1),h=n(),g=e=>i(`/api/observability/${e}`);async function _(e,t=`GET`,n){return a(g(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}})}var v=r(),y=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,b=`space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,x=(e=0)=>`${(e/1048576).toFixed(1)} MiB`;function S(){let e=(0,h.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,v.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-4`,children:[(0,v.jsx)(c,{className:`h-48 rounded-xl`}),(0,v.jsx)(c,{className:`h-64 rounded-xl`})]}),e[0]=t):t=e[0],t}function de(e,t){let n=0,r=e,i=new Set;for(;r.parentSpanId&&n<12&&!i.has(r.spanId);){i.add(r.spanId);let e=t.find(e=>e.spanId===r.parentSpanId);if(!e)break;r=e,n++}return n}function fe(e){let t=[],n=new Set;function r(i){n.has(i.spanId)||(n.add(i.spanId),t.push(i),e.filter(e=>e.parentSpanId===i.spanId).forEach(r))}return e.filter(t=>!t.parentSpanId||!e.some(e=>e.spanId===t.parentSpanId)).forEach(r),e.forEach(r),t}function pe(){let e=ee(e=>e.language)===`zh`,t=(t,n)=>e?n:t,n=l(g(`tracing/settings`),()=>_(`tracing/settings`)),r=l(g(`tracing/status`),()=>_(`tracing/status`),{refreshInterval:1e4}),[i,a]=(0,m.useState)(),[h,pe]=(0,m.useState)(),C=i??h??n.data?.config,[w,T]=(0,m.useState)(``),[E,D]=(0,m.useState)(``),[me,O]=(0,m.useState)(0),[k,he]=(0,m.useState)(!1),[ge,A]=(0,m.useState)(``),[_e,ve]=(0,m.useState)(!1),[j,ye]=(0,m.useState)(``),[M,be]=(0,m.useState)(`7`),[N,xe]=(0,m.useState)({conversationId:``,runId:``,agentId:``}),[P,F]=(0,m.useState)(`records`),[I,Se]=(0,m.useState)(`10`),[Ce,L]=(0,m.useState)([``]),[R,z]=(0,m.useState)(0),[we,Te]=(0,m.useState)(()=>Date.now()+1),B=Ce[R],[V,H]=(0,m.useState)();function U(){L([``]),z(0),Te(Date.now()+1)}let[Ee,W]=(0,m.useState)(!1),G=new URLSearchParams({limit:I,from:String(we-Number(M)*864e5),to:String(we)});j&&G.set(`status`,j),B&&G.set(`cursor`,B);for(let[e,t]of Object.entries(N))t&&G.set(e,t);let De=`traces?${G}`,K=l(g(De),()=>_(De),{refreshInterval:B?0:1e4}),q=l(V?g(`traces/${V}`):null,()=>_(`traces/${V}`));function J(e){if(!C)return;let t=structuredClone(C);e(t),a(t)}async function Y(e,i=t(`Saved`,`已保存`)){he(!0),A(``),ve(!1);try{await e(),A(i),await Promise.all([n.mutate(),r.mutate(),K.mutate()])}catch(e){ve(!0),A(e instanceof Error?e.message:t(`Request failed`,`操作失败`))}finally{he(!1)}}let X=p({value:C??null,dirty:!!(i&&JSON.stringify(i)!==JSON.stringify(h??n.data?.config)),validate:e=>{if([[`retentionDays`,1,90],[`maxStoreMiB`,16,4096],[`maxTraces`,10,1e5],[`maxSpans`,100,1e6],[`maxTraceKiB`,16,4096],[`maxWriteMiBPerMinute`,1,100]].some(([t,n,r])=>!Number.isInteger(e.local[t])||e.local[t]<n||e.local[t]>r))return t(`Enter valid storage limits before continuing.`,`请填写有效的存储限额。`);try{let t=new URL(e.langfuse.baseUrl);if(![`http:`,`https:`].includes(t.protocol)||e.langfuse.baseUrl.length>2048)throw Error()}catch{return t(`Enter a valid HTTP(S) Base URL.`,`请填写有效的 HTTP(S) Base URL。`)}return null},onSave:async e=>{let t=await _(`tracing/settings`,`PATCH`,e);pe(t.config),a(t=>t&&JSON.stringify(t)===JSON.stringify(e)?void 0:t),await r.mutate().catch(()=>{})}}),Z=(0,m.useMemo)(()=>({publicKey:w.trim(),secretKey:E.trim()}),[w,E]),Q=p({value:Z,dirty:!!(Z.publicKey||Z.secretKey),delayMs:1e3,validate:e=>e.publicKey.length>512||e.secretKey.length>512?t(`Credentials must be at most 512 characters.`,`凭证长度不能超过 512 个字符。`):null,onSave:async e=>{await _(`tracing/langfuse/credentials`,`PUT`,{...e.publicKey?{publicKey:e.publicKey}:{},...e.secretKey?{secretKey:e.secretKey}:{}}),T(t=>t.trim()===e.publicKey?``:t),D(t=>t.trim()===e.secretKey?``:t),O(e=>e+1),await Promise.allSettled([n.mutate(),r.mutate()])}}),$=[X.status,Q.status].some(e=>e===`dirty`||e===`saving`);async function Oe(){V&&await Y(async()=>{let e=await _(`traces/${V}/export`),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`trace-${V}.json`,n.click(),URL.revokeObjectURL(t)},t(`Exported`,`已导出`))}return(0,v.jsxs)(le,{className:`space-y-6`,children:[(0,v.jsx)(ue,{title:t(`Runtime tracing`,`运行追踪`),subtitle:t(`Local diagnostics with bounded retention. Enable Langfuse to also export new traces.`,`默认保留有界本地记录;启用 Langfuse 后同时导出新采集的追踪。`),actions:P===`settings`?(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,v.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t(`Changes save automatically`,`修改后自动保存`)}),(0,v.jsx)(f,{status:X.status,error:X.error})]}):(0,v.jsx)(u,{disabled:K.isValidating,onClick:U,children:t(`Refresh records`,`刷新记录`)})}),ge&&(0,v.jsx)(`p`,{role:_e?`alert`:`status`,className:`text-sm text-fg-muted`,children:ge}),n.error&&(0,v.jsxs)(`div`,{role:`alert`,className:b,children:[(0,v.jsx)(`p`,{children:t(`Unable to load tracing settings.`,`无法加载追踪设置。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void n.mutate(),children:t(`Retry loading settings`,`重新加载设置`)})]}),(0,v.jsxs)(ce,{as:`nav`,"aria-label":t(`Tracing sections`,`追踪页面分区`),className:`flex gap-2 border-b border-edge pb-3`,children:[(0,v.jsx)(u,{"aria-pressed":P===`records`,variant:`ghost`,onClick:()=>F(`records`),children:t(`Execution records`,`执行记录`)}),(0,v.jsx)(u,{"aria-pressed":P===`settings`,variant:`ghost`,onClick:()=>F(`settings`),children:t(`Capture settings`,`采集设置`)})]}),P===`settings`&&(C?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`section`,{className:b,onBlurCapture:X.onBlurCapture,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:t(`Local recording`,`本地记录`)}),X.error&&(0,v.jsx)(u,{variant:`ghost`,onClick:X.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,v.jsx)(`input`,{type:`checkbox`,checked:C.enabled,onChange:e=>J(t=>{t.enabled=e.target.checked})}),t(`Record traces`,`记录运行追踪`)]}),(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Retention (days)`,`保留天数`),(0,v.jsx)(d,{className:y,type:`number`,min:1,max:90,value:C.local.retentionDays,onChange:e=>J(t=>{t.local.retentionDays=Number(e.target.value)})})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Storage budget (MiB)`,`存储上限(MiB)`),(0,v.jsx)(d,{className:y,type:`number`,min:16,max:4096,value:C.local.maxStoreMiB,onChange:e=>J(t=>{t.local.maxStoreMiB=Number(e.target.value)})})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Capture`,`采集内容`),(0,v.jsx)(s,{placeholder:t(`Choose`,`请选择`),allowEmpty:!1,value:C.capture,onChange:e=>J(t=>{t.capture=e}),options:[{value:`metadata`,label:t(`Metadata only`,`仅元数据`)},{value:`redacted`,label:t(`Redacted previews`,`脱敏摘要`)},{value:`detailed`,label:t(`Detailed · 30 minutes`,`详细记录 · 30 分钟`)}]})]})]}),(0,v.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Previews may contain personal content. Secrets and media are filtered; large values are truncated.`,`摘要可能包含个人内容。过滤凭证和媒体,超长内容会截断。`)}),C.detailedUntil&&(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Detailed capture expires: `,`详细采集截止:`),new Date(C.detailedUntil).toLocaleString()]}),(0,v.jsxs)(`details`,{children:[(0,v.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:t(`Advanced limits`,`高级限制`)}),(0,v.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[[`maxTraces`,t(`Trace count`,`Trace 条数`)],[`maxSpans`,t(`Span count`,`Span 条数`)],[`maxTraceKiB`,t(`Per trace (KiB)`,`单 Trace 上限(KiB)`)],[`maxWriteMiBPerMinute`,t(`Write budget (MiB/minute)`,`写入额度(MiB/分钟)`)]].map(([e,t])=>(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t,(0,v.jsx)(d,{type:`number`,min:1,className:y,value:C.local[e],onChange:t=>J(n=>{n.local[e]=Number(t.target.value)})})]},e))})]}),r.data?(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Disk / payload`,`磁盘 / 数据`),`:`,x(r.data.local.physicalBytes),` / `,x(r.data.local.bytes),` · `,r.data.local.traces??0,` traces · `,r.data.local.spans??0,` spans · `,t(`Dropped`,`丢弃`),` `,Number(r.data.local.dropped??0)+Number(r.data.local.queueDropped??0),(r.data.local.paused||r.data.local.unavailable)&&` · ${t(`Recording paused`,`存储暂停`)}`]}):(0,v.jsx)(c,{className:`h-10`}),(r.error||r.data?.local.lastError)&&(0,v.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,v.jsx)(`p`,{role:`alert`,children:r.data?.local.lastError?t(`Trace recording is unavailable.`,`追踪记录异常。`):t(`Unable to load recording status.`,`无法获取记录状态。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void r.mutate(),children:t(`Refresh recording status`,`刷新记录状态`)}),(0,v.jsxs)(`details`,{children:[(0,v.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:t(`Technical details`,`技术详情`)}),(0,v.jsx)(`p`,{className:`mt-2 break-words text-fg-muted`,children:r.data?.local.lastError||String(r.error?.message)})]})]}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{await _(`traces/prune`,`POST`)}),children:t(`Clean expired`,`清理过期记录`)}),(0,v.jsx)(u,{disabled:k,onClick:()=>W(!0),children:t(`Clear local traces`,`清空本地追踪`)})]})]}),(0,v.jsxs)(`section`,{className:b,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:`Langfuse`}),(0,v.jsx)(f,{status:Q.status,error:Q.error})]}),Q.error&&(0,v.jsx)(u,{variant:`ghost`,onClick:Q.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,v.jsx)(`input`,{type:`checkbox`,checked:C.langfuse.enabled,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.enabled=e.target.checked})}),t(`Also export new traces to Langfuse`,`同时导出新采集的追踪到 Langfuse`)]}),(0,v.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,v.jsxs)(`label`,{className:`space-y-1 text-sm sm:col-span-2`,children:[`Base URL`,(0,v.jsx)(`input`,{className:y,type:`url`,value:C.langfuse.baseUrl,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.baseUrl=e.target.value})})]}),[`publicKey`,`secretKey`].map(e=>{let r=e===`publicKey`?`Public Key`:`Secret Key`,i=e===`publicKey`?w:E,ee=n.data?.credentials[e===`publicKey`?`publicKeyConfigured`:`secretKeyConfigured`];return(0,v.jsxs)(`div`,{className:`space-y-1 text-sm`,onBlurCapture:Q.onBlurCapture,children:[(0,v.jsx)(`label`,{htmlFor:`langfuse-${e}`,children:r}),(0,v.jsx)(se,{id:`langfuse-${e}`,value:i||(ee?`••••••••••••`:``),allowUnrevealedCopy:!0,onChange:t=>(e===`publicKey`?T:D)(t.replace(/^•+/,``)),placeholder:e===`publicKey`?`pk-lf-…`:`sk-lf-…`,labels:{show:t(`Show ${r}`,`查看 ${r}`),hide:t(`Hide ${r}`,`隐藏 ${r}`),copy:t(`Copy ${r}`,`复制 ${r}`),copied:t(`Copied`,`已复制`)},reveal:()=>_(`tracing/langfuse/credentials/${e}/reveal`,`POST`).then(e=>e.key),loadFailedLabel:t(`Unable to load the configured key.`,`无法读取已配置的 Key。`),notInConfigFile:t(`No configured key is available.`,`暂无已配置的 Key。`)},me)]},e)})]}),(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Credential sources`,`凭证来源`),`:`,n.data?.credentials.publicKeySource,` / `,n.data?.credentials.secretKeySource,` · URL: `,n.data?.credentials.baseUrlSource]}),r.data&&(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[r.data.langfuse.state,` · `,t(`Pending`,`待发送`),` `,r.data.langfuse.pending,` · `,t(`Dropped`,`丢弃`),` `,r.data.langfuse.dropped,r.data.langfuse.lastSuccess?` · ${new Date(r.data.langfuse.lastSuccess).toLocaleString()}`:``]}),r.data?.langfuse.lastError&&(0,v.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,v.jsx)(`p`,{role:`alert`,children:t(`Unable to export traces.`,`无法导出追踪。`)}),(0,v.jsxs)(`details`,{children:[(0,v.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:t(`Technical details`,`技术详情`)}),(0,v.jsx)(`p`,{className:`mt-2 break-words text-fg-muted`,children:r.data.langfuse.lastError})]})]}),(0,v.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Changes save automatically. Historical traces are not uploaded. Offline exports may be dropped.`,`修改后自动保存。不会上传历史记录;断网或队列满时可能丢弃远端导出。`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{if(!(await _(`tracing/langfuse/test`,`POST`)).ok)throw Error(t(`Connection test failed. Check saved configuration and credentials.`,`连接测试失败,请检查已保存的配置和凭证。`))},t(`Diagnostic trace accepted by the ingestion endpoint`,`采集端已接受诊断追踪`)),children:t(`Test connection`,`测试连接`)}),(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{await _(`tracing/langfuse/credentials`,`DELETE`),T(``),D(``),O(e=>e+1)}),children:t(`Remove saved credentials`,`移除已保存凭证`)})]})]})]}):(0,v.jsx)(S,{})),P===`records`&&(0,v.jsxs)(`section`,{className:b,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:t(`Recent runs`,`最近执行`)}),(0,v.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Status`,`执行状态`),(0,v.jsx)(s,{placeholder:t(`All statuses`,`全部状态`),allowEmpty:!1,value:j,onChange:e=>{ye(e),U()},options:[{value:``,label:t(`All statuses`,`全部状态`)},...[`running`,`success`,`error`,`cancelled`,`suspended`,`interrupted`].map(e=>({value:e,label:t(e,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[e])}))]})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Time range`,`时间范围`),(0,v.jsx)(s,{placeholder:t(`Choose`,`请选择`),value:M,allowEmpty:!1,onChange:e=>{be(e),U()},options:[`1`,`7`,`30`,`90`].map(e=>({value:e,label:`${e} ${t(`days`,`天`)}`}))})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Page size`,`每页条数`),(0,v.jsx)(s,{placeholder:t(`Choose`,`请选择`),value:I,allowEmpty:!1,onChange:e=>{Se(e),U()},options:[`10`,`20`].map(e=>({value:e,label:`${e} ${t(`records`,`条`)}`}))})]})]}),(0,v.jsxs)(`details`,{children:[(0,v.jsxs)(`summary`,{className:`cursor-pointer text-sm text-fg-muted`,children:[t(`Advanced filters`,`高级筛选`),Object.values(N).some(Boolean)?` · ${t(`Active`,`已启用`)}`:``]}),(0,v.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[`conversationId`,`runId`,`agentId`].map(e=>(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[{conversationId:t(`Conversation ID`,`会话 ID`),runId:t(`Run ID`,`执行 ID`),agentId:t(`Agent ID`,`Agent ID`)}[e],(0,v.jsx)(`input`,{"aria-label":e,placeholder:t(`Exact ID`,`输入完整 ID`),className:y,value:N[e],onChange:t=>{xe({...N,[e]:t.target.value}),U()}})]},e))})]}),(0,v.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,v.jsx)(`summary`,{className:`w-fit cursor-pointer rounded focus-visible:outline-accent`,children:t(`About costs`,`费用说明`)}),(0,v.jsxs)(`p`,{className:`mt-2 leading-5`,children:[t(`Amounts are shown in USD. Cloud charges use Credits receipts.`,`金额以美元显示,Cloud 扣费以 Credits 凭证为准。`),` `,(0,v.jsx)(`a`,{className:`text-accent-fg hover:underline`,href:`#/settings/usage`,children:t(`View usage`,`查看用量`)})]})]}),(0,v.jsxs)(`div`,{role:`region`,"aria-label":t(`Execution results`,`执行结果`),"aria-busy":K.isValidating,className:`h-[24rem] min-h-0 overflow-y-auto overscroll-contain rounded-lg border border-edge sm:h-[28rem]`,children:[K.error&&(0,v.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-4 text-sm`,children:[(0,v.jsx)(`p`,{children:t(`Unable to load execution records.`,`无法加载执行记录。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void K.mutate(),disabled:K.isValidating,children:t(`Retry loading records`,`重新加载记录`)})]}),!K.data&&!K.error?(0,v.jsx)(`div`,{className:`space-y-3 p-3`,children:[0,1,2,3,4].map(e=>(0,v.jsx)(c,{className:`h-16`},e))}):(0,v.jsxs)(`div`,{className:`divide-y divide-edge`,children:[K.data?.traces.length===0&&(0,v.jsx)(`p`,{className:`flex h-48 items-center justify-center px-4 text-sm text-fg-muted`,children:t(`No traces in this range`,`此时间范围内暂无记录`)}),K.data?.traces.map(n=>(0,v.jsxs)(`button`,{onClick:()=>H(n.traceId),className:`flex w-full flex-col gap-2 px-3 py-3 text-left text-sm hover:bg-surface-hover sm:flex-row sm:items-center sm:justify-between`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`p`,{className:`truncate font-medium`,children:[n.name,n.attributes[`xopc.agentId`]?` · ${n.attributes[`xopc.agentId`]}`:``]}),(0,v.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[new Date(n.startedAt).toLocaleString(e?`zh-CN`:`en-US`),` · `,n.traceId]}),n.stats&&(0,v.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n.stats.generations,` `,t(`model calls`,`次模型调用`),` · `,n.stats.tokens,` tokens · `,n.stats.unknownCostCalls>0?`${t(`Cost pending`,`费用待确认`)}${n.stats.knownCostUsd>0?` · ${t(`known portion`,`已知部分`)} ${n.stats.knownCostUsd.toFixed(4)}`:``}`:`$${n.stats.knownCostUsd.toFixed(4)}`]})]}),(0,v.jsxs)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:[t(n.status,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[n.status]??n.status),` · `,n.endedAt?`${Math.round(n.endedAt-n.startedAt)} ms`:`—`,n.partialReason?` · ${t(`Partial`,`部分记录`)}`:``]})]},n.traceId))]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(`p`,{"aria-live":`polite`,className:`text-xs text-fg-muted`,children:t(`Page ${R+1} · ${K.data?.traces.length??0} records`,`第 ${R+1} 页 · ${K.data?.traces.length??0} 条`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:R===0||K.isValidating,onClick:()=>z(e=>Math.max(0,e-1)),children:t(`Previous page`,`上一页`)}),(0,v.jsx)(u,{disabled:!K.data?.nextCursor||K.isValidating,onClick:()=>{let e=K.data?.nextCursor;e&&(L(t=>[...t.slice(0,R+1),e]),z(e=>e+1))},children:t(`Next page`,`下一页`)})]})]})]}),(0,v.jsx)(oe,{open:!!V,onOpenChange:e=>{e||H(void 0)},children:(0,v.jsxs)(re,{children:[(0,v.jsx)(te,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,v.jsxs)(ie,{className:`fixed left-1/2 top-1/2 z-[91] flex h-[min(44rem,calc(100vh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-4`,children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,v.jsx)(ae,{className:`font-medium`,children:t(`Trace details`,`追踪详情`)}),(0,v.jsx)(o,{asChild:!0,children:(0,v.jsx)(u,{children:t(`Close`,`关闭`)})})]}),(0,v.jsx)(ne,{className:`shrink-0 truncate text-xs text-fg-muted`,children:V}),(0,v.jsx)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-4`,children:q.error?(0,v.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[(0,v.jsx)(`p`,{children:t(`Unable to load this record.`,`无法加载此记录。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void q.mutate(),children:t(`Retry loading record`,`重新加载此记录`)})]}):q.data?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`p`,{className:`text-sm`,children:[q.data.trace.status,` `,q.data.trace.partialReason&&` · ${q.data.trace.partialReason}`]}),fe(q.data.spans).map(e=>(0,v.jsxs)(`details`,{style:{marginLeft:de(e,q.data.spans)*12},className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,v.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.name,` · `,e.status,` · `,e.endedAt?`${Math.round(e.endedAt-e.startedAt)} ms`:`—`]}),(0,v.jsx)(`pre`,{className:`mt-3 whitespace-pre-wrap break-all text-xs text-fg-muted`,children:JSON.stringify(e.attributes,null,2)})]},e.spanId))]}):(0,v.jsx)(S,{})}),(0,v.jsx)(`div`,{className:`shrink-0 border-t border-edge pt-3`,children:(0,v.jsx)(u,{disabled:!q.data||k,onClick:()=>void Oe(),children:t(`Export JSON`,`导出 JSON`)})})]})]})}),(0,v.jsx)(oe,{open:Ee,onOpenChange:W,children:(0,v.jsxs)(re,{children:[(0,v.jsx)(te,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,v.jsxs)(ie,{className:`fixed left-1/2 top-1/2 z-[91] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 space-y-4 rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,v.jsx)(ae,{children:t(`Clear local traces?`,`清空本地追踪?`)}),(0,v.jsx)(ne,{className:`text-sm text-fg-muted`,children:t(`Removes retained local traces. Conversations, usage records and Langfuse data remain available.`,`删除已保留的本地追踪。会话、用量记录及 Langfuse 数据仍保留。`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{await _(`traces`,`DELETE`),W(!1),H(void 0)}),children:t(`Clear`,`清空`)}),(0,v.jsx)(o,{asChild:!0,children:(0,v.jsx)(u,{children:t(`Cancel`,`取消`)})})]})]})]})})]})}export{pe as TracingSettingsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as ee,o as a}from"./locale-store-CAZaC05J.js";import{a as te,i as ne,n as o,o as re,r as ie,s as ae,t as oe}from"./dist-BGTk37IG.js";import{t as s}from"./popover-select-CEMWIrtY.js";import{t as se}from"./secret-input-Dryrns2s.js";import{t as c}from"./skeleton-BI5TyibZ.js";import{i as l}from"./vendor-swr-CdRzEUwF.js";import{t as u}from"./button-Cc4hUNTt.js";import{t as ce}from"./sliding-tab-list-DuQyViqe.js";import{t as d}from"./number-input-El7Szeln.js";import{n as le,t as ue}from"./settings-page-header-LuOJvqNa.js";import"./settings-page-layout-CduQ8w4a.js";import{n as f,t as p}from"./use-autosave-BVYS8UoK.js";var m=e(t(),1),h=n(),g=e=>i(`/api/observability/${e}`);async function _(e,t=`GET`,n){return a(g(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}})}var v=r(),y=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,b=`space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,x=(e=0)=>`${(e/1048576).toFixed(1)} MiB`;function S(){let e=(0,h.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,v.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-4`,children:[(0,v.jsx)(c,{className:`h-48 rounded-xl`}),(0,v.jsx)(c,{className:`h-64 rounded-xl`})]}),e[0]=t):t=e[0],t}function de(e,t){let n=0,r=e,i=new Set;for(;r.parentSpanId&&n<12&&!i.has(r.spanId);){i.add(r.spanId);let e=t.find(e=>e.spanId===r.parentSpanId);if(!e)break;r=e,n++}return n}function fe(e){let t=[],n=new Set;function r(i){n.has(i.spanId)||(n.add(i.spanId),t.push(i),e.filter(e=>e.parentSpanId===i.spanId).forEach(r))}return e.filter(t=>!t.parentSpanId||!e.some(e=>e.spanId===t.parentSpanId)).forEach(r),e.forEach(r),t}function pe(){let e=ee(e=>e.language)===`zh`,t=(t,n)=>e?n:t,n=l(g(`tracing/settings`),()=>_(`tracing/settings`)),r=l(g(`tracing/status`),()=>_(`tracing/status`),{refreshInterval:1e4}),[i,a]=(0,m.useState)(),[h,pe]=(0,m.useState)(),C=i??h??n.data?.config,[w,T]=(0,m.useState)(``),[E,D]=(0,m.useState)(``),[me,O]=(0,m.useState)(0),[k,he]=(0,m.useState)(!1),[ge,A]=(0,m.useState)(``),[_e,ve]=(0,m.useState)(!1),[j,ye]=(0,m.useState)(``),[M,be]=(0,m.useState)(`7`),[N,xe]=(0,m.useState)({conversationId:``,runId:``,agentId:``}),[P,F]=(0,m.useState)(`records`),[I,Se]=(0,m.useState)(`10`),[Ce,L]=(0,m.useState)([``]),[R,z]=(0,m.useState)(0),[we,Te]=(0,m.useState)(()=>Date.now()+1),B=Ce[R],[V,H]=(0,m.useState)();function U(){L([``]),z(0),Te(Date.now()+1)}let[Ee,W]=(0,m.useState)(!1),G=new URLSearchParams({limit:I,from:String(we-Number(M)*864e5),to:String(we)});j&&G.set(`status`,j),B&&G.set(`cursor`,B);for(let[e,t]of Object.entries(N))t&&G.set(e,t);let De=`traces?${G}`,K=l(g(De),()=>_(De),{refreshInterval:B?0:1e4}),q=l(V?g(`traces/${V}`):null,()=>_(`traces/${V}`));function J(e){if(!C)return;let t=structuredClone(C);e(t),a(t)}async function Y(e,i=t(`Saved`,`已保存`)){he(!0),A(``),ve(!1);try{await e(),A(i),await Promise.all([n.mutate(),r.mutate(),K.mutate()])}catch(e){ve(!0),A(e instanceof Error?e.message:t(`Request failed`,`操作失败`))}finally{he(!1)}}let X=p({value:C??null,dirty:!!(i&&JSON.stringify(i)!==JSON.stringify(h??n.data?.config)),validate:e=>{if([[`retentionDays`,1,90],[`maxStoreMiB`,16,4096],[`maxTraces`,10,1e5],[`maxSpans`,100,1e6],[`maxTraceKiB`,16,4096],[`maxWriteMiBPerMinute`,1,100]].some(([t,n,r])=>!Number.isInteger(e.local[t])||e.local[t]<n||e.local[t]>r))return t(`Enter valid storage limits before continuing.`,`请填写有效的存储限额。`);try{let t=new URL(e.langfuse.baseUrl);if(![`http:`,`https:`].includes(t.protocol)||e.langfuse.baseUrl.length>2048)throw Error()}catch{return t(`Enter a valid HTTP(S) Base URL.`,`请填写有效的 HTTP(S) Base URL。`)}return null},onSave:async e=>{let t=await _(`tracing/settings`,`PATCH`,e);pe(t.config),a(t=>t&&JSON.stringify(t)===JSON.stringify(e)?void 0:t),await r.mutate().catch(()=>{})}}),Z=(0,m.useMemo)(()=>({publicKey:w.trim(),secretKey:E.trim()}),[w,E]),Q=p({value:Z,dirty:!!(Z.publicKey||Z.secretKey),delayMs:1e3,validate:e=>e.publicKey.length>512||e.secretKey.length>512?t(`Credentials must be at most 512 characters.`,`凭证长度不能超过 512 个字符。`):null,onSave:async e=>{await _(`tracing/langfuse/credentials`,`PUT`,{...e.publicKey?{publicKey:e.publicKey}:{},...e.secretKey?{secretKey:e.secretKey}:{}}),T(t=>t.trim()===e.publicKey?``:t),D(t=>t.trim()===e.secretKey?``:t),O(e=>e+1),await Promise.allSettled([n.mutate(),r.mutate()])}}),$=[X.status,Q.status].some(e=>e===`dirty`||e===`saving`);async function Oe(){V&&await Y(async()=>{let e=await _(`traces/${V}/export`),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`trace-${V}.json`,n.click(),URL.revokeObjectURL(t)},t(`Exported`,`已导出`))}return(0,v.jsxs)(le,{className:`space-y-6`,children:[(0,v.jsx)(ue,{title:t(`Runtime tracing`,`运行追踪`),subtitle:t(`Local diagnostics with bounded retention. Enable Langfuse to also export new traces.`,`默认保留有界本地记录;启用 Langfuse 后同时导出新采集的追踪。`),actions:P===`settings`?(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,v.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t(`Changes save automatically`,`修改后自动保存`)}),(0,v.jsx)(f,{status:X.status,error:X.error})]}):(0,v.jsx)(u,{disabled:K.isValidating,onClick:U,children:t(`Refresh records`,`刷新记录`)})}),ge&&(0,v.jsx)(`p`,{role:_e?`alert`:`status`,className:`text-sm text-fg-muted`,children:ge}),n.error&&(0,v.jsxs)(`div`,{role:`alert`,className:b,children:[(0,v.jsx)(`p`,{children:t(`Unable to load tracing settings.`,`无法加载追踪设置。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void n.mutate(),children:t(`Retry loading settings`,`重新加载设置`)})]}),(0,v.jsxs)(ce,{as:`nav`,"aria-label":t(`Tracing sections`,`追踪页面分区`),className:`flex gap-2 border-b border-edge pb-3`,children:[(0,v.jsx)(u,{"aria-pressed":P===`records`,variant:`ghost`,onClick:()=>F(`records`),children:t(`Execution records`,`执行记录`)}),(0,v.jsx)(u,{"aria-pressed":P===`settings`,variant:`ghost`,onClick:()=>F(`settings`),children:t(`Capture settings`,`采集设置`)})]}),P===`settings`&&(C?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`section`,{className:b,onBlurCapture:X.onBlurCapture,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:t(`Local recording`,`本地记录`)}),X.error&&(0,v.jsx)(u,{variant:`ghost`,onClick:X.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,v.jsx)(`input`,{type:`checkbox`,checked:C.enabled,onChange:e=>J(t=>{t.enabled=e.target.checked})}),t(`Record traces`,`记录运行追踪`)]}),(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Retention (days)`,`保留天数`),(0,v.jsx)(d,{className:y,type:`number`,min:1,max:90,value:C.local.retentionDays,onChange:e=>J(t=>{t.local.retentionDays=Number(e.target.value)})})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Storage budget (MiB)`,`存储上限(MiB)`),(0,v.jsx)(d,{className:y,type:`number`,min:16,max:4096,value:C.local.maxStoreMiB,onChange:e=>J(t=>{t.local.maxStoreMiB=Number(e.target.value)})})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Capture`,`采集内容`),(0,v.jsx)(s,{placeholder:t(`Choose`,`请选择`),allowEmpty:!1,value:C.capture,onChange:e=>J(t=>{t.capture=e}),options:[{value:`metadata`,label:t(`Metadata only`,`仅元数据`)},{value:`redacted`,label:t(`Redacted previews`,`脱敏摘要`)},{value:`detailed`,label:t(`Detailed · 30 minutes`,`详细记录 · 30 分钟`)}]})]})]}),(0,v.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Previews may contain personal content. Secrets and media are filtered; large values are truncated.`,`摘要可能包含个人内容。过滤凭证和媒体,超长内容会截断。`)}),C.detailedUntil&&(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Detailed capture expires: `,`详细采集截止:`),new Date(C.detailedUntil).toLocaleString()]}),(0,v.jsxs)(`details`,{children:[(0,v.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:t(`Advanced limits`,`高级限制`)}),(0,v.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[[`maxTraces`,t(`Trace count`,`Trace 条数`)],[`maxSpans`,t(`Span count`,`Span 条数`)],[`maxTraceKiB`,t(`Per trace (KiB)`,`单 Trace 上限(KiB)`)],[`maxWriteMiBPerMinute`,t(`Write budget (MiB/minute)`,`写入额度(MiB/分钟)`)]].map(([e,t])=>(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t,(0,v.jsx)(d,{type:`number`,min:1,className:y,value:C.local[e],onChange:t=>J(n=>{n.local[e]=Number(t.target.value)})})]},e))})]}),r.data?(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Disk / payload`,`磁盘 / 数据`),`:`,x(r.data.local.physicalBytes),` / `,x(r.data.local.bytes),` · `,r.data.local.traces??0,` traces · `,r.data.local.spans??0,` spans · `,t(`Dropped`,`丢弃`),` `,Number(r.data.local.dropped??0)+Number(r.data.local.queueDropped??0),(r.data.local.paused||r.data.local.unavailable)&&` · ${t(`Recording paused`,`存储暂停`)}`]}):(0,v.jsx)(c,{className:`h-10`}),(r.error||r.data?.local.lastError)&&(0,v.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,v.jsx)(`p`,{role:`alert`,children:r.data?.local.lastError?t(`Trace recording is unavailable.`,`追踪记录异常。`):t(`Unable to load recording status.`,`无法获取记录状态。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void r.mutate(),children:t(`Refresh recording status`,`刷新记录状态`)}),(0,v.jsxs)(`details`,{children:[(0,v.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:t(`Technical details`,`技术详情`)}),(0,v.jsx)(`p`,{className:`mt-2 break-words text-fg-muted`,children:r.data?.local.lastError||String(r.error?.message)})]})]}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{await _(`traces/prune`,`POST`)}),children:t(`Clean expired`,`清理过期记录`)}),(0,v.jsx)(u,{disabled:k,onClick:()=>W(!0),children:t(`Clear local traces`,`清空本地追踪`)})]})]}),(0,v.jsxs)(`section`,{className:b,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:`Langfuse`}),(0,v.jsx)(f,{status:Q.status,error:Q.error})]}),Q.error&&(0,v.jsx)(u,{variant:`ghost`,onClick:Q.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,v.jsx)(`input`,{type:`checkbox`,checked:C.langfuse.enabled,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.enabled=e.target.checked})}),t(`Also export new traces to Langfuse`,`同时导出新采集的追踪到 Langfuse`)]}),(0,v.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,v.jsxs)(`label`,{className:`space-y-1 text-sm sm:col-span-2`,children:[`Base URL`,(0,v.jsx)(`input`,{className:y,type:`url`,value:C.langfuse.baseUrl,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.baseUrl=e.target.value})})]}),[`publicKey`,`secretKey`].map(e=>{let r=e===`publicKey`?`Public Key`:`Secret Key`,i=e===`publicKey`?w:E,ee=n.data?.credentials[e===`publicKey`?`publicKeyConfigured`:`secretKeyConfigured`];return(0,v.jsxs)(`div`,{className:`space-y-1 text-sm`,onBlurCapture:Q.onBlurCapture,children:[(0,v.jsx)(`label`,{htmlFor:`langfuse-${e}`,children:r}),(0,v.jsx)(se,{id:`langfuse-${e}`,value:i||(ee?`••••••••••••`:``),allowUnrevealedCopy:!0,onChange:t=>(e===`publicKey`?T:D)(t.replace(/^•+/,``)),placeholder:e===`publicKey`?`pk-lf-…`:`sk-lf-…`,labels:{show:t(`Show ${r}`,`查看 ${r}`),hide:t(`Hide ${r}`,`隐藏 ${r}`),copy:t(`Copy ${r}`,`复制 ${r}`),copied:t(`Copied`,`已复制`)},reveal:()=>_(`tracing/langfuse/credentials/${e}/reveal`,`POST`).then(e=>e.key),loadFailedLabel:t(`Unable to load the configured key.`,`无法读取已配置的 Key。`),notInConfigFile:t(`No configured key is available.`,`暂无已配置的 Key。`)},me)]},e)})]}),(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Credential sources`,`凭证来源`),`:`,n.data?.credentials.publicKeySource,` / `,n.data?.credentials.secretKeySource,` · URL: `,n.data?.credentials.baseUrlSource]}),r.data&&(0,v.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[r.data.langfuse.state,` · `,t(`Pending`,`待发送`),` `,r.data.langfuse.pending,` · `,t(`Dropped`,`丢弃`),` `,r.data.langfuse.dropped,r.data.langfuse.lastSuccess?` · ${new Date(r.data.langfuse.lastSuccess).toLocaleString()}`:``]}),r.data?.langfuse.lastError&&(0,v.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,v.jsx)(`p`,{role:`alert`,children:t(`Unable to export traces.`,`无法导出追踪。`)}),(0,v.jsxs)(`details`,{children:[(0,v.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:t(`Technical details`,`技术详情`)}),(0,v.jsx)(`p`,{className:`mt-2 break-words text-fg-muted`,children:r.data.langfuse.lastError})]})]}),(0,v.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Changes save automatically. Historical traces are not uploaded. Offline exports may be dropped.`,`修改后自动保存。不会上传历史记录;断网或队列满时可能丢弃远端导出。`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{if(!(await _(`tracing/langfuse/test`,`POST`)).ok)throw Error(t(`Connection test failed. Check saved configuration and credentials.`,`连接测试失败,请检查已保存的配置和凭证。`))},t(`Diagnostic trace accepted by the ingestion endpoint`,`采集端已接受诊断追踪`)),children:t(`Test connection`,`测试连接`)}),(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{await _(`tracing/langfuse/credentials`,`DELETE`),T(``),D(``),O(e=>e+1)}),children:t(`Remove saved credentials`,`移除已保存凭证`)})]})]})]}):(0,v.jsx)(S,{})),P===`records`&&(0,v.jsxs)(`section`,{className:b,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:t(`Recent runs`,`最近执行`)}),(0,v.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Status`,`执行状态`),(0,v.jsx)(s,{placeholder:t(`All statuses`,`全部状态`),allowEmpty:!1,value:j,onChange:e=>{ye(e),U()},options:[{value:``,label:t(`All statuses`,`全部状态`)},...[`running`,`success`,`error`,`cancelled`,`suspended`,`interrupted`].map(e=>({value:e,label:t(e,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[e])}))]})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Time range`,`时间范围`),(0,v.jsx)(s,{placeholder:t(`Choose`,`请选择`),value:M,allowEmpty:!1,onChange:e=>{be(e),U()},options:[`1`,`7`,`30`,`90`].map(e=>({value:e,label:`${e} ${t(`days`,`天`)}`}))})]}),(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Page size`,`每页条数`),(0,v.jsx)(s,{placeholder:t(`Choose`,`请选择`),value:I,allowEmpty:!1,onChange:e=>{Se(e),U()},options:[`10`,`20`].map(e=>({value:e,label:`${e} ${t(`records`,`条`)}`}))})]})]}),(0,v.jsxs)(`details`,{children:[(0,v.jsxs)(`summary`,{className:`cursor-pointer text-sm text-fg-muted`,children:[t(`Advanced filters`,`高级筛选`),Object.values(N).some(Boolean)?` · ${t(`Active`,`已启用`)}`:``]}),(0,v.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[`conversationId`,`runId`,`agentId`].map(e=>(0,v.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[{conversationId:t(`Conversation ID`,`会话 ID`),runId:t(`Run ID`,`执行 ID`),agentId:t(`Agent ID`,`Agent ID`)}[e],(0,v.jsx)(`input`,{"aria-label":e,placeholder:t(`Exact ID`,`输入完整 ID`),className:y,value:N[e],onChange:t=>{xe({...N,[e]:t.target.value}),U()}})]},e))})]}),(0,v.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,v.jsx)(`summary`,{className:`w-fit cursor-pointer rounded focus-visible:outline-accent`,children:t(`About costs`,`费用说明`)}),(0,v.jsxs)(`p`,{className:`mt-2 leading-5`,children:[t(`Amounts are shown in USD. Cloud charges use Credits receipts.`,`金额以美元显示,Cloud 扣费以 Credits 凭证为准。`),` `,(0,v.jsx)(`a`,{className:`text-accent-fg hover:underline`,href:`#/settings/usage`,children:t(`View usage`,`查看用量`)})]})]}),(0,v.jsxs)(`div`,{role:`region`,"aria-label":t(`Execution results`,`执行结果`),"aria-busy":K.isValidating,className:`h-[24rem] min-h-0 overflow-y-auto overscroll-contain rounded-lg border border-edge sm:h-[28rem]`,children:[K.error&&(0,v.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-4 text-sm`,children:[(0,v.jsx)(`p`,{children:t(`Unable to load execution records.`,`无法加载执行记录。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void K.mutate(),disabled:K.isValidating,children:t(`Retry loading records`,`重新加载记录`)})]}),!K.data&&!K.error?(0,v.jsx)(`div`,{className:`space-y-3 p-3`,children:[0,1,2,3,4].map(e=>(0,v.jsx)(c,{className:`h-16`},e))}):(0,v.jsxs)(`div`,{className:`divide-y divide-edge`,children:[K.data?.traces.length===0&&(0,v.jsx)(`p`,{className:`flex h-48 items-center justify-center px-4 text-sm text-fg-muted`,children:t(`No traces in this range`,`此时间范围内暂无记录`)}),K.data?.traces.map(n=>(0,v.jsxs)(`button`,{onClick:()=>H(n.traceId),className:`flex w-full flex-col gap-2 px-3 py-3 text-left text-sm hover:bg-surface-hover sm:flex-row sm:items-center sm:justify-between`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`p`,{className:`truncate font-medium`,children:[n.name,n.attributes[`xopc.agentId`]?` · ${n.attributes[`xopc.agentId`]}`:``]}),(0,v.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[new Date(n.startedAt).toLocaleString(e?`zh-CN`:`en-US`),` · `,n.traceId]}),n.stats&&(0,v.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n.stats.generations,` `,t(`model calls`,`次模型调用`),` · `,n.stats.tokens,` tokens · `,n.stats.unknownCostCalls>0?`${t(`Cost pending`,`费用待确认`)}${n.stats.knownCostUsd>0?` · ${t(`known portion`,`已知部分`)} ${n.stats.knownCostUsd.toFixed(4)}`:``}`:`$${n.stats.knownCostUsd.toFixed(4)}`]})]}),(0,v.jsxs)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:[t(n.status,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[n.status]??n.status),` · `,n.endedAt?`${Math.round(n.endedAt-n.startedAt)} ms`:`—`,n.partialReason?` · ${t(`Partial`,`部分记录`)}`:``]})]},n.traceId))]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(`p`,{"aria-live":`polite`,className:`text-xs text-fg-muted`,children:t(`Page ${R+1} · ${K.data?.traces.length??0} records`,`第 ${R+1} 页 · ${K.data?.traces.length??0} 条`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:R===0||K.isValidating,onClick:()=>z(e=>Math.max(0,e-1)),children:t(`Previous page`,`上一页`)}),(0,v.jsx)(u,{disabled:!K.data?.nextCursor||K.isValidating,onClick:()=>{let e=K.data?.nextCursor;e&&(L(t=>[...t.slice(0,R+1),e]),z(e=>e+1))},children:t(`Next page`,`下一页`)})]})]})]}),(0,v.jsx)(oe,{open:!!V,onOpenChange:e=>{e||H(void 0)},children:(0,v.jsxs)(re,{children:[(0,v.jsx)(te,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,v.jsxs)(ie,{className:`fixed left-1/2 top-1/2 z-[91] flex h-[min(44rem,calc(100vh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-4`,children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,v.jsx)(ae,{className:`font-medium`,children:t(`Trace details`,`追踪详情`)}),(0,v.jsx)(o,{asChild:!0,children:(0,v.jsx)(u,{children:t(`Close`,`关闭`)})})]}),(0,v.jsx)(ne,{className:`shrink-0 truncate text-xs text-fg-muted`,children:V}),(0,v.jsx)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-4`,children:q.error?(0,v.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[(0,v.jsx)(`p`,{children:t(`Unable to load this record.`,`无法加载此记录。`)}),(0,v.jsx)(u,{variant:`ghost`,onClick:()=>void q.mutate(),children:t(`Retry loading record`,`重新加载此记录`)})]}):q.data?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`p`,{className:`text-sm`,children:[q.data.trace.status,` `,q.data.trace.partialReason&&` · ${q.data.trace.partialReason}`]}),fe(q.data.spans).map(e=>(0,v.jsxs)(`details`,{style:{marginLeft:de(e,q.data.spans)*12},className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,v.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.name,` · `,e.status,` · `,e.endedAt?`${Math.round(e.endedAt-e.startedAt)} ms`:`—`]}),(0,v.jsx)(`pre`,{className:`mt-3 whitespace-pre-wrap break-all text-xs text-fg-muted`,children:JSON.stringify(e.attributes,null,2)})]},e.spanId))]}):(0,v.jsx)(S,{})}),(0,v.jsx)(`div`,{className:`shrink-0 border-t border-edge pt-3`,children:(0,v.jsx)(u,{disabled:!q.data||k,onClick:()=>void Oe(),children:t(`Export JSON`,`导出 JSON`)})})]})]})}),(0,v.jsx)(oe,{open:Ee,onOpenChange:W,children:(0,v.jsxs)(re,{children:[(0,v.jsx)(te,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,v.jsxs)(ie,{className:`fixed left-1/2 top-1/2 z-[91] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 space-y-4 rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,v.jsx)(ae,{children:t(`Clear local traces?`,`清空本地追踪?`)}),(0,v.jsx)(ne,{className:`text-sm text-fg-muted`,children:t(`Removes retained local traces. Conversations, usage records and Langfuse data remain available.`,`删除已保留的本地追踪。会话、用量记录及 Langfuse 数据仍保留。`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(u,{disabled:k||$,onClick:()=>void Y(async()=>{await _(`traces`,`DELETE`),W(!1),H(void 0)}),children:t(`Clear`,`清空`)}),(0,v.jsx)(o,{asChild:!0,children:(0,v.jsx)(u,{children:t(`Cancel`,`取消`)})})]})]})]})})]})}export{pe as TracingSettingsPage};
|
|
@@ -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{a as i,i as a,l as o,n as s,o as c}from"./locale-store-B6OrWgY1.js";import{t as l}from"./messages-jwdBhfL9.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as ee}from"./globe-DSSGFWFn.js";import{t as te}from"./loader-circle-CifKLtgG.js";import{t as d}from"./power-ZI-pBczI.js";import{t as f}from"./cn-0WouolD0.js";import{t as p}from"./skeleton-BI5TyibZ.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{n as h,r as g}from"./gateway-config-swr-D6cc6W6E.js";import{t as _}from"./button-Cc4hUNTt.js";import{s as v}from"./form-field-width-DJw_jULe.js";import{u as y}from"./navigation-D62kPsA9.js";import{t as b}from"./copy-text-row-CpiRzq4G.js";import{n as ne,t as re}from"./settings-form-section-num14vSv.js";var x=e(t(),1),S=n(),C=r();function w(e){let t=(0,S.c)(10),{language:n,label:r,section:i,className:a}=e,o;t[0]!==n||t[1]!==i?(o=y(n,i),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=f(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,a),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==r||t[7]!==o||t[8]!==s?(l=(0,C.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:s,children:[r,c]}),t[6]=r,t[7]=o,t[8]=s,t[9]=l):l=t[9],l}async function T(){let e=await i(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function E(e=`serve`){let t=await i(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function D(){let e=await i(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var O=`https://tailscale.com/download`;function k(e){let t=(0,S.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function A({embedded:e=!1}){let t=s(e=>e.language),n=l(t).remoteAccess.tailscale,r=(0,x.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:l(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!o(e=>e.conversationId),[a,c]=(0,x.useState)(!1),[u,f]=(0,x.useState)(null),{data:h,mutate:g,isLoading:v}=m(i?`exposure-status`:null,T,{refreshInterval:3e4}),y=h?.tailscale.hostname,S=h?.tailscale.active===!0,O=h?.tailscale.cliAvailable!==!1,A=y?`https://${y}/`:null,ie=(0,x.useCallback)(async()=>{c(!0),f(null);try{await E(`serve`),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[g]),ae=(0,x.useCallback)(async()=>{c(!0),f(null);try{await D(),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[g]);if(!i)return null;let j=(0,C.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,C.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,C.jsxs)(`span`,{children:[n.stepInstallBefore,(0,C.jsx)(k,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,C.jsx)(`span`,{children:n.stepEnable})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,C.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&h?.tailscale.cliAvailable===!1?(0,C.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,C.jsx)(k,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,v&&!h?(0,C.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,C.jsx)(p,{className:`h-20 rounded-lg`}),(0,C.jsx)(p,{className:`h-20 rounded-lg`})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(re,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),A?(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(b,{text:A,labels:r})}):null,u?(0,C.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,C.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void ae(),children:[a?(0,C.jsx)(te,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,C.jsxs)(_,{type:`button`,disabled:a||!O,onClick:()=>void ie(),children:[a?(0,C.jsx)(te,{className:`mr-1 size-4 animate-spin`}):(0,C.jsx)(d,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,C.jsx)(w,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?j:(0,C.jsxs)(re,{children:[(0,C.jsx)(ne,{icon:ee,title:n.title,subtitle:n.subtitle}),j]})}async function ie(e){let t=await i(a(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ae(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function j(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function oe(){return(0,x.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||j(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function se(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,v,`dark:border-edge`)}function ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function M(){let e=(0,S.c)(85),t=s(ue),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!o(le),a=oe(),c=g(i).data?.payload?.config,u;e[2]===c?u=e[3]:(u=ce(c),e[2]=c,e[3]=u);let d=u,[p,m]=(0,x.useState)(``),v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={busy:!1,result:null},e[4]=v):v=e[4];let[y,b]=(0,x.useState)(v),w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w={busy:!1,error:null},e[5]=w):w=e[5];let[T,E]=(0,x.useState)(w),D,O;e[6]!==d||e[7]!==a||e[8]!==p?(D=()=>{p||(d?m(d):a&&m(a))},O=[d,a,p],e[6]=d,e[7]=a,e[8]=p,e[9]=D,e[10]=O):(D=e[9],O=e[10]),(0,x.useEffect)(D,O);let k;bb0:{let t;e[11]===p?t=e[12]:(t=p.trim(),e[11]=p,e[12]=t);let n=t;if(n){k=n;break bb0}k=d??a??``}let A=k,j=!d&&!!a&&A===a,M;e[13]!==p||e[14]!==A?(M=async()=>{let e=p.trim()||A;if(e){b({busy:!0,result:null});try{let t=await ie(e);b({busy:!1,result:t})}catch(e){let t=e;b({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=p,e[14]=A,e[15]=M):M=e[15];let fe=M,N;e[16]===A?N=e[17]:(N=async()=>{let e=A.trim();if(e){E({busy:!0,error:null});try{await ae(e),await h(),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=A,e[17]=N);let pe=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{E({busy:!0,error:null});try{await ae(null),await h(),m(``),b({busy:!1,result:null}),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,C.jsx)(ne,{icon:ee,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,C.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=f(se(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{m(e.target.value),b({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==p||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,C.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:p,onChange:R}),e[26]=p,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===fe?B=e[31]:(B=()=>void fe(),e[30]=fe,e[31]=B);let V;e[32]!==p||e[33]!==y.busy?(V=y.busy||!p.trim(),e[32]=p,e[33]=y.busy,e[34]=V):V=e[34];let H;e[35]===y.busy?H=e[36]:(H=y.busy?(0,C.jsx)(te,{className:`size-3.5 animate-spin`}):null,e[35]=y.busy,e[36]=H);let he=y.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,C.jsxs)(_,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==a||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&a?(0,C.jsxs)(`div`,{className:`rounded-lg bg-accent-soft/60 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,C.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:a}),(0,C.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=a,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==y.result||e[53]!==r.probeStatus?(q=y.result?(0,C.jsx)(de,{result:y.result,labels:r.probeStatus}):null,e[52]=y.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==d||e[56]!==A||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==T.busy?(J=A&&d!==A?(0,C.jsxs)(_,{type:`button`,onClick:()=>void pe(),disabled:T.busy,children:[T.busy?(0,C.jsx)(te,{className:`size-3.5 animate-spin`}):null,T.busy?r.saving:r.saveAsDefault]}):null,e[55]=d,e[56]=A,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=T.busy,e[61]=J):J=e[61];let Y;e[62]!==d||e[63]!==r.clear||e[64]!==T.busy?(Y=d?(0,C.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:T.busy,children:r.clear}):null,e[62]=d,e[63]=r.clear,e[64]=T.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===T.error?Z=e[70]:(Z=T.error?(0,C.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:T.error}):null,e[69]=T.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,C.jsx)(`div`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,C.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,C.jsxs)(re,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function le(e){return e.conversationId}function ue(e){return e.language}function de(e){let t=(0,S.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,C.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,C.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,C.jsxs)(C.Fragment,{children:[` · `,(0,C.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,C.jsxs)(`div`,{className:`rounded-lg bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,C.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,C.jsxs)(C.Fragment,{children:[` — `,(0,C.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,C.jsxs)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-xs text-red-900 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function fe(){let e=await c(a(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function N(e){try{return{kind:`ready`,setup:(await c(a(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function pe(e){return c(a(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function P(e){await c(a(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function me(e,t){await c(a(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function F(){let e=await i(a(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var I=`https://console.xopc.ai/access/client`;function L(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.code;if(typeof n==`string`)return n;let r=t.error;if(!r||typeof r!=`object`)return;let i=r.code;return typeof i==`string`?i:void 0}function R(e){return L(e)===`TUNNEL_REGISTRATION_KEY_REJECTED`||e instanceof Error&&/\bTunnel register failed: 401\b/.test(e.message)}function z(e){return L(e)===`TUNNEL_RECOVERY_PROOF_REJECTED`||e instanceof Error&&e.message===`Active lease ownership proof required`}function B(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(L(e)??``)}async function V(){return c(a(`/api/tunnel/status`))}async function H(){await c(a(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function he(){await c(a(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function U(e){return c(a(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({recoverActiveLease:e?.recoverActiveLease===!0})})}async function W(e){return c(a(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function G(){let e=(await c(a(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function K(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{w as S,fe as _,H as a,A as b,W as c,z as d,R as f,F as g,me as h,he as i,L as l,N as m,V as n,G as o,P as p,K as r,U as s,I as t,B as u,pe as v,T as x,M as y};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,n as s,o as c}from"./locale-store-CAZaC05J.js";import{t as l}from"./messages-C7fckbyG.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as ee}from"./globe-DSSGFWFn.js";import{t as te}from"./loader-circle-CifKLtgG.js";import{t as d}from"./power-ZI-pBczI.js";import{t as f}from"./cn-0WouolD0.js";import{t as p}from"./skeleton-BI5TyibZ.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{n as h,r as g}from"./gateway-config-swr-Cq-ByXL4.js";import{t as _}from"./button-Cc4hUNTt.js";import{s as v}from"./form-field-width-DJw_jULe.js";import{u as y}from"./navigation-D62kPsA9.js";import{t as b}from"./copy-text-row-CpiRzq4G.js";import{n as ne,t as re}from"./settings-form-section-num14vSv.js";var x=e(t(),1),S=n(),C=r();function w(e){let t=(0,S.c)(10),{language:n,label:r,section:i,className:a}=e,o;t[0]!==n||t[1]!==i?(o=y(n,i),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=f(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,a),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==r||t[7]!==o||t[8]!==s?(l=(0,C.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:s,children:[r,c]}),t[6]=r,t[7]=o,t[8]=s,t[9]=l):l=t[9],l}async function T(){let e=await i(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function E(e=`serve`){let t=await i(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function D(){let e=await i(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var O=`https://tailscale.com/download`;function k(e){let t=(0,S.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function A({embedded:e=!1}){let t=s(e=>e.language),n=l(t).remoteAccess.tailscale,r=(0,x.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:l(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!o(e=>e.conversationId),[a,c]=(0,x.useState)(!1),[u,f]=(0,x.useState)(null),{data:h,mutate:g,isLoading:v}=m(i?`exposure-status`:null,T,{refreshInterval:3e4}),y=h?.tailscale.hostname,S=h?.tailscale.active===!0,O=h?.tailscale.cliAvailable!==!1,A=y?`https://${y}/`:null,ie=(0,x.useCallback)(async()=>{c(!0),f(null);try{await E(`serve`),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[g]),ae=(0,x.useCallback)(async()=>{c(!0),f(null);try{await D(),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[g]);if(!i)return null;let j=(0,C.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,C.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,C.jsxs)(`span`,{children:[n.stepInstallBefore,(0,C.jsx)(k,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,C.jsx)(`span`,{children:n.stepEnable})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,C.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&h?.tailscale.cliAvailable===!1?(0,C.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,C.jsx)(k,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,v&&!h?(0,C.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,C.jsx)(p,{className:`h-20 rounded-lg`}),(0,C.jsx)(p,{className:`h-20 rounded-lg`})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(re,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),A?(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(b,{text:A,labels:r})}):null,u?(0,C.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,C.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void ae(),children:[a?(0,C.jsx)(te,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,C.jsxs)(_,{type:`button`,disabled:a||!O,onClick:()=>void ie(),children:[a?(0,C.jsx)(te,{className:`mr-1 size-4 animate-spin`}):(0,C.jsx)(d,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,C.jsx)(w,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?j:(0,C.jsxs)(re,{children:[(0,C.jsx)(ne,{icon:ee,title:n.title,subtitle:n.subtitle}),j]})}async function ie(e){let t=await i(a(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ae(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function j(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function oe(){return(0,x.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||j(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function se(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,v,`dark:border-edge`)}function ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function M(){let e=(0,S.c)(85),t=s(ue),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!o(le),a=oe(),c=g(i).data?.payload?.config,u;e[2]===c?u=e[3]:(u=ce(c),e[2]=c,e[3]=u);let d=u,[p,m]=(0,x.useState)(``),v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={busy:!1,result:null},e[4]=v):v=e[4];let[y,b]=(0,x.useState)(v),w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w={busy:!1,error:null},e[5]=w):w=e[5];let[T,E]=(0,x.useState)(w),D,O;e[6]!==d||e[7]!==a||e[8]!==p?(D=()=>{p||(d?m(d):a&&m(a))},O=[d,a,p],e[6]=d,e[7]=a,e[8]=p,e[9]=D,e[10]=O):(D=e[9],O=e[10]),(0,x.useEffect)(D,O);let k;bb0:{let t;e[11]===p?t=e[12]:(t=p.trim(),e[11]=p,e[12]=t);let n=t;if(n){k=n;break bb0}k=d??a??``}let A=k,j=!d&&!!a&&A===a,M;e[13]!==p||e[14]!==A?(M=async()=>{let e=p.trim()||A;if(e){b({busy:!0,result:null});try{let t=await ie(e);b({busy:!1,result:t})}catch(e){let t=e;b({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=p,e[14]=A,e[15]=M):M=e[15];let fe=M,N;e[16]===A?N=e[17]:(N=async()=>{let e=A.trim();if(e){E({busy:!0,error:null});try{await ae(e),await h(),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=A,e[17]=N);let pe=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{E({busy:!0,error:null});try{await ae(null),await h(),m(``),b({busy:!1,result:null}),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,C.jsx)(ne,{icon:ee,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,C.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=f(se(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{m(e.target.value),b({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==p||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,C.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:p,onChange:R}),e[26]=p,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===fe?B=e[31]:(B=()=>void fe(),e[30]=fe,e[31]=B);let V;e[32]!==p||e[33]!==y.busy?(V=y.busy||!p.trim(),e[32]=p,e[33]=y.busy,e[34]=V):V=e[34];let H;e[35]===y.busy?H=e[36]:(H=y.busy?(0,C.jsx)(te,{className:`size-3.5 animate-spin`}):null,e[35]=y.busy,e[36]=H);let he=y.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,C.jsxs)(_,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==a||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&a?(0,C.jsxs)(`div`,{className:`rounded-lg bg-accent-soft/60 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,C.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:a}),(0,C.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=a,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==y.result||e[53]!==r.probeStatus?(q=y.result?(0,C.jsx)(de,{result:y.result,labels:r.probeStatus}):null,e[52]=y.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==d||e[56]!==A||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==T.busy?(J=A&&d!==A?(0,C.jsxs)(_,{type:`button`,onClick:()=>void pe(),disabled:T.busy,children:[T.busy?(0,C.jsx)(te,{className:`size-3.5 animate-spin`}):null,T.busy?r.saving:r.saveAsDefault]}):null,e[55]=d,e[56]=A,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=T.busy,e[61]=J):J=e[61];let Y;e[62]!==d||e[63]!==r.clear||e[64]!==T.busy?(Y=d?(0,C.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:T.busy,children:r.clear}):null,e[62]=d,e[63]=r.clear,e[64]=T.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===T.error?Z=e[70]:(Z=T.error?(0,C.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:T.error}):null,e[69]=T.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,C.jsx)(`div`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,C.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,C.jsxs)(re,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function le(e){return e.conversationId}function ue(e){return e.language}function de(e){let t=(0,S.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,C.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,C.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,C.jsxs)(C.Fragment,{children:[` · `,(0,C.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,C.jsxs)(`div`,{className:`rounded-lg bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,C.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,C.jsxs)(C.Fragment,{children:[` — `,(0,C.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,C.jsxs)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-xs text-red-900 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function fe(){let e=await c(a(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function N(e){try{return{kind:`ready`,setup:(await c(a(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function pe(e){return c(a(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function P(e){await c(a(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function me(e,t){await c(a(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function F(){let e=await i(a(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var I=`https://console.xopc.ai/access/client`;function L(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.code;if(typeof n==`string`)return n;let r=t.error;if(!r||typeof r!=`object`)return;let i=r.code;return typeof i==`string`?i:void 0}function R(e){return L(e)===`TUNNEL_REGISTRATION_KEY_REJECTED`||e instanceof Error&&/\bTunnel register failed: 401\b/.test(e.message)}function z(e){return L(e)===`TUNNEL_RECOVERY_PROOF_REJECTED`||e instanceof Error&&e.message===`Active lease ownership proof required`}function B(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(L(e)??``)}async function V(){return c(a(`/api/tunnel/status`))}async function H(){await c(a(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function he(){await c(a(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function U(e){return c(a(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({recoverActiveLease:e?.recoverActiveLease===!0})})}async function W(e){return c(a(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function G(){let e=(await c(a(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function K(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{w as S,fe as _,H as a,A as b,W as c,z as d,R as f,F as g,me as h,he as i,L as l,N as m,V as n,G as o,P as p,K as r,U as s,I as t,B as u,pe as v,T as x,M as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t,p as n}from"./locale-store-
|
|
1
|
+
import{i as e,o as t,p as n}from"./locale-store-CAZaC05J.js";import{t as r}from"./createLucideIcon-DPHK1VkS.js";var i=r(`file-clock`,[[`path`,{d:`M16 22h2a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v2.85`,key:`ryk6xj`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 14v2.2l1.6 1`,key:`6m4bie`}],[`circle`,{cx:`8`,cy:`16`,r:`6`,key:`10v15b`}]]),a=r(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]);async function o(){return t(e(`/api/onboarding/work-discovery`))}async function s(){await t(e(`/api/onboarding/work-discovery`),{method:`PATCH`,body:JSON.stringify({status:`dismissed`})})}async function c(n){return(await t(e(`/api/work-discovery/preview`),{method:`POST`,body:JSON.stringify({rootPath:n})})).preview}async function l(){let n=await t(e(`/api/work-discovery/candidates`),{method:`POST`});return{candidates:n.candidates,processingTarget:n.processingTarget}}async function u(n,r){return(await t(e(`/api/context-sources/work-folders`),{method:`POST`,body:JSON.stringify({rootPath:n,processingPolicy:r})})).source}async function d(n,r,i,a){return t(e(`/api/context-sources/bootstrap`),{method:`POST`,body:JSON.stringify({items:n,processingPolicy:i,...r?{workDiscoveryRunId:r}:{},sourceCheckpoints:a})})}async function f(n){return(await t(e(`/api/work-discovery/runs`),{method:`POST`,body:JSON.stringify({rootPath:n,source:`onboarding_selected_directory`,idempotencyKey:crypto.randomUUID()})})).run}async function p(n){return(await t(e(`/api/work-discovery/runs/${encodeURIComponent(n)}`))).run}async function m(n){return(await t(e(`/api/work-discovery/runs/${encodeURIComponent(n)}/cancel`),{method:`POST`})).run}async function h(n){return(await t(e(`/api/work-discovery/runs/${encodeURIComponent(n)}/retry`),{method:`POST`})).run}async function g(n,r,i){return(await t(e(`/api/work-discovery/runs/${encodeURIComponent(n)}/recognition-feedback`),{method:`POST`,body:JSON.stringify({decision:r,correctedIntent:i})})).run}async function _(n,r){await t(e(`/api/work-discovery/runs/${encodeURIComponent(n)}/suggestions/${encodeURIComponent(r)}/select`),{method:`POST`})}function v(e,t){return Object.fromEntries(e.map(e=>[e,t]))}function y(e,t){let n=v(t,`running`);for(let t of e)n[t.sourceId]=t.status;return n}async function b(e){if(!e)return;let t=Date.now()+75e3;for(;Date.now()<t;){try{let t=await p(e);if(S.getState().updateDirectoryRun(t),t.status===`completed`||t.status===`failed`||t.status===`canceled`)return}catch{}await new Promise(e=>window.setTimeout(e,800))}}var x={status:`idle`,drawerOpen:!1,directoryStatus:`idle`,directoryRun:null,sources:{},itemCounts:{},memories:[],threads:[],error:void 0},S=n((e,t)=>({...x,setDrawerOpen:n=>{!n&&t().status===`completed`?e({...x}):e({drawerOpen:n})},finish:()=>e({...x}),updateDirectoryRun:n=>{let r=n.status===`completed`?`completed`:n.status===`failed`||n.status===`canceled`?`failed`:`running`,i=Object.values(t().sources).every(e=>e!==`running`&&e!==`idle`),a=Object.values(t().sources).some(e=>e===`denied`||e===`failed`||e===`partial`);e({directoryStatus:r,directoryRun:n,status:r===`completed`&&i?a?`partial`:`completed`:r===`failed`&&i?`partial`:`running`})},collectSources:async(n,r,i)=>{let a=window.electronAPI?.understandingSources?.collect;if(!(!a||!r.length)){e({status:`running`,sources:v(r,`running`),itemCounts:Object.fromEntries(r.map(e=>[e,0])),memories:[],threads:[],error:void 0});try{let o=await a(r),s=y(o,r),c=Object.fromEntries(o.map(e=>[e.sourceId,e.items.length]));e({sources:s,itemCounts:c});let l=o.flatMap(e=>e.status===`completed`?e.items:[]),u=Object.fromEntries(o.flatMap(e=>e.checkpoint?[[e.sourceId,e.checkpoint]]:[]));l.length&&await b(n);let f=l.length?await d(l,n,i,u):{profileCandidates:[],workThreads:[],knowledgeCandidates:[],sourceStatuses:[]};for(let e of f.sourceStatuses)s[e.sourceId]=e.status;let p=f.profileCandidates,m=Object.values(s).some(e=>e===`denied`||e===`failed`||e===`partial`),h=f.sourceStatuses.flatMap(e=>e.error?[e.error]:[]),g=!n||t().directoryStatus===`completed`;e({sources:s,itemCounts:c,memories:p,threads:f.workThreads,...h.length?{error:h.join(`; `)}:{},status:g?m?`partial`:`completed`:`running`})}catch(t){e(e=>({status:`partial`,sources:Object.fromEntries(Object.entries(e.sources).map(([e,t])=>[e,t===`running`?`failed`:t])),error:t instanceof Error?t.message:String(t)}))}}}}));export{o as a,c,f as d,g as f,s as i,h as l,i as m,m as n,p as o,a as p,l as r,u as s,S as t,_ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,o as n,p as r}from"./locale-store-
|
|
1
|
+
import{a as e,i as t,o as n,p as r}from"./locale-store-CAZaC05J.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{o as a}from"./vendor-swr-CdRzEUwF.js";var o=i(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),s=i(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),c=i(`handshake`,[[`path`,{d:`m11 17 2 2a1 1 0 1 0 3-3`,key:`efffak`}],[`path`,{d:`m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4`,key:`9pr0kb`}],[`path`,{d:`m21 3 1 11h-2`,key:`1tisrp`}],[`path`,{d:`M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3`,key:`1uvwmv`}],[`path`,{d:`M3 4h8`,key:`1ep09j`}]]),l=i(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),u=i(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),d=i(`user-round-pen`,[[`path`,{d:`M2 21a8 8 0 0 1 10.821-7.487`,key:`1c8h7z`}],[`path`,{d:`M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`1817ys`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}]]);function f(){return n(t(`/api/user-model`))}async function p(){let e=await f();return{profile:{callName:typeof e.profile.callName==`string`?e.profile.callName:``,role:typeof e.profile.role==`string`?e.profile.role:``,pronouns:typeof e.profile.pronouns==`string`?e.profile.pronouns:``,timezone:typeof e.profile.timezone==`string`?e.profile.timezone:``,locale:typeof e.profile.locale==`string`?e.profile.locale:``},...typeof e.suggestedCallName==`string`?{suggestedCallName:e.suggestedCallName}:{}}}async function m(e){let r=await n(t(`/api/user-model/profile`),{method:`PATCH`,body:JSON.stringify(e)});return{callName:r.profile.callName??``,role:r.profile.role??``,pronouns:r.profile.pronouns??``,timezone:r.profile.timezone??``,locale:r.profile.locale??``}}function h(){return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}function g(e,r){return n(t(`/api/user-model/assertions/${encodeURIComponent(e)}/status`),{method:`PATCH`,body:JSON.stringify({status:r})})}function _(e,r){return n(t(`/api/user-model/assertions/${encodeURIComponent(e)}/scope`),{method:`PATCH`,body:JSON.stringify({scope:r})})}function v(e,r){return n(t(`/api/user-model/assertions/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({statement:r})})}function y(e,r){return n(t(`/api/user-model/priorities/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(r)})}function b(e){let r=Date.now();return n(t(`/api/user-model/priorities`),{method:`POST`,body:JSON.stringify({targetType:`topic`,targetId:e.title.trim(),rank:`primary`,urgency:1,scope:{type:`global`},validFrom:r,validTo:e.validTo})})}function x(e,r){return n(t(`/api/user-model/rules/${encodeURIComponent(e)}/status`),{method:`PATCH`,body:JSON.stringify({status:r})})}function S(e){return n(t(`/api/user-model/rules`),{method:`POST`,body:JSON.stringify({category:e.category,statement:e.statement,priority:50,scope:e.scope,conditions:{...e.conditions,requiresConfirmation:!1}})})}function C(e,r,i){return n(t(`/api/knowledge-memory/${encodeURIComponent(e.id)}/review`),{method:`POST`,body:JSON.stringify({action:r,expectedStatus:e.status,...i===void 0?{}:{content:i}})})}function w(e){return n(t(`/api/user-model/assertions/${encodeURIComponent(e)}`),{method:`DELETE`})}function T(e){return n(t(`/api/knowledge-memory/${encodeURIComponent(e)}`),{method:`DELETE`})}function E(e){return n(t(`/api/user-model/settings`),{method:`PATCH`,body:JSON.stringify(e)})}async function D(){let n=await e(t(`/api/user-model/export`));if(!n.ok)throw Error(`Export failed (${n.status})`);let r=await n.blob(),i=(n.headers.get(`Content-Disposition`)??``).match(/filename="([^"]+)"/)?.[1]??`xopc-memory.json`,a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=i,o.click(),URL.revokeObjectURL(a)}var O=e=>e.status===`queued`||e.status===`running`,k=new Set,A,j=r((e,r)=>({sources:[],starting:!1,async start(i){if(!r().starting){e({starting:!0,error:void 0});try{await n(t(`/api/user-model/refresh`),{method:`POST`,body:JSON.stringify(i?{sourceIds:[i]}:{})}),await r().poll()}catch(t){e({error:t instanceof Error?t.message:String(t)})}finally{e({starting:!1})}}},poll(){return A||(A=(async()=>{try{let i=await n(t(`/api/user-model/refresh`)),o=new Map(r().sources.map(e=>[e.id,e.status]));e({sources:i.sources,error:void 0}),i.sources.some(e=>!O(e)&&o.get(e.id)!==e.status)&&a(`/api/user-model`);for(let e of i.sources)O(e)&&e.metadata.phase===`waiting_desktop`&&M(e)}catch(t){e({error:t instanceof Error?t.message:String(t)})}})().finally(()=>{A=void 0}),A)}}));async function M(e){let r=window.electronAPI?.understandingSources?.collect;if(!(!r||k.size>0)){k.add(e.id);try{let i;try{let t=(await r([e.adapterId])).find(t=>t.sourceId===e.adapterId);i=t?.status===`completed`?{items:t.items}:{items:[],error:t?.error??`Source collection failed. Check its permissions and retry.`}}catch{i={items:[],error:`Source collection was interrupted. Please retry.`}}await n(t(`/api/user-model/refresh/sources/${encodeURIComponent(e.id)}/collection`),{method:`POST`,body:JSON.stringify(i)}),await j.getState().poll()}catch(e){j.setState({error:e instanceof Error?e.message:String(e)})}finally{k.delete(e.id)}}}export{o as C,s as S,m as _,w as a,l as b,D as c,C as d,_ as f,y as g,E as h,S as i,f as l,x as m,v as n,T as o,g as p,b as r,h as s,j as t,p as u,d as v,c as x,u as y};
|
|
@@ -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{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-B6OrWgY1.js";import{t as c}from"./messages-jwdBhfL9.js";import{t as l}from"./bot-DjLkhyZL.js";import{t as u}from"./popover-select-CEMWIrtY.js";import{t as d}from"./circle-alert-BEjgurr2.js";import{t as f}from"./coins-DjP27vUx.js";import{t as p}from"./database-CjjeZfRG.js";import{t as m}from"./gauge-C78eD2BA.js";import{t as h}from"./refresh-cw-BRlGaq2w.js";import{t as g}from"./timer-rCwGHjuO.js";import{t as _}from"./skeleton-BI5TyibZ.js";import{i as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-Cc4hUNTt.js";import{t as b}from"./sliding-tab-list-DuQyViqe.js";import{n as x,t as S}from"./settings-page-header-BAN34UQi.js";import"./settings-page-layout-B5TVFBV2.js";import{t as ee}from"./xopc-cloud-account-card-BkdW2p3v.js";var C=e(t(),1),w=n();function T(e,t=Date.now()+1){let n=t-e*24*60*60*1e3;return new URLSearchParams({from:String(n),to:String(t)}).toString()}function E(e){return s(a(`/api/usage/summary?${e}`))}function D(e,t,n=20){let r=new URLSearchParams(e);return r.set(`limit`,String(n)),t&&r.set(`cursor`,t),s(a(`/api/usage/events?${r}`))}var O=r();function k(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`,{notation:`compact`,maximumFractionDigits:1}).format(e)}function A(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function j(e){let t=BigInt(e),n=String(t%10000n).padStart(4,`0`).replace(/0+$/,``);return`${t/10000n}${n?`.${n}`:``}`}function te(e,t){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(e)}function M(){let e=(0,w.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,O.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,O.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[0,1,2,3].map(N)}),(0,O.jsx)(_,{className:`h-52 rounded-xl`}),(0,O.jsx)(_,{className:`h-72 rounded-xl`})]}),e[0]=t):t=e[0],t}function N(e){return(0,O.jsx)(_,{className:`h-24 rounded-xl`},e)}function P(){let e=o(e=>e.language),t=c(e).usage,[n,r]=i(),a=[`7`,`30`,`90`].includes(n.get(`days`)??``)?n.get(`days`):`7`,s=n.get(`size`)===`50`?50:20,w=n.getAll(`cursor`),N=w.at(-1),[P]=(0,C.useState)(()=>Date.now()+1),F=Number(n.get(`to`)),I=Number.isSafeInteger(F)&&F>Number(a)*864e5?F:P,L=(0,C.useMemo)(()=>T(Number(a),I),[a,I]),R=v([`usage-summary`,L],()=>E(L),{refreshInterval:15e3}),z=v([`usage-events`,L,N,s],()=>D(L,N,s),{refreshInterval:15e3}),B=!R.data&&!R.error,V=R.error,H=e=>{let t=new URLSearchParams(n);t.set(`to`,String(I)),e(t),r(t)},U=e=>H(t=>{t.set(`days`,e),t.set(`to`,String(Date.now()+1)),t.delete(`cursor`),t.delete(`groupPage`)}),W=n.get(`group`)===`model`?`model`:`scenario`,G=[...W===`model`?R.data?.byModel??[]:R.data?.byCategory??[]].sort((e,t)=>t.totals.calls-e.totals.calls||e.key.localeCompare(t.key)),K=Math.max(1,Math.ceil((G?.length??0)/6)),q=Number(n.get(`groupPage`)),J=Math.min(K,Number.isSafeInteger(q)&&q>0?q:1),Y=G?.slice((J-1)*6,J*6),X=w.length+1,Z=R.data?.totals,ne=(Z?.billing?.cloud.calls??0)>0,Q=e=>{let n=e.billing?.cloud;return n?.calls?n.chargedCreditMicro===null?t.cloudUnconfirmed:`${n.pendingCalls+n.unavailableCalls>0?`≥ `:``}${j(n.chargedCreditMicro)} Credits`:t.noCloudCalls},$=e=>{let n=e.billing?.external;return n?.calls?n.unknownCostCalls===n.calls?t.costUnknown:`${n.unknownCostCalls>0?`≥ `:`≈ `}${A(n.estimatedCostUsd)}`:t.noExternalCalls},re=e=>e.billing?.source===`local`||e.provider!==`xopc-cloud`&&e.costSource===`local`?t.localSource:e.billing?.source===`xopc_cloud`||e.provider===`xopc-cloud`?t.cloudSource:t.externalSource,ie=e=>{let n=e.billing;return n?.source===`local`?t.localNoCharge:n?.source===`xopc_cloud`?n.state===`settled`&&n.chargedCreditMicro!==null?`${j(n.chargedCreditMicro)} Credits`:n.state===`released`?t.cloudReleased:n.state===`pending`?n.reservedCreditMicro===null?t.cloudPending:t.cloudPendingReserved.replace(`{{credits}}`,j(n.reservedCreditMicro)):t.cloudUnconfirmed:e.provider===`xopc-cloud`?t.cloudUnconfirmed:e.costSource===`local`?t.localNoCharge:e.estimatedCostUsd===void 0?t.costUnknown:`≈ ${A(e.estimatedCostUsd)}`},ae=e=>(0,O.jsxs)(`span`,{className:`flex flex-col items-end gap-1 text-xs`,children:[e.billing?.cloud.calls?(0,O.jsxs)(`span`,{children:[t.cloudSource,`: `,Q(e)]}):null,e.billing?.external.calls?(0,O.jsxs)(`span`,{children:[t.externalSource,`: `,$(e)]}):null,e.billing?.localCalls?(0,O.jsx)(`span`,{children:t.localNoCharge}):null,(0,O.jsxs)(`span`,{children:[e.calls,` `,t.callUnit]})]}),oe={"usage.reason.imageGeneration":t.reasons.imageGeneration,"usage.reason.audioTranscription":t.reasons.audioTranscription,"usage.reason.audioSpeech":t.reasons.audioSpeech,"usage.reason.agentAnswer":t.reasons.agentAnswer,"usage.reason.continueAfterTool":t.reasons.continueAfterTool,"usage.reason.backgroundReview":t.reasons.backgroundReview,"usage.reason.sessionCompaction":t.reasons.sessionCompaction,"usage.reason.sessionTitle":t.reasons.sessionTitle,"usage.reason.imageUnderstanding":t.reasons.imageUnderstanding,"usage.reason.webExtract":t.reasons.webExtract,"usage.reason.sessionSearch":t.reasons.sessionSearch,"usage.reason.noteGeneration":t.reasons.noteGeneration,"usage.reason.automationDraft":t.reasons.automationDraft,"usage.reason.taskPlanning":t.reasons.taskPlanning,"usage.reason.taskJudging":t.reasons.taskJudging,"usage.reason.voiceSummary":t.reasons.voiceSummary,"usage.reason.voiceSelection":t.reasons.voiceSelection,"usage.reason.homeAdvice":t.reasons.homeAdvice,"usage.reason.workDiscovery":t.reasons.workDiscovery,"usage.reason.workInvestigation":t.reasons.workInvestigation,"usage.reason.discussionAnalysis":t.reasons.discussionAnalysis,"usage.reason.textAssist":t.reasons.textAssist,"usage.reason.userModelInterpretation":t.reasons.userModelInterpretation,"usage.reason.other":t.reasons.other};return(0,O.jsxs)(x,{children:[(0,O.jsx)(S,{title:t.title,subtitle:t.subtitle,actions:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`w-36`,children:(0,O.jsx)(u,{value:a,allowEmpty:!1,ariaLabel:t.periodLabel,placeholder:t.periodLabel,options:[{value:`7`,label:t.last7Days},{value:`30`,label:t.last30Days},{value:`90`,label:t.last90Days}],onChange:U})}),(0,O.jsx)(y,{variant:`ghost`,"aria-label":t.refresh,title:t.refresh,onClick:()=>U(a),children:(0,O.jsx)(h,{className:`size-4`,"aria-hidden":!0})})]})}),B?(0,O.jsx)(M,{}):V?(0,O.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,O.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`font-medium text-fg`,children:t.loadError}),(0,O.jsx)(`p`,{className:`mt-1`,children:String(V.message??V)})]}),(0,O.jsx)(y,{variant:`secondary`,onClick:()=>void Promise.all([R.mutate(),z.mutate()]),children:t.retry})]})]}):Z?(0,O.jsxs)(`div`,{className:`space-y-5`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.summaryLabel}),(0,O.jsx)(`section`,{"aria-label":t.summaryLabel,className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[{label:t.cloudCharged,value:Q(Z),icon:f},{label:t.knownCost,value:$(Z),icon:f},{label:t.calls,value:Z.calls.toLocaleString(),icon:m},{label:t.tokens,value:k(Z.totalTokens,e),icon:p}].map(e=>(0,O.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,O.jsx)(e.icon,{className:`size-4`,"aria-hidden":!0}),e.label]}),(0,O.jsx)(`div`,{className:`mt-2 text-xl font-semibold tabular-nums text-fg`,children:e.value})]},e.label))}),(Z.billing?.external.unknownCostCalls??0)>0?(0,O.jsx)(`p`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:Z.billing?.external.unknownCostCalls===Z.billing?.external.calls?t.allCostsUnknown:t.someCostsUnknown}):null,Z.billing?.cloud.calls?(0,O.jsxs)(`p`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:[t.cloudCoverage.replace(`{{pending}}`,String(Z.billing.cloud.pendingCalls)).replace(`{{unknown}}`,String(Z.billing.cloud.unavailableCalls)),Z.billing.cloud.reservedCreditMicro===null?``:` ${t.cloudReserved.replace(`{{credits}}`,j(Z.billing.cloud.reservedCreditMicro))}`]}):null,(0,O.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.distribution}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.distributionHint})]}),(0,O.jsx)(b,{className:`flex gap-1`,role:`group`,"aria-label":t.distribution,children:[`scenario`,`model`].map(e=>(0,O.jsx)(y,{variant:W===e?`secondary`:`ghost`,"aria-pressed":W===e,onClick:()=>H(t=>{t.set(`group`,e),t.delete(`groupPage`)}),children:e===`scenario`?t.byScenario:t.byModel},e))})]}),(0,O.jsx)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:Y?.length?Y.map(e=>{let n=W===`scenario`?t.categories[e.key]??e.key:e.key;return(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 py-3 text-sm sm:flex-row sm:items-center sm:justify-between`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`p`,{className:`truncate font-medium text-fg`,title:n,children:n}),(0,O.jsx)(`div`,{className:`mt-2 h-1 max-w-64 overflow-hidden rounded-full bg-surface-inset`,"aria-hidden":!0,children:(0,O.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${Z.calls?e.totals.calls/Z.calls*100:0}%`}})})]}),(0,O.jsx)(`div`,{className:`shrink-0 self-end tabular-nums text-fg-muted sm:self-auto`,children:ae(e.totals)})]},e.key)}):(0,O.jsx)(`p`,{className:`py-5 text-sm text-fg-subtle`,children:t.empty})}),K>1?(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,"aria-live":`polite`,children:t.groupPage.replace(`{{page}}`,String(J)).replace(`{{pages}}`,String(K)).replace(`{{count}}`,String(G?.length??0))}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(y,{disabled:J===1,"aria-label":t.previousDistribution,onClick:()=>H(e=>e.set(`groupPage`,String(J-1))),children:t.previousPage}),(0,O.jsx)(y,{disabled:J===K,"aria-label":t.nextDistribution,onClick:()=>H(e=>e.set(`groupPage`,String(J+1))),children:t.nextPage})]})]}):null]}),(0,O.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.recentCalls}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.recentCallsHint})]}),(0,O.jsx)(`div`,{className:`w-36`,children:(0,O.jsx)(u,{value:String(s),allowEmpty:!1,ariaLabel:t.pageSize,placeholder:t.pageSize,options:[20,50].map(e=>({value:String(e),label:t.rowsPerPage.replace(`{{count}}`,String(e))})),onChange:e=>H(t=>{t.set(`size`,e),t.delete(`cursor`)})})})]}),(0,O.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:z.error?(0,O.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-4 text-sm text-fg-muted`,children:[(0,O.jsx)(`p`,{children:t.loadError}),(0,O.jsx)(y,{onClick:()=>void z.mutate(),children:t.retry})]}):z.data?z.data.items.length?z.data.items.map(n=>(0,O.jsxs)(`article`,{className:`grid gap-2 px-4 py-3 text-sm sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(l,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`span`,{className:`truncate font-medium text-fg`,children:oe[n.reasonKey]??t.reasons.other})]}),(0,O.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,O.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[n.provider,`/`,n.model]}),(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,O.jsx)(g,{className:`size-3`,"aria-hidden":!0}),te(n.startedAt,e)]}),(0,O.jsx)(`span`,{className:`rounded border border-edge px-1.5 py-0.5`,children:re(n)}),(0,O.jsx)(`span`,{children:n.totalTokens===void 0?t.tokensUnknown:`${k(n.totalTokens,e)} tokens`})]})]}),(0,O.jsxs)(`div`,{className:`text-left tabular-nums text-fg sm:text-right`,children:[ie(n),(0,O.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.status[n.status]??n.status})]})]},n.id)):(0,O.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-subtle`,children:t.empty}):(0,O.jsx)(`div`,{"aria-busy":`true`,className:`space-y-3 p-4`,children:[0,1,2,3].map(e=>(0,O.jsx)(_,{className:`h-16`},e))})}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,"aria-live":`polite`,children:t.eventPage.replace(`{{page}}`,String(X)).replace(`{{count}}`,String(z.data?.items.length??0))}),(0,O.jsxs)(`nav`,{className:`flex gap-2`,"aria-label":t.pagination,children:[X>1?(0,O.jsx)(y,{variant:`ghost`,onClick:()=>H(e=>e.delete(`cursor`)),children:t.firstPage}):null,(0,O.jsx)(y,{disabled:X===1,onClick:()=>H(e=>{e.delete(`cursor`),w.slice(0,-1).forEach(t=>e.append(`cursor`,t))}),children:t.previousPage}),(0,O.jsx)(y,{disabled:!z.data?.nextCursor||!!z.error,onClick:()=>H(e=>{z.data?.nextCursor&&e.append(`cursor`,z.data.nextCursor)}),children:t.nextPage})]})]})]}),(0,O.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg focus-visible:outline-accent`,children:t.billingDetails}),(0,O.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:t.cloudBillingHint}),(0,O.jsx)(`a`,{className:`mt-2 inline-block text-xs text-accent-fg hover:underline`,href:`https://console.xopc.ai/models/billing`,target:`_blank`,rel:`noreferrer`,children:t.cloudCreditsLabel}),ne?(0,O.jsx)(`div`,{className:`mt-4`,children:(0,O.jsx)(ee,{labels:c(e).capabilitiesSettings.xopcCloudAccount})}):null]})]}):null]})}export{P as UsageSettingsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-CAZaC05J.js";import{t as c}from"./messages-C7fckbyG.js";import{t as l}from"./bot-DjLkhyZL.js";import{t as u}from"./popover-select-CEMWIrtY.js";import{t as d}from"./circle-alert-BEjgurr2.js";import{t as f}from"./coins-DjP27vUx.js";import{t as p}from"./database-CjjeZfRG.js";import{t as m}from"./gauge-C78eD2BA.js";import{t as h}from"./refresh-cw-BRlGaq2w.js";import{t as g}from"./timer-rCwGHjuO.js";import{t as _}from"./skeleton-BI5TyibZ.js";import{i as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-Cc4hUNTt.js";import{t as b}from"./sliding-tab-list-DuQyViqe.js";import{n as x,t as S}from"./settings-page-header-LuOJvqNa.js";import"./settings-page-layout-CduQ8w4a.js";import{t as ee}from"./xopc-cloud-account-card-Bbe19Del.js";var C=e(t(),1),w=n();function T(e,t=Date.now()+1){let n=t-e*24*60*60*1e3;return new URLSearchParams({from:String(n),to:String(t)}).toString()}function E(e){return s(a(`/api/usage/summary?${e}`))}function D(e,t,n=20){let r=new URLSearchParams(e);return r.set(`limit`,String(n)),t&&r.set(`cursor`,t),s(a(`/api/usage/events?${r}`))}var O=r();function k(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`,{notation:`compact`,maximumFractionDigits:1}).format(e)}function A(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function j(e){let t=BigInt(e),n=String(t%10000n).padStart(4,`0`).replace(/0+$/,``);return`${t/10000n}${n?`.${n}`:``}`}function te(e,t){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(e)}function M(){let e=(0,w.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,O.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,O.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[0,1,2,3].map(N)}),(0,O.jsx)(_,{className:`h-52 rounded-xl`}),(0,O.jsx)(_,{className:`h-72 rounded-xl`})]}),e[0]=t):t=e[0],t}function N(e){return(0,O.jsx)(_,{className:`h-24 rounded-xl`},e)}function P(){let e=o(e=>e.language),t=c(e).usage,[n,r]=i(),a=[`7`,`30`,`90`].includes(n.get(`days`)??``)?n.get(`days`):`7`,s=n.get(`size`)===`50`?50:20,w=n.getAll(`cursor`),N=w.at(-1),[P]=(0,C.useState)(()=>Date.now()+1),F=Number(n.get(`to`)),I=Number.isSafeInteger(F)&&F>Number(a)*864e5?F:P,L=(0,C.useMemo)(()=>T(Number(a),I),[a,I]),R=v([`usage-summary`,L],()=>E(L),{refreshInterval:15e3}),z=v([`usage-events`,L,N,s],()=>D(L,N,s),{refreshInterval:15e3}),B=!R.data&&!R.error,V=R.error,H=e=>{let t=new URLSearchParams(n);t.set(`to`,String(I)),e(t),r(t)},U=e=>H(t=>{t.set(`days`,e),t.set(`to`,String(Date.now()+1)),t.delete(`cursor`),t.delete(`groupPage`)}),W=n.get(`group`)===`model`?`model`:`scenario`,G=[...W===`model`?R.data?.byModel??[]:R.data?.byCategory??[]].sort((e,t)=>t.totals.calls-e.totals.calls||e.key.localeCompare(t.key)),K=Math.max(1,Math.ceil((G?.length??0)/6)),q=Number(n.get(`groupPage`)),J=Math.min(K,Number.isSafeInteger(q)&&q>0?q:1),Y=G?.slice((J-1)*6,J*6),X=w.length+1,Z=R.data?.totals,ne=(Z?.billing?.cloud.calls??0)>0,Q=e=>{let n=e.billing?.cloud;return n?.calls?n.chargedCreditMicro===null?t.cloudUnconfirmed:`${n.pendingCalls+n.unavailableCalls>0?`≥ `:``}${j(n.chargedCreditMicro)} Credits`:t.noCloudCalls},$=e=>{let n=e.billing?.external;return n?.calls?n.unknownCostCalls===n.calls?t.costUnknown:`${n.unknownCostCalls>0?`≥ `:`≈ `}${A(n.estimatedCostUsd)}`:t.noExternalCalls},re=e=>e.billing?.source===`local`||e.provider!==`xopc-cloud`&&e.costSource===`local`?t.localSource:e.billing?.source===`xopc_cloud`||e.provider===`xopc-cloud`?t.cloudSource:t.externalSource,ie=e=>{let n=e.billing;return n?.source===`local`?t.localNoCharge:n?.source===`xopc_cloud`?n.state===`settled`&&n.chargedCreditMicro!==null?`${j(n.chargedCreditMicro)} Credits`:n.state===`released`?t.cloudReleased:n.state===`pending`?n.reservedCreditMicro===null?t.cloudPending:t.cloudPendingReserved.replace(`{{credits}}`,j(n.reservedCreditMicro)):t.cloudUnconfirmed:e.provider===`xopc-cloud`?t.cloudUnconfirmed:e.costSource===`local`?t.localNoCharge:e.estimatedCostUsd===void 0?t.costUnknown:`≈ ${A(e.estimatedCostUsd)}`},ae=e=>(0,O.jsxs)(`span`,{className:`flex flex-col items-end gap-1 text-xs`,children:[e.billing?.cloud.calls?(0,O.jsxs)(`span`,{children:[t.cloudSource,`: `,Q(e)]}):null,e.billing?.external.calls?(0,O.jsxs)(`span`,{children:[t.externalSource,`: `,$(e)]}):null,e.billing?.localCalls?(0,O.jsx)(`span`,{children:t.localNoCharge}):null,(0,O.jsxs)(`span`,{children:[e.calls,` `,t.callUnit]})]}),oe={"usage.reason.imageGeneration":t.reasons.imageGeneration,"usage.reason.audioTranscription":t.reasons.audioTranscription,"usage.reason.audioSpeech":t.reasons.audioSpeech,"usage.reason.agentAnswer":t.reasons.agentAnswer,"usage.reason.continueAfterTool":t.reasons.continueAfterTool,"usage.reason.backgroundReview":t.reasons.backgroundReview,"usage.reason.sessionCompaction":t.reasons.sessionCompaction,"usage.reason.sessionTitle":t.reasons.sessionTitle,"usage.reason.imageUnderstanding":t.reasons.imageUnderstanding,"usage.reason.webExtract":t.reasons.webExtract,"usage.reason.sessionSearch":t.reasons.sessionSearch,"usage.reason.noteGeneration":t.reasons.noteGeneration,"usage.reason.automationDraft":t.reasons.automationDraft,"usage.reason.taskPlanning":t.reasons.taskPlanning,"usage.reason.taskJudging":t.reasons.taskJudging,"usage.reason.voiceSummary":t.reasons.voiceSummary,"usage.reason.voiceSelection":t.reasons.voiceSelection,"usage.reason.homeAdvice":t.reasons.homeAdvice,"usage.reason.workDiscovery":t.reasons.workDiscovery,"usage.reason.workInvestigation":t.reasons.workInvestigation,"usage.reason.discussionAnalysis":t.reasons.discussionAnalysis,"usage.reason.textAssist":t.reasons.textAssist,"usage.reason.userModelInterpretation":t.reasons.userModelInterpretation,"usage.reason.other":t.reasons.other};return(0,O.jsxs)(x,{children:[(0,O.jsx)(S,{title:t.title,subtitle:t.subtitle,actions:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`w-36`,children:(0,O.jsx)(u,{value:a,allowEmpty:!1,ariaLabel:t.periodLabel,placeholder:t.periodLabel,options:[{value:`7`,label:t.last7Days},{value:`30`,label:t.last30Days},{value:`90`,label:t.last90Days}],onChange:U})}),(0,O.jsx)(y,{variant:`ghost`,"aria-label":t.refresh,title:t.refresh,onClick:()=>U(a),children:(0,O.jsx)(h,{className:`size-4`,"aria-hidden":!0})})]})}),B?(0,O.jsx)(M,{}):V?(0,O.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,O.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`font-medium text-fg`,children:t.loadError}),(0,O.jsx)(`p`,{className:`mt-1`,children:String(V.message??V)})]}),(0,O.jsx)(y,{variant:`secondary`,onClick:()=>void Promise.all([R.mutate(),z.mutate()]),children:t.retry})]})]}):Z?(0,O.jsxs)(`div`,{className:`space-y-5`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.summaryLabel}),(0,O.jsx)(`section`,{"aria-label":t.summaryLabel,className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[{label:t.cloudCharged,value:Q(Z),icon:f},{label:t.knownCost,value:$(Z),icon:f},{label:t.calls,value:Z.calls.toLocaleString(),icon:m},{label:t.tokens,value:k(Z.totalTokens,e),icon:p}].map(e=>(0,O.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,O.jsx)(e.icon,{className:`size-4`,"aria-hidden":!0}),e.label]}),(0,O.jsx)(`div`,{className:`mt-2 text-xl font-semibold tabular-nums text-fg`,children:e.value})]},e.label))}),(Z.billing?.external.unknownCostCalls??0)>0?(0,O.jsx)(`p`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:Z.billing?.external.unknownCostCalls===Z.billing?.external.calls?t.allCostsUnknown:t.someCostsUnknown}):null,Z.billing?.cloud.calls?(0,O.jsxs)(`p`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:[t.cloudCoverage.replace(`{{pending}}`,String(Z.billing.cloud.pendingCalls)).replace(`{{unknown}}`,String(Z.billing.cloud.unavailableCalls)),Z.billing.cloud.reservedCreditMicro===null?``:` ${t.cloudReserved.replace(`{{credits}}`,j(Z.billing.cloud.reservedCreditMicro))}`]}):null,(0,O.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.distribution}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.distributionHint})]}),(0,O.jsx)(b,{className:`flex gap-1`,role:`group`,"aria-label":t.distribution,children:[`scenario`,`model`].map(e=>(0,O.jsx)(y,{variant:W===e?`secondary`:`ghost`,"aria-pressed":W===e,onClick:()=>H(t=>{t.set(`group`,e),t.delete(`groupPage`)}),children:e===`scenario`?t.byScenario:t.byModel},e))})]}),(0,O.jsx)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:Y?.length?Y.map(e=>{let n=W===`scenario`?t.categories[e.key]??e.key:e.key;return(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 py-3 text-sm sm:flex-row sm:items-center sm:justify-between`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`p`,{className:`truncate font-medium text-fg`,title:n,children:n}),(0,O.jsx)(`div`,{className:`mt-2 h-1 max-w-64 overflow-hidden rounded-full bg-surface-inset`,"aria-hidden":!0,children:(0,O.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${Z.calls?e.totals.calls/Z.calls*100:0}%`}})})]}),(0,O.jsx)(`div`,{className:`shrink-0 self-end tabular-nums text-fg-muted sm:self-auto`,children:ae(e.totals)})]},e.key)}):(0,O.jsx)(`p`,{className:`py-5 text-sm text-fg-subtle`,children:t.empty})}),K>1?(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,"aria-live":`polite`,children:t.groupPage.replace(`{{page}}`,String(J)).replace(`{{pages}}`,String(K)).replace(`{{count}}`,String(G?.length??0))}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(y,{disabled:J===1,"aria-label":t.previousDistribution,onClick:()=>H(e=>e.set(`groupPage`,String(J-1))),children:t.previousPage}),(0,O.jsx)(y,{disabled:J===K,"aria-label":t.nextDistribution,onClick:()=>H(e=>e.set(`groupPage`,String(J+1))),children:t.nextPage})]})]}):null]}),(0,O.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.recentCalls}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.recentCallsHint})]}),(0,O.jsx)(`div`,{className:`w-36`,children:(0,O.jsx)(u,{value:String(s),allowEmpty:!1,ariaLabel:t.pageSize,placeholder:t.pageSize,options:[20,50].map(e=>({value:String(e),label:t.rowsPerPage.replace(`{{count}}`,String(e))})),onChange:e=>H(t=>{t.set(`size`,e),t.delete(`cursor`)})})})]}),(0,O.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:z.error?(0,O.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-4 text-sm text-fg-muted`,children:[(0,O.jsx)(`p`,{children:t.loadError}),(0,O.jsx)(y,{onClick:()=>void z.mutate(),children:t.retry})]}):z.data?z.data.items.length?z.data.items.map(n=>(0,O.jsxs)(`article`,{className:`grid gap-2 px-4 py-3 text-sm sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(l,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`span`,{className:`truncate font-medium text-fg`,children:oe[n.reasonKey]??t.reasons.other})]}),(0,O.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,O.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[n.provider,`/`,n.model]}),(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,O.jsx)(g,{className:`size-3`,"aria-hidden":!0}),te(n.startedAt,e)]}),(0,O.jsx)(`span`,{className:`rounded border border-edge px-1.5 py-0.5`,children:re(n)}),(0,O.jsx)(`span`,{children:n.totalTokens===void 0?t.tokensUnknown:`${k(n.totalTokens,e)} tokens`})]})]}),(0,O.jsxs)(`div`,{className:`text-left tabular-nums text-fg sm:text-right`,children:[ie(n),(0,O.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.status[n.status]??n.status})]})]},n.id)):(0,O.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-subtle`,children:t.empty}):(0,O.jsx)(`div`,{"aria-busy":`true`,className:`space-y-3 p-4`,children:[0,1,2,3].map(e=>(0,O.jsx)(_,{className:`h-16`},e))})}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,"aria-live":`polite`,children:t.eventPage.replace(`{{page}}`,String(X)).replace(`{{count}}`,String(z.data?.items.length??0))}),(0,O.jsxs)(`nav`,{className:`flex gap-2`,"aria-label":t.pagination,children:[X>1?(0,O.jsx)(y,{variant:`ghost`,onClick:()=>H(e=>e.delete(`cursor`)),children:t.firstPage}):null,(0,O.jsx)(y,{disabled:X===1,onClick:()=>H(e=>{e.delete(`cursor`),w.slice(0,-1).forEach(t=>e.append(`cursor`,t))}),children:t.previousPage}),(0,O.jsx)(y,{disabled:!z.data?.nextCursor||!!z.error,onClick:()=>H(e=>{z.data?.nextCursor&&e.append(`cursor`,z.data.nextCursor)}),children:t.nextPage})]})]})]}),(0,O.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg focus-visible:outline-accent`,children:t.billingDetails}),(0,O.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:t.cloudBillingHint}),(0,O.jsx)(`a`,{className:`mt-2 inline-block text-xs text-accent-fg hover:underline`,href:`https://console.xopc.ai/models/billing`,target:`_blank`,rel:`noreferrer`,children:t.cloudCreditsLabel}),ne?(0,O.jsx)(`div`,{className:`mt-4`,children:(0,O.jsx)(ee,{labels:c(e).capabilitiesSettings.xopcCloudAccount})}):null]})]}):null]})}export{P as UsageSettingsPage};
|
package/dist/gateway/static/root/assets/{use-autosave-HL8XRNR8.js → use-autosave-BVYS8UoK.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{n as i}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{n as i}from"./locale-store-CAZaC05J.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./circle-alert-BEjgurr2.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./cn-0WouolD0.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=i(f)===`zh`;if(n===`idle`)return null;let m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:``,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=c(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(s,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(o,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),(0,p.useEffect)(()=>{if(s!==`saved`)return;let e=window.setTimeout(()=>c(`idle`),1600);return()=>window.clearTimeout(e)},[s]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-load-DrVGNxJm.js","assets/rolldown-runtime-aKtaBQYM.js","assets/attachment-utils-core-BIOUBrpT.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
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"./preload-helper-Czpn1I53.js";import{i as a,n as o,o as s}from"./locale-store-B6OrWgY1.js";import{t as c}from"./messages-jwdBhfL9.js";import{o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{t as p}from"./chevron-left-DqFhpbvK.js";import{t as m}from"./chevron-right-BweFrslA.js";import{n as h,t as g}from"./file-BqMS_3DT.js";import{a as _,b as v,l as y,n as b,t as x,x as S}from"./use-file-preview-expanded-CW956CXS.js";import{t as C}from"./mic-CuUb7zc-.js";import{n as w}from"./share-link-dialog-BMcXyzr2.js";import{t as T}from"./cn-0WouolD0.js";import{r as ee,t as E}from"./constants-DBtMsXdW.js";import{r as D}from"./tasks-DRmd6sWt.js";import{a as O,i as k,o as A}from"./capabilities-DlHPLld_.js";import{t as j}from"./capabilities-CoeuLRt6.js";import{r as M}from"./attachment-utils-core-BIOUBrpT.js";import{a as te,n as ne,s as N,t as re}from"./file-preview-surface-zE9AcaHM.js";import{n as P}from"./interaction-BdhHBbYa.js";import{n as ie}from"./electron-env-DHOGevH3.js";import{i as F}from"./skill-wire-pattern-BPpeIcCi.js";async function I(e){return D.parse(await s(a(`/api/tasks`),{method:`POST`,body:JSON.stringify(e)}))}async function L(e){return j(`xopc.tasks.get`,{id:e})}async function R(e){return s(a(`/api/tasks/${encodeURIComponent(e)}/conversation`),{method:`POST`})}async function z(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,expectedVersion:n})}),L(e)}async function ae(e){await s(a(`/api/tasks/${encodeURIComponent(e)}`),{method:`DELETE`})}async function B(e,t,n,r=crypto.randomUUID(),i=`api`){return await s(a(`/api/tasks/${encodeURIComponent(e)}/commands`),{method:`POST`,body:JSON.stringify({idempotencyKey:r,expectedVersion:n,command:t,source:i})}),L(e)}async function V(e,t,n,r,i){return await s(a(`/api/tasks/${encodeURIComponent(e)}/criteria/${t}/review`),{method:`PUT`,body:JSON.stringify({status:n,expectedVersion:r,contractVersion:i})}),L(e)}async function H(e,t,n){return await s(a(`/api/task-runs/${encodeURIComponent(t)}/cancel`),{method:`POST`,body:JSON.stringify({expectedVersion:n,reason:`Cancelled by user`})}),L(e)}async function U(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/handoff`),{method:`POST`,body:JSON.stringify({toAgentId:t,expectedVersion:n,idempotencyKey:crypto.randomUUID()})}),L(e)}async function W(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/dependencies`),{method:`PUT`,body:JSON.stringify({dependsOnTaskIds:t,expectedVersion:n})}),L(e)}async function G(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/board-position`),{method:`PUT`,body:JSON.stringify({beforeTaskId:t,expectedVersion:n})}),L(e)}async function K(e,t,n){await s(a(`/api/task-runs/${encodeURIComponent(e)}/feedback`),{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({rating:t,reason:n?.trim()||void 0})})}function q(e,t=!1){let n=new URLSearchParams;return e&&n.set(`locale`,e),t&&n.set(`attention`,`all`),s(a(`/api/home${n.size?`?${n.toString()}`:``}`)).then(A)}function J(e){return s(a(`/api/home/advisor/refresh`),{method:`POST`,body:JSON.stringify({idempotencyKey:crypto.randomUUID(),locale:e})})}function Y(){return s(a(`/api/home/advisor/history`)).then(e=>O.parse(e))}async function X(e,t){return k.parse(await s(a(`/api/home/opportunities/${encodeURIComponent(e.id)}/action`),{method:`POST`,body:JSON.stringify({idempotencyKey:crypto.randomUUID(),expectedRevision:e.revision,mode:t})}))}function Z(e,t){let n=crypto.randomUUID();return s(a(`/api/home/opportunities/${encodeURIComponent(e.id)}/feedback`),{method:`POST`,body:JSON.stringify({...t,idempotencyKey:n,expectedRevision:e.revision})}).then(()=>({ok:!0,idempotencyKey:n}))}function oe(e,t){return s(a(`/api/home/opportunities/${encodeURIComponent(e)}/feedback/undo`),{method:`POST`,body:JSON.stringify({idempotencyKey:t})})}function se(e,t){return s(a(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function ce(e){return s(a(`/api/home/attention/acknowledge`),{method:`POST`,body:JSON.stringify(e)})}function le(e){return s(a(`/api/home/attention/retry`),{method:`POST`,body:JSON.stringify(e)})}function ue(e,t){let n=e.trim(),r=t.trim();return n&&F(n)?`/skill:${n}${r?` ${r}`:` `}`:r||null}function de(e,t,n){let r=e.trim(),i=t?.trim()??``;if(!r&&!i)return null;let a=new URLSearchParams;return r&&a.set(`draft`,r),a.set(`autoSend`,`1`),i&&a.set(`attachmentsHandoff`,i),n?.projectScope===`none`&&a.set(`projectScope`,`none`),`/chat/new?${a.toString()}`}function fe(e){let t=e.startsWith(`?`)?e.slice(1):e;if(!t)return``;let n=new URLSearchParams(t),r=new URLSearchParams,i=n.get(`skill`),a=n.get(`slash`),o=n.get(`draft`),s=n.get(`autoSend`),c=n.get(`attachmentHandoff`),l=n.get(`attachmentsHandoff`),u=n.get(`agentSetup`);i&&r.set(`skill`,i),a&&r.set(`slash`,a),o&&r.set(`draft`,o),s===`1`&&r.set(`autoSend`,`1`),c&&r.set(`attachmentHandoff`,c),l&&r.set(`attachmentsHandoff`,l),n.get(`setup`)===`automation`&&r.set(`setup`,`automation`),u===`1`&&r.set(`agentSetup`,`1`),n.get(`scene`)===`find-skills`&&r.set(`scene`,`find-skills`);let d=r.toString();return d?`?${d}`:``}function pe(e){let t=e.startsWith(`?`)?e.slice(1):e,n=new URLSearchParams(t),r=n.get(`projectId`)?.trim();return r?{kind:`project`,projectId:r}:n.get(`projectScope`)===`none`?{kind:`none`}:{kind:`remember-last`}}function me(e){let t=e?.trim();return t?`/chat/new?projectId=${encodeURIComponent(t)}`:`/chat/new?projectScope=none`}var he=n(),Q=e(t(),1),$=r();function ge(e){let t=(0,he.c)(6),n=v(),r,i;if(t[0]!==n||t[1]!==e?(r=()=>{!n||e.embedded||!e.open||!e.attachment||(N.getState().openFile({attachment:e.attachment,images:e.images,conversationId:e.conversationId||void 0,resultRevision:e.resultRevision},n),e.onClose())},i=[n,e],t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,Q.useEffect)(r,i),n&&!e.embedded)return null;let a;return t[4]===e?a=t[5]:(a=(0,$.jsx)(_e,{...e}),t[4]=e,t[5]=a),a}function _e({open:e,embedded:t=!1,tabId:n,attachment:r,images:i=[],resultRevision:a,onAttachmentChange:s,authToken:h,conversationId:g,layerClassName:_=`z-[81]`,onClose:v}){let C=o(e=>e.language),E=c(C).chat,D=y({open:e,attachment:r,authToken:h,conversationId:g,language:C}),O=te(),{expanded:k,setExpanded:A}=x(e,O.dialogOpen),[j,M]=(0,Q.useState)(!1),{preview:N,fileType:F,hasExtractedText:I}=D,L=r?i.findIndex(e=>e===r||e.id&&e.id===r.id||e.uri&&e.uri===r.uri||!e.id&&!e.uri&&e.name===r.name&&!!e.data&&e.data===r.data):-1,R=F===`image`&&i.length>1&&L>=0&&!!s,z=e=>{if(!R||O.dialogOpen)return;let t=L+(e===`previous`?-1:1);t>=0&&t<i.length&&s?.(i[t])},ae=F!==`image`&&F!==`text`&&F!==`pptx`&&I,B=N?.uri?ee(N.uri):null,V=!!(B||N?.uri?.startsWith(`media://`)&&(g||N.taskId)),H=()=>{!N?.uri||!V||O.createShareLink(B?{fileId:B,fileName:N.name}:{uri:N.uri,conversationId:g??void 0,taskId:N.taskId,fileName:N.name})},U=!!(N&&!D.loading&&!D.loadError),W=()=>{A(!1),v()},G=()=>{if(!N||!D.downloadBuffer)return;let e=new Blob([D.downloadBuffer],{type:D.descriptor.mimeType}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=N.name??`download`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},K=!!D.downloadBuffer,q=ie()&&F===`spreadsheet`&&/\.xlsx?$/i.test(D.fileName)&&!!D.downloadBuffer&&!!window.electronAPI?.shell?.openTemporaryFile,J=async()=>{let e=D.downloadBuffer,t=window.electronAPI?.shell?.openTemporaryFile;if(!(!e||!t||j)){M(!0);try{(await t({fileName:D.fileName,data:new Uint8Array(e)})).ok||S(`warning`,E.attachmentPreviewOpenLocalFailed)}catch{S(`warning`,E.attachmentPreviewOpenLocalFailed)}finally{M(!1)}}},Y={onDownload:G,canDownload:K},X=T(`min-h-0 min-w-0 flex-1 cursor-pointer border-0 p-0`,`bg-surface-base transition-colors`,`hover:bg-surface-hover/90 dark:bg-black/60 dark:hover:bg-black/70`,P.focusRingBase),Z=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{header:{expanded:k,onToggleExpanded:U?()=>A(e=>!e):void 0,hideClose:t,onClose:W,share:V?{onClick:H,loading:O.loading}:void 0,openWithSystemApp:q?{onClick:()=>void J(),loading:j}:void 0,textView:ae?{active:D.showExtractedText,onChange:e=>{D.setShowExtractedText(e),D.clearLoadError()}}:void 0},chat:D.downloadBuffer?{conversationId:g,createFile:async()=>new File([D.downloadBuffer],D.fileName,{type:D.descriptor.mimeType})}:void 0,onImageSwipe:R?z:void 0,language:C,descriptor:n?{...D.descriptor,id:n}:D.descriptor,loading:D.loading,loadError:D.loadError,textContent:D.textContent,binaryBuffer:D.binaryBuffer,showExtractedText:D.showExtractedText,extractedText:D.extractedText,extractedTextTruncated:D.extractedTextTruncated,actions:Y}),a?(0,$.jsxs)(`p`,{className:`shrink-0 border-t border-edge px-4 py-2 text-xs text-fg-muted`,"data-result-revision":!0,children:[C===`zh`?`成果版本`:`Result version`,` `,a]}):null,R?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-4 border-t border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewPreviousImage,disabled:L===0,onClick:()=>z(`previous`),className:T(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,P.focusRingBase),children:(0,$.jsx)(p,{size:20,"aria-hidden":`true`})}),(0,$.jsxs)(`span`,{role:`status`,className:`min-w-16 text-center text-sm tabular-nums text-fg-muted`,children:[L+1,` / `,i.length]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewNextImage,disabled:L===i.length-1,onClick:()=>z(`next`),className:T(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,P.focusRingBase),children:(0,$.jsx)(m,{size:20,"aria-hidden":`true`})})]}):null]});return t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{expanded:k,children:Z}),(0,$.jsx)(w,{open:O.dialogOpen,onOpenChange:O.handleOpenChange,loading:O.loading,error:O.error,result:O.result,pendingParams:O.pendingParams,onConfirm:e=>void O.confirmShareLink(e)})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{open:e,onOpenChange:e=>!e&&W(),children:(0,$.jsx)(l,{children:(0,$.jsxs)(u,{"aria-describedby":void 0,onKeyDown:e=>{!R||O.dialogOpen||e.altKey||e.ctrlKey||e.metaKey||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),z(e.key===`ArrowLeft`?`previous`:`next`))},className:T(`xopc-dialog-content-fullscreen fixed inset-0 flex h-[100dvh] w-full flex-row overflow-hidden`,ne(),_,`border-0 bg-transparent p-0 shadow-none outline-none`),children:[(0,$.jsx)(d,{className:`sr-only`,children:N?.name??``}),(0,$.jsx)(`button`,{type:`button`,className:X,onClick:W,"aria-label":E.attachmentPreviewClose}),(0,$.jsx)(`div`,{className:T(`flex h-full min-h-0 shrink-0 flex-col overflow-hidden`,k?`w-full`:`w-[min(100%,var(--max-width-app-main))]`,`bg-surface-panel sm:border-x sm:border-edge dark:sm:border-edge`,`shadow-float dark:shadow-elevated`),children:Z}),(0,$.jsx)(`button`,{type:`button`,className:X,onClick:W,"aria-label":E.attachmentPreviewClose})]})})}),(0,$.jsx)(w,{open:O.dialogOpen,onOpenChange:O.handleOpenChange,loading:O.loading,error:O.error,result:O.result,pendingParams:O.pendingParams,onConfirm:e=>void O.confirmShareLink(e)})]})}function ve(e){let t=(0,he.c)(23),{attachments:n,conversationId:r,topPadded:i,onRemove:a,className:s}=e,l=o(ye),u;t[0]===l?u=t[1]:(u=c(l),t[0]=l,t[1]=u);let d=u.chat,[f,p]=(0,Q.useState)(null);if(n.length===0)return null;let m=i?`pt-2`:`pt-3`,_;t[2]!==s||t[3]!==m?(_=T(`flex flex-wrap gap-2 border-b border-edge-subtle/90 bg-surface-hover/20 px-4 pb-2 dark:border-edge-subtle`,m,s),t[2]=s,t[3]=m,t[4]=_):_=t[4];let v;if(t[5]!==n||t[6]!==d||t[7]!==a){let e;t[9]!==d||t[10]!==a?(e=(e,t)=>{let n=e.type===`pasted_text`?d.pastedText:e.name;return(0,$.jsxs)(`div`,{className:`flex max-w-[200px] items-center rounded-lg bg-surface-hover text-xs dark:bg-surface-hover/80`,children:[(0,$.jsxs)(`button`,{type:`button`,className:T(`flex min-w-0 flex-1 items-center gap-1.5 rounded-l-lg py-1 pl-2 pr-1 text-left hover:bg-surface-active`,P.transition,P.press,P.focusRingPanel),onClick:()=>p(e),"aria-label":`${d.attachmentPreviewOpen}: ${n}`,title:`${d.attachmentPreviewOpen}: ${n}`,children:[e.mimeType?.startsWith(`image/`)&&e.content?(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:``,className:`size-6 shrink-0 rounded object-cover`}):e.type===`voice`||e.mimeType?.startsWith(`audio/`)?(0,$.jsx)(C,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):e.type===`pasted_text`?(0,$.jsx)(h,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):(0,$.jsx)(g,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-disabled`,children:M(e.size)})]}),(0,$.jsx)(`button`,{type:`button`,className:T(`flex min-h-8 min-w-8 items-center justify-center rounded-r-lg text-fg-muted hover:bg-surface-active hover:text-fg`,P.transition,P.press,P.focusRingPanel),onClick:()=>a(t),"aria-label":`${d.attachmentPreviewRemove}: ${n}`,title:`${d.attachmentPreviewRemove}: ${n}`,children:(0,$.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e.id??`${e.name}-${e.size}-${e.mimeType}-${e.content?.slice(0,16)??``}`)},t[9]=d,t[10]=a,t[11]=e):e=t[11],v=n.map(e),t[5]=n,t[6]=d,t[7]=a,t[8]=v}else v=t[8];let y;t[12]!==_||t[13]!==v?(y=(0,$.jsx)(`div`,{className:_,children:v}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=f!==null,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>p(null),t[15]=x):x=t[15];let S;t[16]!==r||t[17]!==f||t[18]!==b?(S=(0,$.jsx)(ge,{open:b,attachment:f,conversationId:r,onClose:x}),t[16]=r,t[17]=f,t[18]=b,t[19]=S):S=t[19];let w;return t[20]!==y||t[21]!==S?(w=(0,$.jsxs)($.Fragment,{children:[y,S]}),t[20]=y,t[21]=S,t[22]=w):w=t[22],w}function ye(e){return e.language}function be(e){let{chat:t,initialAttachments:n=[],onAttachmentsChange:r}=e,[a,o]=(0,Q.useState)(n),[s,c]=(0,Q.useState)(!1),l=(0,Q.useRef)(null),u=(0,Q.useRef)(a),d=(0,Q.useRef)(r);u.current=a,d.current=r;let f=(0,Q.useCallback)(e=>{let t=typeof e==`function`?e(u.current):e;u.current=t,o(t),d.current?.(t)},[]),p=(0,Q.useCallback)(()=>{f([])},[]),m=(0,Q.useCallback)(e=>{f(t=>t.filter((t,n)=>n!==e))},[]),h=(0,Q.useCallback)(()=>u.current.map(e=>({type:e.type===`voice`?`voice`:e.type||`file`,mimeType:e.mimeType,data:e.content,name:e.name,size:e.size,...e.uri?{uri:e.uri}:{},...typeof e.durationSeconds==`number`&&Number.isFinite(e.durationSeconds)&&e.durationSeconds>0?{durationSeconds:e.durationSeconds}:{}})),[]),g=(0,Q.useCallback)(async(e,n)=>{if(e.length===0)return;let r=10-u.current.length;if(r<=0){S(`warning`,t.maxAttachmentsReached,{max:10});return}let a=e.slice(0,r);e.length>a.length&&S(`warning`,t.maxAttachmentsTruncated,{max:10,dropped:e.length-a.length});let{loadAttachment:o}=await i(async()=>{let{loadAttachment:e}=await import(`./attachment-load-DrVGNxJm.js`).then(e=>e.t);return{loadAttachment:e}},__vite__mapDeps([0,1,2])),s=(await Promise.all(a.map(async e=>{if(e.size>33554432)return S(`warning`,t.attachmentFileTooLarge,{name:e.name,maxSize:M(E)}),null;try{return await o(e,e.name)}catch{return S(`error`,t.attachmentLoadFailed,{name:e.name}),null}}))).filter(e=>e!==null).map(e=>n?{...e,type:n}:e);f(e=>[...e,...s])},[t.attachmentFileTooLarge,t.attachmentLoadFailed,t.maxAttachmentsReached,t.maxAttachmentsTruncated]),v=(0,Q.useCallback)(e=>g(e),[g]);return(0,Q.useEffect)(()=>{if(e.conversationId)return _(e.conversationId,async e=>{let t=u.current.length;return await g([e]),u.current.length>t})},[g,e.conversationId]),{attachments:a,setAttachments:f,attachmentsRef:u,isDragging:s,setIsDragging:c,fileInputRef:l,processFiles:v,processPastedText:(0,Q.useCallback)(e=>g([new File([e.text],e.name,{type:e.mimeType})],`pasted_text`),[g]),removeAttachment:m,clearAttachments:p,wireAttachmentsPayload:h}}export{V as C,z as D,oe as E,G as O,le as S,K as T,Y as _,de as a,J as b,fe as c,H as d,B as f,q as g,R as h,ue as i,W as k,ce as l,ae as m,ve as n,me as o,I as p,ge as r,pe as s,be as t,X as u,L as v,Z as w,se as x,U as y};
|
|
2
|
+
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"./preload-helper-Czpn1I53.js";import{i as a,n as o,o as s}from"./locale-store-CAZaC05J.js";import{t as c}from"./messages-C7fckbyG.js";import{o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{t as p}from"./chevron-left-DqFhpbvK.js";import{t as m}from"./chevron-right-BweFrslA.js";import{n as h,t as g}from"./file-BqMS_3DT.js";import{a as _,b as v,l as y,n as b,t as x,x as S}from"./use-file-preview-expanded-nd_CuFsd.js";import{t as C}from"./mic-CuUb7zc-.js";import{n as w}from"./share-link-dialog-CTATUaa4.js";import{t as T}from"./cn-0WouolD0.js";import{r as ee,t as E}from"./constants-DBtMsXdW.js";import{r as D}from"./tasks-DRmd6sWt.js";import{a as O,i as k,o as A}from"./capabilities-C7lnwKKm.js";import{t as j}from"./capabilities-DaeQXJT4.js";import{r as M}from"./attachment-utils-core-BIOUBrpT.js";import{a as te,n as ne,s as N,t as re}from"./file-preview-surface-BcLeaSNe.js";import{n as P}from"./interaction-BdhHBbYa.js";import{n as ie}from"./electron-env-DHOGevH3.js";import{i as F}from"./skill-wire-pattern-BPpeIcCi.js";async function I(e){return D.parse(await s(a(`/api/tasks`),{method:`POST`,body:JSON.stringify(e)}))}async function L(e){return j(`xopc.tasks.get`,{id:e})}async function R(e){return s(a(`/api/tasks/${encodeURIComponent(e)}/conversation`),{method:`POST`})}async function z(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,expectedVersion:n})}),L(e)}async function ae(e){await s(a(`/api/tasks/${encodeURIComponent(e)}`),{method:`DELETE`})}async function B(e,t,n,r=crypto.randomUUID(),i=`api`){return await s(a(`/api/tasks/${encodeURIComponent(e)}/commands`),{method:`POST`,body:JSON.stringify({idempotencyKey:r,expectedVersion:n,command:t,source:i})}),L(e)}async function V(e,t,n,r,i){return await s(a(`/api/tasks/${encodeURIComponent(e)}/criteria/${t}/review`),{method:`PUT`,body:JSON.stringify({status:n,expectedVersion:r,contractVersion:i})}),L(e)}async function H(e,t,n){return await s(a(`/api/task-runs/${encodeURIComponent(t)}/cancel`),{method:`POST`,body:JSON.stringify({expectedVersion:n,reason:`Cancelled by user`})}),L(e)}async function U(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/handoff`),{method:`POST`,body:JSON.stringify({toAgentId:t,expectedVersion:n,idempotencyKey:crypto.randomUUID()})}),L(e)}async function W(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/dependencies`),{method:`PUT`,body:JSON.stringify({dependsOnTaskIds:t,expectedVersion:n})}),L(e)}async function G(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/board-position`),{method:`PUT`,body:JSON.stringify({beforeTaskId:t,expectedVersion:n})}),L(e)}async function K(e,t,n){await s(a(`/api/task-runs/${encodeURIComponent(e)}/feedback`),{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({rating:t,reason:n?.trim()||void 0})})}function q(e,t=!1){let n=new URLSearchParams;return e&&n.set(`locale`,e),t&&n.set(`attention`,`all`),s(a(`/api/home${n.size?`?${n.toString()}`:``}`)).then(A)}function J(e){return s(a(`/api/home/advisor/refresh`),{method:`POST`,body:JSON.stringify({idempotencyKey:crypto.randomUUID(),locale:e})})}function Y(){return s(a(`/api/home/advisor/history`)).then(e=>O.parse(e))}async function X(e,t){return k.parse(await s(a(`/api/home/opportunities/${encodeURIComponent(e.id)}/action`),{method:`POST`,body:JSON.stringify({idempotencyKey:crypto.randomUUID(),expectedRevision:e.revision,mode:t})}))}function Z(e,t){let n=crypto.randomUUID();return s(a(`/api/home/opportunities/${encodeURIComponent(e.id)}/feedback`),{method:`POST`,body:JSON.stringify({...t,idempotencyKey:n,expectedRevision:e.revision})}).then(()=>({ok:!0,idempotencyKey:n}))}function oe(e,t){return s(a(`/api/home/opportunities/${encodeURIComponent(e)}/feedback/undo`),{method:`POST`,body:JSON.stringify({idempotencyKey:t})})}function se(e,t){return s(a(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function ce(e){return s(a(`/api/home/attention/acknowledge`),{method:`POST`,body:JSON.stringify(e)})}function le(e){return s(a(`/api/home/attention/retry`),{method:`POST`,body:JSON.stringify(e)})}function ue(e,t){let n=e.trim(),r=t.trim();return n&&F(n)?`/skill:${n}${r?` ${r}`:` `}`:r||null}function de(e,t,n){let r=e.trim(),i=t?.trim()??``;if(!r&&!i)return null;let a=new URLSearchParams;return r&&a.set(`draft`,r),a.set(`autoSend`,`1`),i&&a.set(`attachmentsHandoff`,i),n?.projectScope===`none`&&a.set(`projectScope`,`none`),`/chat/new?${a.toString()}`}function fe(e){let t=e.startsWith(`?`)?e.slice(1):e;if(!t)return``;let n=new URLSearchParams(t),r=new URLSearchParams,i=n.get(`skill`),a=n.get(`slash`),o=n.get(`draft`),s=n.get(`autoSend`),c=n.get(`attachmentHandoff`),l=n.get(`attachmentsHandoff`),u=n.get(`agentSetup`);i&&r.set(`skill`,i),a&&r.set(`slash`,a),o&&r.set(`draft`,o),s===`1`&&r.set(`autoSend`,`1`),c&&r.set(`attachmentHandoff`,c),l&&r.set(`attachmentsHandoff`,l),n.get(`setup`)===`automation`&&r.set(`setup`,`automation`),u===`1`&&r.set(`agentSetup`,`1`),n.get(`scene`)===`find-skills`&&r.set(`scene`,`find-skills`);let d=r.toString();return d?`?${d}`:``}function pe(e){let t=e.startsWith(`?`)?e.slice(1):e,n=new URLSearchParams(t),r=n.get(`projectId`)?.trim();return r?{kind:`project`,projectId:r}:n.get(`projectScope`)===`none`?{kind:`none`}:{kind:`remember-last`}}function me(e){let t=e?.trim();return t?`/chat/new?projectId=${encodeURIComponent(t)}`:`/chat/new?projectScope=none`}var he=n(),Q=e(t(),1),$=r();function ge(e){let t=(0,he.c)(6),n=v(),r,i;if(t[0]!==n||t[1]!==e?(r=()=>{!n||e.embedded||!e.open||!e.attachment||(N.getState().openFile({attachment:e.attachment,images:e.images,conversationId:e.conversationId||void 0,resultRevision:e.resultRevision},n),e.onClose())},i=[n,e],t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,Q.useEffect)(r,i),n&&!e.embedded)return null;let a;return t[4]===e?a=t[5]:(a=(0,$.jsx)(_e,{...e}),t[4]=e,t[5]=a),a}function _e({open:e,embedded:t=!1,tabId:n,attachment:r,images:i=[],resultRevision:a,onAttachmentChange:s,authToken:h,conversationId:g,layerClassName:_=`z-[81]`,onClose:v}){let C=o(e=>e.language),E=c(C).chat,D=y({open:e,attachment:r,authToken:h,conversationId:g,language:C}),O=te(),{expanded:k,setExpanded:A}=x(e,O.dialogOpen),[j,M]=(0,Q.useState)(!1),{preview:N,fileType:F,hasExtractedText:I}=D,L=r?i.findIndex(e=>e===r||e.id&&e.id===r.id||e.uri&&e.uri===r.uri||!e.id&&!e.uri&&e.name===r.name&&!!e.data&&e.data===r.data):-1,R=F===`image`&&i.length>1&&L>=0&&!!s,z=e=>{if(!R||O.dialogOpen)return;let t=L+(e===`previous`?-1:1);t>=0&&t<i.length&&s?.(i[t])},ae=F!==`image`&&F!==`text`&&F!==`pptx`&&I,B=N?.uri?ee(N.uri):null,V=!!(B||N?.uri?.startsWith(`media://`)&&(g||N.taskId)),H=()=>{!N?.uri||!V||O.createShareLink(B?{fileId:B,fileName:N.name}:{uri:N.uri,conversationId:g??void 0,taskId:N.taskId,fileName:N.name})},U=!!(N&&!D.loading&&!D.loadError),W=()=>{A(!1),v()},G=()=>{if(!N||!D.downloadBuffer)return;let e=new Blob([D.downloadBuffer],{type:D.descriptor.mimeType}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=N.name??`download`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},K=!!D.downloadBuffer,q=ie()&&F===`spreadsheet`&&/\.xlsx?$/i.test(D.fileName)&&!!D.downloadBuffer&&!!window.electronAPI?.shell?.openTemporaryFile,J=async()=>{let e=D.downloadBuffer,t=window.electronAPI?.shell?.openTemporaryFile;if(!(!e||!t||j)){M(!0);try{(await t({fileName:D.fileName,data:new Uint8Array(e)})).ok||S(`warning`,E.attachmentPreviewOpenLocalFailed)}catch{S(`warning`,E.attachmentPreviewOpenLocalFailed)}finally{M(!1)}}},Y={onDownload:G,canDownload:K},X=T(`min-h-0 min-w-0 flex-1 cursor-pointer border-0 p-0`,`bg-surface-base transition-colors`,`hover:bg-surface-hover/90 dark:bg-black/60 dark:hover:bg-black/70`,P.focusRingBase),Z=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{header:{expanded:k,onToggleExpanded:U?()=>A(e=>!e):void 0,hideClose:t,onClose:W,share:V?{onClick:H,loading:O.loading}:void 0,openWithSystemApp:q?{onClick:()=>void J(),loading:j}:void 0,textView:ae?{active:D.showExtractedText,onChange:e=>{D.setShowExtractedText(e),D.clearLoadError()}}:void 0},chat:D.downloadBuffer?{conversationId:g,createFile:async()=>new File([D.downloadBuffer],D.fileName,{type:D.descriptor.mimeType})}:void 0,onImageSwipe:R?z:void 0,language:C,descriptor:n?{...D.descriptor,id:n}:D.descriptor,loading:D.loading,loadError:D.loadError,textContent:D.textContent,binaryBuffer:D.binaryBuffer,showExtractedText:D.showExtractedText,extractedText:D.extractedText,extractedTextTruncated:D.extractedTextTruncated,actions:Y}),a?(0,$.jsxs)(`p`,{className:`shrink-0 border-t border-edge px-4 py-2 text-xs text-fg-muted`,"data-result-revision":!0,children:[C===`zh`?`成果版本`:`Result version`,` `,a]}):null,R?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-4 border-t border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewPreviousImage,disabled:L===0,onClick:()=>z(`previous`),className:T(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,P.focusRingBase),children:(0,$.jsx)(p,{size:20,"aria-hidden":`true`})}),(0,$.jsxs)(`span`,{role:`status`,className:`min-w-16 text-center text-sm tabular-nums text-fg-muted`,children:[L+1,` / `,i.length]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewNextImage,disabled:L===i.length-1,onClick:()=>z(`next`),className:T(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,P.focusRingBase),children:(0,$.jsx)(m,{size:20,"aria-hidden":`true`})})]}):null]});return t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{expanded:k,children:Z}),(0,$.jsx)(w,{open:O.dialogOpen,onOpenChange:O.handleOpenChange,loading:O.loading,error:O.error,result:O.result,pendingParams:O.pendingParams,onConfirm:e=>void O.confirmShareLink(e)})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{open:e,onOpenChange:e=>!e&&W(),children:(0,$.jsx)(l,{children:(0,$.jsxs)(u,{"aria-describedby":void 0,onKeyDown:e=>{!R||O.dialogOpen||e.altKey||e.ctrlKey||e.metaKey||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),z(e.key===`ArrowLeft`?`previous`:`next`))},className:T(`xopc-dialog-content-fullscreen fixed inset-0 flex h-[100dvh] w-full flex-row overflow-hidden`,ne(),_,`border-0 bg-transparent p-0 shadow-none outline-none`),children:[(0,$.jsx)(d,{className:`sr-only`,children:N?.name??``}),(0,$.jsx)(`button`,{type:`button`,className:X,onClick:W,"aria-label":E.attachmentPreviewClose}),(0,$.jsx)(`div`,{className:T(`flex h-full min-h-0 shrink-0 flex-col overflow-hidden`,k?`w-full`:`w-[min(100%,var(--max-width-app-main))]`,`bg-surface-panel sm:border-x sm:border-edge dark:sm:border-edge`,`shadow-float dark:shadow-elevated`),children:Z}),(0,$.jsx)(`button`,{type:`button`,className:X,onClick:W,"aria-label":E.attachmentPreviewClose})]})})}),(0,$.jsx)(w,{open:O.dialogOpen,onOpenChange:O.handleOpenChange,loading:O.loading,error:O.error,result:O.result,pendingParams:O.pendingParams,onConfirm:e=>void O.confirmShareLink(e)})]})}function ve(e){let t=(0,he.c)(23),{attachments:n,conversationId:r,topPadded:i,onRemove:a,className:s}=e,l=o(ye),u;t[0]===l?u=t[1]:(u=c(l),t[0]=l,t[1]=u);let d=u.chat,[f,p]=(0,Q.useState)(null);if(n.length===0)return null;let m=i?`pt-2`:`pt-3`,_;t[2]!==s||t[3]!==m?(_=T(`flex flex-wrap gap-2 border-b border-edge-subtle/90 bg-surface-hover/20 px-4 pb-2 dark:border-edge-subtle`,m,s),t[2]=s,t[3]=m,t[4]=_):_=t[4];let v;if(t[5]!==n||t[6]!==d||t[7]!==a){let e;t[9]!==d||t[10]!==a?(e=(e,t)=>{let n=e.type===`pasted_text`?d.pastedText:e.name;return(0,$.jsxs)(`div`,{className:`flex max-w-[200px] items-center rounded-lg bg-surface-hover text-xs dark:bg-surface-hover/80`,children:[(0,$.jsxs)(`button`,{type:`button`,className:T(`flex min-w-0 flex-1 items-center gap-1.5 rounded-l-lg py-1 pl-2 pr-1 text-left hover:bg-surface-active`,P.transition,P.press,P.focusRingPanel),onClick:()=>p(e),"aria-label":`${d.attachmentPreviewOpen}: ${n}`,title:`${d.attachmentPreviewOpen}: ${n}`,children:[e.mimeType?.startsWith(`image/`)&&e.content?(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:``,className:`size-6 shrink-0 rounded object-cover`}):e.type===`voice`||e.mimeType?.startsWith(`audio/`)?(0,$.jsx)(C,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):e.type===`pasted_text`?(0,$.jsx)(h,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):(0,$.jsx)(g,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-disabled`,children:M(e.size)})]}),(0,$.jsx)(`button`,{type:`button`,className:T(`flex min-h-8 min-w-8 items-center justify-center rounded-r-lg text-fg-muted hover:bg-surface-active hover:text-fg`,P.transition,P.press,P.focusRingPanel),onClick:()=>a(t),"aria-label":`${d.attachmentPreviewRemove}: ${n}`,title:`${d.attachmentPreviewRemove}: ${n}`,children:(0,$.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e.id??`${e.name}-${e.size}-${e.mimeType}-${e.content?.slice(0,16)??``}`)},t[9]=d,t[10]=a,t[11]=e):e=t[11],v=n.map(e),t[5]=n,t[6]=d,t[7]=a,t[8]=v}else v=t[8];let y;t[12]!==_||t[13]!==v?(y=(0,$.jsx)(`div`,{className:_,children:v}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=f!==null,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>p(null),t[15]=x):x=t[15];let S;t[16]!==r||t[17]!==f||t[18]!==b?(S=(0,$.jsx)(ge,{open:b,attachment:f,conversationId:r,onClose:x}),t[16]=r,t[17]=f,t[18]=b,t[19]=S):S=t[19];let w;return t[20]!==y||t[21]!==S?(w=(0,$.jsxs)($.Fragment,{children:[y,S]}),t[20]=y,t[21]=S,t[22]=w):w=t[22],w}function ye(e){return e.language}function be(e){let{chat:t,initialAttachments:n=[],onAttachmentsChange:r}=e,[a,o]=(0,Q.useState)(n),[s,c]=(0,Q.useState)(!1),l=(0,Q.useRef)(null),u=(0,Q.useRef)(a),d=(0,Q.useRef)(r);u.current=a,d.current=r;let f=(0,Q.useCallback)(e=>{let t=typeof e==`function`?e(u.current):e;u.current=t,o(t),d.current?.(t)},[]),p=(0,Q.useCallback)(()=>{f([])},[]),m=(0,Q.useCallback)(e=>{f(t=>t.filter((t,n)=>n!==e))},[]),h=(0,Q.useCallback)(()=>u.current.map(e=>({type:e.type===`voice`?`voice`:e.type||`file`,mimeType:e.mimeType,data:e.content,name:e.name,size:e.size,...e.uri?{uri:e.uri}:{},...typeof e.durationSeconds==`number`&&Number.isFinite(e.durationSeconds)&&e.durationSeconds>0?{durationSeconds:e.durationSeconds}:{}})),[]),g=(0,Q.useCallback)(async(e,n)=>{if(e.length===0)return;let r=10-u.current.length;if(r<=0){S(`warning`,t.maxAttachmentsReached,{max:10});return}let a=e.slice(0,r);e.length>a.length&&S(`warning`,t.maxAttachmentsTruncated,{max:10,dropped:e.length-a.length});let{loadAttachment:o}=await i(async()=>{let{loadAttachment:e}=await import(`./attachment-load-DrVGNxJm.js`).then(e=>e.t);return{loadAttachment:e}},__vite__mapDeps([0,1,2])),s=(await Promise.all(a.map(async e=>{if(e.size>33554432)return S(`warning`,t.attachmentFileTooLarge,{name:e.name,maxSize:M(E)}),null;try{return await o(e,e.name)}catch{return S(`error`,t.attachmentLoadFailed,{name:e.name}),null}}))).filter(e=>e!==null).map(e=>n?{...e,type:n}:e);f(e=>[...e,...s])},[t.attachmentFileTooLarge,t.attachmentLoadFailed,t.maxAttachmentsReached,t.maxAttachmentsTruncated]),v=(0,Q.useCallback)(e=>g(e),[g]);return(0,Q.useEffect)(()=>{if(e.conversationId)return _(e.conversationId,async e=>{let t=u.current.length;return await g([e]),u.current.length>t})},[g,e.conversationId]),{attachments:a,setAttachments:f,attachmentsRef:u,isDragging:s,setIsDragging:c,fileInputRef:l,processFiles:v,processPastedText:(0,Q.useCallback)(e=>g([new File([e.text],e.name,{type:e.mimeType})],`pasted_text`),[g]),removeAttachment:m,clearAttachments:p,wireAttachmentsPayload:h}}export{V as C,z as D,oe as E,G as O,le as S,K as T,Y as _,de as a,J as b,fe as c,H as d,B as f,q as g,R as h,ue as i,W as k,ce as l,ae as m,ve as n,me as o,I as p,ge as r,pe as s,be as t,X as u,L as v,Z as w,se as x,U as y};
|