@xopcai/xopc 0.0.456 → 0.0.459

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.
Files changed (312) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +5 -1
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-DYwR1u3f.js → activity-store-CQHh48Zf.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CsRBprL-.js → agent-avatar-dicebear-CAz-Ke6Q.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-display-DqFYHXCS.js → agent-avatar-display-loBdGw_i.js} +2 -2
  7. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DOAJrMLe.js → agent-defaults-settings-panel-By2Q-6JS.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agent-plugin-dialog-vqlN3ORH.js → agent-plugin-dialog-CikzCYAG.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agents-BgHlOVRV.js → agents-CGUdvmIT.js} +3 -3
  10. package/dist/gateway/static/root/assets/{agents-admin-api-CKscfdvA.js → agents-admin-api-D0N09mqJ.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-CHM2c_Ah.js → api-B1J5ajiP.js} +1 -1
  12. package/dist/gateway/static/root/assets/{api-DPNeNCmR.js → api-B4FJ51EC.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-Bhz6bj1C.js → app-management-settings-panel-BHlUDZOG.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-BX32aogA.js → appearance-settings-Du5JLyV1.js} +1 -1
  15. package/dist/gateway/static/root/assets/{apps-page-0Yo3jBsQ.js → apps-page-M2XD1Pzu.js} +1 -1
  16. package/dist/gateway/static/root/assets/{archive-plugin-Bha8obMe.js → archive-plugin-BAvglLfu.js} +1 -1
  17. package/dist/gateway/static/root/assets/{automation-api-mn8ihWJ_.js → automation-api-DxBmyzp0.js} +1 -1
  18. package/dist/gateway/static/root/assets/automation-display-DaVDNZz8.js +2 -0
  19. package/dist/gateway/static/root/assets/{automation-result-state-COzakzak.js → automation-result-state-CAsqgMNR.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automation-run-list-BhtaMpTb.js → automation-run-list-BmYeWB_N.js} +1 -1
  21. package/dist/gateway/static/root/assets/automation-task-card-CiJmJ7_h.js +2 -0
  22. package/dist/gateway/static/root/assets/{automations-page-CgQDpSpK.js → automations-page-CVjgENMO.js} +1 -1
  23. package/dist/gateway/static/root/assets/automations-workspace-CGPWyL0P.js +9 -0
  24. package/dist/gateway/static/root/assets/{binary-plugins-DUbrJFLU.js → binary-plugins-D2bFqG6K.js} +1 -1
  25. package/dist/gateway/static/root/assets/{block-editor-DW--pXAc.js → block-editor-CmnkluMF.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-settings-page-CDh6nxs9.js → browser-settings-page-CGcgZOWh.js} +1 -1
  27. package/dist/gateway/static/root/assets/capabilities-DB713nRi.js +1 -0
  28. package/dist/gateway/static/root/assets/{capabilities-DKbXv8Ck.js → capabilities-DDqDvCBs.js} +1 -1
  29. package/dist/gateway/static/root/assets/capabilities-page-D2hq4cgE.js +2 -0
  30. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BW5jQz5R.js → capabilities-settings-panel-CvF8VRTv.js} +1 -1
  31. package/dist/gateway/static/root/assets/{channels-BzZp42yO.js → channels-BDVQ6Z7A.js} +1 -1
  32. package/dist/gateway/static/root/assets/{chat-agents-api-UOdNWZ0_.js → chat-agents-api-CjlzCSmC.js} +1 -1
  33. package/dist/gateway/static/root/assets/{chat-chart-block-NSy-B0NS.js → chat-chart-block-stPJEZ90.js} +1 -1
  34. package/dist/gateway/static/root/assets/chat-page-BhPw56Vc.js +71 -0
  35. package/dist/gateway/static/root/assets/{chat-terminal-dock-CAaHWS7F.js → chat-terminal-dock-B4uA_W6R.js} +1 -1
  36. package/dist/gateway/static/root/assets/{command-palette-api-Dkn9bbYd.js → command-palette-api-CP0F6sIm.js} +1 -1
  37. package/dist/gateway/static/root/assets/{composer-model-config-control-BrK8-SNz.js → composer-model-config-control-DAagrRx_.js} +1 -1
  38. package/dist/gateway/static/root/assets/{composer-notifications-B-kL3qAA.js → composer-notifications-CqV6Xj-H.js} +1 -1
  39. package/dist/gateway/static/root/assets/composer-payload-handoff-Dc43dgSg.js +1 -0
  40. package/dist/gateway/static/root/assets/{computer-settings-page-C9KdEecx.js → computer-settings-page-f-vcEpeF.js} +1 -1
  41. package/dist/gateway/static/root/assets/{connected-providers-grid-D_8v6Qex.js → connected-providers-grid-CZ-FXxaW.js} +1 -1
  42. package/dist/gateway/static/root/assets/{connection-usage-guide-CiVpcbds.js → connection-usage-guide-Cibh2lrV.js} +1 -1
  43. package/dist/gateway/static/root/assets/{connector-service-page-B919cKSm.js → connector-service-page-Btz68iy8.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connectors-api-CgsSm-Av.js → connectors-api-CTuVWwBf.js} +1 -1
  45. package/dist/gateway/static/root/assets/connectors-page-DyzDVVfz.js +1 -0
  46. package/dist/gateway/static/root/assets/{date-picker-dx284jQI.js → date-picker-XnE3iFhG.js} +1 -1
  47. package/dist/gateway/static/root/assets/{date-time-picker-Dj-bhLNP.js → date-time-picker-VGKm0HVn.js} +1 -1
  48. package/dist/gateway/static/root/assets/{desktop-pet-Cn1TfGz4.js → desktop-pet-CBm3DySQ.js} +1 -1
  49. package/dist/gateway/static/root/assets/{desktop-pet-settings-CsmrvoxU.js → desktop-pet-settings-6O77QXGo.js} +1 -1
  50. package/dist/gateway/static/root/assets/{dev-view-store-BOxbj1ie.js → dev-view-store-B8fGILny.js} +1 -1
  51. package/dist/gateway/static/root/assets/{device-pairing-wizard-CAqFIFRC.js → device-pairing-wizard-qtUvtdDT.js} +1 -1
  52. package/dist/gateway/static/root/assets/{directory-picker-path-field-BxEw5OrT.js → directory-picker-path-field-ByDqf5fE.js} +1 -1
  53. package/dist/gateway/static/root/assets/{discussion-annotation-sync-CyntTwIa.js → discussion-annotation-sync-fwPPMPv9.js} +1 -1
  54. package/dist/gateway/static/root/assets/{extension-authoritative-grants-C0ReZguU.js → extension-authoritative-grants-BfL8dMBf.js} +1 -1
  55. package/dist/gateway/static/root/assets/{extension-debug-page-Cd3HMUbi.js → extension-debug-page-BPwRrP3L.js} +1 -1
  56. package/dist/gateway/static/root/assets/{extension-iframe-host-DiIqM2JO.js → extension-iframe-host-DIH4TcdH.js} +1 -1
  57. package/dist/gateway/static/root/assets/{extension-marketplace-api-CK5CMKTs.js → extension-marketplace-api-BIzkukYp.js} +1 -1
  58. package/dist/gateway/static/root/assets/{extension-message-router-Dn8JzOdR.js → extension-message-router-C9JDpo_7.js} +1 -1
  59. package/dist/gateway/static/root/assets/{extension-page-CLZtAtqm.js → extension-page-CLDoL5N8.js} +1 -1
  60. package/dist/gateway/static/root/assets/{extension-provider-CbVokTvd.js → extension-provider-BPIoHw4r.js} +1 -1
  61. package/dist/gateway/static/root/assets/{extension-settings-page-BM79cwUy.js → extension-settings-page-BO_UKeG8.js} +1 -1
  62. package/dist/gateway/static/root/assets/file-preview-surface-i5UOFnQF.js +1 -0
  63. package/dist/gateway/static/root/assets/{gateway-config-swr-OGhON-s6.js → gateway-config-swr-1Rk0LeEM.js} +1 -1
  64. package/dist/gateway/static/root/assets/{gateway-realtime-B9u4uSXW.js → gateway-realtime-DIs1pjkQ.js} +1 -1
  65. package/dist/gateway/static/root/assets/gateway-realtime-store-sx7B8kdC.js +1 -0
  66. package/dist/gateway/static/root/assets/{gateway-restart-DKAweWmg.js → gateway-restart-DTmlcJps.js} +1 -1
  67. package/dist/gateway/static/root/assets/{gateway-settings-Dc7qUbG-.js → gateway-settings-ClcCloqQ.js} +1 -1
  68. package/dist/gateway/static/root/assets/{gateway-startup-retry-BaaoKBoB.js → gateway-startup-retry-D6WPS0RW.js} +1 -1
  69. package/dist/gateway/static/root/assets/{global-defaults-api-BIr3ApRj.js → global-defaults-api-BpDMnJe7.js} +1 -1
  70. package/dist/gateway/static/root/assets/home-page-BPPe4JXB.js +7 -0
  71. package/dist/gateway/static/root/assets/{image-generation-api-C7D2IetZ.js → image-generation-api-sbtx4NiC.js} +1 -1
  72. package/dist/gateway/static/root/assets/{imports-page-BjEdZJxZ.js → imports-page-CBlaxUhl.js} +1 -1
  73. package/dist/gateway/static/root/assets/index-D0_qnBzh.css +1 -0
  74. package/dist/gateway/static/root/assets/index-Hv71yddc.js +11 -0
  75. package/dist/gateway/static/root/assets/{install-connector-dialog-BsiyYQhx.js → install-connector-dialog-DxSv1wS2.js} +1 -1
  76. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CIthQ1lp.js → keyboard-shortcuts-settings-CnAV96nr.js} +1 -1
  77. package/dist/gateway/static/root/assets/{local-app-workbench-page-CSCIHvZV.js → local-app-workbench-page-D8oqDDAn.js} +1 -1
  78. package/dist/gateway/static/root/assets/{local-apps-page-EntiM0tz.js → local-apps-page-BI3Be5qo.js} +1 -1
  79. package/dist/gateway/static/root/assets/{local-session-drafts-XurtjR58.js → local-session-drafts-BIBHRkpM.js} +2 -2
  80. package/dist/gateway/static/root/assets/{locale-store-cg9cm2EL.js → locale-store-Dy1EByeG.js} +1 -1
  81. package/dist/gateway/static/root/assets/{logs-page-rmS9VSem.js → logs-page-CMW34T31.js} +1 -1
  82. package/dist/gateway/static/root/assets/{management-api-B6jVuJ6W.js → management-api-B5w5DdXH.js} +1 -1
  83. package/dist/gateway/static/root/assets/{management-settings-DdI9gs51.js → management-settings-DfcMIqbQ.js} +1 -1
  84. package/dist/gateway/static/root/assets/{markdown-view-D1zBWkfB.js → markdown-view-BlxIaCCQ.js} +1 -1
  85. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-Bn49Ph1n.js → mcp-conversation-setup-page-CsTSmjmX.js} +1 -1
  86. package/dist/gateway/static/root/assets/{media-plugins-Cd6hAGDp.js → media-plugins-DGhWjPIU.js} +1 -1
  87. package/dist/gateway/static/root/assets/messages-BAnhwALN.js +3 -0
  88. package/dist/gateway/static/root/assets/{model-selector-CL6WT-jw.js → model-selector-C-CqPBao.js} +1 -1
  89. package/dist/gateway/static/root/assets/{models-hub-cache-s0FMNhq9.js → models-hub-cache-Bgh3Gfgl.js} +1 -1
  90. package/dist/gateway/static/root/assets/{note-detail-panel-C6s0WlNL.js → note-detail-panel-DLPwJGh0.js} +3 -3
  91. package/dist/gateway/static/root/assets/note-image-lightbox-CqK_uJ6Y.js +1 -0
  92. package/dist/gateway/static/root/assets/{notes-api-CR75RHd0.js → notes-api-CdXA-g9r.js} +1 -1
  93. package/dist/gateway/static/root/assets/{notes-page-CR7dNVDi.js → notes-page-DpfN5bZZ.js} +1 -1
  94. package/dist/gateway/static/root/assets/{oauth-api-CvPnQTlH.js → oauth-api-B560CHeD.js} +1 -1
  95. package/dist/gateway/static/root/assets/{oauth-provider-connect-Dk1NeeqD.js → oauth-provider-connect-D63M8Iv7.js} +1 -1
  96. package/dist/gateway/static/root/assets/{page-context-capture-button-BPtX67hZ.js → page-context-capture-button-Dibmspef.js} +1 -1
  97. package/dist/gateway/static/root/assets/{page-context-draft-Ckb8baxj.js → page-context-draft-Cr5GqS2D.js} +1 -1
  98. package/dist/gateway/static/root/assets/page-header-store-Bm8oxpFR.js +1 -0
  99. package/dist/gateway/static/root/assets/{personal-avatar-CZSnrSfc.js → personal-avatar-BMRVyTrE.js} +1 -1
  100. package/dist/gateway/static/root/assets/{personal-page-C89kLOIL.js → personal-page-BBGjwkAC.js} +1 -1
  101. package/dist/gateway/static/root/assets/{personal-profile-settings-DJRDcK2c.js → personal-profile-settings-HMQY9lz9.js} +1 -1
  102. package/dist/gateway/static/root/assets/{personal-settings-panel-C6p25Noq.js → personal-settings-panel-BppxtWBl.js} +1 -1
  103. package/dist/gateway/static/root/assets/{phone-dependencies-card-DKkFFpqi.js → phone-dependencies-card-flTci8mm.js} +1 -1
  104. package/dist/gateway/static/root/assets/{phone-model-connection-CRRHq4PQ.js → phone-model-connection-Vi_Swyv6.js} +1 -1
  105. package/dist/gateway/static/root/assets/{phone-model-picker-CN_I0-46.js → phone-model-picker-BOv3mb_F.js} +1 -1
  106. package/dist/gateway/static/root/assets/{phone-settings-page-CkdSOA7D.js → phone-settings-page-vD0bTcHj.js} +1 -1
  107. package/dist/gateway/static/root/assets/{phone-workspace-store-CC61pIuJ.js → phone-workspace-store-Ltrevdsx.js} +1 -1
  108. package/dist/gateway/static/root/assets/{plugin-details-dialog-Bqz4jT53.js → plugin-details-dialog-nSDw8sfo.js} +1 -1
  109. package/dist/gateway/static/root/assets/{preference-select-fields-DHeNbAvn.js → preference-select-fields-D1pZekPs.js} +1 -1
  110. package/dist/gateway/static/root/assets/{product-automation-feedback-BN2HTA9T.js → product-automation-feedback-D51I7Lg3.js} +1 -1
  111. package/dist/gateway/static/root/assets/{product-open-page-B-j4gpLD.js → product-open-page-BO8lUvw3.js} +1 -1
  112. package/dist/gateway/static/root/assets/product-preview-content-WkF2j_c-.js +1 -0
  113. package/dist/gateway/static/root/assets/{product-preview-modal-aurFBFq4.js → product-preview-modal-DMHOKocl.js} +2 -2
  114. package/dist/gateway/static/root/assets/{project-detail-page-sHcdluTm.js → project-detail-page-Dj_PuT7k.js} +2 -2
  115. package/dist/gateway/static/root/assets/{project-understanding-HNK9lFVy.js → project-understanding-Cg8WbBNB.js} +1 -1
  116. package/dist/gateway/static/root/assets/{projects-page-CugSyKl5.js → projects-page-C6Pt6OdT.js} +1 -1
  117. package/dist/gateway/static/root/assets/{providers-api-DUntOOqr.js → providers-api-Nytkkop9.js} +1 -1
  118. package/dist/gateway/static/root/assets/{recording-upload-DIwP541B.js → recording-upload-CyZSl2DJ.js} +1 -1
  119. package/dist/gateway/static/root/assets/{registry-api-BTd_OgbD.js → registry-api-DuDIthjL.js} +1 -1
  120. package/dist/gateway/static/root/assets/{remote-access-hub-f5mIfsBF.js → remote-access-hub-DePwafOK.js} +1 -1
  121. package/dist/gateway/static/root/assets/{resource-unavailable-DtQ2rfu_.js → resource-unavailable-BRKhKJA0.js} +1 -1
  122. package/dist/gateway/static/root/assets/right-workspace-store-HPw7Gw0n.js +1 -0
  123. package/dist/gateway/static/root/assets/route-preload-gas8e1we.js +2 -0
  124. package/dist/gateway/static/root/assets/routine-panel-CXs4PjW0.js +2 -0
  125. package/dist/gateway/static/root/assets/{runtime-tools-api-C1iI8EPo.js → runtime-tools-api-Dd8a07eo.js} +1 -1
  126. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-0tdI1z0g.js → runtime-tools-settings-panel-CvHQoqHu.js} +1 -1
  127. package/dist/gateway/static/root/assets/service-recommendation-list-DDlMyPvC.js +1 -0
  128. package/dist/gateway/static/root/assets/{session-api-CQlEq0MB.js → session-api-BFiIYodK.js} +1 -1
  129. package/dist/gateway/static/root/assets/{session-manager-C7RfUfqI.js → session-manager-D2LaQymu.js} +2 -2
  130. package/dist/gateway/static/root/assets/{sessions-page-DdS8U0RV.js → sessions-page-DQEq_VJS.js} +1 -1
  131. package/dist/gateway/static/root/assets/settings-advanced-gate-Cvx7DnU8.js +1 -0
  132. package/dist/gateway/static/root/assets/{settings-advanced-section-C6dPu5i1.js → settings-advanced-section-B-H1gYOs.js} +1 -1
  133. package/dist/gateway/static/root/assets/{settings-mode-store-BSiiowQa.js → settings-mode-store-YH60sibB.js} +1 -1
  134. package/dist/gateway/static/root/assets/{settings-page-C4CYw21O.js → settings-page-D2qkIrUg.js} +1 -1
  135. package/dist/gateway/static/root/assets/{settings-page-header-BSMu5Zq3.js → settings-page-header-DEZZ8D0S.js} +1 -1
  136. package/dist/gateway/static/root/assets/{settings-page-layout-B_vMffB1.js → settings-page-layout-De2j64Lo.js} +1 -1
  137. package/dist/gateway/static/root/assets/{setup-interaction-page-DKXfFdNt.js → setup-interaction-page-Dh6BPwv0.js} +1 -1
  138. package/dist/gateway/static/root/assets/{setup-status-panel-BbAZ9w77.js → setup-status-panel-DGAAczL-.js} +1 -1
  139. package/dist/gateway/static/root/assets/{share-link-dialog-ztX1WPXG.js → share-link-dialog-C1t_HB6f.js} +1 -1
  140. package/dist/gateway/static/root/assets/{share-preview-page-Ds2Ydfg6.js → share-preview-page-fV5USZb1.js} +1 -1
  141. package/dist/gateway/static/root/assets/{shares-api-CSZqeNL4.js → shares-api-Dm07CnXw.js} +1 -1
  142. package/dist/gateway/static/root/assets/{shares-settings-CX3TNAmI.js → shares-settings-sl40lqND.js} +1 -1
  143. package/dist/gateway/static/root/assets/{skill-api-CGzAQ-MX.js → skill-api-BV8oFqeE.js} +1 -1
  144. package/dist/gateway/static/root/assets/{skill-list-api-DfUsku-x.js → skill-list-api-1o_YRCu9.js} +1 -1
  145. package/dist/gateway/static/root/assets/{skill-reload-api-Y9qSMnBd.js → skill-reload-api-fGsO9Y86.js} +1 -1
  146. package/dist/gateway/static/root/assets/{skills-page-DnMN50Ot.js → skills-page-FTd0Z7Ey.js} +1 -1
  147. package/dist/gateway/static/root/assets/{system-settings-panel-DWNkQmme.js → system-settings-panel-CUI6QHEP.js} +1 -1
  148. package/dist/gateway/static/root/assets/task-detail-page-_5TEldtl.js +3 -0
  149. package/dist/gateway/static/root/assets/task-result-evidence-CSJeB9AH.js +1 -0
  150. package/dist/gateway/static/root/assets/{terminal-panel-store-D8eZPvql.js → terminal-panel-store-Du53Upr2.js} +1 -1
  151. package/dist/gateway/static/root/assets/{theme-store-GZQ3pTgy.js → theme-store-BaWep_o7.js} +1 -1
  152. package/dist/gateway/static/root/assets/{tracing-settings-page-DM3-7Hlw.js → tracing-settings-page-CnciBMVH.js} +1 -1
  153. package/dist/gateway/static/root/assets/{tunnel-api-DOGAIXRR.js → tunnel-api-Iz7JCBt3.js} +1 -1
  154. package/dist/gateway/static/root/assets/{understanding-activity-store-CuPfe0eQ.js → understanding-activity-store-BFc8PamJ.js} +1 -1
  155. package/dist/gateway/static/root/assets/{understanding-refresh-store-CIpGYSl0.js → understanding-refresh-store-CdEfR40A.js} +1 -1
  156. package/dist/gateway/static/root/assets/{usage-page-BA9Yrvqu.js → usage-page-DL2fmeOh.js} +1 -1
  157. package/dist/gateway/static/root/assets/{use-autosave-CO0IPCVg.js → use-autosave-N_SjHXTw.js} +1 -1
  158. package/dist/gateway/static/root/assets/use-composer-attachments-CO7XLI4x.js +2 -0
  159. package/dist/gateway/static/root/assets/{use-file-preview-expanded-dhNMHf5b.js → use-file-preview-expanded-BXXeXnT0.js} +3 -3
  160. package/dist/gateway/static/root/assets/{use-personal-profile-CVqDWBDS.js → use-personal-profile-C1vqD9yV.js} +1 -1
  161. package/dist/gateway/static/root/assets/{use-realtime-voice-DDVVlX1R.js → use-realtime-voice-C7iWQuUv.js} +1 -1
  162. package/dist/gateway/static/root/assets/{use-workspace-tree-CZej8mhf.js → use-workspace-tree-D27u-eoX.js} +1 -1
  163. package/dist/gateway/static/root/assets/{user-model-page-Bbi2MpIS.js → user-model-page-D2FHjLi7.js} +1 -1
  164. package/dist/gateway/static/root/assets/{voice-api-key-field-DpwUDAvu.js → voice-api-key-field-B_GApUQP.js} +1 -1
  165. package/dist/gateway/static/root/assets/{voice-config-api-GIuXoHXw.js → voice-config-api-DhJ3l8fk.js} +1 -1
  166. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-Cc30ZcFy.js → voice-input-shortcut-events-CEeFBhp3.js} +1 -1
  167. package/dist/gateway/static/root/assets/{voice-settings-DA3m5MT0.js → voice-settings-BiqJ0tlf.js} +1 -1
  168. package/dist/gateway/static/root/assets/{work-discovery-overlay-yGUkk1NV.js → work-discovery-overlay-UvWbDUXi.js} +1 -1
  169. package/dist/gateway/static/root/assets/{work-discovery-page-RN6iuY-0.js → work-discovery-page-BM1HsYz6.js} +1 -1
  170. package/dist/gateway/static/root/assets/{working-directory-picker-modal-CeXl9w6z.js → working-directory-picker-modal-BGZduAXV.js} +1 -1
  171. package/dist/gateway/static/root/assets/{workspace-api-B1Uirhxf.js → workspace-api-LghfbP5g.js} +2 -2
  172. package/dist/gateway/static/root/assets/workspace-editor-agent-store-DVPJcbuE.js +1 -0
  173. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-NffP-UXC.js +1 -0
  174. package/dist/gateway/static/root/assets/{workspace-open-location-menu-DWGNOIE2.js → workspace-open-location-menu-CvZxU9de.js} +1 -1
  175. package/dist/gateway/static/root/assets/workspace-preview-store-Do31QQH5.js +1 -0
  176. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-x-XT4bKF.js → xopc-cloud-account-card-Q_jezTUy.js} +1 -1
  177. package/dist/gateway/static/root/index.html +92 -90
  178. package/dist/package.js +1 -1
  179. package/dist/packages/gateway-contract/src/automations.js +6 -0
  180. package/dist/packages/gateway-contract/src/capabilities.js +1 -1
  181. package/dist/packages/gateway-contract/src/home.js +3 -0
  182. package/dist/packages/gateway-contract/src/index.js +3 -1
  183. package/dist/packages/gateway-contract/src/observation.js +177 -0
  184. package/dist/packages/gateway-contract/src/session-input-command.js +5 -1
  185. package/dist/src/agent/agent-manager.js +1 -1
  186. package/dist/src/agent/background-review/run-background-review.js +1 -1
  187. package/dist/src/agent/client-error-format.js +1 -1
  188. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
  189. package/dist/src/agent/embedded/execution-tool-policy.js +31 -5
  190. package/dist/src/agent/embedded/run-for-session.js +16 -8
  191. package/dist/src/agent/embedded/run-turn.js +65 -29
  192. package/dist/src/agent/embedded/types.d.ts +2 -0
  193. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  194. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  195. package/dist/src/agent/external-tools/endpoint-provider.js +3 -3
  196. package/dist/src/agent/fallback/reason.js +1 -1
  197. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +5 -0
  198. package/dist/src/agent/orchestration/llm-turn-retry.js +17 -6
  199. package/dist/src/agent/service.js +1 -1
  200. package/dist/src/agent/skills/index.js +1 -1
  201. package/dist/src/agent/skills/managed-store.js +1 -1
  202. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  203. package/dist/src/agent/tools/personal-memory-tool.js +1 -1
  204. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  205. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  206. package/dist/src/agent-catalog/capabilities.js +2 -2
  207. package/dist/src/agent-catalog/repository.js +1 -1
  208. package/dist/src/automations/api/routes.js +2 -2
  209. package/dist/src/automations/capabilities/drafts.js +1 -1
  210. package/dist/src/automations/capabilities/write.d.ts +10 -0
  211. package/dist/src/automations/capabilities/write.js +1 -1
  212. package/dist/src/automations/configuration-conversation.js +1 -1
  213. package/dist/src/automations/domain/types.d.ts +14 -0
  214. package/dist/src/automations/domain/validation.d.ts +20 -0
  215. package/dist/src/automations/domain/validation.js +6 -0
  216. package/dist/src/automations/draft/automation-draft-validator.d.ts +5 -0
  217. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  218. package/dist/src/automations/index.js +2 -2
  219. package/dist/src/automations/service/action-executor.d.ts +2 -0
  220. package/dist/src/automations/service/action-executor.js +18 -2
  221. package/dist/src/automations/service/index.js +2 -2
  222. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  223. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  224. package/dist/src/capabilities/runtime/product.js +1 -1
  225. package/dist/src/cli/commands/agents.js +1 -1
  226. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  227. package/dist/src/cli/commands/models.js +1 -1
  228. package/dist/src/cli/commands/onboard/model.js +1 -1
  229. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  230. package/dist/src/computer/endpoint-transport.js +1 -1
  231. package/dist/src/config/agent-profile.js +1 -1
  232. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  233. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  234. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  235. package/dist/src/gateway/agents-admin.js +2 -2
  236. package/dist/src/gateway/global-defaults-admin.js +1 -1
  237. package/dist/src/gateway/hono/routes/agents.js +1 -1
  238. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  239. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  240. package/dist/src/gateway/hono/routes/home.js +100 -2
  241. package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
  242. package/dist/src/gateway/hono/routes/notes.js +2 -2
  243. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  244. package/dist/src/gateway/hono/routes/projects.js +2 -2
  245. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  246. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  247. package/dist/src/gateway/image-generation-setup.js +1 -1
  248. package/dist/src/gateway/security/gateway-scopes.js +1 -0
  249. package/dist/src/gateway/service.js +21 -4
  250. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  251. package/dist/src/home-intelligence/application-service.d.ts +1 -0
  252. package/dist/src/home-intelligence/application-service.js +1 -1
  253. package/dist/src/home-intelligence/generator.js +4 -0
  254. package/dist/src/home-intelligence/host.d.ts +157 -1
  255. package/dist/src/home-intelligence/host.js +198 -14
  256. package/dist/src/home-intelligence/observation.d.ts +41 -0
  257. package/dist/src/home-intelligence/observation.js +297 -0
  258. package/dist/src/home-intelligence/repository.d.ts +1 -1
  259. package/dist/src/home-intelligence/routines.d.ts +36 -0
  260. package/dist/src/home-intelligence/routines.js +444 -0
  261. package/dist/src/home-intelligence/snapshot.d.ts +14 -0
  262. package/dist/src/imports/importService.js +1 -1
  263. package/dist/src/local-apps/automation-proposals.d.ts +20 -0
  264. package/dist/src/local-apps/automation-proposals.js +1 -1
  265. package/dist/src/local-apps/capabilities/automation-policy.js +1 -1
  266. package/dist/src/local-apps/capabilities/delegate.js +3 -3
  267. package/dist/src/local-apps/p1-services.js +1 -1
  268. package/dist/src/local-apps/service.js +1 -1
  269. package/dist/src/personal-agent/proactivity/repository.d.ts +1 -1
  270. package/dist/src/personal-agent/service.js +1 -1
  271. package/dist/src/providers/model-catalog-persistence.js +1 -1
  272. package/dist/src/providers/model-response.js +1 -1
  273. package/dist/src/realtime/compact-run-event.js +9 -0
  274. package/dist/src/runtime-tools/archive.js +1 -1
  275. package/dist/src/storage/sqlite/conversation-repository.js +4 -1
  276. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  277. package/dist/src/storage/sqlite/schema.js +7 -7
  278. package/dist/src/storage/sqlite/schema.sql +71 -0
  279. package/dist/src/storage/sqlite/session-input-control-repository.js +2 -0
  280. package/dist/src/storage/sqlite/upgrades/272_home_observation.sql +41 -0
  281. package/dist/src/storage/sqlite/upgrades/273_observation_routines.sql +30 -0
  282. package/dist/src/tasks/capabilities/read.js +2 -2
  283. package/dist/src/tasks/capabilities/write.js +1 -1
  284. package/dist/src/tasks/home-query-service.js +1 -0
  285. package/dist/src/tui/backends/embedded-backend.js +1 -1
  286. package/dist/src/voice/realtime/persona-context.js +1 -1
  287. package/package.json +2 -2
  288. package/dist/gateway/static/root/assets/automation-task-card-BY_k6iWp.js +0 -3
  289. package/dist/gateway/static/root/assets/automations-workspace-CWEDraTP.js +0 -9
  290. package/dist/gateway/static/root/assets/calendar-clock-D-quYVPe.js +0 -1
  291. package/dist/gateway/static/root/assets/capabilities-kG175Q-7.js +0 -1
  292. package/dist/gateway/static/root/assets/capabilities-page-D1wQ2sPI.js +0 -2
  293. package/dist/gateway/static/root/assets/chat-page-BjYumhaI.js +0 -71
  294. package/dist/gateway/static/root/assets/composer-payload-handoff-DBE1mvOS.js +0 -1
  295. package/dist/gateway/static/root/assets/connectors-page-CEpfDCLA.js +0 -1
  296. package/dist/gateway/static/root/assets/file-preview-surface-z7_HV0WN.js +0 -1
  297. package/dist/gateway/static/root/assets/gateway-realtime-store-xB7Bq4Zs.js +0 -1
  298. package/dist/gateway/static/root/assets/home-page-i_PIrDCU.js +0 -3
  299. package/dist/gateway/static/root/assets/index-DBlVVXOA.js +0 -11
  300. package/dist/gateway/static/root/assets/index-DpkEeFEQ.css +0 -1
  301. package/dist/gateway/static/root/assets/messages-eQ2CYlpG.js +0 -3
  302. package/dist/gateway/static/root/assets/note-image-lightbox-DfK2KSgu.js +0 -1
  303. package/dist/gateway/static/root/assets/page-header-store-DU4NnGap.js +0 -1
  304. package/dist/gateway/static/root/assets/product-preview-content-EqrTk7kU.js +0 -1
  305. package/dist/gateway/static/root/assets/route-preload-DrfQJkmW.js +0 -2
  306. package/dist/gateway/static/root/assets/service-recommendation-list-DSIe-NRe.js +0 -1
  307. package/dist/gateway/static/root/assets/settings-advanced-gate-DnfH22f_.js +0 -1
  308. package/dist/gateway/static/root/assets/task-detail-page-DBnkT1Nj.js +0 -3
  309. package/dist/gateway/static/root/assets/task-input-card-lCMSy6YY.js +0 -1
  310. package/dist/gateway/static/root/assets/use-composer-attachments-CLIrD0mm.js +0 -2
  311. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Nos5ebMv.js +0 -1
  312. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-D0h2yJ3v.js +0 -1
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-CeXl9w6z.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./interaction-BdhHBbYa.js";import{n as o,t as s}from"./use-directory-picker-C4p7AgWY.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:r,onPick:s,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h!==void 0&&h,y,b;t[0]!==d||t[1]!==r?(b=r.trim(),y=b?o(b):d??``,t[0]=d,t[1]=r,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=i(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,a.transition,a.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==s?(O=e=>{e.stopPropagation(),u||s()},t[9]=u,t[10]=s,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=i(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(n,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:n,onChange:a,disabled:o,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==a||t[1]!==n?(_={initialPath:n,onPicked:a},t[0]=a,t[1]=n,t[2]=_):_=t[2];let v=s(_),y;t[3]===n?y=t[4]:(y=n.trim(),t[3]=n,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=i(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=o||v.picking,w;t[7]===a?w=t[8]:(w=e=>void a(e.target.value),t[7]=a,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==n?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:n,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=n,t[16]=E):E=t[16];let D=o||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==n||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:n,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=n,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(r,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-BGZduAXV.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./interaction-BdhHBbYa.js";import{n as o,t as s}from"./use-directory-picker-C4p7AgWY.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:r,onPick:s,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h!==void 0&&h,y,b;t[0]!==d||t[1]!==r?(b=r.trim(),y=b?o(b):d??``,t[0]=d,t[1]=r,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=i(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,a.transition,a.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==s?(O=e=>{e.stopPropagation(),u||s()},t[9]=u,t[10]=s,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=i(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(n,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:n,onChange:a,disabled:o,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==a||t[1]!==n?(_={initialPath:n,onPicked:a},t[0]=a,t[1]=n,t[2]=_):_=t[2];let v=s(_),y;t[3]===n?y=t[4]:(y=n.trim(),t[3]=n,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=i(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=o||v.picking,w;t[7]===a?w=t[8]:(w=e=>void a(e.target.value),t[7]=a,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==n?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:n,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=n,t[16]=E):E=t[16];let D=o||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==n||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:n,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=n,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(r,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-cg9cm2EL.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./chevron-down-ccbiQQz_.js";import{t as o}from"./button-Cc4hUNTt.js";var s=i(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),c=i(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),l=i(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]);function u(e){let t=e.audioAvailable&&!e.audioDeleted,n=`sync_pending`,r=`none`;return e.audioDeleted?n=`audio_deleted`:e.localSave===`saving`?n=`local_saving`:e.localSave===`failed`?n=`save_failed`:e.localSave===`partial`?(n=`local_partial`,r=`recover`):t?e.serverStatus===`cancelled`?n=`cancelled`:e.serverStatus===`needs_attention`?(n=e.failureStage===`organization`?`analysis_failed`:`transcription_failed`,r=`pipeline`):e.serverStatus===`completed`?e.noteAvailable?e.analysisStale?(n=`analysis_stale`,r=`analyze`):n=`ready`:(n=`analysis_missing`,r=`regenerate`):n=e.serverStatus===`organizing`?e.retryScheduled?`analysis_retrying`:`organizing`:e.retryScheduled?`transcription_retrying`:`transcribing`:e.jobState===`failed`?(n=`verify_failed`,r=`pipeline`):e.jobState===`queued`||e.jobState===`running`||e.sync===`verifying`?n=`verifying`:e.sync===`offline`||e.sync===`failed`?(n=`sync_failed`,r=e.localSave===`complete`?`sync`:`none`):e.localSave!==`complete`&&e.serverStatus===`needs_attention`&&(n=`source_missing`),{stage:n,leave:e.localSave===`saving`?`hold`:t?`cloud`:e.localSave===`complete`?`local`:`hold`,retry:r,audio:t,text:e.textAvailable,note:e.noteAvailable,stale:e.analysisStale}}var d=`open-discussion-capture`;function f(e){window.dispatchEvent(new CustomEvent(d,{detail:e?{projectId:e}:{}}))}var p=e(),m={save_failed:[`录音未能保存`,`Recording could not be saved`,`尚未确认可恢复的原音。请检查麦克风权限和可用存储空间后重新录制。`,`No recoverable audio has been confirmed. Check microphone permission and available storage before recording again.`],cancelled:[`已停止整理`,`Processing stopped`,`已有原音、文字和笔记仍可使用。`,`Existing audio, text and notes remain available.`],local_saving:[`正在保存录音`,`Saving recording`,`请稍候,确认保存完成前请留在此页面。`,`Please stay on this page until saving is confirmed.`],local_partial:[`已保留部分录音`,`Part of the recording was retained`,`本次录音未完整保存。请先恢复或导出已保存部分,确认缺失范围。`,`This recording was not saved completely. Recover or export the saved portion and review the missing parts.`],sync_pending:[`正在同步原音`,`Syncing original audio`,`已完成的文字和笔记可先使用。原音确认可用后,会继续整理。`,`Available text and notes can be used now. Processing continues once the original audio is confirmed.`],sync_failed:[`原音同步未完成`,`Audio sync incomplete`,`已保存的内容仍保留在录制设备。连接网络后可重试同步,无需重新录音。`,`Saved content remains on the recording device. Reconnect and retry sync without recording again.`],verifying:[`原音已上传,正在确认`,`Confirming uploaded audio`,`上传完成后,还需确认原音可用。已有文字可以先查看。`,`Uploaded audio is being checked. Existing text can be read now.`],verify_failed:[`原音确认未完成`,`Audio confirmation incomplete`,`上传内容已保留,可重试确认原音。已有文字和笔记仍可使用。`,`Uploaded content is retained. Retry audio confirmation; existing text and notes remain available.`],transcribing:[`正在整理文字`,`Preparing transcript`,`原音已可回听,已完成的文字可先搜索和查看。文字完成后继续生成笔记。`,`Play the original audio and search available text now. Notes will follow the transcript.`],transcription_retrying:[`正在重试整理文字`,`Retrying transcription`,`原音和处理进度已保留,系统稍后自动重试。已有文字仍可使用。`,`Audio and progress are retained. An automatic retry is scheduled; existing text remains available.`],transcription_failed:[`文字整理未完成`,`Transcription incomplete`,`原音和已有文字均保留。重试会从已保存进度继续,无需重新录音。`,`Audio and existing text are retained. Retry from saved progress without recording again.`],organizing:[`正在生成笔记`,`Preparing notes`,`可以先回听原音、查找原话。笔记完成后可查看重点、结论和行动建议。`,`Play audio and find original statements now. Highlights, conclusions and suggested actions will follow.`],analysis_retrying:[`正在重试生成笔记`,`Retrying notes`,`原音、文字和已有笔记均保留,系统稍后自动重试。`,`Audio, text and existing notes are retained. An automatic retry is scheduled.`],analysis_failed:[`笔记生成未完成`,`Notes incomplete`,`原音、文字和已有笔记均保留。重试只继续整理,不会重新录音或创建重复笔记。`,`Audio, text and existing notes are retained. Retry continues processing without recording again or creating another note.`],ready:[`录音与笔记已就绪`,`Recording and notes are ready`,`现在可以回听原音、查找原话,并回顾重要信息。`,`Play the audio, find original statements and review important information.`],analysis_missing:[`暂未生成笔记`,`Notes are not available yet`,`原音和已有文字仍可使用,可以从原音重新生成文字与笔记。`,`Audio and existing text remain available. Regenerate text and notes from the original audio.`],analysis_stale:[`原文已更新`,`Transcript updated`,`当前笔记基于修改前的原文,可保留查看,也可按新版原文重新整理。`,`Existing notes use an earlier transcript. Keep them or generate notes from the updated text.`],source_missing:[`原音尚不可用`,`Original audio is not available yet`,`请到录制设备的待恢复录音中继续同步。已有文字和笔记仍可查看。`,`Continue sync from recoverable recordings on the recording device. Existing text and notes remain readable.`],audio_deleted:[`原音已删除`,`Original audio was deleted`,`已有文字和笔记仍可查看;重新生成需要重新导入原音。`,`Existing text and notes remain readable. Import the original audio again to regenerate.`]},h={leave_local:[`录音已在本机保存,可以离开当前页面。`,`Recording saved on this device. You can leave this page.`],leave_cloud:[`原音已同步,可以离开当前页面。`,`Original audio synced. You can leave this page.`],leave_hold:[`请先确认保存结果,再离开当前页面。`,`Confirm the recording is saved before leaving this page.`],local_hint:[`关闭应用后,可在待恢复录音中继续同步。请保留本机录音数据。`,`After closing the app, continue sync from recoverable recordings. Keep the recording data on this device.`],cloud_hint:[`后续转写与笔记整理在后台继续;失败时可在这条笔记中重试。`,`Transcription and notes continue on the server. Retry here if processing fails.`],retry_sync:[`重试同步`,`Retry sync`],retry_pipeline:[`继续处理`,`Resume processing`],retry_analysis_failed:[`重试生成笔记`,`Retry notes`],retry_transcription_failed:[`继续整理文字`,`Resume transcription`],retry_verify_failed:[`重试确认原音`,`Retry audio confirmation`],retry_recover:[`恢复已录内容`,`Recover saved audio`],retry_regenerate:[`从原音重新生成`,`Regenerate from audio`],retry_analyze:[`按新版原文整理`,`Update notes from transcript`],audio:[`原音`,`Audio`],text:[`文字`,`Transcript`],note:[`笔记`,`Notes`],available:[`可用`,`Available`],pending:[`尚未完成`,`Not ready`],old_note:[`旧版可用`,`Earlier version available`],open:[`打开笔记`,`Open note`],recover:[`待恢复录音`,`Recoverable recordings`],export:[`导出已录内容`,`Export saved audio`],close:[`稍后查看`,`View later`],annotation_failed:[`重点同步未完成,原音和笔记处理不受影响。`,`Highlights are not synced yet. Audio and note processing are unaffected.`],retry_annotation:[`重试重点同步`,`Retry highlights`]},g=t();function _(e,t=`unknown`,n=`pending`){return{localSave:t,sync:n,serverStatus:e?.discussion.status??``,failureStage:e?.discussion.failureStage??``,jobState:e?.recordingJob?.state??``,retryScheduled:!!e?.processing?.nextAttemptAt,audioAvailable:!!e?.discussion.audioAttachmentId,audioDeleted:!!e?.discussion.audioDeletedAt,textAvailable:!!e?.transcript?.text?.trim()||!!e?.discussion.canonicalTranscript?.trim(),noteAvailable:!!e?.organization?.organization,analysisStale:!!e?.organization&&e.organization.transcriptRevision!==e.transcript?.revision}}function v(e){let t=(0,p.c)(61),{input:n,zh:r,compact:i,busy:s,onRetry:c,children:l,nextAttemptAt:d,context:f}=e,_=i!==void 0&&i,v=s!==void 0&&s,y=f===void 0?`capture`:f,b,x,S,C,w,T,E,D,O,k,A,j,M;if(t[0]!==y||t[1]!==n||t[2]!==r){C=u(n),S=m[C.stage];let e;t[16]===r?e=t[17]:(e=e=>h[e][+!r],t[16]=r,t[17]=e),b=e,x=`retry_${[`analysis_failed`,`transcription_failed`,`verify_failed`].includes(C.stage)?C.stage:C.retry}`,M=`polite`,w=C.stage,T=y===`note`?`mx-auto w-full max-w-[46rem] text-fg`:`rounded-xl bg-surface-inset p-3 text-fg`,E=y===`capture`?(0,g.jsx)(`p`,{className:`mb-1 text-sm font-medium`,children:b(`leave_${C.leave}`)}):null,k=`group`,A=y,j=y===`note`&&(C.stage.endsWith(`_failed`)||C.stage.includes(`retry`)||C.stage===`local_partial`)?!0:void 0,O=`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-lg text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,D=C.stage.endsWith(`_failed`)||C.stage===`local_partial`?`bg-danger`:`bg-accent`,t[0]=y,t[1]=n,t[2]=r,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=w,t[8]=T,t[9]=E,t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j,t[15]=M}else b=t[3],x=t[4],S=t[5],C=t[6],w=t[7],T=t[8],E=t[9],D=t[10],O=t[11],k=t[12],A=t[13],j=t[14],M=t[15];let N=`size-1.5 shrink-0 rounded-full ${D}`,P;t[18]===N?P=t[19]:(P=(0,g.jsx)(`span`,{className:N,"aria-hidden":!0}),t[18]=N,t[19]=P);let F=S[+!r],I;t[20]===F?I=t[21]:(I=(0,g.jsx)(`span`,{className:`min-w-0 flex-1`,children:F}),t[20]=F,t[21]=I);let L;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(a,{className:`size-3.5 shrink-0 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0}),t[22]=L):L=t[22];let R;t[23]!==P||t[24]!==I||t[25]!==O?(R=(0,g.jsxs)(`summary`,{className:O,children:[P,I,L]}),t[23]=P,t[24]=I,t[25]=O,t[26]=R):R=t[26];let z;t[27]!==y||t[28]!==b||t[29]!==C.leave?(z=y===`note`?(0,g.jsx)(`p`,{children:b(`leave_${C.leave}`)}):null,t[27]=y,t[28]=b,t[29]=C.leave,t[30]=z):z=t[30];let B;t[31]!==_||t[32]!==d||t[33]!==b||t[34]!==S||t[35]!==C||t[36]!==r?(B=_?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{children:S[r?2:3]}),d&&Number.isFinite(d)?(0,g.jsxs)(`p`,{children:[r?`下次自动重试时间:`:`Next automatic retry: `,new Date(d).toLocaleTimeString(r?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}):null,C.leave===`local`?(0,g.jsx)(`p`,{children:b(`local_hint`)}):null,(0,g.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1`,"aria-label":r?`已可用内容`:`Available content`,children:[`audio`,`text`,`note`].map(e=>(0,g.jsxs)(`li`,{children:[b(e),` · `,e===`note`&&C.note&&C.stale?b(`old_note`):b(C[e]?`available`:`pending`)]},e))})]}),t[31]=_,t[32]=d,t[33]=b,t[34]=S,t[35]=C,t[36]=r,t[37]=B):B=t[37];let V;t[38]!==z||t[39]!==B?(V=(0,g.jsxs)(`div`,{className:`space-y-2 pb-3 text-xs leading-5 text-fg-muted`,children:[z,B]}),t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]!==R||t[42]!==V||t[43]!==k||t[44]!==A||t[45]!==j?(H=(0,g.jsxs)(`details`,{className:k,open:j,children:[R,V]},A),t[41]=R,t[42]=V,t[43]=k,t[44]=A,t[45]=j,t[46]=H):H=t[46];let U;t[47]!==v||t[48]!==c||t[49]!==b||t[50]!==x||t[51]!==C.retry?(U=C.retry!==`none`&&c?(0,g.jsx)(o,{className:`min-h-11`,disabled:v,onClick:()=>c(C.retry),children:b(x)}):null,t[47]=v,t[48]=c,t[49]=b,t[50]=x,t[51]=C.retry,t[52]=U):U=t[52];let W;return t[53]!==l||t[54]!==w||t[55]!==T||t[56]!==E||t[57]!==H||t[58]!==U||t[59]!==M?(W=(0,g.jsxs)(`section`,{"aria-live":M,"data-recording-outcome":w,className:T,children:[E,H,U,l]}),t[53]=l,t[54]=w,t[55]=T,t[56]=E,t[57]=H,t[58]=U,t[59]=M,t[60]=W):W=t[60],W}function y(){return r(n(`/api/discussion-capture/settings`))}function b(e){return r(n(`/api/discussion-capture/settings`),{method:`PUT`,body:JSON.stringify({consentPolicyVersion:e})})}async function x(e){return r(n(`/api/discussions`),{method:`POST`,body:JSON.stringify(e)})}function S(e){return r(n(`/api/discussions/${encodeURIComponent(e)}`))}async function C(e){try{return await r(n(`/api/discussions/by-note/${encodeURIComponent(e)}`))}catch(e){if(e.status===404)return null;throw e}}function w(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/transcript`))}function T(e,t,i){let a=new FormData;return a.set(`file`,i.blob,`segment-${t}.wav`),a.set(`startedAtMs`,String(i.startedAtMs)),a.set(`endedAtMs`,String(i.endedAtMs)),a.set(`sha256`,i.sha256),r(n(`/api/discussions/${encodeURIComponent(e)}/segments/${t}`),{method:`PUT`,body:a})}function E(e,t=`resume`){return r(n(`/api/discussions/${encodeURIComponent(e)}/retry`),{method:`POST`,body:JSON.stringify({mode:t})})}function D(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/project`),{method:`DELETE`})}function O(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks`))}function k(e,t,i,a){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks/${t}`),{method:`PUT`,headers:{"Content-Type":`application/octet-stream`,"x-audio-sha256":a},body:i})}function A(e,t){return r(n(`/api/discussions/${encodeURIComponent(e)}/capture/seal`),{method:`POST`,body:JSON.stringify(t)})}function j(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/job`))}var M=()=>window.dispatchEvent(new Event(`discussion-annotations-changed`));async function N(){return new Promise((e,t)=>{let n=indexedDB.open(`xopc-note-annotations`,1);n.onupgradeneeded=()=>{n.result.createObjectStore(`annotations`,{keyPath:[`recordingId`,`annotation.id`]}).createIndex(`recordingId`,`recordingId`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function P(e,t){let n=await N();try{return await new Promise((r,i)=>{let a=n.transaction(`annotations`,e?`readwrite`:`readonly`,{durability:`strict`}),o,s;a.oncomplete=()=>r(o),a.onabort=()=>i(s??a.error??Error(`Annotation save failed`)),a.onerror=()=>i(a.error);try{t(a.objectStore(`annotations`),e=>{o=e},e=>{s=e,a.abort()})}catch(e){a.abort(),i(e)}})}finally{n.close()}}async function F(e){return P(!1,(t,n)=>{let r=t.index(`recordingId`).getAll(e);r.onsuccess=()=>n(r.result)})}async function I(e,t,n){await P(!0,(r,i,a)=>{let o=r.get([e,t.id]);o.onsuccess=()=>{let s=o.result;if(n!==void 0&&(n===null?s&&s.state!==`synced`:s?.nonce!==n)){a(Error(`Annotation changed in another tab. Your editor content is retained; reload before saving.`));return}r.put({recordingId:e,annotation:t,nonce:crypto.randomUUID(),state:`pending`}),i()}}),M()}function L(e,t=`highlight`){let n=Date.now();return{id:crypto.randomUUID(),kind:t,text:``,anchor:e,revision:0,deleted:!1,createdAt:n,updatedAt:n}}async function R(e,t,n){await P(!0,(r,i)=>{let a=r.get([e,t]);a.onsuccess=()=>{let e=a.result;e&&e.annotation.anchor.offsetMs===void 0&&r.put({...e,nonce:crypto.randomUUID(),state:`pending`,annotation:{...e.annotation,anchor:{...e.annotation.anchor,offsetMs:n}}}),i()}}),M()}async function z(e,t,n=!1){await P(!0,(r,i)=>{let a=r.get([e.recordingId,e.annotation.id]);a.onsuccess=()=>{let o=a.result;o&&(o.nonce===e.nonce?r.put({...o,annotation:t??o.annotation,state:n?`conflict`:`synced`}):t&&o.annotation.revision===e.annotation.revision&&r.put({...o,annotation:{...o.annotation,revision:t.revision}})),i()}}),M()}var B=new Map;function V(e,t){let i=`${e}:${t}`;if(B.has(i))return B.get(i);let a=(async()=>{for(let i=0;i<5;i++){let i=(await F(e)).filter(e=>e.state===`pending`);if(!i.length)return;for(let e of i){if(e.state!==`pending`)continue;let i=e.annotation;try{await z(e,await r(n(`/api/discussions/${encodeURIComponent(t)}/annotations/${encodeURIComponent(i.id)}`),{method:`PUT`,signal:AbortSignal.timeout(15e3),body:JSON.stringify({id:i.id,kind:i.kind,text:i.text,anchor:i.anchor,expectedRevision:i.revision,deleted:i.deleted})}))}catch(t){throw t.status===409&&await z(e,void 0,!0),t}}}throw Error(`Highlights are still being updated. Saved local changes will sync on retry.`)})().finally(()=>B.delete(i));return B.set(i,a),a}export{f as C,s as E,d as S,c as T,D as _,R as a,v as b,x as c,C as d,w as f,A as g,E as h,L as i,S as l,j as m,z as n,I as o,O as p,F as r,b as s,V as t,y as u,T as v,l as w,_ as x,k as y};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-Dy1EByeG.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./chevron-down-ccbiQQz_.js";import{t as o}from"./button-Cc4hUNTt.js";var s=i(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),c=i(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),l=i(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]);function u(e){let t=e.audioAvailable&&!e.audioDeleted,n=`sync_pending`,r=`none`;return e.audioDeleted?n=`audio_deleted`:e.localSave===`saving`?n=`local_saving`:e.localSave===`failed`?n=`save_failed`:e.localSave===`partial`?(n=`local_partial`,r=`recover`):t?e.serverStatus===`cancelled`?n=`cancelled`:e.serverStatus===`needs_attention`?(n=e.failureStage===`organization`?`analysis_failed`:`transcription_failed`,r=`pipeline`):e.serverStatus===`completed`?e.noteAvailable?e.analysisStale?(n=`analysis_stale`,r=`analyze`):n=`ready`:(n=`analysis_missing`,r=`regenerate`):n=e.serverStatus===`organizing`?e.retryScheduled?`analysis_retrying`:`organizing`:e.retryScheduled?`transcription_retrying`:`transcribing`:e.jobState===`failed`?(n=`verify_failed`,r=`pipeline`):e.jobState===`queued`||e.jobState===`running`||e.sync===`verifying`?n=`verifying`:e.sync===`offline`||e.sync===`failed`?(n=`sync_failed`,r=e.localSave===`complete`?`sync`:`none`):e.localSave!==`complete`&&e.serverStatus===`needs_attention`&&(n=`source_missing`),{stage:n,leave:e.localSave===`saving`?`hold`:t?`cloud`:e.localSave===`complete`?`local`:`hold`,retry:r,audio:t,text:e.textAvailable,note:e.noteAvailable,stale:e.analysisStale}}var d=`open-discussion-capture`;function f(e){window.dispatchEvent(new CustomEvent(d,{detail:e?{projectId:e}:{}}))}var p=e(),m={save_failed:[`录音未能保存`,`Recording could not be saved`,`尚未确认可恢复的原音。请检查麦克风权限和可用存储空间后重新录制。`,`No recoverable audio has been confirmed. Check microphone permission and available storage before recording again.`],cancelled:[`已停止整理`,`Processing stopped`,`已有原音、文字和笔记仍可使用。`,`Existing audio, text and notes remain available.`],local_saving:[`正在保存录音`,`Saving recording`,`请稍候,确认保存完成前请留在此页面。`,`Please stay on this page until saving is confirmed.`],local_partial:[`已保留部分录音`,`Part of the recording was retained`,`本次录音未完整保存。请先恢复或导出已保存部分,确认缺失范围。`,`This recording was not saved completely. Recover or export the saved portion and review the missing parts.`],sync_pending:[`正在同步原音`,`Syncing original audio`,`已完成的文字和笔记可先使用。原音确认可用后,会继续整理。`,`Available text and notes can be used now. Processing continues once the original audio is confirmed.`],sync_failed:[`原音同步未完成`,`Audio sync incomplete`,`已保存的内容仍保留在录制设备。连接网络后可重试同步,无需重新录音。`,`Saved content remains on the recording device. Reconnect and retry sync without recording again.`],verifying:[`原音已上传,正在确认`,`Confirming uploaded audio`,`上传完成后,还需确认原音可用。已有文字可以先查看。`,`Uploaded audio is being checked. Existing text can be read now.`],verify_failed:[`原音确认未完成`,`Audio confirmation incomplete`,`上传内容已保留,可重试确认原音。已有文字和笔记仍可使用。`,`Uploaded content is retained. Retry audio confirmation; existing text and notes remain available.`],transcribing:[`正在整理文字`,`Preparing transcript`,`原音已可回听,已完成的文字可先搜索和查看。文字完成后继续生成笔记。`,`Play the original audio and search available text now. Notes will follow the transcript.`],transcription_retrying:[`正在重试整理文字`,`Retrying transcription`,`原音和处理进度已保留,系统稍后自动重试。已有文字仍可使用。`,`Audio and progress are retained. An automatic retry is scheduled; existing text remains available.`],transcription_failed:[`文字整理未完成`,`Transcription incomplete`,`原音和已有文字均保留。重试会从已保存进度继续,无需重新录音。`,`Audio and existing text are retained. Retry from saved progress without recording again.`],organizing:[`正在生成笔记`,`Preparing notes`,`可以先回听原音、查找原话。笔记完成后可查看重点、结论和行动建议。`,`Play audio and find original statements now. Highlights, conclusions and suggested actions will follow.`],analysis_retrying:[`正在重试生成笔记`,`Retrying notes`,`原音、文字和已有笔记均保留,系统稍后自动重试。`,`Audio, text and existing notes are retained. An automatic retry is scheduled.`],analysis_failed:[`笔记生成未完成`,`Notes incomplete`,`原音、文字和已有笔记均保留。重试只继续整理,不会重新录音或创建重复笔记。`,`Audio, text and existing notes are retained. Retry continues processing without recording again or creating another note.`],ready:[`录音与笔记已就绪`,`Recording and notes are ready`,`现在可以回听原音、查找原话,并回顾重要信息。`,`Play the audio, find original statements and review important information.`],analysis_missing:[`暂未生成笔记`,`Notes are not available yet`,`原音和已有文字仍可使用,可以从原音重新生成文字与笔记。`,`Audio and existing text remain available. Regenerate text and notes from the original audio.`],analysis_stale:[`原文已更新`,`Transcript updated`,`当前笔记基于修改前的原文,可保留查看,也可按新版原文重新整理。`,`Existing notes use an earlier transcript. Keep them or generate notes from the updated text.`],source_missing:[`原音尚不可用`,`Original audio is not available yet`,`请到录制设备的待恢复录音中继续同步。已有文字和笔记仍可查看。`,`Continue sync from recoverable recordings on the recording device. Existing text and notes remain readable.`],audio_deleted:[`原音已删除`,`Original audio was deleted`,`已有文字和笔记仍可查看;重新生成需要重新导入原音。`,`Existing text and notes remain readable. Import the original audio again to regenerate.`]},h={leave_local:[`录音已在本机保存,可以离开当前页面。`,`Recording saved on this device. You can leave this page.`],leave_cloud:[`原音已同步,可以离开当前页面。`,`Original audio synced. You can leave this page.`],leave_hold:[`请先确认保存结果,再离开当前页面。`,`Confirm the recording is saved before leaving this page.`],local_hint:[`关闭应用后,可在待恢复录音中继续同步。请保留本机录音数据。`,`After closing the app, continue sync from recoverable recordings. Keep the recording data on this device.`],cloud_hint:[`后续转写与笔记整理在后台继续;失败时可在这条笔记中重试。`,`Transcription and notes continue on the server. Retry here if processing fails.`],retry_sync:[`重试同步`,`Retry sync`],retry_pipeline:[`继续处理`,`Resume processing`],retry_analysis_failed:[`重试生成笔记`,`Retry notes`],retry_transcription_failed:[`继续整理文字`,`Resume transcription`],retry_verify_failed:[`重试确认原音`,`Retry audio confirmation`],retry_recover:[`恢复已录内容`,`Recover saved audio`],retry_regenerate:[`从原音重新生成`,`Regenerate from audio`],retry_analyze:[`按新版原文整理`,`Update notes from transcript`],audio:[`原音`,`Audio`],text:[`文字`,`Transcript`],note:[`笔记`,`Notes`],available:[`可用`,`Available`],pending:[`尚未完成`,`Not ready`],old_note:[`旧版可用`,`Earlier version available`],open:[`打开笔记`,`Open note`],recover:[`待恢复录音`,`Recoverable recordings`],export:[`导出已录内容`,`Export saved audio`],close:[`稍后查看`,`View later`],annotation_failed:[`重点同步未完成,原音和笔记处理不受影响。`,`Highlights are not synced yet. Audio and note processing are unaffected.`],retry_annotation:[`重试重点同步`,`Retry highlights`]},g=t();function _(e,t=`unknown`,n=`pending`){return{localSave:t,sync:n,serverStatus:e?.discussion.status??``,failureStage:e?.discussion.failureStage??``,jobState:e?.recordingJob?.state??``,retryScheduled:!!e?.processing?.nextAttemptAt,audioAvailable:!!e?.discussion.audioAttachmentId,audioDeleted:!!e?.discussion.audioDeletedAt,textAvailable:!!e?.transcript?.text?.trim()||!!e?.discussion.canonicalTranscript?.trim(),noteAvailable:!!e?.organization?.organization,analysisStale:!!e?.organization&&e.organization.transcriptRevision!==e.transcript?.revision}}function v(e){let t=(0,p.c)(61),{input:n,zh:r,compact:i,busy:s,onRetry:c,children:l,nextAttemptAt:d,context:f}=e,_=i!==void 0&&i,v=s!==void 0&&s,y=f===void 0?`capture`:f,b,x,S,C,w,T,E,D,O,k,A,j,M;if(t[0]!==y||t[1]!==n||t[2]!==r){C=u(n),S=m[C.stage];let e;t[16]===r?e=t[17]:(e=e=>h[e][+!r],t[16]=r,t[17]=e),b=e,x=`retry_${[`analysis_failed`,`transcription_failed`,`verify_failed`].includes(C.stage)?C.stage:C.retry}`,M=`polite`,w=C.stage,T=y===`note`?`mx-auto w-full max-w-[46rem] text-fg`:`rounded-xl bg-surface-inset p-3 text-fg`,E=y===`capture`?(0,g.jsx)(`p`,{className:`mb-1 text-sm font-medium`,children:b(`leave_${C.leave}`)}):null,k=`group`,A=y,j=y===`note`&&(C.stage.endsWith(`_failed`)||C.stage.includes(`retry`)||C.stage===`local_partial`)?!0:void 0,O=`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-lg text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,D=C.stage.endsWith(`_failed`)||C.stage===`local_partial`?`bg-danger`:`bg-accent`,t[0]=y,t[1]=n,t[2]=r,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=w,t[8]=T,t[9]=E,t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j,t[15]=M}else b=t[3],x=t[4],S=t[5],C=t[6],w=t[7],T=t[8],E=t[9],D=t[10],O=t[11],k=t[12],A=t[13],j=t[14],M=t[15];let N=`size-1.5 shrink-0 rounded-full ${D}`,P;t[18]===N?P=t[19]:(P=(0,g.jsx)(`span`,{className:N,"aria-hidden":!0}),t[18]=N,t[19]=P);let F=S[+!r],I;t[20]===F?I=t[21]:(I=(0,g.jsx)(`span`,{className:`min-w-0 flex-1`,children:F}),t[20]=F,t[21]=I);let L;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(a,{className:`size-3.5 shrink-0 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0}),t[22]=L):L=t[22];let R;t[23]!==P||t[24]!==I||t[25]!==O?(R=(0,g.jsxs)(`summary`,{className:O,children:[P,I,L]}),t[23]=P,t[24]=I,t[25]=O,t[26]=R):R=t[26];let z;t[27]!==y||t[28]!==b||t[29]!==C.leave?(z=y===`note`?(0,g.jsx)(`p`,{children:b(`leave_${C.leave}`)}):null,t[27]=y,t[28]=b,t[29]=C.leave,t[30]=z):z=t[30];let B;t[31]!==_||t[32]!==d||t[33]!==b||t[34]!==S||t[35]!==C||t[36]!==r?(B=_?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{children:S[r?2:3]}),d&&Number.isFinite(d)?(0,g.jsxs)(`p`,{children:[r?`下次自动重试时间:`:`Next automatic retry: `,new Date(d).toLocaleTimeString(r?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}):null,C.leave===`local`?(0,g.jsx)(`p`,{children:b(`local_hint`)}):null,(0,g.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1`,"aria-label":r?`已可用内容`:`Available content`,children:[`audio`,`text`,`note`].map(e=>(0,g.jsxs)(`li`,{children:[b(e),` · `,e===`note`&&C.note&&C.stale?b(`old_note`):b(C[e]?`available`:`pending`)]},e))})]}),t[31]=_,t[32]=d,t[33]=b,t[34]=S,t[35]=C,t[36]=r,t[37]=B):B=t[37];let V;t[38]!==z||t[39]!==B?(V=(0,g.jsxs)(`div`,{className:`space-y-2 pb-3 text-xs leading-5 text-fg-muted`,children:[z,B]}),t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]!==R||t[42]!==V||t[43]!==k||t[44]!==A||t[45]!==j?(H=(0,g.jsxs)(`details`,{className:k,open:j,children:[R,V]},A),t[41]=R,t[42]=V,t[43]=k,t[44]=A,t[45]=j,t[46]=H):H=t[46];let U;t[47]!==v||t[48]!==c||t[49]!==b||t[50]!==x||t[51]!==C.retry?(U=C.retry!==`none`&&c?(0,g.jsx)(o,{className:`min-h-11`,disabled:v,onClick:()=>c(C.retry),children:b(x)}):null,t[47]=v,t[48]=c,t[49]=b,t[50]=x,t[51]=C.retry,t[52]=U):U=t[52];let W;return t[53]!==l||t[54]!==w||t[55]!==T||t[56]!==E||t[57]!==H||t[58]!==U||t[59]!==M?(W=(0,g.jsxs)(`section`,{"aria-live":M,"data-recording-outcome":w,className:T,children:[E,H,U,l]}),t[53]=l,t[54]=w,t[55]=T,t[56]=E,t[57]=H,t[58]=U,t[59]=M,t[60]=W):W=t[60],W}function y(){return r(n(`/api/discussion-capture/settings`))}function b(e){return r(n(`/api/discussion-capture/settings`),{method:`PUT`,body:JSON.stringify({consentPolicyVersion:e})})}async function x(e){return r(n(`/api/discussions`),{method:`POST`,body:JSON.stringify(e)})}function S(e){return r(n(`/api/discussions/${encodeURIComponent(e)}`))}async function C(e){try{return await r(n(`/api/discussions/by-note/${encodeURIComponent(e)}`))}catch(e){if(e.status===404)return null;throw e}}function w(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/transcript`))}function T(e,t,i){let a=new FormData;return a.set(`file`,i.blob,`segment-${t}.wav`),a.set(`startedAtMs`,String(i.startedAtMs)),a.set(`endedAtMs`,String(i.endedAtMs)),a.set(`sha256`,i.sha256),r(n(`/api/discussions/${encodeURIComponent(e)}/segments/${t}`),{method:`PUT`,body:a})}function E(e,t=`resume`){return r(n(`/api/discussions/${encodeURIComponent(e)}/retry`),{method:`POST`,body:JSON.stringify({mode:t})})}function D(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/project`),{method:`DELETE`})}function O(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks`))}function k(e,t,i,a){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks/${t}`),{method:`PUT`,headers:{"Content-Type":`application/octet-stream`,"x-audio-sha256":a},body:i})}function A(e,t){return r(n(`/api/discussions/${encodeURIComponent(e)}/capture/seal`),{method:`POST`,body:JSON.stringify(t)})}function j(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/job`))}var M=()=>window.dispatchEvent(new Event(`discussion-annotations-changed`));async function N(){return new Promise((e,t)=>{let n=indexedDB.open(`xopc-note-annotations`,1);n.onupgradeneeded=()=>{n.result.createObjectStore(`annotations`,{keyPath:[`recordingId`,`annotation.id`]}).createIndex(`recordingId`,`recordingId`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function P(e,t){let n=await N();try{return await new Promise((r,i)=>{let a=n.transaction(`annotations`,e?`readwrite`:`readonly`,{durability:`strict`}),o,s;a.oncomplete=()=>r(o),a.onabort=()=>i(s??a.error??Error(`Annotation save failed`)),a.onerror=()=>i(a.error);try{t(a.objectStore(`annotations`),e=>{o=e},e=>{s=e,a.abort()})}catch(e){a.abort(),i(e)}})}finally{n.close()}}async function F(e){return P(!1,(t,n)=>{let r=t.index(`recordingId`).getAll(e);r.onsuccess=()=>n(r.result)})}async function I(e,t,n){await P(!0,(r,i,a)=>{let o=r.get([e,t.id]);o.onsuccess=()=>{let s=o.result;if(n!==void 0&&(n===null?s&&s.state!==`synced`:s?.nonce!==n)){a(Error(`Annotation changed in another tab. Your editor content is retained; reload before saving.`));return}r.put({recordingId:e,annotation:t,nonce:crypto.randomUUID(),state:`pending`}),i()}}),M()}function L(e,t=`highlight`){let n=Date.now();return{id:crypto.randomUUID(),kind:t,text:``,anchor:e,revision:0,deleted:!1,createdAt:n,updatedAt:n}}async function R(e,t,n){await P(!0,(r,i)=>{let a=r.get([e,t]);a.onsuccess=()=>{let e=a.result;e&&e.annotation.anchor.offsetMs===void 0&&r.put({...e,nonce:crypto.randomUUID(),state:`pending`,annotation:{...e.annotation,anchor:{...e.annotation.anchor,offsetMs:n}}}),i()}}),M()}async function z(e,t,n=!1){await P(!0,(r,i)=>{let a=r.get([e.recordingId,e.annotation.id]);a.onsuccess=()=>{let o=a.result;o&&(o.nonce===e.nonce?r.put({...o,annotation:t??o.annotation,state:n?`conflict`:`synced`}):t&&o.annotation.revision===e.annotation.revision&&r.put({...o,annotation:{...o.annotation,revision:t.revision}})),i()}}),M()}var B=new Map;function V(e,t){let i=`${e}:${t}`;if(B.has(i))return B.get(i);let a=(async()=>{for(let i=0;i<5;i++){let i=(await F(e)).filter(e=>e.state===`pending`);if(!i.length)return;for(let e of i){if(e.state!==`pending`)continue;let i=e.annotation;try{await z(e,await r(n(`/api/discussions/${encodeURIComponent(t)}/annotations/${encodeURIComponent(i.id)}`),{method:`PUT`,signal:AbortSignal.timeout(15e3),body:JSON.stringify({id:i.id,kind:i.kind,text:i.text,anchor:i.anchor,expectedRevision:i.revision,deleted:i.deleted})}))}catch(t){throw t.status===409&&await z(e,void 0,!0),t}}}throw Error(`Highlights are still being updated. Saved local changes will sync on retry.`)})().finally(()=>B.delete(i));return B.set(i,a),a}export{f as C,s as E,d as S,c as T,D as _,R as a,v as b,x as c,C as d,w as f,A as g,E as h,L as i,S as l,j as m,z as n,I as o,O as p,F as r,b as s,V as t,y as u,T as v,l as w,_ as x,k 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{i,n as a,o}from"./locale-store-cg9cm2EL.js";import{t as s}from"./messages-eQ2CYlpG.js";import{a as c,l,n as u}from"./dist-CY7CS_D3.js";import{i as d,n as f,r as p}from"./popover-select-CLsphyzA.js";import{t as m}from"./skeleton-DzdOeGYz.js";import{c as h}from"./local-apps-DeqzkJiF.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";var _=e(t(),1),v=n(),y={"capability:xopc.projects.get":`Read approved project details`,"capability:xopc.projects.list":`Search approved projects`,"capability:xopc.projects.list_milestones":`Read approved project milestones`,"capability:xopc.projects.list_updates":`Read approved project progress updates`,"capability:xopc.projects.update":`Update approved project metadata at an exact version`,"capability:xopc.projects.create_milestone":`Create milestones in approved projects`,"capability:xopc.projects.update_milestone":`Update milestones in approved projects`,"capability:xopc.projects.create_update":`Record progress in approved projects`,"capability:xopc.tasks.create":`Capture tasks without starting execution`,"capability:xopc.tasks.update":`Edit approved task details at an exact version`,"capability:xopc.files.read":`Read explicitly selected files and import selected attachments`,"capability:xopc.files.propose_export":`Propose a file export for host review`,"capability:xopc.connectors.describe":`Read contracts of approved connector operations`,"capability:xopc.connectors.read":`Run approved connector read operations on the selected account`,"capability:xopc.connectors.propose_write":`Propose connector writes for individual host review`,"capability:xopc.apps.get_request":`Read this app’s resource request outcomes`,"capability:xopc.automations.simulate":`Validate a proposed automation without running it`,"capability:xopc.automations.propose":`Submit automation changes for separate host review`,"capability:xopc.automations.get_proposal":`Read this app’s proposal review outcomes`,"capability:xopc.automations.history":`Recover this app’s authorized run history`,"capability:xopc.automations.run_events":`Read this app’s sanitized run progress events`,"capability:xopc.automations.list":`List approved automation summaries`,"capability:xopc.automations.get":`Read approved automation summaries`,"capability:xopc.automations.run":`Run individually approved automation configurations (may cause external effects and costs)`,"capability:xopc.automations.get_run":`Read results of runs submitted by this app`,"capability:xopc.automations.cancel":`Request cancellation of runs submitted by this app`,"capability:xopc.agent.delegate":`Delegate bounded text reasoning to the configured model (may incur costs)`,"capability:xopc.notes.create":`Create notes within the approved scope`,"capability:xopc.notes.update":`Change approved notes at an exact revision`,"capability:xopc.notes.append":`Append content to approved notes`,"capability:xopc.notes.get":`Read approved notes by ID`,"capability:xopc.notes.list":`Search and list approved notes`,"capability:xopc.tasks.get":`Read approved task summaries`,"capability:xopc.tasks.list":`Search and list approved task summaries`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},b={"capability:xopc.projects.get":`读取授权项目详情`,"capability:xopc.projects.list":`搜索授权项目`,"capability:xopc.projects.list_milestones":`读取授权项目里程碑`,"capability:xopc.projects.list_updates":`读取授权项目进展`,"capability:xopc.projects.update":`按精确版本更新授权项目资料`,"capability:xopc.projects.create_milestone":`在授权项目内创建里程碑`,"capability:xopc.projects.update_milestone":`更新授权项目的里程碑`,"capability:xopc.projects.create_update":`记录授权项目进展`,"capability:xopc.tasks.create":`收集任务,不启动执行`,"capability:xopc.tasks.update":`按精确版本编辑授权任务资料`,"capability:xopc.files.read":`读取逐项授权的文件及手动选择的附件`,"capability:xopc.files.propose_export":`提出文件导出请求,由宿主审核`,"capability:xopc.connectors.describe":`读取授权连接器操作的接口定义`,"capability:xopc.connectors.read":`在指定账户执行授权的连接器读取操作`,"capability:xopc.connectors.propose_write":`提出连接器写入请求,由宿主逐次审核`,"capability:xopc.apps.get_request":`读取此应用资源请求的结果`,"capability:xopc.automations.simulate":`验证自动化方案,不执行操作`,"capability:xopc.automations.propose":`提交自动化变更,由宿主另行审核`,"capability:xopc.automations.get_proposal":`读取此应用提案的审核结果`,"capability:xopc.automations.history":`恢复此应用有权读取的运行历史`,"capability:xopc.automations.run_events":`读取此应用运行的脱敏进度事件`,"capability:xopc.automations.list":`列出授权范围内的自动化摘要`,"capability:xopc.automations.get":`读取授权范围内的自动化摘要`,"capability:xopc.automations.run":`运行逐项确认的自动化配置(可能产生外部影响和费用)`,"capability:xopc.automations.get_run":`读取此应用发起的自动化运行结果`,"capability:xopc.automations.cancel":`请求取消此应用发起的自动化运行`,"capability:xopc.agent.delegate":`委托已配置模型执行有预算限制的文本推理(可能产生费用)`,"capability:xopc.notes.create":`在授权范围内创建笔记`,"capability:xopc.notes.update":`按精确版本修改授权范围内的笔记`,"capability:xopc.notes.append":`向授权范围内的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取授权范围内的笔记`,"capability:xopc.notes.list":`搜索和列出授权范围内的笔记`,"capability:xopc.tasks.get":`读取授权范围内的任务摘要`,"capability:xopc.tasks.list":`搜索和列出授权范围内的任务摘要`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function x(e,t){let n=y[e];return t===`zh`&&b[e]?b[e]:n??e}var S=r();function C(e){let t=(0,v.c)(19),{extensionId:n,kind:r,values:i,onChange:a,zh:o}=e,[s,c]=(0,_.useState)(``),{data:l,error:u,isLoading:f}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=${r}&search=${encodeURIComponent(s)}`,T),p=r===`notes`?o?`笔记`:`Notes`:r===`tasks`?o?`任务`:`Tasks`:r===`automations`?o?`自动化`:`Automations`:r===`files`?o?`文件`:`Files`:o?`项目`:`Projects`,h;if(t[0]!==l?.items||t[1]!==i){h=(l?.items??[]).map(w);for(let e of i)h.some(t=>t.value===e)||h.push({value:e,label:e});t[0]=l?.items,t[1]=i,t[2]=h}else h=t[2];let y=o?`搜索${p}`:`Search ${p}`,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>c(e.target.value),t[3]=b):b=t[3];let x=o?`搜索${p}(最多显示 100 项)`:`Search ${p} (up to 100 results)`,C;t[4]!==s||t[5]!==y||t[6]!==x?(C=(0,S.jsx)(`input`,{"aria-label":y,value:s,onChange:b,placeholder:x,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[4]=s,t[5]=y,t[6]=x,t[7]=C):C=t[7];let E;t[8]!==u||t[9]!==f||t[10]!==p||t[11]!==a||t[12]!==h||t[13]!==i||t[14]!==o?(E=(0,S.jsx)(`div`,{className:`mt-1 max-h-36 overflow-y-auto`,children:f?(0,S.jsx)(m,{className:`h-16`}):u?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:o?`无法加载,请重试`:`Could not load resources`}):(0,S.jsx)(d,{ariaLabel:p,multiple:!0,options:h,values:i,onChange:a})}),t[8]=u,t[9]=f,t[10]=p,t[11]=a,t[12]=h,t[13]=i,t[14]=o,t[15]=E):E=t[15];let D;return t[16]!==C||t[17]!==E?(D=(0,S.jsxs)(`div`,{className:`mt-2 rounded-lg border border-edge p-2`,children:[C,E]}),t[16]=C,t[17]=E,t[18]=D):D=t[18],D}function w(e){return{value:e.id,label:e.title}}function T(e){return o(i(e))}function E(e){let t=(0,v.c)(92),{extensionId:n,permissions:r,value:i,onChange:a,zh:o}=e,s=o?`读取笔记的范围`:`Notes this app may read`,c;t[0]===r?c=t[1]:(c=r.some(F),t[0]=r,t[1]=c);let l;t[2]!==s||t[3]!==c?(l={key:`notesRead`,label:s,kind:`notes`,visible:c},t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=o?`修改与创建笔记的范围`:`Notes this app may change or create`,d;t[5]===r?d=t[6]:(d=r.some(te),t[5]=r,t[6]=d);let m;t[7]!==u||t[8]!==d?(m={key:`notesWrite`,label:u,kind:`notes`,visible:d},t[7]=u,t[8]=d,t[9]=m):m=t[9];let h=o?`读取任务的范围`:`Tasks this app may read`,g;t[10]===r?g=t[11]:(g=r.some(ee),t[10]=r,t[11]=g);let _;t[12]!==h||t[13]!==g?(_={key:`tasksRead`,label:h,kind:`tasks`,visible:g},t[12]=h,t[13]=g,t[14]=_):_=t[14];let y=o?`读取自动化的范围`:`Automations this app may read`,b;t[15]===r?b=t[16]:(b=r.some(P),t[15]=r,t[16]=b);let x;t[17]!==y||t[18]!==b?(x={key:`automationsRead`,label:y,kind:`automations`,visible:b},t[17]=y,t[18]=b,t[19]=x):x=t[19];let w=o?`创建和更新任务的范围`:`Tasks this app may capture or edit`,T;t[20]===r?T=t[21]:(T=r.some(N),t[20]=r,t[21]=T);let E;t[22]!==w||t[23]!==T?(E={key:`tasksWrite`,label:w,kind:`tasks`,visible:T},t[22]=w,t[23]=T,t[24]=E):E=t[24];let L=o?`读取项目的范围`:`Projects this app may read`,R;t[25]===r?R=t[26]:(R=r.some(M),t[25]=r,t[26]=R);let B;t[27]!==L||t[28]!==R?(B={key:`projectsRead`,label:L,kind:`projects`,visible:R},t[27]=L,t[28]=R,t[29]=B):B=t[29];let V=o?`更新项目和进度的范围`:`Projects this app may update`,H;t[30]===r?H=t[31]:(H=r.some(j),t[30]=r,t[31]=H);let U;t[32]!==V||t[33]!==H?(U={key:`projectsWrite`,label:V,kind:`projects`,visible:H},t[32]=V,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==x||t[36]!==E||t[37]!==B||t[38]!==U||t[39]!==l||t[40]!==m||t[41]!==_?(W=[l,m,_,x,E,B,U],t[35]=x,t[36]=E,t[37]=B,t[38]=U,t[39]=l,t[40]=m,t[41]=_,t[42]=W):W=t[42];let G=W,K;t[43]!==n||t[44]!==a||t[45]!==r||t[46]!==i||t[47]!==o?(K=r.some(A)?(0,S.jsx)(z,{extensionId:n,value:i,onChange:a,zh:o}):null,t[43]=n,t[44]=a,t[45]=r,t[46]=i,t[47]=o,t[48]=K):K=t[48];let q;t[49]!==n||t[50]!==a||t[51]!==r||t[52]!==i||t[53]!==o?(q=r.includes(`capability:xopc.files.read`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`文件与附件读取`:`File and attachment reads`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesRead.mode===`selected`,onChange:e=>a({...i,filesRead:e.target.checked?{mode:`selected`,ids:[]}:{mode:`none`}})}),o?`允许读取以下选定的工作区文件(每个最多 512 KiB)`:`Allow reading these selected workspace files (up to 512 KiB each)`]}),i.filesRead.mode===`selected`?(0,S.jsx)(C,{extensionId:n,kind:`files`,values:i.filesRead.ids,zh:o,onChange:e=>a({...i,filesRead:{mode:`selected`,ids:e}})}):null,(0,S.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesImport,onChange:e=>a({...i,filesImport:e.target.checked})}),o?`允许在宿主中逐次选择并导入本机附件`:`Allow choosing a local attachment in the host for each import`]})]}):null,t[49]=n,t[50]=a,t[51]=r,t[52]=i,t[53]=o,t[54]=q):q=t[54];let J;t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==o?(J=r.includes(`capability:xopc.files.propose_export`)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesExport,onChange:e=>a({...i,filesExport:e.target.checked})}),o?`允许提出文件导出请求;每次均需在宿主确认保存,不直接覆盖 Gateway 文件`:`Allow export requests; each browser save requires host confirmation and does not overwrite Gateway files`]}):null,t[55]=a,t[56]=r,t[57]=i,t[58]=o,t[59]=J):J=t[59];let Y;t[60]!==a||t[61]!==r||t[62]!==i||t[63]!==o?(Y=r.some(k)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.automationProposals,onChange:e=>a({...i,automationProposals:e.target.checked})}),o?`允许模拟和提交自动化提案;创建、修改或启用仍须在宿主逐项审核`:`Allow simulation and automation proposals; creation, changes and activation still require host review`]}):null,t[60]=a,t[61]=r,t[62]=i,t[63]=o,t[64]=Y):Y=t[64];let X;t[65]!==a||t[66]!==r||t[67]!==i||t[68]!==o?(X=r.includes(`capability:xopc.agent.delegate`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`受限 Agent 委托`:`Restricted Agent delegation`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.agentDelegate,onChange:e=>a({...i,agentDelegate:e.target.checked})}),o?`允许发送应用指令、上下文和授权引用到已配置的模型`:`Allow sending app instructions, context and approved references to the configured model`]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`可能产生模型费用。每应用每小时最多 20 次,每次最多 30 秒、4096 输出 token,支持文本或 JSON。无聊天历史、记忆、文件、工具或自动写入权限。预览不运行真实委托。`:`May incur model costs. Up to 20 calls per app per hour, 30 seconds and 4096 output tokens per call, as text or JSON. No chat history, memory, files, tools or automatic writes. Unavailable in previews.`})]}):null,t[65]=a,t[66]=r,t[67]=i,t[68]=o,t[69]=X):X=t[69];let Z;t[70]!==n||t[71]!==a||t[72]!==r||t[73]!==i||t[74]!==o?(Z=r.some(O)?(0,S.jsx)(I,{extensionId:n,value:i,onChange:a,zh:o}):null,t[70]=n,t[71]=a,t[72]=r,t[73]=i,t[74]=o,t[75]=Z):Z=t[75];let Q;t[76]===G?Q=t[77]:(Q=G.filter(D),t[76]=G,t[77]=Q);let $;t[78]!==n||t[79]!==a||t[80]!==Q||t[81]!==i||t[82]!==o?($=Q.map(e=>{let t=i[e.key],r=t=>a({...i,[e.key]:t});return(0,S.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,S.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:e.label}),(0,S.jsxs)(f,{"aria-label":e.label,value:t.mode,onChange:e=>r(e.target.value===`selected`?{mode:`selected`,ids:[],projectIds:[],includeCreated:!1}:{mode:e.target.value}),children:[(0,S.jsx)(p,{value:`none`,children:o?`不允许`:`No access`}),(0,S.jsx)(p,{value:`selected`,children:o?`仅选择的记录或项目`:`Selected records or projects`}),(0,S.jsx)(p,{value:`workspace`,children:o?`整个工作区(包含所有记录)`:`Entire workspace (all records)`})]}),t.mode===`workspace`?(0,S.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:o?`这会授权访问整个工作区,请确认符合此工具的用途。`:`This grants workspace-wide access. Check that this matches the tool’s purpose.`}):null,t.mode===`selected`?(0,S.jsxs)(S.Fragment,{children:[e.kind===`notes`||e.kind===`tasks`?(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:t.includeCreated,onChange:e=>r({...t,includeCreated:e.target.checked})}),e.kind===`notes`?o?`包括此应用创建的笔记`:`Include notes created by this app`:o?`包括此应用创建的任务`:`Include tasks created by this app`]}):null,(0,S.jsx)(C,{extensionId:n,kind:e.kind,values:e.kind===`projects`?[...new Set([...t.ids,...t.projectIds])]:t.ids,onChange:n=>r({...t,ids:n,...e.kind===`projects`?{projectIds:[]}:{}}),zh:o}),e.kind===`projects`?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`也可授权以下项目中的记录,包括以后加入项目的记录。`:`You may also allow records in these projects, including future additions.`}),(0,S.jsx)(C,{extensionId:n,kind:`projects`,values:t.projectIds,onChange:e=>r({...t,projectIds:e}),zh:o})]})]}):null]},e.key)}),t[78]=n,t[79]=a,t[80]=Q,t[81]=i,t[82]=o,t[83]=$):$=t[83];let ne;return t[84]!==K||t[85]!==q||t[86]!==J||t[87]!==Y||t[88]!==X||t[89]!==Z||t[90]!==$?(ne=(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[K,q,J,Y,X,Z,$]}),t[84]=K,t[85]=q,t[86]=J,t[87]=Y,t[88]=X,t[89]=Z,t[90]=$,t[91]=ne):ne=t[91],ne}function D(e){return e.visible}function O(e){return/capability:xopc.automations.(run|cancel)$/.test(e)}function k(e){return/capability:xopc.automations.(propose|get_proposal|simulate)$/.test(e)}function A(e){return/capability:xopc.connectors./.test(e)}function j(e){return/capability:xopc.projects.(update|create_milestone|update_milestone|create_update)$/.test(e)}function M(e){return/capability:xopc.projects.(get|list|list_milestones|list_updates)$/.test(e)}function N(e){return/capability:xopc.tasks.(create|update)$/.test(e)}function P(e){return/capability:xopc.automations.(get|list|get_run|history|run_events)$/.test(e)}function ee(e){return/capability:xopc.tasks.(get|list)$/.test(e)}function te(e){return/capability:xopc.notes.(create|update|append)$/.test(e)}function F(e){return/capability:xopc.notes.(get|list)$/.test(e)}function I(e){let t=(0,v.c)(34),{extensionId:n,value:r,onChange:i,zh:a}=e,[o,s]=(0,_.useState)(``),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},t[0]=c):c=t[0];let[l,u]=(0,_.useState)(c),{data:d,error:f,isLoading:p}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=automations&search=${encodeURIComponent(o)}`,R),h;t[1]!==r.automationsRun.approvals||t[2]!==r.automationsRun.mode?(h=r.automationsRun.mode===`selected`?r.automationsRun.approvals:[],t[1]=r.automationsRun.approvals,t[2]=r.automationsRun.mode,t[3]=h):h=t[3];let y=h,b;t[4]!==i||t[5]!==r?(b=e=>i({...r,automationsRun:e.length?{mode:`selected`,approvals:e}:{mode:`none`}}),t[4]=i,t[5]=r,t[6]=b):b=t[6];let x=b,C=a?`允许执行的自动化`:`Approved automation execution`,w;t[7]===C?w=t[8]:(w=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:C}),t[7]=C,t[8]=w);let T=a?`所选自动化可能使用 Agent 工具、修改文件或向外发送结果,并产生费用。请展开检查后再勾选。应用只能运行确认过的配置,每小时最多 20 次;配置变化需重新授权。授权到期或撤权后,受限运行会中止后续调用。`:`These automations may use Agent tools, change files, send results externally and incur costs. Inspect each before approving. Up to 20 submissions per app per hour. Configuration changes require new approval. Expiry or revocation stops further calls in bounded runs.`,E;t[9]===T?E=t[10]:(E=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-warning`,children:T}),t[9]=T,t[10]=E);let D=a?`搜索可执行自动化`:`Search executable automations`,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>s(e.target.value),t[11]=O):O=t[11];let k=a?`搜索自动化`:`Search automations`,A;t[12]!==o||t[13]!==k||t[14]!==D?(A=(0,S.jsx)(`input`,{"aria-label":D,value:o,onChange:O,placeholder:k,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[12]=o,t[13]=k,t[14]=D,t[15]=A):A=t[15];let j;t[16]!==y||t[17]!==d?.items||t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==x||t[22]!==a?(j=p?(0,S.jsx)(m,{className:`mt-2 h-16`}):f?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载自动化`:`Could not load automations`}):(d?.items??[]).map(e=>{let t=y.some(t=>t.id===e.id&&t.configurationDigest===e.configurationDigest&&t.authority.model&&t.authority.maxRuns>0&&t.authority.expiresAt>Date.now()),n=!t&&y.some(t=>t.id===e.id),r=e.review.action,i=l[e.id]??y.find(t=>t.id===e.id)?.authority??{model:!1,tools:!1,dataWrite:!1,externalSend:!1,expiresAt:Date.now()+36e5,maxRuns:1,maxCostMicrousd:1e6},o=n=>{u(t=>({...t,[e.id]:n})),t&&x([...y.filter(t=>t.id!==e.id),...n.model?[{id:e.id,configurationDigest:e.configurationDigest,authority:n}]:[]])};return(0,S.jsxs)(`details`,{className:`mt-2 rounded-md border border-edge p-2 text-xs text-fg`,children:[(0,S.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.title,n?a?`(配置已改变,需重新确认)`:` (changed; review again)`:``]}),(0,S.jsxs)(`div`,{className:`mt-2 space-y-2 break-words`,children:[(0,S.jsxs)(`p`,{children:[a?`执行方式`:`Action`,`: `,r.kind===`agent`?`Agent`:r.kind===`task_command`?a?`任务命令`:`Task command`:r.kind]}),r.instruction?(0,S.jsx)(`p`,{className:`whitespace-pre-wrap`,children:r.instruction}):null,r.agentId?(0,S.jsxs)(`p`,{children:[`Agent: `,r.agentId]}):null,r.model?(0,S.jsxs)(`p`,{children:[a?`模型`:`Model`,`: `,r.model]}):null,r.workingDirectory?(0,S.jsxs)(`p`,{children:[a?`工作目录`:`Working directory`,`: `,r.workingDirectory]}):null,r.mcpSourceId?(0,S.jsxs)(`p`,{children:[`MCP: `,r.mcpSourceId]}):null,r.taskId?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`p`,{children:[a?`任务`:`Task`,`: `,r.taskId]}),(0,S.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:JSON.stringify(r.command,null,2)})]}):null,(0,S.jsxs)(`p`,{children:[a?`执行策略`:`Safety`,`: `,e.review.safety?.mode??`auto_apply`,` / `,e.review.conversationMode]}),(0,S.jsxs)(`p`,{children:[a?`超时与重试`:`Timeout / retries`,`: `,e.review.reliability?.executionTimeoutSeconds??r.timeoutSeconds??(a?`宿主默认`:`Host default`),` / `,e.review.reliability?.retryCount??0]}),(0,S.jsxs)(`p`,{children:[a?`结果投递`:`Delivery`,`: `,e.review.delivery.destinations.map(L).join(`, `)||(a?`无`:`None`)]}),[`model`,`tools`,`dataWrite`,`externalSend`].map(e=>(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i[e],onChange:t=>o({...i,[e]:t.target.checked})}),{model:a?`允许模型处理(上下文会发送给模型供应商)`:`Allow model processing (context is disclosed to the provider)`,tools:a?`允许本地文件读取工具`:`Allow local file read tools`,dataWrite:a?`允许本地文件写入(工具写入还需允许工具)`:`Allow local file writes (tool writes also require tools)`,externalSend:a?`允许向以上已审核目标投递结果`:`Allow delivery to the reviewed external destinations`}[e]]},e)),(0,S.jsx)(`p`,{className:`text-fg-muted`,children:a?`不开放 Shell、浏览器、MCP 或嵌套委托。预算按已知模型价格预留最坏情况费用,不代表供应商账单封顶;价格未知时拒绝执行。有效期结束或撤权会中止后续调用。`:`Shell, browser, MCP and nested delegation are unavailable. Known model prices reserve worst-case usage; this is not a provider billing guarantee. Unknown pricing is denied. Expiry or revocation stops further calls.`}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`有效时长(分钟)`:`Valid for (minutes)`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`43200`,value:Math.max(0,Math.ceil((i.expiresAt-Date.now())/6e4)),onChange:e=>o({...i,expiresAt:Date.now()+Number(e.target.value)*6e4}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`本次授权最多运行次数`:`Maximum runs for this approval`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`100`,value:i.maxRuns,onChange:e=>o({...i,maxRuns:Number(e.target.value)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`模型预留预算(美元)`:`Model reservation budget (USD)`,(0,S.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`0.001`,value:i.maxCostMicrousd/1e6,onChange:e=>o({...i,maxCostMicrousd:Math.round(Number(e.target.value)*1e6)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,disabled:!e.runnable||!i.model||i.expiresAt<=Date.now()||i.maxRuns<1,checked:t,onChange:t=>x([...y.filter(t=>t.id!==e.id),...t.target.checked?[{id:e.id,configurationDigest:e.configurationDigest,authority:i}]:[]])}),e.runnable?a?`允许此应用运行以上配置`:`Allow this app to run this configuration`:a?`此自动化当前不可授权执行`:`This automation cannot currently be approved`]})]})]},e.id)}),t[16]=y,t[17]=d?.items,t[18]=l,t[19]=f,t[20]=p,t[21]=x,t[22]=a,t[23]=j):j=t[23];let M;t[24]!==y.length||t[25]!==x||t[26]!==a?(M=y.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>x([]),children:[a?`清除所有执行授权`:`Clear all execution approvals`,` (`,y.length,`)`]}):null,t[24]=y.length,t[25]=x,t[26]=a,t[27]=M):M=t[27];let N;return t[28]!==A||t[29]!==j||t[30]!==M||t[31]!==w||t[32]!==E?(N=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[w,E,A,j,M]}),t[28]=A,t[29]=j,t[30]=M,t[31]=w,t[32]=E,t[33]=N):N=t[33],N}function L(e){return[e.kind,e.endpoint??e.conversationId??e.pathTemplate??e.channelId,e.targetId??e.templateId].filter(Boolean).join(`: `)}function R(e){return o(i(e))}function z(e){let t=(0,v.c)(25),{extensionId:n,value:r,onChange:i,zh:a}=e,{data:o,error:s,isLoading:c}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=connectors`,B),l;t[0]!==r.connectors.bindings||t[1]!==r.connectors.mode?(l=r.connectors.mode===`selected`?r.connectors.bindings:[],t[0]=r.connectors.bindings,t[1]=r.connectors.mode,t[2]=l):l=t[2];let u=l,d=a?`外部服务与账户`:`External services and accounts`,f;t[3]===d?f=t[4]:(f=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:d}),t[3]=d,t[4]=f);let p=a?`仅允许以下账户和操作。读取受连接器现有策略约束;写入每次另行审核。重新连接或操作契约变化后需重新选择,可能产生外部服务费用。`:`Only these accounts and actions. Reads retain existing connector policy; writes require a separate review each time. Reconnection or contract changes require a new selection. External service fees may apply.`,h;t[5]===p?h=t[6]:(h=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p}),t[5]=p,t[6]=h);let _;t[7]!==u||t[8]!==o?.items||t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==r||t[13]!==a?(_=c?(0,S.jsx)(m,{className:`h-20`}):s?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载连接器`:`Could not load connectors`}):(o?.items??[]).map(e=>(0,S.jsxs)(`label`,{className:`my-2 flex items-start gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:u.some(t=>JSON.stringify(t)===JSON.stringify(e.binding)),onChange:t=>{let n=u.filter(t=>!(t.toolRef===e.binding.toolRef&&t.accountId===e.binding.accountId));t.target.checked&&n.push(e.binding),i({...r,connectors:n.length?{mode:`selected`,bindings:n}:{mode:`none`}})}}),e.title]},e.id)),t[7]=u,t[8]=o?.items,t[9]=s,t[10]=c,t[11]=i,t[12]=r,t[13]=a,t[14]=_):_=t[14];let y;t[15]!==u.length||t[16]!==i||t[17]!==r||t[18]!==a?(y=u.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>i({...r,connectors:{mode:`none`}}),children:[a?`清除连接器授权`:`Clear connector approvals`,` (`,u.length,`)`]}):null,t[15]=u.length,t[16]=i,t[17]=r,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==h||t[22]!==_||t[23]!==y?(b=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[f,h,_,y]}),t[20]=f,t[21]=h,t[22]=_,t[23]=y,t[24]=b):b=t[24],b}function B(e){return o(i(e))}function V(e){let t=(0,v.c)(63),{open:n,onOpenChange:r,extensionId:i,extensionName:o,permissions:d,onConfirm:f,confirmDisabled:p,localApp:m,resourceScopes:g,error:y}=e,b=a(U),C=s(b).extensionUi,w;t[0]===g?w=t[1]:(w=()=>h.parse(g??{}),t[0]=g,t[1]=w);let[T,D]=(0,_.useState)(w),O;t[2]!==g||t[3]!==D?(O=()=>D(h.parse(g??{})),t[2]=g,t[3]=D,t[4]=O):O=t[4];let k;t[5]!==i||t[6]!==g?(k=[g,i],t[5]=i,t[6]=g,t[7]=k):k=t[7],(0,_.useEffect)(O,k);let A=l,j=l,M;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,S.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[8]=M):M=t[8];let N=l,P=H,ee=l,te=C.permissionTitle.replace(`{{name}}`,o),F;t[9]!==ee.Title||t[10]!==te?(F=(0,S.jsx)(ee.Title,{className:`text-base font-semibold text-fg`,children:te}),t[9]=ee.Title,t[10]=te,t[11]=F):F=t[11];let I;t[12]===i?I=t[13]:(I=(0,S.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[12]=i,t[13]=I);let L;t[14]!==C.permissionSubtitle||t[15]!==I?(L=(0,S.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[C.permissionSubtitle,` `,I]}),t[14]=C.permissionSubtitle,t[15]=I,t[16]=L):L=t[16];let R;t[17]!==b||t[18]!==d||t[19]!==C.permissionsNone?(R=d.length===0?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:C.permissionsNone}):(0,S.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:d.map(e=>(0,S.jsx)(`li`,{children:x(e,b)},e))}),t[17]=b,t[18]=d,t[19]=C.permissionsNone,t[20]=R):R=t[20];let z;t[21]!==i||t[22]!==b||t[23]!==m||t[24]!==d||t[25]!==T||t[26]!==D?(z=m?(0,S.jsx)(E,{extensionId:i,permissions:d,value:T,onChange:D,zh:b===`zh`}):null,t[21]=i,t[22]=b,t[23]=m,t[24]=d,t[25]=T,t[26]=D,t[27]=z):z=t[27];let B;t[28]!==R||t[29]!==z?(B=(0,S.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[R,z]}),t[28]=R,t[29]=z,t[30]=B):B=t[30];let V;t[31]===y?V=t[32]:(V=y?(0,S.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:y}):null,t[31]=y,t[32]=V);let W;t[33]===C.deny?W=t[34]:(W=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:C.deny})}),t[33]=C.deny,t[34]=W);let G;t[35]!==m||t[36]!==f||t[37]!==T?(G=()=>{f(m?T:void 0)},t[35]=m,t[36]=f,t[37]=T,t[38]=G):G=t[38];let K;t[39]!==p||t[40]!==C.allow||t[41]!==G?(K=(0,S.jsx)(`button`,{type:`button`,disabled:p,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:G,children:C.allow}),t[39]=p,t[40]=C.allow,t[41]=G,t[42]=K):K=t[42];let q;t[43]!==W||t[44]!==K?(q=(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[W,K]}),t[43]=W,t[44]=K,t[45]=q):q=t[45];let J;t[46]!==F||t[47]!==L||t[48]!==B||t[49]!==V||t[50]!==q||t[51]!==N.Content||t[52]!==P?(J=(0,S.jsxs)(N.Content,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,onOpenAutoFocus:P,children:[F,L,B,V,q]}),t[46]=F,t[47]=L,t[48]=B,t[49]=V,t[50]=q,t[51]=N.Content,t[52]=P,t[53]=J):J=t[53];let Y;t[54]!==J||t[55]!==j.Portal||t[56]!==M?(Y=(0,S.jsxs)(j.Portal,{children:[M,J]}),t[54]=J,t[55]=j.Portal,t[56]=M,t[57]=Y):Y=t[57];let X;return t[58]!==r||t[59]!==n||t[60]!==Y||t[61]!==A.Root?(X=(0,S.jsx)(A.Root,{open:n,onOpenChange:r,children:Y}),t[58]=r,t[59]=n,t[60]=Y,t[61]=A.Root,t[62]=X):X=t[62],X}function H(e){return e.preventDefault()}function U(e){return e.language}async function W(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function G(e,t,n){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t,resourceScopes:n})})).grant}export{E as i,W as n,V as r,G as t};
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 a,o}from"./locale-store-Dy1EByeG.js";import{t as s}from"./messages-BAnhwALN.js";import{a as c,l,n as u}from"./dist-CY7CS_D3.js";import{i as d,n as f,r as p}from"./popover-select-CLsphyzA.js";import{t as m}from"./skeleton-DzdOeGYz.js";import{c as h}from"./local-apps-DeqzkJiF.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";var _=e(t(),1),v=n(),y={"capability:xopc.projects.get":`Read approved project details`,"capability:xopc.projects.list":`Search approved projects`,"capability:xopc.projects.list_milestones":`Read approved project milestones`,"capability:xopc.projects.list_updates":`Read approved project progress updates`,"capability:xopc.projects.update":`Update approved project metadata at an exact version`,"capability:xopc.projects.create_milestone":`Create milestones in approved projects`,"capability:xopc.projects.update_milestone":`Update milestones in approved projects`,"capability:xopc.projects.create_update":`Record progress in approved projects`,"capability:xopc.tasks.create":`Capture tasks without starting execution`,"capability:xopc.tasks.update":`Edit approved task details at an exact version`,"capability:xopc.files.read":`Read explicitly selected files and import selected attachments`,"capability:xopc.files.propose_export":`Propose a file export for host review`,"capability:xopc.connectors.describe":`Read contracts of approved connector operations`,"capability:xopc.connectors.read":`Run approved connector read operations on the selected account`,"capability:xopc.connectors.propose_write":`Propose connector writes for individual host review`,"capability:xopc.apps.get_request":`Read this app’s resource request outcomes`,"capability:xopc.automations.simulate":`Validate a proposed automation without running it`,"capability:xopc.automations.propose":`Submit automation changes for separate host review`,"capability:xopc.automations.get_proposal":`Read this app’s proposal review outcomes`,"capability:xopc.automations.history":`Recover this app’s authorized run history`,"capability:xopc.automations.run_events":`Read this app’s sanitized run progress events`,"capability:xopc.automations.list":`List approved automation summaries`,"capability:xopc.automations.get":`Read approved automation summaries`,"capability:xopc.automations.run":`Run individually approved automation configurations (may cause external effects and costs)`,"capability:xopc.automations.get_run":`Read results of runs submitted by this app`,"capability:xopc.automations.cancel":`Request cancellation of runs submitted by this app`,"capability:xopc.agent.delegate":`Delegate bounded text reasoning to the configured model (may incur costs)`,"capability:xopc.notes.create":`Create notes within the approved scope`,"capability:xopc.notes.update":`Change approved notes at an exact revision`,"capability:xopc.notes.append":`Append content to approved notes`,"capability:xopc.notes.get":`Read approved notes by ID`,"capability:xopc.notes.list":`Search and list approved notes`,"capability:xopc.tasks.get":`Read approved task summaries`,"capability:xopc.tasks.list":`Search and list approved task summaries`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},b={"capability:xopc.projects.get":`读取授权项目详情`,"capability:xopc.projects.list":`搜索授权项目`,"capability:xopc.projects.list_milestones":`读取授权项目里程碑`,"capability:xopc.projects.list_updates":`读取授权项目进展`,"capability:xopc.projects.update":`按精确版本更新授权项目资料`,"capability:xopc.projects.create_milestone":`在授权项目内创建里程碑`,"capability:xopc.projects.update_milestone":`更新授权项目的里程碑`,"capability:xopc.projects.create_update":`记录授权项目进展`,"capability:xopc.tasks.create":`收集任务,不启动执行`,"capability:xopc.tasks.update":`按精确版本编辑授权任务资料`,"capability:xopc.files.read":`读取逐项授权的文件及手动选择的附件`,"capability:xopc.files.propose_export":`提出文件导出请求,由宿主审核`,"capability:xopc.connectors.describe":`读取授权连接器操作的接口定义`,"capability:xopc.connectors.read":`在指定账户执行授权的连接器读取操作`,"capability:xopc.connectors.propose_write":`提出连接器写入请求,由宿主逐次审核`,"capability:xopc.apps.get_request":`读取此应用资源请求的结果`,"capability:xopc.automations.simulate":`验证自动化方案,不执行操作`,"capability:xopc.automations.propose":`提交自动化变更,由宿主另行审核`,"capability:xopc.automations.get_proposal":`读取此应用提案的审核结果`,"capability:xopc.automations.history":`恢复此应用有权读取的运行历史`,"capability:xopc.automations.run_events":`读取此应用运行的脱敏进度事件`,"capability:xopc.automations.list":`列出授权范围内的自动化摘要`,"capability:xopc.automations.get":`读取授权范围内的自动化摘要`,"capability:xopc.automations.run":`运行逐项确认的自动化配置(可能产生外部影响和费用)`,"capability:xopc.automations.get_run":`读取此应用发起的自动化运行结果`,"capability:xopc.automations.cancel":`请求取消此应用发起的自动化运行`,"capability:xopc.agent.delegate":`委托已配置模型执行有预算限制的文本推理(可能产生费用)`,"capability:xopc.notes.create":`在授权范围内创建笔记`,"capability:xopc.notes.update":`按精确版本修改授权范围内的笔记`,"capability:xopc.notes.append":`向授权范围内的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取授权范围内的笔记`,"capability:xopc.notes.list":`搜索和列出授权范围内的笔记`,"capability:xopc.tasks.get":`读取授权范围内的任务摘要`,"capability:xopc.tasks.list":`搜索和列出授权范围内的任务摘要`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function x(e,t){let n=y[e];return t===`zh`&&b[e]?b[e]:n??e}var S=r();function C(e){let t=(0,v.c)(19),{extensionId:n,kind:r,values:i,onChange:a,zh:o}=e,[s,c]=(0,_.useState)(``),{data:l,error:u,isLoading:f}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=${r}&search=${encodeURIComponent(s)}`,T),p=r===`notes`?o?`笔记`:`Notes`:r===`tasks`?o?`任务`:`Tasks`:r===`automations`?o?`自动化`:`Automations`:r===`files`?o?`文件`:`Files`:o?`项目`:`Projects`,h;if(t[0]!==l?.items||t[1]!==i){h=(l?.items??[]).map(w);for(let e of i)h.some(t=>t.value===e)||h.push({value:e,label:e});t[0]=l?.items,t[1]=i,t[2]=h}else h=t[2];let y=o?`搜索${p}`:`Search ${p}`,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>c(e.target.value),t[3]=b):b=t[3];let x=o?`搜索${p}(最多显示 100 项)`:`Search ${p} (up to 100 results)`,C;t[4]!==s||t[5]!==y||t[6]!==x?(C=(0,S.jsx)(`input`,{"aria-label":y,value:s,onChange:b,placeholder:x,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[4]=s,t[5]=y,t[6]=x,t[7]=C):C=t[7];let E;t[8]!==u||t[9]!==f||t[10]!==p||t[11]!==a||t[12]!==h||t[13]!==i||t[14]!==o?(E=(0,S.jsx)(`div`,{className:`mt-1 max-h-36 overflow-y-auto`,children:f?(0,S.jsx)(m,{className:`h-16`}):u?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:o?`无法加载,请重试`:`Could not load resources`}):(0,S.jsx)(d,{ariaLabel:p,multiple:!0,options:h,values:i,onChange:a})}),t[8]=u,t[9]=f,t[10]=p,t[11]=a,t[12]=h,t[13]=i,t[14]=o,t[15]=E):E=t[15];let D;return t[16]!==C||t[17]!==E?(D=(0,S.jsxs)(`div`,{className:`mt-2 rounded-lg border border-edge p-2`,children:[C,E]}),t[16]=C,t[17]=E,t[18]=D):D=t[18],D}function w(e){return{value:e.id,label:e.title}}function T(e){return o(i(e))}function E(e){let t=(0,v.c)(92),{extensionId:n,permissions:r,value:i,onChange:a,zh:o}=e,s=o?`读取笔记的范围`:`Notes this app may read`,c;t[0]===r?c=t[1]:(c=r.some(F),t[0]=r,t[1]=c);let l;t[2]!==s||t[3]!==c?(l={key:`notesRead`,label:s,kind:`notes`,visible:c},t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=o?`修改与创建笔记的范围`:`Notes this app may change or create`,d;t[5]===r?d=t[6]:(d=r.some(te),t[5]=r,t[6]=d);let m;t[7]!==u||t[8]!==d?(m={key:`notesWrite`,label:u,kind:`notes`,visible:d},t[7]=u,t[8]=d,t[9]=m):m=t[9];let h=o?`读取任务的范围`:`Tasks this app may read`,g;t[10]===r?g=t[11]:(g=r.some(ee),t[10]=r,t[11]=g);let _;t[12]!==h||t[13]!==g?(_={key:`tasksRead`,label:h,kind:`tasks`,visible:g},t[12]=h,t[13]=g,t[14]=_):_=t[14];let y=o?`读取自动化的范围`:`Automations this app may read`,b;t[15]===r?b=t[16]:(b=r.some(P),t[15]=r,t[16]=b);let x;t[17]!==y||t[18]!==b?(x={key:`automationsRead`,label:y,kind:`automations`,visible:b},t[17]=y,t[18]=b,t[19]=x):x=t[19];let w=o?`创建和更新任务的范围`:`Tasks this app may capture or edit`,T;t[20]===r?T=t[21]:(T=r.some(N),t[20]=r,t[21]=T);let E;t[22]!==w||t[23]!==T?(E={key:`tasksWrite`,label:w,kind:`tasks`,visible:T},t[22]=w,t[23]=T,t[24]=E):E=t[24];let L=o?`读取项目的范围`:`Projects this app may read`,R;t[25]===r?R=t[26]:(R=r.some(M),t[25]=r,t[26]=R);let B;t[27]!==L||t[28]!==R?(B={key:`projectsRead`,label:L,kind:`projects`,visible:R},t[27]=L,t[28]=R,t[29]=B):B=t[29];let V=o?`更新项目和进度的范围`:`Projects this app may update`,H;t[30]===r?H=t[31]:(H=r.some(j),t[30]=r,t[31]=H);let U;t[32]!==V||t[33]!==H?(U={key:`projectsWrite`,label:V,kind:`projects`,visible:H},t[32]=V,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==x||t[36]!==E||t[37]!==B||t[38]!==U||t[39]!==l||t[40]!==m||t[41]!==_?(W=[l,m,_,x,E,B,U],t[35]=x,t[36]=E,t[37]=B,t[38]=U,t[39]=l,t[40]=m,t[41]=_,t[42]=W):W=t[42];let G=W,K;t[43]!==n||t[44]!==a||t[45]!==r||t[46]!==i||t[47]!==o?(K=r.some(A)?(0,S.jsx)(z,{extensionId:n,value:i,onChange:a,zh:o}):null,t[43]=n,t[44]=a,t[45]=r,t[46]=i,t[47]=o,t[48]=K):K=t[48];let q;t[49]!==n||t[50]!==a||t[51]!==r||t[52]!==i||t[53]!==o?(q=r.includes(`capability:xopc.files.read`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`文件与附件读取`:`File and attachment reads`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesRead.mode===`selected`,onChange:e=>a({...i,filesRead:e.target.checked?{mode:`selected`,ids:[]}:{mode:`none`}})}),o?`允许读取以下选定的工作区文件(每个最多 512 KiB)`:`Allow reading these selected workspace files (up to 512 KiB each)`]}),i.filesRead.mode===`selected`?(0,S.jsx)(C,{extensionId:n,kind:`files`,values:i.filesRead.ids,zh:o,onChange:e=>a({...i,filesRead:{mode:`selected`,ids:e}})}):null,(0,S.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesImport,onChange:e=>a({...i,filesImport:e.target.checked})}),o?`允许在宿主中逐次选择并导入本机附件`:`Allow choosing a local attachment in the host for each import`]})]}):null,t[49]=n,t[50]=a,t[51]=r,t[52]=i,t[53]=o,t[54]=q):q=t[54];let J;t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==o?(J=r.includes(`capability:xopc.files.propose_export`)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesExport,onChange:e=>a({...i,filesExport:e.target.checked})}),o?`允许提出文件导出请求;每次均需在宿主确认保存,不直接覆盖 Gateway 文件`:`Allow export requests; each browser save requires host confirmation and does not overwrite Gateway files`]}):null,t[55]=a,t[56]=r,t[57]=i,t[58]=o,t[59]=J):J=t[59];let Y;t[60]!==a||t[61]!==r||t[62]!==i||t[63]!==o?(Y=r.some(k)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.automationProposals,onChange:e=>a({...i,automationProposals:e.target.checked})}),o?`允许模拟和提交自动化提案;创建、修改或启用仍须在宿主逐项审核`:`Allow simulation and automation proposals; creation, changes and activation still require host review`]}):null,t[60]=a,t[61]=r,t[62]=i,t[63]=o,t[64]=Y):Y=t[64];let X;t[65]!==a||t[66]!==r||t[67]!==i||t[68]!==o?(X=r.includes(`capability:xopc.agent.delegate`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`受限 Agent 委托`:`Restricted Agent delegation`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.agentDelegate,onChange:e=>a({...i,agentDelegate:e.target.checked})}),o?`允许发送应用指令、上下文和授权引用到已配置的模型`:`Allow sending app instructions, context and approved references to the configured model`]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`可能产生模型费用。每应用每小时最多 20 次,每次最多 30 秒、4096 输出 token,支持文本或 JSON。无聊天历史、记忆、文件、工具或自动写入权限。预览不运行真实委托。`:`May incur model costs. Up to 20 calls per app per hour, 30 seconds and 4096 output tokens per call, as text or JSON. No chat history, memory, files, tools or automatic writes. Unavailable in previews.`})]}):null,t[65]=a,t[66]=r,t[67]=i,t[68]=o,t[69]=X):X=t[69];let Z;t[70]!==n||t[71]!==a||t[72]!==r||t[73]!==i||t[74]!==o?(Z=r.some(O)?(0,S.jsx)(I,{extensionId:n,value:i,onChange:a,zh:o}):null,t[70]=n,t[71]=a,t[72]=r,t[73]=i,t[74]=o,t[75]=Z):Z=t[75];let Q;t[76]===G?Q=t[77]:(Q=G.filter(D),t[76]=G,t[77]=Q);let $;t[78]!==n||t[79]!==a||t[80]!==Q||t[81]!==i||t[82]!==o?($=Q.map(e=>{let t=i[e.key],r=t=>a({...i,[e.key]:t});return(0,S.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,S.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:e.label}),(0,S.jsxs)(f,{"aria-label":e.label,value:t.mode,onChange:e=>r(e.target.value===`selected`?{mode:`selected`,ids:[],projectIds:[],includeCreated:!1}:{mode:e.target.value}),children:[(0,S.jsx)(p,{value:`none`,children:o?`不允许`:`No access`}),(0,S.jsx)(p,{value:`selected`,children:o?`仅选择的记录或项目`:`Selected records or projects`}),(0,S.jsx)(p,{value:`workspace`,children:o?`整个工作区(包含所有记录)`:`Entire workspace (all records)`})]}),t.mode===`workspace`?(0,S.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:o?`这会授权访问整个工作区,请确认符合此工具的用途。`:`This grants workspace-wide access. Check that this matches the tool’s purpose.`}):null,t.mode===`selected`?(0,S.jsxs)(S.Fragment,{children:[e.kind===`notes`||e.kind===`tasks`?(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:t.includeCreated,onChange:e=>r({...t,includeCreated:e.target.checked})}),e.kind===`notes`?o?`包括此应用创建的笔记`:`Include notes created by this app`:o?`包括此应用创建的任务`:`Include tasks created by this app`]}):null,(0,S.jsx)(C,{extensionId:n,kind:e.kind,values:e.kind===`projects`?[...new Set([...t.ids,...t.projectIds])]:t.ids,onChange:n=>r({...t,ids:n,...e.kind===`projects`?{projectIds:[]}:{}}),zh:o}),e.kind===`projects`?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`也可授权以下项目中的记录,包括以后加入项目的记录。`:`You may also allow records in these projects, including future additions.`}),(0,S.jsx)(C,{extensionId:n,kind:`projects`,values:t.projectIds,onChange:e=>r({...t,projectIds:e}),zh:o})]})]}):null]},e.key)}),t[78]=n,t[79]=a,t[80]=Q,t[81]=i,t[82]=o,t[83]=$):$=t[83];let ne;return t[84]!==K||t[85]!==q||t[86]!==J||t[87]!==Y||t[88]!==X||t[89]!==Z||t[90]!==$?(ne=(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[K,q,J,Y,X,Z,$]}),t[84]=K,t[85]=q,t[86]=J,t[87]=Y,t[88]=X,t[89]=Z,t[90]=$,t[91]=ne):ne=t[91],ne}function D(e){return e.visible}function O(e){return/capability:xopc.automations.(run|cancel)$/.test(e)}function k(e){return/capability:xopc.automations.(propose|get_proposal|simulate)$/.test(e)}function A(e){return/capability:xopc.connectors./.test(e)}function j(e){return/capability:xopc.projects.(update|create_milestone|update_milestone|create_update)$/.test(e)}function M(e){return/capability:xopc.projects.(get|list|list_milestones|list_updates)$/.test(e)}function N(e){return/capability:xopc.tasks.(create|update)$/.test(e)}function P(e){return/capability:xopc.automations.(get|list|get_run|history|run_events)$/.test(e)}function ee(e){return/capability:xopc.tasks.(get|list)$/.test(e)}function te(e){return/capability:xopc.notes.(create|update|append)$/.test(e)}function F(e){return/capability:xopc.notes.(get|list)$/.test(e)}function I(e){let t=(0,v.c)(34),{extensionId:n,value:r,onChange:i,zh:a}=e,[o,s]=(0,_.useState)(``),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},t[0]=c):c=t[0];let[l,u]=(0,_.useState)(c),{data:d,error:f,isLoading:p}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=automations&search=${encodeURIComponent(o)}`,R),h;t[1]!==r.automationsRun.approvals||t[2]!==r.automationsRun.mode?(h=r.automationsRun.mode===`selected`?r.automationsRun.approvals:[],t[1]=r.automationsRun.approvals,t[2]=r.automationsRun.mode,t[3]=h):h=t[3];let y=h,b;t[4]!==i||t[5]!==r?(b=e=>i({...r,automationsRun:e.length?{mode:`selected`,approvals:e}:{mode:`none`}}),t[4]=i,t[5]=r,t[6]=b):b=t[6];let x=b,C=a?`允许执行的自动化`:`Approved automation execution`,w;t[7]===C?w=t[8]:(w=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:C}),t[7]=C,t[8]=w);let T=a?`所选自动化可能使用 Agent 工具、修改文件或向外发送结果,并产生费用。请展开检查后再勾选。应用只能运行确认过的配置,每小时最多 20 次;配置变化需重新授权。授权到期或撤权后,受限运行会中止后续调用。`:`These automations may use Agent tools, change files, send results externally and incur costs. Inspect each before approving. Up to 20 submissions per app per hour. Configuration changes require new approval. Expiry or revocation stops further calls in bounded runs.`,E;t[9]===T?E=t[10]:(E=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-warning`,children:T}),t[9]=T,t[10]=E);let D=a?`搜索可执行自动化`:`Search executable automations`,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>s(e.target.value),t[11]=O):O=t[11];let k=a?`搜索自动化`:`Search automations`,A;t[12]!==o||t[13]!==k||t[14]!==D?(A=(0,S.jsx)(`input`,{"aria-label":D,value:o,onChange:O,placeholder:k,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[12]=o,t[13]=k,t[14]=D,t[15]=A):A=t[15];let j;t[16]!==y||t[17]!==d?.items||t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==x||t[22]!==a?(j=p?(0,S.jsx)(m,{className:`mt-2 h-16`}):f?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载自动化`:`Could not load automations`}):(d?.items??[]).map(e=>{let t=y.some(t=>t.id===e.id&&t.configurationDigest===e.configurationDigest&&t.authority.model&&t.authority.maxRuns>0&&t.authority.expiresAt>Date.now()),n=!t&&y.some(t=>t.id===e.id),r=e.review.action,i=l[e.id]??y.find(t=>t.id===e.id)?.authority??{model:!1,tools:!1,dataWrite:!1,externalSend:!1,expiresAt:Date.now()+36e5,maxRuns:1,maxCostMicrousd:1e6},o=n=>{u(t=>({...t,[e.id]:n})),t&&x([...y.filter(t=>t.id!==e.id),...n.model?[{id:e.id,configurationDigest:e.configurationDigest,authority:n}]:[]])};return(0,S.jsxs)(`details`,{className:`mt-2 rounded-md border border-edge p-2 text-xs text-fg`,children:[(0,S.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.title,n?a?`(配置已改变,需重新确认)`:` (changed; review again)`:``]}),(0,S.jsxs)(`div`,{className:`mt-2 space-y-2 break-words`,children:[(0,S.jsxs)(`p`,{children:[a?`执行方式`:`Action`,`: `,r.kind===`agent`?`Agent`:r.kind===`task_command`?a?`任务命令`:`Task command`:r.kind]}),r.instruction?(0,S.jsx)(`p`,{className:`whitespace-pre-wrap`,children:r.instruction}):null,r.agentId?(0,S.jsxs)(`p`,{children:[`Agent: `,r.agentId]}):null,r.model?(0,S.jsxs)(`p`,{children:[a?`模型`:`Model`,`: `,r.model]}):null,r.workingDirectory?(0,S.jsxs)(`p`,{children:[a?`工作目录`:`Working directory`,`: `,r.workingDirectory]}):null,r.mcpSourceId?(0,S.jsxs)(`p`,{children:[`MCP: `,r.mcpSourceId]}):null,r.taskId?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`p`,{children:[a?`任务`:`Task`,`: `,r.taskId]}),(0,S.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:JSON.stringify(r.command,null,2)})]}):null,(0,S.jsxs)(`p`,{children:[a?`执行策略`:`Safety`,`: `,e.review.safety?.mode??`auto_apply`,` / `,e.review.conversationMode]}),(0,S.jsxs)(`p`,{children:[a?`超时与重试`:`Timeout / retries`,`: `,e.review.reliability?.executionTimeoutSeconds??r.timeoutSeconds??(a?`宿主默认`:`Host default`),` / `,e.review.reliability?.retryCount??0]}),(0,S.jsxs)(`p`,{children:[a?`结果投递`:`Delivery`,`: `,e.review.delivery.destinations.map(L).join(`, `)||(a?`无`:`None`)]}),[`model`,`tools`,`dataWrite`,`externalSend`].map(e=>(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i[e],onChange:t=>o({...i,[e]:t.target.checked})}),{model:a?`允许模型处理(上下文会发送给模型供应商)`:`Allow model processing (context is disclosed to the provider)`,tools:a?`允许本地文件读取工具`:`Allow local file read tools`,dataWrite:a?`允许本地文件写入(工具写入还需允许工具)`:`Allow local file writes (tool writes also require tools)`,externalSend:a?`允许向以上已审核目标投递结果`:`Allow delivery to the reviewed external destinations`}[e]]},e)),(0,S.jsx)(`p`,{className:`text-fg-muted`,children:a?`不开放 Shell、浏览器、MCP 或嵌套委托。预算按已知模型价格预留最坏情况费用,不代表供应商账单封顶;价格未知时拒绝执行。有效期结束或撤权会中止后续调用。`:`Shell, browser, MCP and nested delegation are unavailable. Known model prices reserve worst-case usage; this is not a provider billing guarantee. Unknown pricing is denied. Expiry or revocation stops further calls.`}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`有效时长(分钟)`:`Valid for (minutes)`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`43200`,value:Math.max(0,Math.ceil((i.expiresAt-Date.now())/6e4)),onChange:e=>o({...i,expiresAt:Date.now()+Number(e.target.value)*6e4}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`本次授权最多运行次数`:`Maximum runs for this approval`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`100`,value:i.maxRuns,onChange:e=>o({...i,maxRuns:Number(e.target.value)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`模型预留预算(美元)`:`Model reservation budget (USD)`,(0,S.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`0.001`,value:i.maxCostMicrousd/1e6,onChange:e=>o({...i,maxCostMicrousd:Math.round(Number(e.target.value)*1e6)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,disabled:!e.runnable||!i.model||i.expiresAt<=Date.now()||i.maxRuns<1,checked:t,onChange:t=>x([...y.filter(t=>t.id!==e.id),...t.target.checked?[{id:e.id,configurationDigest:e.configurationDigest,authority:i}]:[]])}),e.runnable?a?`允许此应用运行以上配置`:`Allow this app to run this configuration`:a?`此自动化当前不可授权执行`:`This automation cannot currently be approved`]})]})]},e.id)}),t[16]=y,t[17]=d?.items,t[18]=l,t[19]=f,t[20]=p,t[21]=x,t[22]=a,t[23]=j):j=t[23];let M;t[24]!==y.length||t[25]!==x||t[26]!==a?(M=y.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>x([]),children:[a?`清除所有执行授权`:`Clear all execution approvals`,` (`,y.length,`)`]}):null,t[24]=y.length,t[25]=x,t[26]=a,t[27]=M):M=t[27];let N;return t[28]!==A||t[29]!==j||t[30]!==M||t[31]!==w||t[32]!==E?(N=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[w,E,A,j,M]}),t[28]=A,t[29]=j,t[30]=M,t[31]=w,t[32]=E,t[33]=N):N=t[33],N}function L(e){return[e.kind,e.endpoint??e.conversationId??e.pathTemplate??e.channelId,e.targetId??e.templateId].filter(Boolean).join(`: `)}function R(e){return o(i(e))}function z(e){let t=(0,v.c)(25),{extensionId:n,value:r,onChange:i,zh:a}=e,{data:o,error:s,isLoading:c}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=connectors`,B),l;t[0]!==r.connectors.bindings||t[1]!==r.connectors.mode?(l=r.connectors.mode===`selected`?r.connectors.bindings:[],t[0]=r.connectors.bindings,t[1]=r.connectors.mode,t[2]=l):l=t[2];let u=l,d=a?`外部服务与账户`:`External services and accounts`,f;t[3]===d?f=t[4]:(f=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:d}),t[3]=d,t[4]=f);let p=a?`仅允许以下账户和操作。读取受连接器现有策略约束;写入每次另行审核。重新连接或操作契约变化后需重新选择,可能产生外部服务费用。`:`Only these accounts and actions. Reads retain existing connector policy; writes require a separate review each time. Reconnection or contract changes require a new selection. External service fees may apply.`,h;t[5]===p?h=t[6]:(h=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p}),t[5]=p,t[6]=h);let _;t[7]!==u||t[8]!==o?.items||t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==r||t[13]!==a?(_=c?(0,S.jsx)(m,{className:`h-20`}):s?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载连接器`:`Could not load connectors`}):(o?.items??[]).map(e=>(0,S.jsxs)(`label`,{className:`my-2 flex items-start gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:u.some(t=>JSON.stringify(t)===JSON.stringify(e.binding)),onChange:t=>{let n=u.filter(t=>!(t.toolRef===e.binding.toolRef&&t.accountId===e.binding.accountId));t.target.checked&&n.push(e.binding),i({...r,connectors:n.length?{mode:`selected`,bindings:n}:{mode:`none`}})}}),e.title]},e.id)),t[7]=u,t[8]=o?.items,t[9]=s,t[10]=c,t[11]=i,t[12]=r,t[13]=a,t[14]=_):_=t[14];let y;t[15]!==u.length||t[16]!==i||t[17]!==r||t[18]!==a?(y=u.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>i({...r,connectors:{mode:`none`}}),children:[a?`清除连接器授权`:`Clear connector approvals`,` (`,u.length,`)`]}):null,t[15]=u.length,t[16]=i,t[17]=r,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==h||t[22]!==_||t[23]!==y?(b=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[f,h,_,y]}),t[20]=f,t[21]=h,t[22]=_,t[23]=y,t[24]=b):b=t[24],b}function B(e){return o(i(e))}function V(e){let t=(0,v.c)(63),{open:n,onOpenChange:r,extensionId:i,extensionName:o,permissions:d,onConfirm:f,confirmDisabled:p,localApp:m,resourceScopes:g,error:y}=e,b=a(U),C=s(b).extensionUi,w;t[0]===g?w=t[1]:(w=()=>h.parse(g??{}),t[0]=g,t[1]=w);let[T,D]=(0,_.useState)(w),O;t[2]!==g||t[3]!==D?(O=()=>D(h.parse(g??{})),t[2]=g,t[3]=D,t[4]=O):O=t[4];let k;t[5]!==i||t[6]!==g?(k=[g,i],t[5]=i,t[6]=g,t[7]=k):k=t[7],(0,_.useEffect)(O,k);let A=l,j=l,M;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,S.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[8]=M):M=t[8];let N=l,P=H,ee=l,te=C.permissionTitle.replace(`{{name}}`,o),F;t[9]!==ee.Title||t[10]!==te?(F=(0,S.jsx)(ee.Title,{className:`text-base font-semibold text-fg`,children:te}),t[9]=ee.Title,t[10]=te,t[11]=F):F=t[11];let I;t[12]===i?I=t[13]:(I=(0,S.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[12]=i,t[13]=I);let L;t[14]!==C.permissionSubtitle||t[15]!==I?(L=(0,S.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[C.permissionSubtitle,` `,I]}),t[14]=C.permissionSubtitle,t[15]=I,t[16]=L):L=t[16];let R;t[17]!==b||t[18]!==d||t[19]!==C.permissionsNone?(R=d.length===0?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:C.permissionsNone}):(0,S.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:d.map(e=>(0,S.jsx)(`li`,{children:x(e,b)},e))}),t[17]=b,t[18]=d,t[19]=C.permissionsNone,t[20]=R):R=t[20];let z;t[21]!==i||t[22]!==b||t[23]!==m||t[24]!==d||t[25]!==T||t[26]!==D?(z=m?(0,S.jsx)(E,{extensionId:i,permissions:d,value:T,onChange:D,zh:b===`zh`}):null,t[21]=i,t[22]=b,t[23]=m,t[24]=d,t[25]=T,t[26]=D,t[27]=z):z=t[27];let B;t[28]!==R||t[29]!==z?(B=(0,S.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[R,z]}),t[28]=R,t[29]=z,t[30]=B):B=t[30];let V;t[31]===y?V=t[32]:(V=y?(0,S.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:y}):null,t[31]=y,t[32]=V);let W;t[33]===C.deny?W=t[34]:(W=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:C.deny})}),t[33]=C.deny,t[34]=W);let G;t[35]!==m||t[36]!==f||t[37]!==T?(G=()=>{f(m?T:void 0)},t[35]=m,t[36]=f,t[37]=T,t[38]=G):G=t[38];let K;t[39]!==p||t[40]!==C.allow||t[41]!==G?(K=(0,S.jsx)(`button`,{type:`button`,disabled:p,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:G,children:C.allow}),t[39]=p,t[40]=C.allow,t[41]=G,t[42]=K):K=t[42];let q;t[43]!==W||t[44]!==K?(q=(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[W,K]}),t[43]=W,t[44]=K,t[45]=q):q=t[45];let J;t[46]!==F||t[47]!==L||t[48]!==B||t[49]!==V||t[50]!==q||t[51]!==N.Content||t[52]!==P?(J=(0,S.jsxs)(N.Content,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,onOpenAutoFocus:P,children:[F,L,B,V,q]}),t[46]=F,t[47]=L,t[48]=B,t[49]=V,t[50]=q,t[51]=N.Content,t[52]=P,t[53]=J):J=t[53];let Y;t[54]!==J||t[55]!==j.Portal||t[56]!==M?(Y=(0,S.jsxs)(j.Portal,{children:[M,J]}),t[54]=J,t[55]=j.Portal,t[56]=M,t[57]=Y):Y=t[57];let X;return t[58]!==r||t[59]!==n||t[60]!==Y||t[61]!==A.Root?(X=(0,S.jsx)(A.Root,{open:n,onOpenChange:r,children:Y}),t[58]=r,t[59]=n,t[60]=Y,t[61]=A.Root,t[62]=X):X=t[62],X}function H(e){return e.preventDefault()}function U(e){return e.language}async function W(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function G(e,t,n){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t,resourceScopes:n})})).grant}export{E as i,W as n,V as r,G as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-cg9cm2EL.js";import{t as i}from"./messages-eQ2CYlpG.js";import{r as a}from"./extension-provider-CbVokTvd.js";import{n as o,t as s}from"./settings-page-header-BSMu5Zq3.js";import"./settings-page-layout-B_vMffB1.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=r(p),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-Dy1EByeG.js";import{t as i}from"./messages-BAnhwALN.js";import{r as a}from"./extension-provider-BPIoHw4r.js";import{n as o,t as s}from"./settings-page-header-DEZZ8D0S.js";import"./settings-page-layout-De2j64Lo.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=r(p),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
@@ -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,l as a,n as o,o as s}from"./locale-store-cg9cm2EL.js";import{t as ee}from"./messages-eQ2CYlpG.js";import{a as c,i as l,o as u,r as d,s as te,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{i as h}from"./theme-store-GZQ3pTgy.js";import{n as g}from"./extension-provider-CbVokTvd.js";import{r as _}from"./extension-message-router-Dn8JzOdR.js";import{r as v}from"./settings-form-draft-Dy10ldo8.js";import{n as y,r as b,t as x}from"./extension-authoritative-grants-C0ReZguU.js";var S=e(t(),1),ne=n();function C(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function w(e,t){let n=C(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var T=r();function E({extensionId:e,proposalId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/automation-proposals/${encodeURIComponent(t)}`,{data:o,error:ee,isLoading:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(``),ne=async e=>{if(o){y(!0),x(``);try{await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.proposal.digest,approve:e,enable:e&&(o.proposal.decision?.enable??g)})}),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!v&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用提出的自动化`:`Review app automation proposal`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`只有你在宿主中确认,才会创建或修改自动化。关闭此窗口不会批准提案。`:`Only your confirmation here creates or changes an automation. Closing this window grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:h?(0,T.jsx)(p,{className:`h-48`}):ee?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取提案,请重新打开或检查授权。`:`Could not load proposal. Reopen or check authorization.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.proposal.status]}),o.proposal.decision?(0,T.jsx)(`p`,{children:n?`审核正在应用;重试将核对原操作结果。`:`Review is being applied; retry to reconcile the original operation.`}):null,o.simulation?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{children:o.simulation.triggerSummary}),(0,T.jsx)(`p`,{children:o.simulation.actionSummary}),[...o.simulation.safetyNotes,...o.simulation.requiredConfirmations].map((e,t)=>(0,T.jsx)(`p`,{className:`text-warning`,children:e},t))]}):null,o.before?(0,T.jsxs)(`details`,{children:[(0,T.jsx)(`summary`,{children:n?`变更前的完整配置`:`Full configuration before change`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.before,null,2)})]}):null,o.definition?(0,T.jsxs)(`details`,{open:!0,children:[(0,T.jsx)(`summary`,{children:n?`待采用的完整配置`:`Full proposed configuration`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.definition,null,2)})]}):null,o.proposal.status===`pending`?(0,T.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,T.jsx)(`input`,{type:`checkbox`,disabled:!!o.proposal.decision,checked:o.proposal.decision?.enable??g,onChange:e=>_(e.target.checked)}),n?`采用后启用。计划将由宿主持续管理,可能调用工具、产生费用或对外发送结果;不会受应用手动运行的次数预算约束。`:`Enable after adoption. The host will manage this schedule independently; it may use tools, incur costs or send results. App manual-run budgets do not limit this adopted schedule.`]}):null]}):null}),b?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:b}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||!!o.proposal.decision||o.proposal.status!==`pending`,onClick:()=>void ne(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝提案`:`Reject proposal`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||o.proposal.status!==`pending`,onClick:()=>void ne(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:n?`确认采用`:`Approve proposal`})]})]})]})})}function D({extensionId:e,requestId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/resource-requests/${encodeURIComponent(t)}`,{data:o,isLoading:ee,error:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(``),b=async e=>{if(o){_(!0),y(``);try{let t=await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.request.digest,approve:e})});if(e&&t.status===`approved`&&o.request.kind===`export`){let e=o.request.input,t=e.encoding===`base64`?Uint8Array.from(atob(e.content??``),e=>e.charCodeAt(0)):new TextEncoder().encode(e.content??``),n=URL.createObjectURL(new Blob([t],{type:`application/octet-stream`})),r=document.createElement(`a`);r.href=n,r.download=e.name??`export.bin`,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}r()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!g&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用资源请求`:`Review app resource request`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`连接器操作绑定以下账户和完整参数,可能产生外部影响或费用。文件导出由浏览器保存,不覆盖 Gateway 文件。关闭窗口不会批准请求。`:`Connector operations use the exact account and arguments below and may cause external effects or fees. Exports are browser saves and do not overwrite Gateway files. Closing grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:ee?(0,T.jsx)(p,{className:`h-48`}):h?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取请求,请检查授权后重试。`:`Could not load request. Check authorization and retry.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.request.status]}),o.request.accountLabel?(0,T.jsxs)(`p`,{children:[n?`账户`:`Account`,`: `,o.request.accountLabel]}):null,o.request.binding?(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.binding,null,2)}):null,(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.input,null,2)})]}):null}),v?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:v}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:g,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||o.request.status!==`pending`,onClick:()=>void b(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝请求`:`Reject request`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||![`pending`,`approved`].includes(o.request.status),onClick:()=>void b(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:o?.request.kind===`export`?n?`确认并保存文件`:`Approve and save file`:n?`确认执行`:`Approve execution`})]})]})]})})}function re(e){let t=(0,ne.c)(36),{prompt:n,zh:r,onClose:i}=e,[a,o]=(0,S.useState)(``),[s,ee]=(0,S.useState)(!1),p;t[0]!==i||t[1]!==n?(p=()=>{n.finish().catch(O),i()},t[0]=i,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==s||t[4]!==m?(h=e=>{!e&&!s&&m()},t[3]=s,t[4]=m,t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),t[6]=g):g=t[6];let _=r?`选择要交给应用的附件`:`Choose an attachment for this app`,v;t[7]===_?v=t[8]:(v=(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:_}),t[7]=_,t[8]=v);let y=r?`应用将获得你在此选择的文件内容(最多 512 KiB),不会获得本机路径。取消不会交付任何文件。`:`The app receives the chosen file content (up to 512 KiB), without your local path. Canceling delivers nothing.`,b;t[9]===y?b=t[10]:(b=(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:y}),t[9]=y,t[10]=b);let x=r?`选择附件`:`Choose attachment`,C;t[11]!==i||t[12]!==n||t[13]!==r?(C=e=>{let t=e.target.files?.[0];if(t){if(t.size>524288){o(r?`文件超过 512 KiB`:`File exceeds 512 KiB`);return}ee(!0),o(``),t.arrayBuffer().then(async e=>{let r=new Uint8Array(e),a=``;for(let e=0;e<r.length;e+=8192)a+=String.fromCharCode(...r.subarray(e,e+8192));await n.finish({name:t.name,mimeType:t.type||`application/octet-stream`,size:r.length,encoding:`base64`,content:btoa(a)}),i()}).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>ee(!1))}},t[11]=i,t[12]=n,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==s||t[16]!==x||t[17]!==C?(w=(0,T.jsx)(`input`,{type:`file`,"aria-label":x,disabled:s,onChange:C}),t[15]=s,t[16]=x,t[17]=C,t[18]=w):w=t[18];let E;t[19]===a?E=t[20]:(E=a?(0,T.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:a}):null,t[19]=a,t[20]=E);let D;t[21]!==w||t[22]!==E?(D=(0,T.jsxs)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-y-auto`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let re=r?`取消`:`Cancel`,k;t[24]!==s||t[25]!==m||t[26]!==re?(k=(0,T.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,T.jsx)(`button`,{type:`button`,disabled:s,onClick:m,className:`rounded-lg border border-edge px-3 py-2`,children:re})}),t[24]=s,t[25]=m,t[26]=re,t[27]=k):k=t[27];let A;t[28]!==D||t[29]!==k||t[30]!==v||t[31]!==b?(A=(0,T.jsxs)(u,{children:[g,(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(360px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[v,b,D,k]})]}),t[28]=D,t[29]=k,t[30]=v,t[31]=b,t[32]=A):A=t[32];let ie;return t[33]!==A||t[34]!==h?(ie=(0,T.jsx)(f,{open:!0,onOpenChange:h,children:A}),t[33]=A,t[34]=h,t[35]=ie):ie=t[35],ie}function O(){}var k=48,A=2e3,ie=`allow-scripts allow-forms allow-popups`;function j(e){let t=(0,ne.c)(155),{extensionId:n,extensionName:r,entrypoint:i,permissions:s,title:c,className:l,fixedHeight:u,maxHeight:d,minHeight:te,initialData:f}=e,p=d===void 0?A:d,m=te===void 0?k:te,C=o(ce),O;t[0]===C?O=t[1]:(O=ee(C),t[0]=C,t[1]=O);let j=O.extensionUi,M=g(),N=a(se),P=a(oe),F=(0,S.useRef)(0),le=(0,S.useRef)(!1),[I,ue]=(0,S.useState)(null),[L,de]=(0,S.useState)(null),[R,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),he;t[2]!==n||t[3]!==N||t[4]!==P?(he=JSON.stringify([n,N,P]),t[2]=n,t[3]=N,t[4]=P,t[5]=he):he=t[5];let z=he,ge,_e;t[6]!==n||t[7]!==z?(ge=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&fe({id:t.requestId,identity:z})},t=e=>{let t=e.detail;t?.extensionId===n&&me({prompt:t,identity:z})};return window.addEventListener(`extension-review-resource-request`,e),window.addEventListener(`extension-pick-attachment`,t),()=>{window.removeEventListener(`extension-review-resource-request`,e),window.removeEventListener(`extension-pick-attachment`,t)}},_e=[n,z],t[6]=n,t[7]=z,t[8]=ge,t[9]=_e):(ge=t[8],_e=t[9]),(0,S.useEffect)(ge,_e);let ve,ye;t[10]!==n||t[11]!==z?(ve=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&de({id:t.proposalId,identity:z})};return window.addEventListener(`extension-review-automation-proposal`,e),()=>window.removeEventListener(`extension-review-automation-proposal`,e)},ye=[n,z],t[10]=n,t[11]=z,t[12]=ve,t[13]=ye):(ve=t[12],ye=t[13]),(0,S.useEffect)(ve,ye);let be=(0,S.useRef)(null),xe=h(ae),Se;t[14]!==n||t[15]!==r?(Se=r?.trim()||n,t[14]=n,t[15]=r,t[16]=Se):Se=t[16];let Ce=Se,we;t[17]!==n||t[18]!==c?(we=c?.trim()||`Extension ${n}`,t[17]=n,t[18]=c,t[19]=we):we=t[19];let Te=we,Ee;t[20]===s?Ee=t[21]:(Ee=JSON.stringify(Array.from(s??[]).toSorted()),t[20]=s,t[21]=Ee);let De=Ee,Oe;t[22]===De?Oe=t[23]:(Oe=JSON.parse(De),t[22]=De,t[23]=Oe);let ke=Oe,Ae=u??Math.min(p,Math.max(m,320)),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[24]=je):je=t[24];let Me;t[25]===Ae?Me=t[26]:(Me={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:Ae,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:je},t[25]=Ae,t[26]=Me);let[B,V]=(0,S.useReducer)(v,Me),{allowed:H,dialogOpen:U,reloadKey:W,loadError:Ne,dynamicHeight:Pe,grantResolved:Fe,grantError:G}=B,Ie;t[27]===n?Ie=t[28]:(Ie=()=>{let e=!0;return le.current=!1,ue(null),V({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),y(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);V({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions,grantRevision:t.grantRevision,localApp:!!t.appId,resourceScopes:t.resourceScopes}})}}).catch(t=>{e&&V({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,F.current+=1}},t[27]=n,t[28]=Ie);let Le;t[29]!==n||t[30]!==N||t[31]!==P||t[32]!==ke||t[33]!==W?(Le=[n,ke,N,P,W],t[29]=n,t[30]=N,t[31]=P,t[32]=ke,t[33]=W,t[34]=Le):Le=t[34],(0,S.useEffect)(Ie,Le);let Re;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(Re=e=>V({type:`patch`,patch:{dialogOpen:e}}),t[35]=Re):Re=t[35];let ze=Re,Be,Ve;t[36]!==n||t[37]!==N||t[38]!==P||t[39]!==j.loadFailed?(Be=()=>{let e=e=>{if(e.detail?.extensionId!==n)return;let t=F.current;y(n).then(e=>{t!==F.current||a.getState().baseUrl!==N||a.getState().conversationId!==P||(ue(e),V({type:`patch`,patch:{dialogOpen:!0,grantError:null}}))}).catch(()=>V({type:`patch`,patch:{grantError:j.loadFailed}}))};return window.addEventListener(`extension-review-permissions`,e),()=>window.removeEventListener(`extension-review-permissions`,e)},Ve=[n,N,P,j.loadFailed],t[36]=n,t[37]=N,t[38]=P,t[39]=j.loadFailed,t[40]=Be,t[41]=Ve):(Be=t[40],Ve=t[41]),(0,S.useEffect)(Be,Ve);let He;t[42]!==i||t[43]!==n?(He=w(n,i),t[42]=i,t[43]=n,t[44]=He):He=t[44];let Ue=He,We;t[45]!==H||t[46]!==n||t[47]!==u||t[48]!==p||t[49]!==m||t[50]!==M||t[51]!==B.grantRevision||t[52]!==B.grantedPermissions||t[53]!==B.localApp||t[54]!==B.manifestDigest?(We=()=>{if(!H)return;let e=be.current;if(!e)return;B.localApp?M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0,B.grantRevision,!0):M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0);let t=M.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&u===void 0&&V({type:`patch`,patch:{dynamicHeight:Math.min(p,Math.max(m,t))}})});return()=>{t(),M.unregisterIframe(n)}},t[45]=H,t[46]=n,t[47]=u,t[48]=p,t[49]=m,t[50]=M,t[51]=B.grantRevision,t[52]=B.grantedPermissions,t[53]=B.localApp,t[54]=B.manifestDigest,t[55]=We):We=t[55];let Ge;t[56]!==H||t[57]!==n||t[58]!==u||t[59]!==p||t[60]!==m||t[61]!==W||t[62]!==M||t[63]!==B.grantRevision||t[64]!==B.grantedPermissions||t[65]!==B.localApp||t[66]!==B.manifestDigest?(Ge=[H,n,u,p,m,B.grantedPermissions,B.manifestDigest,B.grantRevision,B.localApp,M,W],t[56]=H,t[57]=n,t[58]=u,t[59]=p,t[60]=m,t[61]=W,t[62]=M,t[63]=B.grantRevision,t[64]=B.grantedPermissions,t[65]=B.localApp,t[66]=B.manifestDigest,t[67]=Ge):Ge=t[67],(0,S.useLayoutEffect)(We,Ge);let Ke,qe;t[68]!==H||t[69]!==n||t[70]!==xe||t[71]!==M?(Ke=()=>{if(!H)return;let e=_(xe);M.sendEvent(n,`theme.changed`,e)},qe=[H,n,xe,M],t[68]=H,t[69]=n,t[70]=xe,t[71]=M,t[72]=Ke,t[73]=qe):(Ke=t[72],qe=t[73]),(0,S.useEffect)(Ke,qe);let Je;t[74]!==Pe||t[75]!==u?(Je=u===void 0?{width:`100%`,height:Pe,border:`none`}:{width:`100%`,height:u,border:`none`},t[74]=Pe,t[75]=u,t[76]=Je):Je=t[76];let Ye=Je,Xe;t[77]!==H||t[78]!==n||t[79]!==N||t[80]!==P||t[81]!==W||t[82]!==I?.manifestDigest||t[83]!==B.localApp||t[84]!==B.manifestDigest?(Xe=e=>{let t=I?.manifestDigest??B.manifestDigest;if(le.current||!t)return;le.current=!0;let r=F.current,i=()=>F.current===r&&a.getState().baseUrl===N&&a.getState().conversationId===P;(B.localApp?x(n,t,e):x(n,t)).then(e=>{if(i()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==t)throw Error(`Permission grant was not persisted`);ue(null),V({type:`patch`,patch:{allowed:!0,dialogOpen:!1,grantError:null,manifestDigest:e.manifestDigest,grantedPermissions:e.permissions,grantRevision:e.grantRevision,resourceScopes:e.resourceScopes,reloadKey:H?W+1:W}})}}).catch(e=>{i()&&V({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{i()&&(le.current=!1)})},t[77]=H,t[78]=n,t[79]=N,t[80]=P,t[81]=W,t[82]=I?.manifestDigest,t[83]=B.localApp,t[84]=B.manifestDigest,t[85]=Xe):Xe=t[85];let Ze=Xe,Qe=I?.permissions??B.grantedPermissions,$e=I?.resourceScopes??B.resourceScopes,et=!(I?.manifestDigest??B.manifestDigest),tt;t[86]!==U||t[87]!==Ce||t[88]!==n||t[89]!==G||t[90]!==Ze||t[91]!==Qe||t[92]!==$e||t[93]!==et||t[94]!==B.localApp?(tt=(0,T.jsx)(b,{open:U,onOpenChange:ze,extensionId:n,extensionName:Ce,permissions:Qe,localApp:B.localApp,resourceScopes:$e,error:G,confirmDisabled:et,onConfirm:Ze}),t[86]=U,t[87]=Ce,t[88]=n,t[89]=G,t[90]=Ze,t[91]=Qe,t[92]=$e,t[93]=et,t[94]=B.localApp,t[95]=tt):tt=t[95];let K=tt;if(!Fe){let e=`${l??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[96]===e?n=t[97]:(n=(0,T.jsx)(`div`,{className:e}),t[96]=e,t[97]=n),n}if(!H){let e;t[98]!==l||t[99]!==U||t[100]!==G||t[101]!==W||t[102]!==j.deniedHint||t[103]!==j.reviewPermissions?(e=U?null:(0,T.jsxs)(`div`,{className:l?`${l} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[G?(0,T.jsx)(`p`,{className:`mb-2 text-danger`,children:G}):null,(0,T.jsx)(`p`,{children:j.deniedHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>V({type:`patch`,patch:{reloadKey:W+1}}),children:j.reviewPermissions})]}),t[98]=l,t[99]=U,t[100]=G,t[101]=W,t[102]=j.deniedHint,t[103]=j.reviewPermissions,t[104]=e):e=t[104];let n;return t[105]!==K||t[106]!==e?(n=(0,T.jsxs)(T.Fragment,{children:[K,e]}),t[105]=K,t[106]=e,t[107]=n):n=t[107],n}let q;t[108]!==n||t[109]!==C||t[110]!==z||t[111]!==R||t[112]!==B.localApp?(q=B.localApp&&R?.identity===z?(0,T.jsx)(D,{extensionId:n,requestId:R.id,zh:C===`zh`,onClose:()=>fe(null)},R.id):null,t[108]=n,t[109]=C,t[110]=z,t[111]=R,t[112]=B.localApp,t[113]=q):q=t[113];let J;t[114]!==pe||t[115]!==C||t[116]!==z||t[117]!==B.localApp?(J=B.localApp&&pe?.identity===z?(0,T.jsx)(re,{prompt:pe.prompt,zh:C===`zh`,onClose:()=>me(null)}):null,t[114]=pe,t[115]=C,t[116]=z,t[117]=B.localApp,t[118]=J):J=t[118];let Y;t[119]!==n||t[120]!==C||t[121]!==z||t[122]!==L||t[123]!==B.localApp?(Y=B.localApp&&L?.identity===z?(0,T.jsx)(E,{extensionId:n,proposalId:L.id,zh:C===`zh`,onClose:()=>de(null)},L.id):null,t[119]=n,t[120]=C,t[121]=z,t[122]=L,t[123]=B.localApp,t[124]=Y):Y=t[124];let X;t[125]===G?X=t[126]:(X=G?(0,T.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:G}):null,t[125]=G,t[126]=X);let Z;t[127]!==Ne||t[128]!==W||t[129]!==j.loadFailed||t[130]!==j.loadFailedConnectionHint||t[131]!==j.retryLoad?(Z=Ne?(0,T.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,T.jsx)(`p`,{children:j.loadFailed}),(0,T.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j.loadFailedConnectionHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{V({type:`patch`,patch:{loadError:!1,reloadKey:W+1}})},children:j.retryLoad})]}):null,t[127]=Ne,t[128]=W,t[129]=j.loadFailed,t[130]=j.loadFailedConnectionHint,t[131]=j.retryLoad,t[132]=Z):Z=t[132];let nt=`${n}-${i}-${W}`,rt=B.localApp?`allow-scripts`:ie,it;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>V({type:`patch`,patch:{loadError:!0}}),t[133]=it):it=t[133];let Q;t[134]!==n||t[135]!==f||t[136]!==C||t[137]!==M?(Q=()=>{V({type:`patch`,patch:{loadError:!1}}),M.sendInit(n,_(h.getState().resolved),C),f!==void 0&&M.sendEvent(n,`widget.data`,f)},t[134]=n,t[135]=f,t[136]=C,t[137]=M,t[138]=Q):Q=t[138];let $;t[139]!==l||t[140]!==Te||t[141]!==Ue||t[142]!==Ye||t[143]!==nt||t[144]!==rt||t[145]!==Q?($=(0,T.jsx)(`iframe`,{ref:be,className:l,title:Te,src:Ue,style:Ye,sandbox:rt,referrerPolicy:`no-referrer`,onError:it,onLoad:Q},nt),t[139]=l,t[140]=Te,t[141]=Ue,t[142]=Ye,t[143]=nt,t[144]=rt,t[145]=Q,t[146]=$):$=t[146];let at;return t[147]!==K||t[148]!==q||t[149]!==J||t[150]!==Y||t[151]!==X||t[152]!==Z||t[153]!==$?(at=(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[q,J,Y,K,X,Z,$]}),t[147]=K,t[148]=q,t[149]=J,t[150]=Y,t[151]=X,t[152]=Z,t[153]=$,t[154]=at):at=t[154],at}function ae(e){return e.resolved}function oe(e){return e.conversationId}function se(e){return e.baseUrl}function ce(e){return e.language}export{j as t};
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,l as a,n as o,o as s}from"./locale-store-Dy1EByeG.js";import{t as ee}from"./messages-BAnhwALN.js";import{a as c,i as l,o as u,r as d,s as te,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{i as h}from"./theme-store-BaWep_o7.js";import{n as g}from"./extension-provider-BPIoHw4r.js";import{r as _}from"./extension-message-router-C9JDpo_7.js";import{r as v}from"./settings-form-draft-Dy10ldo8.js";import{n as y,r as b,t as x}from"./extension-authoritative-grants-BfL8dMBf.js";var S=e(t(),1),ne=n();function C(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function w(e,t){let n=C(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var T=r();function E({extensionId:e,proposalId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/automation-proposals/${encodeURIComponent(t)}`,{data:o,error:ee,isLoading:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(``),ne=async e=>{if(o){y(!0),x(``);try{await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.proposal.digest,approve:e,enable:e&&(o.proposal.decision?.enable??g)})}),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!v&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用提出的自动化`:`Review app automation proposal`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`只有你在宿主中确认,才会创建或修改自动化。关闭此窗口不会批准提案。`:`Only your confirmation here creates or changes an automation. Closing this window grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:h?(0,T.jsx)(p,{className:`h-48`}):ee?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取提案,请重新打开或检查授权。`:`Could not load proposal. Reopen or check authorization.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.proposal.status]}),o.proposal.decision?(0,T.jsx)(`p`,{children:n?`审核正在应用;重试将核对原操作结果。`:`Review is being applied; retry to reconcile the original operation.`}):null,o.simulation?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{children:o.simulation.triggerSummary}),(0,T.jsx)(`p`,{children:o.simulation.actionSummary}),[...o.simulation.safetyNotes,...o.simulation.requiredConfirmations].map((e,t)=>(0,T.jsx)(`p`,{className:`text-warning`,children:e},t))]}):null,o.before?(0,T.jsxs)(`details`,{children:[(0,T.jsx)(`summary`,{children:n?`变更前的完整配置`:`Full configuration before change`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.before,null,2)})]}):null,o.definition?(0,T.jsxs)(`details`,{open:!0,children:[(0,T.jsx)(`summary`,{children:n?`待采用的完整配置`:`Full proposed configuration`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.definition,null,2)})]}):null,o.proposal.status===`pending`?(0,T.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,T.jsx)(`input`,{type:`checkbox`,disabled:!!o.proposal.decision,checked:o.proposal.decision?.enable??g,onChange:e=>_(e.target.checked)}),n?`采用后启用。计划将由宿主持续管理,可能调用工具、产生费用或对外发送结果;不会受应用手动运行的次数预算约束。`:`Enable after adoption. The host will manage this schedule independently; it may use tools, incur costs or send results. App manual-run budgets do not limit this adopted schedule.`]}):null]}):null}),b?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:b}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||!!o.proposal.decision||o.proposal.status!==`pending`,onClick:()=>void ne(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝提案`:`Reject proposal`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||o.proposal.status!==`pending`,onClick:()=>void ne(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:n?`确认采用`:`Approve proposal`})]})]})]})})}function D({extensionId:e,requestId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/resource-requests/${encodeURIComponent(t)}`,{data:o,isLoading:ee,error:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(``),b=async e=>{if(o){_(!0),y(``);try{let t=await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.request.digest,approve:e})});if(e&&t.status===`approved`&&o.request.kind===`export`){let e=o.request.input,t=e.encoding===`base64`?Uint8Array.from(atob(e.content??``),e=>e.charCodeAt(0)):new TextEncoder().encode(e.content??``),n=URL.createObjectURL(new Blob([t],{type:`application/octet-stream`})),r=document.createElement(`a`);r.href=n,r.download=e.name??`export.bin`,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}r()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!g&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用资源请求`:`Review app resource request`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`连接器操作绑定以下账户和完整参数,可能产生外部影响或费用。文件导出由浏览器保存,不覆盖 Gateway 文件。关闭窗口不会批准请求。`:`Connector operations use the exact account and arguments below and may cause external effects or fees. Exports are browser saves and do not overwrite Gateway files. Closing grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:ee?(0,T.jsx)(p,{className:`h-48`}):h?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取请求,请检查授权后重试。`:`Could not load request. Check authorization and retry.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.request.status]}),o.request.accountLabel?(0,T.jsxs)(`p`,{children:[n?`账户`:`Account`,`: `,o.request.accountLabel]}):null,o.request.binding?(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.binding,null,2)}):null,(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.input,null,2)})]}):null}),v?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:v}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:g,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||o.request.status!==`pending`,onClick:()=>void b(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝请求`:`Reject request`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||![`pending`,`approved`].includes(o.request.status),onClick:()=>void b(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:o?.request.kind===`export`?n?`确认并保存文件`:`Approve and save file`:n?`确认执行`:`Approve execution`})]})]})]})})}function re(e){let t=(0,ne.c)(36),{prompt:n,zh:r,onClose:i}=e,[a,o]=(0,S.useState)(``),[s,ee]=(0,S.useState)(!1),p;t[0]!==i||t[1]!==n?(p=()=>{n.finish().catch(O),i()},t[0]=i,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==s||t[4]!==m?(h=e=>{!e&&!s&&m()},t[3]=s,t[4]=m,t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),t[6]=g):g=t[6];let _=r?`选择要交给应用的附件`:`Choose an attachment for this app`,v;t[7]===_?v=t[8]:(v=(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:_}),t[7]=_,t[8]=v);let y=r?`应用将获得你在此选择的文件内容(最多 512 KiB),不会获得本机路径。取消不会交付任何文件。`:`The app receives the chosen file content (up to 512 KiB), without your local path. Canceling delivers nothing.`,b;t[9]===y?b=t[10]:(b=(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:y}),t[9]=y,t[10]=b);let x=r?`选择附件`:`Choose attachment`,C;t[11]!==i||t[12]!==n||t[13]!==r?(C=e=>{let t=e.target.files?.[0];if(t){if(t.size>524288){o(r?`文件超过 512 KiB`:`File exceeds 512 KiB`);return}ee(!0),o(``),t.arrayBuffer().then(async e=>{let r=new Uint8Array(e),a=``;for(let e=0;e<r.length;e+=8192)a+=String.fromCharCode(...r.subarray(e,e+8192));await n.finish({name:t.name,mimeType:t.type||`application/octet-stream`,size:r.length,encoding:`base64`,content:btoa(a)}),i()}).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>ee(!1))}},t[11]=i,t[12]=n,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==s||t[16]!==x||t[17]!==C?(w=(0,T.jsx)(`input`,{type:`file`,"aria-label":x,disabled:s,onChange:C}),t[15]=s,t[16]=x,t[17]=C,t[18]=w):w=t[18];let E;t[19]===a?E=t[20]:(E=a?(0,T.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:a}):null,t[19]=a,t[20]=E);let D;t[21]!==w||t[22]!==E?(D=(0,T.jsxs)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-y-auto`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let re=r?`取消`:`Cancel`,k;t[24]!==s||t[25]!==m||t[26]!==re?(k=(0,T.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,T.jsx)(`button`,{type:`button`,disabled:s,onClick:m,className:`rounded-lg border border-edge px-3 py-2`,children:re})}),t[24]=s,t[25]=m,t[26]=re,t[27]=k):k=t[27];let A;t[28]!==D||t[29]!==k||t[30]!==v||t[31]!==b?(A=(0,T.jsxs)(u,{children:[g,(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(360px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[v,b,D,k]})]}),t[28]=D,t[29]=k,t[30]=v,t[31]=b,t[32]=A):A=t[32];let ie;return t[33]!==A||t[34]!==h?(ie=(0,T.jsx)(f,{open:!0,onOpenChange:h,children:A}),t[33]=A,t[34]=h,t[35]=ie):ie=t[35],ie}function O(){}var k=48,A=2e3,ie=`allow-scripts allow-forms allow-popups`;function j(e){let t=(0,ne.c)(155),{extensionId:n,extensionName:r,entrypoint:i,permissions:s,title:c,className:l,fixedHeight:u,maxHeight:d,minHeight:te,initialData:f}=e,p=d===void 0?A:d,m=te===void 0?k:te,C=o(ce),O;t[0]===C?O=t[1]:(O=ee(C),t[0]=C,t[1]=O);let j=O.extensionUi,M=g(),N=a(se),P=a(oe),F=(0,S.useRef)(0),le=(0,S.useRef)(!1),[I,ue]=(0,S.useState)(null),[L,de]=(0,S.useState)(null),[R,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),he;t[2]!==n||t[3]!==N||t[4]!==P?(he=JSON.stringify([n,N,P]),t[2]=n,t[3]=N,t[4]=P,t[5]=he):he=t[5];let z=he,ge,_e;t[6]!==n||t[7]!==z?(ge=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&fe({id:t.requestId,identity:z})},t=e=>{let t=e.detail;t?.extensionId===n&&me({prompt:t,identity:z})};return window.addEventListener(`extension-review-resource-request`,e),window.addEventListener(`extension-pick-attachment`,t),()=>{window.removeEventListener(`extension-review-resource-request`,e),window.removeEventListener(`extension-pick-attachment`,t)}},_e=[n,z],t[6]=n,t[7]=z,t[8]=ge,t[9]=_e):(ge=t[8],_e=t[9]),(0,S.useEffect)(ge,_e);let ve,ye;t[10]!==n||t[11]!==z?(ve=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&de({id:t.proposalId,identity:z})};return window.addEventListener(`extension-review-automation-proposal`,e),()=>window.removeEventListener(`extension-review-automation-proposal`,e)},ye=[n,z],t[10]=n,t[11]=z,t[12]=ve,t[13]=ye):(ve=t[12],ye=t[13]),(0,S.useEffect)(ve,ye);let be=(0,S.useRef)(null),xe=h(ae),Se;t[14]!==n||t[15]!==r?(Se=r?.trim()||n,t[14]=n,t[15]=r,t[16]=Se):Se=t[16];let Ce=Se,we;t[17]!==n||t[18]!==c?(we=c?.trim()||`Extension ${n}`,t[17]=n,t[18]=c,t[19]=we):we=t[19];let Te=we,Ee;t[20]===s?Ee=t[21]:(Ee=JSON.stringify(Array.from(s??[]).toSorted()),t[20]=s,t[21]=Ee);let De=Ee,Oe;t[22]===De?Oe=t[23]:(Oe=JSON.parse(De),t[22]=De,t[23]=Oe);let ke=Oe,Ae=u??Math.min(p,Math.max(m,320)),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[24]=je):je=t[24];let Me;t[25]===Ae?Me=t[26]:(Me={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:Ae,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:je},t[25]=Ae,t[26]=Me);let[B,V]=(0,S.useReducer)(v,Me),{allowed:H,dialogOpen:U,reloadKey:W,loadError:Ne,dynamicHeight:Pe,grantResolved:Fe,grantError:G}=B,Ie;t[27]===n?Ie=t[28]:(Ie=()=>{let e=!0;return le.current=!1,ue(null),V({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),y(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);V({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions,grantRevision:t.grantRevision,localApp:!!t.appId,resourceScopes:t.resourceScopes}})}}).catch(t=>{e&&V({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,F.current+=1}},t[27]=n,t[28]=Ie);let Le;t[29]!==n||t[30]!==N||t[31]!==P||t[32]!==ke||t[33]!==W?(Le=[n,ke,N,P,W],t[29]=n,t[30]=N,t[31]=P,t[32]=ke,t[33]=W,t[34]=Le):Le=t[34],(0,S.useEffect)(Ie,Le);let Re;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(Re=e=>V({type:`patch`,patch:{dialogOpen:e}}),t[35]=Re):Re=t[35];let ze=Re,Be,Ve;t[36]!==n||t[37]!==N||t[38]!==P||t[39]!==j.loadFailed?(Be=()=>{let e=e=>{if(e.detail?.extensionId!==n)return;let t=F.current;y(n).then(e=>{t!==F.current||a.getState().baseUrl!==N||a.getState().conversationId!==P||(ue(e),V({type:`patch`,patch:{dialogOpen:!0,grantError:null}}))}).catch(()=>V({type:`patch`,patch:{grantError:j.loadFailed}}))};return window.addEventListener(`extension-review-permissions`,e),()=>window.removeEventListener(`extension-review-permissions`,e)},Ve=[n,N,P,j.loadFailed],t[36]=n,t[37]=N,t[38]=P,t[39]=j.loadFailed,t[40]=Be,t[41]=Ve):(Be=t[40],Ve=t[41]),(0,S.useEffect)(Be,Ve);let He;t[42]!==i||t[43]!==n?(He=w(n,i),t[42]=i,t[43]=n,t[44]=He):He=t[44];let Ue=He,We;t[45]!==H||t[46]!==n||t[47]!==u||t[48]!==p||t[49]!==m||t[50]!==M||t[51]!==B.grantRevision||t[52]!==B.grantedPermissions||t[53]!==B.localApp||t[54]!==B.manifestDigest?(We=()=>{if(!H)return;let e=be.current;if(!e)return;B.localApp?M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0,B.grantRevision,!0):M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0);let t=M.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&u===void 0&&V({type:`patch`,patch:{dynamicHeight:Math.min(p,Math.max(m,t))}})});return()=>{t(),M.unregisterIframe(n)}},t[45]=H,t[46]=n,t[47]=u,t[48]=p,t[49]=m,t[50]=M,t[51]=B.grantRevision,t[52]=B.grantedPermissions,t[53]=B.localApp,t[54]=B.manifestDigest,t[55]=We):We=t[55];let Ge;t[56]!==H||t[57]!==n||t[58]!==u||t[59]!==p||t[60]!==m||t[61]!==W||t[62]!==M||t[63]!==B.grantRevision||t[64]!==B.grantedPermissions||t[65]!==B.localApp||t[66]!==B.manifestDigest?(Ge=[H,n,u,p,m,B.grantedPermissions,B.manifestDigest,B.grantRevision,B.localApp,M,W],t[56]=H,t[57]=n,t[58]=u,t[59]=p,t[60]=m,t[61]=W,t[62]=M,t[63]=B.grantRevision,t[64]=B.grantedPermissions,t[65]=B.localApp,t[66]=B.manifestDigest,t[67]=Ge):Ge=t[67],(0,S.useLayoutEffect)(We,Ge);let Ke,qe;t[68]!==H||t[69]!==n||t[70]!==xe||t[71]!==M?(Ke=()=>{if(!H)return;let e=_(xe);M.sendEvent(n,`theme.changed`,e)},qe=[H,n,xe,M],t[68]=H,t[69]=n,t[70]=xe,t[71]=M,t[72]=Ke,t[73]=qe):(Ke=t[72],qe=t[73]),(0,S.useEffect)(Ke,qe);let Je;t[74]!==Pe||t[75]!==u?(Je=u===void 0?{width:`100%`,height:Pe,border:`none`}:{width:`100%`,height:u,border:`none`},t[74]=Pe,t[75]=u,t[76]=Je):Je=t[76];let Ye=Je,Xe;t[77]!==H||t[78]!==n||t[79]!==N||t[80]!==P||t[81]!==W||t[82]!==I?.manifestDigest||t[83]!==B.localApp||t[84]!==B.manifestDigest?(Xe=e=>{let t=I?.manifestDigest??B.manifestDigest;if(le.current||!t)return;le.current=!0;let r=F.current,i=()=>F.current===r&&a.getState().baseUrl===N&&a.getState().conversationId===P;(B.localApp?x(n,t,e):x(n,t)).then(e=>{if(i()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==t)throw Error(`Permission grant was not persisted`);ue(null),V({type:`patch`,patch:{allowed:!0,dialogOpen:!1,grantError:null,manifestDigest:e.manifestDigest,grantedPermissions:e.permissions,grantRevision:e.grantRevision,resourceScopes:e.resourceScopes,reloadKey:H?W+1:W}})}}).catch(e=>{i()&&V({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{i()&&(le.current=!1)})},t[77]=H,t[78]=n,t[79]=N,t[80]=P,t[81]=W,t[82]=I?.manifestDigest,t[83]=B.localApp,t[84]=B.manifestDigest,t[85]=Xe):Xe=t[85];let Ze=Xe,Qe=I?.permissions??B.grantedPermissions,$e=I?.resourceScopes??B.resourceScopes,et=!(I?.manifestDigest??B.manifestDigest),tt;t[86]!==U||t[87]!==Ce||t[88]!==n||t[89]!==G||t[90]!==Ze||t[91]!==Qe||t[92]!==$e||t[93]!==et||t[94]!==B.localApp?(tt=(0,T.jsx)(b,{open:U,onOpenChange:ze,extensionId:n,extensionName:Ce,permissions:Qe,localApp:B.localApp,resourceScopes:$e,error:G,confirmDisabled:et,onConfirm:Ze}),t[86]=U,t[87]=Ce,t[88]=n,t[89]=G,t[90]=Ze,t[91]=Qe,t[92]=$e,t[93]=et,t[94]=B.localApp,t[95]=tt):tt=t[95];let K=tt;if(!Fe){let e=`${l??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[96]===e?n=t[97]:(n=(0,T.jsx)(`div`,{className:e}),t[96]=e,t[97]=n),n}if(!H){let e;t[98]!==l||t[99]!==U||t[100]!==G||t[101]!==W||t[102]!==j.deniedHint||t[103]!==j.reviewPermissions?(e=U?null:(0,T.jsxs)(`div`,{className:l?`${l} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[G?(0,T.jsx)(`p`,{className:`mb-2 text-danger`,children:G}):null,(0,T.jsx)(`p`,{children:j.deniedHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>V({type:`patch`,patch:{reloadKey:W+1}}),children:j.reviewPermissions})]}),t[98]=l,t[99]=U,t[100]=G,t[101]=W,t[102]=j.deniedHint,t[103]=j.reviewPermissions,t[104]=e):e=t[104];let n;return t[105]!==K||t[106]!==e?(n=(0,T.jsxs)(T.Fragment,{children:[K,e]}),t[105]=K,t[106]=e,t[107]=n):n=t[107],n}let q;t[108]!==n||t[109]!==C||t[110]!==z||t[111]!==R||t[112]!==B.localApp?(q=B.localApp&&R?.identity===z?(0,T.jsx)(D,{extensionId:n,requestId:R.id,zh:C===`zh`,onClose:()=>fe(null)},R.id):null,t[108]=n,t[109]=C,t[110]=z,t[111]=R,t[112]=B.localApp,t[113]=q):q=t[113];let J;t[114]!==pe||t[115]!==C||t[116]!==z||t[117]!==B.localApp?(J=B.localApp&&pe?.identity===z?(0,T.jsx)(re,{prompt:pe.prompt,zh:C===`zh`,onClose:()=>me(null)}):null,t[114]=pe,t[115]=C,t[116]=z,t[117]=B.localApp,t[118]=J):J=t[118];let Y;t[119]!==n||t[120]!==C||t[121]!==z||t[122]!==L||t[123]!==B.localApp?(Y=B.localApp&&L?.identity===z?(0,T.jsx)(E,{extensionId:n,proposalId:L.id,zh:C===`zh`,onClose:()=>de(null)},L.id):null,t[119]=n,t[120]=C,t[121]=z,t[122]=L,t[123]=B.localApp,t[124]=Y):Y=t[124];let X;t[125]===G?X=t[126]:(X=G?(0,T.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:G}):null,t[125]=G,t[126]=X);let Z;t[127]!==Ne||t[128]!==W||t[129]!==j.loadFailed||t[130]!==j.loadFailedConnectionHint||t[131]!==j.retryLoad?(Z=Ne?(0,T.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,T.jsx)(`p`,{children:j.loadFailed}),(0,T.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j.loadFailedConnectionHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{V({type:`patch`,patch:{loadError:!1,reloadKey:W+1}})},children:j.retryLoad})]}):null,t[127]=Ne,t[128]=W,t[129]=j.loadFailed,t[130]=j.loadFailedConnectionHint,t[131]=j.retryLoad,t[132]=Z):Z=t[132];let nt=`${n}-${i}-${W}`,rt=B.localApp?`allow-scripts`:ie,it;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>V({type:`patch`,patch:{loadError:!0}}),t[133]=it):it=t[133];let Q;t[134]!==n||t[135]!==f||t[136]!==C||t[137]!==M?(Q=()=>{V({type:`patch`,patch:{loadError:!1}}),M.sendInit(n,_(h.getState().resolved),C),f!==void 0&&M.sendEvent(n,`widget.data`,f)},t[134]=n,t[135]=f,t[136]=C,t[137]=M,t[138]=Q):Q=t[138];let $;t[139]!==l||t[140]!==Te||t[141]!==Ue||t[142]!==Ye||t[143]!==nt||t[144]!==rt||t[145]!==Q?($=(0,T.jsx)(`iframe`,{ref:be,className:l,title:Te,src:Ue,style:Ye,sandbox:rt,referrerPolicy:`no-referrer`,onError:it,onLoad:Q},nt),t[139]=l,t[140]=Te,t[141]=Ue,t[142]=Ye,t[143]=nt,t[144]=rt,t[145]=Q,t[146]=$):$=t[146];let at;return t[147]!==K||t[148]!==q||t[149]!==J||t[150]!==Y||t[151]!==X||t[152]!==Z||t[153]!==$?(at=(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[q,J,Y,K,X,Z,$]}),t[147]=K,t[148]=q,t[149]=J,t[150]=Y,t[151]=X,t[152]=Z,t[153]=$,t[154]=at):at=t[154],at}function ae(e){return e.resolved}function oe(e){return e.conversationId}function se(e){return e.baseUrl}function ce(e){return e.language}export{j as t};
@@ -1 +1 @@
1
- import{a as e,i as t}from"./locale-store-cg9cm2EL.js";async function n(n=``){let i=await e(t(`/api/marketplace${n.trim()?`?q=${encodeURIComponent(n.trim())}`:``}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!Array.isArray(a.extensions))throw Error(a.error??`Invalid response`);return a.extensions}async function r(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function i(n){let i=await e(t(`/api/marketplace/packages/${encodeURIComponent(n.trim())}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.id)throw Error(a.error??`Invalid response`);return a.payload}async function a(n){let i=await e(t(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.extensionId)throw Error(a.error??`Invalid response`);return a.payload}async function o(n){let i=await e(t(`/api/extensions/${encodeURIComponent(n.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:n.enabled})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error?.message??`Invalid response`);return a.payload}async function s(n){let i=await e(t(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:n})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error??`Invalid response`);return a.payload}export{s as a,o as i,i as n,a as r,n as t};
1
+ import{a as e,i as t}from"./locale-store-Dy1EByeG.js";async function n(n=``){let i=await e(t(`/api/marketplace${n.trim()?`?q=${encodeURIComponent(n.trim())}`:``}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!Array.isArray(a.extensions))throw Error(a.error??`Invalid response`);return a.extensions}async function r(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function i(n){let i=await e(t(`/api/marketplace/packages/${encodeURIComponent(n.trim())}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.id)throw Error(a.error??`Invalid response`);return a.payload}async function a(n){let i=await e(t(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.extensionId)throw Error(a.error??`Invalid response`);return a.payload}async function o(n){let i=await e(t(`/api/extensions/${encodeURIComponent(n.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:n.enabled})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error?.message??`Invalid response`);return a.payload}async function s(n){let i=await e(t(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:n})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error??`Invalid response`);return a.payload}export{s as a,o as i,i as n,a as r,n as t};
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,l as n,n as r,o as i}from"./locale-store-cg9cm2EL.js";import{c as a,m as o,p as s,u as c,y as l}from"./schemas-CCWMleym.js";import{s as u}from"./local-apps-DeqzkJiF.js";import{d,i as f,t as p}from"./session-manager-C7RfUfqI.js";import{t as m}from"./capabilities-kG175Q-7.js";import{t as h}from"./activity-store-DYwR1u3f.js";import{i as g}from"./theme-store-GZQ3pTgy.js";var _=function(e){return e[e.PermissionDenied=4001]=`PermissionDenied`,e[e.InvalidRequest=4002]=`InvalidRequest`,e[e.MethodNotFound=4003]=`MethodNotFound`,e[e.InternalError=4004]=`InternalError`,e[e.Timeout=4005]=`Timeout`,e[e.ExtensionNotFound=4006]=`ExtensionNotFound`,e[e.RateLimited=4007]=`RateLimited`,e}({});async function v(e,t,n){let r=new p,i=await r.loadSessionAgentConfig(e);await r.loadSession(e),d(e,i),await new f().send(t,e,n,i.thinkingLevel)}var y=[`--color-surface-base`,`--color-surface-panel`,`--color-surface-hover`,`--color-fg`,`--color-fg-muted`,`--color-fg-subtle`,`--color-accent`,`--color-accent-hover`,`--color-accent-soft`,`--color-edge`,`--color-edge-subtle`,`--color-danger`,`--color-success`,`--color-warning`,`--radius-sm`,`--radius-lg`,`--radius-xl`];function b(e){let t=getComputedStyle(document.documentElement),n={};for(let e of y){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return{mode:e,tokens:n,fontFamily:t.getPropertyValue(`font-family`).trim(),fontFamilyMono:t.getPropertyValue(`--font-mono`).trim()}}async function x(t,n,r){let i=500;for(;!n.aborted;){try{let a=await e(t,{signal:n,headers:{Accept:`text/event-stream`}});if(!a.ok||!a.body){r({type:`error`,message:`Run subscription unavailable; review access before retrying`});return}let o=a.body.pipeThrough(new TextDecoderStream).getReader(),s=``;try{for(;;){let e=await o.read();if(e.done)break;s=(s+e.value).replaceAll(`\r
1
+ import{a as e,i as t,l as n,n as r,o as i}from"./locale-store-Dy1EByeG.js";import{c as a,m as o,p as s,u as c,y as l}from"./schemas-CCWMleym.js";import{s as u}from"./local-apps-DeqzkJiF.js";import{d,i as f,t as p}from"./session-manager-D2LaQymu.js";import{t as m}from"./capabilities-DB713nRi.js";import{t as h}from"./activity-store-CQHh48Zf.js";import{i as g}from"./theme-store-BaWep_o7.js";var _=function(e){return e[e.PermissionDenied=4001]=`PermissionDenied`,e[e.InvalidRequest=4002]=`InvalidRequest`,e[e.MethodNotFound=4003]=`MethodNotFound`,e[e.InternalError=4004]=`InternalError`,e[e.Timeout=4005]=`Timeout`,e[e.ExtensionNotFound=4006]=`ExtensionNotFound`,e[e.RateLimited=4007]=`RateLimited`,e}({});async function v(e,t,n){let r=new p,i=await r.loadSessionAgentConfig(e);await r.loadSession(e),d(e,i),await new f().send(t,e,n,i.thinkingLevel)}var y=[`--color-surface-base`,`--color-surface-panel`,`--color-surface-hover`,`--color-fg`,`--color-fg-muted`,`--color-fg-subtle`,`--color-accent`,`--color-accent-hover`,`--color-accent-soft`,`--color-edge`,`--color-edge-subtle`,`--color-danger`,`--color-success`,`--color-warning`,`--radius-sm`,`--radius-lg`,`--radius-xl`];function b(e){let t=getComputedStyle(document.documentElement),n={};for(let e of y){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return{mode:e,tokens:n,fontFamily:t.getPropertyValue(`font-family`).trim(),fontFamilyMono:t.getPropertyValue(`--font-mono`).trim()}}async function x(t,n,r){let i=500;for(;!n.aborted;){try{let a=await e(t,{signal:n,headers:{Accept:`text/event-stream`}});if(!a.ok||!a.body){r({type:`error`,message:`Run subscription unavailable; review access before retrying`});return}let o=a.body.pipeThrough(new TextDecoderStream).getReader(),s=``;try{for(;;){let e=await o.read();if(e.done)break;s=(s+e.value).replaceAll(`\r
2
2
  `,`
3
3
  `);let t;for(;(t=s.indexOf(`
4
4
 
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-DtQ2rfu_.js";import{t as o}from"./page-header-store-DU4NnGap.js";import{r as s,s as c}from"./extension-provider-CbVokTvd.js";import{t as l}from"./extension-iframe-host-DiIqM2JO.js";var u=n(),d=e(t(),1),f=r();function p(){let e=(0,u.c)(24),{extensionId:t,pageId:n}=i(),r=s(),p=o(h),g=o(m),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&c(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==p?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return p({startExtra:null,main:(0,f.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,f.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,p],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=p,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,d.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[13]=t):t=e[13],t}if(!_){let n=r.some(e=>e.id===t)?`plugin-page`:`plugin`,i;return e[14]===n?i=e[15]:(i=(0,f.jsx)(a,{kind:n,backTo:`/capabilities/extensions`}),e[14]=n,e[15]=i),i}if(!v?.length){let t;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin-page`,backTo:`/capabilities/extensions`}),e[16]=t):t=e[16],t}if(!b){let t;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[17]=t):t=e[17],t}let C=_.ui?.permissions,w;return e[18]!==_.name||e[19]!==t||e[20]!==b.entrypoint||e[21]!==b.title||e[22]!==C?(w=(0,f.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,f.jsx)(l,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[18]=_.name,e[19]=t,e[20]=b.entrypoint,e[21]=b.title,e[22]=C,e[23]=w):w=e[23],w}function m(e){return e.clearPageHeader}function h(e){return e.setPageHeader}export{p as ExtensionPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-BRKhKJA0.js";import{t as o}from"./page-header-store-Bm8oxpFR.js";import{r as s,s as c}from"./extension-provider-BPIoHw4r.js";import{t as l}from"./extension-iframe-host-DIH4TcdH.js";var u=n(),d=e(t(),1),f=r();function p(){let e=(0,u.c)(24),{extensionId:t,pageId:n}=i(),r=s(),p=o(h),g=o(m),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&c(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==p?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return p({startExtra:null,main:(0,f.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,f.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,p],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=p,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,d.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[13]=t):t=e[13],t}if(!_){let n=r.some(e=>e.id===t)?`plugin-page`:`plugin`,i;return e[14]===n?i=e[15]:(i=(0,f.jsx)(a,{kind:n,backTo:`/capabilities/extensions`}),e[14]=n,e[15]=i),i}if(!v?.length){let t;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin-page`,backTo:`/capabilities/extensions`}),e[16]=t):t=e[16],t}if(!b){let t;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[17]=t):t=e[17],t}let C=_.ui?.permissions,w;return e[18]!==_.name||e[19]!==t||e[20]!==b.entrypoint||e[21]!==b.title||e[22]!==C?(w=(0,f.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,f.jsx)(l,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[18]=_.name,e[19]=t,e[20]=b.entrypoint,e[21]=b.title,e[22]=C,e[23]=w):w=e[23],w}function m(e){return e.clearPageHeader}function h(e){return e.setPageHeader}export{p as ExtensionPage};
@@ -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,o as s}from"./locale-store-cg9cm2EL.js";import{i as c}from"./vendor-swr-CdRzEUwF.js";import{a as l}from"./gateway-realtime-B9u4uSXW.js";import{i as u}from"./theme-store-GZQ3pTgy.js";import{n as d,r as f,t as p}from"./extension-message-router-Dn8JzOdR.js";var m=e(t(),1),h=n(),g=`agent-stream-event`;function _(e){return e===`off`||e===`on`||e===`stream`}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.conversationId==`string`?t.conversationId.trim():``,r=typeof t.runId==`string`?t.runId.trim():``;return n&&r?{conversationId:n,runId:r}:null}function y(e,t,n){return t&&typeof t==`object`&&!Array.isArray(t)?{...t,seq:n}:{type:e,seq:n,payload:t}}async function b(e){try{let t=await i(a(`/api/sessions/${encodeURIComponent(e)}/agent-config`));if(!t.ok)return`on`;let n=await t.json(),r=n.payload?.activityDetail?.effective;if(_(r))return r;let o=n.payload?.activityDetail?.default;return _(o)?o:`on`}catch{return`on`}}function x(e){window.dispatchEvent(new CustomEvent(g,{detail:e}))}function S(e={}){let t=e.subscribe??l,n=e.loadActivityDetailLevel??b,r=e.dispatch??x,i=new Map,a=!1,o=e=>{let o=v(e.detail);if(!o||i.has(o.runId))return;let s=`on`,c=!1,l,u=!1,d=!1,f=()=>{},p=()=>{u||(u=!0,f(),i.get(o.runId)===p&&i.delete(o.runId))},m=e=>{a||u||r({conversationId:o.conversationId,event:e,activityDetailLevel:s})};n(o.conversationId).then(e=>{s=e,c=!0,e===`stream`&&l&&!d&&m(l),l=void 0}),f=t(`run:${o.runId}`,{onEvent:e=>{if(u||d)return;let t=y(e.event,e.data,e.seq);e.event===`thinking_delta`&&!c?l=t:m(t),e.event===`run_end`&&(d=!0,l=void 0,queueMicrotask(p))},onGap:e=>{e.recoverable||p()}},0),i.set(o.runId,p)},s=e=>{let t=v(e.detail);t&&i.get(t.runId)?.()};return window.addEventListener(`run-started`,o),window.addEventListener(`run-completed`,s),window.addEventListener(`agent-run-ended`,s),()=>{a=!0,window.removeEventListener(`run-started`,o),window.removeEventListener(`run-completed`,s),window.removeEventListener(`agent-run-ended`,s);for(let e of[...i.values()])e()}}function C(e){return e.active||e.activationEligible===!0}function w(e){let t=e.ui?.contributions;return t?Array.isArray(t.pages)&&t.pages.length>0||Array.isArray(t.settingsPanels)&&t.settingsPanels.length>0||Array.isArray(t.chatWidgets)&&t.chatWidgets.length>0:!1}function T(e){return e.source===`bundled`&&e.hasUi===!0&&w(e)}function E(e){return e.kind===`image-generation`||e.kind===`media-provider`}function D(e){return C(e)?e.hasConfigSchema||E(e)?!0:e.hasUi?w(e):!1:!1}function O(e){return D(e)||T(e)}var k=r(),A=(0,m.createContext)(null);function j({children:e}){let t=(0,m.useRef)(null);if(!t.current){let e=new p;d(e),t.current=e}let n=t.current,{data:r,isLoading:i,mutate:l}=c(o(e=>!!e.conversationId)?`gateway-extensions-list`:null,()=>s(a(`/api/extensions`)),{revalidateOnFocus:!1}),h=r?.extensions??[],_=u(e=>e.resolved);(0,m.useEffect)(()=>{let e=()=>{l()};return window.addEventListener(`config-reload`,e),window.addEventListener(`registry-updated`,e),()=>{window.removeEventListener(`config-reload`,e),window.removeEventListener(`registry-updated`,e)}},[l]);let v=(0,m.useCallback)(e=>{let t=e.detail;t?.conversationId&&n.forwardAgentStreamEvent(t.conversationId,t.event??t)},[n]),y=(0,m.useRef)(v);y.current=v,(0,m.useEffect)(()=>{let e=e=>{y.current(e)};return window.addEventListener(g,e),()=>{window.removeEventListener(g,e)}},[]),(0,m.useEffect)(()=>{let e=f(_);n.broadcastEvent(`theme.changed`,e)},[_,n]);let b=(0,m.useRef)(n);b.current=n,(0,m.useEffect)(()=>()=>{b.current.dispose(),t.current=null},[]);let x=(0,m.useMemo)(()=>({router:n,extensions:h,loading:i}),[n,h,i]);return(0,k.jsx)(A.Provider,{value:x,children:e})}function M(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionRouter must be used within ExtensionProvider`);return e.router}function N(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensions must be used within ExtensionProvider`);return e.extensions}function P(){let e=(0,h.c)(2),t=N(),n;return e[0]===t?n=e[1]:(n=t.filter(D),e[0]=t,e[1]=n),n}function F(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionsLoading must be used within ExtensionProvider`);return e.loading}export{P as a,g as c,F as i,S as l,M as n,E as o,N as r,O as s,j as t};
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,o as s}from"./locale-store-Dy1EByeG.js";import{i as c}from"./vendor-swr-CdRzEUwF.js";import{a as l}from"./gateway-realtime-DIs1pjkQ.js";import{i as u}from"./theme-store-BaWep_o7.js";import{n as d,r as f,t as p}from"./extension-message-router-C9JDpo_7.js";var m=e(t(),1),h=n(),g=`agent-stream-event`;function _(e){return e===`off`||e===`on`||e===`stream`}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.conversationId==`string`?t.conversationId.trim():``,r=typeof t.runId==`string`?t.runId.trim():``;return n&&r?{conversationId:n,runId:r}:null}function y(e,t,n){return t&&typeof t==`object`&&!Array.isArray(t)?{...t,seq:n}:{type:e,seq:n,payload:t}}async function b(e){try{let t=await i(a(`/api/sessions/${encodeURIComponent(e)}/agent-config`));if(!t.ok)return`on`;let n=await t.json(),r=n.payload?.activityDetail?.effective;if(_(r))return r;let o=n.payload?.activityDetail?.default;return _(o)?o:`on`}catch{return`on`}}function x(e){window.dispatchEvent(new CustomEvent(g,{detail:e}))}function S(e={}){let t=e.subscribe??l,n=e.loadActivityDetailLevel??b,r=e.dispatch??x,i=new Map,a=!1,o=e=>{let o=v(e.detail);if(!o||i.has(o.runId))return;let s=`on`,c=!1,l,u=!1,d=!1,f=()=>{},p=()=>{u||(u=!0,f(),i.get(o.runId)===p&&i.delete(o.runId))},m=e=>{a||u||r({conversationId:o.conversationId,event:e,activityDetailLevel:s})};n(o.conversationId).then(e=>{s=e,c=!0,e===`stream`&&l&&!d&&m(l),l=void 0}),f=t(`run:${o.runId}`,{onEvent:e=>{if(u||d)return;let t=y(e.event,e.data,e.seq);e.event===`thinking_delta`&&!c?l=t:m(t),e.event===`run_end`&&(d=!0,l=void 0,queueMicrotask(p))},onGap:e=>{e.recoverable||p()}},0),i.set(o.runId,p)},s=e=>{let t=v(e.detail);t&&i.get(t.runId)?.()};return window.addEventListener(`run-started`,o),window.addEventListener(`run-completed`,s),window.addEventListener(`agent-run-ended`,s),()=>{a=!0,window.removeEventListener(`run-started`,o),window.removeEventListener(`run-completed`,s),window.removeEventListener(`agent-run-ended`,s);for(let e of[...i.values()])e()}}function C(e){return e.active||e.activationEligible===!0}function w(e){let t=e.ui?.contributions;return t?Array.isArray(t.pages)&&t.pages.length>0||Array.isArray(t.settingsPanels)&&t.settingsPanels.length>0||Array.isArray(t.chatWidgets)&&t.chatWidgets.length>0:!1}function T(e){return e.source===`bundled`&&e.hasUi===!0&&w(e)}function E(e){return e.kind===`image-generation`||e.kind===`media-provider`}function D(e){return C(e)?e.hasConfigSchema||E(e)?!0:e.hasUi?w(e):!1:!1}function O(e){return D(e)||T(e)}var k=r(),A=(0,m.createContext)(null);function j({children:e}){let t=(0,m.useRef)(null);if(!t.current){let e=new p;d(e),t.current=e}let n=t.current,{data:r,isLoading:i,mutate:l}=c(o(e=>!!e.conversationId)?`gateway-extensions-list`:null,()=>s(a(`/api/extensions`)),{revalidateOnFocus:!1}),h=r?.extensions??[],_=u(e=>e.resolved);(0,m.useEffect)(()=>{let e=()=>{l()};return window.addEventListener(`config-reload`,e),window.addEventListener(`registry-updated`,e),()=>{window.removeEventListener(`config-reload`,e),window.removeEventListener(`registry-updated`,e)}},[l]);let v=(0,m.useCallback)(e=>{let t=e.detail;t?.conversationId&&n.forwardAgentStreamEvent(t.conversationId,t.event??t)},[n]),y=(0,m.useRef)(v);y.current=v,(0,m.useEffect)(()=>{let e=e=>{y.current(e)};return window.addEventListener(g,e),()=>{window.removeEventListener(g,e)}},[]),(0,m.useEffect)(()=>{let e=f(_);n.broadcastEvent(`theme.changed`,e)},[_,n]);let b=(0,m.useRef)(n);b.current=n,(0,m.useEffect)(()=>()=>{b.current.dispose(),t.current=null},[]);let x=(0,m.useMemo)(()=>({router:n,extensions:h,loading:i}),[n,h,i]);return(0,k.jsx)(A.Provider,{value:x,children:e})}function M(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionRouter must be used within ExtensionProvider`);return e.router}function N(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensions must be used within ExtensionProvider`);return e.extensions}function P(){let e=(0,h.c)(2),t=N(),n;return e[0]===t?n=e[1]:(n=t.filter(D),e[0]=t,e[1]=n),n}function F(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionsLoading must be used within ExtensionProvider`);return e.loading}export{P as a,g as c,F as i,S as l,M as n,E as o,N as r,O as s,j as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-cg9cm2EL.js";import{t as d}from"./messages-eQ2CYlpG.js";import{t as f}from"./resource-unavailable-DtQ2rfu_.js";import{n as p,r as m}from"./popover-select-CLsphyzA.js";import{t as h}from"./cn-0WouolD0.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-Cc4hUNTt.js";import{a as v,o as y,s as b}from"./form-field-width-DJw_jULe.js";import{r as x}from"./extension-provider-CbVokTvd.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-DiIqM2JO.js";import{t as w}from"./settings-loading-skeleton-CAoOV17i.js";import{n as T,t as E}from"./settings-page-header-BSMu5Zq3.js";import"./settings-page-layout-B_vMffB1.js";import{n as D,t as O}from"./use-autosave-CO0IPCVg.js";import{c as k,s as A,u as j}from"./voice-config-api-GIuXoHXw.js";import{t as M}from"./voice-api-key-field-DpwUDAvu.js";import{t as N}from"./schema-form-C9TYGa0_.js";var P=e(t(),1),F=n(),I=r();function L(e){let t=(0,F.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,I.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(y,v)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=g(s(`/api/voice/stt-providers`),k,{revalidateOnFocus:!1}),u=(0,P.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,_=u?.models??[],y=_[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,P.useMemo)(()=>V(t,e,y),[y,e,t]),x=(0,P.useRef)(!1),[C,w]=(0,P.useState)(null),T=C??b,E=(0,P.useRef)(T);E.current=T;let A=b,N=O({value:T,dirty:T.apiKey!==A.apiKey||T.model!==A.model,onSave:(0,P.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await j(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),F=_.length>0?[..._].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:N.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:N.status,error:N.error}),(0,I.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,I.jsx)(L,{children:i.stt.apiKey}),(0,I.jsx)(M,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,I.jsx)(L,{children:i.stt.model}),F.length>0?(0,I.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),N.saveNow({...T,model:e.target.value})},children:F.map(e=>(0,I.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,I.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,F.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=g(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:_,isLoading:v}=g(i?`voice-settings-ext-stt`:null,A,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,I.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==_||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,I.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:_},y),t[8]=_,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=g(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=g(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,P.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,P.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,P.useReducer)(J,{localValues:{},isDirty:!1}),v=(0,P.useRef)(!1),y=(0,P.useRef)(m.localValues);y.current=m.localValues;let b=(0,P.useRef)(p);!v.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,P.useCallback)(e=>{v.current=!0,h({type:`change`,value:e})},[]),S=(0,P.useCallback)(()=>{!d||d.type!==`object`||(v.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,P.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,I.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:w.status,error:w.error}),(0,I.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,I.jsx)(N,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,F.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=x();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,g=!!(h&&u.ui),_=!!u.hasConfigSchema,v=u.kind===`media-provider`;if(!_&&!g&&!v){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let y=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),b;e[13]===y?b=e[14]:(b=(0,I.jsx)(E,{title:y}),e[13]=y,e[14]=b);let S;e[15]!==v||e[16]!==r?(S=v?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,I.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=v,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==v?(w=v?(0,I.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=v,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==_?(D=_?(0,I.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=_,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==g||e[28]!==h?(O=g&&h&&u.ui?(0,I.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,I.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=g,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==b||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,I.jsxs)(T,{gap:`gap-5`,children:[b,S,w,D,O]}),e[30]=b,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-Dy1EByeG.js";import{t as d}from"./messages-BAnhwALN.js";import{t as f}from"./resource-unavailable-BRKhKJA0.js";import{n as p,r as m}from"./popover-select-CLsphyzA.js";import{t as h}from"./cn-0WouolD0.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-Cc4hUNTt.js";import{a as v,o as y,s as b}from"./form-field-width-DJw_jULe.js";import{r as x}from"./extension-provider-BPIoHw4r.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-DIH4TcdH.js";import{t as w}from"./settings-loading-skeleton-CAoOV17i.js";import{n as T,t as E}from"./settings-page-header-DEZZ8D0S.js";import"./settings-page-layout-De2j64Lo.js";import{n as D,t as O}from"./use-autosave-N_SjHXTw.js";import{c as k,s as A,u as j}from"./voice-config-api-DhJ3l8fk.js";import{t as M}from"./voice-api-key-field-B_GApUQP.js";import{t as N}from"./schema-form-C9TYGa0_.js";var P=e(t(),1),F=n(),I=r();function L(e){let t=(0,F.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,I.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(y,v)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=g(s(`/api/voice/stt-providers`),k,{revalidateOnFocus:!1}),u=(0,P.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,_=u?.models??[],y=_[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,P.useMemo)(()=>V(t,e,y),[y,e,t]),x=(0,P.useRef)(!1),[C,w]=(0,P.useState)(null),T=C??b,E=(0,P.useRef)(T);E.current=T;let A=b,N=O({value:T,dirty:T.apiKey!==A.apiKey||T.model!==A.model,onSave:(0,P.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await j(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),F=_.length>0?[..._].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:N.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:N.status,error:N.error}),(0,I.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,I.jsx)(L,{children:i.stt.apiKey}),(0,I.jsx)(M,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,I.jsx)(L,{children:i.stt.model}),F.length>0?(0,I.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),N.saveNow({...T,model:e.target.value})},children:F.map(e=>(0,I.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,I.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,F.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=g(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:_,isLoading:v}=g(i?`voice-settings-ext-stt`:null,A,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,I.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==_||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,I.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:_},y),t[8]=_,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=g(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=g(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,P.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,P.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,P.useReducer)(J,{localValues:{},isDirty:!1}),v=(0,P.useRef)(!1),y=(0,P.useRef)(m.localValues);y.current=m.localValues;let b=(0,P.useRef)(p);!v.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,P.useCallback)(e=>{v.current=!0,h({type:`change`,value:e})},[]),S=(0,P.useCallback)(()=>{!d||d.type!==`object`||(v.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,P.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,I.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:w.status,error:w.error}),(0,I.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,I.jsx)(N,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,F.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=x();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,g=!!(h&&u.ui),_=!!u.hasConfigSchema,v=u.kind===`media-provider`;if(!_&&!g&&!v){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let y=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),b;e[13]===y?b=e[14]:(b=(0,I.jsx)(E,{title:y}),e[13]=y,e[14]=b);let S;e[15]!==v||e[16]!==r?(S=v?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,I.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=v,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==v?(w=v?(0,I.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=v,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==_?(D=_?(0,I.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=_,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==g||e[28]!==h?(O=g&&h&&u.ui?(0,I.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,I.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=g,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==b||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,I.jsxs)(T,{gap:`gap-5`,children:[b,S,w,D,O]}),e[30]=b,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./electron-env-DHOGevH3.js";import{a as o}from"./shares-api-Dm07CnXw.js";var s=e(t(),1);function c(){let[e,t]=(0,s.useState)(!1),[n,r]=(0,s.useState)(!1),[i,a]=(0,s.useState)(null),[c,l]=(0,s.useState)(null),[u,d]=(0,s.useState)(null),f=(0,s.useCallback)(e=>{t(!0),d(e),a(null),l(null)},[]),p=(0,s.useCallback)(async e=>{if(!u||n)return null;r(!0),l(null);try{let t=await o({...u,...e});return a(t.payload),t.payload}catch(e){let t=e instanceof Error?e.message:String(e);return l(t),null}finally{r(!1)}},[n,u]),m=(0,s.useCallback)(()=>{a(null),l(null),r(!1),d(null)},[]);return{dialogOpen:e,loading:n,result:i,error:c,pendingParams:u,createShareLink:f,confirmShareLink:p,handleOpenChange:(0,s.useCallback)(e=>{t(e),e||m()},[m])}}var l=e(n(),1);function u(){return a()&&window.electronAPI?.platform===`darwin`}function d(){return a()&&window.electronAPI?.platform===`win32`}function f(){return d()?`windows-preview-viewport`:``}var p=r();function m({expanded:e,children:t}){let n=(0,s.useRef)(null),r=e?n.current?.closest(`.app-main-surface`)??document.querySelector(`.app-main-surface`):null,a=(0,p.jsx)(`div`,{"data-file-preview-expanded":e||void 0,"data-browser-occluder":e||void 0,className:i(`file-preview-surface flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden [&_.markdown-body_h1]:border-b-0! [&_.markdown-body_h2]:border-b-0!`,e&&(r?`absolute inset-0 z-[115]`:`fixed inset-0 z-[115] h-[100dvh] w-screen`),e&&!r&&f()),children:t});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{ref:n,hidden:!0,"aria-hidden":!0}),e?(0,l.createPortal)(a,r??document.body):a]})}export{c as a,d as i,f as n,u as r,m as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-cg9cm2EL.js";import{i as a,o}from"./vendor-swr-CdRzEUwF.js";var s=e(t(),1),c=n();function l(e){if(!(!e||typeof e!=`object`||!(`section`in e)))return e.section}function u(e){return l(e)===`skills`}function d(){return r(`/api/config`)}var f=null;async function p(){return f||(f=i(d()).finally(()=>{f=null}),f)}function m(e){let t=(0,c.c)(6),n;t[0]===e?n=t[1]:(n=e?d():null,t[0]=e,t[1]=n);let r=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={revalidateOnFocus:!1},t[2]=i):i=t[2];let l=a(r,p,i),f,m;return t[3]===e?(f=t[4],m=t[5]):(f=()=>{if(!e)return;let t=d(),n=e=>{u(e.detail)||o(t)};return window.addEventListener(`config-reload`,n),()=>window.removeEventListener(`config-reload`,n)},m=[e],t[3]=e,t[4]=f,t[5]=m),(0,s.useEffect)(f,m),l}function h(){return o(d())}export{u as a,l as i,h as n,m as r,p as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-Dy1EByeG.js";import{i as a,o}from"./vendor-swr-CdRzEUwF.js";var s=e(t(),1),c=n();function l(e){if(!(!e||typeof e!=`object`||!(`section`in e)))return e.section}function u(e){return l(e)===`skills`}function d(){return r(`/api/config`)}var f=null;async function p(){return f||(f=i(d()).finally(()=>{f=null}),f)}function m(e){let t=(0,c.c)(6),n;t[0]===e?n=t[1]:(n=e?d():null,t[0]=e,t[1]=n);let r=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={revalidateOnFocus:!1},t[2]=i):i=t[2];let l=a(r,p,i),f,m;return t[3]===e?(f=t[4],m=t[5]):(f=()=>{if(!e)return;let t=d(),n=e=>{u(e.detail)||o(t)};return window.addEventListener(`config-reload`,n),()=>window.removeEventListener(`config-reload`,n)},m=[e],t[3]=e,t[4]=f,t[5]=m),(0,s.useEffect)(f,m),l}function h(){return o(d())}export{u as a,l as i,h as n,m as r,p as t};