dorkos 0.133.0 → 0.134.0

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 (324) hide show
  1. package/dist/bin/cli.js +371 -82
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-D-EHHVPa.js → AboutPage-zOZ0j1a0.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-BTHnE1vP.js → ActivityErrorState-BlHkTJeC.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-BfSLPIdR.js → ActivityPage-LCOV7KDT.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-PwUBjQw8.js → ActivityRow-CvDae84E.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-DgkNN6bi.js → AdapterIcon-Dm5QP8_9.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-DX0dzp7q.js → AdapterSetupWizard-CNga-lEN.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-ApuDEKqq.js → AgentOptionRow-CHb4ifHN.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-BDci-9aL.js → AgentPicker-B8WFWr7p.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-B2gxCMGi.js → AgentRequestCard-Cnhi_1sr.js} +3 -3
  13. package/dist/client/assets/{AppearancePage-8SVnFe0k.js → AppearancePage-BI5qdQoW.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-CnL1ubxL.js → ApplyToOverridesDialog-gSHV8ggp.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-CCKhUtil.js → AttentionSignalRow-QgzOBKxa.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-B7wFPzG4.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Ck8dc5X4.js} +3 -3
  17. package/dist/client/assets/{BindingDialog-C4BHVXno.js → BindingDialog-DX1N_tTX.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-7E5uwVms.js → BlintzCanvas-FqS5vfnA.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-l7lfyDGn.js → CanvasCsvContent-B9h8JQsV.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-BXo8hS_n.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-BhAho9NF.js +2 -0
  22. package/dist/client/assets/{ChannelComposer-CAYvz_ZB.js → ChannelComposer-DUKyoCYz.js} +5 -5
  23. package/dist/client/assets/{ChatAppsOff-CNeKBVNz.js → ChatAppsOff-hxeSExhA.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-BZRcNFsS.js → CodeMirrorDiff-BoDEtyYj.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-DD5tArRn.js → CodeMirrorEditor-CU7h0emU.js} +1 -1
  26. package/dist/client/assets/{ComputerResourceView-BUmsVssG.js → ComputerResourceView-Dd4Kedxf.js} +1 -1
  27. package/dist/client/assets/{ComputerViewer-BKMR5LkF.js → ComputerViewer-CssfoCBB.js} +1 -1
  28. package/dist/client/assets/{ConnectionAccessLists-DYUiFmPY.js → ConnectionAccessLists-2qFBRKpv.js} +1 -1
  29. package/dist/client/assets/{ConnectionsPage-DR2Kfm9Q.js → ConnectionsPage-CPyrw58B.js} +1 -1
  30. package/dist/client/assets/{ConventionPage-Do6q8873.js → ConventionPage-B2MERyNx.js} +2 -2
  31. package/dist/client/assets/{ExtensionPageRoute-CP7NM7fw.js → ExtensionPageRoute-7x-7Ad0_.js} +1 -1
  32. package/dist/client/assets/{FeatureDisabledState-Bi23k3rg.js → FeatureDisabledState-DsbRcnZ6.js} +1 -1
  33. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-lRlmDXYz.js → FloatingTanStackRouterDevtools-CqogiFob-BReszru7.js} +1 -1
  34. package/dist/client/assets/{ForwardConsentHost-DSR1pEEK.js → ForwardConsentHost-DOwU-xQ9.js} +1 -1
  35. package/dist/client/assets/HandlePage-B7fNgSTl.js +1 -0
  36. package/dist/client/assets/{HeartbeatPage-BTNVcHOI.js → HeartbeatPage-0qi56iQb.js} +1 -1
  37. package/dist/client/assets/{KeyEntry-67acsEG2.js → KeyEntry-uKZG5d2z.js} +1 -1
  38. package/dist/client/assets/{LexicalField-Cb68LIar.js → LexicalField-CKc8eUK3.js} +2 -2
  39. package/dist/client/assets/{ManagesPage-ChPlBF42.js → ManagesPage-DWVLpjw2.js} +1 -1
  40. package/dist/client/assets/{Marketplace-CzPhJEE1.js → Marketplace-VBnmDEQE.js} +4 -4
  41. package/dist/client/assets/{MarketplaceSourcesView-CmQgxQmU.js → MarketplaceSourcesView-BRuo8wIH.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-z5JUaCSA.js → McpAppFrame-IfamHBcy.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-ZrnzwrOH.js → McpSigninBody-VmuxAjoo.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-HJpWK-JI.js → Model3dViewer-CT4aYUpn.js} +1 -1
  45. package/dist/client/assets/NamePage-CFRvBLJ8.js +1 -0
  46. package/dist/client/assets/NewDirectMessageMenu-BZFyclIS.js +1 -0
  47. package/dist/client/assets/{NotificationsPage-DwNUI0Z3.js → NotificationsPage-DMJf-hq3.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-RNAZY1vn.js → OpenMeshSwitch-DltP6-54.js} +1 -1
  49. package/dist/client/assets/{OperatorIdentityForm-B7S2C_eT.js → OperatorIdentityForm-C8oS_fQG.js} +1 -1
  50. package/dist/client/assets/PermissionHistory-BAe31Nl3.js +1 -0
  51. package/dist/client/assets/{PermissionsPage-ToK0DZVV.js → PermissionsPage-CqvpcXTJ.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-BvMtUQRM.js → PersonalityPopover-D8l_Hfc1.js} +1 -1
  53. package/dist/client/assets/PhotoPage-DTl81tTW.js +1 -0
  54. package/dist/client/assets/{PreviewRefusedNotice-DzbkMrUo.js → PreviewRefusedNotice-DZh7zTEt.js} +1 -1
  55. package/dist/client/assets/{ProfileFields-DU8dTGHT.js → ProfileFields-T1f833SK.js} +1 -1
  56. package/dist/client/assets/{ProfilePanelContainer-BfT-ufV7.js → ProfilePanelContainer-BSbE5rqM.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-DrOtV-0N.js → ProfileRolePicker-CpAhjq-e.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-CEnhme_V.js → PromptSuggestionChips-BGZ3HP31.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-CwjpR1Tw.js → ReportsToPopover-DfmvDL7E.js} +1 -1
  60. package/dist/client/assets/{RoomSurface-CChzNJKw.js → RoomSurface-DCYXQ79N.js} +1 -1
  61. package/dist/client/assets/{RoomsPage-Dbf6ijKr.js → RoomsPage-DTMTTWEf.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-Bh5sSsSC.js → RunsOnPopover-CjJiJgly.js} +1 -1
  63. package/dist/client/assets/{RuntimeConnectFlow-BYQnY5vv.js → RuntimeConnectFlow-Dinsb9em.js} +1 -1
  64. package/dist/client/assets/{RuntimeSetupDialog-DTO5v0dP.js → RuntimeSetupDialog-UhsfZRye.js} +1 -1
  65. package/dist/client/assets/{SeenDevices-cuY7ASEy.js → SeenDevices-CuXXI7Jv.js} +3 -3
  66. package/dist/client/assets/{SessionsPage-BrqpVx-t.js → SessionsPage-Cn4rUeyL.js} +1 -1
  67. package/dist/client/assets/{SettingsDialog-DCAZX_1d.js → SettingsDialog-CZrhYejc.js} +3 -3
  68. package/dist/client/assets/{SkillsPage-D5who_ZH.js → SkillsPage-CoanF7Jz.js} +1 -1
  69. package/dist/client/assets/{TaskDialogWrapper-BJ6XtOC5.js → TaskDialogWrapper-CU4PkcGk.js} +1 -1
  70. package/dist/client/assets/{TasksEmptyState-B3SjsxQa.js → TasksEmptyState-lWVZXYPS.js} +2 -2
  71. package/dist/client/assets/{TasksPage-B72w7J87.js → TasksPage-BPmiut-D.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-B9ma5j-X.js → TeamComputerEntry-2RKJhINy.js} +1 -1
  73. package/dist/client/assets/{TodoPromiseList-DDKWAfmv.js → TodoPromiseList-iODTn1_b.js} +1 -1
  74. package/dist/client/assets/{TodoPromisesPage-BNXpvXzS.js → TodoPromisesPage-BCm38YVu.js} +1 -1
  75. package/dist/client/assets/{ToolsPage-DbJykCG3.js → ToolsPage-Bboa9crU.js} +1 -1
  76. package/dist/client/assets/{TopologyGraph-DKZS3nlr.js → TopologyGraph-Dw_sLFBL.js} +1 -1
  77. package/dist/client/assets/{TourHost-Bw3Uoea5.js → TourHost-BUV9rMNn.js} +1 -1
  78. package/dist/client/assets/{UnlinkDialog-B-XCFNSd.js → UnlinkDialog-B7lL7sxN.js} +1 -1
  79. package/dist/client/assets/{UnreadDivider-1aPVzwd7.js → UnreadDivider-DCB47jhk.js} +1 -1
  80. package/dist/client/assets/{WidgetErrorCard-C5ieVv_9.js → WidgetErrorCard-D14BNvfm.js} +2 -2
  81. package/dist/client/assets/{WithheldExtensionsNotice-CCO4ClRZ.js → WithheldExtensionsNotice-I0VwWxDY.js} +1 -1
  82. package/dist/client/assets/{WorkQueuePage-BbPKNwDg.js → WorkQueuePage-wVj3wlat.js} +1 -1
  83. package/dist/client/assets/{WorkView-BRcytACJ.js → WorkView-MSsuFZVO.js} +1 -1
  84. package/dist/client/assets/{_shell-EwFeSIGp.js → _shell-Bp1Mn6YU.js} +4 -4
  85. package/dist/client/assets/{_shell._home-DD2mg-iK.js → _shell._home-CylH7Gjr.js} +1 -1
  86. package/dist/client/assets/{_shell._home.activity-Z1QuU2M4.js → _shell._home.activity-BABzsE_Y.js} +1 -1
  87. package/dist/client/assets/_shell._home.index-BWXNHCGe.js +3 -0
  88. package/dist/client/assets/{_shell._home.tasks-BtC85Iut.js → _shell._home.tasks-BJg6t5SW.js} +1 -1
  89. package/dist/client/assets/{_shell._home.workspaces-qMG5OJYR.js → _shell._home.workspaces-B3LBf9vr.js} +1 -1
  90. package/dist/client/assets/{_shell.channels-BE4EK-iM.js → _shell.channels-C0xYFINv.js} +2 -2
  91. package/dist/client/assets/_shell.connections-73FPamLr.js +6 -0
  92. package/dist/client/assets/{_shell.feedback-requests-CwKSkkuD.js → _shell.feedback-requests-BYYmQE_b.js} +1 -1
  93. package/dist/client/assets/_shell.marketplace-CiBixBHr.js +1 -0
  94. package/dist/client/assets/_shell.marketplace_.sources-DPUWEdt6.js +1 -0
  95. package/dist/client/assets/_shell.session-CJhLuYyA.js +1 -0
  96. package/dist/client/assets/{_shell.team-Dm5a4f8_.js → _shell.team-BbulfYAQ.js} +3 -3
  97. package/dist/client/assets/_shell.threads-CRFlslhF.js +1 -0
  98. package/dist/client/assets/_shell.todos-CmwRh6jX.js +6 -0
  99. package/dist/client/assets/_shell.x._extensionId-DdKU91-V.js +1 -0
  100. package/dist/client/assets/_shell.x._extensionId_._-DdKU91-V.js +1 -0
  101. package/dist/client/assets/{abnfDiagram-WEYOIA3C-Bu2T3jVw.js → abnfDiagram-WEYOIA3C-CF3eRhtw.js} +1 -1
  102. package/dist/client/assets/{access-copy-tkiFMhRf.js → access-copy-EuKlRWLG.js} +1 -1
  103. package/dist/client/assets/{arc-5q4SfXO9.js → arc-BqnZif1q.js} +1 -1
  104. package/dist/client/assets/{architectureDiagram-ZHVYKT53-BnDMOBhV.js → architectureDiagram-ZHVYKT53-CQytXLkh.js} +1 -1
  105. package/dist/client/assets/{banner-CSKUrrI0.js → banner-nfkn2OLZ.js} +1 -1
  106. package/dist/client/assets/{blockDiagram-RJAE7QA3-CtushlEs.js → blockDiagram-RJAE7QA3-CXieJU3q.js} +1 -1
  107. package/dist/client/assets/{c4Diagram-XDPPPE54-7L-qYwKH.js → c4Diagram-XDPPPE54-BPmgfFrI.js} +1 -1
  108. package/dist/client/assets/channel-BOMQJ9aR.js +1 -0
  109. package/dist/client/assets/{chunk-2E7WHVMD-ksBVyqQ3.js → chunk-2E7WHVMD-BtumkVCk.js} +1 -1
  110. package/dist/client/assets/{chunk-2Q5K7J3B-Bfqdkihb.js → chunk-2Q5K7J3B-BUsPKn6-.js} +1 -1
  111. package/dist/client/assets/{chunk-4EMNKR2T-Brf2dH9x.js → chunk-4EMNKR2T-CuRou8Oa.js} +1 -1
  112. package/dist/client/assets/{chunk-55XCU76K-BlE7Cq40.js → chunk-55XCU76K-CafKfo9G.js} +1 -1
  113. package/dist/client/assets/{chunk-5VM5RSS4-Bkgg3j7L.js → chunk-5VM5RSS4-BdemtVRg.js} +1 -1
  114. package/dist/client/assets/{chunk-JWPE2WC7-B9TRpN4O.js → chunk-JWPE2WC7-C1pKIt5Q.js} +1 -1
  115. package/dist/client/assets/{chunk-VQ5W62QI-ZoILnIYi.js → chunk-VQ5W62QI-DPIQcwQZ.js} +1 -1
  116. package/dist/client/assets/{chunk-XXDRQBXY-r2xNhaKz.js → chunk-XXDRQBXY-CDtiCG5n.js} +1 -1
  117. package/dist/client/assets/{chunk-ZCHMQSOR-DfV3cF7d.js → chunk-ZCHMQSOR-DsHVvsHO.js} +2 -2
  118. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-VOVqMNNP.js → classDiagram-v2-4MYWR3UA-CNKi62Mk.js} +1 -1
  119. package/dist/client/assets/{command-CaUEAy3b.js → command-D1cWVheG.js} +1 -1
  120. package/dist/client/assets/{copy-button-BOznikwM.js → copy-button-BHHQAtAH.js} +1 -1
  121. package/dist/client/assets/{cose-bilkent-JH36ORCC-CAdBvyLz.js → cose-bilkent-JH36ORCC-CqK8lNYm.js} +1 -1
  122. package/dist/client/assets/{cpu-j9vX9Wfk.js → cpu-BhPT23rn.js} +1 -1
  123. package/dist/client/assets/{cynefin-EF2NZ3EQ-DcH1A9Oo.js → cynefin-EF2NZ3EQ-DUFv7wAT.js} +1 -1
  124. package/dist/client/assets/{cynefinDiagram-WF24UDRP-DJuKBXHi.js → cynefinDiagram-WF24UDRP-DprACurA.js} +1 -1
  125. package/dist/client/assets/{dagre-NK4GIZVX-D099H_0S.js → dagre-NK4GIZVX-CFCbvrTm.js} +1 -1
  126. package/dist/client/assets/{detail-row-Crl89jnh.js → detail-row-DBa1uo_y.js} +1 -1
  127. package/dist/client/assets/{diagram-CBK3MWTC-Cd_4W9XO.js → diagram-CBK3MWTC-BgRgWBNs.js} +1 -1
  128. package/dist/client/assets/{diagram-I5XIIV2D-Bc7aQKt3.js → diagram-I5XIIV2D-Bvmxrku7.js} +1 -1
  129. package/dist/client/assets/{diagram-ODIL2UCW-awVJZ4Bg.js → diagram-ODIL2UCW-CqzUdcUW.js} +1 -1
  130. package/dist/client/assets/{diagram-PFBEJUXE-dhsj9aeU.js → diagram-PFBEJUXE-DwXryVWl.js} +1 -1
  131. package/dist/client/assets/{diagram-RJA3I4VV-Dm59CbiV.js → diagram-RJA3I4VV-DqGvHPAI.js} +1 -1
  132. package/dist/client/assets/{diagram-TYUNFSNR-BhvcIjA9.js → diagram-TYUNFSNR-GOfZ43Y3.js} +1 -1
  133. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-C4wT_MTC.js → ebnfDiagram-V4P3TTPT-lF7-sW99.js} +1 -1
  134. package/dist/client/assets/{elk-QONTBCTQ-CPI0zjmW.js → elk-QONTBCTQ-Cd5kFMK6.js} +1 -1
  135. package/dist/client/assets/{empty-state-BHcmkSzu.js → empty-state-CHse95jw.js} +1 -1
  136. package/dist/client/assets/{erDiagram-KYQIGQAA-C_vGcbOB.js → erDiagram-KYQIGQAA-BqXJlTJO.js} +1 -1
  137. package/dist/client/assets/{execution-config-BS5rtvTZ.js → execution-config-U_R_H28y.js} +1 -1
  138. package/dist/client/assets/{file-CQGljfDT.js → file-DZ6-r1A3.js} +1 -1
  139. package/dist/client/assets/{file-exclamation-point-B0a55VME.js → file-exclamation-point-CR6qeV6m.js} +1 -1
  140. package/dist/client/assets/{file-text-Cycq_S0e.js → file-text-4-Vc22J-.js} +1 -1
  141. package/dist/client/assets/{find-latest-widget-fence-B6sJdG3Q.js → find-latest-widget-fence-D61kyRv5.js} +2 -2
  142. package/dist/client/assets/{flowDiagram-IUGLLWBU-_VNfmnxx.js → flowDiagram-IUGLLWBU-C18poulN.js} +1 -1
  143. package/dist/client/assets/{form-BL14vwyB.js → form-B51NLChW.js} +1 -1
  144. package/dist/client/assets/{format-cron-meJMgYNe.js → format-cron-CrDI8dcD.js} +1 -1
  145. package/dist/client/assets/{ganttDiagram-R7GPNTJY-o0gGU7X_.js → ganttDiagram-R7GPNTJY-BHa77y_O.js} +1 -1
  146. package/dist/client/assets/{git-branch-CsLE6G0Y.js → git-branch-CzV_Mp0H.js} +1 -1
  147. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DjXjUpJo.js → gitGraphDiagram-PDYL7XHY-DdfDaaK5.js} +1 -1
  148. package/dist/client/assets/{graph-BMYee_VK.js → graph-stVQph_6.js} +1 -1
  149. package/dist/client/assets/{heart-Cn3a-UQI.js → heart-B7rSSNjF.js} +1 -1
  150. package/dist/client/assets/{highlighted-body-KPVGNVTW-DsX5yCC0.js → highlighted-body-KPVGNVTW-BDppiTvx.js} +1 -1
  151. package/dist/client/assets/{image-lightbox-BZ_eBZgA.js → image-lightbox-DwZmxmRU.js} +1 -1
  152. package/dist/client/assets/{image-off-DjR7LI5G.js → image-off-B65OAyEw.js} +1 -1
  153. package/dist/client/assets/{index-BR1m9FON.js → index-B2JoVHek.js} +231 -231
  154. package/dist/client/assets/{index-Cb_p_ynP.js → index-BC7vn8oJ.js} +1 -1
  155. package/dist/client/assets/{index-DARchye_.js → index-BD0bxxdG.js} +1 -1
  156. package/dist/client/assets/{index-BxWr8Mrf.js → index-BJE7FpeW.js} +1 -1
  157. package/dist/client/assets/{index-CczLBUKI.js → index-BLepK8Tm.js} +1 -1
  158. package/dist/client/assets/{index-Z2ApBQt4.js → index-BNMepjWi.js} +1 -1
  159. package/dist/client/assets/{index-H4e5Wpmi.js → index-B_7AgsWu.js} +1 -1
  160. package/dist/client/assets/{index-Cgjq7a-8.js → index-BchQNMCW.js} +1 -1
  161. package/dist/client/assets/{index-DFb4kOjm.js → index-BgKo-iME.js} +2 -2
  162. package/dist/client/assets/{index-Kt6r3DQg.js → index-BncKYCzR.js} +1 -1
  163. package/dist/client/assets/{index-CpWxcN5D.js → index-Bocv39Dy.js} +1 -1
  164. package/dist/client/assets/{index-BcnwvTnt.js → index-Bx9vkvgI.js} +1 -1
  165. package/dist/client/assets/{index-o6kGmVGx.js → index-ByKStnc0.js} +1 -1
  166. package/dist/client/assets/index-C2FXv0W1.js +1 -0
  167. package/dist/client/assets/index-CCRFURxg.js +1 -0
  168. package/dist/client/assets/{index-DLN0kcME.js → index-CNXWcd0h.js} +1 -1
  169. package/dist/client/assets/index-CT9qR-37.js +1 -0
  170. package/dist/client/assets/{index-vHKVYcH7.js → index-CXbvnAWk.js} +1 -1
  171. package/dist/client/assets/{index-Cv67OXfk.js → index-CaWtXSTG.js} +1 -1
  172. package/dist/client/assets/{index-DQ8uADJF.js → index-CayDBSDe.js} +1 -1
  173. package/dist/client/assets/{index-4rSR8lau.js → index-Ci17H_nH.js} +1 -1
  174. package/dist/client/assets/{index-DqZmnJED.js → index-CpCaGGh0.js} +1 -1
  175. package/dist/client/assets/{index-CfKSlYjb.js → index-CvLTkguu.js} +1 -1
  176. package/dist/client/assets/{index-dY7IFpet.js → index-CyTJNCti.js} +1 -1
  177. package/dist/client/assets/{index-Joav7LQU.js → index-CzDpDW1S.js} +1 -1
  178. package/dist/client/assets/{index-B4TxpTKD.js → index-D1FZurLO.js} +1 -1
  179. package/dist/client/assets/{index-BmKHO-FD.js → index-D5HU9MN-.js} +1 -1
  180. package/dist/client/assets/index-DBjkg_lo.css +1 -0
  181. package/dist/client/assets/{index-gmyiXkmr.js → index-DCymAWyX.js} +1 -1
  182. package/dist/client/assets/{index-faSyUc2q.js → index-DDPQZJQz.js} +1 -1
  183. package/dist/client/assets/{index-Cf4Gtxf9.js → index-DK-qQXH4.js} +1 -1
  184. package/dist/client/assets/{index-DrlB9RSk.js → index-DTJV1dBd.js} +1 -1
  185. package/dist/client/assets/{index-DiM3QX-4.js → index-Dhj4iWHB.js} +3 -3
  186. package/dist/client/assets/index-DxqA8BnM.js +1 -0
  187. package/dist/client/assets/{index-DlvUENo4.js → index-DzVJOMZm.js} +1 -1
  188. package/dist/client/assets/{index-47--OGKJ.js → index-FRNKkajP.js} +1 -1
  189. package/dist/client/assets/{index-Dfko0tSp.js → index-L1Tsd-wn.js} +1 -1
  190. package/dist/client/assets/{index-KganLhU1.js → index-QaablvAu.js} +2 -2
  191. package/dist/client/assets/{index-DMSSN08i.js → index-SawUg2NU.js} +1 -1
  192. package/dist/client/assets/{index-B8LqLhq7.js → index-YObNtFmj.js} +1 -1
  193. package/dist/client/assets/{index-1MwES_vb.js → index-iRuOpaV9.js} +1 -1
  194. package/dist/client/assets/{index-BOCclWF3.js → index-ulrRTPa9.js} +1 -1
  195. package/dist/client/assets/{index-BsZkXHsH.js → index-wcSHU-xr.js} +1 -1
  196. package/dist/client/assets/{index-D5Qmx1JR.js → index-yZEr0YWk.js} +3 -3
  197. package/dist/client/assets/{index.esm-CJIDYBqd.js → index.esm-gt8tvZ7J.js} +1 -1
  198. package/dist/client/assets/{infoDiagram-MVDRKAX5-B1mMyUlp.js → infoDiagram-MVDRKAX5-DzhnMotD.js} +1 -1
  199. package/dist/client/assets/{inline-code-mh48Uhbi.js → inline-code-rYW-kJLB.js} +1 -1
  200. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-efEMQ0_X.js → ishikawaDiagram-HPEHV2GE-CfEX5E3R.js} +1 -1
  201. package/dist/client/assets/{journeyDiagram-BOSHW7O7-DSAywiVk.js → journeyDiagram-BOSHW7O7-oPrRia7f.js} +1 -1
  202. package/dist/client/assets/{kanban-definition-FNSA4HC5-B9pbU4zK.js → kanban-definition-FNSA4HC5-c4CFmcMa.js} +1 -1
  203. package/dist/client/assets/{layers-B0Z5Od3N.js → layers-D9XZggr2.js} +1 -1
  204. package/dist/client/assets/{lightbulb-Cfb5ecEd.js → lightbulb-DQBO5jSg.js} +1 -1
  205. package/dist/client/assets/{link-2-Dzy5BUL3.js → link-2-CZiWX9vI.js} +1 -1
  206. package/dist/client/assets/{list-runtime-types-DLmjtBMq.js → list-runtime-types-Dry1muZ1.js} +1 -1
  207. package/dist/client/assets/{markdown-content-DhAtZOfj.js → markdown-content-FcvkqTTS.js} +1 -1
  208. package/dist/client/assets/{mention-pill-DmA8FxL4.js → mention-pill-BxASQ-6w.js} +1 -1
  209. package/dist/client/assets/{mermaid.core-DUIkdbeL.js → mermaid.core-BqACpHu4.js} +4 -4
  210. package/dist/client/assets/{message-square-off-BowIzJUV.js → message-square-off-SMiCYjYr.js} +1 -1
  211. package/dist/client/assets/{mindmap-definition-6OY57UG3-Dz7ZOR4C.js → mindmap-definition-6OY57UG3-BSYcYnyL.js} +1 -1
  212. package/dist/client/assets/{more-details-DV7LmY0E.js → more-details-D9_Bn2GL.js} +1 -1
  213. package/dist/client/assets/{owner-notice-DdFc2P8z.js → owner-notice-DO2xE-1L.js} +1 -1
  214. package/dist/client/assets/{package-BhKXbvU_.js → package-DpqGENzU.js} +1 -1
  215. package/dist/client/assets/{page-container-0sWZ3xh9.js → page-container-Cta3RqHd.js} +1 -1
  216. package/dist/client/assets/{pane-resize-handle-Bjy4udre.js → pane-resize-handle-BJ0XV-Zg.js} +1 -1
  217. package/dist/client/assets/{paperclip-C-7LhBfl.js → paperclip-CItlLyje.js} +1 -1
  218. package/dist/client/assets/{path-input-BPVyI72G.js → path-input-CAkVS5XR.js} +1 -1
  219. package/dist/client/assets/{pegDiagram-ECIUJNBX-C4EOP-Fa.js → pegDiagram-ECIUJNBX-Bnc4eqtF.js} +1 -1
  220. package/dist/client/assets/{pieDiagram-GNMPY74T-CQ1OxRkv.js → pieDiagram-GNMPY74T-7gG33sSR.js} +1 -1
  221. package/dist/client/assets/{plug-CIZ-wWL8.js → plug-Cb8qsOxJ.js} +1 -1
  222. package/dist/client/assets/{primer-trigger-XA5fLzR5.js → primer-trigger-BG3lb31_.js} +2 -2
  223. package/dist/client/assets/{profile-errors-C1XACbc9.js → profile-errors-T-3VgU7E.js} +1 -1
  224. package/dist/client/assets/progress-CwpnobNW.js +1 -0
  225. package/dist/client/assets/{quadrantDiagram-D57K4MC3-Cw4BdkpS.js → quadrantDiagram-D57K4MC3-Dr2Z6GbA.js} +1 -1
  226. package/dist/client/assets/{query-error-state-Cm-Lozlb.js → query-error-state-BV8fyXBe.js} +1 -1
  227. package/dist/client/assets/{radio-DQ29H26H.js → radio-SApjvqfy.js} +1 -1
  228. package/dist/client/assets/{railroadDiagram-Y72NRBL7-CSKtYLmm.js → railroadDiagram-Y72NRBL7-7kfKSzWs.js} +1 -1
  229. package/dist/client/assets/{registry-Tbt9pcZl.js → registry-BcpatPes.js} +4 -4
  230. package/dist/client/assets/registry-BuTvvFn6.js +1 -0
  231. package/dist/client/assets/{relay-trace-schemas-4AAUf-Zl.js → relay-trace-schemas-eOfnfe4X.js} +2 -2
  232. package/dist/client/assets/{repeat-B8g-x-Sc.js → repeat-BB0attnO.js} +1 -1
  233. package/dist/client/assets/{requirementDiagram-EQYSW5RA-BPSBZr7X.js → requirementDiagram-EQYSW5RA-CmOVPT7N.js} +1 -1
  234. package/dist/client/assets/{room-files-source-BkiK4-ZI.js → room-files-source-C32w3dXr.js} +1 -1
  235. package/dist/client/assets/{rotate-ccw-clock-DRtL-2nr.js → rotate-ccw-clock-C1SBdbZP.js} +1 -1
  236. package/dist/client/assets/{rotate-cw-BbHkWN-J.js → rotate-cw-BTqPAMgP.js} +1 -1
  237. package/dist/client/assets/{sankeyDiagram-SY24JHO5-DVlHablQ.js → sankeyDiagram-SY24JHO5-DFcTUSd1.js} +1 -1
  238. package/dist/client/assets/{scroll-area-DAC7NrVU.js → scroll-area-rEyYMbHG.js} +1 -1
  239. package/dist/client/assets/{sequenceDiagram-BLEHNHQU--wZkN8xk.js → sequenceDiagram-BLEHNHQU-BNY4ALqc.js} +1 -1
  240. package/dist/client/assets/server-BCFl_ur3.js +6 -0
  241. package/dist/client/assets/{shield-x-CEWfkzDN.js → shield-x-B2nLbkhR.js} +1 -1
  242. package/dist/client/assets/{signed-in-CMhCR-m8.js → signed-in-BcxH99a5.js} +1 -1
  243. package/dist/client/assets/{sizeCapture-INFHLROL-CLXc7d3S.js → sizeCapture-INFHLROL-CuNPY5HV.js} +1 -1
  244. package/dist/client/assets/{soul-file-CbX7rNqz.js → soul-file-ITCKiDY9.js} +1 -1
  245. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-5xa1FM_X.js → stateDiagram-v2-A6IESKWZ-CmUdZZJs.js} +1 -1
  246. package/dist/client/assets/{swimlanes-B3ENRKFQ-DKgxJxjE.js → swimlanes-B3ENRKFQ-BmNmFgsZ.js} +1 -1
  247. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Cd_Magxj.js +8 -0
  248. package/dist/client/assets/{table-D0EJT0uP.js → table-COZ3E1UU.js} +1 -1
  249. package/dist/client/assets/{tabs-Ctjzrm8t.js → tabs-CDr3zS_2.js} +1 -1
  250. package/dist/client/assets/{timeline-definition-JXYKGLGB-B9P7ituI.js → timeline-definition-JXYKGLGB-Cq7UTNkh.js} +1 -1
  251. package/dist/client/assets/{trust-dial-D__tIhzt.js → trust-dial-BsEooNiu.js} +2 -2
  252. package/dist/client/assets/{trust-posture-DaHHtOZn.js → trust-posture-Dk5ctS0Q.js} +1 -1
  253. package/dist/client/assets/{unplug-B-ipHefz.js → unplug-DB0xx2bf.js} +1 -1
  254. package/dist/client/assets/{unverified-catalog-notice-C8swqaTn.js → unverified-catalog-notice-CQoKhOjQ.js} +1 -1
  255. package/dist/client/assets/{use-bindings-gLHRNAFU.js → use-bindings-CEhDyZoj.js} +1 -1
  256. package/dist/client/assets/{use-composer-prefs-CjpxcBIe.js → use-composer-prefs-uC9mUd0f.js} +1 -1
  257. package/dist/client/assets/{use-connector-management-BLiCJMgU.js → use-connector-management-54m5ZcyP.js} +1 -1
  258. package/dist/client/assets/{use-deep-link-scroll-r2nKjzA-.js → use-deep-link-scroll-C4DQRnGX.js} +1 -1
  259. package/dist/client/assets/{use-delete-binding-BSiOik_K.js → use-delete-binding-Cr9soEn-.js} +1 -1
  260. package/dist/client/assets/{use-dev-links-DXcIlMf-.js → use-dev-links-CXGFC-N0.js} +1 -1
  261. package/dist/client/assets/{use-direct-message-panel-BbH8N4mE.js → use-direct-message-panel-BxwiNzks.js} +1 -1
  262. package/dist/client/assets/{use-external-adapter-catalog-mmKni5ui.js → use-external-adapter-catalog-D3xkw3mY.js} +1 -1
  263. package/dist/client/assets/{use-filter-state-CiPZ0AIH.js → use-filter-state-N0pdU49v.js} +1 -1
  264. package/dist/client/assets/{use-full-activity-feed-DXroUzfN.js → use-full-activity-feed-COuRZq_w.js} +1 -1
  265. package/dist/client/assets/use-is-below-desktop-CgAcZ8iA.js +1 -0
  266. package/dist/client/assets/{use-mesh-topology-upehQ5Cv.js → use-mesh-topology-BSRzCO1U.js} +1 -1
  267. package/dist/client/assets/{use-mounted-ref-IHwyriaF.js → use-mounted-ref-pxDiCOyS.js} +1 -1
  268. package/dist/client/assets/{use-notification-prefs-BHOK2P2l.js → use-notification-prefs-6N6Y4rqG.js} +1 -1
  269. package/dist/client/assets/use-pending-read-HbJdwxw1.js +1 -0
  270. package/dist/client/assets/{use-personality-commit-Chf3UX8P.js → use-personality-commit-Dl3YK7Qd.js} +1 -1
  271. package/dist/client/assets/{use-promo-activation-Dlw6bg7G.js → use-promo-activation-DXRrwLes.js} +2 -2
  272. package/dist/client/assets/{use-promo-dismissals-Dx_fli7I.js → use-promo-dismissals-DnqiKhqW.js} +1 -1
  273. package/dist/client/assets/{use-pulse-freshness-CG_I6a-O.js → use-pulse-freshness-D9uzSgz_.js} +1 -1
  274. package/dist/client/assets/{use-room-follow-claim-Bgrpr3bO.js → use-room-follow-claim-Ch6ZoOAv.js} +1 -1
  275. package/dist/client/assets/{use-room-sessions-DecGrP3E.js → use-room-sessions-C3NpXFWY.js} +1 -1
  276. package/dist/client/assets/{use-roving-tab-list-CDkh-Ujm.js → use-roving-tab-list-LZku4K5R.js} +1 -1
  277. package/dist/client/assets/{use-session-canvas-tvLLPQcm.js → use-session-canvas-Bub7vCaj.js} +6 -6
  278. package/dist/client/assets/{use-status-budget-BBl2yxLR.js → use-status-budget-DrAROrOw.js} +2 -2
  279. package/dist/client/assets/{use-todos-BzRauzdQ.js → use-todos-COW66MhB.js} +1 -1
  280. package/dist/client/assets/{use-transform-DzJeHpxm.js → use-transform-CXFCVk8z.js} +1 -1
  281. package/dist/client/assets/{use-unclaimed-chats--HZdmq4F.js → use-unclaimed-chats-T3kskM3T.js} +1 -1
  282. package/dist/client/assets/use-update-config-BhLEnZe5.js +1 -0
  283. package/dist/client/assets/{useMutationState-DIywUTDG.js → useMutationState-6Zu1xBsZ.js} +1 -1
  284. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-C9aLJ03F.js → usecaseDiagram-WPOLBNNX-CUu-YUIY.js} +1 -1
  285. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-ChBIWbL0.js → vennDiagram-Q3Y3IDCW-CfA29THe.js} +1 -1
  286. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DvQDOaTm.js → wardleyDiagram-IVAIDKWA-CrARcH-W.js} +1 -1
  287. package/dist/client/assets/{xychartDiagram-4URNHDU4-8FxLPP2c.js → xychartDiagram-4URNHDU4-BCVaXTG3.js} +1 -1
  288. package/dist/client/assets/{zap-DSllMMHe.js → zap-C-pr1sst.js} +1 -1
  289. package/dist/client/index.html +2 -2
  290. package/dist/drizzle/20261108035027_dor3547_extension_grant_subject.sql +30 -0
  291. package/dist/drizzle/meta/20261108035027_snapshot.json +15121 -0
  292. package/dist/drizzle/meta/_journal.json +7 -0
  293. package/dist/server/extension-child.cjs +19 -3
  294. package/dist/server/index.js +13162 -12123
  295. package/dist/server/index.js.map +2 -2
  296. package/package.json +2 -2
  297. package/dist/client/assets/CanvasFileContent-Bqd0IEfK.js +0 -2
  298. package/dist/client/assets/CanvasModel3dContent-DqL0Sy4r.js +0 -2
  299. package/dist/client/assets/HandlePage-aHId3bYX.js +0 -1
  300. package/dist/client/assets/NamePage-C7F-SotG.js +0 -1
  301. package/dist/client/assets/NewDirectMessageMenu-CjBjzsDe.js +0 -1
  302. package/dist/client/assets/PermissionHistory-D0chstxf.js +0 -1
  303. package/dist/client/assets/PhotoPage-Cqo3PNO_.js +0 -1
  304. package/dist/client/assets/_shell._home.index-BzTYr8Bw.js +0 -3
  305. package/dist/client/assets/_shell.connections-CBx0ogzx.js +0 -1
  306. package/dist/client/assets/_shell.marketplace-CgWBUKSA.js +0 -1
  307. package/dist/client/assets/_shell.marketplace_.sources-8HZpKFDI.js +0 -1
  308. package/dist/client/assets/_shell.session-D6HcVbnm.js +0 -1
  309. package/dist/client/assets/_shell.threads-BavVtQOE.js +0 -1
  310. package/dist/client/assets/_shell.todos-B6uWr0zA.js +0 -6
  311. package/dist/client/assets/_shell.x._extensionId-DaELdkCH.js +0 -1
  312. package/dist/client/assets/_shell.x._extensionId_._-DaELdkCH.js +0 -1
  313. package/dist/client/assets/channel-A3XT7_2L.js +0 -1
  314. package/dist/client/assets/index-BJRgbiEd.js +0 -1
  315. package/dist/client/assets/index-BcFn_S6b.js +0 -1
  316. package/dist/client/assets/index-BdVQOlVQ.css +0 -1
  317. package/dist/client/assets/index-C5EvpXcq.js +0 -1
  318. package/dist/client/assets/index-DZhMvc9m.js +0 -1
  319. package/dist/client/assets/progress-BA2JPtb6.js +0 -6
  320. package/dist/client/assets/registry-jD9zw538.js +0 -1
  321. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-f6MOc3pl.js +0 -8
  322. package/dist/client/assets/use-is-below-desktop-LUZL5z5t.js +0 -1
  323. package/dist/client/assets/use-pending-read-mVsOBTzn.js +0 -1
  324. package/dist/client/assets/use-update-config-DjL7-nUR.js +0 -1
