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 @@
1
+ import{a5 as R,a7 as b,a8 as C,aR as x,dR as P,eZ as j,r as d,j as e,d2 as E,d3 as M,d5 as T,d6 as k,d7 as L,e_ as O,eL as _,I,aD as N,B as D,a_ as K,aE as F,by as B,bz as Q,e$ as q,f as z,bA as H,bC as V,f0 as Y}from"./index-B2JoVHek.js";function A(t){return Promise.all([t.invalidateQueries({queryKey:x.lists()}),t.invalidateQueries({queryKey:x.details()}),t.invalidateQueries({queryKey:x.threads()})]).then(()=>{})}function w(t){return(t==null?void 0:t.code)==="SLUG_TAKEN"}function $({isInlineErrorVisible:t}){const a=R(),r=b();return C({mutationFn:({title:n,agentPaths:l})=>a.createRoom({kind:"channel",title:n,members:[],agentPaths:l}),onSuccess:()=>A(r),meta:{suppressErrorToast:!0},onError:n=>{w(n)&&t()||P.error("Couldn’t create that channel.",{description:n.message})}})}function J(){const t=R(),a=b();return C({mutationFn:({agentPaths:r,title:n})=>t.createRoom({kind:"dm",title:n,members:[],agentPaths:r}),onSettled:()=>A(a),meta:{errorLabel:"Couldn’t start that DM"}})}const y=200;function G(){const t=K.getState();t.activeRightPanelTab==="canvas"&&t.setActiveRightPanelTabView(F)}function ee({open:t,onOpenChange:a,onCreated:r}){const n=j(),[l,m]=d.useState(""),h=d.useRef(null),c=d.useRef(null),u=d.useRef(!0);d.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const o=$({isInlineErrorVisible:()=>u.current}),g=w(o.error)?o.error.message:null,f=l.trim(),p=f.length>0&&f.length<=y,v=s=>{!p||o.isPending||o.mutate({title:f,agentPaths:s.map(i=>i.agentPath)},{onSuccess:i=>{a(!1),G(),r(i)}})},S=s=>{var i;s.key==="Enter"&&(s.preventDefault(),p&&((i=c.current)==null||i.focus()))};return e.jsx(E,{open:t,onOpenChange:a,children:e.jsxs(M,{className:"sm:max-w-md",onOpenAutoFocus:s=>{var i;s.preventDefault(),(i=h.current)==null||i.focus()},children:[e.jsxs(T,{children:[e.jsx(k,{children:"New channel"}),e.jsx(L,{children:"Name it, then pick who’s in it."})]}),e.jsxs(O,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"channel-name",children:"Channel name"}),e.jsx(I,{ref:h,id:"channel-name",value:l,maxLength:y,placeholder:"Backend",autoComplete:"off",onChange:s=>{m(s.target.value),o.error&&o.reset()},onKeyDown:S,"aria-invalid":g?!0:void 0,"aria-describedby":g?"channel-name-error":void 0}),g&&e.jsx("p",{id:"channel-name-error",role:"alert",className:"text-destructive text-xs",children:g})]}),e.jsxs("section",{"aria-label":"Agents in this channel",className:"space-y-2 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Who’s in it"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Agents read everything here and reply when @mentioned."}),e.jsx(N,{roster:n,onSubmit:v,submitLabel:s=>s.length===0?"Create channel":s.length===1?"Create channel with 1 agent":`Create channel with ${s.length} agents`,emptyRosterMessage:"You don’t have any agents yet. You can add them to the channel later.",allChosenMessage:"That’s every agent you have.",isSubmitting:o.isPending,submitDisabled:!p,inputRef:c})]}),e.jsx("div",{className:"flex justify-center border-t pt-3",children:e.jsx(D,{type:"button",variant:"ghost",size:"sm",disabled:!p||o.isPending,onClick:()=>v([]),children:"Create it without agents"})})]})]})})}const U="One agent opens a chat. Two or more start a group message.";function W(t){return t.length===1}function X(t){const a=t[0];return a!==void 0&&W(t)?`Open chat with ${a.displayName}`:"Start group message"}function te({onStart:t,open:a,onOpenChange:r,hideTrigger:n=!1}){const l=j(),m=d.useRef(null),h=()=>{r(!1),Y.getState().open()};return e.jsxs(B,{open:a,onOpenChange:r,modal:!0,fullHeight:!0,children:[e.jsx(Q,{asChild:!0,children:e.jsx(q,{...n?{"aria-hidden":!0,tabIndex:-1,className:"sr-only"}:{"aria-label":"New message"},children:e.jsx(z,{})})}),e.jsxs(H,{side:"right",align:"start",className:"flex w-64 flex-col p-2","aria-label":"New message",onOpenAutoFocus:c=>{var u;c.preventDefault(),(u=m.current)==null||u.focus()},children:[e.jsx(V,{children:"New message"}),e.jsx(N,{inputRef:m,roster:l,onSubmit:c=>{r(!1),t(c)},submitLabel:X,emptyRosterMessage:"You don’t have any agents yet.",emptyRosterAction:e.jsx(D,{type:"button",size:"sm",variant:"outline",onClick:h,children:"Create agent"}),allChosenMessage:"Everyone is already here."}),e.jsx("p",{className:"text-muted-foreground mt-2 shrink-0 px-2 text-xs",children:U})]})]})}export{ee as C,te as N,U as O,W as a,X as o,J as u};
@@ -1 +1 @@
1
- import{j as t,w as s}from"./index-BR1m9FON.js";function o({member:e}){var n;const i=((n=e.agent)==null?void 0:n.manifestId)??null;return i===null?t.jsx("div",{className:"min-h-0 flex-1 px-4 py-3","data-slot":"profile-notifications",children:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Notifications are set per agent."})}):t.jsx("div",{className:"min-h-0 flex-1 px-2 py-2","data-slot":"profile-notifications",children:t.jsx(s,{lens:{agentId:i},emptyLabel:`${e.displayName} has not told you anything yet.`})})}export{o as NotificationsPage};
1
+ import{j as t,w as s}from"./index-B2JoVHek.js";function o({member:e}){var n;const i=((n=e.agent)==null?void 0:n.manifestId)??null;return i===null?t.jsx("div",{className:"min-h-0 flex-1 px-4 py-3","data-slot":"profile-notifications",children:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Notifications are set per agent."})}):t.jsx("div",{className:"min-h-0 flex-1 px-2 py-2","data-slot":"profile-notifications",children:t.jsx(s,{lens:{agentId:i},emptyLabel:`${e.displayName} has not told you anything yet.`})})}export{o as NotificationsPage};
@@ -1,4 +1,4 @@
1
- import{fg as A,r as f,fh as K,fi as T,a5 as p,a6 as _,a7 as m,a8 as v,fj as M,j as d,fk as S,c$ as j,G as R}from"./index-BR1m9FON.js";import{u as w}from"./use-mesh-topology-upehQ5Cv.js";const O={activeWithinMs:3600*1e3,inactiveAfterMs:10080*60*1e3};function P(e){if(e.liveKinds.includes("pendingApproval")||e.liveKinds.includes("error")||e.hasBrokenExecutionConfig===!0)return"needs-attention";if(e.liveKinds.includes("streaming"))return"active";if(e.lastActivityAt===null)return"fresh";if(e.now-e.lastActivityAt<=O.activeWithinMs)return"active";const s=Math.max(e.lastActivityAt,e.lastInteractionAt??e.lastActivityAt);return e.now-s>O.inactiveAfterMs?"inactive":"idle"}function x(e,t,s){var a;const n=new Map;for(const[i,o]of Object.entries(e)){if(!s.has(o))continue;const r=T((a=t[i])==null?void 0:a.lifecycle);if(!r)continue;const c=n.get(o);c?c.push(r):n.set(o,[r])}return n}const q=Object.freeze({});function B(e,t=[],s=q){const n=e.join(`
1
+ import{fg as A,r as f,fh as K,fi as T,a5 as p,a6 as _,a7 as m,a8 as v,fj as M,j as d,fk as S,c$ as j,G as R}from"./index-B2JoVHek.js";import{u as w}from"./use-mesh-topology-BSRzCO1U.js";const O={activeWithinMs:3600*1e3,inactiveAfterMs:10080*60*1e3};function P(e){if(e.liveKinds.includes("pendingApproval")||e.liveKinds.includes("error")||e.hasBrokenExecutionConfig===!0)return"needs-attention";if(e.liveKinds.includes("streaming"))return"active";if(e.lastActivityAt===null)return"fresh";if(e.now-e.lastActivityAt<=O.activeWithinMs)return"active";const s=Math.max(e.lastActivityAt,e.lastInteractionAt??e.lastActivityAt);return e.now-s>O.inactiveAfterMs?"inactive":"idle"}function x(e,t,s){var a;const n=new Map;for(const[i,o]of Object.entries(e)){if(!s.has(o))continue;const r=T((a=t[i])==null?void 0:a.lifecycle);if(!r)continue;const c=n.get(o);c?c.push(r):n.set(o,[r])}return n}const q=Object.freeze({});function B(e,t=[],s=q){const n=e.join(`
2
2
  `),a=t.join(`
3
3
  `),i=A(f.useCallback(u=>u.statusCwds,[])),o=A(f.useCallback(u=>u.statuses,[])),{data:r}=K(),c=r==null?void 0:r.agentActivity;return f.useMemo(()=>{const u=n.length===0?[]:n.split(`
4
4
  `),N=new Set(a.length===0?[]:a.split(`
@@ -1 +1 @@
1
- import{bk as j,fS as F,fT as H,aZ as x,r as g,ch as P,cl as B,ct as w,fU as G,a5 as D,a6 as K,c6 as M,c1 as Y,fV as q,z,bl as W,j as i,eL as N,I as R,B as A}from"./index-BR1m9FON.js";import{d as U,c as V,n as Q,h as Z}from"./profile-errors-C1XACbc9.js";import{u as J}from"./use-mounted-ref-IHwyriaF.js";import{u as L,F as k}from"./ProfileFields-DU8dTGHT.js";function X(e){return{name:e.displayName.trim()===""||e.displayName===j,handle:!e.handle}}function de(e){const r=X(e);return r.name||r.handle}function $(e,r){var t,s,d;const a=(d=(s=(t=e.person)==null?void 0:t.email)==null?void 0:s.split("@")[0])==null?void 0:d.trim();if(!a)return"";const o=new Set([...F,...r.filter(l=>l.id!==e.id&&l.handle).map(l=>l.handle.toLowerCase())]);return H(a,o)??""}function ue(){const e=x(a=>a.setRightPanelOpen),r=x(a=>a.setActiveRightPanelTab);g.useEffect(()=>{const a=o=>{if((o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="A"){o.preventDefault();const{rightPanelOpen:t,activeRightPanelTab:s}=x.getState();t&&s===P?e(!1):(r(P),e(!0))}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r])}const ee="agent-hub",te={sessions:"sessions",tasks:"tasks",tools:"tools",channels:"rooms",config:null,toolkit:null,identity:null,overview:null,profile:null,personality:null};function ae(e){return(typeof e=="string"?te[e]:null)??void 0}const I=new Set(["identity","personality","channels","tools"]);function ne(){var n;const e=w(),r=D(),a=K({queryKey:["profile-location",e.profileRef],queryFn:()=>r.getSessionLocation(e.profileRef),enabled:!!e.profileRef}),o=M(m=>m.openProfileDockedFromLink),t=x(m=>m.requestRightPanel),s=x(m=>m.setExplicitAgentPath),d=Y(),l=e.panel===P,c=e.agentPath??((n=a.data)==null?void 0:n.cwd)??null,u=q(e.profilePage)??void 0,h=g.useRef(null);g.useEffect(()=>{!l&&c&&h.current!==c&&(h.current=c,s(c))},[l,c,s]);const f=g.useRef(new Map);g.useEffect(()=>{if(!l){f.current.clear();return}if(e.profileRef&&!c)return;const m=c??d;if(m){const p=f.current.get(m);if(p!==void 0&&(u===void 0||p.has(u)))return;f.current.set(m,(p??new Set).add(u??"")),o(m,u);return}t(P,null)},[l,e.profileRef,c,d,u,o,t])}function se(){const e=w(),r=G(),a=D(),o=e.panel===ee,t=e.dialog==="agent"||!!e.agent&&I.has(e.agent),s=o||t,d=o?e.hubTab:e.agent;g.useEffect(()=>{if(!s&&!e.agentPath||!r)return;let l=!1;return(async()=>{const u=e.profileRef??(e.agentPath?(await a.createSessionLocation(e.agentPath)).id:void 0);if(l)return;const h=ae(d);r({search:f=>{const n={...f};return e.dialog==="agent"&&delete n.dialog,typeof n.agent=="string"&&I.has(n.agent)&&delete n.agent,u&&(n.profileRef=u,delete n.agentPath),s&&(delete n.hubTab,n.panel=P,h?n.profilePage=h:delete n.profilePage),n},replace:!0})})().catch(()=>{}),()=>{l=!0}},[s,e.dialog,e.agentPath,e.profileRef,d,r,a])}function fe(){se(),ne(),B()}function re(){var E,b;const r=((E=z().data)==null?void 0:E.members)??[],a=r.find(y=>y.isSelf),o=J(),t=U({isShownInline:()=>o.current}),s=V({isShownInline:()=>o.current}),[d,l]=g.useState(!1),c=!a||a.displayName===j?"":a.displayName,u=(a==null?void 0:a.handle)??"",[h,f]=L(c),[n,m]=L(a?u||$(a,r):""),p=h.trim(),v=n.trim(),S=a?W(a):null,T=p.length>0&&(p!==c||S!==null),C=t.isError&&t.variables===p?Q(t.error):null,O=s.isError&&((b=s.variables)==null?void 0:b.handle)===v?Z(s.error,v):null,_=async()=>{if(!a)return!1;l(!0);let y=!0;return T&&(y=await t.mutateAsync(p).then(()=>y,()=>!1)),v&&v!==u&&(y=await s.mutateAsync({authorId:a.id,handle:v}).then(()=>y,()=>!1)),l(!1),y};return{ready:a!==void 0,name:h,setName:f,handle:n,setHandle:m,canSave:a!==void 0&&!d&&(p.length>0||v.length>0),saving:d,nameError:C,nameSuggestion:S!==null&&p===c?S:null,handleError:O,save:_}}function he({onSaved:e,confirmLabel:r="Save",onSkip:a,skipLabel:o="Skip"}){const t=re(),s=g.useId(),d=g.useId(),l=g.useId(),c=f=>{f.preventDefault(),t.canSave&&t.save().then(n=>{n&&e()})},u=t.nameError!==null||t.handleError!==null;let h=r;return t.saving?h="Saving…":u&&(h="Try again"),i.jsxs("form",{onSubmit:c,className:"flex flex-col gap-3","data-testid":"operator-identity-form",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:s,className:"text-xs",children:"Your name"}),i.jsx(R,{id:s,value:t.name,maxLength:80,autoComplete:"name",placeholder:"What you go by",disabled:!t.ready,onChange:f=>t.setName(f.target.value),className:"h-8 text-sm"}),t.nameSuggestion&&!t.nameError&&i.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.nameSuggestion,". Save it to make it yours."]}),t.nameError&&i.jsx(k,{tone:"error",children:t.nameError})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:d,className:"text-xs",children:"Handle"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-sm",children:"@"}),i.jsx(R,{id:d,value:t.handle,maxLength:64,autoComplete:"username",autoCapitalize:"none",spellCheck:!1,placeholder:"yourname","aria-describedby":l,disabled:!t.ready,onChange:f=>t.setHandle(f.target.value),className:"h-8 pl-6 text-sm"})]}),i.jsx("p",{id:l,className:"text-muted-foreground text-xs",children:"What others type after @ to reach you."}),t.handleError&&i.jsx(k,{tone:"error",children:t.handleError})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx(A,{type:"submit",size:"sm",disabled:!t.canSave,"data-testid":"confirm-identity",children:h}),a&&i.jsx(A,{type:"button",size:"sm",variant:"ghost",onClick:a,disabled:t.saving,"data-testid":"skip-identity",children:o})]})]})}export{he as O,ne as a,fe as b,ue as c,de as i,se as u};
1
+ import{bl as j,fS as F,fT as H,a_ as x,r as g,ch as P,cl as B,ct as w,fU as G,a5 as D,a6 as K,c6 as M,c1 as Y,fV as q,z,bm as W,j as i,eL as N,I as R,B as A}from"./index-B2JoVHek.js";import{d as U,c as V,n as Q,h as J}from"./profile-errors-T-3VgU7E.js";import{u as X}from"./use-mounted-ref-pxDiCOyS.js";import{u as L,F as k}from"./ProfileFields-T1f833SK.js";function Z(e){return{name:e.displayName.trim()===""||e.displayName===j,handle:!e.handle}}function de(e){const r=Z(e);return r.name||r.handle}function $(e,r){var t,s,d;const a=(d=(s=(t=e.person)==null?void 0:t.email)==null?void 0:s.split("@")[0])==null?void 0:d.trim();if(!a)return"";const o=new Set([...F,...r.filter(l=>l.id!==e.id&&l.handle).map(l=>l.handle.toLowerCase())]);return H(a,o)??""}function ue(){const e=x(a=>a.setRightPanelOpen),r=x(a=>a.setActiveRightPanelTab);g.useEffect(()=>{const a=o=>{if((o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="A"){o.preventDefault();const{rightPanelOpen:t,activeRightPanelTab:s}=x.getState();t&&s===P?e(!1):(r(P),e(!0))}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r])}const ee="agent-hub",te={sessions:"sessions",tasks:"tasks",tools:"tools",channels:"rooms",config:null,toolkit:null,identity:null,overview:null,profile:null,personality:null};function ae(e){return(typeof e=="string"?te[e]:null)??void 0}const I=new Set(["identity","personality","channels","tools"]);function ne(){var n;const e=w(),r=D(),a=K({queryKey:["profile-location",e.profileRef],queryFn:()=>r.getSessionLocation(e.profileRef),enabled:!!e.profileRef}),o=M(m=>m.openProfileDockedFromLink),t=x(m=>m.requestRightPanel),s=x(m=>m.setExplicitAgentPath),d=Y(),l=e.panel===P,c=e.agentPath??((n=a.data)==null?void 0:n.cwd)??null,u=q(e.profilePage)??void 0,h=g.useRef(null);g.useEffect(()=>{!l&&c&&h.current!==c&&(h.current=c,s(c))},[l,c,s]);const f=g.useRef(new Map);g.useEffect(()=>{if(!l){f.current.clear();return}if(e.profileRef&&!c)return;const m=c??d;if(m){const p=f.current.get(m);if(p!==void 0&&(u===void 0||p.has(u)))return;f.current.set(m,(p??new Set).add(u??"")),o(m,u);return}t(P,null)},[l,e.profileRef,c,d,u,o,t])}function se(){const e=w(),r=G(),a=D(),o=e.panel===ee,t=e.dialog==="agent"||!!e.agent&&I.has(e.agent),s=o||t,d=o?e.hubTab:e.agent;g.useEffect(()=>{if(!s&&!e.agentPath||!r)return;let l=!1;return(async()=>{const u=e.profileRef??(e.agentPath?(await a.createSessionLocation(e.agentPath)).id:void 0);if(l)return;const h=ae(d);r({search:f=>{const n={...f};return e.dialog==="agent"&&delete n.dialog,typeof n.agent=="string"&&I.has(n.agent)&&delete n.agent,u&&(n.profileRef=u,delete n.agentPath),s&&(delete n.hubTab,n.panel=P,h?n.profilePage=h:delete n.profilePage),n},replace:!0})})().catch(()=>{}),()=>{l=!0}},[s,e.dialog,e.agentPath,e.profileRef,d,r,a])}function fe(){se(),ne(),B()}function re(){var E,b;const r=((E=z().data)==null?void 0:E.members)??[],a=r.find(y=>y.isSelf),o=X(),t=U({isShownInline:()=>o.current}),s=V({isShownInline:()=>o.current}),[d,l]=g.useState(!1),c=!a||a.displayName===j?"":a.displayName,u=(a==null?void 0:a.handle)??"",[h,f]=L(c),[n,m]=L(a?u||$(a,r):""),p=h.trim(),v=n.trim(),S=a?W(a):null,T=p.length>0&&(p!==c||S!==null),C=t.isError&&t.variables===p?Q(t.error):null,_=s.isError&&((b=s.variables)==null?void 0:b.handle)===v?J(s.error,v):null,O=async()=>{if(!a)return!1;l(!0);let y=!0;return T&&(y=await t.mutateAsync(p).then(()=>y,()=>!1)),v&&v!==u&&(y=await s.mutateAsync({authorId:a.id,handle:v}).then(()=>y,()=>!1)),l(!1),y};return{ready:a!==void 0,name:h,setName:f,handle:n,setHandle:m,canSave:a!==void 0&&!d&&(p.length>0||v.length>0),saving:d,nameError:C,nameSuggestion:S!==null&&p===c?S:null,handleError:_,save:O}}function he({onSaved:e,confirmLabel:r="Save",onSkip:a,skipLabel:o="Skip"}){const t=re(),s=g.useId(),d=g.useId(),l=g.useId(),c=f=>{f.preventDefault(),t.canSave&&t.save().then(n=>{n&&e()})},u=t.nameError!==null||t.handleError!==null;let h=r;return t.saving?h="Saving…":u&&(h="Try again"),i.jsxs("form",{onSubmit:c,className:"flex flex-col gap-3","data-testid":"operator-identity-form",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:s,className:"text-xs",children:"Your name"}),i.jsx(R,{id:s,value:t.name,maxLength:80,autoComplete:"name",placeholder:"What you go by",disabled:!t.ready,onChange:f=>t.setName(f.target.value),className:"h-8 text-sm"}),t.nameSuggestion&&!t.nameError&&i.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.nameSuggestion,". Save it to make it yours."]}),t.nameError&&i.jsx(k,{tone:"error",children:t.nameError})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:d,className:"text-xs",children:"Handle"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-sm",children:"@"}),i.jsx(R,{id:d,value:t.handle,maxLength:64,autoComplete:"username",autoCapitalize:"none",spellCheck:!1,placeholder:"yourname","aria-describedby":l,disabled:!t.ready,onChange:f=>t.setHandle(f.target.value),className:"h-8 pl-6 text-sm"})]}),i.jsx("p",{id:l,className:"text-muted-foreground text-xs",children:"What others type after @ to reach you."}),t.handleError&&i.jsx(k,{tone:"error",children:t.handleError})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx(A,{type:"submit",size:"sm",disabled:!t.canSave,"data-testid":"confirm-identity",children:h}),a&&i.jsx(A,{type:"button",size:"sm",variant:"ghost",onClick:a,disabled:t.saving,"data-testid":"skip-identity",children:o})]})]})}export{he as O,ne as a,fe as b,ue as c,de as i,se as u};
@@ -0,0 +1 @@
1
+ import{j as s,eH as A,eI as P,G as k,gz as Y,a5 as E,a6 as W,gZ as R,r as N,a7 as ee,a8 as se,aJ as te,bc as ne,B as x,i2 as v,by as U,bz as L,C as D,bA as H,bC as M,U as ae,h2 as _,e as C,ba as ie,i3 as le,i4 as re,i5 as oe}from"./index-B2JoVHek.js";import{u as y,c as de,a as p,l as B,S as f,P as b,s as z,d as T,r as j,f as $,b as K,e as S,g as ce,A as ue}from"./ApplyToOverridesDialog-gSHV8ggp.js";import{s as g,C as w,T as Q}from"./trust-dial-BsEooNiu.js";const O=[{value:"blocked",label:"Blocked"},{value:"ask",label:"Ask"},{value:"allowed",label:"Allowed"}];function V({value:e,onChange:t,floor:n=!1,disabled:a=!1,className:l,"aria-label":o}){const d=n?O.filter(i=>i.value!=="allowed"):O;return s.jsx(A,{"aria-label":o,value:e??"",onValueChange:i=>t(i),disabled:a,className:k("w-full md:w-auto",l),children:d.map(i=>s.jsx(P,{value:i.value,className:k(Y,"md:min-h-0 md:min-w-16"),children:i.label},i.value))})}function me(e){const t=E();return W({queryKey:R.agent(e??""),queryFn:()=>t.getAgentPermissions(e),enabled:!!e})}function he(e){const{data:t}=y();return N.useMemo(()=>{const n=new Map;for(const a of(t==null?void 0:t.exceptions)??[]){if(a.area!==e)continue;const l=n.get(a.agentId);(!l||l.action&&!a.action)&&n.set(a.agentId,a)}return[...n.values()]},[t,e])}function xe(e){const t=E();return W({queryKey:R.history(e),queryFn:()=>t.getPermissionHistory(e?{agentId:e,limit:50}:{limit:50})})}function fe(e){var n;const t=e;return(t==null?void 0:t.code)!=="UNDO_CONFLICT"?null:((n=t.body)==null?void 0:n.conflicts)??[]}function ge(){const e=E(),t=ee();return se({mutationFn:({eventId:n,force:a})=>e.undoPermissionChange(n,a?{force:!0}:{}),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:R.all}),t.invalidateQueries({queryKey:["mesh","agents"]}),t.invalidateQueries({queryKey:te.all})}})}function F(e){const{data:t}=y();return t?de(t,e):void 0}function G({areaId:e,label:t,description:n,floor:a,value:l,sourceText:o,why:d,changed:i=!1,onChange:m,onReset:r,disabled:u=!1,footer:c,details:h}){return s.jsxs("div",{className:"@container","data-testid":`permission-row-${e}`,children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[i?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:t}),a?s.jsx(ne,{className:"text-muted-foreground size-3.5","aria-label":"Never Allowed"}):null]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:n}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:o}),d?s.jsxs(s.Fragment,{children:[o?" · ":null,d]}):null]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(V,{value:l,onChange:m,floor:a,disabled:u,"aria-label":t}),i&&r?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:r,disabled:u,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null,c]})]}),h]})}function pe({area:e,exception:t}){const n=p({kind:"agent",agentId:t.agentId}),a=()=>n.mutate({kind:"patch",...t.action?{actions:{[t.action]:null}}:{areas:{[e]:null}},surface:"settings"}),l=B(t.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[t.agentName,": ",f[t.state],t.action?" (one action)":""]}),l?s.jsx("span",{className:"text-muted-foreground block text-xs",children:l}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",onClick:a,disabled:n.isPending,"aria-label":`Reset ${t.agentName} to the default`,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function je({area:e,areaLabel:t,agents:n}){if(n.length===0)return null;const a=n.length===1?"1 agent differs":`${n.length} agents differ`;return s.jsxs(U,{children:[s.jsx(L,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start md:self-end",children:[a,s.jsx(D,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(H,{className:"w-80 space-y-2",children:[s.jsxs(M,{className:"text-sm font-medium",children:["Set differently for ",t]}),s.jsx("ul",{className:"space-y-1",children:n.map(l=>s.jsx(pe,{area:e,exception:l},l.agentId))})]})]})}function J(e,t){return e.resolved.source===(t.kind==="agent"?"agent-action":"default-action")}function Z({action:e,preset:t,agentName:n}){const a=f[e.resolved.state];return s.jsx(b,{question:`Why is ${e.title} set to ${a}${n?` for ${n}`:""}?`,sentence:z({...e.resolved,preset:t,fromExtension:e.source!==void 0}),...e.lastChange?{lastChange:e.lastChange}:{}})}function Ne({action:e,area:t,scope:n,preset:a,agentName:l,disabled:o,reset:d,onSave:i}){const m=J(e,n),r=F({kind:"action",action:e.id,area:t.id}),u=m?"Set on its own":e.alwaysAsks?e.source?"Always asks: an extension tool that can delete things":"Always asks, so you see the change first":e.resolved.destructiveAsk?"Always asks unless you set it here":`Follows ${t.label}`,c=e.tier==="observe"?"A read: Ask lets it through":null,h=n.kind==="default"&&r!==void 0?T(r):null;return s.jsxs("li",{className:"flex flex-col gap-2 py-2 @md:flex-row @md:items-center @md:justify-between","data-testid":`permission-action-${e.id}`,children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm",children:e.title}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.source?s.jsxs("span",{children:["From ",e.source.name," · "]}):null,s.jsx("span",{children:u}),c?s.jsxs("span",{children:[" · ",c]}):null,h?s.jsxs("span",{children:[" · ",h]}):null," ·"," ",s.jsx(Z,{action:e,preset:a,...l?{agentName:l}:{}})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[m?d:null,s.jsx(V,{value:e.resolved.state,floor:t.floor||e.alwaysAsks===!0,disabled:o,"aria-label":e.title,onChange:I=>{I!==e.resolved.state&&i(I)}})]})]})}function X({scope:e,area:t,surface:n,preset:a,agentName:l}){const o=p(e),[d,i]=N.useState(!1);if(t.actions.length===0)return null;const m=t.actions.filter(c=>J(c,e)),r=(c,h)=>o.mutate({kind:"patch",actions:{[c.id]:h},surface:n},{onError:j}),u=c=>s.jsxs(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:o.isPending,"aria-label":`Put ${c.title} back to ${t.label}`,onClick:()=>r(c,null),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]});return s.jsxs("div",{className:"flex flex-col items-start gap-1 pb-3","data-testid":`permission-actions-${t.id}`,children:[!d&&m.length>0?s.jsx("ul",{className:"w-full space-y-1","data-testid":`permission-action-exceptions-${t.id}`,children:m.map(c=>s.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[s.jsxs("span",{className:"text-muted-foreground min-w-0",children:[s.jsxs("span",{children:["Except ",c.title,": ",f[c.resolved.state]]})," ","·"," ",s.jsx(Z,{action:c,preset:a,...l?{agentName:l}:{}})]}),u(c)]},c.id))}):null,s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground -ml-2 h-7 px-2 text-xs","aria-expanded":d,onClick:()=>i(c=>!c),children:[s.jsx(ae,{className:k("size-3.5 transition-transform",d&&"rotate-180"),"aria-hidden":!0}),d?"Hide individual actions":"Show individual actions"]}),d?s.jsx("ul",{className:"divide-border w-full divide-y","aria-label":`${t.label} actions`,children:t.actions.map(c=>s.jsx(Ne,{action:c,area:t,scope:e,preset:a,...l?{agentName:l}:{},disabled:o.isPending,reset:u(c),onSave:h=>r(c,h)},c.id))}):null]})}function ve({agentId:e,agentName:t,files:n}){const a=p({kind:"agent",agentId:e}),l=n.source==="agent",o=n.inherited.stop,d=n.stop,i=r=>a.mutate({kind:"patch",filesAndCommands:r,surface:"agent-page"},{onError:j}),m=o?`${l?`Everyone else: ${g(o)}`:`Same as everyone (${g(o)})`}${n.inherited.source==="runtime"?` · ${$("runtime")}`:""}`:$(n.inherited.source);return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[l?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands in this agent’s chats"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:m})," ·"," ",s.jsx(b,{question:`Why is Files & commands ${d?`set to ${g(d)}`:"not set"} for ${t}?`,sentence:K(d,n.source),...n.lastChange?{lastChange:n.lastChange}:{}})]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:d??"",disabled:a.isPending,onValueChange:r=>{r&&r!==d&&i(r)},children:w.map(r=>s.jsxs(P,{value:r.id,"aria-label":r.label,children:[s.jsx(Q,{descriptor:r,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:r.label})]},r.id))}),l?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:()=>i(null),disabled:a.isPending,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null]})]}),s.jsx(_,{descriptor:w.find(r=>r.stop===d),className:"pb-3"})]})}function Te({files:e,preset:t,onChange:n,disabled:a=!1,runtimeLabel:l=o=>o}){const o=F({kind:"files"}),d=e.stop===null?$("runtime-own"):e.stop===e.presetStop?`From ${S[t??"trusted"]}`:"Changed from your preset";return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:[d,o!==void 0?T(o):""].filter(Boolean).join(" · ")})," ","·"," ",s.jsx(b,{question:`Why is Files & commands ${e.stop?`set to ${g(e.stop)}`:"not set"}?`,sentence:K(e.stop,e.stop===null?"runtime-own":"default"),...e.lastChange?{lastChange:e.lastChange}:{}})]}),e.runtimes.map(i=>s.jsxs("p",{className:"text-muted-foreground text-xs",children:[l(i.runtime)," starts at ",g(i.stop)," (Settings → Runtimes)"]},i.runtime))]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:e.stop??"",disabled:a,onValueChange:i=>{i&&i!==e.stop&&n(i)},children:w.map(i=>s.jsxs(P,{value:i.id,"aria-label":i.label,children:[s.jsx(Q,{descriptor:i,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:i.label})]},i.id))}),s.jsx(we,{agents:e.exceptions})]})]}),s.jsx(_,{descriptor:w.find(i=>i.stop===e.stop),className:"pb-3"})]})}function be({agent:e}){const t=p({kind:"agent",agentId:e.agentId}),n=B(e.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[e.agentName,": ",g(e.stop)]}),n?s.jsx("span",{className:"text-muted-foreground block text-xs",children:n}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",disabled:t.isPending,"aria-label":`Reset ${e.agentName} to the default`,onClick:()=>t.mutate({kind:"patch",filesAndCommands:null,surface:"settings"},{onError:j}),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function we({agents:e}){return e.length===0?null:s.jsxs(U,{children:[s.jsx(L,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start @lg:self-end",children:[e.length===1?"1 agent differs":`${e.length} agents differ`,s.jsx(D,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(H,{className:"w-80 space-y-2",children:[s.jsx(M,{className:"text-sm font-medium",children:"Set differently for Files & commands"}),s.jsx("ul",{className:"space-y-1",children:e.map(t=>s.jsx(be,{agent:t},t.agentId))})]})]})}function q(e){return e.filter(t=>t.kind==="state")}function ye({area:e,overview:t}){const n=p({kind:"default"}),a=he(e.id),l=F({kind:"area",area:e.id})??0,[o,d]=N.useState(null),i=(r,u)=>{n.mutate({kind:"patch",areas:{[e.id]:r},...u&&u.length>0?{applyToAgents:u}:{},surface:"settings"},{onError:j,onSettled:()=>d(null)})},m=r=>{r!==e.resolved.state&&(a.length>0?d(r):i(r))};return s.jsxs(s.Fragment,{children:[s.jsx(G,{areaId:e.id,label:e.label,description:e.description,floor:e.floor,value:e.resolved.state,sourceText:[ce(e.resolved.source,t.preset),T(l)].filter(Boolean).join(" · "),why:s.jsx(b,{question:`Why is ${e.label} set to ${f[e.resolved.state]}?`,sentence:z({...e.resolved,preset:t.preset}),...e.lastChange?{lastChange:e.lastChange}:{}}),onChange:m,disabled:n.isPending,footer:s.jsx(je,{area:e.id,areaLabel:e.label,agents:a}),details:s.jsx(X,{scope:{kind:"default"},area:e,surface:"settings",preset:t.preset})}),s.jsx(ue,{open:o!==null,onCancel:()=>d(null),subject:e.label,next:o??"ask",agents:a.map(r=>({agentId:r.agentId,agentName:r.agentName,detail:`${f[r.state]}${r.action?" (one action)":""}`})),affectedCount:l,onKeep:()=>o&&i(o),onUpdate:r=>o&&i(o,r),pending:n.isPending})]})}function ke({agentId:e,agentName:t,area:n}){var r;const a=((r=y().data)==null?void 0:r.preset)??null,l=p({kind:"agent",agentId:e}),o=n.resolved.source==="agent-area"||n.resolved.source==="agent-action",d=o?`Everyone else: ${f[n.inherited.state]}`:`Same as everyone (${f[n.inherited.state]})`,i=n.changedOutsideAt?`Changed outside DorkOS · ${d}`:d,m=u=>l.mutate({kind:"patch",areas:{[n.id]:u},surface:"agent-page"},{onError:j});return s.jsx(G,{areaId:n.id,label:n.label,description:n.description,floor:n.floor,value:n.resolved.state,sourceText:i,why:s.jsx(b,{question:`Why is ${n.label} set to ${f[n.resolved.state]} for ${t}?`,sentence:z({...n.resolved,preset:a}),...n.lastChange?{lastChange:n.lastChange}:{}}),changed:o,onChange:u=>{u!==n.resolved.state&&m(u)},onReset:()=>m(null),disabled:l.isPending,details:s.jsx(X,{scope:{kind:"agent",agentId:e},area:n,surface:"agent-page",preset:a,agentName:t})})}function Fe({scope:e}){const t=y(),n=me(e.kind==="agent"?e.agentId:void 0);return e.kind==="default"?t.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the permissions."}):t.data?s.jsx("div",{className:"divide-border divide-y","data-testid":"permission-list-default",children:q(t.data.areas).map(a=>s.jsx(ye,{area:a,overview:t.data},a.id))}):s.jsx(C,{className:"h-20 w-full"}):n.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s permissions."}):n.data?s.jsxs("div",{className:"divide-border divide-y","data-testid":"permission-list-agent",children:[s.jsx(ve,{agentId:e.agentId,agentName:n.data.agentName,files:n.data.filesAndCommands}),q(n.data.areas).map(a=>s.jsx(ke,{agentId:e.agentId,agentName:n.data.agentName,area:a},a.id))]}):s.jsx(C,{className:"h-20 w-full"})}function Ce(e,t){if(t.key.kind==="chat")return le(e);if(t.key.kind==="account")return re(e);if(e===null)return t.target.kind==="agent"?"the default":"the preset";switch(t.key.kind){case"files":return $e(e)?g(e):e;case"preset":return e in S?S[e]:e;default:return e in f?f[e]:e}}function $e(e){return oe.includes(e)}function Se(e){if(e.length===1){const{change:t}=e[0];return`This has changed since. Set it back to ${Ce(t.before,t)} anyway?`}return"Some of this has changed since. Set it all back anyway?"}function Ae(e){if(e.suggestionRestored)return null;if(e.changes.length===0&&e.skipped.length===0)return"Nothing to undo. It was already back.";if(e.skipped.length===0)return null;const t=e.changes.length,n=`Undid ${t} ${t===1?"change":"changes"}.`,a=e.skipped.filter(i=>i.reason==="changed-since").length,l=e.skipped.filter(i=>i.reason==="floor").length,o=e.skipped.filter(i=>i.reason==="gone").length,d=[];if(a>0&&d.push(`${a} had changed since and ${a===1?"was":"were"} left alone.`),l>0&&d.push(`${l} can’t be set to Allowed and ${l===1?"was":"were"} left alone.`),o>0&&d.push(`${o} ${o===1?"was about an agent":"were about agents"} no longer here.`),d.length>1){const i=e.skipped.length;return`${n} ${i} ${i===1?"was":"were"} left alone.`}return[n,...d].join(" ")}function Pe({item:e}){const t=ge(),[n,a]=N.useState(null),[l,o]=N.useState(null),d=e.undone,i=e.undoable&&!d,m=ie(e.occurredAt),r=u=>t.mutate({eventId:e.id,...u?{force:!0}:{}},{onSuccess:c=>{a(null),o(Ae(c))},onError:c=>{const h=fe(c);h?a(h):j(c)}});return s.jsxs("li",{className:"space-y-1","data-testid":"permission-history-row",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[s.jsx("p",{className:"text-sm",children:e.summary}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.actorLabel," · ",m]}),e.actorDetail?s.jsx("p",{className:"text-muted-foreground text-xs",children:e.actorDetail}):null]}),d?s.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5 text-xs",children:"Undone"}):i&&n===null?s.jsx(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:t.isPending,"aria-label":`Undo: ${e.summary}, ${m}`,onClick:()=>r(!1),children:"Undo"}):null]}),n!==null?s.jsxs("div",{role:"group","aria-label":"Undo conflict",className:"bg-muted/50 flex flex-col gap-2 rounded-md p-2 @md:flex-row @md:items-center @md:justify-between",children:[s.jsx("p",{className:"text-sm",children:Se(n)}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(x,{variant:"outline",size:"sm",disabled:t.isPending,onClick:()=>a(null),children:"Cancel"}),s.jsx(x,{size:"sm",disabled:t.isPending,onClick:()=>r(!0),children:"Set it back"})]})]}):null,l?s.jsx("p",{className:"text-muted-foreground text-xs",role:"status",children:l}):null]})}function Ie({agentId:e}){const{data:t,isPending:n,isError:a}=xe(e);if(a)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the history."});if(n)return s.jsx(C,{className:"h-12 w-full"});const l=(t==null?void 0:t.items)??[];return l.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No permission changes yet."}):s.jsx("ul",{className:"@container space-y-3","aria-label":"Permission history",children:l.map(o=>s.jsx(Pe,{item:o},o.id))})}export{Te as D,Fe as P,Ie as a};
@@ -1 +1 @@
1
- import{y as n,j as s}from"./index-BR1m9FON.js";import{P as a,a as m}from"./PermissionHistory-D0chstxf.js";import{R as r}from"./ApplyToOverridesDialog-CnL1ubxL.js";import"./trust-dial-D__tIhzt.js";import"./zap-DSllMMHe.js";function x({member:t}){var o;const e=n((o=t.agent)==null?void 0:o.runtime),i=(e==null?void 0:e.supportsMcp)??!0;return s.jsxs("div",{className:"space-y-6",children:[i?null:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent can’t use DorkOS tools, so these don’t apply."}),s.jsx(a,{scope:{kind:"agent",agentId:t.id}}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[r[0]," ",r[1]]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"History"}),s.jsx(m,{agentId:t.id})]})]})}export{x as PermissionsPage};
1
+ import{y as n,j as s}from"./index-B2JoVHek.js";import{P as a,a as m}from"./PermissionHistory-BAe31Nl3.js";import{R as r}from"./ApplyToOverridesDialog-gSHV8ggp.js";import"./trust-dial-BsEooNiu.js";import"./zap-C-pr1sst.js";function x({member:t}){var o;const e=n((o=t.agent)==null?void 0:o.runtime),i=(e==null?void 0:e.supportsMcp)??!0;return s.jsxs("div",{className:"space-y-6",children:[i?null:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent can’t use DorkOS tools, so these don’t apply."}),s.jsx(a,{scope:{kind:"agent",agentId:t.id}}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[r[0]," ",r[1]]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"History"}),s.jsx(m,{agentId:t.id})]})]})}export{x as PermissionsPage};
@@ -1 +1 @@
1
- import{b as n,j as t,e as i}from"./index-BR1m9FON.js";import{u as m,P as p}from"./use-personality-commit-Chf3UX8P.js";import"./dorkbot-templates-8Yu9POWJ.js";import"./sound-D3r8dGFH.js";import"./soul-file-CbX7rNqz.js";function P({member:r}){const{agent:e,isPending:o,update:a}=n(r),s=m(e,a);return o?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(p,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{P as PersonalityPopover};
1
+ import{b as n,j as t,e as i}from"./index-B2JoVHek.js";import{u as m,P as p}from"./use-personality-commit-Dl3YK7Qd.js";import"./dorkbot-templates-8Yu9POWJ.js";import"./sound-D3r8dGFH.js";import"./soul-file-ITCKiDY9.js";function P({member:r}){const{agent:e,isPending:o,update:a}=n(r),s=m(e,a);return o?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(p,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{P as PersonalityPopover};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-B2JoVHek.js";import{b as t}from"./ProfileFields-T1f833SK.js";import"./profile-errors-T-3VgU7E.js";import"./use-mounted-ref-pxDiCOyS.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
@@ -1 +1 @@
1
- import{e0 as o,e1 as u,e2 as d,a5 as l,a6 as f,ac as h,j as n}from"./index-BR1m9FON.js";import{S as p}from"./shield-x-CEWfkzDN.js";const m={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function v(e){return m[e]??!1}function x(e){try{return d.toString(e)}catch{return`On the schedule ${e}`}}function w(e){const s=e.cron?x(e.cron):"Runs only when you ask",t=o(e.startsEnabled);return`${s}, ${t}. This job ${u(e.permissionMode)}.`}function g(e,s){const t=l(),{enabled:r=!0,...a}=s??{},i=Object.keys(a).length>0;return f({queryKey:h.permissionPreview(e??"",i?a:void 0),queryFn:()=>t.previewMarketplacePackage(e,i?a:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function c(e){const s=e==null?void 0:e.body,t=Array.isArray(s==null?void 0:s.errors)?s.errors.filter(r=>typeof r=="string"):[];return t.length>0?{reasons:t,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function b(e){return c(e).checked}function j({error:e}){const{reasons:s,checked:t}=c(e);return n.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[n.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[n.jsx(p,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:t?"What it found:":"It couldn’t check what this package does."}),s.length>0&&n.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:s.map(r=>n.jsx("li",{children:r},r))})]})}export{j as P,w as d,b as i,v as r,g as u};
1
+ import{e0 as o,e1 as u,e2 as d,a5 as l,a6 as f,ac as h,j as n}from"./index-B2JoVHek.js";import{S as p}from"./shield-x-B2nLbkhR.js";const m={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function v(e){return m[e]??!1}function x(e){try{return d.toString(e)}catch{return`On the schedule ${e}`}}function w(e){const s=e.cron?x(e.cron):"Runs only when you ask",t=o(e.startsEnabled);return`${s}, ${t}. This job ${u(e.permissionMode)}.`}function g(e,s){const t=l(),{enabled:r=!0,...a}=s??{},i=Object.keys(a).length>0;return f({queryKey:h.permissionPreview(e??"",i?a:void 0),queryFn:()=>t.previewMarketplacePackage(e,i?a:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function c(e){const s=e==null?void 0:e.body,t=Array.isArray(s==null?void 0:s.errors)?s.errors.filter(r=>typeof r=="string"):[];return t.length>0?{reasons:t,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function b(e){return c(e).checked}function j({error:e}){const{reasons:s,checked:t}=c(e);return n.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[n.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[n.jsx(p,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:t?"What it found:":"It couldn’t check what this package does."}),s.length>0&&n.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:s.map(r=>n.jsx("li",{children:r},r))})]})}export{j as P,w as d,b as i,v as r,g as u};
@@ -1 +1 @@
1
- import{r as p,t as E,j as e,bh as m,bi as g,bj as x,g as y,B as u,I as f,bk as j,bl as b}from"./index-BR1m9FON.js";import{u as k,a as C,b as v,c as A,h as I,d as F,n as D}from"./profile-errors-C1XACbc9.js";import{u as N}from"./use-mounted-ref-IHwyriaF.js";function P(a){const[n,t]=p.useState(a),[r,i]=p.useState(a);return r!==a&&(i(a),t(a)),[n,t]}const M="image/png,image/jpeg,image/webp";function l({tone:a,children:n}){return e.jsx("p",{role:a==="error"?"alert":"status",className:a==="error"?"text-destructive text-xs":"text-muted-foreground text-xs",children:n})}function H({member:a}){const n=E(a),t=p.useRef(null),r=k(),i=C();function c(s){const o=s==null?void 0:s[0];o&&(r.mutate({file:o}),t.current&&(t.current.value=""))}return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Photo",description:"PNG, JPEG or WebP, up to 2 MB.",orientation:"vertical",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{size:"lg",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:t,type:"file",accept:M,className:"hidden","data-testid":"profile-photo-input",onChange:s=>c(s.target.files)}),e.jsx(u,{size:"sm",variant:"outline",disabled:r.isPending,onClick:()=>{var s;return(s=t.current)==null?void 0:s.click()},children:a.imageUrl?"Change photo":"Upload a photo"}),a.imageUrl&&e.jsx(u,{size:"sm",variant:"ghost",disabled:i.isPending,onClick:()=>i.mutate(),children:"Remove"})]})]})}),r.isError&&e.jsx(l,{tone:"error",children:v(r.error)}),i.isError&&e.jsx(l,{tone:"error",children:v(i.error)})]})})}function L({member:a}){const n=N(),t=F({isShownInline:()=>n.current}),r=a.displayName===j?"":a.displayName,[i,c]=P(r),s=b(a),o=i.trim().length>0&&i.trim()!==r,d=i.trim().length>0&&(o||s!==null);return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Display name",description:s?`${s}. Save it to make it yours.`:"What DorkOS calls you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:i,maxLength:80,"aria-label":"Display name",placeholder:j,onChange:h=>c(h.target.value)}),e.jsx(u,{size:"sm",disabled:!d||t.isPending,onClick:()=>t.mutate(i.trim()),children:"Save"})]})}),t.isError&&e.jsx(l,{tone:"error",children:D(t.error)}),t.isSuccess&&i.trim()===t.variables&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function z({member:a}){var d,h;const n=N(),t=A({isShownInline:()=>n.current}),[r,i]=P(a.handle??""),c=r.trim()!==(a.handle??""),s=a.kind==="agent",o=s?(d=a.agent)==null?void 0:d.authorId:a.id;return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Handle",description:s?"What others type after @ to reach this agent.":"What others type after @ to reach you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:r,maxLength:64,placeholder:s?"agentname":"yourname","aria-label":"Handle",disabled:!o,onChange:S=>i(S.target.value)}),e.jsx(u,{size:"sm",disabled:!o||!c||t.isPending,onClick:()=>o&&t.mutate({authorId:o,handle:r.trim()}),children:"Save"})]})}),!o&&e.jsx(l,{tone:"ok",children:"It gets a handle when it first joins a room."}),t.isError&&e.jsx(l,{tone:"error",children:I(t.error,r.trim())}),t.isSuccess&&r.trim()===((h=t.variables)==null?void 0:h.handle)&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function T({member:a}){var n,t;return e.jsx(m,{children:e.jsx(g,{children:e.jsx(x,{label:"Email",description:(n=a.person)!=null&&n.email?"Your sign-in email. It stays fixed.":"No login on this machine. Turn one on in Settings › Login & security.",orientation:"vertical",children:e.jsx(f,{readOnly:!0,"aria-label":"Email",value:((t=a.person)==null?void 0:t.email)??"",placeholder:"No email on this machine",className:"text-muted-foreground"})})})})}export{l as F,L as P,z as a,H as b,T as c,P as u};
1
+ import{r as p,t as E,j as e,bi as m,bj as g,bk as x,g as y,B as u,I as f,bl as j,bm as b}from"./index-B2JoVHek.js";import{u as k,a as C,b as v,c as A,h as I,d as F,n as D}from"./profile-errors-T-3VgU7E.js";import{u as N}from"./use-mounted-ref-pxDiCOyS.js";function P(a){const[n,t]=p.useState(a),[r,i]=p.useState(a);return r!==a&&(i(a),t(a)),[n,t]}const M="image/png,image/jpeg,image/webp";function l({tone:a,children:n}){return e.jsx("p",{role:a==="error"?"alert":"status",className:a==="error"?"text-destructive text-xs":"text-muted-foreground text-xs",children:n})}function H({member:a}){const n=E(a),t=p.useRef(null),r=k(),i=C();function c(s){const o=s==null?void 0:s[0];o&&(r.mutate({file:o}),t.current&&(t.current.value=""))}return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Photo",description:"PNG, JPEG or WebP, up to 2 MB.",orientation:"vertical",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{size:"lg",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:t,type:"file",accept:M,className:"hidden","data-testid":"profile-photo-input",onChange:s=>c(s.target.files)}),e.jsx(u,{size:"sm",variant:"outline",disabled:r.isPending,onClick:()=>{var s;return(s=t.current)==null?void 0:s.click()},children:a.imageUrl?"Change photo":"Upload a photo"}),a.imageUrl&&e.jsx(u,{size:"sm",variant:"ghost",disabled:i.isPending,onClick:()=>i.mutate(),children:"Remove"})]})]})}),r.isError&&e.jsx(l,{tone:"error",children:v(r.error)}),i.isError&&e.jsx(l,{tone:"error",children:v(i.error)})]})})}function L({member:a}){const n=N(),t=F({isShownInline:()=>n.current}),r=a.displayName===j?"":a.displayName,[i,c]=P(r),s=b(a),o=i.trim().length>0&&i.trim()!==r,d=i.trim().length>0&&(o||s!==null);return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Display name",description:s?`${s}. Save it to make it yours.`:"What DorkOS calls you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:i,maxLength:80,"aria-label":"Display name",placeholder:j,onChange:h=>c(h.target.value)}),e.jsx(u,{size:"sm",disabled:!d||t.isPending,onClick:()=>t.mutate(i.trim()),children:"Save"})]})}),t.isError&&e.jsx(l,{tone:"error",children:D(t.error)}),t.isSuccess&&i.trim()===t.variables&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function z({member:a}){var d,h;const n=N(),t=A({isShownInline:()=>n.current}),[r,i]=P(a.handle??""),c=r.trim()!==(a.handle??""),s=a.kind==="agent",o=s?(d=a.agent)==null?void 0:d.authorId:a.id;return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Handle",description:s?"What others type after @ to reach this agent.":"What others type after @ to reach you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:r,maxLength:64,placeholder:s?"agentname":"yourname","aria-label":"Handle",disabled:!o,onChange:S=>i(S.target.value)}),e.jsx(u,{size:"sm",disabled:!o||!c||t.isPending,onClick:()=>o&&t.mutate({authorId:o,handle:r.trim()}),children:"Save"})]})}),!o&&e.jsx(l,{tone:"ok",children:"It gets a handle when it first joins a room."}),t.isError&&e.jsx(l,{tone:"error",children:I(t.error,r.trim())}),t.isSuccess&&r.trim()===((h=t.variables)==null?void 0:h.handle)&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function T({member:a}){var n,t;return e.jsx(m,{children:e.jsx(g,{children:e.jsx(x,{label:"Email",description:(n=a.person)!=null&&n.email?"Your sign-in email. It stays fixed.":"No login on this machine. Turn one on in Settings › Login & security.",orientation:"vertical",children:e.jsx(f,{readOnly:!0,"aria-label":"Email",value:((t=a.person)==null?void 0:t.email)??"",placeholder:"No email on this machine",className:"text-muted-foreground"})})})})}export{l as F,L as P,z as a,H as b,T as c,P as u};
@@ -1 +1 @@
1
- import{r as f,j as t,bh as D,bi as R,bj as E,ew as H,ex as M,ey as _,ez as A,eA as Z,G as V,I as v,B as P,z as B}from"./index-BR1m9FON.js";import{F as j,b as K,P as Y,a as $,c as G}from"./ProfileFields-DU8dTGHT.js";import{u as I,P as q,b as J}from"./ProfileRolePicker-DrOtV-0N.js";function U(e,s){if(e.length!==s.length)return!1;const n=new Set(s);return e.every(r=>n.has(r))}function Q(){const{roles:e,isLoading:s,saveRoles:n}=I(),[r,i]=f.useState(e),[l,o]=f.useState(e),[d,u]=f.useState("idle"),[x,m]=f.useState(null);!s&&!U(l,e)&&(o(e),i(e));const h=()=>{u("saving"),n(r).then(()=>{u("idle"),m(r)}).catch(()=>u("error"))};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-3",children:[t.jsx(E,{label:"What kind of work you do",description:"Only DorkBot and your agents read this. It stays on this machine.",orientation:"vertical",children:t.jsx(q,{selected:r,onChange:i,onConfirm:h,confirmLabel:d==="saving"?"Saving…":"Save",busy:d==="saving"||s})}),d==="error"&&t.jsx(j,{tone:"error",children:"Couldn’t save that. Try again."}),d!=="error"&&x&&U(r,x)&&t.jsx(j,{tone:"ok",children:"Saved."})]})})}const X=Object.freeze({days:[1,2,3,4,5],start:"09:00",end:"17:00"});function ee(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}const k=new Map;function te(e){let s=k.get(e);return s||(s=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short"}),k.set(e,s)),s}const ne={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function w(e,s){const n={};for(const r of te(s).formatToParts(new Date(e)))n[r.type]=r.value;return{year:Number(n.year),month:Number(n.month),day:Number(n.day),hour:Number(n.hour),minute:Number(n.minute),second:Number(n.second),weekday:ne[n.weekday??""]??0}}function z(e,s){const n=w(e,s);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-Math.floor(e/1e3)*1e3}function se(e){const[s,n]=e.split(":").map(Number);return(s??0)*60+(n??0)}function ae(e,s,n,r,i){const l=se(r),o=Date.UTC(e,s-1,n,Math.floor(l/60),l%60),d=o-z(o-864e5,i),u=o-z(o+864e5,i),x=h=>{const y=w(h,i);return y.year===e&&y.month===s&&y.day===n&&y.hour*60+y.minute===l},m=[d,u].filter(x);return m.length>0?Math.min(...m):Math.max(d,u)}function re(e,s,n){const[r,i,l]=e.split("-").map(Number);return new Date(ae(r??1970,i??1,l??1,s,n))}function oe(e,s){const n=w(e.getTime(),s);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}const ie=[{day:1,short:"M",name:"Monday"},{day:2,short:"T",name:"Tuesday"},{day:3,short:"W",name:"Wednesday"},{day:4,short:"T",name:"Thursday"},{day:5,short:"F",name:"Friday"},{day:6,short:"S",name:"Saturday"},{day:0,short:"S",name:"Sunday"}];function le(e){const s=typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[];return s.includes(e)?s:[e,...s]}function de(e,s,n){const r=e??J()??ee(),i=s??X;return{timezone:r,days:[...i.days],start:i.start,end:i.end,awayUntil:n!=null&&n.until?oe(new Date(n.until),r):""}}function b(e,s){return e.timezone===s.timezone&&e.start===s.start&&e.end===s.end&&e.awayUntil===s.awayUntil&&[...e.days].sort().join()===[...s.days].sort().join()}function ue(e){return e.days.length===0?"Pick at least one working day.":!e.start||!e.end?"Set a start and an end time.":e.end<=e.start?"The day has to end after it starts.":null}function ce(e,s,n){return e.awayUntil===s.awayUntil?n:e.awayUntil?{...n,until:re(e.awayUntil,"00:00",e.timezone).toISOString()}:null}function me(){const{timezone:e,workingHours:s,away:n,isLoading:r,saveHours:i}=I(),l=de(e,s,n),[o,d]=f.useState(l),[u,x]=f.useState(l),[m,h]=f.useState("idle"),[y,C]=f.useState(null),[F,O]=f.useState(null);!r&&!b(u,l)&&(x(l),d(l));const p=ue(o),g=a=>d(c=>({...c,...a})),W=a=>g({days:o.days.includes(a)?o.days.filter(c=>c!==a):[...o.days,a]}),L=()=>{if(p)return;h("saving");const a=o;i({timezone:a.timezone,workingHours:{days:[...a.days].sort((c,S)=>c-S),start:a.start,end:a.end},away:ce(a,u,n)}).then(()=>{h("idle"),C(null),O(a)}).catch(c=>{h("error"),C(c instanceof Error?c.message:null)})};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-4",children:[t.jsx(E,{label:"Your hours",description:"Your time zone and working hours.",orientation:"vertical",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-timezone",className:"text-muted-foreground text-xs",children:"Time zone"}),t.jsxs(H,{value:o.timezone,onValueChange:a=>g({timezone:a}),children:[t.jsx(M,{id:"profile-timezone",className:"h-8 text-sm",responsive:!1,children:t.jsx(_,{})}),t.jsx(A,{children:le(o.timezone).map(a=>t.jsx(Z,{value:a,responsive:!1,children:a.replace(/_/g," ")},a))})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{id:"profile-days-label",className:"text-muted-foreground text-xs",children:"Working days"}),t.jsx("div",{role:"group","aria-labelledby":"profile-days-label",className:"flex gap-1",children:ie.map(({day:a,short:c,name:S})=>{const T=o.days.includes(a);return t.jsx("button",{type:"button","aria-label":S,"aria-pressed":T,onClick:()=>W(a),className:V("size-8 rounded-md border text-xs font-medium",T?"bg-primary text-primary-foreground border-transparent":"text-muted-foreground hover:bg-accent"),children:c},a)})})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-start",className:"text-muted-foreground text-xs",children:"Start"}),t.jsx(v,{id:"profile-hours-start",type:"time",value:o.start,onChange:a=>g({start:a.target.value})})]}),t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-end",className:"text-muted-foreground text-xs",children:"End"}),t.jsx(v,{id:"profile-hours-end",type:"time",value:o.end,onChange:a=>g({end:a.target.value})})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-away-until",className:"text-muted-foreground text-xs",children:"Away until"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(v,{id:"profile-away-until",type:"date",value:o.awayUntil,onChange:a=>g({awayUntil:a.target.value})}),o.awayUntil&&t.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>g({awayUntil:""}),children:"Clear"})]})]})]})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(P,{type:"button",size:"sm",onClick:L,disabled:r||m==="saving"||p!==null||b(o,u),children:m==="saving"?"Saving…":"Save"}),p&&t.jsx(j,{tone:"error",children:p}),!p&&m==="error"&&t.jsx(j,{tone:"error",children:y??"Couldn’t save that. Try again."}),!p&&m!=="error"&&F&&b(o,F)&&t.jsx(j,{tone:"ok",children:"Saved."})]})]})})}function fe({member:e}){return t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"How you appear on your team page, in rooms and beside your messages."}),t.jsx(K,{member:e}),t.jsx(Y,{member:e}),t.jsx($,{member:e}),t.jsx(G,{member:e}),t.jsx(Q,{}),t.jsx(me,{})]})}function N({children:e}){return t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:e})}function pe(){var n;const e=B(),s=(n=e.data)==null?void 0:n.members.find(r=>r.isSelf);return e.isPending?t.jsx(N,{children:"Loading your profile…"}):e.isError?t.jsx(N,{children:"Couldn’t load your profile. Reopen this tab to try again."}):s?t.jsx(fe,{member:s}):t.jsx(N,{children:"Couldn’t find your profile. Reopen this tab to try again."})}export{fe as P,pe as a};
1
+ import{r as f,j as t,bi as D,bj as R,bk as E,ew as H,ex as M,ey as _,ez as A,eA as Z,G as V,I as v,B as P,z as B}from"./index-B2JoVHek.js";import{F as j,b as K,P as Y,a as $,c as G}from"./ProfileFields-T1f833SK.js";import{u as I,P as q,b as J}from"./ProfileRolePicker-CpAhjq-e.js";function k(e,s){if(e.length!==s.length)return!1;const n=new Set(s);return e.every(r=>n.has(r))}function Q(){const{roles:e,isLoading:s,saveRoles:n}=I(),[r,i]=f.useState(e),[l,o]=f.useState(e),[d,u]=f.useState("idle"),[x,m]=f.useState(null);!s&&!k(l,e)&&(o(e),i(e));const h=()=>{u("saving"),n(r).then(()=>{u("idle"),m(r)}).catch(()=>u("error"))};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-3",children:[t.jsx(E,{label:"What kind of work you do",description:"Only DorkBot and your agents read this. It stays on this machine.",orientation:"vertical",children:t.jsx(q,{selected:r,onChange:i,onConfirm:h,confirmLabel:d==="saving"?"Saving…":"Save",busy:d==="saving"||s})}),d==="error"&&t.jsx(j,{tone:"error",children:"Couldn’t save that. Try again."}),d!=="error"&&x&&k(r,x)&&t.jsx(j,{tone:"ok",children:"Saved."})]})})}const X=Object.freeze({days:[1,2,3,4,5],start:"09:00",end:"17:00"});function ee(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}const U=new Map;function te(e){let s=U.get(e);return s||(s=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short"}),U.set(e,s)),s}const ne={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function w(e,s){const n={};for(const r of te(s).formatToParts(new Date(e)))n[r.type]=r.value;return{year:Number(n.year),month:Number(n.month),day:Number(n.day),hour:Number(n.hour),minute:Number(n.minute),second:Number(n.second),weekday:ne[n.weekday??""]??0}}function z(e,s){const n=w(e,s);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-Math.floor(e/1e3)*1e3}function se(e){const[s,n]=e.split(":").map(Number);return(s??0)*60+(n??0)}function ae(e,s,n,r,i){const l=se(r),o=Date.UTC(e,s-1,n,Math.floor(l/60),l%60),d=o-z(o-864e5,i),u=o-z(o+864e5,i),x=h=>{const y=w(h,i);return y.year===e&&y.month===s&&y.day===n&&y.hour*60+y.minute===l},m=[d,u].filter(x);return m.length>0?Math.min(...m):Math.max(d,u)}function re(e,s,n){const[r,i,l]=e.split("-").map(Number);return new Date(ae(r??1970,i??1,l??1,s,n))}function oe(e,s){const n=w(e.getTime(),s);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}const ie=[{day:1,short:"M",name:"Monday"},{day:2,short:"T",name:"Tuesday"},{day:3,short:"W",name:"Wednesday"},{day:4,short:"T",name:"Thursday"},{day:5,short:"F",name:"Friday"},{day:6,short:"S",name:"Saturday"},{day:0,short:"S",name:"Sunday"}];function le(e){const s=typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[];return s.includes(e)?s:[e,...s]}function de(e,s,n){const r=e??J()??ee(),i=s??X;return{timezone:r,days:[...i.days],start:i.start,end:i.end,awayUntil:n!=null&&n.until?oe(new Date(n.until),r):""}}function b(e,s){return e.timezone===s.timezone&&e.start===s.start&&e.end===s.end&&e.awayUntil===s.awayUntil&&[...e.days].sort().join()===[...s.days].sort().join()}function ue(e){return e.days.length===0?"Pick at least one working day.":!e.start||!e.end?"Set a start and an end time.":e.end<=e.start?"The day has to end after it starts.":null}function ce(e,s,n){return e.awayUntil===s.awayUntil?n:e.awayUntil?{...n,until:re(e.awayUntil,"00:00",e.timezone).toISOString()}:null}function me(){const{timezone:e,workingHours:s,away:n,isLoading:r,saveHours:i}=I(),l=de(e,s,n),[o,d]=f.useState(l),[u,x]=f.useState(l),[m,h]=f.useState("idle"),[y,C]=f.useState(null),[F,O]=f.useState(null);!r&&!b(u,l)&&(x(l),d(l));const p=ue(o),g=a=>d(c=>({...c,...a})),W=a=>g({days:o.days.includes(a)?o.days.filter(c=>c!==a):[...o.days,a]}),L=()=>{if(p)return;h("saving");const a=o;i({timezone:a.timezone,workingHours:{days:[...a.days].sort((c,S)=>c-S),start:a.start,end:a.end},away:ce(a,u,n)}).then(()=>{h("idle"),C(null),O(a)}).catch(c=>{h("error"),C(c instanceof Error?c.message:null)})};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-4",children:[t.jsx(E,{label:"Your hours",description:"Your time zone and working hours.",orientation:"vertical",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-timezone",className:"text-muted-foreground text-xs",children:"Time zone"}),t.jsxs(H,{value:o.timezone,onValueChange:a=>g({timezone:a}),children:[t.jsx(M,{id:"profile-timezone",className:"h-8 text-sm",responsive:!1,children:t.jsx(_,{})}),t.jsx(A,{children:le(o.timezone).map(a=>t.jsx(Z,{value:a,responsive:!1,children:a.replace(/_/g," ")},a))})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{id:"profile-days-label",className:"text-muted-foreground text-xs",children:"Working days"}),t.jsx("div",{role:"group","aria-labelledby":"profile-days-label",className:"flex gap-1",children:ie.map(({day:a,short:c,name:S})=>{const T=o.days.includes(a);return t.jsx("button",{type:"button","aria-label":S,"aria-pressed":T,onClick:()=>W(a),className:V("size-8 rounded-md border text-xs font-medium",T?"bg-primary text-primary-foreground border-transparent":"text-muted-foreground hover:bg-accent"),children:c},a)})})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-start",className:"text-muted-foreground text-xs",children:"Start"}),t.jsx(v,{id:"profile-hours-start",type:"time",value:o.start,onChange:a=>g({start:a.target.value})})]}),t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-end",className:"text-muted-foreground text-xs",children:"End"}),t.jsx(v,{id:"profile-hours-end",type:"time",value:o.end,onChange:a=>g({end:a.target.value})})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-away-until",className:"text-muted-foreground text-xs",children:"Away until"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(v,{id:"profile-away-until",type:"date",value:o.awayUntil,onChange:a=>g({awayUntil:a.target.value})}),o.awayUntil&&t.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>g({awayUntil:""}),children:"Clear"})]})]})]})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(P,{type:"button",size:"sm",onClick:L,disabled:r||m==="saving"||p!==null||b(o,u),children:m==="saving"?"Saving…":"Save"}),p&&t.jsx(j,{tone:"error",children:p}),!p&&m==="error"&&t.jsx(j,{tone:"error",children:y??"Couldn’t save that. Try again."}),!p&&m!=="error"&&F&&b(o,F)&&t.jsx(j,{tone:"ok",children:"Saved."})]})]})})}function fe({member:e}){return t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"How you appear on your team page, in rooms and beside your messages."}),t.jsx(K,{member:e}),t.jsx(Y,{member:e}),t.jsx($,{member:e}),t.jsx(G,{member:e}),t.jsx(Q,{}),t.jsx(me,{})]})}function N({children:e}){return t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:e})}function pe(){var n;const e=B(),s=(n=e.data)==null?void 0:n.members.find(r=>r.isSelf);return e.isPending?t.jsx(N,{children:"Loading your profile…"}):e.isError?t.jsx(N,{children:"Couldn’t load your profile. Reopen this tab to try again."}):s?t.jsx(fe,{member:s}):t.jsx(N,{children:"Couldn’t find your profile. Reopen this tab to try again."})}export{fe as P,pe as a};
@@ -1 +1 @@
1
- import{a5 as O,a7 as E,a6 as I,aJ as h,a8 as j,aI as D,f1 as S,r as b,j as l,G as z,I as q,B as k}from"./index-BR1m9FON.js";function B(){var a,d,c,m,g,p;const r=O(),s=E(),{data:e,isLoading:o}=I({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:S}),i=j({mutationKey:D,mutationFn:u=>r.updateConfig({profile:u}),onSuccess:()=>{s.invalidateQueries({queryKey:h.all})}});return{roles:((a=e==null?void 0:e.profile)==null?void 0:a.roles)??[],rolePromptDismissedAt:((d=e==null?void 0:e.profile)==null?void 0:d.rolePromptDismissedAt)??null,identityPromptDismissedAt:((c=e==null?void 0:e.profile)==null?void 0:c.identityPromptDismissedAt)??null,timezone:((m=e==null?void 0:e.profile)==null?void 0:m.timezone)??null,workingHours:((g=e==null?void 0:e.profile)==null?void 0:g.workingHours)??null,away:((p=e==null?void 0:e.profile)==null?void 0:p.away)??null,isLoading:o,saveHours:u=>i.mutateAsync(u).then(()=>{}),saveRoles:u=>i.mutateAsync({roles:u}).then(()=>{}),dismissRolePrompt:()=>i.mutateAsync({rolePromptDismissedAt:new Date().toISOString()}).then(()=>{}),dismissIdentityPrompt:()=>i.mutateAsync({identityPromptDismissedAt:new Date().toISOString()}).then(()=>{})}}let x=!1;function K(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function Q(){const r=O(),s=E(),{data:e,isSuccess:o}=I({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:S}),i=e==null?void 0:e.profile;b.useEffect(()=>{if(x||!o||!i)return;if(i.timezone!=null){x=!0;return}const a=K();a&&(x=!0,r.updateConfig({profile:{timezone:a}}).then(()=>s.invalidateQueries({queryKey:h.all})).catch(()=>{}))},[o,i,r,s])}const w=[{id:"software-development",label:"Building software"},{id:"hiring",label:"Hiring people"},{id:"marketing",label:"Marketing"},{id:"writing",label:"Writing"},{id:"research",label:"Research"},{id:"business-ops",label:"Running a business"},{id:"design",label:"Design"},{id:"sales",label:"Sales"}],M=6,F={developer:"software-development",engineer:"software-development",programmer:"software-development",coder:"software-development","software engineer":"software-development",recruiter:"hiring",recruiting:"hiring",talent:"hiring",marketer:"marketing",growth:"marketing",writer:"writing",author:"writing",researcher:"research",scientist:"research",founder:"business-ops",entrepreneur:"business-ops",operations:"business-ops",ops:"business-ops",designer:"design",seller:"sales",salesperson:"sales"};function H(r){var i;const s=r.trim().toLowerCase();if(s.length===0)return;const e=w.find(a=>a.id===s);if(e)return e.id;const o=F[s];return o||((i=w.find(a=>a.label.toLowerCase()===s))==null?void 0:i.id)}const A=10,N=60;function v(r,s){const e=s.trim().toLowerCase();return r.some(o=>o.trim().toLowerCase()===e)}function W({selected:r,onChange:s,onConfirm:e,confirmLabel:o,onSkip:i,skipLabel:a,busy:d=!1,error:c=null}){const[m,g]=b.useState(!1),[p,u]=b.useState(""),C=b.useRef(null),y=w.slice(0,M),T=r.filter(t=>!y.some(n=>n.id===t)),f=r.length>=A,P=t=>{v(r,t)?s(r.filter(n=>n!==t)):f||s([...r,t])},L=()=>{const t=p.trim().slice(0,N);if(!t)return;const n=H(t),R=n&&y.some(_=>_.id===n)?n:t;!v(r,R)&&r.length<A&&s([...r,R]),u("")};return l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"What kind of work you do",children:[y.map(t=>{const n=v(r,t.id);return l.jsx("button",{type:"button","aria-pressed":n,disabled:f&&!n,onClick:()=>P(t.id),className:z("focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",n?"border-primary bg-primary text-primary-foreground":"border-input bg-background text-foreground hover:bg-accent"),children:t.label},t.id)}),T.map(t=>l.jsx("button",{type:"button","aria-pressed":!0,onClick:()=>s(r.filter(n=>n!==t)),className:"border-primary bg-primary text-primary-foreground focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:t},t)),!m&&l.jsx("button",{type:"button",disabled:f,onClick:()=>{g(!0),setTimeout(()=>{var t;return(t=C.current)==null?void 0:t.focus()},0)},className:"border-input text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring rounded-md border border-dashed px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",children:"Something else"})]}),f&&l.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"profile-role-cap-hint",children:"Ten at most. Remove a role to add another."}),m&&!f&&l.jsx(q,{ref:C,value:p,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),L())},maxLength:N,placeholder:"Type your work and press Enter","aria-label":"Something else: describe your work",className:"h-8 text-xs"}),c&&l.jsx("p",{className:"text-destructive text-sm",role:"alert","data-testid":"profile-save-error",children:c}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(k,{size:"sm",onClick:e,disabled:d||r.length===0,"data-testid":"confirm-profile",children:o}),i&&l.jsx(k,{size:"sm",variant:"ghost",onClick:i,disabled:d,"data-testid":"skip-profile",children:a})]})]})}export{W as P,Q as a,K as b,B as u};
1
+ import{a5 as O,a7 as E,a6 as I,aJ as h,a8 as j,aI as D,f1 as S,r as b,j as l,G as z,I as q,B as k}from"./index-B2JoVHek.js";function B(){var a,d,c,m,g,p;const r=O(),s=E(),{data:e,isLoading:o}=I({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:S}),i=j({mutationKey:D,mutationFn:u=>r.updateConfig({profile:u}),onSuccess:()=>{s.invalidateQueries({queryKey:h.all})}});return{roles:((a=e==null?void 0:e.profile)==null?void 0:a.roles)??[],rolePromptDismissedAt:((d=e==null?void 0:e.profile)==null?void 0:d.rolePromptDismissedAt)??null,identityPromptDismissedAt:((c=e==null?void 0:e.profile)==null?void 0:c.identityPromptDismissedAt)??null,timezone:((m=e==null?void 0:e.profile)==null?void 0:m.timezone)??null,workingHours:((g=e==null?void 0:e.profile)==null?void 0:g.workingHours)??null,away:((p=e==null?void 0:e.profile)==null?void 0:p.away)??null,isLoading:o,saveHours:u=>i.mutateAsync(u).then(()=>{}),saveRoles:u=>i.mutateAsync({roles:u}).then(()=>{}),dismissRolePrompt:()=>i.mutateAsync({rolePromptDismissedAt:new Date().toISOString()}).then(()=>{}),dismissIdentityPrompt:()=>i.mutateAsync({identityPromptDismissedAt:new Date().toISOString()}).then(()=>{})}}let x=!1;function K(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function Q(){const r=O(),s=E(),{data:e,isSuccess:o}=I({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:S}),i=e==null?void 0:e.profile;b.useEffect(()=>{if(x||!o||!i)return;if(i.timezone!=null){x=!0;return}const a=K();a&&(x=!0,r.updateConfig({profile:{timezone:a}}).then(()=>s.invalidateQueries({queryKey:h.all})).catch(()=>{}))},[o,i,r,s])}const w=[{id:"software-development",label:"Building software"},{id:"hiring",label:"Hiring people"},{id:"marketing",label:"Marketing"},{id:"writing",label:"Writing"},{id:"research",label:"Research"},{id:"business-ops",label:"Running a business"},{id:"design",label:"Design"},{id:"sales",label:"Sales"}],M=6,F={developer:"software-development",engineer:"software-development",programmer:"software-development",coder:"software-development","software engineer":"software-development",recruiter:"hiring",recruiting:"hiring",talent:"hiring",marketer:"marketing",growth:"marketing",writer:"writing",author:"writing",researcher:"research",scientist:"research",founder:"business-ops",entrepreneur:"business-ops",operations:"business-ops",ops:"business-ops",designer:"design",seller:"sales",salesperson:"sales"};function H(r){var i;const s=r.trim().toLowerCase();if(s.length===0)return;const e=w.find(a=>a.id===s);if(e)return e.id;const o=F[s];return o||((i=w.find(a=>a.label.toLowerCase()===s))==null?void 0:i.id)}const A=10,N=60;function v(r,s){const e=s.trim().toLowerCase();return r.some(o=>o.trim().toLowerCase()===e)}function W({selected:r,onChange:s,onConfirm:e,confirmLabel:o,onSkip:i,skipLabel:a,busy:d=!1,error:c=null}){const[m,g]=b.useState(!1),[p,u]=b.useState(""),C=b.useRef(null),y=w.slice(0,M),T=r.filter(t=>!y.some(n=>n.id===t)),f=r.length>=A,P=t=>{v(r,t)?s(r.filter(n=>n!==t)):f||s([...r,t])},L=()=>{const t=p.trim().slice(0,N);if(!t)return;const n=H(t),R=n&&y.some(_=>_.id===n)?n:t;!v(r,R)&&r.length<A&&s([...r,R]),u("")};return l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"What kind of work you do",children:[y.map(t=>{const n=v(r,t.id);return l.jsx("button",{type:"button","aria-pressed":n,disabled:f&&!n,onClick:()=>P(t.id),className:z("focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",n?"border-primary bg-primary text-primary-foreground":"border-input bg-background text-foreground hover:bg-accent"),children:t.label},t.id)}),T.map(t=>l.jsx("button",{type:"button","aria-pressed":!0,onClick:()=>s(r.filter(n=>n!==t)),className:"border-primary bg-primary text-primary-foreground focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:t},t)),!m&&l.jsx("button",{type:"button",disabled:f,onClick:()=>{g(!0),setTimeout(()=>{var t;return(t=C.current)==null?void 0:t.focus()},0)},className:"border-input text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring rounded-md border border-dashed px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",children:"Something else"})]}),f&&l.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"profile-role-cap-hint",children:"Ten at most. Remove a role to add another."}),m&&!f&&l.jsx(q,{ref:C,value:p,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),L())},maxLength:N,placeholder:"Type your work and press Enter","aria-label":"Something else: describe your work",className:"h-8 text-xs"}),c&&l.jsx("p",{className:"text-destructive text-sm",role:"alert","data-testid":"profile-save-error",children:c}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(k,{size:"sm",onClick:e,disabled:d||r.length===0,"data-testid":"confirm-profile",children:o}),i&&l.jsx(k,{size:"sm",variant:"ghost",onClick:i,disabled:d,"data-testid":"skip-profile",children:a})]})]})}export{W as P,Q as a,K as b,B as u};
@@ -1 +1 @@
1
- import{j as e,_ as c,aR as l,G as i}from"./index-BR1m9FON.js";const p=4,m={compact:"max-w-[200px] gap-1.5 px-2.5 py-1 text-xs",comfortable:"min-h-9 max-w-[280px] gap-2 px-3 py-1.5 text-sm"};function u({suggestions:o,onChipClick:s,ariaLabel:r="Suggested follow-ups",size:a="compact"}){const n=o.slice(0,p);return e.jsx(c.div,{"data-slot":"prompt-suggestion-chips",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},role:"group","aria-label":r,className:"mt-1.5 flex flex-wrap items-center gap-2",children:n.map(t=>e.jsxs("button",{type:"button","aria-label":t,title:t,onClick:()=>s(t),className:i("bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring inline-flex items-center truncate rounded-md transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-offset-2",m[a]),children:[e.jsx(l,{className:i("shrink-0",a==="compact"?"size-3":"size-3.5")}),e.jsx("span",{className:"truncate",children:t})]},t))})}export{u as P};
1
+ import{j as e,_ as c,aS as l,G as i}from"./index-B2JoVHek.js";const p=4,m={compact:"max-w-[200px] gap-1.5 px-2.5 py-1 text-xs",comfortable:"min-h-9 max-w-[280px] gap-2 px-3 py-1.5 text-sm"};function u({suggestions:o,onChipClick:s,ariaLabel:r="Suggested follow-ups",size:a="compact"}){const n=o.slice(0,p);return e.jsx(c.div,{"data-slot":"prompt-suggestion-chips",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},role:"group","aria-label":r,className:"mt-1.5 flex flex-wrap items-center gap-2",children:n.map(t=>e.jsxs("button",{type:"button","aria-label":t,title:t,onClick:()=>s(t),className:i("bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring inline-flex items-center truncate rounded-md transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-offset-2",m[a]),children:[e.jsx(l,{className:i("shrink-0",a==="compact"?"size-3":"size-3.5")}),e.jsx("span",{className:"truncate",children:t})]},t))})}export{u as P};
@@ -1 +1 @@
1
- import{r as g,b as D,z as P,j as e,e as O,D as _,F as U,G as C,t as z,g as F,J as K,K as M}from"./index-BR1m9FON.js";import{u as Y}from"./use-mounted-ref-IHwyriaF.js";const A="REPORTS_TO_CYCLE",q="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function B({option:a,selected:d,focusable:i,isDefault:p,disabled:x,onPick:c}){const n=z(a.member);return e.jsxs("button",{type:"button",role:"radio","aria-checked":d,tabIndex:i?0:-1,disabled:x,onClick:c,className:C(M,"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-left text-sm","hover:bg-accent disabled:opacity-60"),children:[e.jsx(F,{size:"xs",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin,badge:null}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[a.label,p&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"text-muted-foreground",children:"(default)"})]})]}),d&&e.jsx(K,{"aria-hidden":!0,className:"size-3.5 shrink-0"})]})}function J({member:a}){var y,R;const d=Y(),i=g.useRef(null),p=g.useId(),x=g.useId(),{agent:c,isPending:n,isSaving:h,error:u,update:b}=D(a,{errorLabel:"Couldn’t change who this agent reports to",isShownInline:t=>d.current===!0&&t.code===A}),j=P();if(n||j.isPending)return e.jsx(O,{className:"h-24 w-full"});if(!c)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const I=((y=j.data)==null?void 0:y.members)??[],l=_(c,I,a),m=U(c.id,I,a),E=m.some(t=>t.accountId===l.accountId)?l.accountId:((R=m[0])==null?void 0:R.accountId)??null,L=t=>{var v;const s=Array.from(((v=i.current)==null?void 0:v.querySelectorAll('[role="radio"]'))??[]),r=s.indexOf(document.activeElement),o={ArrowDown:r+1,ArrowRight:r+1,ArrowUp:r-1,ArrowLeft:r-1,Home:0,End:s.length-1}[t.key];if(o===void 0||s.length===0)return;t.preventDefault();const f=s[(o+s.length)%s.length];s.forEach(N=>N.tabIndex=N===f?0:-1),f==null||f.focus()},S=m.filter(t=>t.kind==="person"),T=m.filter(t=>t.kind==="agent"),k=(u==null?void 0:u.code)===A?u.message:null,w=(t,s,r)=>r.length>0&&e.jsxs("div",{role:"group","aria-labelledby":s,className:"space-y-0.5",children:[e.jsx("div",{id:s,className:C(q,"px-1.5"),children:t}),r.map(o=>e.jsx(B,{option:o,selected:l.accountId===o.accountId,focusable:E===o.accountId,isDefault:l.isDefault&&l.accountId===o.accountId,disabled:h,onPick:()=>{o.accountId!==c.reportsTo&&b({reportsTo:o.accountId})}},o.accountId))]});return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-reports-to",children:[e.jsxs("div",{ref:i,role:"radiogroup","aria-label":"Reports to",onKeyDown:L,className:"max-h-72 space-y-2 overflow-y-auto",children:[w("People",p,S),w("Agents",x,T)]}),k&&e.jsx("p",{role:"alert",className:"text-status-error px-1.5 text-xs",children:k}),!l.isDefault&&e.jsx("button",{type:"button",disabled:h,onClick:()=>b({reportsTo:null}),className:"text-muted-foreground hover:text-foreground px-1.5 text-xs underline-offset-2 hover:underline",children:"Use the default"})]})}export{J as ReportsToPopover};
1
+ import{r as g,b as D,z as P,j as e,e as O,D as _,F as U,G as C,t as z,g as F,J as K,K as M}from"./index-B2JoVHek.js";import{u as Y}from"./use-mounted-ref-pxDiCOyS.js";const A="REPORTS_TO_CYCLE",q="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function B({option:a,selected:d,focusable:i,isDefault:p,disabled:x,onPick:c}){const n=z(a.member);return e.jsxs("button",{type:"button",role:"radio","aria-checked":d,tabIndex:i?0:-1,disabled:x,onClick:c,className:C(M,"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-left text-sm","hover:bg-accent disabled:opacity-60"),children:[e.jsx(F,{size:"xs",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin,badge:null}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[a.label,p&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"text-muted-foreground",children:"(default)"})]})]}),d&&e.jsx(K,{"aria-hidden":!0,className:"size-3.5 shrink-0"})]})}function J({member:a}){var y,R;const d=Y(),i=g.useRef(null),p=g.useId(),x=g.useId(),{agent:c,isPending:n,isSaving:h,error:u,update:b}=D(a,{errorLabel:"Couldn’t change who this agent reports to",isShownInline:t=>d.current===!0&&t.code===A}),j=P();if(n||j.isPending)return e.jsx(O,{className:"h-24 w-full"});if(!c)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const I=((y=j.data)==null?void 0:y.members)??[],l=_(c,I,a),m=U(c.id,I,a),E=m.some(t=>t.accountId===l.accountId)?l.accountId:((R=m[0])==null?void 0:R.accountId)??null,L=t=>{var v;const s=Array.from(((v=i.current)==null?void 0:v.querySelectorAll('[role="radio"]'))??[]),r=s.indexOf(document.activeElement),o={ArrowDown:r+1,ArrowRight:r+1,ArrowUp:r-1,ArrowLeft:r-1,Home:0,End:s.length-1}[t.key];if(o===void 0||s.length===0)return;t.preventDefault();const f=s[(o+s.length)%s.length];s.forEach(N=>N.tabIndex=N===f?0:-1),f==null||f.focus()},S=m.filter(t=>t.kind==="person"),T=m.filter(t=>t.kind==="agent"),k=(u==null?void 0:u.code)===A?u.message:null,w=(t,s,r)=>r.length>0&&e.jsxs("div",{role:"group","aria-labelledby":s,className:"space-y-0.5",children:[e.jsx("div",{id:s,className:C(q,"px-1.5"),children:t}),r.map(o=>e.jsx(B,{option:o,selected:l.accountId===o.accountId,focusable:E===o.accountId,isDefault:l.isDefault&&l.accountId===o.accountId,disabled:h,onPick:()=>{o.accountId!==c.reportsTo&&b({reportsTo:o.accountId})}},o.accountId))]});return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-reports-to",children:[e.jsxs("div",{ref:i,role:"radiogroup","aria-label":"Reports to",onKeyDown:L,className:"max-h-72 space-y-2 overflow-y-auto",children:[w("People",p,S),w("Agents",x,T)]}),k&&e.jsx("p",{role:"alert",className:"text-status-error px-1.5 text-xs",children:k}),!l.isDefault&&e.jsx("button",{type:"button",disabled:h,onClick:()=>b({reportsTo:null}),className:"text-muted-foreground hover:text-foreground px-1.5 text-xs underline-offset-2 hover:underline",children:"Use the default"})]})}export{J as ReportsToPopover};
@@ -1 +1 @@
1
- import{a5 as he,a8 as pe,a7 as Ke,jB as Ge,jC as le,jD as je,jE as Ue,jF as Xe,jG as Ye,aQ as Qe,r as n,j as t,G as ae,B as ge,x as Ve,aZ as we,jH as Ze,e as se,gK as Ee,hr as Je,gJ as Pe,jI as et,jJ as tt,_ as xe,jK as _e,jL as Le,C as nt,n as st,gN as Z,dR as ot,fU as rt,jM as at,jN as it,jO as dt,cz as lt,jP as ut,jQ as ct,jR as ft,jS as mt,cv as ht,jT as pt,gI as te,jU as gt,l as xt,s as ke,jV as vt,jW as Rt,em as yt,X as bt,ej as jt,jX as wt,jY as Ne,jZ as kt,af as Nt,j_ as It,gH as At,gG as St,j$ as Ct,aG as Ie,Z as Mt}from"./index-BR1m9FON.js";import{P as Tt,u as Ot}from"./pane-resize-handle-Bjy4udre.js";import{D as Et,U as Pt,u as _t}from"./UnreadDivider-1aPVzwd7.js";import{u as Lt}from"./use-room-follow-claim-Bgrpr3bO.js";import{i as Dt,a as ve,e as Re,g as Ft,f as De,h as zt,j as Fe,c as V,d as oe,k as Ht,l as ce,b as fe,m as me,A as ze,n as He,t as ye,r as $t,o as re,R as be,u as $e,C as qe,p as qt}from"./ChannelComposer-CAYvz_ZB.js";import{u as Wt,f as Bt,a as Kt,F as Gt,C as J,d as Ut,M as Xt}from"./registry-Tbt9pcZl.js";import{u as Yt}from"./use-connector-management-BLiCJMgU.js";import{A as Qt}from"./AgentRequestCard-B2gxCMGi.js";import{u as Vt}from"./use-room-sessions-DecGrP3E.js";function Zt(){const e=he();return pe({mutationFn:({roomId:s,authorId:o})=>e.haltRoomAgent(s,o),meta:{errorLabel:"Couldn’t stop this agent"}})}function Jt(){const e=he();return pe({mutationFn:({roomId:s,authorId:o})=>e.promoteHold(s,o),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function en(e){const s=he(),o=Ke(),a=Ge(e),b=le(m=>{var f;return e===null?null:((f=m.paging[e])==null?void 0:f.cursor)??null}),r=pe({mutationFn:async m=>{var g;const f=(g=le.getState().paging[m])==null?void 0:g.cursor;if(f==null)return;const j=await s.listRoomEntries(m,{before:f,limit:je}),k=Qe.entries(m),I=o.getQueryData(k),A=Ue(I,j);o.setQueryData(k,A),le.getState().notePage(m,Xe(j)??f,Ye(j,je)||A.length===((I==null?void 0:I.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:i,isPending:p}=r,v=n.useRef(!1),h=n.useCallback(async()=>{if(!(e===null||v.current)){v.current=!0;try{await i(e).catch(()=>{})}finally{v.current=!1}}},[e,i]);return{canLoadOlder:a,isLoadingOlder:p,cursor:b,loadOlder:h}}function tn({id:e,summary:s,open:o,onOpen:a,endsGroup:b}){const{capabilities:r}=Wt(),{count:i,lastAt:p,unread:v}=s,h=Bt(p),[m,f]=n.useState({count:i,bumped:!1});m.count!==i&&f({count:i,bumped:!0});const j=m.count===i&&m.bumped;return r.threads?t.jsx("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":v>0?"":void 0,"aria-expanded":o,onClick:a,className:ae("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","hover:bg-row-hover flex w-fit items-center rounded-md text-left text-xs transition-colors",b===void 0?"mb-1":"mt-2",b===!0&&"mb-[var(--msg-padding-y-end)]",b===!1&&"mb-1","h-11 px-2 md:h-7",v>0?"text-foreground font-medium":"text-muted-foreground hover:text-foreground"),children:t.jsxs("span",{children:[t.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),t.jsx("span",{className:ae(j&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:i},i),i===1?" reply":" replies",h.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:p,title:Kt(p),children:h})]}),v>0&&` · ${v} new`]})}):null}const nn=3;function sn(e,s){const o=[],a=new Map,b=new Map;let r=0;for(;r<e.length;){const i=r;for(;r<e.length&&e[r].kind==="notice";)r++;const p=e.slice(i,r);if(p.length===0){o.push(e[r]),r++;continue}const v=p[p.length-1],h=p.filter(g=>g!==v&&!Dt(g.body.notice));if(p.length<nn||h.length===0){o.push(...p);continue}const m=p[0].id,f=s.has(m),j={runId:m,count:h.length,expanded:f},k=new Set(h);for(const g of h)b.set(g.id,m);if(f){a.set(p[0].id,j),o.push(...p);continue}const I=p.findIndex(g=>k.has(g)),A=p.slice(I).find(g=>!k.has(g));a.set(A.id,j),o.push(...p.filter(g=>!k.has(g)))}return{visible:o,foldBefore:a,runOf:b}}function on({loading:e,onLoad:s}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(ge,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&t.jsx(Ve,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}const rn="ROOM.md";function an(e){return e==null?void 0:e.find(s=>s.pinned&&s.content.type==="file"&&s.content.sourcePath===rn)}function dn({roomId:e}){const s=we(a=>an(a.roomCanvasDocuments[e]));if(!s)return null;const o=()=>{const a=we.getState();a.activateRoomCanvasDocument(e,s.id),Ze(a,"user")};return t.jsxs("p",{className:"max-w-sm text-xs","data-testid":"room-md-hint",children:["This channel has a ROOM.md for its goal and rules."," ",t.jsx("button",{type:"button",onClick:o,className:"text-foreground focus-ring rounded-sm underline underline-offset-2",children:"Open"})]})}const ln="room-load-older",un=4;function We({roomName:e}){return t.jsx(Gt,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:un},(s,o)=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(se,{className:"size-7 shrink-0 rounded-full"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx(se,{className:"h-3 w-24"}),t.jsx(se,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${o}`))})}function cn({roomId:e,roomName:s,viewerAuthorId:o,entries:a,members:b,formerAuthors:r,lastReadSeq:i,reactionFrequents:p,streamStalled:v,isLoading:h,error:m,onAddAgents:f,openThreadId:j,onOpenThread:k,resumeRow:I,landOnRow:A,onTopRow:g,canLoadOlder:C=!1,isLoadingOlder:d=!1,onLoadOlder:u,ref:O,roomKind:_}){const S=n.useMemo(()=>ve(b,r),[b,r]),B=Ee(b,o),T=Re(),P=n.useMemo(()=>new Map([...S].map(([y,Y])=>[y,Y.displayName])),[S]),D=Je(),Q=Pe(e,null),{topLevel:H,repliesByRoot:$,orphaned:K}=n.useMemo(()=>Ft(a),[a]),[F,G]=n.useState(()=>new Set),[X,L]=n.useState(null),q=n.useMemo(()=>sn(H,F),[H,F]),W=q.visible,c=n.useCallback(y=>{const Y=!F.has(y),N=new Set(F);Y?N.add(y):N.delete(y),G(N),L(Y?y:null)},[F]),x=n.useMemo(()=>new Map(a.map(y=>[y.id,y])),[a]),z=n.useMemo(()=>{const y=et(W,i),Y=tt(W.map(M=>({id:M.id,authorId:M.body.moment?`moment:${M.id}`:M.authorId,timestamp:M.createdAt})),{now:D,lastSeenId:y.lastSeenId,unreadFromStart:y.fromStart}),N=[];C&&!h&&N.push({kind:"load-older",id:ln});for(const M of Y){if(M.kind==="day-divider"){N.push({kind:"day-divider",id:M.key,label:M.label});continue}if(M.kind==="unread-divider"){N.push({kind:"unread-divider",id:M.key});continue}const U=W[M.index],ne=q.foldBefore.get(U.id);ne&&N.push({kind:"notice-fold",id:`notice-fold:${ne.runId}`,fold:ne});const de=$.get(U.id);N.push({kind:"message",id:U.id,entry:U,grouping:M.grouping,position:M.index+1,answers:De(U,W[M.index-1],x.get.bind(x)),headsThread:de!==void 0}),de&&N.push({kind:"thread-reply",id:zt(U.id),rootId:U.id,replies:de,totalReplies:U.threadReplyCount,endsGroup:M.grouping.position==="last"||M.grouping.position==="only"})}return N},[W,q,$,x,i,D,C,h]),l=n.useMemo(()=>z.map(y=>y.kind==="load-older"?{kind:"notice",id:y.id,at:"",body:null}:y.kind==="notice-fold"?{kind:"notice",id:y.id,at:"",body:null}:y.kind==="day-divider"?{kind:"day-divider",id:y.id,label:y.label}:y.kind==="unread-divider"?{kind:"unread-divider",id:y.id}:y.kind==="thread-reply"?{kind:"thread-reply",id:y.id,rootId:y.rootId,replyCount:Fe(y.replies.length,y.totalReplies),lastAt:y.replies[y.replies.length-1].createdAt}:{kind:"message",id:y.id,payload:y.entry,grouping:y.grouping,author:V(oe(y.entry,S),S,T.faces),at:y.entry.createdAt}),[z,S,T.faces]),w=n.useCallback((y,Y)=>{const N=z[Y.index];if(N.kind==="load-older")return u===void 0?null:t.jsx(on,{loading:d,onLoad:u});if(N.kind==="notice-fold")return t.jsx(fn,{fold:N.fold,onToggle:()=>c(N.fold.runId)});if(N.kind==="day-divider")return t.jsx(Et,{label:N.label});if(N.kind==="unread-divider")return t.jsx(Pt,{});if(N.kind==="thread-reply"){if(Y.onOpenThread===void 0)return null;const ne=Y.onOpenThread;return t.jsx(tn,{id:ce(N.rootId),summary:Ht(N.replies,i,N.totalReplies),open:j===N.rootId,onOpen:()=>ne(N.rootId),endsGroup:N.endsGroup})}const M=oe(N.entry,S),U=t.jsx(fe,{roomId:e,entry:N.entry,author:V(M,S,T.faces),authorRef:S.get(M),authors:S,viewerAuthorId:o,authorNames:P,reactionFrequents:p,streamStalled:v,isMember:B,grouping:N.grouping,orphanedReply:K.has(N.entry.id),answers:N.answers,feedPosition:{index:N.position,total:-1},rowId:me(N.entry.id),roomKind:_,headsThread:N.headsThread});return X!==null&&q.runOf.get(N.entry.id)===X?t.jsx(xe.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:Le.normal,ease:_e.out},onAnimationComplete:()=>L(null),children:U}):U},[z,e,_,S,T.faces,o,P,p,v,B,K,i,j,d,u,q,X,c]),R=n.useCallback(y=>{if(y.kind==="message")return me(y.id);if(y.kind==="thread-reply")return ce(y.rootId)},[]);if(m)return t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),t.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const E=b.some(y=>y.author.kind==="agent"),ee=t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx(st,{className:"text-muted-foreground size-8 md:size-6","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),t.jsx("p",{className:"max-w-sm",children:E?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(ge,{type:"button",size:"sm",variant:E?"ghost":"default",onClick:f,className:"mt-1",children:E?"Add more agents":"Add agents"}),t.jsx(dn,{roomId:e})]});return t.jsx(ze,{known:T,children:t.jsx(J.Timeline,{ref:O,conversationId:e,label:`Messages in ${s}`,rows:l,renderRow:w,onOpenThread:k,domIdOf:R,...I===void 0?{}:{resumeRow:I},...A===void 0?{}:{landOnRow:A},...g===void 0?{}:{onTopRow:g},pending:Q,viewerAuthorId:o,loading:h?t.jsx(We,{roomName:s}):void 0,empty:ee,feedTestId:"room-timeline"})})}function fn({fold:e,onToggle:s}){const o=e.count===1?"notice":"notices";return t.jsx("div",{"data-testid":"room-notice-fold",className:"py-0.5 pr-[var(--msg-padding-x)] pl-[calc(var(--msg-padding-x)+var(--msg-gutter-width)+var(--msg-gap))]",children:t.jsxs(ge,{type:"button",variant:"ghost",size:"xs","aria-expanded":e.expanded,"aria-label":`${e.expanded?"Hide":"Show"} ${e.count} earlier ${o}`,onClick:s,className:"text-muted-foreground hover:text-foreground -ml-2 font-normal",children:[t.jsx(xe.span,{"aria-hidden":!0,className:"inline-flex",initial:!1,animate:{rotate:e.expanded?90:0},transition:{duration:Le.fast,ease:_e.out},children:t.jsx(nt,{className:"size-(--size-icon-xs)"})}),e.expanded?`Hide ${e.count} earlier`:`${e.count} earlier`]})})}function mn(e){const{roomId:s,entrySeq:o,entries:a,historyLoaded:b}=e,r=o===void 0?null:`${s}:${o}`,i=n.useMemo(()=>{if(o===void 0)return null;const I=a.find(d=>d.seq===o);if(I===void 0)return null;const A=He(a,I.id);if(A===null)return null;const g=ye(I)??null,C=g!==null&&A.rowId!==I.id;return{roomRowId:A.rowId,threadRootId:C?g:null,entryId:I.id}},[a,o]),p=n.useRef(null),v=(i==null?void 0:i.threadRootId)??null;n.useEffect(()=>{r===null||v===null||p.current!==r&&(p.current=r,Z.getState().openThread(s,v))},[r,s,v]);const h=n.useRef(null);n.useEffect(()=>{r===null||!b||i===null&&h.current!==r&&(h.current=r,ot.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,b,i]);const m=n.useRef(null),f=n.useCallback(()=>{if(!(r===null||m.current===r))return m.current=r,i==null?void 0:i.roomRowId},[r,i]),j=n.useRef(null),k=n.useCallback(()=>{if(!(r===null||j.current===r))return j.current=r,(i==null?void 0:i.threadRootId)===null||i==null?void 0:i.entryId},[r,i]);return{roomRow:o===void 0?void 0:f,threadRow:o===void 0?void 0:k}}function hn(e,s){const[o,a]=n.useState({roomId:null,seq:null});return o.roomId===e?o.seq:e===null?(a({roomId:null,seq:null}),null):s===null?null:(a({roomId:e,seq:s}),s)}const pn=600;function gn(e){return document.getElementById(ce(e))??document.getElementById(me(e))}function xn(){const e=n.useRef(null);return n.useEffect(()=>()=>{var o;return(o=e.current)==null?void 0:o.call(e)},[]),{arm:n.useCallback(o=>{var p;(p=e.current)==null||p.call(e);let a=0;const b=Date.now()+pn;let r=!1;const i=()=>{if(r)return;const v=document.activeElement;if(v===null||v===document.body||!v.isConnected){const m=gn(o);if(m!==null){m.focus();return}}Date.now()>=b||(a=requestAnimationFrame(i))};a=requestAnimationFrame(i),e.current=()=>{r=!0,cancelAnimationFrame(a)}},[])}}function vn({roomId:e,route:s,urlThreadId:o,openThreadId:a,entries:b,historyLoaded:r}){const i=rt(),p=n.useRef(null);n.useEffect(()=>{if(e!==null){if(p.current!==e&&(p.current=e,o!==void 0)){Z.getState().openThread(e,o);return}if(r&&a!==void 0){const v=b.find(m=>m.id===a),h=v===void 0?void 0:$t(v);if(h!==void 0&&h!==a){const m=Z.getState().open[e];Z.getState().openThread(e,h,(m==null?void 0:m.focusComposer)??!1);return}}a!==o&&(i==null||i({to:s,search:v=>({...v,thread:a}),replace:!0}))}},[e,s,a,o,b,r,i])}function Rn(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(s=>s.author.kind==="agent")}function yn({room:e,hasEntries:s,onAddAgents:o}){return!s||!Rn(e)?null:t.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",t.jsx("button",{type:"button",onClick:o,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function bn({roomId:e}){const{approvals:s}=at(),o=it(s).filter(a=>a.roomId===e);return o.length===0?null:t.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:t.jsx(dt,{approvals:o})})}function jn({roomId:e}){const{data:s}=Yt("pending"),o=(s??[]).filter(a=>a.roomId===e);return o.length===0?null:t.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:o.map(a=>t.jsx(Qt,{request:a},a.requestId))})}const wn="An agent",Ae=64,ue=3,kn=new Set;function Be({room:e,entries:s,scope:o,laneScope:a,stalled:b,unavailable:r=!1,onRetry:i,onScrollToRow:p}){const v=lt(),h=ut(e.id,o),m=ct(e.id,o),f=ft(e.id,o),[j,k]=n.useState(!1),I=Vt(e.id,{enabled:j}),A=mt(),{mutate:g}=Zt(),[C,d]=n.useState(kn),u=n.useCallback(l=>{d(w=>new Set(w).add(l)),g({roomId:e.id,authorId:l},{onSettled:()=>d(w=>{const R=new Set(w);return R.delete(l),R})})},[g,e.id]),O=Jt(),[_,S]=n.useState(()=>new Map),B=ht(),T=Re(),P=n.useMemo(()=>ve(e.members,e.formerAuthors),[e.members,e.formerAuthors]),D=n.useCallback(l=>{var w;return((w=P.get(l))==null?void 0:w.displayName)??wn},[P]),{interactions:Q}=pt(),H=n.useMemo(()=>Q.filter(l=>l.roomId===e.id),[Q,e.id]),$=n.useMemo(()=>{var w;const l={};for(const R of H){if(R.roomAuthorId===void 0)continue;const E=(w=P.get(R.roomAuthorId))==null?void 0:w.displayName;E!==void 0&&(l[R.sessionId]=E)}return l},[H,P]),K=n.useMemo(()=>h.map(l=>({authorId:l.authorId,name:D(l.authorId),state:l.state,since:l.since,activity:l.activity??null})),[h,D]),F=n.useMemo(()=>m.map(l=>{var R;const w=(R=B.data)==null?void 0:R.find(E=>E.id===l.behindRoomId);return{authorId:l.authorId,name:D(l.authorId),since:l.since,behind:{roomId:l.behindRoomId,title:w===void 0?null:te(w)},othersWaiting:l.othersWaiting,severalInTheWay:l.severalInTheWay}}),[m,D,B.data]),G=n.useMemo(()=>{const l=new Set;for(const w of m)_.get(w.authorId)===w.entryId&&l.add(w.authorId);return l},[m,_]),X=n.useMemo(()=>f===null?null:{authorId:f.authorId,name:D(f.authorId)},[f,D]),L=n.useMemo(()=>Ut({capabilities:be,asks:H,agentNames:$,stalled:b,presence:K,held:F,silentFinish:X,turn:null}),[H,$,K,F,X,b]),q=n.useMemo(()=>{var w;const l=new Map;for(const R of((w=I.data)==null?void 0:w.bindings)??[])l.set(R.authorId,R.sessionId);return l},[I.data]),W=n.useCallback(l=>{const w=s.find(E=>E.id===l);if(w===void 0)return null;const R=w.body.text.replace(/\s+/gu," ").trim();return R.length===0?null:R.length>Ae?`${R.slice(0,Ae).trimEnd()}…`:R},[s]),c=n.useCallback(l=>{var w;return a==="thread"?re(l):((w=He(s,l))==null?void 0:w.domId)??null},[s,a]),x=n.useMemo(()=>{const l=h.map(R=>{const E=W(R.entryId),ee=c(R.entryId);return{authorId:R.authorId,author:V(R.authorId,P,T.faces),state:R.state,since:R.since,doing:gt(R.activity),replyingTo:E===null||ee===null?null:{entryId:R.entryId,excerpt:E,rowId:ee},sessionId:q.get(R.authorId)??null}}),w=F.map(R=>({authorId:R.authorId,author:V(R.authorId,P,T.faces),state:"held",since:R.since,doing:null,replyingTo:null,sessionId:null,behind:R.behind,othersWaiting:R.othersWaiting}));return[...l,...w]},[h,F,P,T.faces,W,c,q]),z=n.useMemo(()=>{if(h.length===0)return null;const l=h.slice(0,ue);return t.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[l.map(w=>t.jsx(Xt,{author:V(w.authorId,P,T.faces),className:"ring-background size-4 ring-2"},w.authorId)),h.length>ue&&t.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${h.length-ue}`})]})},[h,P,T.faces]);return t.jsx(J.LiveLane,{state:L,scope:a,onRetry:i,unavailable:r,faces:z,onPeekOpenChange:k,askCard:L.kind==="ask"?t.jsx(vt,{ask:L.ask,...$[L.ask.sessionId]?{agentName:$[L.ask.sessionId]}:{},onOpenSession:l=>{v(ke({session:l}))},className:"border-l-0"}):void 0,peek:t.jsx(J.LivePeek,{rows:x,onScrollToRow:p,onOpenSession:l=>{v(ke({session:l}))},onOpenRoom:l=>{v({...xt.channels(),search:{id:l}})},onAnswerFirst:l=>{const w=m.find(R=>R.authorId===l);w!==void 0&&S(R=>new Map(R).set(l,w.entryId)),O.mutate({roomId:e.id,authorId:l})},promoted:G,onStopAll:()=>A.mutate({roomId:e.id}),stopping:A.isPending,onStopAgent:u,stoppingAgents:C})})}const Se=3e3;function Nn(e,s,o,a=Date.now){const b=n.useRef(null),r=n.useRef(new Map),i=n.useRef(new Map),p=b.current,v=r.current,h=i.current,m=a();for(const f of e){if(h.has(f.id))continue;if(p===null){h.set(f.id,"at-rest");continue}const j=v.get(f.authorId);h.set(f.id,j!==void 0&&m-j<Se?"handed-off":"dropped")}return n.useEffect(()=>{if(!o)return;b.current=new Set(e.map(j=>j.id));const f=a();for(const j of s)r.current.set(j,f);for(const[j,k]of r.current)f-k>Se&&r.current.delete(j);for(const j of i.current.keys())b.current.has(j)||i.current.delete(j)}),h}function In({kind:e}){return e==="thread-error"?t.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),t.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?t.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[t.jsx(se,{className:"h-3 w-24"}),t.jsx(se,{className:"h-3 w-full max-w-sm"})]}):t.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs",children:"This thread’s first message is gone. Its replies remain."})}function An({room:e,rootEntryId:s,focusComposer:o,entries:a,reactionFrequents:b,streamStalled:r,streamUnavailable:i,onRetryStream:p,historyLoaded:v,historyFailed:h=!1,landOnRow:m,pushed:f,onClose:j}){const k=n.useMemo(()=>ve(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=$e({room:e,threadRootId:s}),A=Ee(e.members,e.viewerAuthorId),g=Re(),C=n.useMemo(()=>new Map([...k].map(([c,x])=>[c,x.displayName])),[k]),{root:d,replies:u}=n.useMemo(()=>{let c;const x=[];for(const z of a)z.id===s?c=z:ye(z)===s&&x.push(z);return{root:c,replies:x}},[a,s]),O=d==null?void 0:d.threadReplyCount,_=O!==void 0&&O>u.length,S=!f,B=d===void 0||_?-1:(S?1:0)+u.length,T=Fe(u.length,O),P=n.useMemo(()=>new Set(u.map(c=>c.id)),[u]),D=n.useMemo(()=>({replyIds:P,inside:!0}),[P]),Q=Rt(e.id,D),H=Pe(e.id,s),$=Nn(u,Q,v),K=n.useRef(null),F=n.useCallback(c=>{var x;(x=K.current)==null||x.scrollToRow(c)},[]),G=n.useRef(null);n.useEffect(()=>{var c;o||(c=G.current)==null||c.focus()},[s,o]);const X=c=>{c.key!=="Escape"||c.defaultPrevented||(c.stopPropagation(),j())},L=n.useMemo(()=>{const c=[];if(d===void 0){const x=h?"thread-error":v?"thread-orphan":"thread-waiting";c.push({kind:"notice",id:x,at:"",body:null})}else S&&c.push({kind:"message",id:d.id,payload:d,grouping:{position:"only"},author:V(oe(d,k),k,g.faces),at:d.createdAt});for(const x of u)c.push({kind:"message",id:x.id,payload:x,grouping:{position:"only"},author:V(oe(x,k),k,g.faces),at:x.createdAt});return c},[d,S,u,k,g.faces,h,v]),q=n.useCallback(c=>{if(c.kind==="notice")return t.jsx(In,{kind:c.id});if(c.kind!=="message")return null;const x=c.payload,z=d!==void 0&&x.id===d.id,l=u.findIndex(E=>E.id===x.id),w=t.jsx(fe,{roomId:e.id,entry:x,rowId:re(x.id),roomKind:e.kind,author:c.author,authorRef:k.get(x.authorId),authors:k,viewerAuthorId:e.viewerAuthorId,authorNames:C,reactionFrequents:b,streamStalled:r,isMember:A,grouping:{position:"only"},answers:De(x,l<=0?d:u[l-1],E=>(d==null?void 0:d.id)===E?d:u.find(ee=>ee.id===E)),feedPosition:{index:z?1:(d===void 0||!S?0:1)+l+1,total:B}});if(z)return t.jsxs(t.Fragment,{children:[w,t.jsx(Ce,{count:T})]});const R=$.get(x.id)??"at-rest";return t.jsx("div",{className:ae(R==="dropped"&&"motion-safe:animate-thread-reply-in",R==="handed-off"&&"motion-safe:animate-reply-settle"),children:w})},[d,S,u,T,$,e.id,e.kind,e.viewerAuthorId,k,C,b,r,A,B]),W=n.useCallback(c=>c.kind==="message"?re(c.id):void 0,[]);return t.jsx(ze,{known:g,children:t.jsx(J.Root,{surface:"room",capabilities:be,target:I.target,anchor:"rail",children:t.jsxs("section",{ref:G,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:X,className:ae("bg-card flex min-h-0 flex-col outline-none",f?"h-full w-full":"w-full border-l"),children:[f?t.jsxs("header",{className:"flex items-center gap-2 border-b px-1 py-1",children:[t.jsxs("button",{type:"button",onClick:j,"aria-label":`Back to ${te(e)}`,"data-testid":"room-thread-back",className:"focus-ring text-muted-foreground hover:text-foreground flex h-11 min-w-0 items-center gap-1 rounded px-2 text-sm",children:[t.jsx(yt,{"aria-hidden":!0,className:"size-4 shrink-0"}),t.jsx("span",{className:"truncate",children:te(e)})]}),t.jsx("p",{className:"ml-auto shrink-0 pr-3 text-sm font-medium",children:"Thread"})]}):t.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[t.jsx("button",{type:"button",onClick:j,"aria-label":"Close thread",className:"focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1",children:t.jsx(bt,{"aria-hidden":!0,className:"size-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium",children:"Thread"}),t.jsx("p",{className:"text-muted-foreground truncate text-xs",children:te(e)})]})]}),f&&d!==void 0&&t.jsxs("div",{"data-testid":"room-thread-pinned-root",className:"max-h-[40%] shrink-0 overflow-y-auto border-b pt-2",children:[t.jsx(fe,{roomId:e.id,entry:d,rowId:re(d.id),roomKind:e.kind,author:V(oe(d,k),k,g.faces),authorRef:k.get(d.authorId),authors:k,viewerAuthorId:e.viewerAuthorId,authorNames:C,reactionFrequents:b,streamStalled:r,isMember:A,grouping:{position:"only"}}),t.jsx(Ce,{count:T})]}),t.jsx(J.Timeline,{ref:K,conversationId:`thread-${s}`,label:`Thread in ${te(e)}`,busy:!v&&!h,rows:L,renderRow:q,domIdOf:W,...m===void 0?{}:{landOnRow:m},pending:H,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Be,{room:e,entries:a,scope:D,laneScope:"thread",stalled:f&&r===!0,unavailable:i,onRetry:f?p:void 0,onScrollToRow:F}),t.jsx(qe,{room:e,threadRootId:s,attachments:I.attachments,focusOnMount:o},s)]})})})}function Ce({count:e}){return e===0?null:t.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[t.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e===1?"1 reply":`${e} replies`}),t.jsx("span",{className:"bg-border h-px flex-1"})]})}const Sn=96,Cn=500;function Mn(e){return e.offset.x>Sn||e.velocity.x>Cn}function Tn({children:e,onClose:s}){const o=jt()===!0,a=o?{x:0}:{x:"100%"};return t.jsx(xe.div,{"data-testid":"room-thread-sheet",className:"bg-card absolute inset-0 z-10 flex flex-col shadow-xl",initial:a,animate:{x:0},exit:a,transition:o?{duration:0}:{duration:.22,ease:[.32,.72,0,1]},drag:"x",dragDirectionLock:!0,dragConstraints:{left:0,right:0},dragElastic:{left:0,right:.9},dragMomentum:!1,onDragEnd:(b,r)=>{Mn(r)&&s()},children:e})}const ie="room-thread-split",On=320,En=360,Pn=40,_n=50,Ln=25;function Me(e,s){return s<=0?Ln:Math.min(Math.round(e/s*1e3)/10,_n)}function Dn(e){const s=Me(On,e),o=Math.round((100-Me(En,e))*10)/10;return{minPct:s,maxPct:o,defaultPct:Math.min(Math.max(Pn,s),o)}}function Fn(e,s,o){if(e===null||s===null||s<=0)return o.defaultPct;const a=e/s*100;return Math.round(Math.min(Math.max(a,o.minPct),o.maxPct)*10)/10}function zn(e){try{const s=localStorage.getItem(e),o=s===null?NaN:Number(s);return Number.isFinite(o)&&o>0?o:null}catch{return null}}function Hn(e,s){try{localStorage.setItem(e,String(Math.round(s)))}catch{}}const $n="react-resizable-panels:room-thread-split";function qn(){try{localStorage.removeItem($n)}catch{}}function Wn(){const[e,s]=n.useState(null),[o,a]=n.useState(null);return{ref:n.useCallback(r=>{if(r===null)return;s(r);const i=()=>a(r.offsetWidth);i();const p=new ResizeObserver(i);return p.observe(r),()=>{p.disconnect(),s(null),a(null)}},[]),element:e,width:o,sizing:Dn(o??0)}}const Bn=`${ie}-room`,Te=`${ie}-thread`,Oe=`${ie}-handle`,Kn=4;function Gn({room:e,thread:s,storageKey:o=kt.ROOM_THREAD_WIDTH}){const{ref:a,element:b,width:r,sizing:i}=Wn(),[p,v]=n.useState(()=>zn(o)),[h,m]=n.useState(null),f=n.useRef(null),j=Fn(p,r,i),k=r===null||(i.maxPct-i.minPct)/100*r<Kn,I=s!==!1;n.useEffect(qn,[]);const A=n.useRef(!1);n.useLayoutEffect(()=>{var u;A.current&&((u=f.current)==null||u.resize(j))},[j,I]);const g=n.useRef(null),C=()=>{var S;const u=(S=f.current)==null?void 0:S.getSize(),O=g.current;if(g.current=null,u===void 0||r===null||r<=0||O===u)return;const _=Math.round(u/100*r);v(_),Hn(o,_)},d=h??j;return n.useLayoutEffect(()=>{const u=b==null?void 0:b.querySelector(`[data-panel-resize-handle-id="${Oe}"]`);u&&(u.setAttribute("aria-controls",Te),u.setAttribute("aria-valuenow",String(Math.round(d))),u.setAttribute("aria-valuemin",String(Math.round(i.minPct))),u.setAttribute("aria-valuemax",String(Math.round(i.maxPct))))}),t.jsx("div",{ref:a,className:"h-full overflow-hidden",children:t.jsxs(wt,{direction:"horizontal",id:ie,onLayout:u=>{A.current=u.length>1,m(A.current?u[1]:null)},children:[t.jsx(Ne,{id:Bn,order:1,className:"flex",children:e}),I&&t.jsxs(t.Fragment,{children:[t.jsx(Tt,{id:Oe,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:k,onDragging:u=>{var O;u&&(g.current=((O=f.current)==null?void 0:O.getSize())??null)},onKeyDownCapture:u=>{var O,_;k||(g.current=((O=f.current)==null?void 0:O.getSize())??null,!(u.key!=="Home"&&u.key!=="End")&&(u.preventDefault(),(_=f.current)==null||_.resize(u.key==="Home"?i.minPct:i.maxPct)))},onResizeEnd:C}),t.jsx(Ne,{ref:f,id:Te,order:2,defaultSize:j,minSize:i.minPct,maxSize:i.maxPct,className:"flex",children:s})]})]})})}function ns({roomId:e,threadId:s,entrySeq:o,threadRoute:a,aboveTimeline:b,aboveComposer:r,offerJumpBackIn:i,onComposerFocusChange:p}){const v=Nt(),h=Ot(),m=It(e),f=m==null?void 0:m.rootEntryId,j=xn(),k=n.useCallback(()=>{var x;const c=(x=Z.getState().open[e])==null?void 0:x.rootEntryId;Z.getState().closeThread(e),c!==void 0&&j.arm(c)},[e,j]),I=n.useCallback(c=>{Z.getState().openThread(e,c)},[e]),A=At(e),g=St(e),C=_t(e,g.isSuccess);Lt(e);const d=A.data,u=n.useMemo(()=>g.data??[],[g.data]),O=$e({room:d});vn({roomId:e,route:a,urlThreadId:s,openThreadId:f,entries:u,historyLoaded:g.isSuccess});const _=n.useMemo(()=>{var c;return((c=d==null?void 0:d.members.find(x=>x.author.id===d.viewerAuthorId))==null?void 0:c.lastReadSeq)??null},[d]),S=hn(e,_);Ct(d,u);const B=n.useRef(null),T=n.useRef(void 0),P=n.useCallback(c=>{T.current=c},[]),D=n.useCallback(()=>T.current,[]);n.useLayoutEffect(()=>{T.current=void 0},[e]);const Q=n.useCallback(c=>{var x;(x=B.current)==null||x.scrollToRow(c)},[]),H=en(e),{loadOlder:$,cursor:K}=H,F=n.useCallback(()=>{const c=qt(u,K);$().then(()=>{c!==null&&requestAnimationFrame(()=>{var x;return(x=B.current)==null?void 0:x.scrollToRow(c.domId)})})},[u,K,$]),G=mn({roomId:e,entrySeq:o,entries:u,historyLoaded:g.isSuccess}),X=n.useMemo(()=>f===void 0?void 0:{replyIds:new Set(u.filter(x=>ye(x)===f).map(x=>x.id)),inside:!1},[u,f]);if(A.isLoading)return t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(We,{})});if(A.isError||!d)return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),t.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const L=m!==void 0&&t.jsx(An,{room:d,rootEntryId:m.rootEntryId,focusComposer:m.focusComposer,entries:u,reactionFrequents:d.reactionFrequents,streamStalled:C.stalled,streamUnavailable:C.unavailable,onRetryStream:C.retry,historyLoaded:g.isSuccess,historyFailed:g.isError,...G.threadRow===void 0?{}:{landOnRow:G.threadRow},pushed:v,onClose:k},m.rootEntryId),q=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[b,t.jsx(cn,{ref:B,roomId:d.id,roomKind:d.kind,roomName:te(d),viewerAuthorId:d.viewerAuthorId,entries:u,members:d.members,formerAuthors:d.formerAuthors,lastReadSeq:S,reactionFrequents:d.reactionFrequents,streamStalled:C.stalled,isLoading:g.isLoading,error:g.error,onAddAgents:()=>Ie("add",d.id),openThreadId:f,onOpenThread:I,resumeRow:D,...G.roomRow===void 0?{}:{landOnRow:G.roomRow},onTopRow:P,canLoadOlder:H.canLoadOlder,isLoadingOlder:H.isLoadingOlder,onLoadOlder:F}),r,t.jsx(bn,{roomId:d.id}),t.jsx(jn,{roomId:d.id}),t.jsx(Be,{room:d,entries:u,scope:X,laneScope:"room",stalled:C.stalled,unavailable:C.unavailable,onRetry:C.retry,onScrollToRow:Q}),t.jsx(yn,{room:d,hasEntries:u.length>0,onAddAgents:()=>Ie("add",d.id)}),t.jsx(qe,{room:d,attachments:O.attachments,offerJumpBackIn:i,onFocusChange:p},d.id)]}),W={surface:"room",capabilities:be,target:O.target,anchor:"rail"};return v?t.jsx(J.Root,{...W,children:t.jsx("div",{style:{paddingBottom:h},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:L!==!1,"data-testid":"room-under-thread",children:q}),t.jsx(Mt,{initial:!1,children:L!==!1&&t.jsx(Tn,{onClose:k,children:L},`thread-${f}`)})]})})}):t.jsx(J.Root,{...W,children:t.jsx(Gn,{room:q,thread:L})})}export{ns as R,tn as T,We as a};
1
+ import{a5 as he,a8 as pe,a7 as Ke,jA as Ge,jB as le,jC as je,jD as Ue,jE as Xe,jF as Ye,aR as Qe,r as n,j as t,G as ae,B as ge,x as Ve,a_ as we,jG as Ze,e as se,gK as Ee,ho as Je,gJ as Pe,jH as et,jI as tt,_ as xe,jJ as _e,jK as Le,C as nt,n as st,gN as Z,dR as ot,fU as rt,jL as at,jM as it,jN as dt,cz as lt,jO as ut,jP as ct,jQ as ft,jR as mt,cv as ht,jS as pt,gI as te,jT as gt,l as xt,s as ke,jU as vt,jV as Rt,em as yt,X as bt,ej as jt,jW as wt,jX as Ne,jY as kt,af as Nt,jZ as It,gH as At,gG as St,j_ as Ct,aG as Ie,Z as Mt}from"./index-B2JoVHek.js";import{P as Tt,u as Ot}from"./pane-resize-handle-BJ0XV-Zg.js";import{D as Et,U as Pt,u as _t}from"./UnreadDivider-DCB47jhk.js";import{u as Lt}from"./use-room-follow-claim-Ch6ZoOAv.js";import{i as Dt,a as ve,e as Re,g as Ft,f as De,h as zt,j as Fe,c as V,d as oe,k as Ht,l as ce,b as fe,m as me,A as ze,n as He,t as ye,r as $t,o as re,R as be,u as $e,C as qe,p as qt}from"./ChannelComposer-DUKyoCYz.js";import{u as Wt,f as Bt,a as Kt,F as Gt,C as J,d as Ut,M as Xt}from"./registry-BcpatPes.js";import{u as Yt}from"./use-connector-management-54m5ZcyP.js";import{A as Qt}from"./AgentRequestCard-Cnhi_1sr.js";import{u as Vt}from"./use-room-sessions-C3NpXFWY.js";function Zt(){const e=he();return pe({mutationFn:({roomId:s,authorId:o})=>e.haltRoomAgent(s,o),meta:{errorLabel:"Couldn’t stop this agent"}})}function Jt(){const e=he();return pe({mutationFn:({roomId:s,authorId:o})=>e.promoteHold(s,o),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function en(e){const s=he(),o=Ke(),a=Ge(e),b=le(m=>{var f;return e===null?null:((f=m.paging[e])==null?void 0:f.cursor)??null}),r=pe({mutationFn:async m=>{var g;const f=(g=le.getState().paging[m])==null?void 0:g.cursor;if(f==null)return;const j=await s.listRoomEntries(m,{before:f,limit:je}),k=Qe.entries(m),I=o.getQueryData(k),A=Ue(I,j);o.setQueryData(k,A),le.getState().notePage(m,Xe(j)??f,Ye(j,je)||A.length===((I==null?void 0:I.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:i,isPending:p}=r,v=n.useRef(!1),h=n.useCallback(async()=>{if(!(e===null||v.current)){v.current=!0;try{await i(e).catch(()=>{})}finally{v.current=!1}}},[e,i]);return{canLoadOlder:a,isLoadingOlder:p,cursor:b,loadOlder:h}}function tn({id:e,summary:s,open:o,onOpen:a,endsGroup:b}){const{capabilities:r}=Wt(),{count:i,lastAt:p,unread:v}=s,h=Bt(p),[m,f]=n.useState({count:i,bumped:!1});m.count!==i&&f({count:i,bumped:!0});const j=m.count===i&&m.bumped;return r.threads?t.jsx("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":v>0?"":void 0,"aria-expanded":o,onClick:a,className:ae("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","hover:bg-row-hover flex w-fit items-center rounded-md text-left text-xs transition-colors",b===void 0?"mb-1":"mt-2",b===!0&&"mb-[var(--msg-padding-y-end)]",b===!1&&"mb-1","h-11 px-2 md:h-7",v>0?"text-foreground font-medium":"text-muted-foreground hover:text-foreground"),children:t.jsxs("span",{children:[t.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),t.jsx("span",{className:ae(j&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:i},i),i===1?" reply":" replies",h.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:p,title:Kt(p),children:h})]}),v>0&&` · ${v} new`]})}):null}const nn=3;function sn(e,s){const o=[],a=new Map,b=new Map;let r=0;for(;r<e.length;){const i=r;for(;r<e.length&&e[r].kind==="notice";)r++;const p=e.slice(i,r);if(p.length===0){o.push(e[r]),r++;continue}const v=p[p.length-1],h=p.filter(g=>g!==v&&!Dt(g.body.notice));if(p.length<nn||h.length===0){o.push(...p);continue}const m=p[0].id,f=s.has(m),j={runId:m,count:h.length,expanded:f},k=new Set(h);for(const g of h)b.set(g.id,m);if(f){a.set(p[0].id,j),o.push(...p);continue}const I=p.findIndex(g=>k.has(g)),A=p.slice(I).find(g=>!k.has(g));a.set(A.id,j),o.push(...p.filter(g=>!k.has(g)))}return{visible:o,foldBefore:a,runOf:b}}function on({loading:e,onLoad:s}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(ge,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&t.jsx(Ve,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}const rn="ROOM.md";function an(e){return e==null?void 0:e.find(s=>s.pinned&&s.content.type==="file"&&s.content.sourcePath===rn)}function dn({roomId:e}){const s=we(a=>an(a.roomCanvasDocuments[e]));if(!s)return null;const o=()=>{const a=we.getState();a.activateRoomCanvasDocument(e,s.id),Ze(a,"user")};return t.jsxs("p",{className:"max-w-sm text-xs","data-testid":"room-md-hint",children:["This channel has a ROOM.md for its goal and rules."," ",t.jsx("button",{type:"button",onClick:o,className:"text-foreground focus-ring rounded-sm underline underline-offset-2",children:"Open"})]})}const ln="room-load-older",un=4;function We({roomName:e}){return t.jsx(Gt,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:un},(s,o)=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(se,{className:"size-7 shrink-0 rounded-full"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx(se,{className:"h-3 w-24"}),t.jsx(se,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${o}`))})}function cn({roomId:e,roomName:s,viewerAuthorId:o,entries:a,members:b,formerAuthors:r,lastReadSeq:i,reactionFrequents:p,streamStalled:v,isLoading:h,error:m,onAddAgents:f,openThreadId:j,onOpenThread:k,resumeRow:I,landOnRow:A,onTopRow:g,canLoadOlder:C=!1,isLoadingOlder:d=!1,onLoadOlder:u,ref:O,roomKind:_}){const S=n.useMemo(()=>ve(b,r),[b,r]),B=Ee(b,o),T=Re(),P=n.useMemo(()=>new Map([...S].map(([y,Y])=>[y,Y.displayName])),[S]),D=Je(),Q=Pe(e,null),{topLevel:H,repliesByRoot:$,orphaned:K}=n.useMemo(()=>Ft(a),[a]),[F,G]=n.useState(()=>new Set),[X,L]=n.useState(null),q=n.useMemo(()=>sn(H,F),[H,F]),W=q.visible,c=n.useCallback(y=>{const Y=!F.has(y),N=new Set(F);Y?N.add(y):N.delete(y),G(N),L(Y?y:null)},[F]),x=n.useMemo(()=>new Map(a.map(y=>[y.id,y])),[a]),z=n.useMemo(()=>{const y=et(W,i),Y=tt(W.map(M=>({id:M.id,authorId:M.body.moment?`moment:${M.id}`:M.authorId,timestamp:M.createdAt})),{now:D,lastSeenId:y.lastSeenId,unreadFromStart:y.fromStart}),N=[];C&&!h&&N.push({kind:"load-older",id:ln});for(const M of Y){if(M.kind==="day-divider"){N.push({kind:"day-divider",id:M.key,label:M.label});continue}if(M.kind==="unread-divider"){N.push({kind:"unread-divider",id:M.key});continue}const U=W[M.index],ne=q.foldBefore.get(U.id);ne&&N.push({kind:"notice-fold",id:`notice-fold:${ne.runId}`,fold:ne});const de=$.get(U.id);N.push({kind:"message",id:U.id,entry:U,grouping:M.grouping,position:M.index+1,answers:De(U,W[M.index-1],x.get.bind(x)),headsThread:de!==void 0}),de&&N.push({kind:"thread-reply",id:zt(U.id),rootId:U.id,replies:de,totalReplies:U.threadReplyCount,endsGroup:M.grouping.position==="last"||M.grouping.position==="only"})}return N},[W,q,$,x,i,D,C,h]),l=n.useMemo(()=>z.map(y=>y.kind==="load-older"?{kind:"notice",id:y.id,at:"",body:null}:y.kind==="notice-fold"?{kind:"notice",id:y.id,at:"",body:null}:y.kind==="day-divider"?{kind:"day-divider",id:y.id,label:y.label}:y.kind==="unread-divider"?{kind:"unread-divider",id:y.id}:y.kind==="thread-reply"?{kind:"thread-reply",id:y.id,rootId:y.rootId,replyCount:Fe(y.replies.length,y.totalReplies),lastAt:y.replies[y.replies.length-1].createdAt}:{kind:"message",id:y.id,payload:y.entry,grouping:y.grouping,author:V(oe(y.entry,S),S,T.faces),at:y.entry.createdAt}),[z,S,T.faces]),w=n.useCallback((y,Y)=>{const N=z[Y.index];if(N.kind==="load-older")return u===void 0?null:t.jsx(on,{loading:d,onLoad:u});if(N.kind==="notice-fold")return t.jsx(fn,{fold:N.fold,onToggle:()=>c(N.fold.runId)});if(N.kind==="day-divider")return t.jsx(Et,{label:N.label});if(N.kind==="unread-divider")return t.jsx(Pt,{});if(N.kind==="thread-reply"){if(Y.onOpenThread===void 0)return null;const ne=Y.onOpenThread;return t.jsx(tn,{id:ce(N.rootId),summary:Ht(N.replies,i,N.totalReplies),open:j===N.rootId,onOpen:()=>ne(N.rootId),endsGroup:N.endsGroup})}const M=oe(N.entry,S),U=t.jsx(fe,{roomId:e,entry:N.entry,author:V(M,S,T.faces),authorRef:S.get(M),authors:S,viewerAuthorId:o,authorNames:P,reactionFrequents:p,streamStalled:v,isMember:B,grouping:N.grouping,orphanedReply:K.has(N.entry.id),answers:N.answers,feedPosition:{index:N.position,total:-1},rowId:me(N.entry.id),roomKind:_,headsThread:N.headsThread});return X!==null&&q.runOf.get(N.entry.id)===X?t.jsx(xe.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:Le.normal,ease:_e.out},onAnimationComplete:()=>L(null),children:U}):U},[z,e,_,S,T.faces,o,P,p,v,B,K,i,j,d,u,q,X,c]),R=n.useCallback(y=>{if(y.kind==="message")return me(y.id);if(y.kind==="thread-reply")return ce(y.rootId)},[]);if(m)return t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),t.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const E=b.some(y=>y.author.kind==="agent"),ee=t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx(st,{className:"text-muted-foreground size-8 md:size-6","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),t.jsx("p",{className:"max-w-sm",children:E?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(ge,{type:"button",size:"sm",variant:E?"ghost":"default",onClick:f,className:"mt-1",children:E?"Add more agents":"Add agents"}),t.jsx(dn,{roomId:e})]});return t.jsx(ze,{known:T,children:t.jsx(J.Timeline,{ref:O,conversationId:e,label:`Messages in ${s}`,rows:l,renderRow:w,onOpenThread:k,domIdOf:R,...I===void 0?{}:{resumeRow:I},...A===void 0?{}:{landOnRow:A},...g===void 0?{}:{onTopRow:g},pending:Q,viewerAuthorId:o,loading:h?t.jsx(We,{roomName:s}):void 0,empty:ee,feedTestId:"room-timeline"})})}function fn({fold:e,onToggle:s}){const o=e.count===1?"notice":"notices";return t.jsx("div",{"data-testid":"room-notice-fold",className:"py-0.5 pr-[var(--msg-padding-x)] pl-[calc(var(--msg-padding-x)+var(--msg-gutter-width)+var(--msg-gap))]",children:t.jsxs(ge,{type:"button",variant:"ghost",size:"xs","aria-expanded":e.expanded,"aria-label":`${e.expanded?"Hide":"Show"} ${e.count} earlier ${o}`,onClick:s,className:"text-muted-foreground hover:text-foreground -ml-2 font-normal",children:[t.jsx(xe.span,{"aria-hidden":!0,className:"inline-flex",initial:!1,animate:{rotate:e.expanded?90:0},transition:{duration:Le.fast,ease:_e.out},children:t.jsx(nt,{className:"size-(--size-icon-xs)"})}),e.expanded?`Hide ${e.count} earlier`:`${e.count} earlier`]})})}function mn(e){const{roomId:s,entrySeq:o,entries:a,historyLoaded:b}=e,r=o===void 0?null:`${s}:${o}`,i=n.useMemo(()=>{if(o===void 0)return null;const I=a.find(d=>d.seq===o);if(I===void 0)return null;const A=He(a,I.id);if(A===null)return null;const g=ye(I)??null,C=g!==null&&A.rowId!==I.id;return{roomRowId:A.rowId,threadRootId:C?g:null,entryId:I.id}},[a,o]),p=n.useRef(null),v=(i==null?void 0:i.threadRootId)??null;n.useEffect(()=>{r===null||v===null||p.current!==r&&(p.current=r,Z.getState().openThread(s,v))},[r,s,v]);const h=n.useRef(null);n.useEffect(()=>{r===null||!b||i===null&&h.current!==r&&(h.current=r,ot.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,b,i]);const m=n.useRef(null),f=n.useCallback(()=>{if(!(r===null||m.current===r))return m.current=r,i==null?void 0:i.roomRowId},[r,i]),j=n.useRef(null),k=n.useCallback(()=>{if(!(r===null||j.current===r))return j.current=r,(i==null?void 0:i.threadRootId)===null||i==null?void 0:i.entryId},[r,i]);return{roomRow:o===void 0?void 0:f,threadRow:o===void 0?void 0:k}}function hn(e,s){const[o,a]=n.useState({roomId:null,seq:null});return o.roomId===e?o.seq:e===null?(a({roomId:null,seq:null}),null):s===null?null:(a({roomId:e,seq:s}),s)}const pn=600;function gn(e){return document.getElementById(ce(e))??document.getElementById(me(e))}function xn(){const e=n.useRef(null);return n.useEffect(()=>()=>{var o;return(o=e.current)==null?void 0:o.call(e)},[]),{arm:n.useCallback(o=>{var p;(p=e.current)==null||p.call(e);let a=0;const b=Date.now()+pn;let r=!1;const i=()=>{if(r)return;const v=document.activeElement;if(v===null||v===document.body||!v.isConnected){const m=gn(o);if(m!==null){m.focus();return}}Date.now()>=b||(a=requestAnimationFrame(i))};a=requestAnimationFrame(i),e.current=()=>{r=!0,cancelAnimationFrame(a)}},[])}}function vn({roomId:e,route:s,urlThreadId:o,openThreadId:a,entries:b,historyLoaded:r}){const i=rt(),p=n.useRef(null);n.useEffect(()=>{if(e!==null){if(p.current!==e&&(p.current=e,o!==void 0)){Z.getState().openThread(e,o);return}if(r&&a!==void 0){const v=b.find(m=>m.id===a),h=v===void 0?void 0:$t(v);if(h!==void 0&&h!==a){const m=Z.getState().open[e];Z.getState().openThread(e,h,(m==null?void 0:m.focusComposer)??!1);return}}a!==o&&(i==null||i({to:s,search:v=>({...v,thread:a}),replace:!0}))}},[e,s,a,o,b,r,i])}function Rn(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(s=>s.author.kind==="agent")}function yn({room:e,hasEntries:s,onAddAgents:o}){return!s||!Rn(e)?null:t.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",t.jsx("button",{type:"button",onClick:o,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function bn({roomId:e}){const{approvals:s}=at(),o=it(s).filter(a=>a.roomId===e);return o.length===0?null:t.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:t.jsx(dt,{approvals:o})})}function jn({roomId:e}){const{data:s}=Yt("pending"),o=(s??[]).filter(a=>a.roomId===e);return o.length===0?null:t.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:o.map(a=>t.jsx(Qt,{request:a},a.requestId))})}const wn="An agent",Ae=64,ue=3,kn=new Set;function Be({room:e,entries:s,scope:o,laneScope:a,stalled:b,unavailable:r=!1,onRetry:i,onScrollToRow:p}){const v=lt(),h=ut(e.id,o),m=ct(e.id,o),f=ft(e.id,o),[j,k]=n.useState(!1),I=Vt(e.id,{enabled:j}),A=mt(),{mutate:g}=Zt(),[C,d]=n.useState(kn),u=n.useCallback(l=>{d(w=>new Set(w).add(l)),g({roomId:e.id,authorId:l},{onSettled:()=>d(w=>{const R=new Set(w);return R.delete(l),R})})},[g,e.id]),O=Jt(),[_,S]=n.useState(()=>new Map),B=ht(),T=Re(),P=n.useMemo(()=>ve(e.members,e.formerAuthors),[e.members,e.formerAuthors]),D=n.useCallback(l=>{var w;return((w=P.get(l))==null?void 0:w.displayName)??wn},[P]),{interactions:Q}=pt(),H=n.useMemo(()=>Q.filter(l=>l.roomId===e.id),[Q,e.id]),$=n.useMemo(()=>{var w;const l={};for(const R of H){if(R.roomAuthorId===void 0)continue;const E=(w=P.get(R.roomAuthorId))==null?void 0:w.displayName;E!==void 0&&(l[R.sessionId]=E)}return l},[H,P]),K=n.useMemo(()=>h.map(l=>({authorId:l.authorId,name:D(l.authorId),state:l.state,since:l.since,activity:l.activity??null})),[h,D]),F=n.useMemo(()=>m.map(l=>{var R;const w=(R=B.data)==null?void 0:R.find(E=>E.id===l.behindRoomId);return{authorId:l.authorId,name:D(l.authorId),since:l.since,behind:{roomId:l.behindRoomId,title:w===void 0?null:te(w)},othersWaiting:l.othersWaiting,severalInTheWay:l.severalInTheWay}}),[m,D,B.data]),G=n.useMemo(()=>{const l=new Set;for(const w of m)_.get(w.authorId)===w.entryId&&l.add(w.authorId);return l},[m,_]),X=n.useMemo(()=>f===null?null:{authorId:f.authorId,name:D(f.authorId)},[f,D]),L=n.useMemo(()=>Ut({capabilities:be,asks:H,agentNames:$,stalled:b,presence:K,held:F,silentFinish:X,turn:null}),[H,$,K,F,X,b]),q=n.useMemo(()=>{var w;const l=new Map;for(const R of((w=I.data)==null?void 0:w.bindings)??[])l.set(R.authorId,R.sessionId);return l},[I.data]),W=n.useCallback(l=>{const w=s.find(E=>E.id===l);if(w===void 0)return null;const R=w.body.text.replace(/\s+/gu," ").trim();return R.length===0?null:R.length>Ae?`${R.slice(0,Ae).trimEnd()}…`:R},[s]),c=n.useCallback(l=>{var w;return a==="thread"?re(l):((w=He(s,l))==null?void 0:w.domId)??null},[s,a]),x=n.useMemo(()=>{const l=h.map(R=>{const E=W(R.entryId),ee=c(R.entryId);return{authorId:R.authorId,author:V(R.authorId,P,T.faces),state:R.state,since:R.since,doing:gt(R.activity),replyingTo:E===null||ee===null?null:{entryId:R.entryId,excerpt:E,rowId:ee},sessionId:q.get(R.authorId)??null}}),w=F.map(R=>({authorId:R.authorId,author:V(R.authorId,P,T.faces),state:"held",since:R.since,doing:null,replyingTo:null,sessionId:null,behind:R.behind,othersWaiting:R.othersWaiting}));return[...l,...w]},[h,F,P,T.faces,W,c,q]),z=n.useMemo(()=>{if(h.length===0)return null;const l=h.slice(0,ue);return t.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[l.map(w=>t.jsx(Xt,{author:V(w.authorId,P,T.faces),className:"ring-background size-4 ring-2"},w.authorId)),h.length>ue&&t.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${h.length-ue}`})]})},[h,P,T.faces]);return t.jsx(J.LiveLane,{state:L,scope:a,onRetry:i,unavailable:r,faces:z,onPeekOpenChange:k,askCard:L.kind==="ask"?t.jsx(vt,{ask:L.ask,...$[L.ask.sessionId]?{agentName:$[L.ask.sessionId]}:{},onOpenSession:l=>{v(ke({session:l}))},className:"border-l-0"}):void 0,peek:t.jsx(J.LivePeek,{rows:x,onScrollToRow:p,onOpenSession:l=>{v(ke({session:l}))},onOpenRoom:l=>{v({...xt.channels(),search:{id:l}})},onAnswerFirst:l=>{const w=m.find(R=>R.authorId===l);w!==void 0&&S(R=>new Map(R).set(l,w.entryId)),O.mutate({roomId:e.id,authorId:l})},promoted:G,onStopAll:()=>A.mutate({roomId:e.id}),stopping:A.isPending,onStopAgent:u,stoppingAgents:C})})}const Se=3e3;function Nn(e,s,o,a=Date.now){const b=n.useRef(null),r=n.useRef(new Map),i=n.useRef(new Map),p=b.current,v=r.current,h=i.current,m=a();for(const f of e){if(h.has(f.id))continue;if(p===null){h.set(f.id,"at-rest");continue}const j=v.get(f.authorId);h.set(f.id,j!==void 0&&m-j<Se?"handed-off":"dropped")}return n.useEffect(()=>{if(!o)return;b.current=new Set(e.map(j=>j.id));const f=a();for(const j of s)r.current.set(j,f);for(const[j,k]of r.current)f-k>Se&&r.current.delete(j);for(const j of i.current.keys())b.current.has(j)||i.current.delete(j)}),h}function In({kind:e}){return e==="thread-error"?t.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),t.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?t.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[t.jsx(se,{className:"h-3 w-24"}),t.jsx(se,{className:"h-3 w-full max-w-sm"})]}):t.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs",children:"This thread’s first message is gone. Its replies remain."})}function An({room:e,rootEntryId:s,focusComposer:o,entries:a,reactionFrequents:b,streamStalled:r,streamUnavailable:i,onRetryStream:p,historyLoaded:v,historyFailed:h=!1,landOnRow:m,pushed:f,onClose:j}){const k=n.useMemo(()=>ve(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=$e({room:e,threadRootId:s}),A=Ee(e.members,e.viewerAuthorId),g=Re(),C=n.useMemo(()=>new Map([...k].map(([c,x])=>[c,x.displayName])),[k]),{root:d,replies:u}=n.useMemo(()=>{let c;const x=[];for(const z of a)z.id===s?c=z:ye(z)===s&&x.push(z);return{root:c,replies:x}},[a,s]),O=d==null?void 0:d.threadReplyCount,_=O!==void 0&&O>u.length,S=!f,B=d===void 0||_?-1:(S?1:0)+u.length,T=Fe(u.length,O),P=n.useMemo(()=>new Set(u.map(c=>c.id)),[u]),D=n.useMemo(()=>({replyIds:P,inside:!0}),[P]),Q=Rt(e.id,D),H=Pe(e.id,s),$=Nn(u,Q,v),K=n.useRef(null),F=n.useCallback(c=>{var x;(x=K.current)==null||x.scrollToRow(c)},[]),G=n.useRef(null);n.useEffect(()=>{var c;o||(c=G.current)==null||c.focus()},[s,o]);const X=c=>{c.key!=="Escape"||c.defaultPrevented||(c.stopPropagation(),j())},L=n.useMemo(()=>{const c=[];if(d===void 0){const x=h?"thread-error":v?"thread-orphan":"thread-waiting";c.push({kind:"notice",id:x,at:"",body:null})}else S&&c.push({kind:"message",id:d.id,payload:d,grouping:{position:"only"},author:V(oe(d,k),k,g.faces),at:d.createdAt});for(const x of u)c.push({kind:"message",id:x.id,payload:x,grouping:{position:"only"},author:V(oe(x,k),k,g.faces),at:x.createdAt});return c},[d,S,u,k,g.faces,h,v]),q=n.useCallback(c=>{if(c.kind==="notice")return t.jsx(In,{kind:c.id});if(c.kind!=="message")return null;const x=c.payload,z=d!==void 0&&x.id===d.id,l=u.findIndex(E=>E.id===x.id),w=t.jsx(fe,{roomId:e.id,entry:x,rowId:re(x.id),roomKind:e.kind,author:c.author,authorRef:k.get(x.authorId),authors:k,viewerAuthorId:e.viewerAuthorId,authorNames:C,reactionFrequents:b,streamStalled:r,isMember:A,grouping:{position:"only"},answers:De(x,l<=0?d:u[l-1],E=>(d==null?void 0:d.id)===E?d:u.find(ee=>ee.id===E)),feedPosition:{index:z?1:(d===void 0||!S?0:1)+l+1,total:B}});if(z)return t.jsxs(t.Fragment,{children:[w,t.jsx(Ce,{count:T})]});const R=$.get(x.id)??"at-rest";return t.jsx("div",{className:ae(R==="dropped"&&"motion-safe:animate-thread-reply-in",R==="handed-off"&&"motion-safe:animate-reply-settle"),children:w})},[d,S,u,T,$,e.id,e.kind,e.viewerAuthorId,k,C,b,r,A,B]),W=n.useCallback(c=>c.kind==="message"?re(c.id):void 0,[]);return t.jsx(ze,{known:g,children:t.jsx(J.Root,{surface:"room",capabilities:be,target:I.target,anchor:"rail",children:t.jsxs("section",{ref:G,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:X,className:ae("bg-card flex min-h-0 flex-col outline-none",f?"h-full w-full":"w-full border-l"),children:[f?t.jsxs("header",{className:"flex items-center gap-2 border-b px-1 py-1",children:[t.jsxs("button",{type:"button",onClick:j,"aria-label":`Back to ${te(e)}`,"data-testid":"room-thread-back",className:"focus-ring text-muted-foreground hover:text-foreground flex h-11 min-w-0 items-center gap-1 rounded px-2 text-sm",children:[t.jsx(yt,{"aria-hidden":!0,className:"size-4 shrink-0"}),t.jsx("span",{className:"truncate",children:te(e)})]}),t.jsx("p",{className:"ml-auto shrink-0 pr-3 text-sm font-medium",children:"Thread"})]}):t.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[t.jsx("button",{type:"button",onClick:j,"aria-label":"Close thread",className:"focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1",children:t.jsx(bt,{"aria-hidden":!0,className:"size-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium",children:"Thread"}),t.jsx("p",{className:"text-muted-foreground truncate text-xs",children:te(e)})]})]}),f&&d!==void 0&&t.jsxs("div",{"data-testid":"room-thread-pinned-root",className:"max-h-[40%] shrink-0 overflow-y-auto border-b pt-2",children:[t.jsx(fe,{roomId:e.id,entry:d,rowId:re(d.id),roomKind:e.kind,author:V(oe(d,k),k,g.faces),authorRef:k.get(d.authorId),authors:k,viewerAuthorId:e.viewerAuthorId,authorNames:C,reactionFrequents:b,streamStalled:r,isMember:A,grouping:{position:"only"}}),t.jsx(Ce,{count:T})]}),t.jsx(J.Timeline,{ref:K,conversationId:`thread-${s}`,label:`Thread in ${te(e)}`,busy:!v&&!h,rows:L,renderRow:q,domIdOf:W,...m===void 0?{}:{landOnRow:m},pending:H,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Be,{room:e,entries:a,scope:D,laneScope:"thread",stalled:f&&r===!0,unavailable:i,onRetry:f?p:void 0,onScrollToRow:F}),t.jsx(qe,{room:e,threadRootId:s,attachments:I.attachments,focusOnMount:o},s)]})})})}function Ce({count:e}){return e===0?null:t.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[t.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e===1?"1 reply":`${e} replies`}),t.jsx("span",{className:"bg-border h-px flex-1"})]})}const Sn=96,Cn=500;function Mn(e){return e.offset.x>Sn||e.velocity.x>Cn}function Tn({children:e,onClose:s}){const o=jt()===!0,a=o?{x:0}:{x:"100%"};return t.jsx(xe.div,{"data-testid":"room-thread-sheet",className:"bg-card absolute inset-0 z-10 flex flex-col shadow-xl",initial:a,animate:{x:0},exit:a,transition:o?{duration:0}:{duration:.22,ease:[.32,.72,0,1]},drag:"x",dragDirectionLock:!0,dragConstraints:{left:0,right:0},dragElastic:{left:0,right:.9},dragMomentum:!1,onDragEnd:(b,r)=>{Mn(r)&&s()},children:e})}const ie="room-thread-split",On=320,En=360,Pn=40,_n=50,Ln=25;function Me(e,s){return s<=0?Ln:Math.min(Math.round(e/s*1e3)/10,_n)}function Dn(e){const s=Me(On,e),o=Math.round((100-Me(En,e))*10)/10;return{minPct:s,maxPct:o,defaultPct:Math.min(Math.max(Pn,s),o)}}function Fn(e,s,o){if(e===null||s===null||s<=0)return o.defaultPct;const a=e/s*100;return Math.round(Math.min(Math.max(a,o.minPct),o.maxPct)*10)/10}function zn(e){try{const s=localStorage.getItem(e),o=s===null?NaN:Number(s);return Number.isFinite(o)&&o>0?o:null}catch{return null}}function Hn(e,s){try{localStorage.setItem(e,String(Math.round(s)))}catch{}}const $n="react-resizable-panels:room-thread-split";function qn(){try{localStorage.removeItem($n)}catch{}}function Wn(){const[e,s]=n.useState(null),[o,a]=n.useState(null);return{ref:n.useCallback(r=>{if(r===null)return;s(r);const i=()=>a(r.offsetWidth);i();const p=new ResizeObserver(i);return p.observe(r),()=>{p.disconnect(),s(null),a(null)}},[]),element:e,width:o,sizing:Dn(o??0)}}const Bn=`${ie}-room`,Te=`${ie}-thread`,Oe=`${ie}-handle`,Kn=4;function Gn({room:e,thread:s,storageKey:o=kt.ROOM_THREAD_WIDTH}){const{ref:a,element:b,width:r,sizing:i}=Wn(),[p,v]=n.useState(()=>zn(o)),[h,m]=n.useState(null),f=n.useRef(null),j=Fn(p,r,i),k=r===null||(i.maxPct-i.minPct)/100*r<Kn,I=s!==!1;n.useEffect(qn,[]);const A=n.useRef(!1);n.useLayoutEffect(()=>{var u;A.current&&((u=f.current)==null||u.resize(j))},[j,I]);const g=n.useRef(null),C=()=>{var S;const u=(S=f.current)==null?void 0:S.getSize(),O=g.current;if(g.current=null,u===void 0||r===null||r<=0||O===u)return;const _=Math.round(u/100*r);v(_),Hn(o,_)},d=h??j;return n.useLayoutEffect(()=>{const u=b==null?void 0:b.querySelector(`[data-panel-resize-handle-id="${Oe}"]`);u&&(u.setAttribute("aria-controls",Te),u.setAttribute("aria-valuenow",String(Math.round(d))),u.setAttribute("aria-valuemin",String(Math.round(i.minPct))),u.setAttribute("aria-valuemax",String(Math.round(i.maxPct))))}),t.jsx("div",{ref:a,className:"h-full overflow-hidden",children:t.jsxs(wt,{direction:"horizontal",id:ie,onLayout:u=>{A.current=u.length>1,m(A.current?u[1]:null)},children:[t.jsx(Ne,{id:Bn,order:1,className:"flex",children:e}),I&&t.jsxs(t.Fragment,{children:[t.jsx(Tt,{id:Oe,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:k,onDragging:u=>{var O;u&&(g.current=((O=f.current)==null?void 0:O.getSize())??null)},onKeyDownCapture:u=>{var O,_;k||(g.current=((O=f.current)==null?void 0:O.getSize())??null,!(u.key!=="Home"&&u.key!=="End")&&(u.preventDefault(),(_=f.current)==null||_.resize(u.key==="Home"?i.minPct:i.maxPct)))},onResizeEnd:C}),t.jsx(Ne,{ref:f,id:Te,order:2,defaultSize:j,minSize:i.minPct,maxSize:i.maxPct,className:"flex",children:s})]})]})})}function ns({roomId:e,threadId:s,entrySeq:o,threadRoute:a,aboveTimeline:b,aboveComposer:r,offerJumpBackIn:i,onComposerFocusChange:p}){const v=Nt(),h=Ot(),m=It(e),f=m==null?void 0:m.rootEntryId,j=xn(),k=n.useCallback(()=>{var x;const c=(x=Z.getState().open[e])==null?void 0:x.rootEntryId;Z.getState().closeThread(e),c!==void 0&&j.arm(c)},[e,j]),I=n.useCallback(c=>{Z.getState().openThread(e,c)},[e]),A=At(e),g=St(e),C=_t(e,g.isSuccess);Lt(e);const d=A.data,u=n.useMemo(()=>g.data??[],[g.data]),O=$e({room:d});vn({roomId:e,route:a,urlThreadId:s,openThreadId:f,entries:u,historyLoaded:g.isSuccess});const _=n.useMemo(()=>{var c;return((c=d==null?void 0:d.members.find(x=>x.author.id===d.viewerAuthorId))==null?void 0:c.lastReadSeq)??null},[d]),S=hn(e,_);Ct(d,u);const B=n.useRef(null),T=n.useRef(void 0),P=n.useCallback(c=>{T.current=c},[]),D=n.useCallback(()=>T.current,[]);n.useLayoutEffect(()=>{T.current=void 0},[e]);const Q=n.useCallback(c=>{var x;(x=B.current)==null||x.scrollToRow(c)},[]),H=en(e),{loadOlder:$,cursor:K}=H,F=n.useCallback(()=>{const c=qt(u,K);$().then(()=>{c!==null&&requestAnimationFrame(()=>{var x;return(x=B.current)==null?void 0:x.scrollToRow(c.domId)})})},[u,K,$]),G=mn({roomId:e,entrySeq:o,entries:u,historyLoaded:g.isSuccess}),X=n.useMemo(()=>f===void 0?void 0:{replyIds:new Set(u.filter(x=>ye(x)===f).map(x=>x.id)),inside:!1},[u,f]);if(A.isLoading)return t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(We,{})});if(A.isError||!d)return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),t.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const L=m!==void 0&&t.jsx(An,{room:d,rootEntryId:m.rootEntryId,focusComposer:m.focusComposer,entries:u,reactionFrequents:d.reactionFrequents,streamStalled:C.stalled,streamUnavailable:C.unavailable,onRetryStream:C.retry,historyLoaded:g.isSuccess,historyFailed:g.isError,...G.threadRow===void 0?{}:{landOnRow:G.threadRow},pushed:v,onClose:k},m.rootEntryId),q=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[b,t.jsx(cn,{ref:B,roomId:d.id,roomKind:d.kind,roomName:te(d),viewerAuthorId:d.viewerAuthorId,entries:u,members:d.members,formerAuthors:d.formerAuthors,lastReadSeq:S,reactionFrequents:d.reactionFrequents,streamStalled:C.stalled,isLoading:g.isLoading,error:g.error,onAddAgents:()=>Ie("add",d.id),openThreadId:f,onOpenThread:I,resumeRow:D,...G.roomRow===void 0?{}:{landOnRow:G.roomRow},onTopRow:P,canLoadOlder:H.canLoadOlder,isLoadingOlder:H.isLoadingOlder,onLoadOlder:F}),r,t.jsx(bn,{roomId:d.id}),t.jsx(jn,{roomId:d.id}),t.jsx(Be,{room:d,entries:u,scope:X,laneScope:"room",stalled:C.stalled,unavailable:C.unavailable,onRetry:C.retry,onScrollToRow:Q}),t.jsx(yn,{room:d,hasEntries:u.length>0,onAddAgents:()=>Ie("add",d.id)}),t.jsx(qe,{room:d,attachments:O.attachments,offerJumpBackIn:i,onFocusChange:p},d.id)]}),W={surface:"room",capabilities:be,target:O.target,anchor:"rail"};return v?t.jsx(J.Root,{...W,children:t.jsx("div",{style:{paddingBottom:h},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:L!==!1,"data-testid":"room-under-thread",children:q}),t.jsx(Mt,{initial:!1,children:L!==!1&&t.jsx(Tn,{onClose:k,children:L},`thread-${f}`)})]})})}):t.jsx(J.Root,{...W,children:t.jsx(Gn,{room:q,thread:L})})}export{ns as R,tn as T,We as a};
@@ -1 +1 @@
1
- import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-BR1m9FON.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
1
+ import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-B2JoVHek.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
@@ -1 +1 @@
1
- import{r as D,ej as Ee,j as e,Z as ye,_ as we,a2 as Ae,G as C,by as ue,bz as fe,en as ke,eo as ie,a4 as Le,bA as me,bC as xe,a5 as De,a7 as Te,a8 as Oe,af as pe,aO as $e,ep as he,eq as Ie,er as Pe,es as _e,aa as N,et as Ue,eu as R,ev as Me,ao as be,B as Re,U as Be,b as He,e as ze,ew as Ke,ex as qe,ey as Qe,ez as Ve,eA as Fe,eB as Ge}from"./index-BR1m9FON.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as L}from"./execution-config-BS5rtvTZ.js";import{U as Ze}from"./unverified-catalog-notice-C8swqaTn.js";import{s as Je}from"./settings-for-runtime-BoOa-ZFG.js";const et={duration:.12,ease:"easeOut"};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=D.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,v=Ee(),p=e.jsx(ye,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:v?{duration:0}:et,className:"block truncate",children:o},o)});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx(ke,{size:"sm",icon:r?Le:void 0,iconClassName:r?ie.warning:void 0,"aria-label":`Set here${r?`: ${r}`:""}`,title:r?`${o}: ${r}`:o,className:s,"data-testid":d,children:p})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:C("px-2 pt-1 text-xs",ie.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):e.jsx(Ae,{size:"xs",tone:r?"warning":"neutral",title:r?`${o}: ${r}`:o,"aria-label":r?`${o}: ${r}`:void 0,className:C("max-w-56",s),"data-testid":d,children:p})}const tt=["agents"];function st(a){const l=De(),i=Te();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:tt})}})}const je="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function U({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:v=!0,className:p,describedBy:m,inheritText:T}){const w=pe(),[S,h]=D.useState(!1);return e.jsxs("div",{className:C("space-y-1",p),children:[v&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:C("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Be,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:C("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:T??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function at({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,oe,le,re,de;const r=pe(),{data:s}=$e(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:v}=Ie(),p=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,k;return((k=(b=v==null?void 0:v.defaults)==null?void 0:b[t])==null?void 0:k.runsOn)==="credits"}}),{data:m,isError:T}=Pe({runtime:o,...p?{account:N}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=p&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,A=a.model??h??(E==null?void 0:E.value)??null,B=o==="doe"&&c&&!w&&!h,x=A?(m??[]).find(t=>t.value===A):void 0,O=(n==null?void 0:n.supportsEffort)??((ae=Je(d,o))==null?void 0:ae.supportsEffort),H=O===void 0&&u,z=O!==!1,K=x?x.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:Q,creditsEntry:ge,resolvedAccount:V}=_e(),F=ge??(a.account===N&&((oe=s==null?void 0:s.claudeCode)!=null&&oe.credits)?{path:s.claudeCode.credits.path}:null),j=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:Q(t.path),path:t.path}]),...F?[{id:N,label:Ue,path:F.path}]:[]],g=a.account??null,G=g!==null,W=o==="claude-code"&&g===N&&((le=s==null?void 0:s.claudeCode)==null?void 0:le.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),$=s!=null&&s.claudeCode&&V?Q(V):null,I=st({errorLabel:"Couldn’t change this agent’s account"}),P=D.useCallback(t=>{I.mutate({id:a.id,updates:{account:t}})},[a.id,I]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:j,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:O,runtimeLabel:t=>R(t).label}),y=t=>{var b;return((b=Ne.breakages.find(k=>t.includes(k.kind)))==null?void 0:b.message)??null},_=!H&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=R(o).label,Ce=o==="claude-code"&&j!==void 0&&(j.length>1||G),Se=y(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=D.useId();return e.jsxs("div",{className:C("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{label:"Model",valueLabel:B?ce:(x==null?void 0:x.displayName)??A??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:A,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:B?ce:c&&!h?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Ze,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),p&&T&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:"Effort"}),(!r||!_)&&(S||_)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),H?e.jsx(M,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?_?e.jsx(U,{label:"Effort",valueLabel:L(X),options:Me.filter(t=>!(x!=null&&x.supportedEffortLevels)||x.supportedEffortLevels.includes(t)).map(t=>({value:t,label:L(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(M,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(M,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:y(["effort-unsupported-runtime"])})]}),Ce&&e.jsx(U,{label:"Account",valueLabel:W?$??"Default":g!==null?((de=j==null?void 0:j.find(t=>t.id===g))==null?void 0:de.label)??g:$??"Default",options:(j??[]).map(t=>({value:t.id,label:t.label,hint:t.id===N?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:G,serverDefault:$,warning:Se,onSelect:t=>P(t),onInherit:()=>P(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Re,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:I.isPending,onClick:()=>P(N),children:"Allow"})]})]})}function M({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const nt="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function ct({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(ze,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:nt,children:"Runs on"}),e.jsxs(Ke,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(qe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Qe,{})}),e.jsx(Ve,{children:f.map(o=>e.jsx(Fe,{value:o,responsive:!1,children:R(o).label},o))})]})]}),e.jsx(at,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ge,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{ct as RunsOnPopover};
1
+ import{r as D,ej as Ee,j as e,Z as ye,_ as we,a2 as Ae,G as C,by as ue,bz as fe,en as ke,eo as ie,a4 as Le,bA as me,bC as xe,a5 as De,a7 as Te,a8 as Oe,af as pe,aP as $e,ep as he,eq as Ie,er as Pe,es as _e,aa as N,et as Ue,eu as R,ev as Me,ao as be,B as Re,U as Be,b as He,e as ze,ew as Ke,ex as qe,ey as Qe,ez as Ve,eA as Fe,eB as Ge}from"./index-B2JoVHek.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as L}from"./execution-config-U_R_H28y.js";import{U as Ze}from"./unverified-catalog-notice-CQoKhOjQ.js";import{s as Je}from"./settings-for-runtime-BoOa-ZFG.js";const et={duration:.12,ease:"easeOut"};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=D.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,v=Ee(),p=e.jsx(ye,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:v?{duration:0}:et,className:"block truncate",children:o},o)});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx(ke,{size:"sm",icon:r?Le:void 0,iconClassName:r?ie.warning:void 0,"aria-label":`Set here${r?`: ${r}`:""}`,title:r?`${o}: ${r}`:o,className:s,"data-testid":d,children:p})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:C("px-2 pt-1 text-xs",ie.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):e.jsx(Ae,{size:"xs",tone:r?"warning":"neutral",title:r?`${o}: ${r}`:o,"aria-label":r?`${o}: ${r}`:void 0,className:C("max-w-56",s),"data-testid":d,children:p})}const tt=["agents"];function st(a){const l=De(),i=Te();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:tt})}})}const je="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function U({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:v=!0,className:p,describedBy:m,inheritText:T}){const w=pe(),[S,h]=D.useState(!1);return e.jsxs("div",{className:C("space-y-1",p),children:[v&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:C("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Be,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:C("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:T??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function at({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,oe,le,re,de;const r=pe(),{data:s}=$e(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:v}=Ie(),p=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,k;return((k=(b=v==null?void 0:v.defaults)==null?void 0:b[t])==null?void 0:k.runsOn)==="credits"}}),{data:m,isError:T}=Pe({runtime:o,...p?{account:N}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=p&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,A=a.model??h??(E==null?void 0:E.value)??null,B=o==="doe"&&c&&!w&&!h,x=A?(m??[]).find(t=>t.value===A):void 0,O=(n==null?void 0:n.supportsEffort)??((ae=Je(d,o))==null?void 0:ae.supportsEffort),H=O===void 0&&u,z=O!==!1,K=x?x.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:Q,creditsEntry:ge,resolvedAccount:V}=_e(),F=ge??(a.account===N&&((oe=s==null?void 0:s.claudeCode)!=null&&oe.credits)?{path:s.claudeCode.credits.path}:null),j=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:Q(t.path),path:t.path}]),...F?[{id:N,label:Ue,path:F.path}]:[]],g=a.account??null,G=g!==null,W=o==="claude-code"&&g===N&&((le=s==null?void 0:s.claudeCode)==null?void 0:le.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),$=s!=null&&s.claudeCode&&V?Q(V):null,I=st({errorLabel:"Couldn’t change this agent’s account"}),P=D.useCallback(t=>{I.mutate({id:a.id,updates:{account:t}})},[a.id,I]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:j,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:O,runtimeLabel:t=>R(t).label}),y=t=>{var b;return((b=Ne.breakages.find(k=>t.includes(k.kind)))==null?void 0:b.message)??null},_=!H&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=R(o).label,Ce=o==="claude-code"&&j!==void 0&&(j.length>1||G),Se=y(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=D.useId();return e.jsxs("div",{className:C("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{label:"Model",valueLabel:B?ce:(x==null?void 0:x.displayName)??A??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:A,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:B?ce:c&&!h?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Ze,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),p&&T&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:"Effort"}),(!r||!_)&&(S||_)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),H?e.jsx(M,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?_?e.jsx(U,{label:"Effort",valueLabel:L(X),options:Me.filter(t=>!(x!=null&&x.supportedEffortLevels)||x.supportedEffortLevels.includes(t)).map(t=>({value:t,label:L(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(M,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(M,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:y(["effort-unsupported-runtime"])})]}),Ce&&e.jsx(U,{label:"Account",valueLabel:W?$??"Default":g!==null?((de=j==null?void 0:j.find(t=>t.id===g))==null?void 0:de.label)??g:$??"Default",options:(j??[]).map(t=>({value:t.id,label:t.label,hint:t.id===N?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:G,serverDefault:$,warning:Se,onSelect:t=>P(t),onInherit:()=>P(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Re,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:I.isPending,onClick:()=>P(N),children:"Allow"})]})]})}function M({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const nt="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function ct({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(ze,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:nt,children:"Runs on"}),e.jsxs(Ke,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(qe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Qe,{})}),e.jsx(Ve,{children:f.map(o=>e.jsx(Fe,{value:o,responsive:!1,children:R(o).label},o))})]})]}),e.jsx(at,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ge,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{ct as RunsOnPopover};