@@ -0,0 +1,6 @@
1
+ import{O as Fn,a5 as oe,a7 as Ye,a8 as Oe,a6 as Ms,j as e,d2 as X,d3 as ee,d5 as se,d6 as ne,d7 as re,e_ as te,d$ as ue,B as y,dR as D,dV as Bs,G as L,x as me,a1 as qs,a2 as G,bD as Us,C as he,r as f,fs as Mn,e8 as Bn,I as J,e as P,oc as Ws,a9 as Hs,c$ as ae,am as le,lY as Ue,ba as Ve,z as qn,ip as Un,h0 as Ks,h as Gs,i as Wn,m0 as Hn,f_ as Kn,s as Ys,fL as Gn,a4 as Qe,Q as Re,T as Te,U as Yn,V as $e,eL as Z,bO as xe,bP as fe,bQ as je,bR as ye,bS as ve,bT as Ne,bU as be,bW as Le,hP as Je,eO as Ze,eP as Xe,c3 as Vn,aS as Qn,od as Jn,j5 as Zn,eN as Xn,ff as Vs,bg as et,fY as st,ew as Qs,ex as Js,ey as Zs,ez as Xs,eA as We,cz as es,l as en,lW as nt,hf as tt,dn as Se,dp as Ae,dq as Ie,oe as at,H as sn,of as it,gH as ot,a3 as ss,h7 as rt,gn as ct,go as lt,gp as dt,f as ns,A as ut,dB as mt,dw as B,dv as pe,dy as ze,dz as H,du as fs,og as ht,oh as pt,oi as gt,oj as xt,eM as ft,X as jt,bc as nn,eH as ts,eI as de,ak as yt,al as vt,ok as tn,af as Nt,ag as bt,ah as kt,i9 as Ct,ol as wt,aj as St,ic as At,om as It,id as Rt,on as Tt,aX as $t,oo as Et,op as _t,gm as Pt,oq as Ot,or as Lt,os as zt,ot as js,ou as Dt,ov as an,ow as Ft,ox as Mt,dc as Bt,eh as qt}from"./index-B2JoVHek.js";import{e as on,j as Ee,k as rn,f as as,l as Ut,m as Wt,n as cn,c as Ht,g as ln,o as Kt,h as Gt,p as Yt,s as ge,q as Vt,i as dn}from"./access-copy-EuKlRWLG.js";import{P as Qt}from"./page-container-Cta3RqHd.js";import{Q as K}from"./query-error-state-BV8fyXBe.js";import{s as is,u as Jt,a as Zt,b as un,c as Xt,d as ea,e as ys,f as sa,i as na,C as ta,g as aa,h as ia,j as oa,L as mn,k as hn,A as ra,l as ca,m as la,n as da,o as ua,p as ma,w as ha,F as pa,q as ga,r as xa,R as fa,t as ja,v as ya,x as va,y as Na}from"./AgentRequestCard-Cnhi_1sr.js";import{C as ba}from"./ChatAppsOff-hxeSExhA.js";import{B as ka,u as De}from"./use-bindings-CEhDyZoj.js";import{u as pn,a as Ca,b as wa,c as Sa,d as Aa,e as Ia,U as Ra}from"./use-unclaimed-chats-T3kskM3T.js";import{c as Ta,u as $a,g as vs,h as Ea,i as _a,j as Pa,k as Oa}from"./use-connector-management-54m5ZcyP.js";import{b as gn,C as La,O as xn}from"./connection-copy--MA7AN04.js";import{E as za}from"./empty-state-CHse95jw.js";import{S as Da}from"./server-BCFl_ur3.js";import{T as Fa,a as Ma,b as Ns,c as bs}from"./tabs-CDr3zS_2.js";import{a as Ba,B as qa,t as Ua,d as Wa}from"./BindingDialog-DX1N_tTX.js";import{u as Ha}from"./use-delete-binding-Cr9soEn-.js";import{u as os,A as fn}from"./AdapterSetupWizard-CNga-lEN.js";import{s as Ka}from"./session-strategy-labels-C7Wduch3.js";import{Z as Ga}from"./zap-C-pr1sst.js";import{M as Ya}from"./message-square-off-SMiCYjYr.js";import{M as Va}from"./more-details-D9_Bn2GL.js";import{B as Qa}from"./trust-dial-BsEooNiu.js";import{C as Ja,a as Za,b as Xa,c as ei,e as si}from"./command-D1cWVheG.js";import"./relay-trace-schemas-eOfnfe4X.js";import"./KeyEntry-uKZG5d2z.js";import"./use-update-config-BhLEnZe5.js";import"./inline-code-rYW-kJLB.js";import"./form-B51NLChW.js";import"./trust-posture-Dk5ctS0Q.js";import"./markdown-content-FcvkqTTS.js";/**
2
+ * @license lucide-react v1.48.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const jn={name:"lock-open",size:24,node:[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],aliases:["unlock"]};jn.node;const ni=Fn(jn);function ti(){const s=oe(),n=Ye();return Oe({mutationFn:({id:t,agentId:a})=>s.moveBinding(t,a),meta:{errorLabel:"Couldn’t move the chat"},onSuccess:()=>{n.invalidateQueries({queryKey:[...ka]})}})}function yn(s){const n=oe();return Ms({queryKey:["relay","adapters",s,"events"],queryFn:()=>n.getAdapterEvents(s),enabled:!!s,refetchInterval:5e3})}function He(s,n){var c;const t=s;if(!t||t.code!=="CHAT_ALREADY_BOUND")return null;const a=(c=t.body)==null?void 0:c.conflict,i=typeof(a==null?void 0:a.bindingId)=="string"?a.bindingId:null;if(!i)return null;const r=typeof(a==null?void 0:a.agentId)=="string"?a.agentId:"another agent";return{bindingId:i,currentAgentName:r,nextAgentId:n.id,nextAgentName:n.name}}function vn({conflict:s,onClose:n,onMoved:t}){return e.jsx(X,{open:s!==null,onOpenChange:a=>!a&&n(),children:e.jsx(ee,{className:"sm:max-w-md",children:s&&e.jsx(ai,{conflict:s,onClose:n,onMoved:t})})})}function ai({conflict:s,onClose:n,onMoved:t}){const a=ti();return e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(ne,{children:"This chat already reaches someone"}),e.jsx(re,{children:"A chat goes to one agent at a time."})]}),e.jsxs(te,{className:"pb-2",children:[e.jsxs("p",{className:"text-sm leading-relaxed",children:["This chat reaches ",e.jsx("span",{className:"font-medium",children:s.currentAgentName}),". Move it to ",e.jsx("span",{className:"font-medium",children:s.nextAgentName}),"?"]}),e.jsxs("p",{className:"text-muted-foreground mt-2 text-xs leading-relaxed",children:["Past messages stay with ",s.currentAgentName,". ",s.nextAgentName," starts fresh."]})]}),e.jsxs(ue,{children:[e.jsx(y,{variant:"outline",onClick:n,disabled:a.isPending,children:"Leave it"}),e.jsx(y,{disabled:a.isPending,onClick:()=>a.mutate({id:s.bindingId,agentId:s.nextAgentId},{onSuccess:()=>{D.success(`${s.nextAgentName} answers this chat now.`),n(),t==null||t()}}),children:a.isPending?"Moving…":`Move it to ${s.nextAgentName}`})]})]})}function Fe(s,n){var t;return((t=n.get(s))==null?void 0:t.displayName)??Bs(s)}function ii(s){return s===0?"No agents yet":s===1?"1 agent":`${s} agents`}function oi(s){return s.length<=1?s[0]??"":s.length===2?`${s[0]} and ${s[1]}`:`${s[0]} and ${s.length-1} more`}function ri(s){if(!(s.label.toLowerCase()!==s.toolkit.toLowerCase()))return{account:s.identityHint??s.label,identity:null};const t=s.identityHint&&s.identityHint!==s.label?s.identityHint:null;return{account:s.label,identity:t}}function Nn(s,n){const t=is(n.get(s));return t===void 0?{}:{logo:t}}const ci={ready:"ready",needs_you:"broken",unavailable:"broken",finishing:"busy",paused:"off",gone:"off"},li={sign_in_again:"sign-in-again",resume:"resume",review_access:"review",fix_key:"fix-key",connect_new:"connect-again"};function di(s,n){var o;const{readiness:t}=s,a=ri(s),i=ci[t.state],r=(o=t.fix)==null?void 0:o.action,c=t.state==="gone"||!r?null:li[r]??null;return{id:s.connectionId,kind:"account",name:Fe(s.toolkit,n),iconKey:s.toolkit,toolkit:s.toolkit,...Nn(s.toolkit,n),...a,waiting:0,tone:i,action:c,detail:t.state==="ready"?`${a.account} · ${s.everyAgent?"Every agent":ii(s.agentCount)}`:i==="broken"?t.copy.owner:`${a.account} · ${t.copy.owner}`}}function ui(s,n){if(n.label)return n.label;const t=n.status.displayName;return t&&t!==s.manifest.displayName?t:null}function mi(s,n,t){const a=s.manifest,i=ui(s,n),r={id:n.id,kind:"chat",name:a.displayName,iconKey:a.iconId??a.type,account:i,identity:null,waiting:t.waitingByChatApp[n.id]??0,deprecated:a.deprecated===!0},c=u=>i?`${i} · ${u}`:u;if(!n.enabled)return{...r,tone:"off",action:"resume",detail:"Paused · no messages in or out"};if(n.confirmation)return{...r,tone:"attention",action:"review",detailTone:"warning",detail:i?`Paused · ${i}`:"Paused · confirm the setting it sends"};if(n.status.state==="error"||n.status.state==="disconnected")return{...r,tone:"broken",action:"fix",detail:"Stopped working. Messages aren’t getting through."};if(n.status.state!=="connected")return{...r,tone:"busy",action:null,detail:c("Connecting…")};const o=[...new Set(t.bindings.filter(u=>u.adapterId===n.id).map(u=>t.agentNames[u.agentId]??u.agentId))];if(o.length===0)return{...r,tone:"attention",action:null,detail:c("No agent answers yet")};const h=o.length===1?"answers":"answer";return{...r,tone:"ready",action:null,detail:c(`${oi(o)} ${h}`)}}const ks={broken:1,attention:2,busy:3,ready:3,off:4};function hi(s){return s.manifest.category==="internal"}function pi(s){const n=s.connections.map(c=>di(c,s.services));for(const c of s.chatApps)if(!hi(c))for(const o of c.instances)n.push(mi(c,o,s));const t=n.map((c,o)=>({row:c,index:o})).sort((c,o)=>ks[c.row.tone]-ks[o.row.tone]||c.row.name.localeCompare(o.row.name)||c.index-o.index).map(({row:c})=>c),a=s.pendingSignIn;if(!a)return t;const i=s.services.get(a.toolkit),r=(i==null?void 0:i.displayName)??Bs(a.toolkit);return[{id:a.flowId,kind:"connecting",name:r,iconKey:a.toolkit,...Nn(a.toolkit,s.services),account:null,identity:null,detail:`Finish signing in on ${(i==null?void 0:i.signInName)??r}…`,tone:"busy",action:"cancel",waiting:0},...t]}function rs(s){const n=s.intents.find(t=>t.kind==="messages");return{account:s.intents.some(t=>t.kind==="account"),chatType:(n==null?void 0:n.kind)==="messages"?n.relayAdapterType:null}}function gi(s,n){return{accounts:new Set(s.filter(t=>t.lifecycle!=="disconnected").map(t=>t.toolkit)),chatApps:new Set(n.filter(t=>t.instances.length>0).map(t=>t.manifest.type))}}function bn(s,n){const t=rs(s);return{account:t.account&&!n.accounts.has(s.serviceSlug),chatType:t.chatType&&!n.chatApps.has(t.chatType)?t.chatType:null}}const kn={popular:"Popular",email:"Email",calendar:"Calendar",chat:"Chat",docs:"Docs",files:"Files",code:"Code",tasks:"Tasks",sales:"Sales",all:"All"};function xi(s){const n=new Set(s.map(a=>a.category));return["popular",...Object.keys(kn).filter(a=>a!=="popular"&&a!=="all"&&n.has(a)),"all"]}function fi(s,n){const t=s.filter(a=>a.category!=="developer");return n==="all"?t:n==="popular"?t.filter(a=>a.popular):t.filter(a=>a.category===n)}function ji(s,n){const t=n.trim().toLowerCase();return t===""?!0:`${s.name} ${s.detail}`.toLowerCase().includes(t)}const Cs={"sign-in-again":"Sign in again",resume:"Resume",cancel:"Cancel",review:"Review",fix:"Fix","fix-key":"Fix the key","connect-again":"Connect again"};function ws({className:s}){return e.jsx(G,{size:"xs",variant:"secondary",className:L("shrink-0",s),children:"Chat"})}function Cn({name:s,iconKey:n,logo:t,detail:a,chat:i,deprecated:r=!1,wrapDetail:c=!1,detailClassName:o}){return e.jsxs(e.Fragment,{children:[e.jsx(qs,{iconKey:n,displayName:s,logo:t}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),i&&e.jsx(ws,{className:"max-sm:hidden"}),r&&e.jsx(G,{size:"xs",variant:"outline",tone:"warning",className:"shrink-0",children:"Deprecated"})]}),e.jsxs("span",{className:"flex items-start gap-1.5",children:[i&&e.jsx(ws,{className:"mt-px sm:hidden"}),e.jsx("span",{className:L("text-muted-foreground block min-w-0 text-xs",c?"line-clamp-2":"truncate",o),children:a})]})]})]})}function yi({row:s,onOpen:n,onAction:t,actionPending:a=!1}){const i=s.tone==="off";return e.jsxs("li",{"data-testid":`app-row-${s.id}`,"data-tone":s.tone,className:L("group/row flex items-center rounded-lg transition-colors",s.tone==="broken"?"bg-status-warning-bg/70 hover:bg-status-warning-bg":"hover:bg-muted/50"),children:[e.jsxs("button",{type:"button",onClick:()=>n(s),className:"focus-ring flex min-h-14 min-w-0 flex-1 items-center gap-3 rounded-lg px-3 py-2 text-left",children:[e.jsx("span",{className:L("flex min-w-0 flex-1 items-center gap-3",i&&"opacity-55"),children:e.jsx(Cn,{name:s.name,iconKey:s.iconKey,logo:s.logo,detail:s.detail,chat:s.kind==="chat",deprecated:s.deprecated,wrapDetail:s.tone==="broken"||s.detailTone==="warning",detailClassName:s.tone==="broken"||s.detailTone==="warning"?"text-status-warning-fg":void 0})}),!s.action&&e.jsx(vi,{row:s})]}),s.action&&e.jsx("div",{className:"flex shrink-0 items-center pr-3",children:e.jsxs(y,{size:"sm",variant:s.tone==="broken"?"default":"outline",disabled:a,onClick:()=>t(s),"aria-label":`${Cs[s.action]}: ${s.name}`,children:[a&&e.jsx(me,{size:"xs"}),Cs[s.action]]})})]})}function vi({row:s}){return s.waiting>0?e.jsxs(G,{shape:"pill",tone:"warning",variant:"outline",className:"shrink-0",children:[s.waiting," waiting"]}):s.tone==="busy"?e.jsx(me,{size:"xs",className:"text-muted-foreground shrink-0"}):s.tone==="ready"?e.jsxs("span",{className:"flex shrink-0 items-center",children:[e.jsx("span",{className:L("size-2 rounded-full",Us.success),"aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:"Connected"})]}):e.jsx(he,{className:"text-muted-foreground size-4 shrink-0 opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100","aria-hidden":!0})}function Ni({service:s,chat:n,actionLabel:t,onConnect:a,unavailableLabel:i}){const r=s.description??bi(s),c=e.jsx(Cn,{name:s.displayName,iconKey:s.iconKey,logo:is(s),detail:r,chat:n,wrapDetail:!0});return a?e.jsx("li",{"data-testid":`catalog-app-${s.serviceSlug}`,children:e.jsxs("button",{type:"button",onClick:()=>a(s),"aria-label":`${t} ${s.displayName}`,className:"group/row hover:bg-muted/50 focus-ring flex min-h-14 w-full items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",children:[c,e.jsx("span",{"aria-hidden":!0,className:"border-border bg-background group-hover/row:bg-muted shrink-0 rounded-md border px-3 py-1.5 text-xs font-medium shadow-xs transition-colors",children:t})]})}):e.jsxs("li",{"data-testid":`catalog-app-${s.serviceSlug}`,className:"flex min-h-14 items-center gap-3 px-3 py-2",children:[e.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-3 opacity-55",children:c}),e.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:i})]})}function bi(s){const n=s.intents.some(a=>a.kind==="messages"),t=s.intents.some(a=>a.kind==="account");return n&&t?`Talk to your agents in ${s.displayName}, or let them use it.`:n?`Talk to your agents in ${s.displayName}.`:`Let agents use your ${s.displayName} account.`}function ki({query:s,onQueryChange:n,data:t,onOpenRow:a,onRowAction:i,pendingRowId:r=null,onConnect:c}){var $,Y,A,T;const[o,h]=f.useState("popular"),u=s.trim()!=="",{catalog:l,relay:g}=t,m=g.enabled,d=t.available.filter(S=>S.category!=="developer"),p=t.available.filter(S=>S.category==="developer"),v=xi(d),N=v.includes(o)?o:"popular",k=u?d:fi(d,N),b=(($=l.data)==null?void 0:$.pages.flatMap(S=>S.warnings))??[],j=(T=(A=(Y=l.data)==null?void 0:Y.pages[0])==null?void 0:A.appConnections)==null?void 0:T.newApps,x=u&&!l.isPending&&t.yours.length===0&&t.available.length===0,w=(S,_)=>{const F=rs(S),I=F.chatType!==null&&!F.account&&!m;return e.jsx(Ni,{service:S,chat:F.chatType!==null,actionLabel:_,onConnect:I?void 0:c,unavailableLabel:"Turned off"},S.serviceSlug)};return e.jsxs("div",{className:"space-y-8","data-testid":Mn.relayIntegrations,children:[e.jsxs("div",{className:"relative",children:[e.jsx(Bn,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),e.jsx(J,{type:"search",value:s,onChange:S=>n(S.target.value),className:"pl-9","aria-label":"Search apps",placeholder:"Search apps","data-testid":"app-search"})]}),t.yoursLoading?e.jsxs("div",{className:"space-y-2","aria-label":"Loading your apps",children:[e.jsx(P,{className:"h-14 rounded-lg"}),e.jsx(P,{className:"h-14 rounded-lg"})]}):t.yoursError?e.jsx(K,{title:"Couldn’t load your apps",description:"Nothing changed. Try again.",onRetry:t.retryYours}):t.yours.length>0&&e.jsxs("section",{"aria-labelledby":"connections-yours",className:"space-y-2",children:[e.jsx("h2",{id:"connections-yours",className:"text-sm font-semibold",children:"Yours"}),e.jsx("ul",{className:"-mx-3 space-y-0.5","data-testid":"yours-list",children:t.yours.map(S=>e.jsx(yi,{row:S,onOpen:a,onAction:i,actionPending:r===S.id},S.id))})]}),x?e.jsxs("div",{className:"bg-muted/40 rounded-xl p-6 text-center",children:[e.jsxs("p",{className:"text-sm font-medium",children:["No app matches “",s.trim(),"”"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:wi(j)})]}):e.jsxs("section",{"aria-labelledby":"connections-all-apps",className:"space-y-3",children:[e.jsx("h2",{id:"connections-all-apps",className:"text-sm font-semibold",children:u?"Apps":"All apps"}),!u&&v.length>2&&e.jsx("div",{role:"group","aria-label":"Show apps by kind",className:"-mx-4 flex scrollbar-none gap-1.5 overflow-x-auto px-4 sm:mx-0 sm:flex-wrap sm:px-0",children:v.map(S=>e.jsx("button",{type:"button","aria-pressed":S===N,onClick:()=>h(S),className:L("focus-ring shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors",S===N?"bg-foreground text-background":"bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground"),children:kn[S]},S))}),l.isPending?e.jsxs("div",{className:"space-y-2","aria-label":"Loading apps",children:[e.jsx(P,{className:"h-14 rounded-lg"}),e.jsx(P,{className:"h-14 rounded-lg"}),e.jsx(P,{className:"h-14 rounded-lg"})]}):l.isError?e.jsx(K,{title:"Couldn’t load the app list",description:"Your apps are unchanged. Try again.",onRetry:()=>void l.refetch(),isRetrying:l.isFetching}):e.jsxs(e.Fragment,{children:[k.length>0&&e.jsx("ul",{className:"-mx-3 space-y-0.5","data-testid":"all-apps-list",children:k.map(S=>w(S,"Connect"))}),(u||N==="all")&&l.hasNextPage&&e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>void l.fetchNextPage(),disabled:l.isFetchingNextPage,children:l.isFetchingNextPage?"Loading…":"Show more apps"})]}),e.jsx(Ci,{data:t}),b.map(S=>e.jsx("p",{className:"text-muted-foreground text-xs",children:S.message},`${S.code}-${S.message}`))]}),p.length>0&&!l.isPending&&e.jsxs("section",{"aria-labelledby":"connections-developers",className:"space-y-2",children:[e.jsx("h2",{id:"connections-developers",className:"text-muted-foreground text-xs font-semibold",children:"For developers"}),e.jsx("ul",{className:"-mx-3 space-y-0.5",children:p.map(S=>w(S,"Set up"))})]})]})}function Ci({data:s}){const{relay:n}=s;return s.chatAppsError?e.jsxs("p",{className:"text-muted-foreground flex flex-wrap items-center gap-x-2 text-xs",children:["Couldn’t load your chat apps.",e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:s.retryChatApps,children:"Try again"})]}):n.isError?e.jsxs("p",{className:"text-muted-foreground flex flex-wrap items-center gap-x-2 text-xs",children:["Couldn’t check chat apps.",e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:n.retry,disabled:n.isRetrying,children:n.isRetrying?"Checking…":"Try again"})]}):e.jsx(ba,{relay:n,variant:"line"})}function wi(s){if((s==null?void 0:s.status)!=="setup_needed")return"Try another name.";switch(s.reason){case"nothing_set_up":return"Only popular apps show until you connect one. Then search finds every app.";case"own_key_unavailable":return"Only popular apps show while your saved key isn’t working.";case"dorkos_account_unavailable":return"Only popular apps show while your DorkOS account can’t connect apps.";case"dorkos_account_unlinked":return"Only popular apps show while your DorkOS account isn’t linked."}}function Si(s,n){const t=s.trim()!=="",a=on(),i=Ee(""),r=Ee(s,t),c=Ws(),o=Hs(c.enabled),{data:h}=De(),{data:u}=pn("pending",c.enabled),{data:l}=ae(),g=f.useMemo(()=>{var j;return new Map((((j=i.data)==null?void 0:j.pages.flatMap(x=>x.services))??[]).map(x=>[x.serviceSlug,x]))},[i.data]),m=f.useMemo(()=>Object.fromEntries(((l==null?void 0:l.agents)??[]).map(j=>[j.id,le(j)])),[l]),d=f.useMemo(()=>c.enabled?o.data??[]:[],[c.enabled,o.data]),p=f.useMemo(()=>{var j;return((j=a.data)==null?void 0:j.connections)??[]},[a.data]),v=f.useMemo(()=>{const j={};for(const x of u??[])j[x.adapterId]=(j[x.adapterId]??0)+1;return pi({connections:p,chatApps:d,bindings:h??[],waitingByChatApp:j,agentNames:m,services:g,pendingSignIn:n})},[p,d,h,u,m,g,n]),N=t?r:i,k=f.useMemo(()=>gi(p,d),[p,d]),b=f.useMemo(()=>{var j;return(((j=N.data)==null?void 0:j.pages.flatMap(x=>x.services))??[]).filter(x=>{const w=bn(x,k);return w.account||w.chatType!==null})},[N.data,k]);return{yours:v.filter(j=>ji(j,s)),allYours:v,chatApps:d,owned:k,available:b,services:g,agentNames:m,yoursLoading:a.isPending||c.isLoading||c.enabled&&o.isPending,yoursError:a.isError,yoursRefreshing:a.isFetching,retryYours:()=>void a.refetch(),catalog:N,relay:c,chatAppsError:c.enabled&&o.isError,retryChatApps:()=>void o.refetch()}}function wn(s){switch(s&&typeof s=="object"&&"code"in s?s.code:void 0){case"connection_cleanup_pending":return"DorkOS is still removing this app’s earlier access. Try again in a few minutes.";case"connection_not_disconnected":return"Disconnect this app before removing it.";case"connection_not_found":return"This app is no longer connected. Pick it again from the list.";case"provider_not_found":case"authentication_unavailable":return"Sign-in isn’t available for this app. Check Settings › Connections, then try again.";case"idempotency_conflict":return"This sign-in was already used. Start again.";default:return"Couldn’t confirm that change. Check the app before trying again."}}const Ai={gmail:["Summarise today’s Gmail inbox","Which of my Gmail emails need a reply?"],outlook:["Summarise today’s Outlook inbox","Which of my Outlook emails need a reply?"],googlecalendar:["What’s on my Google Calendar today?","Find a free hour on my Google Calendar this week"],slack:["Summarise what I missed in Slack today","Which Slack messages mention me?"],notion:["What changed in my Notion this week?","Summarise my most recent Notion page"],googledocs:["Summarise my most recent Google Doc"],googlesheets:["What’s in my most recent Google Sheet?"],airtable:["List my Airtable bases and what each one tracks"],googledrive:["Which Google Drive files did I change this week?"],dropbox:["Which Dropbox files did I add this week?"],github:["Which GitHub pull requests need my review?","Summarise my open GitHub issues"],linear:["Which Linear issues are assigned to me?","What changed in my Linear issues today?"],jira:["Which Jira issues are assigned to me?"],asana:["Which Asana tasks are due this week?"],todoist:["What’s on my Todoist list today?"],hubspot:["Which HubSpot deals changed this week?"]};function Ii(s){return Ai[s]??[]}const Ri={gmail:"When a new email arrives…",outlook:"When a new email arrives…",googlecalendar:"When an event changes…",slack:"When a new message arrives…",github:"When something changes on GitHub…",linear:"When an issue changes…",jira:"When an issue changes…"};function Ti(s,n){return Ri[s]??`When something new happens in ${n}…`}function $i(s,n){if(s.agentId&&n[s.agentId])return n[s.agentId];switch(s.actorKind){case"operator":return"You";case"program":return"A program";case"event":return"A notification";default:return"An agent"}}function Ei(s,n,t){const a=`${$i(s,t)} · ${Ue(s.operationSlug,n)}`;return s.outcome===void 0?s.completedAt?a:`${a} (in progress)`:s.outcome==="success"?a:s.outcome==="outcome_unknown"?`${a} (result unknown)`:`${a} (didn’t finish)`}function _i(s,n=new Date){const t=new Date(s);if(t.getTime()<=n.getTime())return"Trying again now.";const a=t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return t.toDateString()===n.toDateString()?`Trying again at ${a}.`:`Trying again ${t.toLocaleDateString([],{weekday:"long"})} at ${a}.`}function Pi(s){const n=s.replaceAll(/([a-z0-9])([A-Z])/gu,"$1 $2").replaceAll(/[_-]+/gu," ").trim().toLowerCase();return n?`${n.charAt(0).toUpperCase()}${n.slice(1)}`:s}function Sn(s){return typeof s=="boolean"?s?"yes":"no":typeof s=="string"||typeof s=="number"?String(s):Array.isArray(s)&&s.every(n=>typeof n!="object"||n===null)?s.map(n=>Sn(n)).join(", "):"a custom value"}function Oi(s,n=null){const t=Object.entries(s).filter(([,a])=>a!==""&&a!==void 0&&a!==null).map(([a,i])=>{var c;return`${((c=n==null?void 0:n.find(o=>o.name===a))==null?void 0:c.label)??Pi(a)} is ${Sn(i)}`});return t.length>0?`Only when ${t.join(" and ")}`:null}function An(s,n,t){const a=h=>({text:h,tone:"plain",checkInChat:!1}),i=(h,u=!1)=>({text:h,tone:"problem",checkInChat:u});switch(s.state){case"pending":return a("Setting up. DorkOS keeps trying on its own.");case"unavailable":return i("Paused because this account can’t be used. Fix it above to restart.");case"revoked":return i("Stopped for good. Remove it and set it up again.")}const r=s.lastDelivery;if(!r)return a(t);const c=Ve(r.receivedAt);switch(r.outcome){case"delivered":return a(`Last one delivered · ${c}`);case"sending":return a(`Newest one on its way · ${c}`);case"retrying":return a(`Newest one hasn’t reached ${n} yet. DorkOS is trying again.`)}const o=s.destination.kind==="agent";switch(r.problem){case"unknown_outcome":return i(o?`DorkOS can’t tell if ${n} got the newest one (${c}). Open the chat to check.`:`DorkOS can’t tell if the newest one reached ${n} (${c}). Check there.`,o);case"refused":return i(`${n} turned away the newest one (${c}). Check this agent can still post there.`);case"changed":return i(`Newest one (${c}) held back because this notification changed. Nothing to do.`);case"cancelled":return i(`Newest one (${c}) cancelled before ${n} read it. Nothing to do.`);case"expired":return i(`Newest one (${c}) expired and wasn’t sent. If it repeats, remove it and add it again.`);case"unreachable":case null:return i(`Newest one (${c}) didn’t reach ${n}. If it repeats, remove it and add it again.`)}}function Li(s){const n=s.filter(t=>An(t,"","").tone==="problem").length;if(n!==0)return n===1?"1 notification needs a look":`${n} notifications need a look`}function zi(s,n){const t=s.find(i=>i.id===n);return t?s.some(i=>i.id!==t.id&&i.displayName===t.displayName)&&t.handle?`${t.displayName} (@${t.handle})`:t.displayName:"an agent that’s no longer here"}function Di(s){const n=s==null?void 0:s.code,t=s==null?void 0:s.status;return n==="invalid_filter"?"Check the filter values, then try again.":n==="destination_unavailable"?"That place can’t take notifications now. Pick another.":t===409?"Something changed while you were choosing. Check your choices, then try again.":"Couldn’t finish setting this up. Try again."}function Fi({subscription:s,agents:n,definition:t,channelLabel:a,removing:i,onRemove:r}){var k,b,j;const c=Gs(),o=Wn(s.agentId,{enabled:s.destination.kind==="room"}),h=zi(n,s.agentId),u=(k=o.data)==null?void 0:k.rooms.find(x=>x.id===s.destination.id);let l=h,g=`Goes to ${h}, all in one chat`;s.destination.kind==="room"?(l=u?u.slug?`#${u.slug}`:u.name:"a room this agent left",g=`Goes to ${l}, for ${h}`):s.destination.kind==="channel"&&(l=a??"a chat that’s no longer set up",g=`Goes to ${l}, for ${h}`);const m=Oi(s.filter,t?Hn(t.filterSchema):null),d=An(s,l,ia(s)),p=(j=(b=n.find(x=>x.id===s.agentId))==null?void 0:b.agent)==null?void 0:j.projectPath,v=s.chatSessionId,N=m?`${g}. ${m}`:g;return e.jsxs("li",{className:"bg-muted/40 flex min-h-11 items-start justify-between gap-2 rounded-lg px-3 py-2","data-state":s.state,children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium break-words",children:s.displayName}),e.jsx("p",{className:"text-muted-foreground text-xs break-words",children:g}),m&&e.jsx("p",{className:"text-muted-foreground text-xs break-words",children:m}),e.jsx("p",{className:L("text-xs break-words",d.tone==="problem"?"text-destructive":"text-muted-foreground"),"data-testid":"notification-status",children:d.text})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[v&&c&&e.jsxs(y,{type:"button",size:"sm",variant:d.checkInChat?"secondary":"ghost",className:"gap-1.5","aria-label":`Open the chat for ${s.displayName}: ${N}`,onClick:()=>void c(Ys({session:v,...p&&{dir:p}})),children:[e.jsx(Kn,{className:"size-3.5","aria-hidden":!0}),e.jsx("span",{className:"max-sm:sr-only",children:"Open chat"})]}),e.jsx(y,{type:"button",size:"icon-sm",variant:"ghost","aria-label":`Remove ${s.displayName}: ${N}`,"aria-busy":i,disabled:i,onClick:r,children:i?e.jsx(me,{size:"sm"}):e.jsx(Gn,{className:"size-4"})})]})]})}function Mi({connectionId:s}){return e.jsx(Bi,{connectionId:s},s)}function Bi({connectionId:s}){var S,_,F,W;const n=Jt(s),t=n.data!==void 0&&n.data.setupMode!=="unavailable",a=Zt(s,t),i=un(s),r=qn(),c=De(),o=Xt(),h=ea(),[u,l]=f.useState(()=>ys()),[g,m]=f.useState(!1),[d,p]=f.useState(()=>new Set),v=I=>{p(z=>new Set(z).add(I)),h.mutate({connectionId:s,subscriptionId:I},{onSettled:()=>p(z=>{const O=new Set(z);return O.delete(I),O})})},N=f.useRef(null),k=((S=a.data)==null?void 0:S.pages.flatMap(I=>I.definitions))??[],b=((_=i.data)==null?void 0:_.pages.flatMap(I=>I.subscriptions))??[],j=(((F=r.data)==null?void 0:F.members)??[]).filter(I=>I.kind==="agent"),x=sa({connectionId:s,definitions:k,draft:u}),w=n.data?na(n.data):!1,$=!!(x&&w),Y=()=>{N.current=null,o.reset()},A=I=>{l(I),Y()},T=()=>{if(!x)return;const I={definitionId:x.definitionId,filter:x.filter,agentId:x.agentId,destination:x.destination,manageExistingTrigger:g},z=JSON.stringify({connectionId:s,decision:I}),O=N.current,M=(O==null?void 0:O.signature)===z?O.requestId:crypto.randomUUID();N.current={signature:z,requestId:M},o.mutate({connectionId:s,input:{...I,requestId:M}},{onSuccess:()=>{N.current=null,l(ys()),m(!1)}})};return e.jsxs("section",{"aria-labelledby":"connection-notifications",className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h3",{id:"connection-notifications",className:"flex items-center gap-2 text-sm font-semibold",children:[e.jsx(Un,{className:"size-4","aria-hidden":"true"}),"Tell an agent"]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Send new activity to an agent, a room or a chat app."})]}),n.isPending?e.jsx(P,{className:"h-20 rounded-lg","aria-label":"Loading delivery setup"}):n.isError?e.jsx(K,{title:"Couldn’t check notifications for this account",description:"Try again before adding one.",onRetry:()=>void n.refetch(),isRetrying:n.isFetching}):n.data?e.jsx(ta,{connectionId:s,status:n.data}):null,i.isPending?e.jsx(P,{className:"h-20 rounded-lg","aria-label":"Loading notifications"}):i.isError?e.jsx(K,{title:"Couldn’t load notifications",description:"Try again. Nothing was changed.",onRetry:()=>void i.refetch(),isRetrying:i.isFetching}):b.length===0?t&&e.jsx("p",{className:"bg-muted/40 rounded-lg p-3 text-sm",children:"No notifications set up."}):e.jsxs("div",{className:"space-y-2","data-testid":"connection-notification-list",children:[e.jsx("ul",{className:"space-y-1.5",children:b.map(I=>{var O;const z=(O=c.data)==null?void 0:O.find(M=>M.id===I.destination.id);return e.jsx(Fi,{subscription:I,agents:j,definition:k.find(M=>M.id===I.definitionId),channelLabel:z?z.label||"a chat app":void 0,removing:d.has(I.id),onRemove:()=>v(I.id)},I.id)})}),i.hasNextPage&&e.jsx(y,{type:"button",size:"sm",variant:"ghost",disabled:i.isFetchingNextPage,onClick:()=>void i.fetchNextPage(),children:i.isFetchingNextPage?"Loading…":"Load more notifications"})]}),o.data&&!b.some(I=>I.id===o.data.id)&&e.jsx("p",{className:"bg-muted/40 rounded-lg p-3 text-sm",role:"status",children:o.data.state==="pending"?`${o.data.displayName} is being set up. DorkOS keeps trying.`:`${o.data.displayName} is on.`}),h.isError&&e.jsx("p",{role:"alert",className:"border-destructive/30 bg-destructive/10 text-foreground rounded-md border p-3 text-sm",children:"Couldn’t confirm the removal. Check the list."}),t&&e.jsxs("div",{className:"space-y-3 rounded-lg border p-3","data-testid":"notification-setup",children:[e.jsx("p",{className:"text-sm font-medium",children:"Add a notification"}),a.isPending?e.jsx(P,{className:"h-20 rounded-md","aria-label":"Loading available notifications"}):a.isError?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:"Notifications aren’t available right now."}),e.jsx(y,{type:"button",variant:"link",size:"xs",className:"h-auto p-0",disabled:a.isFetching,onClick:()=>void a.refetch(),children:a.isFetching?"Checking…":"Check again"})]}):k.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This app offers no notifications yet."}):r.isPending?e.jsx(P,{className:"h-20 rounded-md","aria-label":"Loading agents"}):r.isError?e.jsx(K,{title:"Couldn’t load agents",description:"Try again before choosing who gets this.",onRetry:()=>void r.refetch(),isRetrying:r.isFetching}):j.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Notifications go to an agent. Add one first."}):e.jsxs(e.Fragment,{children:[e.jsx(aa,{idPrefix:"notification",definitions:k,draft:u,onChange:A,agents:j,sourceStatus:n.data}),((W=n.data)==null?void 0:W.setupMode)==="byo_webhook"&&e.jsxs("div",{className:"flex min-h-11 items-center gap-2",children:[e.jsx(Ks,{id:"notification-manage-existing",checked:g,onCheckedChange:I=>{m(I===!0),Y()}}),e.jsx("label",{htmlFor:"notification-manage-existing",className:"text-sm",children:"Take over a matching one already in Composio"})]}),o.isError&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Di(o.error)}),e.jsx(y,{type:"button",size:"sm",disabled:!$||o.isPending,onClick:T,children:o.isPending?"Saving…":"Set up notification"})]}),a.hasNextPage&&e.jsx(y,{type:"button",size:"sm",variant:"ghost",disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:a.isFetchingNextPage?"Loading…":"Load more activity"})]})]})}function _e({title:s,description:n,action:t,children:a,testId:i}){const r=`panel-section-${s.toLowerCase().replaceAll(/\s+/gu,"-")}`;return e.jsxs("section",{"aria-labelledby":r,className:"space-y-2.5","data-testid":i,children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{id:r,className:"text-sm font-semibold",children:s}),n&&e.jsx("p",{className:"text-muted-foreground text-xs",children:n})]}),t]}),a]})}function Pe({message:s,detail:n,action:t,onAction:a,pending:i=!1,secondary:r,technicalDetail:c,actionHint:o,icon:h=Qe}){const u=f.useId();return e.jsxs("div",{role:"status","data-testid":"app-panel-fix",className:"bg-status-warning-bg flex flex-col gap-3 rounded-xl p-3.5",children:[e.jsxs("p",{className:"text-status-warning-fg flex items-start gap-2 text-sm",children:[e.jsx(h,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:[s,n&&e.jsx("span",{className:"mt-1 block",children:n})]})]}),(t&&a||r)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t&&a&&e.jsxs(y,{size:"sm",onClick:a,disabled:i,"aria-describedby":o?u:void 0,className:"h-auto min-h-8 max-w-full whitespace-normal max-md:min-h-11",children:[i&&e.jsx(me,{size:"xs"}),t]}),r]}),o&&e.jsx("p",{id:u,className:"text-status-warning-fg text-xs",children:o}),c&&e.jsxs(Re,{children:[e.jsxs(Te,{className:"group/details text-status-warning-fg hover:text-status-warning-fg focus-ring flex items-center gap-1 rounded text-xs",children:[e.jsx(Yn,{className:"size-3 -rotate-90 transition-transform group-data-[state=open]/details:rotate-0","aria-hidden":!0}),"Details"]}),e.jsx($e,{children:e.jsx("pre",{className:"bg-muted/50 mt-1 max-h-40 overflow-auto rounded p-2 text-xs whitespace-pre-wrap",children:c})})]})]})}function q({label:s,hint:n,destructive:t=!1,className:a,ref:i,...r}){return e.jsxs("button",{ref:i,type:"button",className:L("group/more-row hover:bg-muted/50 focus-ring flex min-h-10 w-full items-center gap-3 rounded-lg px-2 py-2 text-left transition-colors disabled:opacity-50",a),...r,children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:L("block text-sm",t&&"text-destructive"),children:s}),n&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:n})]}),e.jsx(he,{className:"text-muted-foreground size-4 shrink-0 transition-transform group-data-[state=open]/more-row:rotate-90","aria-hidden":!0})]})}function qi({detail:s,appName:n,onEditExactActions:t,onSignInAgain:a,signingIn:i,onAddAnother:r,onClose:c}){var b;const{connection:o,provider:h}=s,u=gn({payer:o.payer,custody:h.custody}),l=o.connectionId,g=rn(),m=as(),d=Ta(),p=un(l,o.lifecycle!=="disconnected"),[v,N]=f.useState(!1),k=o.lifecycle==="disconnected";return e.jsxs(Re,{children:[e.jsxs(Te,{className:"group/more text-muted-foreground hover:text-foreground focus-ring flex w-full items-center justify-between rounded-md py-1 text-sm font-semibold",children:["More",e.jsx(he,{className:"size-4 transition-transform group-data-[state=open]/more:rotate-90","aria-hidden":!0})]}),e.jsxs($e,{className:"-mx-2 space-y-1 pt-2","data-testid":"app-panel-more",children:[!k&&e.jsx(Ui,{detail:s}),!k&&e.jsxs(Re,{children:[e.jsx(Te,{asChild:!0,children:e.jsx(q,{label:Ti(o.toolkit,n),hint:Li(((b=p.data)==null?void 0:b.pages.flatMap(j=>j.subscriptions))??[])})}),e.jsx($e,{className:"px-2 pt-2 pb-3",children:e.jsx(Mi,{connectionId:l})})]}),o.everyAgent&&e.jsx(q,{label:"Stop sharing with every agent",hint:"Agents picked by name keep access",disabled:d.isPending,onClick:()=>d.mutate({connectionId:l})}),d.isError&&e.jsx("p",{role:"alert",className:"text-destructive px-2 text-xs",children:"Couldn’t stop sharing. Try again."}),!k&&e.jsx(q,{label:"Exact actions per agent",onClick:()=>t(l)}),o.lifecycle==="connected"&&e.jsx(q,{label:"Pause",hint:"Agents stop until you resume",disabled:g.isPending,onClick:()=>g.mutate({connectionId:l,input:void 0})}),o.lifecycle==="paused"&&e.jsx(q,{label:"Resume",disabled:m.isPending,onClick:()=>m.mutate({connectionId:l,input:void 0})}),!k&&e.jsx(q,{label:"Sign in again",hint:"Who can use it stays the same",disabled:i,onClick:a}),e.jsx(q,{label:`Connect another ${n} account`,onClick:()=>r(o.toolkit)}),e.jsxs("div",{className:"px-2 py-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"How it’s connected"}),e.jsxs("p",{className:"text-muted-foreground mt-0.5 text-xs leading-relaxed",children:[h.displayName,". ",h.disclosure]}),u&&e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:u})]}),!k&&e.jsx(q,{label:"Disconnect…",destructive:!0,onClick:()=>N(!0)})]}),e.jsx(Wi,{detail:s,appName:n,open:v,onOpenChange:N,onDisconnected:c})]})}function Ui({detail:s}){const n=Ut(),[t,a]=f.useState(s.connection.label),i=`connection-name-${s.connection.connectionId}`,r=t.trim()===""||t.trim()===s.connection.label;return e.jsxs("form",{className:"flex items-end gap-2 px-2 py-2",onSubmit:c=>{c.preventDefault(),!r&&n.mutate({connectionId:s.connection.connectionId,input:{label:t.trim()}})},children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx(Z,{htmlFor:i,children:"Name"}),e.jsx(J,{id:i,value:t,onChange:c=>a(c.target.value)})]}),e.jsx(y,{type:"submit",variant:"secondary",disabled:r||n.isPending,children:n.isPending?"Saving…":"Save"})]})}function Wi({detail:s,appName:n,open:t,onOpenChange:a,onDisconnected:i}){const r=s.connection.connectionId,c=Wt(r,t),o=cn(),h=s.agents.map(u=>u.displayName);return e.jsx(xe,{open:t,onOpenChange:a,children:e.jsxs(fe,{children:[e.jsxs(je,{children:[e.jsxs(ye,{children:["Disconnect ",n,"?"]}),e.jsx(ve,{children:c.isPending?"Checking who will lose access…":c.data?Hi(h,c.data):"Who loses access isn’t known yet."})]}),c.isError&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t check who loses access. Try again."}),e.jsxs(Ne,{children:[e.jsx(be,{children:"Keep connected"}),e.jsx(Le,{disabled:!c.data||o.isPending,variant:"destructive",onClick:u=>{u.preventDefault(),o.mutate({connectionId:r,input:void 0},{onSuccess:()=>{a(!1),i()}})},children:o.isPending?"Disconnecting…":"Disconnect"})]})]})})}function Hi(s,n){const t=[];return n.everyAgent?t.push("Every agent will lose access."):s.length>0?t.push(`${oa(s)} will lose access.`):n.affectedAgentCount>0?t.push(`${n.affectedAgentCount} ${n.affectedAgentCount===1?"agent":"agents"} will lose access.`):t.push("No agent uses it right now."),n.affectedSessionCount>0&&t.push(`${n.affectedSessionCount} open ${n.affectedSessionCount===1?"chat":"chats"} will stop using it.`),n.affectedSubscriptionCount>0&&t.push(`${n.affectedSubscriptionCount} ${n.affectedSubscriptionCount===1?"notification stops":"notifications stop"}.`),n.pendingDeliveryCount>0&&t.push(`${n.pendingDeliveryCount} waiting ${n.pendingDeliveryCount===1?"delivery":"deliveries"} won’t be sent.`),t.join(" ")}const Ss=3;function Ki(s){const n=Ht(s.connectionId);return n.isPending?e.jsxs("div",{className:"space-y-3","aria-label":"Loading app details",children:[e.jsx(P,{className:"h-28 rounded-lg"}),e.jsx(P,{className:"h-20 rounded-lg"})]}):n.isError?e.jsx(mn,{error:n.error,title:"Couldn’t load this app",description:"Nothing changed. Try again.",onRetry:()=>void n.refetch(),isRetrying:n.isFetching}):e.jsx(Gi,{...s,detail:n.data})}function Gi({connectionId:s,startWho:n,detail:t,onSignInStarted:a,onEditExactActions:i,onAddAnother:r,onClose:c}){var j;const{connection:o}=t,h=Ee(""),u=new Map((((j=h.data)==null?void 0:j.pages.flatMap(x=>x.services))??[]).map(x=>[x.serviceSlug,x])),l=Fe(o.toolkit,u),g=ln(),m=rn(),d=as(),p=cn(),v=Kt(),N=g.error??m.error??d.error??p.error??v.error,k=()=>g.mutate({connectionId:s},{onSuccess:x=>a(x.flowId)}),b=o.readiness.state==="gone";return e.jsxs("div",{className:"space-y-7",children:[e.jsx(Yi,{detail:t,appName:l,onSignInAgain:k,reconnecting:g.isPending,onResume:()=>d.mutate({connectionId:s,input:void 0}),resuming:d.isPending,onReview:()=>i(s),onConnectNew:()=>r(o.toolkit),onRemove:()=>v.mutate({connectionId:s,input:void 0},{onSuccess:()=>c()}),removing:v.isPending,onRetryDisconnect:()=>p.mutate({connectionId:s,input:void 0}),retryingDisconnect:p.isPending}),N&&e.jsx("p",{role:"alert",className:"text-destructive bg-destructive/5 rounded-lg p-3 text-sm",children:wn(N)}),!b&&e.jsx(hn,{mode:"page",variant:"embedded",connectionId:s,serviceName:l,startWho:n,onEditExactActions:i,appActions:{toolkit:o.toolkit,providerInstanceId:o.providerInstanceId}}),e.jsx(Vi,{detail:t}),o.readiness.state==="ready"&&e.jsx(Qi,{detail:t}),e.jsx(qi,{detail:t,onSignInAgain:k,signingIn:g.isPending,appName:l,onEditExactActions:i,onAddAnother:r,onClose:c})]})}function Yi({detail:s,appName:n,onSignInAgain:t,reconnecting:a,onResume:i,resuming:r,onReview:c,onConnectNew:o,onRemove:h,removing:u,onRetryDisconnect:l,retryingDisconnect:g}){const m=Je(),d=Gt(),[p,v]=f.useState(!1),{readiness:N}=s.connection;if(N.state==="ready")return null;const k=N.fix,b=k!=null&&k.retryAt?_i(k.retryAt):void 0,j=N.copy.owner,x=N.state==="gone",w=(()=>{switch(k==null?void 0:k.action){case"sign_in_again":return{action:"Sign in again",onAction:t,pending:a};case"connect_again":return{action:"Connect again",onAction:t,pending:a};case"connect_new":return{action:`Connect ${n} again`,onAction:o};case"resume":return{action:"Resume",onAction:i,pending:r};case"review_access":return{action:"Check who can use it",onAction:c};case"fix_key":return{action:"Fix the key",onAction:()=>m.open("connections","ways")};case"retry":return x?{action:"Try again now",onAction:l,pending:g}:{action:"Check again",onAction:()=>d.mutate(),pending:d.isPending};case"remove":return{action:"Remove from your apps",onAction:()=>v(!0),pending:u};case"wait":case"turn_on_for_this_chat":case void 0:return null}})(),$=N.serviceAccessPage;return e.jsxs(e.Fragment,{children:[e.jsx(Pe,{message:j,detail:b,...w??{},secondary:x&&e.jsxs(e.Fragment,{children:[$&&e.jsx(y,{asChild:!0,size:"sm",variant:"ghost",className:"h-auto min-h-8 max-w-full whitespace-normal","data-testid":"service-access-page",children:e.jsxs(Ze,{href:$.url,children:["Open ",$.service," settings",e.jsx(Xe,{className:"size-3.5","aria-hidden":!0})]})}),(k==null?void 0:k.action)!=="remove"&&e.jsx(y,{size:"sm",variant:"ghost",className:"h-auto min-h-8 max-w-full whitespace-normal",onClick:()=>v(!0),disabled:u,"data-testid":"remove-account",children:"Remove from your apps"})]})}),x&&e.jsx(xe,{open:p,onOpenChange:v,children:e.jsxs(fe,{children:[e.jsxs(je,{children:[e.jsxs(ye,{children:["Remove ",n," from your apps?"]}),e.jsx(ve,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:"It leaves this list. Its activity history is kept."}),e.jsx("p",{children:"Connect it again later and you choose who can use it."}),N.reason==="disconnect_finishing"&&e.jsx("p",{children:"DorkOS still finishes removing its access at the service."})]})})]}),e.jsxs(Ne,{children:[e.jsx(be,{children:"Keep it"}),e.jsx(Le,{disabled:u,onClick:h,children:"Remove app"})]})]})})]})}function Vi({detail:s}){var l,g;const{connection:n}=s,t=Yt(n.connectionId),{data:a}=ae(),[i,r]=f.useState(!1),c=Object.fromEntries(s.agents.map(m=>[m.agentId,m.displayName]));for(const m of(a==null?void 0:a.agents)??[])c[l=m.id]??(c[l]=le(m));const o=((g=t.data)==null?void 0:g.items)??[],h=i?o:o.slice(0,Ss);let u;return n.usage.status==="unavailable"?u=e.jsx("p",{className:"text-muted-foreground text-sm",children:"Activity isn’t available right now."}):t.isPending?u=e.jsx(P,{className:"h-16 rounded-lg"}):t.isError?u=e.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:["Couldn’t load what agents did.",e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:()=>void t.refetch(),children:"Try again"})]}):o.length===0?u=e.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing yet."}):u=e.jsx("ul",{className:"space-y-1.5",children:h.map(m=>e.jsxs("li",{className:"flex items-baseline justify-between gap-3 text-sm",children:[e.jsx("span",{className:"min-w-0 truncate",children:Ei(m,n.toolkit,c)}),e.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:Ve(m.startedAt)})]},`${m.logicalOperationId}-${m.attemptIndex}`))}),e.jsx(_e,{title:"Recently",action:o.length>Ss&&e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:()=>r(m=>!m),children:i?"Show less":"See all"}),children:u})}function Qi({detail:s}){const n=Ii(s.connection.toolkit),{data:t}=ae(),{data:a}=Vn(),i=Gs();if(n.length===0)return null;const r=(a==null?void 0:a.agents)??[],c=l=>r.find(g=>g.id===l)??null,o=((t==null?void 0:t.agents)??[]).find(l=>l.isSystem),h=s.agents.map(l=>c(l.agentId)).find(l=>l!==null)??c(o==null?void 0:o.id),u=h?h.displayName??h.name:null;return e.jsx(_e,{title:"Try it",description:u?`Opens a chat with ${u}, ready to send.`:void 0,children:e.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(l=>e.jsxs(y,{variant:"outline",size:"sm",className:"h-auto min-h-8 justify-start py-1.5 text-left whitespace-normal",disabled:!h||!i,onClick:()=>h&&i&&void i(Ys({session:crypto.randomUUID(),agentId:h.id,draft:"1",prompt:l})),children:[e.jsx(Qn,{className:"text-muted-foreground size-3.5","aria-hidden":!0}),l]},l))})})}function Ji(s){return s.requesterKind==="program"?"A program":"Something using your sign-in"}function Q(s,n,t){const a=Fe(s,t);return n?`${a} (${n})`:a}function As(s){return s===1?"1 action":`${s} actions`}function Zi(s,n){const t=Ji(s),a=s.context;switch(a.kind){case"unavailable":return{title:`${t} asks to change a connection`,detail:"Open it to see the request."};case"connect":return{title:`${t} asks to connect ${Q(a.toolkit,a.label,n)}`,detail:"You sign in first. No agent gets it until you choose."};case"edit":return{title:`${t} asks to rename ${Q(a.connection.toolkit,a.connection.label,n)}`,detail:"Only its name changes."};case"pause":return{title:`${t} asks to pause ${Q(a.connection.toolkit,a.connection.label,n)}`,detail:"Agents can’t use it until you resume it."};case"resume":return{title:`${t} asks to resume ${Q(a.connection.toolkit,a.connection.label,n)}`,detail:"Agents it’s shared with get it back."};case"disconnect":return{title:`${t} asks to disconnect ${Q(a.connection.toolkit,a.connection.label,n)}`,detail:a.everyAgent?"Every agent loses access.":a.affectedAgentCount===0?"No agent uses it right now.":`${a.affectedAgentCount===1?"1 agent loses":`${a.affectedAgentCount} agents lose`} access.`};case"set_agent_access":return{title:`${t} asks to let ${a.agent.displayName} use ${Q(a.connection.toolkit,a.connection.label,n)}`,detail:`${As(a.requestedOperations.length)} to review.`};case"remove_agent_access":return{title:`${t} asks to stop ${a.agent.displayName} using ${Q(a.connection.toolkit,a.connection.label,n)}`,detail:a.keptThroughEveryAgent.length>0?`Still shared with every agent, so it keeps ${As(a.keptThroughEveryAgent.length)}.`:"It loses access to this app."}}}function Xi(s,n){if(s.state!=="approved")return null;const t=s.context,a=t.kind==="connect"?Q(t.toolkit,t.label,n):t.kind==="unavailable"?"the connection":Q(t.connection.toolkit,t.connection.label,n);return s.resolution.kind==="connect_authentication_required"?{title:`Approved: finish signing in to ${a}`,detail:"Open it to finish signing in."}:s.resolution.kind==="outcome_unknown"?{title:`Check ${a} before another change`,detail:"Couldn’t confirm the approved change took effect."}:null}const eo=10080*60*1e3,so=Jn,no=60*1e3;function to({services:s,onOpenRequest:n,onOpenReview:t}){var l,g;const a=$a("pending"),i=vs("pending"),r=vs("resolved"),c=ao(),o=(r.data??[]).filter(m=>m.state==="approved"&&(m.resolution.kind==="connect_authentication_required"&&c-Date.parse(m.resolvedAt)<so||m.resolution.kind==="outcome_unknown"&&c-Date.parse(m.resolvedAt)<eo)),h=[a,i,r].filter(m=>m.isError);return!((((l=a.data)==null?void 0:l.length)??0)+(((g=i.data)==null?void 0:g.length)??0)+o.length>0)&&h.length===0?null:e.jsxs("section",{"aria-labelledby":"connections-needs-you","data-testid":"needs-you",className:"bg-status-warning-bg/60 rounded-xl p-1.5",children:[e.jsx("h2",{id:"connections-needs-you",className:"text-status-warning-fg px-2.5 pt-1.5 pb-1 text-xs font-semibold",children:"Needs you"}),e.jsxs("ul",{children:[(a.data??[]).map(m=>e.jsx(Be,{testId:`needs-you-request-${m.requestId}`,line:{title:`${m.agent.displayName} wants to use ${Fe(m.serviceSlug,s)}`,detail:m.reason},onOpen:()=>n(m.requestId)},`request-${m.requestId}`)),(i.data??[]).map(m=>e.jsx(Be,{testId:`needs-you-review-${m.reviewRequestId}`,line:Zi(m,s),onOpen:()=>t(m.reviewRequestId)},`review-${m.reviewRequestId}`)),o.map(m=>{const d=Xi(m,s);return d?e.jsx(Be,{testId:`needs-you-review-${m.reviewRequestId}`,line:d,onOpen:()=>t(m.reviewRequestId)},`review-${m.reviewRequestId}`):null})]}),h.length>0&&e.jsxs("p",{className:"text-muted-foreground flex flex-wrap items-center gap-x-2 px-2.5 pb-1.5 text-xs",children:["Couldn’t check for waiting requests.",e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:()=>h.forEach(m=>void m.refetch()),children:"Try again"})]})]})}function ao(){const[s,n]=f.useState(()=>Date.now());return f.useEffect(()=>{const t=setInterval(()=>n(Date.now()),no);return()=>clearInterval(t)},[]),s}function Be({testId:s,line:n,onOpen:t}){return e.jsx("li",{children:e.jsxs("button",{type:"button","data-testid":s,onClick:t,className:"hover:bg-background/60 focus-ring flex min-h-12 w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors",children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"line-clamp-2 block text-sm font-medium sm:line-clamp-1",children:n.title}),e.jsx("span",{className:"text-muted-foreground line-clamp-2 block text-xs sm:line-clamp-1",children:n.detail})]}),e.jsxs("span",{className:"text-muted-foreground flex shrink-0 items-center gap-0.5 text-xs font-medium",children:["Review",e.jsx(he,{className:"size-3.5","aria-hidden":!0})]})]})})}function io({requestId:s,open:n,onOpenChange:t,onEditExactActions:a,onCloseAutoFocus:i}){const r=Ea(s),c=r.data?`${r.data.agent.displayName} asked to use ${ge(r.data.serviceSlug)}`:"An agent’s request";return e.jsx(X,{open:n,onOpenChange:t,children:e.jsxs(ee,{"data-testid":"agent-request-dialog",onCloseAutoFocus:i,className:"max-h-[90vh] sm:max-w-xl",children:[e.jsxs(se,{className:"sr-only",children:[e.jsx(ne,{children:c}),e.jsx(re,{children:"Answer it here, as in the chat."})]}),e.jsx(te,{className:"pb-4",children:r.isPending?e.jsx(P,{className:"h-40 rounded-xl","aria-label":"Loading the request"}):r.isError?e.jsx(K,{title:"Couldn’t load this request",description:"Nothing changed. Try again.",onRetry:()=>void r.refetch(),isRetrying:r.isFetching}):r.data?e.jsx(ra,{request:r.data,className:"max-w-none",...a?{onEditExactActions:a}:{}},r.data.requestId):null})]})})}function oo(s){const n=s.context;if(n.kind==="unavailable")return{title:"Older connection request",approveLabel:"Approve"};switch(n.kind){case"connect":return{title:`Connect ${ge(n.toolkit)}${n.label?` (${n.label})`:""}`,approveLabel:"Approve and continue"};case"edit":return{title:`Rename ${n.connection.label}`,approveLabel:"Approve rename"};case"pause":return{title:`Pause ${n.connection.label}`,approveLabel:"Approve pause"};case"resume":return{title:`Resume ${n.connection.label}`,approveLabel:"Approve resume"};case"disconnect":return{title:`Disconnect ${n.connection.label}`,approveLabel:"Approve disconnect"};case"set_agent_access":return{title:`Change access for ${n.agent.displayName}`,approveLabel:"Approve access"};case"remove_agent_access":return{title:`Remove access for ${n.agent.displayName}`,approveLabel:"Approve removal"}}}function ro(s){return(s.split(".").at(-1)??s).replaceAll("_"," ").replace(/\b\w/g,t=>t.toUpperCase())}function In(s){const n=new Map;for(const t of s){const a=n.get(t.operationSlug);(!a||t.toolkitVersion.localeCompare(a.toolkitVersion,void 0,{numeric:!0})>0)&&n.set(t.operationSlug,t)}return new Set(s.filter(t=>t.toolkitVersion.localeCompare(n.get(t.operationSlug).toolkitVersion,void 0,{numeric:!0})<0).map(t=>t.operationRevisionId))}function co({reviewRequestId:s,open:n,onOpenChange:t,onCloseAutoFocus:a}){var k;const i=_a(s),r=Pa(),[c,o]=f.useState(!1),[h,u]=f.useState(!1),l=i.data,g=(l==null?void 0:l.state)==="approved"&&l.resolution.kind==="connect_authentication_required"?l.resolution.authentication:null,m=c||!!(g&&!g.authorizeUrl),d=Oa((g==null?void 0:g.flowId)??null,m),p=d.isError?"check_failed":((k=d.data)==null?void 0:k.state)??(m?"checking":"required"),v=f.useMemo(()=>l?oo(l):null,[l]),N=b=>{!s||h||r.mutate({reviewRequestId:s,decision:b},{onError:()=>{u(!0)}})};return e.jsx(X,{open:n,onOpenChange:t,children:e.jsxs(ee,{"data-testid":"connector-review-dialog",onCloseAutoFocus:a,className:"max-h-[90vh] sm:max-w-xl [&>[data-slot=dialog-content-close]]:absolute [&>[data-slot=dialog-content-close]]:top-4 [&>[data-slot=dialog-content-close]]:right-4 [&>[data-slot=dialog-content-close]]:m-0 [&>[data-slot=dialog-content-close]]:opacity-100",children:[e.jsxs(se,{children:[e.jsx(ne,{children:(v==null?void 0:v.title)??"Review connection request"}),e.jsx(re,{className:"text-foreground",children:"Check the account, agent and actions first."})]}),e.jsx(te,{className:"space-y-4 pb-4",children:i.isLoading?e.jsx(P,{className:"h-48 rounded-lg"}):i.isError?e.jsx(K,{title:"Couldn’t load this request",description:"It may have expired or belong to another owner.",onRetry:()=>void i.refetch(),isRetrying:i.isFetching}):l&&v?e.jsxs(e.Fragment,{children:[e.jsx(lo,{context:l.context}),l.targetStatus==="unavailable"&&l.state==="pending"&&e.jsxs("div",{className:"border-status-warning/30 bg-status-warning/5 flex gap-3 rounded-lg border p-3",children:[e.jsx(Zn,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"This request can’t be approved"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"The account, agent or app setup changed since. You can still deny it."})]})]}),l.state!=="pending"&&e.jsx(mo,{review:l}),h&&e.jsxs("div",{role:"alert",className:"border-destructive/30 bg-destructive/5 rounded-lg border p-3",children:[e.jsx("p",{className:"text-sm font-medium",children:"Couldn’t confirm your decision"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"Reload the request to see what was recorded."})]}),g&&e.jsxs("div",{"aria-live":"polite",className:"space-y-3 rounded-lg border p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:p==="connected"?"Account connected":p==="failed"||p==="expired"||p==="start_unknown"?"Sign-in didn’t finish":p==="pending"||p==="starting"?"Waiting for sign-in":p==="checking"?"Checking sign-in":p==="check_failed"?"Couldn’t check sign-in":"Sign-in still required"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:p==="connected"?"Sign-in finished and the account is ready.":p==="expired"?"The sign-in timed out. Connect it yourself on the Connections page.":p==="start_unknown"?"DorkOS can’t tell if the sign-in started. Connect it on the Connections page.":p==="failed"?"Sign-in didn’t finish. Connect it yourself on the Connections page.":p==="pending"||p==="starting"||p==="checking"?"Finish signing in. This page updates when the account is ready.":p==="check_failed"?"The account may be connected. Check again before another request.":"No account connected yet. Continue to the service to sign in."}),p==="check_failed"?e.jsx(y,{onClick:()=>void d.refetch(),disabled:d.isFetching,children:d.isFetching?"Checking…":"Check again"}):p!=="connected"&&p!=="failed"&&p!=="expired"&&p!=="start_unknown"&&g.authorizeUrl?e.jsx(y,{asChild:!0,children:e.jsxs(Ze,{href:g.authorizeUrl,onOpened:()=>o(!0),children:["Continue to sign in",e.jsx(Xe,{className:"size-4","aria-hidden":!0})]})}):p==="required"?e.jsx(y,{onClick:()=>o(!0),children:"Check connection"}):null]})]}):null}),e.jsx(ue,{children:(l==null?void 0:l.state)==="pending"&&h?e.jsx(y,{onClick:()=>{i.refetch().then(b=>{b.isError||(u(!1),r.reset())})},disabled:i.isFetching,children:i.isFetching?"Reloading request…":"Reload request"}):(l==null?void 0:l.state)==="pending"?e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"outline",onClick:()=>N("denied"),disabled:r.isPending,children:"Deny"}),l.targetStatus==="available"&&l.context.kind!=="unavailable"&&e.jsx(y,{onClick:()=>N("approved"),disabled:r.isPending,children:r.isPending?"Saving decision…":v==null?void 0:v.approveLabel})]}):e.jsx(y,{variant:"secondary",onClick:()=>t(!1),children:"Done"})})]})})}function lo({context:s}){if(s.kind==="unavailable")return e.jsx("p",{className:"text-muted-foreground rounded-lg border p-4 text-sm",children:"This older request lacks the detail to approve safely."});if(s.kind==="connect")return e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 rounded-lg border p-4 text-sm",children:[e.jsx("dt",{children:"App"}),e.jsx("dd",{className:"font-medium",children:ge(s.toolkit)}),e.jsx("dt",{children:"Connected through"}),e.jsx("dd",{children:s.providerDisplayName}),s.label&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Label"}),e.jsx("dd",{children:s.label})]})]});const n=s.kind==="set_agent_access"?s.requestedOperations:s.kind==="remove_agent_access"||s.kind==="disconnect"?s.affectedOperations:[],t=In(n),a=s.kind==="set_agent_access"||s.kind==="remove_agent_access"?s.agent:null;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 rounded-lg border p-4 text-sm",children:[e.jsx("dt",{children:"Account"}),e.jsx("dd",{className:"font-medium",children:s.connection.label}),e.jsx("dt",{children:"App"}),e.jsx("dd",{children:ge(s.connection.toolkit)}),e.jsx("dt",{children:"Status"}),e.jsx("dd",{children:La[s.connection.status]}),e.jsx("dt",{children:"Sign-in"}),e.jsx("dd",{"data-testid":"connector-review-custody",children:uo(s.connection)}),a&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Agent"}),e.jsx("dd",{children:a.displayName})]})]}),s.kind==="disconnect"&&e.jsx("p",{"data-testid":"connector-review-impact",className:"text-sm font-medium",children:s.everyAgent?"Every agent loses this account. It’s shared with every agent now.":`Removes this account from ${s.affectedAgentCount} ${s.affectedAgentCount===1?"agent":"agents"}.`}),s.kind==="remove_agent_access"&&s.keptThroughEveryAgent.length>0&&e.jsxs("div",{role:"note","data-testid":"connector-review-every-agent-kept",className:"bg-muted/40 space-y-1 rounded-lg p-3 text-sm",children:[e.jsxs("p",{children:[s.agent.displayName," keeps ",s.keptThroughEveryAgent.length," ",s.keptThroughEveryAgent.length===1?"action":"actions"," on"," ",s.connection.label," through “Every agent”."]}),e.jsxs("p",{children:["Approving removes only what ",s.agent.displayName," has by name."]}),e.jsxs("p",{children:["To remove it all, stop sharing ",s.connection.label," with every agent in Connections."]})]}),n.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:"Exact actions"}),e.jsx("ul",{className:"space-y-2",children:n.map(i=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("span",{className:"text-sm",children:[ro(i.operationSlug),t.has(i.operationRevisionId)&&e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:"Older version"})]}),e.jsx(G,{size:"xs",variant:i.capabilityClassification==="destructive"?"destructive":"secondary",children:xn[i.capabilityClassification]})]},i.operationRevisionId))})]})]})}function uo(s){switch(s.custody){case"managed":return"Kept in Composio’s vault";case"self-host":return"Kept on your own Nango server";case"external":return"Handled by the app’s own server"}}function mo({review:s}){if(s.state==="pending")return null;if(s.state==="resolving")return e.jsxs("div",{"data-testid":"connector-review-outcome","data-outcome":"resolving",className:"bg-muted/40 rounded-lg border p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Applying change"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"Still applying. Check again before another change."})]});const n=s.state==="denied"?"Denied":s.state==="expired"?"Expired":s.resolution.kind==="applied"?"Approved and applied":s.resolution.kind==="outcome_unknown"?"Outcome unknown":"Approved",t=s.state==="expired"?"This request can no longer change access.":s.state==="denied"?"No requested change was made.":s.resolution.kind==="applied"?"The requested change was applied.":s.resolution.kind==="outcome_unknown"?"It may have been applied. Check the connection before another change.":"Finish signing in to connect the account.";return e.jsxs("div",{"data-testid":"connector-review-outcome","data-outcome":s.state==="approved"?s.resolution.kind:s.state,className:"bg-muted/40 rounded-lg border p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:n}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:t})]})}function ho(s,n){switch(s){case"service_not_ready":return{title:`${n} can’t be connected yet`,description:"This isn’t something you can fix here.",canRetry:!1};case"setup_needs_fix":return{title:`${n} can’t be connected right now`,description:"Its sign-in setup in DorkOS has a problem. Use Send feedback to report it.",canRetry:!1};case"account_link_required":return{title:"This computer isn’t linked to DorkOS",description:"Link your DorkOS account again, then connect.",canRetry:!1,action:"relink"};case"service_unavailable":return{title:`${n} isn’t available right now`,description:"Nothing was connected. Try again in a few minutes.",canRetry:!0}}}const po=new Set(["provider_not_found","authentication_unavailable"]);function go(s,n){const t=typeof s=="object"&&s!==null&&"code"in s?s.code:void 0;return typeof t=="string"&&po.has(t)?{title:"Couldn’t start the connection",description:`The way DorkOS reaches ${n} isn’t working. Check Settings › Connections.`,canRetry:!1}:{title:"Couldn’t start the connection",description:"Nothing was connected. Try again in a moment.",canRetry:!0}}function xo(s,n){const t=s.authenticationSetup;return t?t.source==="configured"?`${n} uses its own sign-in page.`:t.kind==="oauth"?`A ${n} sign-in page opens next.`:t.kind==="fields"&&s.mode==="managed"?`Enter your ${n} details on dorkos.ai. DorkOS doesn’t save them.`:t.kind==="none"&&s.mode==="managed"?`Confirm this ${n} connection on dorkos.ai. No account details needed.`:null:null}function Is(s,n){var t,a,i;return(s==null?void 0:s.mode)==="managed"&&((t=s.authenticationSetup)==null?void 0:t.kind)==="fields"?"Enter account details":(s==null?void 0:s.mode)==="managed"&&((a=s.authenticationSetup)==null?void 0:a.kind)==="none"?"Review and confirm":((i=s==null?void 0:s.authenticationSetup)==null?void 0:i.source)==="configured"?"Continue":n==="authorize"?"Open sign-in":(s==null?void 0:s.authKind)==="none"?"Check connection":"Continue"}function Rs({copy:s,onRetry:n,isRetrying:t=!1,onClose:a}){return s.canRetry&&n?e.jsx(K,{title:s.title,description:s.description,onRetry:n,isRetrying:t}):e.jsxs("div",{"data-testid":"connect-refusal",className:"space-y-2",children:[e.jsx(za,{icon:Qe,tone:"destructive",headline:s.title,description:s.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.action==="relink"&&e.jsx(fa,{variant:"outline",size:"sm"}),a&&e.jsx(y,{variant:"secondary",size:"sm",onClick:a,children:"Close"})]})]})}function fo({service:s,flowId:n,onFlowIdChange:t,onClose:a,onChooseAccess:i,onConnected:r}){var ke,Ce,E;const[c,o]=f.useState(!!(s||n)),[h,u]=f.useState(""),[l,g]=f.useState(null),[m,d]=f.useState(!1),p=Vt(),v=dn(n),N=((ke=v.data)==null?void 0:ke.toolkit)??(s==null?void 0:s.serviceSlug)??"",k=Ee(N),b=(Ce=k.data)==null?void 0:Ce.pages.flatMap(R=>R.services).find(R=>R.serviceSlug===N),j=(E=k.data)==null?void 0:E.pages[0],x=j==null?void 0:j.appConnections,w=b??s??null,$=ca(w),Y=$.filter(R=>R.capabilities.authentication.status==="available").length,A=$.find(R=>R.providerInstanceId===l)??(v.data?$.find(R=>R.providerInstanceId===v.data.providerInstanceId):null)??la($,x==null?void 0:x.newApps),T=v.data??p.data,S=!T&&da(w),_=(w==null?void 0:w.displayName)??ge((T==null?void 0:T.toolkit)??"service"),F=A?xo(A,_):null,W=A?gn(A):null,I=ua(A,w),z=()=>{o(!1),a()},O=()=>{t(null),z()},M=()=>{if(!w||!A)return;const R={providerInstanceId:A.providerInstanceId,...h.trim()&&{label:h.trim()}};p.mutate({...R,toolkit:w.serviceSlug,idempotencyKey:crypto.randomUUID()},{onSuccess:V=>t(V.flowId)})};return e.jsx(e.Fragment,{children:e.jsx(X,{open:c,onOpenChange:R=>{R?o(!0):z()},children:e.jsxs(ee,{"data-testid":"connect-auth-dialog",className:L("max-h-[90vh] sm:max-w-lg [&>[data-slot=dialog-content-close]]:absolute [&>[data-slot=dialog-content-close]]:top-4 [&>[data-slot=dialog-content-close]]:right-4 [&>[data-slot=dialog-content-close]]:m-0 [&>[data-slot=dialog-content-close]]:opacity-100",S&&"min-h-0"),children:[e.jsxs(se,{children:[e.jsxs(ne,{children:["Connect ",_]}),e.jsx(re,{children:T?"Finish, then choose which agents can use it.":S?"First, pick how DorkOS reaches your apps. You only do this once.":"Name the account and check who handles sign-in."})]}),e.jsx(te,{className:"space-y-4 pb-4",children:S&&$.length===0&&ma(j)&&(x==null?void 0:x.newApps.status)==="ready"?e.jsx(K,{title:`Couldn’t reach ${_} just now`,description:`${ha(x.newApps.way)} didn’t answer. Try again in a moment.`,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}):S?e.jsx(pa,{reason:ga(x,w),onLeave:z}):T?T.state==="starting"||T.state==="pending"?e.jsxs("div",{className:"space-y-4",children:[A&&e.jsxs("div",{"data-testid":"connect-disclosure",className:"bg-muted/40 space-y-1.5 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium",children:A.displayName}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:A.disclosure}),F&&e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:F}),W&&e.jsx("p",{className:"text-muted-foreground text-xs",children:W})]}),T.state==="pending"&&T.authorizeUrl?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:I??`Continue to sign in to ${_}.`}),e.jsx(y,{asChild:!0,className:"w-full",children:e.jsxs(Ze,{href:T.authorizeUrl,keepOpener:(A==null?void 0:A.mode)==="managed",children:[Is(A,"authorize"),e.jsx(Xe,{className:"size-4","aria-hidden":!0})]})})]}):e.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Vs,{className:"size-4 animate-spin","aria-hidden":!0}),T.state==="starting"?"Starting the connection…":"Waiting for sign-in…"]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can reload or leave without starting over."}),v.isError&&e.jsx(K,{title:"Couldn’t check the connection",description:"Sign-in may still finish. Check again.",onRetry:()=>void v.refetch(),isRetrying:v.isFetching})]}):T.state==="connected"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(et,{className:"text-status-success size-4","aria-hidden":!0}),e.jsxs("span",{children:[_," is connected"]})]}),e.jsx(hn,{mode:"page",connectionId:T.connectionId,serviceName:_,logo:is(w),onSkip:()=>{O(),r==null||r(T.connectionId)},onFinished:()=>{O(),r==null||r(T.connectionId)},onEditExactActions:R=>{i(R),O()}})]}):T.state==="failed"&&T.failureCode?(()=>{const R=ho(T.failureCode,_);return e.jsx(Rs,{copy:R,onRetry:R.canRetry?()=>{t(null),p.reset()}:void 0,onClose:O})})():e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{role:"alert",className:"text-destructive text-sm font-medium",children:T.state==="expired"?"This connection request expired.":"The connection didn’t finish."}),"reason"in T&&e.jsx("p",{className:"text-muted-foreground text-xs",children:T.reason}),e.jsx(y,{variant:"secondary",onClick:()=>{t(null),p.reset()},children:"Start again"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Z,{htmlFor:"connection-label",children:"Account label"}),e.jsx(J,{id:"connection-label",value:h,onChange:R=>u(R.target.value),placeholder:"Work, personal, support…",autoComplete:"off"}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Tells several ",_," accounts apart."]})]}),I&&e.jsx("p",{"data-testid":"connect-sign-in-line",className:"text-sm",children:I}),A?e.jsxs("div",{"data-testid":"connect-disclosure",className:"bg-muted/40 space-y-2 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xn,{className:"text-muted-foreground size-4","aria-hidden":!0}),e.jsx("p",{className:"text-sm font-medium",children:A.displayName})]}),Y>1&&e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>d(R=>!R),children:"Connect another way"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:A.disclosure}),F&&e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:F}),W&&e.jsx("p",{className:"text-muted-foreground text-xs",children:W})]}):null,e.jsx(xa,{toolkit:N,appName:_,providerInstanceId:(A==null?void 0:A.providerInstanceId)??null}),m&&e.jsxs("fieldset",{className:"space-y-2",children:[e.jsx("legend",{className:"text-xs font-medium",children:"Ways to connect"}),$.map(R=>{const V=R.capabilities.authentication.status==="available";return e.jsxs("button",{type:"button",disabled:!V,onClick:()=>{g(R.providerInstanceId),d(!1)},className:"bg-muted/40 focus-visible:ring-ring flex min-h-11 w-full items-center justify-between rounded-lg px-3 py-2 text-left focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",children:[e.jsx("span",{children:e.jsx("span",{className:"block text-sm font-medium",children:R.displayName})}),!V&&e.jsx("span",{className:"text-muted-foreground text-xs",children:"Unavailable"})]},R.providerInstanceId)})]}),p.isError&&e.jsx(Rs,{copy:go(p.error,_),onRetry:M,isRetrying:p.isPending})]})}),!T&&e.jsxs(ue,{children:[e.jsx(y,{variant:"ghost",onClick:z,children:"Cancel"}),!S&&e.jsx(y,{onClick:M,disabled:!A||p.isPending,children:p.isPending?"Starting…":Is(A,"start")})]})]})})})}function jo(s){var t,a;const n=((t=s.senderName)==null?void 0:t.trim())||"Someone";if(s.chatKind==="group"){const i=(a=s.chatTitle)==null?void 0:a.trim();return i?`${n} added your bot to “${i}”`:`${n} added your bot to a group`}return`${n} messaged your bot`}function Ts(s){return s.chatKind==="group"?"Which agent should join?":"Which agent should answer?"}function yo(s){return s.chatKind==="group"&&s.platformChatType==="channel"}function vo({chat:s,agentOptions:n,onClaim:t,onIgnore:a,onBlock:i,onLeave:r,isDeciding:c=!1}){var g;const[o,h]=f.useState(n.length===1?((g=n[0])==null?void 0:g.id)??"":""),u=s.chatKind==="group",l=yo(s);return e.jsxs(st,{"data-testid":`claim-card-${s.id}`,gap:"sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:jo(s)}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.messageCount===1?"One message so far.":`${s.messageCount} messages so far.`," ","Not read or answered yet."]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!l&&e.jsxs(Qs,{value:o,onValueChange:h,disabled:c,children:[e.jsx(Js,{className:"w-full sm:w-56","aria-label":Ts(s),"data-testid":`claim-agent-${s.id}`,children:e.jsx(Zs,{placeholder:Ts(s)})}),e.jsx(Xs,{children:n.map(m=>e.jsx(We,{value:m.id,children:le(m)},m.id))})]}),l?null:u?e.jsx(y,{size:"sm",disabled:!o||c,onClick:()=>t(o,!0),children:"Join"}):e.jsxs(e.Fragment,{children:[e.jsx(y,{size:"sm",disabled:!o||c,onClick:()=>t(o,!0),children:"Answer in a channel"}),e.jsx(y,{size:"sm",variant:"outline",disabled:!o||c,onClick:()=>t(o,!1),children:"Answer privately"})]}),e.jsx(y,{size:"sm",variant:"ghost",disabled:c,onClick:a,children:"Ignore"}),u?e.jsx(y,{size:"sm",variant:"ghost",disabled:c,onClick:r,children:"Leave"}):e.jsx(y,{size:"sm",variant:"ghost",disabled:c,onClick:i,children:"Block"})]}),l?e.jsx("p",{className:"text-muted-foreground text-xs",children:"Broadcast channel: no one to answer. Ignore hides it. Leave removes the bot."}):u?e.jsx("p",{className:"text-muted-foreground text-xs",children:"Ignore hides this quietly. Leave removes the bot, so nothing more arrives."}):e.jsxs("div",{className:"text-muted-foreground space-y-0.5 text-xs",children:[e.jsx("p",{children:"A channel gives you a room to see and reply from."}),e.jsx("p",{children:"Answering privately keeps this chat as it is."}),e.jsx("p",{children:"Ignore hides this quietly. Block stops recording this chat."})]})]})}function No({enabled:s,adapterId:n}){Ca();const{data:t,isLoading:a}=pn("pending",s),{data:i}=ae(),r=wa(),c=Sa(),o=Aa(),h=Ia(),u=es(),[l,g]=f.useState(null),m=(i==null?void 0:i.agents)??[],d=(t??[]).filter(v=>!n||v.adapterId===n),p=r.isPending||c.isPending||o.isPending||h.isPending;return s?a?e.jsx(P,{className:"h-28 w-full rounded-lg"}):d.length===0?null:e.jsxs("section",{"aria-labelledby":"connections-waiting",className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"connections-waiting",className:"text-sm font-semibold",children:"Waiting on you"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:d.length===1?"Someone messaged a bot with no agent to answer.":`${d.length} chats reached a bot with no agent to answer.`})]}),d.map(v=>e.jsx(vo,{chat:v,agentOptions:m,isDeciding:p,onClaim:(N,k)=>{var j;const b=((j=m.find(x=>x.id===N))==null?void 0:j.name)??N;r.mutate({id:v.id,input:{agentId:N,bridge:k}},{onSuccess:({binding:x,bridgeError:w})=>{if(w){D.warning(`${b} will answer this chat privately: ${w}`);return}if(k&&x.roomId){D.success(`${b} will answer in a new channel.`),u({...en.channels(),search:{id:x.roomId}});return}D.success(`${b} will answer this chat.`)},onError:x=>{const w=He(x,{id:N,name:b});if(w){g(w);return}D.error(x instanceof Error?x.message:"Couldn’t set an agent to answer")}})},onIgnore:()=>c.mutate(v.id,{onSuccess:()=>D.success("Ignored. This chat won’t show again.")}),onBlock:()=>o.mutate(v.id,{onSuccess:()=>D.success("Blocked. This chat is no longer recorded.")}),onLeave:()=>h.mutate(v.id,{onSuccess:()=>D.success("Left the group. It’s no longer recorded.")})},v.id)),e.jsx(vn,{conflict:l,onClose:()=>g(null)})]}):null}function bo({connectionId:s,open:n,onOpenChange:t}){var b,j;const[a,i]=f.useState({}),[r,c]=f.useState(null),o=ja({connectionId:s,active:n,onPreview:x=>i(ya(x))}),{preview:h,saveOutcome:u,saved:l,needsReconciliation:g,needsRefresh:m}=o,d=(j=(b=on().data)==null?void 0:b.connections.find(x=>x.connectionId===s))==null?void 0:j.readiness,p=(d==null?void 0:d.reason)==="needs_review"||(d==null?void 0:d.reason)==="access_update_failed",v=f.useMemo(()=>h?va(h,a):[],[h,a]),N=m||u!==null,k=p&&v.length===0;return e.jsx(X,{open:n,onOpenChange:t,children:e.jsxs(ee,{"data-testid":"connector-access-dialog",className:"max-h-[90vh] sm:max-w-3xl [&>[data-slot=dialog-content-close]]:absolute [&>[data-slot=dialog-content-close]]:top-4 [&>[data-slot=dialog-content-close]]:right-4 [&>[data-slot=dialog-content-close]]:m-0 [&>[data-slot=dialog-content-close]]:opacity-100",children:[e.jsxs(se,{children:[e.jsx(ne,{children:"Choose agent access"}),e.jsx(re,{children:"Pick the actions each agent may take. Current access stays selected."})]}),e.jsx(te,{className:"space-y-4 pb-4",children:o.isLoading?e.jsxs("div",{className:"space-y-3","aria-label":"Loading account actions",children:[e.jsx(P,{className:"h-20 rounded-lg"}),e.jsx(P,{className:"h-36 rounded-lg"})]}):o.loadFailed?e.jsx(mn,{error:o.loadError,title:"Couldn’t load account actions",description:"Nothing changed. Try again.",onRetry:o.refresh,isRetrying:o.isLoading}):N?e.jsx(Na,{access:o}):h?e.jsxs(e.Fragment,{children:[p&&d&&e.jsxs("p",{"data-testid":"access-dialog-cause",className:"bg-status-warning-bg text-status-warning-fg rounded-lg p-3 text-sm",children:[d.copy.owner," If this looks right, confirm it."]}),e.jsx(ko,{preview:h,selections:a,setSelections:i,advancedAgentId:r,setAdvancedAgentId:c})]}):null}),e.jsxs(ue,{children:[e.jsx(y,{variant:"ghost",onClick:()=>t(!1),children:l?"Done":u?"Close":"Cancel"}),g?e.jsx(y,{variant:"secondary",onClick:o.refresh,children:"Reload current access"}):u&&!l?e.jsxs(y,{variant:"secondary",onClick:o.checkSync,disabled:o.isCheckingSync,children:[e.jsx(Vs,{className:"size-4","aria-hidden":!0}),o.isCheckingSync?"Checking…":"Check if it’s done"]}):!m&&h&&!l?e.jsx(y,{onClick:()=>o.apply(v,void 0,{confirm:k}),disabled:v.length===0&&!p||o.isSaving,children:o.isSaving?"Saving…":k?"Confirm access":"Save access"}):null]})]})})}function ko({preview:s,selections:n,setSelections:t,advancedAgentId:a,setAdvancedAgentId:i}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s.connection.label}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Pick a level for each agent. Use Advanced for single actions."})]}),s.everyAgent.operationRevisionIds.length>0&&e.jsxs("div",{"data-testid":"exact-editor-every-agent",className:"bg-muted/40 space-y-1 rounded-lg p-3 text-sm",children:[e.jsxs("p",{children:["Every agent, even future ones, also has ",s.everyAgent.operationRevisionIds.length," ",s.everyAgent.operationRevisionIds.length===1?"action":"actions"," here."]}),e.jsx("p",{className:"text-muted-foreground",children:"The levels below don’t include them. To remove them, stop sharing with every agent."})]}),s.agents.length===0?e.jsx("p",{className:"bg-muted/40 rounded-lg p-4 text-sm",children:"No agents yet. Add one first."}):e.jsx("div",{className:"space-y-2",children:s.agents.map(r=>{const c=In(s.candidates),o=n[r.agentId],h=new Set((o==null?void 0:o.operationRevisionIds)??[]),u=(o==null?void 0:o.level)==="read"?"Read":(o==null?void 0:o.level)==="read-write"?"Read + write":h.size===0?"No access":"Custom access",l=a===r.agentId,g=m=>t({...n,[r.agentId]:{operationRevisionIds:nt(s.candidates,m),...m!=="none"&&{level:m}}});return e.jsxs("fieldset",{className:"bg-muted/40 rounded-lg p-3",children:[e.jsxs("legend",{className:"sr-only",children:["Access for ",r.displayName]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold",children:r.displayName}),e.jsx("p",{className:"text-muted-foreground text-xs",children:u})]}),e.jsx(y,{size:"sm",variant:"ghost","aria-expanded":l,onClick:()=>i(l?null:r.agentId),children:"Advanced"})]}),e.jsx("div",{className:"mt-2 grid grid-cols-3 gap-1.5","aria-label":`Quick access for ${r.displayName}`,children:[["none","No access"],["read","Read"],["read-write","Read + write"]].map(([m,d])=>e.jsx(y,{size:"sm",variant:u===d?"secondary":"outline","aria-pressed":u===d,onClick:()=>g(m),className:"px-2 text-xs",children:d},m))}),l&&e.jsx("ul",{className:"mt-3 space-y-1.5","data-testid":`advanced-access-${r.agentId}`,children:s.candidates.map(m=>{const d=h.has(m.operationRevisionId),p=!m.supported&&!d;return e.jsxs("li",{className:"bg-background flex gap-3 rounded-md p-2.5",children:[e.jsx(Ks,{"aria-label":`${Ue(m.operationSlug,s.connection.toolkit)} for ${r.displayName}`,checked:d,disabled:p,onCheckedChange:v=>{const N=new Set(h);v===!0?N.add(m.operationRevisionId):N.delete(m.operationRevisionId),t({...n,[r.agentId]:{operationRevisionIds:[...N].sort()}})}}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-sm font-medium",children:Ue(m.operationSlug,s.connection.toolkit)}),e.jsx(G,{size:"xs",variant:m.capabilityClassification==="destructive"?"destructive":"secondary",children:xn[m.capabilityClassification]}),!m.supported&&e.jsx(G,{size:"xs",variant:"outline",children:"No longer available"}),c.has(m.operationRevisionId)&&e.jsx("span",{className:"text-muted-foreground text-xs",children:"Older version"})]})})]},m.operationRevisionId)})})]},r.agentId)})})]})}function Co({agentName:s,sessionStrategy:n,chatId:t,channelType:a,canInitiate:i=!1,canReply:r=!0,canReceive:c=!0}){return e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"truncate",children:s}),n!=="per-chat"&&e.jsx(G,{variant:"secondary",className:"shrink-0",children:Ka(n)}),t&&e.jsx(G,{variant:"outline",className:"shrink-0 truncate",children:a?`#${t}`:t}),e.jsxs(tt,{children:[i&&e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(Ga,{className:"size-3 shrink-0 text-amber-500","aria-label":"Can message first"})}),e.jsx(Ie,{children:"Can message first"})]}),!r&&e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(Ya,{className:"text-muted-foreground/70 size-3 shrink-0","aria-label":"Can’t reply"})}),e.jsx(Ie,{children:"Can’t reply"})]}),!c&&e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(at,{className:"text-muted-foreground/70 size-3 shrink-0","aria-label":"Doesn’t receive messages"})}),e.jsx(Ie,{children:"Doesn’t receive messages"})]})]})]})}const wo=["People you may not know can put text in front of your agent.","Permissions are the real limit. A bridged chat asks before acting by default.","Raise that only if you trust everyone in the chat.","The channel keeps the whole record: every message that reached your agent, for good."];function So({binding:s,onDone:n}){const t=os({errorLabel:"Couldn’t bridge that chat"}),a=es();if(s.bridge==="room")return e.jsx(Ao,{binding:s,onDone:n});if(!s.chatId)return e.jsx(qe,{reason:"This reaches every chat here. Point it at one chat first."});if(s.platformChatType==="channel")return e.jsx(qe,{reason:"This is a broadcast channel, not a two-way chat. Your agent can’t reply."});const i=s.channelType==null||s.channelType==="dm";if(!(s.platformChatType==="private"||s.platformChatType==="group"||s.platformChatType==="supergroup"||s.platformChatType==null&&i))return e.jsx(qe,{reason:"DorkOS doesn’t know what kind of chat this is. Reconnect it from a new message."});async function c(){try{const o=await t.mutateAsync({id:s.id,updates:{bridge:"room"}});o.roomId&&a({...en.channels(),search:{id:o.roomId}}),n==null||n()}catch{}}return e.jsxs("section",{className:"border-border/60 space-y-3 rounded-lg border p-3","aria-labelledby":"bridge-heading",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(sn,{className:"text-muted-foreground size-4"}),e.jsx("h4",{id:"bridge-heading",className:"text-sm font-medium",children:"Bridge to a channel"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Messages land in a channel your agent reads. You can reply from there too."}),e.jsx("ul",{className:"text-muted-foreground space-y-1.5 text-xs",children:wo.map(o=>e.jsxs("li",{className:"flex gap-1.5",children:[e.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground/60",children:"•"}),e.jsx("span",{children:o})]},o))}),e.jsxs(y,{size:"sm",onClick:c,disabled:t.isPending,children:[t.isPending&&e.jsx(me,{size:"xs",className:"mr-1.5"}),"Bridge to a channel"]})]})}function Ao({binding:s,onDone:n}){const t=os({errorLabel:"Couldn’t un-bridge that chat"}),a=it(),{data:i}=ot(s.roomId??null),r=i!==void 0,c=(i==null?void 0:i.deliverNotices)??!1;async function o(){try{await t.mutateAsync({id:s.id,updates:{bridge:"off"}}),D.success("This chat is private again"),n==null||n()}catch{}}return e.jsxs("section",{className:"border-border/60 space-y-3 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(sn,{className:"text-muted-foreground size-4"}),e.jsx("p",{className:"text-sm font-medium",children:"This chat is a channel"})]}),s.roomId&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Z,{htmlFor:"bridge-deliver-notices",className:"cursor-pointer text-xs font-normal",children:"Tell this chat when your agent stops early"}),e.jsx(ss,{id:"bridge-deliver-notices",checked:c,disabled:!r||a.isPending,onCheckedChange:h=>a.mutate({roomId:s.roomId,deliverNotices:h}),"aria-label":"Tell this chat when your agent stops early"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"People in this chat see a short note."})]}),e.jsxs(xe,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(y,{variant:"ghost",size:"sm",className:"text-muted-foreground",children:"Un-bridge this chat"})}),e.jsxs(fe,{children:[e.jsxs(je,{children:[e.jsx(ye,{children:"Un-bridge this chat?"}),e.jsx(ve,{children:"Its channel is archived. The chat goes back to a private, one-to-one line."})]}),e.jsxs(Va,{children:[e.jsx("p",{children:"The channel and everything in it are kept."}),e.jsx("p",{children:"Bridging this chat again brings its history back."}),e.jsx("p",{children:"For a clean start with no old messages, archive the channel, then bridge again."})]}),e.jsxs(Ne,{children:[e.jsx(be,{children:"Keep it bridged"}),e.jsx(Le,{onClick:o,children:"Un-bridge"})]})]})]})]})}function qe({reason:s}){return e.jsxs("section",{className:"border-border/60 bg-muted/30 flex gap-2 rounded-lg border p-3",children:[e.jsx(Qa,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Can’t bridge this chat"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s})]})]})}function Io({adapterId:s,onQuickBind:n,onAdvanced:t,isPending:a,children:i}){const[r,c]=f.useState(!1),{data:o}=ae(),{data:h=[]}=De(),u=f.useMemo(()=>new Set(h.filter(d=>d.adapterId===s).map(d=>d.agentId)),[h,s]),l=f.useMemo(()=>((o==null?void 0:o.agents)??[]).filter(d=>!u.has(d.id)),[o,u]);async function g(d){await n(d),c(!1)}function m(){c(!1),t()}return e.jsxs(ct,{open:r,onOpenChange:c,children:[e.jsx(lt,{asChild:!0,children:i}),e.jsxs(dt,{className:"w-56 p-0",align:"start",children:[e.jsxs(Ja,{children:[e.jsx(Za,{placeholder:"Search agents…"}),e.jsxs(Xa,{children:[e.jsx(ei,{children:"No agents to add"}),l.map(d=>e.jsxs(si,{value:d.id,keywords:[le(d)],onSelect:()=>g(d.id),disabled:a,children:[a?e.jsx(me,{size:"xs",className:"mr-2"}):null,le(d)]},d.id))]})]}),e.jsx("div",{className:"border-t px-2 py-1.5",children:e.jsx(y,{variant:"ghost",size:"sm",className:"text-muted-foreground w-full text-xs",onClick:m,children:"Advanced…"})})]})]})}function Ro({instance:s,appName:n,emphasizePick:t=!0}){const{data:a=[]}=De(),{data:i}=ae(),r=Ba({suppressErrorToast:!0}),c=os({suppressErrorToast:!0}),o=Ha(),[h,u]=f.useState(null),[l,g]=f.useState(null),m=(i==null?void 0:i.agents)??[],d=x=>{const w=m.find($=>$.id===x);return w?le(w):x},p=a.filter(x=>x.adapterId===s.id);async function v(x){try{await r.mutateAsync({adapterId:s.id,agentId:x,sessionStrategy:"per-chat",label:""}),D.success(`${d(x)} answers ${n} now`)}catch(w){const $=He(w,{id:x,name:d(x)});if($){g($);return}D.error(w instanceof Error?w.message:"Couldn’t set who answers")}}async function N(x){if(h)try{h.mode==="edit"?(await c.mutateAsync({id:h.binding.id,updates:Ua(x)}),D.success("Saved")):(await r.mutateAsync(Wa(x)),D.success(`${d(x.agentId)} answers ${n} now`)),u(null)}catch(w){const $=He(w,{id:x.agentId,name:d(x.agentId)});if($){g($);return}D.error(w instanceof Error?w.message:"Couldn’t save that")}}async function k(x){try{await o.mutateAsync(x),D.success("Removed"),u(null)}catch{}}const b=(x,w)=>e.jsx(Io,{adapterId:s.id,onQuickBind:v,onAdvanced:()=>u({mode:"create"}),isPending:r.isPending,children:e.jsxs(y,{variant:w,size:"sm",children:[e.jsx(ns,{className:"size-3.5","aria-hidden":!0}),x]})}),j=(h==null?void 0:h.mode)==="edit"?h.binding:null;return e.jsxs("div",{className:"space-y-2","data-testid":"chat-app-answerers",children:[p.length===0?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"No agent answers yet. Messages wait until you pick one."}),b("Pick who answers",t?"default":"outline")]}):e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"-mx-2 space-y-0.5",children:p.map(x=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>u({mode:"edit",binding:x}),className:"group/row hover:bg-muted/50 focus-ring flex min-h-10 w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors",children:[e.jsx(Co,{agentName:d(x.agentId),sessionStrategy:x.sessionStrategy,chatId:x.chatId,channelType:x.channelType,canInitiate:x.canInitiate,canReply:x.canReply,canReceive:x.canReceive}),e.jsx(he,{className:"text-muted-foreground ml-auto size-4 shrink-0","aria-hidden":!0})]})},x.id))}),b("Add an agent","ghost")]}),h&&e.jsx(qa,{open:!0,onOpenChange:x=>{x||u(null)},mode:h.mode,initialValues:j?{adapterId:j.adapterId,agentId:j.agentId,sessionStrategy:j.sessionStrategy,label:j.label??"",permissionMode:j.permissionMode,chatId:j.chatId,channelType:j.channelType,canInitiate:j.canInitiate,canReply:j.canReply,canReceive:j.canReceive}:{adapterId:s.id},adapterName:n,agentName:j?d(j.agentId):void 0,onConfirm:N,onDelete:j?k:void 0,bindingId:j==null?void 0:j.id,isPending:r.isPending||c.isPending||o.isPending,bridged:(j==null?void 0:j.bridge)==="room",bridgeSlot:j?e.jsx(So,{binding:j,onDone:()=>u(null)}):void 0}),e.jsx(vn,{conflict:l,onClose:()=>g(null),onMoved:()=>u(null)})]})}const To={"adapter.connected":"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200","adapter.message_sent":"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200","adapter.disconnected":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200","adapter.error":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200","adapter.message_received":"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200","adapter.status_change":"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200"},Ke={"adapter.connected":"Connected","adapter.disconnected":"Disconnected","adapter.message_received":"Received","adapter.message_sent":"Sent","adapter.error":"Error","adapter.status_change":"Status"},$o=Object.keys(Ke);function Eo({adapterId:s}){const{data:n,isLoading:t}=yn(s),[a,i]=f.useState("all"),r=f.useRef(null),[c,o]=f.useState(!0),h=f.useCallback(()=>{const m=r.current;if(!m)return;o(m.scrollHeight-m.scrollTop-m.clientHeight<20)},[]);f.useEffect(()=>{c&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[n,c]);const u=()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight,o(!0))};if(t)return e.jsx("div",{className:"space-y-2 p-3",children:[1,2,3,4].map(m=>e.jsx(P,{className:"h-6 w-full"},m))});const l=(n==null?void 0:n.events)??[],g=a==="all"?l:l.filter(m=>m.subject===a);return l.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 p-6 text-center",children:[e.jsx(ut,{className:"text-muted-foreground size-6"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No events yet"})]}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[e.jsx("h4",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Events"}),e.jsxs(Qs,{value:a,onValueChange:i,children:[e.jsx(Js,{responsive:!1,className:"h-7 w-[130px] text-xs",children:e.jsx(Zs,{})}),e.jsxs(Xs,{children:[e.jsx(We,{value:"all",children:"All types"}),$o.map(m=>e.jsx(We,{value:m,children:Ke[m]},m))]})]})]}),e.jsx("div",{ref:r,onScroll:h,className:"flex-1 overflow-y-auto p-2",children:g.map(m=>{const d=m.metadata?JSON.parse(m.metadata):null,p=new Date(m.sentAt).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsxs("div",{className:"flex items-start gap-2 py-1",children:[e.jsx("span",{className:"text-muted-foreground shrink-0 font-mono text-xs tabular-nums",children:p}),e.jsx(G,{size:"xs",variant:"secondary",className:L("shrink-0",To[m.subject]??""),children:Ke[m.subject]??m.subject}),e.jsx("span",{className:"text-xs break-words",children:(d==null?void 0:d.message)??m.subject})]},m.id)})}),!c&&e.jsx("div",{className:"flex justify-center border-t py-1",children:e.jsxs(y,{variant:"ghost",size:"sm",onClick:u,className:"h-6 text-xs",children:[e.jsx(mt,{className:"mr-1 size-3"}),"Jump to bottom"]})})]})}const _o=3,Po={"adapter.message_received":"A message came in","adapter.message_sent":"A reply went out","adapter.connected":"Connected","adapter.disconnected":"Disconnected","adapter.status_change":"Its status changed"};function Oo(s){if(!s)return null;try{return JSON.parse(s)}catch{return null}}function Lo(s,n){if(s==="adapter.error"){const t=Oo(n);return t!=null&&t.message?`Something went wrong: ${t.message}`:"Something went wrong"}return Po[s]??s}function zo({adapterId:s}){const{data:n,isPending:t,isError:a,refetch:i}=yn(s),[r,c]=f.useState(!1),o=(n==null?void 0:n.events)??[],[h,u]=f.useState(null);return t?e.jsx(P,{className:"h-16 rounded-lg"}):a?e.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:["Couldn’t load what happened here.",e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:()=>void i(),children:"Try again"})]}):o.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing yet."}):r?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"bg-muted/30 h-72 overflow-hidden rounded-lg",children:e.jsx(Eo,{adapterId:s})}),e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:()=>c(!1),children:"Show less"})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("ul",{className:"space-y-1.5",children:o.slice(0,_o).map(l=>{const g=Lo(l.subject,l.metadata),m=h===l.id,d=e.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:Ve(l.sentAt)});return l.subject==="adapter.error"?e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":m,onClick:()=>u(m?null:l.id),className:"focus-ring hover:bg-muted/50 -mx-1 flex w-full items-baseline justify-between gap-3 rounded px-1 text-left text-sm",children:[e.jsx("span",{className:L("min-w-0",m?"break-words":"truncate"),children:g}),d]})},l.id):e.jsxs("li",{className:"flex items-baseline justify-between gap-3 text-sm",children:[e.jsx("span",{className:"min-w-0 truncate",children:g}),d]},l.id)})}),e.jsx(y,{variant:"link",size:"xs",className:"h-auto p-0",onClick:()=>c(!0),children:"See all"})]})}const Rn=["global-mcp-servers"],cs={networkMode:"always",meta:{suppressErrorToast:!0}};function Do(){const s=oe();return Ms({queryKey:Rn,queryFn:async()=>(await s.listGlobalMcpServers()).servers,networkMode:"always"})}function ls(){const s=Ye();return()=>s.invalidateQueries({queryKey:Rn})}function Fo(){const s=oe(),n=ls();return Oe({...cs,gcTime:0,mutationFn:t=>s.addGlobalMcpServer(t),onSettled:n})}function Tn(){const s=oe(),n=ls();return Oe({...cs,mutationFn:({name:t,patch:a})=>s.patchGlobalMcpServer(t,a),onSettled:n})}function Mo(){const s=oe(),n=ls();return Oe({...cs,mutationFn:t=>s.removeGlobalMcpServer(t),onSettled:n})}const $n=/TOKEN|KEY|SECRET|PASS|PWD|BEARER|AUTH|COOKIE|CREDENTIAL|DATABASE_URL|DSN/i;function Bo(s,n=[]){return $n.test(s)||n.includes(s)}const En=new Set(["npx","bunx","uvx"]),qo=new Set(["-y","--yes","-q","--quiet"]),Uo=/(?:.@|==)\d[^/\s]*$/;function Wo(s,n){if(!En.has(s))return;const t=n.find(a=>!qo.has(a));return t===void 0||t.startsWith("-")?void 0:t}function Ho(s,n){if(!En.has(s))return!1;const t=Wo(s,n);return t===void 0||!Uo.test(t)}const _n=B().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/,"Use letters, numbers, dashes and underscores"),Ko=pe({name:_n,connection:ht,secretNames:H(B().min(1)).max(64).default([]),excludedAgents:H(B().min(1)).max(500).default([]),enabled:ze().default(!1)});pe({enabled:ze().optional(),excludedAgents:H(B().min(1)).max(500).optional()}).strict().refine(s=>s.enabled!==void 0||s.excludedAgents!==void 0,{message:"Nothing to change"});const $s=pe({name:B(),secret:ze()}),Go=pe({name:B(),note:B()}),Yo=pe({name:B(),enabled:ze(),transport:fs(["stdio","http","sse"]),command:B().optional(),args:H(B()).optional(),url:B().optional(),env:H($s),headers:H($s),excludedAgents:H(B()),addedAt:B(),skippedOn:H(fs(["codex","opencode"])),warnings:H(Go)});pe({servers:H(Yo)});const Vo={name:"",kind:"command",command:"",args:"",url:"",env:[],headers:[],excludedAgents:[]};function Qo(s){const n=[],t=/"([^"]*)"|'([^']*)'|(\S)/g;let a=null,i=0;for(const r of s.matchAll(t))a!==null&&r.index>i&&(n.push(a),a=null),a=(a??"")+(r[1]??r[2]??r[3]??""),i=r.index+r[0].length;return a!==null&&n.push(a),n}function Ge(s){return Bo(s.name.trim(),s.marked?[s.name.trim()]:[])}function Pn(s){return(s.kind==="command"?s.env:s.headers).filter(t=>t.name.trim()!==""||t.value!=="")}function Jo(s){if(!_n.safeParse(s.name.trim()).success)return{field:"name",message:"Name it with letters, numbers, dashes and underscores."};if(s.kind==="command"&&s.command.trim()==="")return{field:"command",message:"Type the program to run."};if(s.kind==="url"&&!B().url().safeParse(s.url.trim()).success)return{field:"url",message:"Type the full address, starting with https://"};const n=new Set;for(const t of Pn(s)){const a=t.name.trim();if(a==="")return{field:"rows",message:"Name each value."};if(n.has(a))return{field:"rows",message:`${a} is there twice.`};if(n.add(a),t.value===""&&Ge(t))return{field:"rows",message:`Type a value for ${a}.`}}return null}function Zo(s){const n=Pn(s),t=Object.fromEntries(n.map(a=>[a.name.trim(),a.value]));return Ko.parse({name:s.name.trim(),enabled:!0,excludedAgents:s.excludedAgents,secretNames:n.filter(a=>a.marked).map(a=>a.name.trim()),connection:s.kind==="command"?{transport:"stdio",command:s.command.trim(),args:Qo(s.args),env:t}:{transport:"http",url:s.url.trim(),headers:t}})}const Xo="••••••••",er=2,sr=/^(localhost|127(?:\.\d+){3}|\[::1\]|.+\.localhost)$/i;function nr(s,n){if(s.length===0)return"All agents";const a=s.flatMap(r=>n(r)??[]).slice(0,er),i=s.length-a.length;return a.length===0?`All agents except ${i}`:`All agents except ${a.join(", ")}${i>0?` +${i} more`:""}`}function tr(s){return s.secret?`${s.name}=${Xo}`:s.name}function On(s){return[...s.env,...s.headers].filter(n=>n.secret).length}function ar(s){if(!s.url)return[];let n;try{n=new URL(s.url)}catch{return[]}return n.protocol!=="http:"||sr.test(n.hostname)?[]:s.headers.filter(t=>t.secret).map(t=>t.name)}function ds(s){return(s==null?void 0:s.code)===pt}function Me(s){return(s==null?void 0:s.noResponse)===!0?"Can’t reach DorkOS. Check that it’s running.":s instanceof Error&&s.message!==""?s.message:"That didn’t work. Try again."}function Ln(s){const n=f.useSyncExternalStore(gt,xt);return s&&n!==null}function Es({noun:s,rows:n,onChange:t,disabled:a,describedBy:i}){const r=f.useId(),c=(o,h)=>t(n.map(u=>u.id===o?{...u,...h}:u));return e.jsxs("div",{className:"space-y-3",children:[n.map((o,h)=>{const u=Ge(o),l=o.name.trim()||`this ${s}`;return e.jsxs("div",{"data-testid":`field-row-${h}`,className:"grid grid-cols-[1fr_auto_auto] items-center gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto_auto]",children:[e.jsx(J,{value:o.name,onChange:g=>c(o.id,{name:g.target.value}),"aria-label":`Name of ${s} ${h+1}`,"aria-describedby":h===0?i:void 0,placeholder:"NAME",autoCapitalize:"off",autoComplete:"off",spellCheck:!1,disabled:a,className:"font-mono"}),e.jsx("div",{className:"col-span-3 row-start-2 sm:col-span-1 sm:row-start-auto",children:u?e.jsx(ft,{id:`${r}-${o.id}`,value:o.value,onChange:g=>c(o.id,{value:g.target.value}),"aria-label":`Value of ${l}`,autoComplete:"new-password",spellCheck:!1,disabled:a,className:"font-mono"}):e.jsx(J,{id:`${r}-${o.id}`,value:o.value,onChange:g=>c(o.id,{value:g.target.value}),"aria-label":`Value of ${l}`,autoComplete:"off",spellCheck:!1,disabled:a,className:"font-mono"})}),e.jsx(ir,{pressed:u,locked:$n.test(o.name.trim()),disabled:a,onToggle:()=>c(o.id,{marked:!o.marked})}),e.jsx(y,{type:"button",variant:"ghost",size:"icon-md",className:"max-sm:size-11",disabled:a,"aria-label":`Remove ${l}`,onClick:()=>t(n.filter(g=>g.id!==o.id)),children:e.jsx(jt,{className:"size-(--size-icon-sm)","aria-hidden":!0})})]},o.id)}),n.some(Ge)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"It won’t show here again. Agents that get this server can use it."}),e.jsxs(y,{type:"button",variant:"ghost",size:"sm",className:"max-sm:h-11",disabled:a,onClick:()=>t([...n,{id:crypto.randomUUID(),name:"",value:"",marked:!1}]),children:[e.jsx(ns,{className:"size-(--size-icon-sm)","aria-hidden":!0}),s==="variable"?"Add a variable":"Add a header"]})]})}function ir({pressed:s,locked:n,disabled:t,onToggle:a}){const i=s?nn:ni;return e.jsxs(Se,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx(y,{type:"button",variant:"ghost",size:"icon-md","aria-label":"Hide this value","aria-pressed":s,"aria-disabled":n||void 0,disabled:t,className:L("max-sm:size-11",n&&"cursor-not-allowed"),onClick:()=>{n||a()},children:e.jsx(i,{className:L("size-(--size-icon-sm)",!s&&"text-muted-foreground"),"aria-hidden":!0})})}),e.jsx(Ie,{children:"Hide this value"})]})}function zn({excluded:s,onChange:n,disabled:t}){const a=f.useId(),i=f.useId(),{data:r}=ae(),c=(r==null?void 0:r.agents)??[],[o,h]=f.useState(!1),u=s.length>0||o?"except":"all";return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{id:a,className:"text-sm font-medium",children:"Which agents get it"}),e.jsxs(ts,{"aria-labelledby":a,value:u,disabled:t,className:"sm:w-fit",onValueChange:l=>{h(l==="except"),l==="all"&&s.length>0&&n([])},children:[e.jsx(de,{value:"all",className:"px-3 text-sm max-sm:min-h-11",children:"All agents"}),e.jsx(de,{value:"except",className:"px-3 text-sm max-sm:min-h-11",children:"All except…"})]}),u==="except"&&e.jsx("ul",{className:"space-y-0.5",children:c.map(l=>{const g=`${i}-${l.id}`,m=l.displayName??l.name,{color:d,emoji:p}=yt(l),v=!s.includes(l.id);return e.jsxs("li",{className:"flex min-h-11 items-center gap-3",children:[e.jsx(vt,{color:d,emoji:p,size:"sm",badge:null}),e.jsx(Z,{htmlFor:g,className:"min-w-0 flex-1 cursor-pointer truncate py-2",children:m}),e.jsx(ss,{id:g,checked:v,disabled:t,onCheckedChange:N=>n(N?s.filter(k=>k!==l.id):[...s,l.id])})]},l.id)})})]})}function or({onClose:s}){const n=f.useId(),t=f.useId(),a=f.useId(),i=f.useId(),r=f.useId(),c=f.useId(),[o,h]=f.useState(Vo),[u,l]=f.useState(null),g=Fo(),m=Ln(g.isPending),d=g.isPending,p=b=>h(j=>({...j,...b}));function v(b){if(b.preventDefault(),d)return;const j=Jo(o);l(j),!j&&g.mutate(Zo(o),{onSuccess:s})}const N=b=>(u==null?void 0:u.field)===b?e.jsx("p",{id:n,role:"alert",className:"text-destructive text-xs",children:u.message}):null,k=b=>(u==null?void 0:u.field)===b?n:void 0;return e.jsx(X,{open:!0,onOpenChange:b=>{!b&&!d&&s()},children:e.jsxs(ee,{className:"max-h-[85vh]",desktopProps:{className:"sm:max-w-xl"},children:[e.jsx(se,{children:e.jsx(ne,{children:"Add a server"})}),e.jsxs("form",{onSubmit:v,noValidate:!0,className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs(te,{alignWithHeader:!0,className:"space-y-4 py-1 [&_input]:scroll-my-6",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Z,{htmlFor:t,children:"Name"}),e.jsx(J,{id:t,autoFocus:!0,value:o.name,onChange:b=>p({name:b.target.value}),"aria-invalid":(u==null?void 0:u.field)==="name"||void 0,"aria-describedby":k("name"),autoCapitalize:"off",autoComplete:"off",spellCheck:!1,disabled:d,className:"font-mono"}),N("name")]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{id:c,className:"sr-only",children:"How it runs"}),e.jsxs(ts,{"aria-labelledby":c,value:o.kind,disabled:d,className:"sm:w-fit",onValueChange:b=>{l(null),p({kind:b})},children:[e.jsx(de,{value:"command",className:"px-3 text-sm max-sm:min-h-11",children:"Command"}),e.jsx(de,{value:"url",className:"px-3 text-sm max-sm:min-h-11",children:"URL"})]})]}),o.kind==="command"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Z,{htmlFor:a,children:"Command"}),e.jsx(J,{id:a,value:o.command,onChange:b=>p({command:b.target.value}),"aria-invalid":(u==null?void 0:u.field)==="command"||void 0,"aria-describedby":k("command"),autoCapitalize:"off",autoComplete:"off",spellCheck:!1,disabled:d,className:"font-mono"}),N("command")]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Z,{htmlFor:i,children:"Arguments"}),e.jsx(J,{id:i,value:o.args,onChange:b=>p({args:b.target.value}),autoCapitalize:"off",autoComplete:"off",spellCheck:!1,disabled:d,className:"font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-sm font-medium",children:"Environment"}),e.jsx(Es,{noun:"variable",rows:o.env,onChange:b=>p({env:b}),disabled:d,describedBy:k("rows")}),N("rows")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Z,{htmlFor:r,children:"URL"}),e.jsx(J,{id:r,type:"url",inputMode:"url",value:o.url,onChange:b=>p({url:b.target.value}),"aria-invalid":(u==null?void 0:u.field)==="url"||void 0,"aria-describedby":k("url"),autoCapitalize:"off",autoComplete:"off",spellCheck:!1,disabled:d,className:"font-mono"}),N("url")]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-sm font-medium",children:"Headers"}),e.jsx(Es,{noun:"header",rows:o.headers,onChange:b=>p({headers:b}),disabled:d,describedBy:k("rows")}),N("rows")]})]}),e.jsx(zn,{excluded:o.excludedAgents,onChange:b=>p({excludedAgents:b}),disabled:d}),g.isError&&(ds(g.error)?e.jsx("p",{role:"status",className:"text-sm",children:"Not confirmed. Nothing changed."}):e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Me(g.error)}))]}),e.jsxs(ue,{className:"shrink-0",children:[e.jsx(y,{type:"button",variant:"ghost",className:"max-sm:h-11",disabled:d,onClick:s,children:"Cancel"}),e.jsx(y,{type:"submit",className:"max-sm:h-11",disabled:d,"aria-busy":d,children:m?"Confirm it’s you…":"Add"})]})]})]})})}function Dn(){return e.jsx("span",{"aria-hidden":!0,className:"bg-muted flex size-9 shrink-0 items-center justify-center rounded-lg",children:e.jsx(Da,{className:"size-(--size-icon-md)"})})}function rr({server:s,nameOf:n,onOpen:t}){const a=Tn(),i=Ln(a.isPending);return e.jsxs("li",{"data-testid":`mcp-server-row-${s.name}`,className:"hover:bg-muted/50 flex items-center rounded-lg transition-colors",children:[e.jsxs("button",{type:"button",onClick:()=>{a.reset(),t()},className:"focus-ring flex min-h-14 min-w-0 flex-1 items-center gap-3 rounded-lg px-3 py-2 text-left",children:[e.jsx("span",{className:L("shrink-0",!s.enabled&&"opacity-55"),children:e.jsx(Dn,{})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:L("block truncate text-sm font-medium",!s.enabled&&"opacity-55"),children:s.name}),e.jsx(cr,{server:s,nameOf:n,outcome:i||a.isError?e.jsx(lr,{waiting:i,error:a.error}):null})]})]}),e.jsx("div",{className:"flex min-h-11 shrink-0 items-center pr-3",children:e.jsx(ss,{"aria-label":`${s.name} on`,checked:s.enabled,disabled:a.isPending,onCheckedChange:r=>a.mutate({name:s.name,patch:{enabled:r}})})})]})}function cr({server:s,nameOf:n,outcome:t}){const[a,...i]=s.warnings,r=!t&&!a&&s.skippedOn.length===0;return e.jsxs("span",{className:L("text-muted-foreground text-xs",r?"line-clamp-2":"block"),children:[t,!s.enabled&&e.jsx("span",{className:"opacity-55",children:"Off · "}),a&&e.jsxs("span",{className:"text-status-warning-fg",children:[a.note,i.length>0&&` +${i.length} more`," · "]}),s.skippedOn.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-status-warning-fg",children:"Not available to Codex or OpenCode agents"})," · "]}),nr(s.excludedAgents,n)]})}function lr({waiting:s,error:n}){return s?e.jsx("span",{role:"status",children:"Confirm it’s you… · "}):ds(n)?e.jsxs("span",{role:"status",className:"text-foreground",children:["Not confirmed. Nothing changed. ·"," "]}):e.jsxs("span",{role:"alert",className:"text-destructive",children:[Me(n)," ·"," "]})}const _s="secret_left";function dr({server:s,onClose:n,onRemoved:t,onCloseAutoFocus:a}){const i=Mo(),r=On(s);function c(){i.mutate(s.name,{onSuccess:()=>t({keysLeft:!1}),onError:o=>{o.code===_s&&t({keysLeft:!0})}})}return e.jsx(xe,{open:!0,onOpenChange:o=>{!o&&!i.isPending&&n()},children:e.jsxs(fe,{onCloseAutoFocus:a,children:[e.jsxs(je,{children:[e.jsxs(ye,{children:["Remove ",s.name,"?"]}),e.jsx(ve,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:"New chats won’t get its tools. Open ones may keep them until they stop."}),r===1&&e.jsx("p",{children:"Its key is deleted here. If it may have leaked, revoke it at the service."}),r>1&&e.jsx("p",{children:"Its keys are deleted here. If they may have leaked, revoke them at the service."})]})})]}),i.isError&&i.error.code!==_s&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Me(i.error)}),e.jsxs(Ne,{children:[e.jsx(be,{disabled:i.isPending,className:"max-sm:h-11",children:"Cancel"}),e.jsx(y,{type:"button",variant:"destructive",className:"max-sm:h-11",disabled:i.isPending,"aria-busy":i.isPending,onClick:c,children:"Remove"})]})]})})}function ur(s){return new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function mr({server:s,onClose:n,onRemove:t,onCloseAutoFocus:a}){const i=Tn(),r=s.command!==void 0&&Ho(s.command,s.args??[]),c=ar(s);return e.jsx(X,{open:!0,onOpenChange:o=>{o||n()},children:e.jsxs(ee,{className:"max-h-[85vh]",desktopProps:{className:"min-h-0 sm:max-w-lg"},onCloseAutoFocus:a,children:[e.jsx(se,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Dn,{}),e.jsxs("div",{className:"min-w-0 text-left",children:[e.jsx(ne,{className:"truncate",children:s.name}),e.jsxs(re,{children:["Added ",ur(s.addedAt)]})]})]})}),e.jsxs(te,{alignWithHeader:!0,className:"space-y-4 py-1",children:[e.jsxs("dl",{className:"bg-muted grid gap-x-4 gap-y-1.5 rounded-lg p-3 text-sm sm:grid-cols-[auto_minmax(0,1fr)]",children:[s.command!==void 0&&e.jsx(ce,{term:"Command",children:s.command}),s.args!==void 0&&s.args.length>0&&e.jsx(ce,{term:"Arguments",children:s.args.join(" ")}),s.url!==void 0&&e.jsx(ce,{term:"URL",children:s.url}),s.transport==="sse"&&e.jsx(ce,{term:"Transport",children:"SSE"}),s.env.length>0&&e.jsx(ce,{term:"Environment",children:s.env.map(o=>e.jsx(Ps,{field:o},o.name))}),s.headers.length>0&&e.jsx(ce,{term:"Headers",children:s.headers.map(o=>e.jsx(Ps,{field:o},o.name))})]}),On(s)>0&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Hidden values won’t show here again. Agents that get this server can use them."}),r&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"Not pinned to a version. What runs can change later."}),c.map(o=>e.jsxs("p",{className:"flex items-start gap-1.5 text-sm",children:[e.jsx(Qe,{className:"text-status-warning-dot mt-0.5 size-(--size-icon-sm) shrink-0","aria-hidden":!0}),e.jsxs("span",{children:["This address isn’t encrypted, so ",e.jsx("strong",{className:"font-medium",children:o})," ","travels in the clear."]})]},o)),s.skippedOn.length>0&&e.jsx("p",{className:"text-status-warning-fg text-sm",children:"Not available to Codex or OpenCode agents"}),s.warnings.map(o=>e.jsx("p",{className:"text-status-warning-fg text-sm",children:o.note},`${o.name}:${o.note}`)),e.jsx(zn,{excluded:s.excludedAgents,disabled:i.isPending,onChange:o=>i.mutate({name:s.name,patch:{excludedAgents:o}})}),i.isError&&(ds(i.error)?e.jsx("p",{role:"status",className:"text-sm",children:"Not confirmed. Nothing changed."}):e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Me(i.error)}))]}),e.jsxs(ue,{className:"shrink-0 sm:justify-between",children:[e.jsx(y,{type:"button",variant:"ghost",className:"max-sm:h-11",disabled:i.isPending,onClick:t,children:"Remove server"}),e.jsx(y,{type:"button",className:"max-sm:h-11",onClick:n,children:"Done"})]})]})})}function Ps({field:s}){return e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"min-w-0 break-all",children:tr(s)}),s.secret&&e.jsx(nn,{className:"size-(--size-icon-xs) shrink-0","aria-hidden":!0})]})}function ce({term:s,children:n}){return e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:s}),e.jsx("dd",{className:"min-w-0 font-mono break-words",children:n})]})}function hr(){const s=Do(),n=ae(),[t,a]=f.useState(!1),[i,r]=f.useState(null),[c,o]=f.useState(null),h=f.useRef(null),u=s.data??[],l=i?u.find(d=>d.name===i.name):void 0,g=d=>{var v;const p=(v=n.data)==null?void 0:v.agents.find(N=>N.id===d);return p?p.displayName??p.name:void 0},m=d=>{d.preventDefault();const p=h.current;p!=null&&p.isConnected?p.focus():tn()};return e.jsxs("section",{"aria-labelledby":"mcp-servers-heading",className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h2",{id:"mcp-servers-heading",className:"text-sm font-semibold",children:"For all your agents"}),e.jsxs(y,{variant:"secondary",size:"sm",className:"max-sm:h-11",onClick:()=>a(!0),children:[e.jsx(ns,{className:"size-(--size-icon-sm)","aria-hidden":!0}),"Add server"]})]}),c&&e.jsxs("div",{role:"alert",className:"bg-status-warning-bg space-y-2 rounded-lg p-3 text-sm",children:[e.jsxs("p",{className:"font-medium",children:[c.name," is removed"]}),e.jsx("p",{children:c.several?"Its keys weren’t deleted from this computer. If in doubt, revoke them at the service.":"Its key wasn’t deleted from this computer. If in doubt, revoke it at the service."}),e.jsx(y,{variant:"ghost",size:"sm",className:"max-sm:h-11",onClick:()=>o(null),children:"Dismiss"})]}),s.isPending&&e.jsx(P,{className:"h-14 w-full rounded-lg"}),s.isError&&e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Couldn’t load your servers."}),e.jsx(y,{variant:"outline",size:"sm",className:"max-sm:h-11",onClick:()=>s.refetch(),children:"Try again"})]}),s.isSuccess&&(u.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No servers yet. Add one and every agent can use its tools."}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Every agent gets these unless a row says otherwise."}),e.jsx("ul",{className:"space-y-0.5",children:u.map(d=>e.jsx(rr,{server:d,nameOf:g,onOpen:()=>{h.current=document.activeElement,r({kind:"sheet",name:d.name})}},d.name))})]})),e.jsxs("div",{className:"text-muted-foreground space-y-1 text-xs",children:[e.jsx("p",{children:"Changes reach new chats. Open ones may keep a server until they stop."}),e.jsx("p",{children:"A server added for one agent lives in that agent’s Toolkit."})]}),t&&e.jsx(or,{onClose:()=>a(!1)}),(i==null?void 0:i.kind)==="sheet"&&l&&e.jsx(mr,{server:l,onClose:()=>r(null),onRemove:()=>r({kind:"remove",name:l.name}),onCloseAutoFocus:m}),(i==null?void 0:i.kind)==="remove"&&l&&e.jsx(dr,{server:l,onClose:()=>r(null),onCloseAutoFocus:m,onRemoved:({keysLeft:d})=>{d&&o({name:l.name,several:[...l.env,...l.headers].filter(p=>p.secret).length>1}),r(null)}})]})}function pr({row:s,open:n,onOpenChange:t,onCloseAutoFocus:a,children:i}){const r=Nt(),[c,o]=f.useState({open:n,mobile:r});let h=c.mobile;(c.open!==n||!n&&c.mobile!==r)&&(o({open:n,mobile:r}),h=r);const u=s&&e.jsxs("div",{className:"flex items-center gap-3 pr-8",children:[e.jsx(qs,{iconKey:s.iconKey,displayName:s.name,logo:s.logo,className:"size-10 rounded-lg"}),e.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[e.jsxs(Ls,{mobile:h,className:"flex items-center gap-2 text-base font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),s.kind==="chat"&&e.jsx(G,{size:"xs",variant:"secondary",children:"Chat"})]}),e.jsxs(zs,{mobile:h,className:"text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs",children:[s.account&&e.jsx("span",{className:"truncate",children:s.identity?`${s.account} · ${s.identity}`:s.account}),s.tone==="ready"&&e.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[s.account&&e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:L("size-2 rounded-full",Us.success),"aria-hidden":!0}),"Connected"]})]})]})]}),l=e.jsxs(e.Fragment,{children:[e.jsx(Ls,{mobile:h,className:"sr-only",children:"App details"}),e.jsx(zs,{mobile:h,className:"sr-only",children:"Loading this app."})]});return h?e.jsx(bt,{open:n,onOpenChange:t,children:e.jsxs(kt,{className:"max-h-[88vh] outline-none","data-testid":"app-panel",onOpenAutoFocus:Os,onCloseAutoFocus:a,children:[e.jsx("div",{className:"px-4 pt-3 pb-3",children:u??l}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-6",children:i})]})}):e.jsx(Ct,{open:n,onOpenChange:t,children:e.jsxs(wt,{className:"w-full gap-0 outline-none","data-testid":"app-panel",onOpenAutoFocus:Os,onCloseAutoFocus:a,children:[e.jsx("div",{className:"px-6 pt-5 pb-4",children:u??l}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-8",children:i})]})})}function Os(s){var n;s.preventDefault(),(n=s.currentTarget)==null||n.focus()}function Ls({mobile:s,className:n,children:t}){return s?e.jsx(St,{className:n,children:t}):e.jsx(At,{className:n,children:t})}function zs({mobile:s,className:n,children:t}){return s?e.jsx(It,{className:n,children:t}):e.jsx(Rt,{className:n,children:t})}const we={chrome:"Chrome",edge:"Edge",brave:"Brave"};function gr(){const s=oe(),[n,t]=f.useState(null),[a,i]=f.useState(null),[r,c]=f.useState(!1),[o,h]=f.useState(!1),u=f.useRef(0),l=f.useRef(null),g=f.useRef(null);f.useEffect(()=>()=>{u.current+=1},[]),f.useEffect(()=>{var d;a&&((d=g.current)==null||d.focus())},[a]);const m=async()=>{const d=++u.current;t(null),i(null),h(!1),c(!0);try{const p=await s.scanYourBrowsers();u.current===d&&t(p)}catch{u.current===d&&h(!0)}finally{u.current===d&&c(!1)}};return e.jsxs("section",{"aria-labelledby":"your-browser-heading",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"your-browser-heading",className:"text-base font-medium",children:"Your browser"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Find a browser profile on the computer running DorkOS."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Profile names and emails are read only when you tap."})]}),e.jsx(y,{ref:l,onClick:()=>void m(),disabled:r,"aria-busy":r,className:"min-h-11",children:r?"Finding browsers…":n||a?"Scan again":"Find my browsers"}),e.jsxs("div",{role:"status","aria-live":"polite",children:[r&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"Looking for browser profiles…"}),(n==null?void 0:n.supported)&&e.jsxs("p",{className:"text-sm",children:["Found ",n.profiles.length," profiles"]})]}),o&&e.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t find your browsers. Try again."}),n&&!n.supported&&e.jsx("p",{className:"text-sm",children:"Browser discovery isn’t available on this computer."}),n&&n.supported&&n.profiles.length===0&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"No profiles found. Open Chrome, Edge or Brave, then scan again."}),n&&n.unreadable.length>0&&e.jsxs("p",{role:"alert",className:"text-muted-foreground text-sm",children:["Couldn’t read ",n.unreadable.map(d=>we[d]).join(", "),". Close it and scan again."]}),n&&n.profiles.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-2","aria-label":"Browser profiles",children:n.profiles.map(d=>e.jsxs("li",{className:"bg-muted/50 flex min-w-0 items-center gap-3 rounded-lg p-3",children:[e.jsx("span",{"aria-hidden":"true",className:"bg-muted flex size-10 shrink-0 items-center justify-center rounded-full text-sm font-medium",children:d.displayName.slice(0,2).toLocaleUpperCase()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"truncate text-sm font-medium",title:d.displayName,children:[we[d.browser]," · ",d.displayName]}),e.jsx("p",{className:"text-muted-foreground truncate text-sm",title:d.email,children:d.email??"Not signed in"})]}),e.jsx(y,{variant:"outline",className:"min-h-11 shrink-0","aria-label":`Use ${we[d.browser]} · ${d.displayName}`,onClick:()=>{t(null),i({browser:d.browser,directory:d.directory,displayName:d.displayName})},children:"Use this"})]},`${d.browser}/${d.directory}`))}),e.jsx(y,{variant:"ghost",className:"min-h-11",onClick:()=>{var d;t(null),(d=l.current)==null||d.focus()},children:"Close list"})]}),a&&e.jsxs("div",{className:"bg-muted/50 space-y-1 rounded-lg p-3",children:[e.jsxs("h3",{ref:g,tabIndex:-1,className:"text-sm font-medium break-words",children:[we[a.browser]," · ",a.displayName]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Selected · Off"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Pairing is coming soon. Agents can’t use this browser yet."})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Looks in Chrome, Edge and Brave. Arc isn’t supported yet."})]})}function xr({children:s}){return Tt("yourBrowser")?e.jsxs(Fa,{defaultValue:"apps",children:[e.jsxs(Ma,{"aria-label":"Apps and browsers",className:"mb-6 h-auto min-h-13 w-full",children:[e.jsx(Ns,{value:"apps",className:"min-h-11 flex-1",children:"Apps"}),e.jsx(Ns,{value:"browsers",className:"min-h-11 flex-1",children:"Browsers"})]}),e.jsx(bs,{value:"browsers",children:e.jsx(gr,{})}),e.jsx(bs,{value:"apps",children:s})]}):s}function fr({service:s,onClose:n,onChooseChat:t,onChooseAccount:a}){const i=(s==null?void 0:s.displayName)??"";return e.jsx(X,{open:s!==null,onOpenChange:r=>!r&&n(),children:e.jsxs(ee,{className:"min-h-0 sm:max-w-md","data-testid":"app-use-choice",children:[e.jsxs(se,{children:[e.jsxs(ne,{children:["Connect ",i]}),e.jsx(re,{children:"What do you want to do?"})]}),e.jsxs(te,{className:"space-y-2 pb-5",children:[e.jsx(Ds,{icon:e.jsx($t,{className:"size-4","aria-hidden":!0}),title:`Talk to my agents in ${i}`,detail:`Your agents get a ${i} bot. You message it, they answer.`,onClick:()=>s&&t(s)}),e.jsx(Ds,{icon:e.jsx(Et,{className:"size-4","aria-hidden":!0}),title:`Let agents use my ${i}`,detail:"Agents can read and post as you.",onClick:()=>s&&a(s)})]})]})})}function Ds({icon:s,title:n,detail:t,onClick:a}){return e.jsxs("button",{type:"button",onClick:a,className:"bg-muted/40 hover:bg-muted/70 focus-ring flex w-full items-start gap-3 rounded-xl p-3.5 text-left transition-colors",children:[e.jsx("span",{className:"bg-background text-muted-foreground flex size-8 shrink-0 items-center justify-center rounded-lg",children:s}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm font-medium",children:n}),e.jsx("span",{className:"text-muted-foreground block text-xs",children:t})]})]})}function jr({kind:s,name:n,id:t,confirmation:a,confirm:i}){const r=_t(a.notSent),c=a.references.length>2;return e.jsx(Pe,{icon:Pt,message:Dt(a),detail:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-status-warning-fg block break-words",title:c?js(a):void 0,children:[zt(s,a),c&&e.jsxs("span",{className:"sr-only",children:[": ",js(a)]})]}),r&&e.jsx("span",{className:"text-status-warning-fg block",children:r})]}),action:Lt(a),actionHint:Ot(a),pending:i.isPending,onAction:()=>i.mutate({id:t,name:n,fingerprint:a.fingerprint})})}function yr({entry:s,instance:n,onClose:t}){const{manifest:a}=s,i=an(),r=Ft(),c=Mt(),o=Ye(),[h,u]=f.useState(null),[l,g]=f.useState(!1),m=n.status.state==="error"||n.status.state==="disconnected",d=p=>i.mutate({id:n.id,enabled:p});return e.jsxs("div",{className:"space-y-7",children:[n.confirmation?e.jsx(jr,{kind:a.displayName,name:n.label??a.displayName,id:n.id,confirmation:n.confirmation,confirm:c}):n.enabled?m?e.jsx(Pe,{message:"Stopped working. Messages aren’t getting through.",technicalDetail:n.status.lastError,action:"Check its settings",onAction:()=>u("edit")}):null:e.jsx(Pe,{message:"Paused. No messages go in or out.",action:"Resume",pending:i.isPending,onAction:()=>d(!0)}),e.jsx(_e,{title:"Who answers",children:e.jsx(Ro,{instance:n,appName:a.displayName,emphasizePick:n.enabled&&!m})}),e.jsx(No,{enabled:!0,adapterId:n.id}),e.jsx(_e,{title:"Recently",children:e.jsx(zo,{adapterId:n.id})}),e.jsxs(Re,{children:[e.jsxs(Te,{className:"group/more text-muted-foreground hover:text-foreground focus-ring flex w-full items-center justify-between rounded-md py-1 text-sm font-semibold",children:["More",e.jsx(he,{className:"size-4 transition-transform group-data-[state=open]/more:rotate-90","aria-hidden":!0})]}),e.jsxs($e,{className:"-mx-2 space-y-1 pt-2","data-testid":"app-panel-more",children:[e.jsx(q,{label:"Settings",hint:"Who can message it, group chats, and its token",onClick:()=>u("edit")}),n.enabled?e.jsx(q,{label:"Pause",hint:"No messages in or out until you resume",disabled:i.isPending,onClick:()=>d(!1)}):e.jsx(q,{label:"Resume",disabled:i.isPending,onClick:()=>d(!0)}),a.multiInstance&&e.jsx(q,{label:`Set up another ${a.displayName}`,onClick:()=>u("add")}),e.jsx(q,{label:"Remove…",destructive:!0,onClick:()=>g(!0)})]})]}),h&&e.jsx(fn,{open:!0,onOpenChange:p=>{p||u(null)},manifest:a,existingInstance:h==="edit"?n:void 0,existingAdapterIds:s.instances.map(p=>p.id)}),e.jsx(xe,{open:l,onOpenChange:g,children:e.jsxs(fe,{children:[e.jsxs(je,{children:[e.jsxs(ye,{children:["Remove ",a.displayName,"?"]}),e.jsx(ve,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:"It stops working and its settings are deleted."}),e.jsx("p",{children:"So are its recent deliveries."}),e.jsx("p",{children:"Its list of people who messaged it is deleted, names included."}),e.jsx("p",{children:"That includes anyone ignored or blocked."}),e.jsx("p",{children:"Messages sent to it after that reach nobody."}),e.jsx("p",{children:"If you set it up again, block anyone you blocked again."})]})})]}),e.jsxs(Ne,{children:[e.jsx(be,{children:"Keep it"}),e.jsxs(Le,{variant:"destructive",onClick:()=>{r.mutate(n.id,{onSuccess:()=>{o.invalidateQueries({queryKey:[...Ra]}),t()}})},children:["Remove ",a.displayName]})]})]})})]})}function vr(){var c;const s=Ws(),n=Hs(s.enabled),[t,a]=f.useState(null),i=f.useCallback(o=>{var u;const h=s.enabled?(u=n.data)==null?void 0:u.find(l=>l.manifest.type===o):void 0;if(h&&(h.instances.length===0||h.manifest.multiInstance)){a(h.manifest);return}D.error("Chat apps aren’t ready. Try again in a moment.")},[n.data,s.enabled]),r=t?e.jsx(fn,{open:!0,onOpenChange:o=>{o||a(null)},manifest:t,existingAdapterIds:(c=n.data)==null?void 0:c.flatMap(o=>o.instances.map(h=>h.id))}):null;return{open:i,dialog:r}}function Nr(){var us,ms,hs,ps,gs;const s=Bt({from:"/_shell/connections"}),n=es({from:"/connections"}),t=f.useCallback(C=>void n({search:U=>{const ie={...U,...C};for(const xs of Object.keys(C))ie[xs]===void 0&&delete ie[xs];return ie}}),[n]),[a,i]=f.useState(""),r=f.useDeferredValue(a),[c,o]=f.useState(null),[h,u]=f.useState(!!s.flow),[l,g]=f.useState(null),[m,d]=f.useState(null),p=vr(),v=f.useRef(null),N=C=>Fs(C,v),k=f.useRef(null),b=C=>Fs(C,k),j=s.request?null:s.flow??null,x=dn(j),w=(us=x.data)==null?void 0:us.state,$=(ms=x.data)==null?void 0:ms.toolkit,Y=f.useMemo(()=>!h&&j&&$&&(w==="starting"||w==="pending")?{flowId:j,toolkit:$}:null,[h,j,w,$]),A=Si(r,Y),{relay:T}=A,S=ln(),_=as(),F=an(),W=Je(),I=S.error??_.error,z=S.isPending&&((hs=S.variables)==null?void 0:hs.connectionId)||_.isPending&&((ps=_.variables)==null?void 0:ps.connectionId)||F.isPending&&((gs=F.variables)==null?void 0:gs.id)||null,O=C=>{o(null),t({flow:C,app:void 0}),u(!0)},M=C=>{o(C),u(!0)},ke=C=>{const U=bn(C,A.owned),ie=T.enabled?U.chatType:null;if(U.account&&ie){d(C);return}if(ie){p.open(ie);return}M(C)},Ce=C=>{switch(C.action){case"sign-in-again":S.mutate({connectionId:C.id},{onSuccess:U=>O(U.flowId)});return;case"resume":C.kind==="chat"?F.mutate({id:C.id,enabled:!0}):_.mutate({connectionId:C.id,input:void 0});return;case"cancel":t({flow:void 0});return;case"review":C.kind==="chat"?t({app:C.id}):g(C.id);return;case"fix":t({app:C.id});return;case"fix-key":W.open("connections","ways");return;case"connect-again":{const U=C.toolkit?A.services.get(C.toolkit):void 0;U?M(U):t({app:C.id});return}case null:return}},E=s.app?A.allYours.find(C=>C.id===s.app&&C.kind!=="connecting")??null:null,R=(E==null?void 0:E.kind)==="chat"?br(A.chatApps,E.id):null;f.useEffect(()=>{s.app&&!A.yoursLoading&&!A.yoursRefreshing&&!A.yoursError&&!E&&t({app:void 0})},[s.app,A.yoursLoading,A.yoursRefreshing,A.yoursError,E,t]);const V=()=>t({app:void 0,who:void 0});return e.jsxs(Qt,{width:"reading",children:[e.jsxs("header",{className:"mb-6",children:[e.jsx(qt,{children:"Connections"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Apps and MCP servers your agents use."}),e.jsxs(ts,{"aria-label":"What to show",value:s.tab==="mcp"?"mcp":"apps",className:"mt-4 sm:w-fit",onValueChange:C=>t({tab:C==="mcp"?"mcp":void 0}),children:[e.jsx(de,{value:"apps",className:"px-3 text-sm max-sm:min-h-11",children:"Apps"}),e.jsx(de,{value:"mcp",className:"px-3 text-sm max-sm:min-h-11",children:"MCP servers"})]})]}),e.jsx("div",{hidden:s.tab==="mcp",children:e.jsx(xr,{children:e.jsxs("div",{className:"space-y-8",children:[e.jsx(to,{services:A.services,onOpenRequest:C=>{v.current=document.activeElement,t({request:C})},onOpenReview:C=>{v.current=document.activeElement,t({review:C})}}),I&&e.jsx("p",{role:"alert","data-testid":"row-action-error",className:"text-destructive bg-destructive/5 rounded-lg p-3 text-sm",children:wn(I)}),e.jsx(ki,{query:a,onQueryChange:i,data:A,onOpenRow:C=>{if(C.kind==="connecting"){u(!0);return}k.current=document.activeElement,t({app:C.id,who:void 0})},onRowAction:Ce,pendingRowId:z,onConnect:ke}),e.jsx(Cr,{})]})})}),s.tab==="mcp"&&e.jsx(hr,{}),e.jsxs(pr,{row:E,open:E!==null,onOpenChange:C=>{C||V()},onCloseAutoFocus:b,children:[(E==null?void 0:E.kind)==="account"&&e.jsx(Ki,{connectionId:E.id,startWho:s.who,onSignInStarted:O,onEditExactActions:g,onAddAnother:C=>{V(),M(A.services.get(C)??kr(C,E.name))},onClose:V},E.id),(E==null?void 0:E.kind)==="chat"&&R&&e.jsx(yr,{entry:R.entry,instance:R.instance,onClose:V},E.id)]}),h&&e.jsx(fo,{service:c,flowId:s.flow??null,onFlowIdChange:C=>t({flow:C??void 0}),onClose:()=>{u(!1),o(null)},onChooseAccess:g,onConnected:C=>t({app:C})},s.flow??(c==null?void 0:c.serviceSlug)??"idle"),e.jsx(io,{requestId:s.request??null,open:!!s.request&&!h,onOpenChange:C=>{C||t({request:void 0})},onEditExactActions:C=>{t({request:void 0}),g(C)},onCloseAutoFocus:N}),e.jsx(co,{reviewRequestId:s.review??null,open:!!s.review,onOpenChange:C=>{C||t({review:void 0})},onCloseAutoFocus:N},s.review??"closed"),e.jsx(bo,{connectionId:l,open:l!==null,onOpenChange:C=>{C||g(null)}},l??"closed"),e.jsx(fr,{service:m,onClose:()=>d(null),onChooseChat:C=>{d(null);const U=rs(C).chatType;U&&p.open(U)},onChooseAccount:C=>{d(null),M(C)}}),p.dialog]})}function Fs(s,n){s.preventDefault();const t=n.current;n.current=null,t!=null&&t.isConnected?t.focus():tn()}function br(s,n){for(const t of s){const a=t.instances.find(i=>i.id===n);if(a)return{entry:t,instance:a}}return null}function kr(s,n){return{serviceSlug:s,displayName:n,iconKey:s,intents:[{kind:"account",displayName:`Use a ${n} account`,routes:[]}]}}function Cr(){const s=Je();return e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Prefer your own Composio or Nango account?"," ",e.jsx(y,{variant:"link",className:"h-auto p-0 text-xs",onClick:()=>s.open("connections","ways"),children:"Set it up in Settings › Connections"})]})}const ec=Nr;export{ec as component};
@@ -1,2 +1,2 @@
1
- import{a5 as l,a6 as u,j as e,f_ as i,e as a,f$ as m,b9 as x,G as h,eh as p}from"./index-BR1m9FON.js";import{P as f}from"./page-container-0sWZ3xh9.js";import{Q as g}from"./query-error-state-Cm-Lozlb.js";import{L as j}from"./lightbulb-Cfb5ecEd.js";import{P as N}from"./paperclip-C-7LhBfl.js";import"./empty-state-BHcmkSzu.js";const b=["feedback","mine"];function y(){const s=l();return u({queryKey:b,queryFn:()=>s.listMyFeedback()})}const k=/^\d+\.\d+/;function w(s){return k.test(s)?`v${s}`:s}const v={bug:m,idea:j,feedback:i},R={bug:"Bug",idea:"Idea",feedback:"Feedback"};function S(s){switch(s.status){case"received":return"Received";case"triaged":return"Triaged";case"in_progress":return"In progress";case"shipped":return s.shippedVersion?`Shipped ${w(s.shippedVersion)}`:"Shipped";case"closed":return"Closed"}}function E(s){switch(s){case"in_progress":return"bg-amber-500/10 text-amber-600 dark:text-amber-400";case"shipped":return"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400";default:return"bg-muted text-muted-foreground"}}function F(s,r=140){const t=s.split(`
1
+ import{a5 as l,a6 as u,j as e,f_ as i,e as a,f$ as m,ba as x,G as h,eh as p}from"./index-B2JoVHek.js";import{P as f}from"./page-container-Cta3RqHd.js";import{Q as g}from"./query-error-state-BV8fyXBe.js";import{L as j}from"./lightbulb-DQBO5jSg.js";import{P as N}from"./paperclip-CItlLyje.js";import"./empty-state-CHse95jw.js";const b=["feedback","mine"];function y(){const s=l();return u({queryKey:b,queryFn:()=>s.listMyFeedback()})}const k=/^\d+\.\d+/;function w(s){return k.test(s)?`v${s}`:s}const v={bug:m,idea:j,feedback:i},R={bug:"Bug",idea:"Idea",feedback:"Feedback"};function S(s){switch(s.status){case"received":return"Received";case"triaged":return"Triaged";case"in_progress":return"In progress";case"shipped":return s.shippedVersion?`Shipped ${w(s.shippedVersion)}`:"Shipped";case"closed":return"Closed"}}function E(s){switch(s){case"in_progress":return"bg-amber-500/10 text-amber-600 dark:text-amber-400";case"shipped":return"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400";default:return"bg-muted text-muted-foreground"}}function F(s,r=140){const t=s.split(`
2
2
  `)[0]??"";return t.length>r?`${t.slice(0,r)}…`:t}function _(s){const r=[s.hasScreenshot&&"screenshot",s.hasTranscript&&"transcript"].filter(t=>!!t);return r.length>0?r.join(", "):null}function C({item:s}){const r=v[s.kind]??i,t=_(s);return e.jsxs("li",{className:"hover:bg-muted/50 flex items-start gap-3 rounded-md px-2 py-2.5 transition-colors",children:[e.jsx(r,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-foreground truncate text-sm",title:s.message,children:F(s.message)}),e.jsxs("p",{className:"text-muted-foreground mt-0.5 flex items-center gap-1 text-xs",children:[e.jsxs("span",{children:[R[s.kind]," · ",x(s.createdAt)]}),t&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx(N,{className:"size-3","aria-hidden":"true"}),t]})]})]}),e.jsx("span",{className:h("shrink-0 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap",E(s.status)),children:S(s)})]})}function n(){return e.jsxs("li",{className:"flex items-start gap-3 rounded-md px-2 py-2.5","aria-hidden":"true",children:[e.jsx(a,{className:"mt-0.5 size-4 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsx(a,{className:"h-3.5 w-3/4"}),e.jsx(a,{className:"h-3 w-1/3"})]}),e.jsx(a,{className:"h-4 w-16 shrink-0 rounded-full"})]})}function L(){const{data:s,isLoading:r,isError:t,refetch:o,isFetching:c}=y();return r?e.jsxs("ul",{className:"space-y-0.5","aria-label":"Loading your reports…",children:[e.jsx(n,{}),e.jsx(n,{}),e.jsx(n,{})]}):t?e.jsx(g,{className:"h-full",title:"Couldn’t load your reports",description:"Check that you’re online and try again.",onRetry:()=>void o(),isRetrying:c}):!s||s.length===0?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center",children:[e.jsx(i,{className:"text-muted-foreground/50 size-8","aria-hidden":"true"}),e.jsx("p",{className:"text-sm font-medium",children:"Nothing sent yet"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs",children:"Send a report from the help menu to see it here."})]}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("ul",{className:"min-h-0 flex-1 space-y-0.5 overflow-y-auto",children:s.map(d=>e.jsx(C,{item:d},d.id))}),e.jsx("p",{className:"text-muted-foreground border-border mt-2 border-t px-2 pt-2 text-xs",children:"Add your email to a report to hear when it ships."})]})}function B(){return e.jsxs(f,{width:"wide",scroll:!1,children:[e.jsxs("header",{className:"mb-6 shrink-0",children:[e.jsx(p,{children:"Your reports"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"What you sent DorkOS, and where each stands."})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(L,{})})]})}const D=B;export{D as component};
@@ -0,0 +1 @@
1
+ import{j as t}from"./index-B2JoVHek.js";import{M as o}from"./Marketplace-VBnmDEQE.js";import{P as r}from"./page-container-Cta3RqHd.js";import"./tabs-CDr3zS_2.js";import"./empty-state-CHse95jw.js";import"./markdown-content-FcvkqTTS.js";import"./PreviewRefusedNotice-DZh7zTEt.js";import"./shield-x-B2nLbkhR.js";import"./use-unclaimed-chats-T3kskM3T.js";import"./use-bindings-CEhDyZoj.js";import"./UnlinkDialog-B7lL7sxN.js";import"./use-dev-links-CXGFC-N0.js";import"./more-details-D9_Bn2GL.js";import"./file-DZ6-r1A3.js";import"./AgentPicker-B8WFWr7p.js";import"./command-D1cWVheG.js";import"./AgentOptionRow-CHb4ifHN.js";import"./useMutationState-6Zu1xBsZ.js";import"./file-exclamation-point-CR6qeV6m.js";import"./rotate-ccw-clock-C1SBdbZP.js";import"./path-input-CAkVS5XR.js";function i(){return t.jsx(r,{width:"wide",children:t.jsx(o,{})})}const R=i;export{R as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-B2JoVHek.js";import{P as r}from"./page-container-Cta3RqHd.js";import{M as e}from"./MarketplaceSourcesView-BRuo8wIH.js";import"./use-pending-read-HbJdwxw1.js";function t(){return o.jsx(r,{width:"reading",children:o.jsx(e,{})})}const s=t;export{s as component};
@@ -0,0 +1 @@
1
+ import{S as o}from"./WorkView-MSsuFZVO.js";import"./index-B2JoVHek.js";import"./WidgetErrorCard-D14BNvfm.js";import"./registry-BcpatPes.js";import"./PromptSuggestionChips-BGZ3HP31.js";import"./primer-trigger-BG3lb31_.js";import"./use-is-below-desktop-CgAcZ8iA.js";import"./use-notification-prefs-6N6Y4rqG.js";import"./use-status-budget-DrAROrOw.js";import"./git-branch-CzV_Mp0H.js";import"./trust-dial-BsEooNiu.js";import"./zap-C-pr1sst.js";import"./use-update-config-BhLEnZe5.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./RuntimeSetupDialog-UhsfZRye.js";import"./inline-code-rYW-kJLB.js";import"./list-runtime-types-Dry1muZ1.js";import"./RuntimeConnectFlow-Dinsb9em.js";import"./copy-button-BHHQAtAH.js";import"./useMutationState-6Zu1xBsZ.js";import"./runtime-connect-Dn0T5YWv.js";import"./unverified-catalog-notice-CQoKhOjQ.js";import"./format-tokens-DymkROvy.js";import"./layers-D9XZggr2.js";import"./detail-row-DBa1uo_y.js";import"./cpu-BhPT23rn.js";import"./banner-nfkn2OLZ.js";import"./UnreadDivider-DCB47jhk.js";import"./composer-insert-BpyATrmR.js";import"./use-composer-prefs-uC9mUd0f.js";import"./McpAppFrame-IfamHBcy.js";import"./more-details-D9_Bn2GL.js";import"./find-latest-widget-fence-D61kyRv5.js";import"./file-DZ6-r1A3.js";import"./use-session-canvas-Bub7vCaj.js";import"./rotate-cw-BTqPAMgP.js";import"./query-keys-DeYqUDia.js";import"./index.esm-gt8tvZ7J.js";import"./file-text-4-Vc22J-.js";import"./shield-x-B2nLbkhR.js";import"./McpSigninBody-VmuxAjoo.js";import"./image-off-B65OAyEw.js";import"./format-duration-BCr6uzby.js";import"./use-connector-management-54m5ZcyP.js";import"./AgentRequestCard-Cnhi_1sr.js";import"./access-copy-EuKlRWLG.js";import"./query-error-state-BV8fyXBe.js";import"./empty-state-CHse95jw.js";import"./use-bindings-CEhDyZoj.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-uKZG5d2z.js";import"./index-Bocv39Dy.js";import"./progress-CwpnobNW.js";import"./markdown-content-FcvkqTTS.js";import"./table-COZ3E1UU.js";import"./server-BCFl_ur3.js";import"./package-DpqGENzU.js";import"./heart-B7rSSNjF.js";import"./use-todos-COW66MhB.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-CItlLyje.js";import"./index-BchQNMCW.js";import"./use-transform-CXFCVk8z.js";const So=o;export{So as component};