dorkos 0.132.0 → 0.133.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 (323) hide show
  1. package/dist/bin/cli.js +188 -76
  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-Co7dVF9Z.js → AboutPage-D-EHHVPa.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-BrTkXZ6h.js → ActivityErrorState-BTHnE1vP.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-Vk3zC2wX.js → ActivityPage-BfSLPIdR.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-D_zqfTtI.js → ActivityRow-PwUBjQw8.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Ba90gZtO.js → AdapterIcon-DgkNN6bi.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-CzlKjgS0.js → AdapterSetupWizard-DX0dzp7q.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-YsNMoqxA.js → AgentOptionRow-ApuDEKqq.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-Chtkpz5v.js → AgentPicker-BDci-9aL.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-BSvTh8P0.js → AgentRequestCard-B2gxCMGi.js} +3 -3
  13. package/dist/client/assets/{AppearancePage-DQXsbxwz.js → AppearancePage-8SVnFe0k.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-Dz4dRYKs.js → ApplyToOverridesDialog-CnL1ubxL.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-D9Gs4fQW.js → AttentionSignalRow-CCKhUtil.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-frMjE1fG.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-B7wFPzG4.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-CMbJI0MX.js → BindingDialog-C4BHVXno.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-Dz8rAsfT.js → BlintzCanvas-7E5uwVms.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-FMSGU_ae.js → CanvasCsvContent-l7lfyDGn.js} +1 -1
  20. package/dist/client/assets/{CanvasFileContent-CecxcpLI.js → CanvasFileContent-Bqd0IEfK.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-C66rrYY-.js → CanvasModel3dContent-DqL0Sy4r.js} +2 -2
  22. package/dist/client/assets/{ChannelComposer-EZk2JgmU.js → ChannelComposer-CAYvz_ZB.js} +5 -5
  23. package/dist/client/assets/{ChatAppsOff-CM043XGQ.js → ChatAppsOff-CNeKBVNz.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-CCnDdKmg.js → CodeMirrorDiff-BZRcNFsS.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-Ct5GtLSd.js → CodeMirrorEditor-DD5tArRn.js} +1 -1
  26. package/dist/client/assets/{ComputerResourceView-dXV2M5eB.js → ComputerResourceView-BUmsVssG.js} +1 -1
  27. package/dist/client/assets/{ComputerViewer-4Aq0_cCL.js → ComputerViewer-BKMR5LkF.js} +1 -1
  28. package/dist/client/assets/{ConnectionAccessLists-DfIlofzc.js → ConnectionAccessLists-DYUiFmPY.js} +1 -1
  29. package/dist/client/assets/{ConnectionsPage-Ck4qQt1-.js → ConnectionsPage-DR2Kfm9Q.js} +1 -1
  30. package/dist/client/assets/{ConventionPage-z4phQYn0.js → ConventionPage-Do6q8873.js} +1 -1
  31. package/dist/client/assets/{ExtensionPageRoute-5chyBxxz.js → ExtensionPageRoute-CP7NM7fw.js} +1 -1
  32. package/dist/client/assets/{FeatureDisabledState-DrNY_0RT.js → FeatureDisabledState-Bi23k3rg.js} +1 -1
  33. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BeWxYbjO.js → FloatingTanStackRouterDevtools-CqogiFob-lRlmDXYz.js} +1 -1
  34. package/dist/client/assets/{ForwardConsentHost-BVh663l5.js → ForwardConsentHost-DSR1pEEK.js} +1 -1
  35. package/dist/client/assets/HandlePage-aHId3bYX.js +1 -0
  36. package/dist/client/assets/HeartbeatPage-BTNVcHOI.js +1 -0
  37. package/dist/client/assets/{KeyEntry-Z5hKKbef.js → KeyEntry-67acsEG2.js} +1 -1
  38. package/dist/client/assets/{LexicalField-C6xJGRPF.js → LexicalField-Cb68LIar.js} +1 -1
  39. package/dist/client/assets/{ManagesPage-CgicR4Kd.js → ManagesPage-ChPlBF42.js} +1 -1
  40. package/dist/client/assets/{Marketplace-vLgSIgdn.js → Marketplace-CzPhJEE1.js} +1 -1
  41. package/dist/client/assets/{MarketplaceSourcesView-Dth8Z9u3.js → MarketplaceSourcesView-CmQgxQmU.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-DAPJUxUi.js → McpAppFrame-z5JUaCSA.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-D4j1GIhT.js → McpSigninBody-ZrnzwrOH.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-BqErc378.js → Model3dViewer-HJpWK-JI.js} +1 -1
  45. package/dist/client/assets/NamePage-C7F-SotG.js +1 -0
  46. package/dist/client/assets/{NewDirectMessageMenu-BC7MdqUz.js → NewDirectMessageMenu-CjBjzsDe.js} +1 -1
  47. package/dist/client/assets/{NotificationsPage-DsO88sso.js → NotificationsPage-DwNUI0Z3.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-Bv623x0o.js → OpenMeshSwitch-RNAZY1vn.js} +1 -1
  49. package/dist/client/assets/{OperatorIdentityForm-C1knkmdh.js → OperatorIdentityForm-B7S2C_eT.js} +1 -1
  50. package/dist/client/assets/{PermissionHistory-BaQShYqE.js → PermissionHistory-D0chstxf.js} +1 -1
  51. package/dist/client/assets/{PermissionsPage-C74Pvkwc.js → PermissionsPage-ToK0DZVV.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-CD0qi79s.js → PersonalityPopover-BvMtUQRM.js} +1 -1
  53. package/dist/client/assets/PhotoPage-Cqo3PNO_.js +1 -0
  54. package/dist/client/assets/{PreviewRefusedNotice-BtTsn6IU.js → PreviewRefusedNotice-DzbkMrUo.js} +1 -1
  55. package/dist/client/assets/{ProfileFields-qnjDsdIB.js → ProfileFields-DU8dTGHT.js} +1 -1
  56. package/dist/client/assets/{ProfilePanelContainer-B01W49_v.js → ProfilePanelContainer-BfT-ufV7.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-LcLX20fO.js → ProfileRolePicker-DrOtV-0N.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-Cxa-xTMn.js → PromptSuggestionChips-CEnhme_V.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-ukRxHNsk.js → ReportsToPopover-CwjpR1Tw.js} +1 -1
  60. package/dist/client/assets/{RoomSurface-CwlU4Lns.js → RoomSurface-CChzNJKw.js} +1 -1
  61. package/dist/client/assets/{RoomsPage-CRJ7tbt0.js → RoomsPage-Dbf6ijKr.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-Bn1F_tCT.js → RunsOnPopover-Bh5sSsSC.js} +1 -1
  63. package/dist/client/assets/{RuntimeConnectFlow-Ddm_TBWI.js → RuntimeConnectFlow-BYQnY5vv.js} +1 -1
  64. package/dist/client/assets/{RuntimeSetupDialog-BcDt-BYK.js → RuntimeSetupDialog-DTO5v0dP.js} +1 -1
  65. package/dist/client/assets/{SeenDevices-mpu0OgjB.js → SeenDevices-cuY7ASEy.js} +1 -1
  66. package/dist/client/assets/{SessionsPage-Dp_iQdpc.js → SessionsPage-BrqpVx-t.js} +1 -1
  67. package/dist/client/assets/{SettingsDialog-TNI6sYo5.js → SettingsDialog-DCAZX_1d.js} +3 -3
  68. package/dist/client/assets/{SkillsPage-k-7ycbOg.js → SkillsPage-D5who_ZH.js} +1 -1
  69. package/dist/client/assets/{TaskDialogWrapper-Bfp5pa_r.js → TaskDialogWrapper-BJ6XtOC5.js} +1 -1
  70. package/dist/client/assets/TasksEmptyState-B3SjsxQa.js +3 -0
  71. package/dist/client/assets/{TasksPage-BRVvjSR1.js → TasksPage-B72w7J87.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-RQBXj6_l.js → TeamComputerEntry-B9ma5j-X.js} +1 -1
  73. package/dist/client/assets/TodoPromiseList-DDKWAfmv.js +1 -0
  74. package/dist/client/assets/TodoPromisesPage-BNXpvXzS.js +1 -0
  75. package/dist/client/assets/{ToolsPage-D1seB8vW.js → ToolsPage-DbJykCG3.js} +2 -2
  76. package/dist/client/assets/{TopologyGraph-DdWrS7dp.js → TopologyGraph-DKZS3nlr.js} +1 -1
  77. package/dist/client/assets/{TourHost-DmcHWh9X.js → TourHost-Bw3Uoea5.js} +1 -1
  78. package/dist/client/assets/{UnlinkDialog-FQzgYxPM.js → UnlinkDialog-B-XCFNSd.js} +1 -1
  79. package/dist/client/assets/{UnreadDivider-DPMhdEbw.js → UnreadDivider-1aPVzwd7.js} +1 -1
  80. package/dist/client/assets/{WidgetErrorCard-B477vOv2.js → WidgetErrorCard-C5ieVv_9.js} +1 -1
  81. package/dist/client/assets/{WithheldExtensionsNotice-BQnkJvgb.js → WithheldExtensionsNotice-CCO4ClRZ.js} +1 -1
  82. package/dist/client/assets/{WorkQueuePage-CwlR32Dy.js → WorkQueuePage-BbPKNwDg.js} +1 -1
  83. package/dist/client/assets/{WorkView-J0V1k1Q7.js → WorkView-BRcytACJ.js} +2 -2
  84. package/dist/client/assets/{_shell-B8mHdyV6.js → _shell-EwFeSIGp.js} +1 -1
  85. package/dist/client/assets/{_shell._home-CadWLlSU.js → _shell._home-DD2mg-iK.js} +1 -1
  86. package/dist/client/assets/{_shell._home.activity-Cmy3lakH.js → _shell._home.activity-Z1QuU2M4.js} +1 -1
  87. package/dist/client/assets/{_shell._home.index-eR2x0FUG.js → _shell._home.index-BzTYr8Bw.js} +2 -2
  88. package/dist/client/assets/{_shell._home.tasks-4Vkj6L-V.js → _shell._home.tasks-BtC85Iut.js} +1 -1
  89. package/dist/client/assets/{_shell._home.workspaces-fYlBcaoi.js → _shell._home.workspaces-qMG5OJYR.js} +1 -1
  90. package/dist/client/assets/{_shell.channels-nErO_7xf.js → _shell.channels-BE4EK-iM.js} +1 -1
  91. package/dist/client/assets/_shell.connections-CBx0ogzx.js +1 -0
  92. package/dist/client/assets/{_shell.feedback-requests-DJxcMS1O.js → _shell.feedback-requests-CwKSkkuD.js} +1 -1
  93. package/dist/client/assets/_shell.marketplace-CgWBUKSA.js +1 -0
  94. package/dist/client/assets/_shell.marketplace_.sources-8HZpKFDI.js +1 -0
  95. package/dist/client/assets/_shell.session-D6HcVbnm.js +1 -0
  96. package/dist/client/assets/{_shell.team-CXbQysNY.js → _shell.team-Dm5a4f8_.js} +3 -3
  97. package/dist/client/assets/{_shell.threads-CDEyGRL3.js → _shell.threads-BavVtQOE.js} +1 -1
  98. package/dist/client/assets/{_shell.todos-8uEPusJV.js → _shell.todos-B6uWr0zA.js} +2 -2
  99. package/dist/client/assets/_shell.x._extensionId-DaELdkCH.js +1 -0
  100. package/dist/client/assets/_shell.x._extensionId_._-DaELdkCH.js +1 -0
  101. package/dist/client/assets/{abnfDiagram-WEYOIA3C-C4khI9rY.js → abnfDiagram-WEYOIA3C-Bu2T3jVw.js} +1 -1
  102. package/dist/client/assets/{access-copy-w5gryYsO.js → access-copy-tkiFMhRf.js} +1 -1
  103. package/dist/client/assets/{arc-fvrOAWql.js → arc-5q4SfXO9.js} +1 -1
  104. package/dist/client/assets/{architectureDiagram-ZHVYKT53-CNH5Fhq_.js → architectureDiagram-ZHVYKT53-BnDMOBhV.js} +1 -1
  105. package/dist/client/assets/{banner-CBw5pFjQ.js → banner-CSKUrrI0.js} +1 -1
  106. package/dist/client/assets/{blockDiagram-RJAE7QA3-BxP4ZQri.js → blockDiagram-RJAE7QA3-CtushlEs.js} +1 -1
  107. package/dist/client/assets/{c4Diagram-XDPPPE54-BhBYlCWz.js → c4Diagram-XDPPPE54-7L-qYwKH.js} +1 -1
  108. package/dist/client/assets/channel-A3XT7_2L.js +1 -0
  109. package/dist/client/assets/{chunk-2E7WHVMD-COA0yYP4.js → chunk-2E7WHVMD-ksBVyqQ3.js} +1 -1
  110. package/dist/client/assets/{chunk-2Q5K7J3B-BbmrmCrP.js → chunk-2Q5K7J3B-Bfqdkihb.js} +1 -1
  111. package/dist/client/assets/{chunk-4EMNKR2T-CzA2mZv9.js → chunk-4EMNKR2T-Brf2dH9x.js} +1 -1
  112. package/dist/client/assets/{chunk-55XCU76K-DJ2x-ilD.js → chunk-55XCU76K-BlE7Cq40.js} +1 -1
  113. package/dist/client/assets/{chunk-5VM5RSS4-BxznGj8M.js → chunk-5VM5RSS4-Bkgg3j7L.js} +1 -1
  114. package/dist/client/assets/{chunk-JWPE2WC7-DHb10Lbd.js → chunk-JWPE2WC7-B9TRpN4O.js} +1 -1
  115. package/dist/client/assets/{chunk-VQ5W62QI-C7cjQxzr.js → chunk-VQ5W62QI-ZoILnIYi.js} +1 -1
  116. package/dist/client/assets/{chunk-XXDRQBXY-M7RrmKQv.js → chunk-XXDRQBXY-r2xNhaKz.js} +1 -1
  117. package/dist/client/assets/{chunk-ZCHMQSOR-BZxPNYte.js → chunk-ZCHMQSOR-DfV3cF7d.js} +2 -2
  118. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-vt1g5HlO.js → classDiagram-v2-4MYWR3UA-VOVqMNNP.js} +1 -1
  119. package/dist/client/assets/{command-DU2-hlOP.js → command-CaUEAy3b.js} +1 -1
  120. package/dist/client/assets/{copy-button-BodCVufV.js → copy-button-BOznikwM.js} +1 -1
  121. package/dist/client/assets/{cose-bilkent-JH36ORCC-Cd27g-Yx.js → cose-bilkent-JH36ORCC-CAdBvyLz.js} +1 -1
  122. package/dist/client/assets/{cpu-BXE_D43d.js → cpu-j9vX9Wfk.js} +1 -1
  123. package/dist/client/assets/{cynefin-EF2NZ3EQ-BnCAgdfS.js → cynefin-EF2NZ3EQ-DcH1A9Oo.js} +1 -1
  124. package/dist/client/assets/{cynefinDiagram-WF24UDRP-eIO4xQHB.js → cynefinDiagram-WF24UDRP-DJuKBXHi.js} +1 -1
  125. package/dist/client/assets/{dagre-NK4GIZVX-Bvd_3Cqy.js → dagre-NK4GIZVX-D099H_0S.js} +1 -1
  126. package/dist/client/assets/{detail-row-BvEUzVxe.js → detail-row-Crl89jnh.js} +1 -1
  127. package/dist/client/assets/{diagram-CBK3MWTC-BGqDA_bh.js → diagram-CBK3MWTC-Cd_4W9XO.js} +1 -1
  128. package/dist/client/assets/{diagram-I5XIIV2D-BXhbpnrE.js → diagram-I5XIIV2D-Bc7aQKt3.js} +1 -1
  129. package/dist/client/assets/{diagram-ODIL2UCW-C4hWeQZn.js → diagram-ODIL2UCW-awVJZ4Bg.js} +1 -1
  130. package/dist/client/assets/{diagram-PFBEJUXE-DIEuwCdA.js → diagram-PFBEJUXE-dhsj9aeU.js} +1 -1
  131. package/dist/client/assets/{diagram-RJA3I4VV-C36ghYx6.js → diagram-RJA3I4VV-Dm59CbiV.js} +1 -1
  132. package/dist/client/assets/{diagram-TYUNFSNR-CSC9FLO6.js → diagram-TYUNFSNR-BhvcIjA9.js} +1 -1
  133. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-DuOLfVHI.js → ebnfDiagram-V4P3TTPT-C4wT_MTC.js} +1 -1
  134. package/dist/client/assets/{elk-QONTBCTQ-NvLhZqkG.js → elk-QONTBCTQ-CPI0zjmW.js} +1 -1
  135. package/dist/client/assets/{empty-state-B316LEXY.js → empty-state-BHcmkSzu.js} +1 -1
  136. package/dist/client/assets/{erDiagram-KYQIGQAA-BcTRY9y8.js → erDiagram-KYQIGQAA-C_vGcbOB.js} +1 -1
  137. package/dist/client/assets/{execution-config-D9vIc46b.js → execution-config-BS5rtvTZ.js} +1 -1
  138. package/dist/client/assets/{file-C_57RCIQ.js → file-CQGljfDT.js} +1 -1
  139. package/dist/client/assets/{file-exclamation-point-C7C2dM_w.js → file-exclamation-point-B0a55VME.js} +1 -1
  140. package/dist/client/assets/{file-text-CS9s0qOe.js → file-text-Cycq_S0e.js} +1 -1
  141. package/dist/client/assets/{find-latest-widget-fence-D_FwbHep.js → find-latest-widget-fence-B6sJdG3Q.js} +1 -1
  142. package/dist/client/assets/{flowDiagram-IUGLLWBU-DxQ31Egh.js → flowDiagram-IUGLLWBU-_VNfmnxx.js} +1 -1
  143. package/dist/client/assets/{form-Cf49Z6eU.js → form-BL14vwyB.js} +1 -1
  144. package/dist/client/assets/{format-cron-Dlp0mfqz.js → format-cron-meJMgYNe.js} +1 -1
  145. package/dist/client/assets/{ganttDiagram-R7GPNTJY-Bxwm173A.js → ganttDiagram-R7GPNTJY-o0gGU7X_.js} +1 -1
  146. package/dist/client/assets/{git-branch-DpByNz2U.js → git-branch-CsLE6G0Y.js} +1 -1
  147. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DH8AQ76t.js → gitGraphDiagram-PDYL7XHY-DjXjUpJo.js} +1 -1
  148. package/dist/client/assets/{graph-BGzqfhJw.js → graph-BMYee_VK.js} +1 -1
  149. package/dist/client/assets/{heart-DKWg_e72.js → heart-Cn3a-UQI.js} +1 -1
  150. package/dist/client/assets/{highlighted-body-KPVGNVTW-Dd_spScF.js → highlighted-body-KPVGNVTW-DsX5yCC0.js} +1 -1
  151. package/dist/client/assets/{image-lightbox-BtsV24zH.js → image-lightbox-BZ_eBZgA.js} +1 -1
  152. package/dist/client/assets/{image-off-Czqq8ai8.js → image-off-DjR7LI5G.js} +1 -1
  153. package/dist/client/assets/{index-B401rtXR.js → index-1MwES_vb.js} +1 -1
  154. package/dist/client/assets/{index-GZP3iUOG.js → index-47--OGKJ.js} +1 -1
  155. package/dist/client/assets/{index-DNkWdNSz.js → index-4rSR8lau.js} +1 -1
  156. package/dist/client/assets/{index-CpxbjS0M.js → index-B4TxpTKD.js} +1 -1
  157. package/dist/client/assets/{index-Deupek6J.js → index-B8LqLhq7.js} +1 -1
  158. package/dist/client/assets/index-BJRgbiEd.js +1 -0
  159. package/dist/client/assets/{index-DOFLQqXn.js → index-BOCclWF3.js} +1 -1
  160. package/dist/client/assets/index-BR1m9FON.js +1066 -0
  161. package/dist/client/assets/index-BcFn_S6b.js +1 -0
  162. package/dist/client/assets/{index-MCPJOxb7.js → index-BcnwvTnt.js} +1 -1
  163. package/dist/client/assets/index-BdVQOlVQ.css +1 -0
  164. package/dist/client/assets/{index-EB7hJHJY.js → index-BmKHO-FD.js} +1 -1
  165. package/dist/client/assets/{index-DCFKleTS.js → index-BsZkXHsH.js} +1 -1
  166. package/dist/client/assets/{index-BapT4bjy.js → index-BxWr8Mrf.js} +1 -1
  167. package/dist/client/assets/index-C5EvpXcq.js +1 -0
  168. package/dist/client/assets/{index-BmckK_5Q.js → index-Cb_p_ynP.js} +1 -1
  169. package/dist/client/assets/{index-CX4nMOaI.js → index-CczLBUKI.js} +1 -1
  170. package/dist/client/assets/{index-DwAhtrb9.js → index-Cf4Gtxf9.js} +1 -1
  171. package/dist/client/assets/{index-JLySVSjV.js → index-CfKSlYjb.js} +1 -1
  172. package/dist/client/assets/{index-CIokV9hG.js → index-Cgjq7a-8.js} +1 -1
  173. package/dist/client/assets/{index-D0k8LoLP.js → index-CpWxcN5D.js} +1 -1
  174. package/dist/client/assets/{index-BhIDM_HP.js → index-Cv67OXfk.js} +1 -1
  175. package/dist/client/assets/{index-vEujcopz.js → index-D5Qmx1JR.js} +3 -3
  176. package/dist/client/assets/{index-CHGNCEc4.js → index-DARchye_.js} +1 -1
  177. package/dist/client/assets/{index-CWBtIScD.js → index-DFb4kOjm.js} +1 -1
  178. package/dist/client/assets/{index-BGKWKxfR.js → index-DLN0kcME.js} +1 -1
  179. package/dist/client/assets/{index-D2gKRr6f.js → index-DMSSN08i.js} +1 -1
  180. package/dist/client/assets/{index-BTB5QRQx.js → index-DQ8uADJF.js} +1 -1
  181. package/dist/client/assets/index-DZhMvc9m.js +1 -0
  182. package/dist/client/assets/{index-B_KMn9ji.js → index-Dfko0tSp.js} +1 -1
  183. package/dist/client/assets/{index-DcUcciFs.js → index-DiM3QX-4.js} +1 -1
  184. package/dist/client/assets/{index-BxNcjL67.js → index-DlvUENo4.js} +1 -1
  185. package/dist/client/assets/{index-DHFIAKQc.js → index-DqZmnJED.js} +1 -1
  186. package/dist/client/assets/{index-N77XDvrM.js → index-DrlB9RSk.js} +1 -1
  187. package/dist/client/assets/{index-DGKwWSrJ.js → index-H4e5Wpmi.js} +1 -1
  188. package/dist/client/assets/{index-DG-iZ_7U.js → index-Joav7LQU.js} +1 -1
  189. package/dist/client/assets/{index-DXA-11hB.js → index-KganLhU1.js} +2 -2
  190. package/dist/client/assets/{index-BQulbvlk.js → index-Kt6r3DQg.js} +1 -1
  191. package/dist/client/assets/{index-O9UP2ojb.js → index-Z2ApBQt4.js} +1 -1
  192. package/dist/client/assets/{index-CaYgHnra.js → index-dY7IFpet.js} +1 -1
  193. package/dist/client/assets/{index-aSuMCzNN.js → index-faSyUc2q.js} +1 -1
  194. package/dist/client/assets/{index-DQ9MUhkA.js → index-gmyiXkmr.js} +1 -1
  195. package/dist/client/assets/{index-sbmgxCMU.js → index-o6kGmVGx.js} +1 -1
  196. package/dist/client/assets/{index-GAcHtPZc.js → index-vHKVYcH7.js} +1 -1
  197. package/dist/client/assets/{index.esm-B0kiCgAP.js → index.esm-CJIDYBqd.js} +1 -1
  198. package/dist/client/assets/{infoDiagram-MVDRKAX5-CFgHv4Dm.js → infoDiagram-MVDRKAX5-B1mMyUlp.js} +1 -1
  199. package/dist/client/assets/{inline-code-B3u1dOXm.js → inline-code-mh48Uhbi.js} +1 -1
  200. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BWRvdwNW.js → ishikawaDiagram-HPEHV2GE-efEMQ0_X.js} +1 -1
  201. package/dist/client/assets/{journeyDiagram-BOSHW7O7-6zzUqSAS.js → journeyDiagram-BOSHW7O7-DSAywiVk.js} +1 -1
  202. package/dist/client/assets/{kanban-definition-FNSA4HC5-CCCFKXnc.js → kanban-definition-FNSA4HC5-B9pbU4zK.js} +1 -1
  203. package/dist/client/assets/{layers-Dbd-86dV.js → layers-B0Z5Od3N.js} +1 -1
  204. package/dist/client/assets/{lightbulb-C15x7OEZ.js → lightbulb-Cfb5ecEd.js} +1 -1
  205. package/dist/client/assets/{link-2-D1CRDxXB.js → link-2-Dzy5BUL3.js} +1 -1
  206. package/dist/client/assets/{list-runtime-types-Cyl4h4lV.js → list-runtime-types-DLmjtBMq.js} +1 -1
  207. package/dist/client/assets/{markdown-content-C1i_dR6j.js → markdown-content-DhAtZOfj.js} +1 -1
  208. package/dist/client/assets/{mention-pill-DoQBb5VU.js → mention-pill-DmA8FxL4.js} +1 -1
  209. package/dist/client/assets/{mermaid.core-BaDCR0nn.js → mermaid.core-DUIkdbeL.js} +4 -4
  210. package/dist/client/assets/{message-square-off-CwB3fRn1.js → message-square-off-BowIzJUV.js} +1 -1
  211. package/dist/client/assets/{mindmap-definition-6OY57UG3-B6g2CNRv.js → mindmap-definition-6OY57UG3-Dz7ZOR4C.js} +1 -1
  212. package/dist/client/assets/{more-details-DNp6DH8i.js → more-details-DV7LmY0E.js} +1 -1
  213. package/dist/client/assets/{owner-notice-P8INt5DW.js → owner-notice-DdFc2P8z.js} +1 -1
  214. package/dist/client/assets/{package-DHEY3aDq.js → package-BhKXbvU_.js} +1 -1
  215. package/dist/client/assets/{page-container-BwHVHvGF.js → page-container-0sWZ3xh9.js} +1 -1
  216. package/dist/client/assets/{pane-resize-handle-BetBV5qX.js → pane-resize-handle-Bjy4udre.js} +1 -1
  217. package/dist/client/assets/{paperclip-DYgUORd3.js → paperclip-C-7LhBfl.js} +1 -1
  218. package/dist/client/assets/{path-input-DpN1vJO-.js → path-input-BPVyI72G.js} +1 -1
  219. package/dist/client/assets/{pegDiagram-ECIUJNBX-Db7P43aK.js → pegDiagram-ECIUJNBX-C4EOP-Fa.js} +1 -1
  220. package/dist/client/assets/{pieDiagram-GNMPY74T-Cz1jeviu.js → pieDiagram-GNMPY74T-CQ1OxRkv.js} +1 -1
  221. package/dist/client/assets/{plug-C5hngNbe.js → plug-CIZ-wWL8.js} +1 -1
  222. package/dist/client/assets/{primer-trigger-Bb7X-l3r.js → primer-trigger-XA5fLzR5.js} +2 -2
  223. package/dist/client/assets/{profile-errors-OMPgeYKJ.js → profile-errors-C1XACbc9.js} +1 -1
  224. package/dist/client/assets/{progress-CNm_pBbE.js → progress-BA2JPtb6.js} +1 -1
  225. package/dist/client/assets/{quadrantDiagram-D57K4MC3-PD02f4Da.js → quadrantDiagram-D57K4MC3-Cw4BdkpS.js} +1 -1
  226. package/dist/client/assets/{query-error-state-BdmBV0DG.js → query-error-state-Cm-Lozlb.js} +1 -1
  227. package/dist/client/assets/{radio-BmjH89ml.js → radio-DQ29H26H.js} +1 -1
  228. package/dist/client/assets/{railroadDiagram-Y72NRBL7-x1K1Xrsr.js → railroadDiagram-Y72NRBL7-CSKtYLmm.js} +1 -1
  229. package/dist/client/assets/{registry-3K4FIIyI.js → registry-Tbt9pcZl.js} +4 -4
  230. package/dist/client/assets/registry-jD9zw538.js +1 -0
  231. package/dist/client/assets/{relay-trace-schemas-CctfRKB2.js → relay-trace-schemas-4AAUf-Zl.js} +1 -1
  232. package/dist/client/assets/{repeat-CK_sumJP.js → repeat-B8g-x-Sc.js} +1 -1
  233. package/dist/client/assets/{requirementDiagram-EQYSW5RA-BM-pntyA.js → requirementDiagram-EQYSW5RA-BPSBZr7X.js} +1 -1
  234. package/dist/client/assets/{room-files-source-CKjJxFRA.js → room-files-source-BkiK4-ZI.js} +1 -1
  235. package/dist/client/assets/{rotate-ccw-clock-DzVWecfL.js → rotate-ccw-clock-DRtL-2nr.js} +1 -1
  236. package/dist/client/assets/{rotate-cw-CpuoCwEK.js → rotate-cw-BbHkWN-J.js} +1 -1
  237. package/dist/client/assets/{sankeyDiagram-SY24JHO5-ByCX1rfW.js → sankeyDiagram-SY24JHO5-DVlHablQ.js} +1 -1
  238. package/dist/client/assets/{scroll-area-BO7uDl4z.js → scroll-area-DAC7NrVU.js} +1 -1
  239. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BPB2hLY6.js → sequenceDiagram-BLEHNHQU--wZkN8xk.js} +1 -1
  240. package/dist/client/assets/{shield-x-DknrRQrV.js → shield-x-CEWfkzDN.js} +1 -1
  241. package/dist/client/assets/{signed-in-DdaXcjzY.js → signed-in-CMhCR-m8.js} +1 -1
  242. package/dist/client/assets/{sizeCapture-INFHLROL-DRe6LanJ.js → sizeCapture-INFHLROL-CLXc7d3S.js} +1 -1
  243. package/dist/client/assets/{soul-file-CPL6-cba.js → soul-file-CbX7rNqz.js} +1 -1
  244. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DZA18t3o.js → stateDiagram-v2-A6IESKWZ-5xa1FM_X.js} +1 -1
  245. package/dist/client/assets/{swimlanes-B3ENRKFQ-DRX2o4k2.js → swimlanes-B3ENRKFQ-DKgxJxjE.js} +1 -1
  246. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-f6MOc3pl.js +8 -0
  247. package/dist/client/assets/{table-BrvyPoEL.js → table-D0EJT0uP.js} +1 -1
  248. package/dist/client/assets/{tabs-BmbzJhKE.js → tabs-Ctjzrm8t.js} +1 -1
  249. package/dist/client/assets/{timeline-definition-JXYKGLGB-BL2C4v8r.js → timeline-definition-JXYKGLGB-B9P7ituI.js} +1 -1
  250. package/dist/client/assets/{trust-dial-tuMHO5Ug.js → trust-dial-D__tIhzt.js} +1 -1
  251. package/dist/client/assets/{trust-posture-9cC08pk5.js → trust-posture-DaHHtOZn.js} +1 -1
  252. package/dist/client/assets/{unplug-B8oONuTT.js → unplug-B-ipHefz.js} +1 -1
  253. package/dist/client/assets/{unverified-catalog-notice-ofL4eYQH.js → unverified-catalog-notice-C8swqaTn.js} +1 -1
  254. package/dist/client/assets/{use-bindings-DVKWBz4y.js → use-bindings-gLHRNAFU.js} +1 -1
  255. package/dist/client/assets/{use-composer-prefs-DWFqxtm6.js → use-composer-prefs-CjpxcBIe.js} +1 -1
  256. package/dist/client/assets/{use-connector-management-B_RvwV0T.js → use-connector-management-BLiCJMgU.js} +1 -1
  257. package/dist/client/assets/{use-deep-link-scroll-Cahio5D0.js → use-deep-link-scroll-r2nKjzA-.js} +1 -1
  258. package/dist/client/assets/{use-delete-binding-DHiPJq9D.js → use-delete-binding-BSiOik_K.js} +1 -1
  259. package/dist/client/assets/{use-dev-links-Cunzy9gq.js → use-dev-links-DXcIlMf-.js} +1 -1
  260. package/dist/client/assets/{use-direct-message-panel-CPyyrU4P.js → use-direct-message-panel-BbH8N4mE.js} +1 -1
  261. package/dist/client/assets/{use-external-adapter-catalog-l9RzI0W5.js → use-external-adapter-catalog-mmKni5ui.js} +1 -1
  262. package/dist/client/assets/{use-filter-state-DKALQgO9.js → use-filter-state-CiPZ0AIH.js} +1 -1
  263. package/dist/client/assets/{use-full-activity-feed-B7miUwr2.js → use-full-activity-feed-DXroUzfN.js} +1 -1
  264. package/dist/client/assets/use-is-below-desktop-LUZL5z5t.js +1 -0
  265. package/dist/client/assets/{use-mesh-topology-Y9Cdja0F.js → use-mesh-topology-upehQ5Cv.js} +1 -1
  266. package/dist/client/assets/{use-mounted-ref-Bb8zNmgI.js → use-mounted-ref-IHwyriaF.js} +1 -1
  267. package/dist/client/assets/{use-notification-prefs-DoZgirjS.js → use-notification-prefs-BHOK2P2l.js} +1 -1
  268. package/dist/client/assets/use-pending-read-mVsOBTzn.js +1 -0
  269. package/dist/client/assets/{use-personality-commit-CDMLIF8s.js → use-personality-commit-Chf3UX8P.js} +1 -1
  270. package/dist/client/assets/{use-promo-activation-XWY3OSoy.js → use-promo-activation-Dlw6bg7G.js} +1 -1
  271. package/dist/client/assets/{use-promo-dismissals-Bg7cJFb8.js → use-promo-dismissals-Dx_fli7I.js} +1 -1
  272. package/dist/client/assets/{use-pulse-freshness-B4nO2ugg.js → use-pulse-freshness-CG_I6a-O.js} +1 -1
  273. package/dist/client/assets/{use-room-follow-claim-CpOIUcG7.js → use-room-follow-claim-Bgrpr3bO.js} +1 -1
  274. package/dist/client/assets/{use-room-sessions-BeiAMSkk.js → use-room-sessions-DecGrP3E.js} +1 -1
  275. package/dist/client/assets/{use-roving-tab-list-HB0egh1C.js → use-roving-tab-list-CDkh-Ujm.js} +1 -1
  276. package/dist/client/assets/{use-session-canvas-Cc04zSW3.js → use-session-canvas-tvLLPQcm.js} +6 -6
  277. package/dist/client/assets/{use-status-budget-GIeJAyM1.js → use-status-budget-BBl2yxLR.js} +2 -2
  278. package/dist/client/assets/{use-todos-Bq9I1_Md.js → use-todos-BzRauzdQ.js} +1 -1
  279. package/dist/client/assets/{use-transform-DEFDL9dO.js → use-transform-DzJeHpxm.js} +1 -1
  280. package/dist/client/assets/{use-unclaimed-chats-BzDzgx9Q.js → use-unclaimed-chats--HZdmq4F.js} +1 -1
  281. package/dist/client/assets/use-update-config-DjL7-nUR.js +1 -0
  282. package/dist/client/assets/{useMutationState-Bffa43_B.js → useMutationState-DIywUTDG.js} +1 -1
  283. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-BoYu8koq.js → usecaseDiagram-WPOLBNNX-C9aLJ03F.js} +1 -1
  284. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-U4E5RDf5.js → vennDiagram-Q3Y3IDCW-ChBIWbL0.js} +1 -1
  285. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DYWCkm0g.js → wardleyDiagram-IVAIDKWA-DvQDOaTm.js} +1 -1
  286. package/dist/client/assets/{xychartDiagram-4URNHDU4-DMf6UlJg.js → xychartDiagram-4URNHDU4-8FxLPP2c.js} +1 -1
  287. package/dist/client/assets/{zap-BmeuEI5X.js → zap-DSllMMHe.js} +1 -1
  288. package/dist/client/index.html +2 -2
  289. package/dist/drizzle/20261104081935_hook_decline_review.sql +3 -0
  290. package/dist/drizzle/20261107183323_dor3933_todos_rename.sql +64 -0
  291. package/dist/drizzle/20261108014418_dor3938_cross_agent_writer.sql +4 -0
  292. package/dist/drizzle/meta/20261104081935_snapshot.json +14910 -0
  293. package/dist/drizzle/meta/20261107183323_snapshot.json +14910 -0
  294. package/dist/drizzle/meta/20261108014418_snapshot.json +14938 -0
  295. package/dist/drizzle/meta/_journal.json +21 -0
  296. package/dist/server/index.js +45684 -43712
  297. package/dist/server/index.js.map +2 -2
  298. package/package.json +4 -4
  299. package/dist/client/assets/CommitmentList-BXbIFc4Y.js +0 -1
  300. package/dist/client/assets/CommitmentsPage-CMKLXfbr.js +0 -1
  301. package/dist/client/assets/HandlePage-0fA-Trcw.js +0 -1
  302. package/dist/client/assets/HeartbeatPage-CByO3lLO.js +0 -1
  303. package/dist/client/assets/NamePage-BI35-ZiO.js +0 -1
  304. package/dist/client/assets/PhotoPage-DE7tKzAB.js +0 -1
  305. package/dist/client/assets/TasksEmptyState-BlGELISr.js +0 -3
  306. package/dist/client/assets/_shell.connections-C9URqim3.js +0 -1
  307. package/dist/client/assets/_shell.marketplace-CNUtNewz.js +0 -1
  308. package/dist/client/assets/_shell.marketplace_.sources-Cku_p8cg.js +0 -1
  309. package/dist/client/assets/_shell.session-B990EEo5.js +0 -1
  310. package/dist/client/assets/_shell.x._extensionId-DXp9Wa0V.js +0 -1
  311. package/dist/client/assets/_shell.x._extensionId_._-DXp9Wa0V.js +0 -1
  312. package/dist/client/assets/channel-splVtfTe.js +0 -1
  313. package/dist/client/assets/index-BYTLOFNS.js +0 -1061
  314. package/dist/client/assets/index-BbPg1hpf.css +0 -1
  315. package/dist/client/assets/index-CUDsA_8O.js +0 -1
  316. package/dist/client/assets/index-D6jG1-Mw.js +0 -1
  317. package/dist/client/assets/index-DOZg4xUY.js +0 -1
  318. package/dist/client/assets/index-DrbZanni.js +0 -1
  319. package/dist/client/assets/registry-DNYPNSm5.js +0 -1
  320. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-D5hU--1Q.js +0 -8
  321. package/dist/client/assets/use-is-below-desktop-DSwl4xyH.js +0 -1
  322. package/dist/client/assets/use-pending-read-DC4hUOFi.js +0 -1
  323. package/dist/client/assets/use-update-config-Bt7fMLqS.js +0 -1
@@ -1 +1 @@
1
- import{h5 as v,eC as fe,j as e,bO as ee,bP as ne,bQ as te,bR as se,bS as ae,h6 as ie,bT as re,bU as ce,bW as oe,a5 as de,a7 as be,a8 as Ce,a6 as Ne,y as le,eJ as Ie,r as A,h7 as he,eL as x,ew as S,ex as R,ey as k,ez as F,eA as b,eE as Te,a3 as E,a2 as pe,aO as Ae,h8 as Se,h9 as Re,a9 as ke,c$ as Fe,d2 as Oe,d3 as we,d5 as Me,d6 as De,d7 as Ee,am as Be,I as $e,ha as J,B,d$ as Le,hb as _e,fL as Pe,hc as ze,x as qe}from"./index-BYTLOFNS.js";import{B as He}from"./use-bindings-DVKWBz4y.js";import{u as Ge}from"./form-Cf49Z6eU.js";import{I as Qe,t as Ue}from"./trust-posture-9cC08pk5.js";import{s as We,t as Ye,T as Ke,a as Ve}from"./trust-dial-tuMHO5Ug.js";function X(n){return`Turn on ${We(n.stop)}`}function Je(n){return!v(n)||fe(n)?null:"This stop never pauses to ask. It acts without checking with you."}function Xe({descriptor:n,consequence:i,onCancel:o,onConfirm:h}){const d=Ye(n??void 0),y=n?Je(n):null;return e.jsx(ee,{open:n!==null,onOpenChange:C=>!C&&o(),children:e.jsxs(ne,{children:[e.jsxs(te,{children:[e.jsxs(se,{className:"flex items-center gap-2",children:[e.jsx(Ke,{descriptor:n??void 0,className:`size-4 ${d}`}),n&&X(n)]}),e.jsxs(ae,{children:[n==null?void 0:n.promise,y&&" ",y&&e.jsx("span",{className:"text-foreground mt-2 block","data-testid":"consent-asks-note",children:y})]})]}),e.jsx("div",{className:"text-muted-foreground space-y-2 text-sm",children:i}),n&&e.jsx(ie,{mode:n.id,descriptor:n}),e.jsxs(re,{children:[e.jsx(ce,{children:"Cancel"}),e.jsx(oe,{onClick:h,children:n&&X(n)})]})]})})}function ln(n={}){const i=de(),o=be();return Ce({mutationFn:h=>i.createBinding(h),onSuccess:()=>{o.invalidateQueries({queryKey:[...He]})},meta:n.suppressErrorToast?{suppressErrorToast:!0}:{errorLabel:n.errorLabel??"Couldn’t add that connection"}})}function Ze(n){const i=de();return Ne({queryKey:["relay","observed-chats",n],queryFn:()=>i.getObservedChats(n),enabled:!!n,staleTime:3e4})}const Z=[{value:"per-chat",label:"One shared chat per group or channel",description:"Everyone there shares one chat with the agent."},{value:"per-user",label:"One chat per person",description:"Each person gets their own chat, even in a group."},{value:"stateless",label:"A fresh start every message",description:"Nothing carries over from the message before."}],G="claude-code";function ve({strategy:n,onStrategyChange:i,permissionMode:o,onPermissionModeChange:h,canInitiate:d,onCanInitiateChange:y,canReply:C,onCanReplyChange:O,canReceive:w,onCanReceiveChange:M,notifyOnTaskComplete:$,onNotifyOnTaskCompleteChange:L,notifyBootstrapHint:p,bridged:_,open:P,onOpenChange:z,hasChanges:q}){const u=Z.find(l=>l.value===n),j=le(G),c=(j==null?void 0:j.permissionModes.values)??[],r=c.find(l=>l.id===o),D=(r==null?void 0:r.label)??Ie(o),[f,I]=A.useState(null);function H(l){const N=c.find(T=>T.id===l);if(N&&v(N)){I(N);return}h(l)}return e.jsxs(e.Fragment,{children:[e.jsxs(he,{open:P,onOpenChange:z,trigger:"Advanced",badge:q?e.jsx(pe,{variant:"secondary",children:"Modified"}):void 0,children:[_?e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{children:"How the agent remembers"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Kept in the channel this chat is linked to."})]}):e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{htmlFor:"binding-session-strategy",children:"How the agent remembers"}),e.jsxs(S,{value:n,onValueChange:l=>i(l),children:[e.jsx(R,{id:"binding-session-strategy",className:"w-full",children:e.jsx(k,{})}),e.jsx(F,{children:Z.map(l=>e.jsx(b,{value:l.value,children:l.label},l.value))})]}),u&&e.jsx("p",{className:"text-muted-foreground text-xs",children:u.description})]}),e.jsxs("div",{className:"space-y-2 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Permissions"}),c.length===0?e.jsxs("p",{"data-testid":"trust-dial-unavailable",className:"text-muted-foreground px-1 text-xs leading-relaxed",children:["Set to “",D,"”. No other levels to choose yet. Saving keeps it."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ve,{mode:o,descriptors:c,onChangeMode:H,strandsWorkingMode:!0,strandedNote:e.jsxs(e.Fragment,{children:["Set to “",D,"”. Saving keeps it, or pick a stop."]})}),e.jsx(ie,{mode:o,...r?{descriptor:r}:{},className:"px-1"})]})]}),e.jsxs("div",{className:"space-y-2.5 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Message direction"}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsxs(x,{htmlFor:"perm-initiate",className:"flex cursor-pointer items-center gap-1.5 text-xs font-normal",children:[e.jsx(Te,{className:"text-muted-foreground size-3"}),"Agent can message first"]}),e.jsx(E,{id:"perm-initiate",checked:d,onCheckedChange:y,"aria-label":"Agent can message first"})]}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(x,{htmlFor:"perm-reply",className:"cursor-pointer text-xs font-normal",children:"Agent can reply to messages"}),e.jsx(E,{id:"perm-reply",checked:C,onCheckedChange:O,"aria-label":"Agent can reply to messages"})]}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(x,{htmlFor:"perm-receive",className:"cursor-pointer text-xs font-normal",children:"Agent receives new messages"}),e.jsx(E,{id:"perm-receive",checked:w,onCheckedChange:M,"aria-label":"Agent receives new messages"})]})]}),e.jsxs("div",{className:"space-y-2.5 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Notifications"}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(x,{htmlFor:"notify-task-complete",className:"cursor-pointer text-xs font-normal",children:"Message me when scheduled tasks finish"}),e.jsx(E,{id:"notify-task-complete",checked:$,onCheckedChange:L,"aria-label":"Message me when scheduled tasks finish"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"When off, you still hear about runs that didn’t finish."}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Needs “Agent can message first”."}),p&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Message your bot once to start. Bots can’t write first."})]})]}),e.jsx(Xe,{descriptor:f,consequence:e.jsxs(e.Fragment,{children:["Anyone who can message this connection can make the agent act, with no one asked."," ",e.jsxs(Qe,{label:"About asking in the chat",title:"At a stop that asks",children:[e.jsx("p",{children:"Where your connection can show buttons, the agent waits for Approve or Deny."}),e.jsx("p",{children:"Only people on the approver list can answer."}),e.jsx("p",{children:"An ask nobody answers is refused after 10 minutes, and the agent carries on."})]})]}),onCancel:()=>I(null),onConfirm:()=>{f&&h(f.id),I(null)}})]})}const m="__any__",en={"per-chat":"One shared chat per group or channel","per-user":"One chat for each person",stateless:"No memory between messages"},me=[{value:"dm",label:"Direct message"},{value:"group",label:"Group"},{value:"channel",label:"Broadcast channel"},{value:"thread",label:"Thread"}];function xe(n){var i;return((i=me.find(o=>o.value===n))==null?void 0:i.label)??n}function nn({sessionStrategy:n,chatDisplayName:i,channelType:o}){const h=en[n];return i?`${h} in ${i}`:o?`${h} · ${xe(o)}`:h}function hn(n){return{adapterId:n.adapterId,agentId:n.agentId,sessionStrategy:n.sessionStrategy,label:n.label,permissionMode:n.permissionMode,chatId:n.chatId,channelType:n.channelType,canInitiate:n.canInitiate,canReply:n.canReply,canReceive:n.canReceive,notifyOnTaskComplete:n.notifyOnTaskComplete}}function pn(n){return{sessionStrategy:n.sessionStrategy,label:n.label,permissionMode:n.permissionMode,chatId:n.chatId??null,channelType:n.channelType??null,canInitiate:n.canInitiate,canReply:n.canReply,canReceive:n.canReceive,notifyOnTaskComplete:n.notifyOnTaskComplete}}function tn(n){return!!(n!=null&&n.canInitiate||(n==null?void 0:n.canReply)===!1||(n==null?void 0:n.canReceive)===!1||(n==null?void 0:n.notifyOnTaskComplete)===!1||(n==null?void 0:n.permissionMode)!==void 0&&n.permissionMode!=="acceptEdits"||n!=null&&n.sessionStrategy&&n.sessionStrategy!=="per-chat")}function sn(n,i){return{adapterId:(n==null?void 0:n.adapterId)??"",agentId:(n==null?void 0:n.agentId)??"",strategy:(n==null?void 0:n.sessionStrategy)??"per-chat",label:(n==null?void 0:n.label)??"",chatId:(n==null?void 0:n.chatId)??m,channelType:(n==null?void 0:n.channelType)??m,permissionMode:(n==null?void 0:n.permissionMode)??(i==null?void 0:i.defaultPermissionMode)??"acceptEdits",canInitiate:(n==null?void 0:n.canInitiate)??(i==null?void 0:i.defaultCanInitiate)??!1,canReply:(n==null?void 0:n.canReply)??!0,canReceive:(n==null?void 0:n.canReceive)??!0,notifyOnTaskComplete:(n==null?void 0:n.notifyOnTaskComplete)??!0}}function mn({open:n,onOpenChange:i,onConfirm:o,mode:h,initialValues:d,adapterName:y,agentName:C,onDelete:O,bindingId:w,isPending:M,bridged:$,bridgeSlot:L}){const p=h==="edit",[_,P]=A.useState(()=>!!(d!=null&&d.chatId||d!=null&&d.channelType)),[z,q]=A.useState(()=>tn(d)),{data:u}=Ae(),j=le(G),[c]=A.useState(()=>{var t;return sn(d,p?void 0:{defaultPermissionMode:Se(Re(u==null?void 0:u.executionDefaults,G),(j==null?void 0:j.permissionModes.values)??[]),defaultCanInitiate:u!=null&&Ue((t=u.permissions)==null?void 0:t.preset)==="trusted"})}),r=Ge({defaultValues:c,onSubmit:async({value:t})=>{await o({adapterId:t.adapterId,agentId:t.agentId,sessionStrategy:t.strategy,label:t.label,permissionMode:t.permissionMode,chatId:t.chatId===m?void 0:t.chatId,channelType:t.channelType===m?void 0:t.channelType,canInitiate:t.canInitiate,canReply:t.canReply,canReceive:t.canReceive,notifyOnTaskComplete:t.notifyOnTaskComplete}),p||r.reset()}}),{data:D=[]}=ke(),{data:f}=Fe(),[I,H]=A.useState(()=>(d==null?void 0:d.adapterId)??""),{data:l=[]}=Ze(I||void 0),N=D.flatMap(t=>t.instances.filter(g=>g.enabled).map(g=>({id:g.id,label:g.label?`${g.label} (${t.manifest.displayName})`:`${g.id} (${t.manifest.displayName})`}))),T=(f==null?void 0:f.agents)??[];function ge(){r.setFieldValue("chatId",m),r.setFieldValue("channelType",m)}return e.jsx(Oe,{open:n,onOpenChange:i,children:e.jsxs(we,{className:"max-h-[85vh] max-w-md gap-0 p-0",children:[e.jsxs(Me,{className:"border-b px-4 py-3",children:[e.jsx(De,{children:p?"Edit connection":"Add connection"}),e.jsx(Ee,{className:"sr-only",children:p?"Edit this connection’s settings":"Connect this agent to a chat"})]}),e.jsx(r.Subscribe,{selector:t=>({values:t.values,isSubmitting:t.isSubmitting}),children:({values:t,isSubmitting:g})=>{var V;const Q=p||!!t.adapterId&&!!t.agentId,ue=!p||t.adapterId!==c.adapterId||t.agentId!==c.agentId||t.strategy!==c.strategy||t.label!==c.label||t.chatId!==c.chatId||t.channelType!==c.channelType||t.permissionMode!==c.permissionMode||t.canInitiate!==c.canInitiate||t.canReply!==c.canReply||t.canReceive!==c.canReceive||t.notifyOnTaskComplete!==c.notifyOnTaskComplete,U=p?C:(V=T.find(s=>s.id===t.agentId))==null?void 0:V.name,W=Q&&U?`${nn({sessionStrategy:t.strategy,chatDisplayName:t.chatId!==m?`#${t.chatId}`:void 0,channelType:t.channelType!==m?t.channelType:void 0})}. Routed to ${U}.`:null,Y=t.chatId!==m||t.channelType!==m,ye=t.strategy!=="per-chat"||t.permissionMode!=="acceptEdits"||t.canInitiate||!t.canReply||!t.canReceive||!t.notifyOnTaskComplete,je=!Q||!ue||!!M||g,K=!!M||g;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-5 overflow-y-auto px-4 py-5",children:[p?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Connection:"," ",e.jsx("span",{className:"text-foreground font-medium",children:y})," →"," ",e.jsx("span",{className:"text-foreground font-medium",children:C})]}),L]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(x,{htmlFor:"binding-adapter",children:"Source"}),N.length===0?e.jsx("p",{className:"text-muted-foreground border-input rounded-md border px-3 py-2 text-sm opacity-50",children:"Nothing set up yet"}):e.jsx(r.AppField,{name:"adapterId",children:s=>e.jsxs(S,{value:s.state.value,onValueChange:a=>{s.handleChange(a),H(a)},children:[e.jsx(R,{id:"binding-adapter",className:"w-full",children:e.jsx(k,{placeholder:"Pick a source"})}),e.jsx(F,{children:N.map(a=>e.jsx(b,{value:a.id,children:a.label},a.id))})]})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(x,{htmlFor:"binding-agent",children:"Agent"}),T.length===0?e.jsx("p",{className:"text-muted-foreground border-input rounded-md border px-3 py-2 text-sm opacity-50",children:"No agents yet"}):e.jsx(r.AppField,{name:"agentId",children:s=>e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(R,{id:"binding-agent",className:"w-full",children:e.jsx(k,{placeholder:"Select an agent"})}),e.jsx(F,{children:T.map(a=>e.jsx(b,{value:a.id,children:Be(a)},a.id))})]})})]})]}),e.jsx(r.AppField,{name:"label",children:s=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(x,{htmlFor:"binding-label",children:"Label (optional)"}),e.jsx($e,{id:"binding-label",placeholder:"e.g., Customer support bot",value:s.state.value,onBlur:s.handleBlur,onChange:a=>s.handleChange(a.target.value)}),e.jsx(J,{children:"A name to tell this connection apart"})]})}),e.jsxs(he,{open:_,onOpenChange:P,trigger:"Chat filter",badge:Y?e.jsx(pe,{variant:"secondary",children:"Active"}):void 0,children:[e.jsx(r.AppField,{name:"chatId",children:s=>e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{htmlFor:"binding-chat-id",children:"Chat ID"}),e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(R,{id:"binding-chat-id",className:"w-full",children:e.jsx(k,{placeholder:"Any chat"})}),e.jsxs(F,{children:[e.jsx(b,{value:m,children:"Any chat"}),l.map(a=>e.jsxs(b,{value:a.chatId,children:[e.jsx("span",{children:a.displayName??a.chatId}),(a.channelType||a.messageCount>0)&&e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:[a.channelType?xe(a.channelType):null,`${a.messageCount} messages`].filter(Boolean).join(" · ")})]},a.chatId))]})]}),e.jsx(J,{children:"Only take messages from this chat"})]})}),e.jsx(r.AppField,{name:"channelType",children:s=>e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{htmlFor:"binding-channel-type",children:"Chat type"}),e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(R,{id:"binding-channel-type",className:"w-full",children:e.jsx(k,{placeholder:"Any type"})}),e.jsxs(F,{children:[e.jsx(b,{value:m,children:"Any type"}),me.map(a=>e.jsx(b,{value:a.value,children:a.label},a.value))]})]})]})}),Y&&e.jsx("div",{className:"px-4 py-3",children:e.jsx(B,{variant:"ghost",size:"sm",onClick:ge,children:"Clear filters"})})]}),e.jsx(ve,{strategy:t.strategy,onStrategyChange:s=>r.setFieldValue("strategy",s),permissionMode:t.permissionMode,onPermissionModeChange:s=>r.setFieldValue("permissionMode",s),canInitiate:t.canInitiate,onCanInitiateChange:s=>r.setFieldValue("canInitiate",s),canReply:t.canReply,onCanReplyChange:s=>r.setFieldValue("canReply",s),canReceive:t.canReceive,onCanReceiveChange:s=>r.setFieldValue("canReceive",s),notifyOnTaskComplete:t.notifyOnTaskComplete,onNotifyOnTaskCompleteChange:s=>r.setFieldValue("notifyOnTaskComplete",s),notifyBootstrapHint:l.length===0,bridged:$,open:z,onOpenChange:q,hasChanges:ye}),W&&e.jsx("p",{className:"text-muted-foreground bg-muted/50 rounded-md px-3 py-2 text-xs italic",children:W})]}),e.jsxs(Le,{className:"border-t px-4 py-3",children:[p&&O&&w&&e.jsxs(ee,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"mr-auto text-red-600 hover:bg-red-50 hover:text-red-700 dark:hover:bg-red-950",children:[e.jsx(Pe,{className:"mr-1.5 size-3.5"}),"Remove"]})}),e.jsxs(ne,{children:[e.jsxs(te,{children:[e.jsx(se,{children:"Remove this connection?"}),e.jsx(ae,{children:"This agent stops getting messages from it."})]}),e.jsxs(re,{children:[e.jsx(ce,{children:"Cancel"}),e.jsx(oe,{onClick:()=>O(w),className:ze({variant:"destructive"}),children:"Remove connection"})]})]})]}),e.jsx(B,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:"Cancel"}),e.jsxs(B,{size:"sm",onClick:()=>r.handleSubmit(),disabled:je,children:[K&&e.jsx(qe,{size:"xs",className:"mr-1.5"}),K?"Saving…":p?"Save changes":"Add connection"]})]})]})}})]})})}export{mn as B,ln as a,nn as b,hn as c,xe as d,pn as t,Ze as u};
1
+ import{h1 as v,eC as fe,j as e,bO as ee,bP as ne,bQ as te,bR as se,bS as ae,h2 as ie,bT as re,bU as ce,bW as oe,a5 as de,a7 as be,a8 as Ce,a6 as Ne,y as le,eJ as Ie,r as A,h3 as he,eL as x,ew as S,ex as R,ey as k,ez as F,eA as b,eE as Te,a3 as E,a2 as pe,aO as Ae,h4 as Se,h5 as Re,a9 as ke,c$ as Fe,d2 as Oe,d3 as we,d5 as Me,d6 as De,d7 as Ee,am as Be,I as $e,h6 as J,B,d$ as Le,h7 as _e,fL as Pe,h8 as ze,x as qe}from"./index-BR1m9FON.js";import{B as He}from"./use-bindings-gLHRNAFU.js";import{u as Ge}from"./form-BL14vwyB.js";import{I as Qe,t as Ue}from"./trust-posture-DaHHtOZn.js";import{s as We,t as Ye,T as Ke,a as Ve}from"./trust-dial-D__tIhzt.js";function X(n){return`Turn on ${We(n.stop)}`}function Je(n){return!v(n)||fe(n)?null:"This stop never pauses to ask. It acts without checking with you."}function Xe({descriptor:n,consequence:i,onCancel:o,onConfirm:h}){const d=Ye(n??void 0),y=n?Je(n):null;return e.jsx(ee,{open:n!==null,onOpenChange:C=>!C&&o(),children:e.jsxs(ne,{children:[e.jsxs(te,{children:[e.jsxs(se,{className:"flex items-center gap-2",children:[e.jsx(Ke,{descriptor:n??void 0,className:`size-4 ${d}`}),n&&X(n)]}),e.jsxs(ae,{children:[n==null?void 0:n.promise,y&&" ",y&&e.jsx("span",{className:"text-foreground mt-2 block","data-testid":"consent-asks-note",children:y})]})]}),e.jsx("div",{className:"text-muted-foreground space-y-2 text-sm",children:i}),n&&e.jsx(ie,{mode:n.id,descriptor:n}),e.jsxs(re,{children:[e.jsx(ce,{children:"Cancel"}),e.jsx(oe,{onClick:h,children:n&&X(n)})]})]})})}function ln(n={}){const i=de(),o=be();return Ce({mutationFn:h=>i.createBinding(h),onSuccess:()=>{o.invalidateQueries({queryKey:[...He]})},meta:n.suppressErrorToast?{suppressErrorToast:!0}:{errorLabel:n.errorLabel??"Couldn’t add that connection"}})}function Ze(n){const i=de();return Ne({queryKey:["relay","observed-chats",n],queryFn:()=>i.getObservedChats(n),enabled:!!n,staleTime:3e4})}const Z=[{value:"per-chat",label:"One shared chat per group or channel",description:"Everyone there shares one chat with the agent."},{value:"per-user",label:"One chat per person",description:"Each person gets their own chat, even in a group."},{value:"stateless",label:"A fresh start every message",description:"Nothing carries over from the message before."}],G="claude-code";function ve({strategy:n,onStrategyChange:i,permissionMode:o,onPermissionModeChange:h,canInitiate:d,onCanInitiateChange:y,canReply:C,onCanReplyChange:O,canReceive:w,onCanReceiveChange:M,notifyOnTaskComplete:$,onNotifyOnTaskCompleteChange:L,notifyBootstrapHint:p,bridged:_,open:P,onOpenChange:z,hasChanges:q}){const u=Z.find(l=>l.value===n),j=le(G),c=(j==null?void 0:j.permissionModes.values)??[],r=c.find(l=>l.id===o),D=(r==null?void 0:r.label)??Ie(o),[f,I]=A.useState(null);function H(l){const N=c.find(T=>T.id===l);if(N&&v(N)){I(N);return}h(l)}return e.jsxs(e.Fragment,{children:[e.jsxs(he,{open:P,onOpenChange:z,trigger:"Advanced",badge:q?e.jsx(pe,{variant:"secondary",children:"Modified"}):void 0,children:[_?e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{children:"How the agent remembers"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Kept in the channel this chat is linked to."})]}):e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{htmlFor:"binding-session-strategy",children:"How the agent remembers"}),e.jsxs(S,{value:n,onValueChange:l=>i(l),children:[e.jsx(R,{id:"binding-session-strategy",className:"w-full",children:e.jsx(k,{})}),e.jsx(F,{children:Z.map(l=>e.jsx(b,{value:l.value,children:l.label},l.value))})]}),u&&e.jsx("p",{className:"text-muted-foreground text-xs",children:u.description})]}),e.jsxs("div",{className:"space-y-2 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Permissions"}),c.length===0?e.jsxs("p",{"data-testid":"trust-dial-unavailable",className:"text-muted-foreground px-1 text-xs leading-relaxed",children:["Set to “",D,"”. No other levels to choose yet. Saving keeps it."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ve,{mode:o,descriptors:c,onChangeMode:H,strandsWorkingMode:!0,strandedNote:e.jsxs(e.Fragment,{children:["Set to “",D,"”. Saving keeps it, or pick a stop."]})}),e.jsx(ie,{mode:o,...r?{descriptor:r}:{},className:"px-1"})]})]}),e.jsxs("div",{className:"space-y-2.5 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Message direction"}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsxs(x,{htmlFor:"perm-initiate",className:"flex cursor-pointer items-center gap-1.5 text-xs font-normal",children:[e.jsx(Te,{className:"text-muted-foreground size-3"}),"Agent can message first"]}),e.jsx(E,{id:"perm-initiate",checked:d,onCheckedChange:y,"aria-label":"Agent can message first"})]}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(x,{htmlFor:"perm-reply",className:"cursor-pointer text-xs font-normal",children:"Agent can reply to messages"}),e.jsx(E,{id:"perm-reply",checked:C,onCheckedChange:O,"aria-label":"Agent can reply to messages"})]}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(x,{htmlFor:"perm-receive",className:"cursor-pointer text-xs font-normal",children:"Agent receives new messages"}),e.jsx(E,{id:"perm-receive",checked:w,onCheckedChange:M,"aria-label":"Agent receives new messages"})]})]}),e.jsxs("div",{className:"space-y-2.5 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Notifications"}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(x,{htmlFor:"notify-task-complete",className:"cursor-pointer text-xs font-normal",children:"Message me when scheduled tasks finish"}),e.jsx(E,{id:"notify-task-complete",checked:$,onCheckedChange:L,"aria-label":"Message me when scheduled tasks finish"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"When off, you still hear about runs that didn’t finish."}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Needs “Agent can message first”."}),p&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Message your bot once to start. Bots can’t write first."})]})]}),e.jsx(Xe,{descriptor:f,consequence:e.jsxs(e.Fragment,{children:["Anyone who can message this connection can make the agent act, with no one asked."," ",e.jsxs(Qe,{label:"About asking in the chat",title:"At a stop that asks",children:[e.jsx("p",{children:"Where your connection can show buttons, the agent waits for Approve or Deny."}),e.jsx("p",{children:"Only people on the approver list can answer."}),e.jsx("p",{children:"An ask nobody answers is refused after 10 minutes, and the agent carries on."})]})]}),onCancel:()=>I(null),onConfirm:()=>{f&&h(f.id),I(null)}})]})}const m="__any__",en={"per-chat":"One shared chat per group or channel","per-user":"One chat for each person",stateless:"No memory between messages"},me=[{value:"dm",label:"Direct message"},{value:"group",label:"Group"},{value:"channel",label:"Broadcast channel"},{value:"thread",label:"Thread"}];function xe(n){var i;return((i=me.find(o=>o.value===n))==null?void 0:i.label)??n}function nn({sessionStrategy:n,chatDisplayName:i,channelType:o}){const h=en[n];return i?`${h} in ${i}`:o?`${h} · ${xe(o)}`:h}function hn(n){return{adapterId:n.adapterId,agentId:n.agentId,sessionStrategy:n.sessionStrategy,label:n.label,permissionMode:n.permissionMode,chatId:n.chatId,channelType:n.channelType,canInitiate:n.canInitiate,canReply:n.canReply,canReceive:n.canReceive,notifyOnTaskComplete:n.notifyOnTaskComplete}}function pn(n){return{sessionStrategy:n.sessionStrategy,label:n.label,permissionMode:n.permissionMode,chatId:n.chatId??null,channelType:n.channelType??null,canInitiate:n.canInitiate,canReply:n.canReply,canReceive:n.canReceive,notifyOnTaskComplete:n.notifyOnTaskComplete}}function tn(n){return!!(n!=null&&n.canInitiate||(n==null?void 0:n.canReply)===!1||(n==null?void 0:n.canReceive)===!1||(n==null?void 0:n.notifyOnTaskComplete)===!1||(n==null?void 0:n.permissionMode)!==void 0&&n.permissionMode!=="acceptEdits"||n!=null&&n.sessionStrategy&&n.sessionStrategy!=="per-chat")}function sn(n,i){return{adapterId:(n==null?void 0:n.adapterId)??"",agentId:(n==null?void 0:n.agentId)??"",strategy:(n==null?void 0:n.sessionStrategy)??"per-chat",label:(n==null?void 0:n.label)??"",chatId:(n==null?void 0:n.chatId)??m,channelType:(n==null?void 0:n.channelType)??m,permissionMode:(n==null?void 0:n.permissionMode)??(i==null?void 0:i.defaultPermissionMode)??"acceptEdits",canInitiate:(n==null?void 0:n.canInitiate)??(i==null?void 0:i.defaultCanInitiate)??!1,canReply:(n==null?void 0:n.canReply)??!0,canReceive:(n==null?void 0:n.canReceive)??!0,notifyOnTaskComplete:(n==null?void 0:n.notifyOnTaskComplete)??!0}}function mn({open:n,onOpenChange:i,onConfirm:o,mode:h,initialValues:d,adapterName:y,agentName:C,onDelete:O,bindingId:w,isPending:M,bridged:$,bridgeSlot:L}){const p=h==="edit",[_,P]=A.useState(()=>!!(d!=null&&d.chatId||d!=null&&d.channelType)),[z,q]=A.useState(()=>tn(d)),{data:u}=Ae(),j=le(G),[c]=A.useState(()=>{var t;return sn(d,p?void 0:{defaultPermissionMode:Se(Re(u==null?void 0:u.executionDefaults,G),(j==null?void 0:j.permissionModes.values)??[]),defaultCanInitiate:u!=null&&Ue((t=u.permissions)==null?void 0:t.preset)==="trusted"})}),r=Ge({defaultValues:c,onSubmit:async({value:t})=>{await o({adapterId:t.adapterId,agentId:t.agentId,sessionStrategy:t.strategy,label:t.label,permissionMode:t.permissionMode,chatId:t.chatId===m?void 0:t.chatId,channelType:t.channelType===m?void 0:t.channelType,canInitiate:t.canInitiate,canReply:t.canReply,canReceive:t.canReceive,notifyOnTaskComplete:t.notifyOnTaskComplete}),p||r.reset()}}),{data:D=[]}=ke(),{data:f}=Fe(),[I,H]=A.useState(()=>(d==null?void 0:d.adapterId)??""),{data:l=[]}=Ze(I||void 0),N=D.flatMap(t=>t.instances.filter(g=>g.enabled).map(g=>({id:g.id,label:g.label?`${g.label} (${t.manifest.displayName})`:`${g.id} (${t.manifest.displayName})`}))),T=(f==null?void 0:f.agents)??[];function ge(){r.setFieldValue("chatId",m),r.setFieldValue("channelType",m)}return e.jsx(Oe,{open:n,onOpenChange:i,children:e.jsxs(we,{className:"max-h-[85vh] max-w-md gap-0 p-0",children:[e.jsxs(Me,{className:"border-b px-4 py-3",children:[e.jsx(De,{children:p?"Edit connection":"Add connection"}),e.jsx(Ee,{className:"sr-only",children:p?"Edit this connection’s settings":"Connect this agent to a chat"})]}),e.jsx(r.Subscribe,{selector:t=>({values:t.values,isSubmitting:t.isSubmitting}),children:({values:t,isSubmitting:g})=>{var V;const Q=p||!!t.adapterId&&!!t.agentId,ue=!p||t.adapterId!==c.adapterId||t.agentId!==c.agentId||t.strategy!==c.strategy||t.label!==c.label||t.chatId!==c.chatId||t.channelType!==c.channelType||t.permissionMode!==c.permissionMode||t.canInitiate!==c.canInitiate||t.canReply!==c.canReply||t.canReceive!==c.canReceive||t.notifyOnTaskComplete!==c.notifyOnTaskComplete,U=p?C:(V=T.find(s=>s.id===t.agentId))==null?void 0:V.name,W=Q&&U?`${nn({sessionStrategy:t.strategy,chatDisplayName:t.chatId!==m?`#${t.chatId}`:void 0,channelType:t.channelType!==m?t.channelType:void 0})}. Routed to ${U}.`:null,Y=t.chatId!==m||t.channelType!==m,ye=t.strategy!=="per-chat"||t.permissionMode!=="acceptEdits"||t.canInitiate||!t.canReply||!t.canReceive||!t.notifyOnTaskComplete,je=!Q||!ue||!!M||g,K=!!M||g;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-5 overflow-y-auto px-4 py-5",children:[p?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Connection:"," ",e.jsx("span",{className:"text-foreground font-medium",children:y})," →"," ",e.jsx("span",{className:"text-foreground font-medium",children:C})]}),L]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(x,{htmlFor:"binding-adapter",children:"Source"}),N.length===0?e.jsx("p",{className:"text-muted-foreground border-input rounded-md border px-3 py-2 text-sm opacity-50",children:"Nothing set up yet"}):e.jsx(r.AppField,{name:"adapterId",children:s=>e.jsxs(S,{value:s.state.value,onValueChange:a=>{s.handleChange(a),H(a)},children:[e.jsx(R,{id:"binding-adapter",className:"w-full",children:e.jsx(k,{placeholder:"Pick a source"})}),e.jsx(F,{children:N.map(a=>e.jsx(b,{value:a.id,children:a.label},a.id))})]})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(x,{htmlFor:"binding-agent",children:"Agent"}),T.length===0?e.jsx("p",{className:"text-muted-foreground border-input rounded-md border px-3 py-2 text-sm opacity-50",children:"No agents yet"}):e.jsx(r.AppField,{name:"agentId",children:s=>e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(R,{id:"binding-agent",className:"w-full",children:e.jsx(k,{placeholder:"Select an agent"})}),e.jsx(F,{children:T.map(a=>e.jsx(b,{value:a.id,children:Be(a)},a.id))})]})})]})]}),e.jsx(r.AppField,{name:"label",children:s=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(x,{htmlFor:"binding-label",children:"Label (optional)"}),e.jsx($e,{id:"binding-label",placeholder:"e.g., Customer support bot",value:s.state.value,onBlur:s.handleBlur,onChange:a=>s.handleChange(a.target.value)}),e.jsx(J,{children:"A name to tell this connection apart"})]})}),e.jsxs(he,{open:_,onOpenChange:P,trigger:"Chat filter",badge:Y?e.jsx(pe,{variant:"secondary",children:"Active"}):void 0,children:[e.jsx(r.AppField,{name:"chatId",children:s=>e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{htmlFor:"binding-chat-id",children:"Chat ID"}),e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(R,{id:"binding-chat-id",className:"w-full",children:e.jsx(k,{placeholder:"Any chat"})}),e.jsxs(F,{children:[e.jsx(b,{value:m,children:"Any chat"}),l.map(a=>e.jsxs(b,{value:a.chatId,children:[e.jsx("span",{children:a.displayName??a.chatId}),(a.channelType||a.messageCount>0)&&e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:[a.channelType?xe(a.channelType):null,`${a.messageCount} messages`].filter(Boolean).join(" · ")})]},a.chatId))]})]}),e.jsx(J,{children:"Only take messages from this chat"})]})}),e.jsx(r.AppField,{name:"channelType",children:s=>e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(x,{htmlFor:"binding-channel-type",children:"Chat type"}),e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(R,{id:"binding-channel-type",className:"w-full",children:e.jsx(k,{placeholder:"Any type"})}),e.jsxs(F,{children:[e.jsx(b,{value:m,children:"Any type"}),me.map(a=>e.jsx(b,{value:a.value,children:a.label},a.value))]})]})]})}),Y&&e.jsx("div",{className:"px-4 py-3",children:e.jsx(B,{variant:"ghost",size:"sm",onClick:ge,children:"Clear filters"})})]}),e.jsx(ve,{strategy:t.strategy,onStrategyChange:s=>r.setFieldValue("strategy",s),permissionMode:t.permissionMode,onPermissionModeChange:s=>r.setFieldValue("permissionMode",s),canInitiate:t.canInitiate,onCanInitiateChange:s=>r.setFieldValue("canInitiate",s),canReply:t.canReply,onCanReplyChange:s=>r.setFieldValue("canReply",s),canReceive:t.canReceive,onCanReceiveChange:s=>r.setFieldValue("canReceive",s),notifyOnTaskComplete:t.notifyOnTaskComplete,onNotifyOnTaskCompleteChange:s=>r.setFieldValue("notifyOnTaskComplete",s),notifyBootstrapHint:l.length===0,bridged:$,open:z,onOpenChange:q,hasChanges:ye}),W&&e.jsx("p",{className:"text-muted-foreground bg-muted/50 rounded-md px-3 py-2 text-xs italic",children:W})]}),e.jsxs(Le,{className:"border-t px-4 py-3",children:[p&&O&&w&&e.jsxs(ee,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"mr-auto text-red-600 hover:bg-red-50 hover:text-red-700 dark:hover:bg-red-950",children:[e.jsx(Pe,{className:"mr-1.5 size-3.5"}),"Remove"]})}),e.jsxs(ne,{children:[e.jsxs(te,{children:[e.jsx(se,{children:"Remove this connection?"}),e.jsx(ae,{children:"This agent stops getting messages from it."})]}),e.jsxs(re,{children:[e.jsx(ce,{children:"Cancel"}),e.jsx(oe,{onClick:()=>O(w),className:ze({variant:"destructive"}),children:"Remove connection"})]})]})]}),e.jsx(B,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:"Cancel"}),e.jsxs(B,{size:"sm",onClick:()=>r.handleSubmit(),disabled:je,children:[K&&e.jsx(qe,{size:"xs",className:"mr-1.5"}),K?"Saving…":p?"Save changes":"Add connection"]})]})]})}})]})})}export{mn as B,ln as a,nn as b,hn as c,xe as d,pn as t,Ze as u};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BaDCR0nn.js","assets/index-BYTLOFNS.js","assets/index-BbPg1hpf.css","assets/transform-BqqRT-Iy.js"])))=>i.map(i=>d[i]);
2
- var G7=Object.defineProperty;var P1=r=>{throw TypeError(r)};var J7=(r,e,t)=>e in r?G7(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Me=(r,e,t)=>J7(r,typeof e!="symbol"?e+"":e,t),hd=(r,e,t)=>e.has(r)||P1("Cannot "+t);var C=(r,e,t)=>(hd(r,e,"read from private field"),t?t.call(r):e.get(r)),H=(r,e,t)=>e.has(r)?P1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(hd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Ui=(r,e,t)=>(hd(r,e,"access private method"),t);import{qP as B1,qQ as Y7,qR as ty,qS as Nh,qT as X7,qU as Z7,qV as Q7,r as R,R as ry,eQ as Mc,qW as Eh,qX as Dh,qY as qs,qZ as F1,q_ as ny,q$ as eb,r0 as hl,r1 as fl,r2 as $1,r3 as ts,r4 as tb,r5 as rb,r6 as nb,r7 as g0,r8 as iy,r9 as Za,gS as ib,ra as sb,rb as is,rc as Mr,rd as Ki,re as Vc,rf as Ve,ft as ob,rg as ab,rh as lb,ri as Wr,rj as iu,rk as Ni,rl as sy,rm as q1,j as P,hk as cb,G as ub,a_ as db}from"./index-BYTLOFNS.js";import{p as Uf}from"./index-JLySVSjV.js";import{aw as hb,ax as fb,ab as pb,ac as mb,ad as gb,ae as yb,af as vb,ag as oy,ah as bb,q as y0,ai as wb,aj as ay,ar as kb,ak as xb,al as Sb,am as Cb,an as Mb,ao as Tb,ap as Ab,aq as Nb,Z as Kf,a4 as Eb,a5 as ly,a6 as Db,a7 as Ob,a8 as Rb,a9 as Ib,aa as zb,m as Lb,a as Pb,ay as Bb,E as Wa,as as Fb,t as ft,n as $b,at as qb,C as _1,az as _b}from"./index-vEujcopz.js";const Hb={}.hasOwnProperty;function cy(r,e){let t=-1,n;if(e.extensions)for(;++t<e.extensions.length;)cy(r,e.extensions[t]);for(n in e)if(Hb.call(e,n))switch(n){case"extensions":break;case"unsafe":{H1(r[n],e[n]);break}case"join":{H1(r[n],e[n]);break}case"handlers":{jb(r[n],e[n]);break}default:r.options[n]=e[n]}return r}function H1(r,e){e&&r.push(...e)}function jb(r,e){e&&Object.assign(r,e)}const Vb=[Wb];function Wb(r,e,t,n){if(e.type==="code"&&B1(e,n)&&(r.type==="list"||r.type===e.type&&B1(r,n)))return!1;if("spread"in t&&typeof t.spread=="boolean")return r.type==="paragraph"&&(r.type===e.type||e.type==="definition"||e.type==="heading"&&Y7(e,n))?void 0:t.spread?1:0}const Gi=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Ub=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DUIkdbeL.js","assets/index-BR1m9FON.js","assets/index-BdVQOlVQ.css","assets/transform-BqqRT-Iy.js"])))=>i.map(i=>d[i]);
2
+ var G7=Object.defineProperty;var P1=r=>{throw TypeError(r)};var J7=(r,e,t)=>e in r?G7(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Me=(r,e,t)=>J7(r,typeof e!="symbol"?e+"":e,t),hd=(r,e,t)=>e.has(r)||P1("Cannot "+t);var C=(r,e,t)=>(hd(r,e,"read from private field"),t?t.call(r):e.get(r)),H=(r,e,t)=>e.has(r)?P1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(hd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Ui=(r,e,t)=>(hd(r,e,"access private method"),t);import{qR as B1,qS as Y7,qT as ty,qU as Nh,qV as X7,qW as Z7,qX as Q7,r as R,R as ry,eQ as Mc,qY as Eh,qZ as Dh,q_ as qs,q$ as F1,r0 as ny,r1 as eb,r2 as hl,r3 as fl,r4 as $1,r5 as ts,r6 as tb,r7 as rb,r8 as nb,r9 as g0,ra as iy,rb as Za,gO as ib,rc as sb,rd as is,re as Mr,rf as Ki,rg as Vc,rh as Ve,ft as ob,ri as ab,rj as lb,rk as Wr,rl as iu,rm as Ni,rn as sy,ro as q1,j as P,hk as cb,G as ub,a_ as db}from"./index-BR1m9FON.js";import{p as Uf}from"./index-CfKSlYjb.js";import{aw as hb,ax as fb,ab as pb,ac as mb,ad as gb,ae as yb,af as vb,ag as oy,ah as bb,q as y0,ai as wb,aj as ay,ar as kb,ak as xb,al as Sb,am as Cb,an as Mb,ao as Tb,ap as Ab,aq as Nb,Z as Kf,a4 as Eb,a5 as ly,a6 as Db,a7 as Ob,a8 as Rb,a9 as Ib,aa as zb,m as Lb,a as Pb,ay as Bb,E as Wa,as as Fb,t as ft,n as $b,at as qb,C as _1,az as _b}from"./index-D5Qmx1JR.js";const Hb={}.hasOwnProperty;function cy(r,e){let t=-1,n;if(e.extensions)for(;++t<e.extensions.length;)cy(r,e.extensions[t]);for(n in e)if(Hb.call(e,n))switch(n){case"extensions":break;case"unsafe":{H1(r[n],e[n]);break}case"join":{H1(r[n],e[n]);break}case"handlers":{jb(r[n],e[n]);break}default:r.options[n]=e[n]}return r}function H1(r,e){e&&r.push(...e)}function jb(r,e){e&&Object.assign(r,e)}const Vb=[Wb];function Wb(r,e,t,n){if(e.type==="code"&&B1(e,n)&&(r.type==="list"||r.type===e.type&&B1(r,n)))return!1;if("spread"in t&&typeof t.spread=="boolean")return r.type==="paragraph"&&(r.type===e.type||e.type==="definition"||e.type==="heading"&&Y7(e,n))?void 0:t.spread?1:0}const Gi=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Ub=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
3
3
  `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:Gi},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
4
4
  ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:Gi},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
5
5
  *])`},{character:"*",inConstruct:"phrasing",notInConstruct:Gi},{atBreak:!0,character:"+",after:`(?:[ \r
@@ -1228,4 +1228,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1228
1228
  fill: hsl(var(--muted-foreground)) !important;
1229
1229
  stroke: hsl(var(--muted-foreground)) !important;
1230
1230
  }
1231
- `,Nz={look:"classic",fontFamily:"var(--font-sans)",themeCSS:Az},Ez=()=>db(()=>import("./mermaid.core-BaDCR0nn.js").then(r=>r.bm),__vite__mapDeps([0,1,2,3])).then(r=>(r.default.initialize(Nz),r));function Dz({value:r,editable:e,onChange:t,className:n,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l}){const c=cb();return P.jsx("div",{"data-theme":c,className:"dorkos-markdown contents",children:P.jsx(Mz,{value:r,theme:c,editable:e,onChange:t,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l,mermaid:Ez,className:ub("desktop:select-text",n)})})}const Lz=Object.freeze(Object.defineProperty({__proto__:null,BlintzCanvas:Dz},Symbol.toStringTag,{value:"Module"}));export{Lz as B,X0 as S,xD as a,kD as b,CD as c,dD as f,Z0 as i,Gv as p,Iv as r,l2 as t};
1231
+ `,Nz={look:"classic",fontFamily:"var(--font-sans)",themeCSS:Az},Ez=()=>db(()=>import("./mermaid.core-DUIkdbeL.js").then(r=>r.bm),__vite__mapDeps([0,1,2,3])).then(r=>(r.default.initialize(Nz),r));function Dz({value:r,editable:e,onChange:t,className:n,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l}){const c=cb();return P.jsx("div",{"data-theme":c,className:"dorkos-markdown contents",children:P.jsx(Mz,{value:r,theme:c,editable:e,onChange:t,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l,mermaid:Ez,className:ub("desktop:select-text",n)})})}const Lz=Object.freeze(Object.defineProperty({__proto__:null,BlintzCanvas:Dz},Symbol.toStringTag,{value:"Module"}));export{Lz as B,X0 as S,xD as a,kD as b,CD as c,dD as f,Z0 as i,Gv as p,Iv as r,l2 as t};
@@ -1,4 +1,4 @@
1
- import{ft as Ee,a5 as xe,aZ as Re,r as ve,a6 as Se,j,G as Ce}from"./index-BYTLOFNS.js";import{u as Oe}from"./index-CIokV9hG.js";import{r as Te}from"./use-session-canvas-Cc04zSW3.js";import"./rotate-cw-CpuoCwEK.js";import"./query-keys-DeYqUDia.js";import"./index.esm-B0kiCgAP.js";import"./WidgetErrorCard-B477vOv2.js";import"./index-D0k8LoLP.js";import"./progress-CNm_pBbE.js";import"./markdown-content-C1i_dR6j.js";import"./table-BrvyPoEL.js";import"./zap-BmeuEI5X.js";import"./package-DHEY3aDq.js";import"./heart-DKWg_e72.js";import"./git-branch-DpByNz2U.js";import"./file-text-CS9s0qOe.js";import"./file-C_57RCIQ.js";import"./McpAppFrame-DAPJUxUi.js";import"./more-details-DNp6DH8i.js";var he={exports:{}};/* @license
1
+ import{ft as Ee,a5 as xe,aZ as Re,r as ve,a6 as Se,j,G as Ce}from"./index-BR1m9FON.js";import{u as Oe}from"./index-Cgjq7a-8.js";import{r as Te}from"./use-session-canvas-tvLLPQcm.js";import"./rotate-cw-BbHkWN-J.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CJIDYBqd.js";import"./WidgetErrorCard-C5ieVv_9.js";import"./index-CpWxcN5D.js";import"./progress-BA2JPtb6.js";import"./markdown-content-DhAtZOfj.js";import"./table-D0EJT0uP.js";import"./zap-DSllMMHe.js";import"./package-BhKXbvU_.js";import"./heart-Cn3a-UQI.js";import"./git-branch-CsLE6G0Y.js";import"./file-text-Cycq_S0e.js";import"./file-CQGljfDT.js";import"./McpAppFrame-z5JUaCSA.js";import"./more-details-DV7LmY0E.js";var he={exports:{}};/* @license
2
2
  Papa Parse
3
3
  v5.7.0
4
4
  https://github.com/mholt/PapaParse
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-Ct5GtLSd.js","assets/index-BYTLOFNS.js","assets/index-BbPg1hpf.css","assets/index-DwAhtrb9.js","assets/index-vEujcopz.js","assets/BlintzCanvas-Dz8rAsfT.js","assets/index-JLySVSjV.js","assets/BlintzCanvas-DCXOV_yN.css"])))=>i.map(i=>d[i]);
2
- import{r as a,aZ as z,hh as ce,j as t,G as O,ge as oe,gf as le,B as D,gg as ue,gh as de,gi as Z,hi as fe,dn as he,dp as pe,J as me,gv as ve,dq as xe,a7 as ge,hj as be,a_ as ee,a5 as ye,hk as je,a6 as Ce}from"./index-BYTLOFNS.js";import{u as ke,a as we,b as Re}from"./use-session-canvas-Cc04zSW3.js";import{R as Te}from"./rotate-cw-CpuoCwEK.js";import"./query-keys-DeYqUDia.js";import"./index.esm-B0kiCgAP.js";import"./WidgetErrorCard-B477vOv2.js";import"./index-D0k8LoLP.js";import"./progress-CNm_pBbE.js";import"./markdown-content-C1i_dR6j.js";import"./table-BrvyPoEL.js";import"./zap-BmeuEI5X.js";import"./package-DHEY3aDq.js";import"./heart-DKWg_e72.js";import"./git-branch-DpByNz2U.js";import"./file-text-CS9s0qOe.js";import"./file-C_57RCIQ.js";import"./McpAppFrame-DAPJUxUi.js";import"./more-details-DNp6DH8i.js";function B(e,r){return["canvas-file",e,r]}function Ne({documentId:e,sourcePath:r,binding:d,save:n,draftRef:o,revisionRef:s,finishAttemptRef:C,timerRef:y,finalSaveRef:b,invalidateConfirmedFile:p}){const x=a.useRef({binding:d,save:n,invalidateConfirmedFile:p}),_=a.useRef(null),f=a.useRef(null);return a.useLayoutEffect(()=>{x.current={binding:d,save:n,invalidateConfirmedFile:p}}),a.useLayoutEffect(()=>{const w=z.getState().openDocuments.find(m=>m.id===e);if(!w||typeof w.openedAt!="number")return;const R=ce(e,w.openedAt,r,{required:()=>!!x.current.binding,current:()=>{const m=f.current;return!!m&&m.revision===s.current&&m.attempt===C.current&&m.binding===x.current.binding&&m.save===x.current.save&&m.binding.current()},invalidateConfirmedFile:()=>x.current.invalidateConfirmedFile(),prepare:async()=>{var c;f.current=null;const{binding:m,save:T}=x.current;if(!(m!=null&&m.current()))return!1;y.current&&(clearTimeout(y.current),y.current=null);const F=o.current,g=s.current,l=++C.current,i=await T(F);return i.status!=="changed"&&i.status!=="no_op"||i.confirmed.content!==F||s.current!==g||C.current!==l||x.current.binding!==m||x.current.save!==T||!m.current()?!1:((c=b.current)==null||c.cancel(),b.current=null,f.current={revision:g,attempt:l,binding:m,save:T},!0)}});return _.current=R,()=>R.retire()},[e,r,o,s,C,y,b]),_}function M(e){return e.status==="refused"||e.status==="local_uncertain"?e.status:"unavailable"}function _e(e,r,d){var l;const n=a.useRef(e),o=a.useRef(null),s=a.useRef(null),[C,y]=a.useState({identity:e.identity,phase:"pending",busy:!1});a.useLayoutEffect(()=>{n.current=e},[e]);const b=a.useCallback((i,c)=>{o.current===i&&n.current.identity===i&&n.current.current()&&y(u=>({identity:i,...c,historical:c.historical??(u.identity===i?u.historical:void 0)}))},[]),p=a.useCallback(i=>{o.current!==i||n.current.identity!==i||y(c=>c.identity===i?{...c,phase:"unavailable",busy:!1}:{identity:i,phase:"unavailable",busy:!1})},[]),x=e.identity,_=e.supported;a.useLayoutEffect(()=>{const i=n.current;s.current=null,o.current=x;let c=!1;return _&&r==="ready"&&i.discover().then(u=>{c||(u.status==="observed"?b(x,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(x,{phase:M(u),busy:!1}):p(x))}),()=>{c=!0,s.current=null,o.current===x&&(o.current=null)}},[x,_,r,d,b,p]);const f=C.identity===e.identity?C:void 0,w=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return;s.current=null,y(j=>({identity:c,phase:"pending",busy:!0,historical:j.identity===c?j.historical:void 0}));const u=await i.discover(!0);u.status==="observed"?b(c,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(c,{phase:M(u),busy:!1}):p(c)},[b,p]),R=a.useCallback(async i=>{const c=n.current,u=c.identity;if(o.current!==u||!c.current())return;s.current=null,y(h=>({identity:u,phase:"pending",busy:!0,discovery:h.identity===u?h.discovery:void 0,historical:h.identity===u?h.historical:void 0}));const j=await c.recover(i);j.status==="observed"?b(u,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?b(u,{phase:M(j),busy:!1}):p(u)},[b,p]),m=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return{status:"idle"};const u={};s.current=u,y(h=>h.identity===c?{...h,phase:"pending",busy:!0}:h);const j=await i.inspectCurrent();return s.current!==u?{status:"idle"}:(s.current=null,j.status==="idle"&&p(c),o.current===c&&n.current.identity===c&&i.current()&&j.status!=="idle"&&y(h=>h.identity===c?{...h,phase:j.status==="observed"?"ready":M(j),busy:!1}:h),j)},[p]),T=e.supported&&r==="ready",F=r==="pending"?"pending":(f==null?void 0:f.phase)??"pending",g=T&&(F!=="ready"||((l=f==null?void 0:f.discovery)==null?void 0:l.admission)==="blocked");return{supported:T,phase:F,editBlocked:g,busy:(f==null?void 0:f.busy)??F==="pending",discovery:f==null?void 0:f.discovery,historical:f==null?void 0:f.historical,refresh:w,recover:R,inspectCurrent:m}}const Fe={unavailable:"Couldn’t check previous saves, so editing is off.",refused:"This file can’t be edited from this canvas."};function Pe(e){var r,d,n;return e.supported?e.phase==="unavailable"||e.phase==="refused"||e.phase==="local_uncertain"?!0:((r=e.discovery)==null?void 0:r.admission)==="blocked"||((d=e.discovery)==null?void 0:d.entries.some(o=>o.state==="review"))===!0||((n=e.historical)==null?void 0:n.state)==="receipt":!1}function X({recovery:e,editing:r,loadCurrent:d}){var o;if(e.phase==="unavailable"||e.phase==="refused")return t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",className:"col-start-1 row-start-1 py-1.5",children:Fe[e.phase]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",className:"col-span-2 col-start-1 row-start-2 mb-1.5 justify-self-start @md:col-span-1 @md:col-start-2 @md:row-start-1 @md:mb-0",disabled:e.busy||r,onClick:()=>void e.refresh(),children:"Check again"})]});if(e.phase==="local_uncertain")return t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."});const n=e.discovery;return t.jsxs("div",{className:"space-y-1",children:[(n==null?void 0:n.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),(n==null?void 0:n.hasMore)&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),n&&n.entries.length>0&&t.jsx(t.Fragment,{children:t.jsx("ul",{children:n.entries.map(s=>t.jsxs("li",{children:[t.jsxs("span",{children:[s.eventId,":"," ",s.state==="receipt"?"Historical save recorded":s.state==="review"?"Original save needs review":s.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),s.state==="review"&&(s.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:e.busy||r,onClick:()=>void e.recover(s.eventId),children:"Recover original receipt"})]}))]},s.eventId))})}),(n==null?void 0:n.admission)==="blocked"&&n.entries.length===0&&t.jsx("p",{children:"No matching recent saves."}),((o=e.historical)==null?void 0:o.state)==="receipt"&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("div",{children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:r||e.editBlocked||e.busy,onClick:d,children:"Load current file"})]})]})}function Se({recovery:e,editing:r,loadCurrent:d}){return!e.supported||r?null:t.jsxs(oe,{children:[t.jsx(le,{asChild:!0,children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground","aria-label":"More file actions",children:t.jsx(ue,{className:"size-4"})})}),t.jsxs(de,{align:"end",children:[t.jsx(Z,{disabled:e.busy,onSelect:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(Z,{disabled:e.editBlocked||e.busy,onSelect:()=>d(),children:"Load current file"})]})]})}function De({recovery:e,editing:r,loadCurrent:d,toolbar:n}){const o=Pe(e),s=e.phase==="unavailable"||e.phase==="refused";return t.jsxs(t.Fragment,{children:[e.supported&&e.phase==="pending"&&t.jsx("p",{role:"status",className:"sr-only",children:"Checking previous saves…"}),t.jsx("div",{...o?{role:"region","aria-label":"Previous file saves"}:{},className:O("shrink-0",o?"bg-muted text-foreground mx-2 mt-2 rounded-md py-1 pr-1 pl-3 text-sm":"flex justify-end px-2 pt-1",o&&(s?"@container":"flow-root")),children:t.jsxs("div",{className:O(o&&s&&"grid grid-cols-[1fr_auto] items-center gap-x-2 @md:grid-cols-[1fr_auto_auto]"),children:[t.jsx("div",{className:O("flex items-center gap-1",o&&!s&&"float-right ml-2",o&&s&&"col-start-2 row-start-1 @md:col-start-3"),children:n}),o&&(s?t.jsx(X,{recovery:e,editing:r,loadCurrent:d}):t.jsx("div",{className:"py-1.5",children:t.jsx(X,{recovery:e,editing:r,loadCurrent:d})}))]})})]})}function Le({editing:e,off:r,observation:d,onClick:n}){return t.jsx(fe,{children:t.jsxs(he,{...r?{}:{open:!1},children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:n,"aria-label":e?"Finish editing":"Edit file",disabled:r,"data-document-save-observation":d,children:e?t.jsx(me,{className:"size-4"}):t.jsx(ve,{className:"size-4"})})})}),t.jsx(xe,{children:"Editing is off"})]})})}const Ee=a.lazy(()=>ee(()=>import("./CodeMirrorEditor-Ct5GtLSd.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ze=a.lazy(()=>ee(()=>import("./BlintzCanvas-Dz8rAsfT.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),Be=500;function Me(e,r){return r==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function Oe(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function te({content:e,documentId:r,cwd:d,loaded:n,theme:o,isEditing:s,onEditingChange:C,setDocumentEditing:y,observedBinding:b,fileSaveObservation:p="unavailable",recoveryBinding:x}){const _=e.readOnly!==!0,f=Me(e.sourcePath,e.language),w=ge(),[R,m]=a.useState(n),[T,F]=a.useState(),g=a.useRef(b);a.useLayoutEffect(()=>{g.current=b},[b]);const l=ke({documentId:r,sourcePath:e.sourcePath,cwd:d,loadedContent:n,documentSaveBinding:T,documentRecoveryBinding:x}),i=_e(l.recovery,p,x),c=we({cwd:d,sourcePath:f?e.sourcePath:null,content:R,saved:l.status==="saved"}),u=a.useRef(!1),j=a.useRef(s);a.useLayoutEffect(()=>(u.current=!0,j.current=s,()=>{u.current=!1}),[s]);const h=a.useRef(null),S=a.useRef(R),L=a.useRef(0),A=a.useRef(0),I=a.useRef(l.save),K=a.useRef(l.prepareFinalSave),U=a.useRef(l.waitForCloseDrain),E=a.useRef(null),V=a.useRef(C),Y=Ne({documentId:r,sourcePath:e.sourcePath,binding:T,save:l.save,draftRef:S,revisionRef:L,finishAttemptRef:A,timerRef:h,finalSaveRef:E,invalidateConfirmedFile:()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)}).catch(()=>{})}});a.useEffect(()=>{S.current=R,I.current=l.save,K.current=l.prepareFinalSave,U.current=l.waitForCloseDrain,V.current=C});const $=a.useCallback(v=>{var k;L.current+=1,S.current=v,m(v),(k=E.current)==null||k.cancel(),E.current=K.current(v),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,I.current(S.current)},Be)},[]),se=()=>{var P;if(i.editBlocked||p==="pending"||p==="ready"&&!((P=g.current)!=null&&P.current()))return;const v=g.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const N=g.current;return!!N&&be(k,N.incarnation)&&N.current()}}:void 0),L.current+=1,S.current=n,m(n),C(!0),y(r,!0)},ne=async()=>{h.current&&(clearTimeout(h.current),h.current=null);const v=S.current,k=L.current,P=++A.current,N=await I.current(v);if(N.status!=="changed"&&N.status!=="no_op"||L.current!==k||A.current!==P||N.confirmed.content!==v)return;const q=N.confirmed;q.content===S.current&&w.setQueryData(B(d,e.sourcePath),Q=>Q&&{...Q,content:q.content,hash:q.hash}),C(!1),y(r,!1)},re=()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)})};a.useEffect(()=>{var v;s||(h.current&&clearTimeout(h.current),h.current=null,(v=E.current)==null||v.cancel(),E.current=null)},[s]),a.useEffect(()=>{const v=Y.current;return()=>{var N;h.current&&(clearTimeout(h.current),h.current=null);const k=(N=E.current)==null?void 0:N.flush(),P=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>U.current(P))),E.current=null,y(r,!1),V.current(!1)}},[r,y,Y]);const G=async()=>{if(s||!u.current||i.editBlocked)return;const v=L.current,k=await i.inspectCurrent();k.status!=="observed"||!u.current||j.current||L.current!==v||!l.recovery.current()||w.setQueryData(B(d,e.sourcePath),P=>P&&{...P,...k.value})},ae=()=>{const v=l.adoptDisk();v!=null&&m(v)},ie=()=>{l.overwrite(S.current)},J=l.status==="saved"?l.confirmedContent!==R?"Unsaved changes":l.documentReceipt?"Save recorded":"Saved to file":Oe(l.status),W=s?R:n;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsx(De,{recovery:i,editing:s,loadCurrent:()=>void G(),toolbar:t.jsxs(t.Fragment,{children:[_&&J&&t.jsx("span",{className:O("mr-1 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:J}),!s&&p==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!s&&t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:re,"aria-label":"Refresh from disk",children:t.jsx(Te,{className:"size-4"})}),_&&t.jsx(Le,{editing:s,off:!s&&(p==="pending"||i.editBlocked),observation:p,onClick:s?()=>void ne():se}),t.jsx(Se,{recovery:i,editing:s,loadCurrent:()=>void G()})]})}),l.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>void l.retryUnconfirmed(),children:"Retry original save"})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ae,children:"Reload"}),t.jsx(D,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:ie,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:f?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ze,{value:W,editable:s,onChange:s?$:void 0,wikiLinks:c})}):t.jsx(Ee,{value:W,editable:s,filename:e.sourcePath,languageHint:e.language,theme:o,onChange:s?$:void 0})})})]})}function Ae(e){const{fileSaveBinding:r,fileSaveObservation:d}=Re(e.documentId);return t.jsx(te,{...e,observedBinding:r,recoveryBinding:r,fileSaveObservation:d})}function Ie(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function at({content:e,documentId:r}){const d=ye(),n=z(g=>g.selectedCwd),o=z(g=>g.setDocumentEditing),s=z(g=>{var l;return((l=g.openDocuments.find(i=>i.id===r))==null?void 0:l.editing)??!1}),C=je(),y=z(g=>g.canvasSessionId),b=z(g=>g.roomCanvasLiveRoomId),{data:p,error:x,isLoading:_}=Ce({queryKey:B(n,e.sourcePath),enabled:n!==null,queryFn:()=>d.readFileContent(n,e.sourcePath),staleTime:3e4,retry:!1}),[f,w]=a.useState(null),R=g=>{w(g&&p?{pinnedHash:p.hash}:null)};if(n===null)return t.jsx(H,{children:"Open a chat to view files."});if(_)return t.jsx(H,{children:"Loading file…"});if(x||!p)return t.jsx(H,{children:Ie(x)});const m=f!==null&&s,T=(m?f==null?void 0:f.pinnedHash:null)??p.hash,F=y&&!b?Ae:te;return t.jsx(F,{content:e,documentId:r,cwd:n,loaded:p.content,theme:C,isEditing:m,onEditingChange:R,setDocumentEditing:o},`${e.sourcePath}:${T}`)}function H({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{at as CanvasFileContent};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-DD5tArRn.js","assets/index-BR1m9FON.js","assets/index-BdVQOlVQ.css","assets/index-Cf4Gtxf9.js","assets/index-D5Qmx1JR.js","assets/BlintzCanvas-7E5uwVms.js","assets/index-CfKSlYjb.js","assets/BlintzCanvas-DCXOV_yN.css"])))=>i.map(i=>d[i]);
2
+ import{r as a,aZ as z,hh as ce,j as t,G as O,ge as oe,gf as le,B as D,gg as ue,gh as de,gi as Z,hi as fe,dn as he,dp as pe,J as me,gv as ve,dq as xe,a7 as ge,hj as be,a_ as ee,a5 as ye,hk as je,a6 as Ce}from"./index-BR1m9FON.js";import{u as ke,a as we,b as Re}from"./use-session-canvas-tvLLPQcm.js";import{R as Te}from"./rotate-cw-BbHkWN-J.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CJIDYBqd.js";import"./WidgetErrorCard-C5ieVv_9.js";import"./index-CpWxcN5D.js";import"./progress-BA2JPtb6.js";import"./markdown-content-DhAtZOfj.js";import"./table-D0EJT0uP.js";import"./zap-DSllMMHe.js";import"./package-BhKXbvU_.js";import"./heart-Cn3a-UQI.js";import"./git-branch-CsLE6G0Y.js";import"./file-text-Cycq_S0e.js";import"./file-CQGljfDT.js";import"./McpAppFrame-z5JUaCSA.js";import"./more-details-DV7LmY0E.js";function B(e,r){return["canvas-file",e,r]}function Ne({documentId:e,sourcePath:r,binding:d,save:n,draftRef:o,revisionRef:s,finishAttemptRef:C,timerRef:y,finalSaveRef:b,invalidateConfirmedFile:p}){const x=a.useRef({binding:d,save:n,invalidateConfirmedFile:p}),_=a.useRef(null),f=a.useRef(null);return a.useLayoutEffect(()=>{x.current={binding:d,save:n,invalidateConfirmedFile:p}}),a.useLayoutEffect(()=>{const w=z.getState().openDocuments.find(m=>m.id===e);if(!w||typeof w.openedAt!="number")return;const R=ce(e,w.openedAt,r,{required:()=>!!x.current.binding,current:()=>{const m=f.current;return!!m&&m.revision===s.current&&m.attempt===C.current&&m.binding===x.current.binding&&m.save===x.current.save&&m.binding.current()},invalidateConfirmedFile:()=>x.current.invalidateConfirmedFile(),prepare:async()=>{var c;f.current=null;const{binding:m,save:T}=x.current;if(!(m!=null&&m.current()))return!1;y.current&&(clearTimeout(y.current),y.current=null);const F=o.current,g=s.current,l=++C.current,i=await T(F);return i.status!=="changed"&&i.status!=="no_op"||i.confirmed.content!==F||s.current!==g||C.current!==l||x.current.binding!==m||x.current.save!==T||!m.current()?!1:((c=b.current)==null||c.cancel(),b.current=null,f.current={revision:g,attempt:l,binding:m,save:T},!0)}});return _.current=R,()=>R.retire()},[e,r,o,s,C,y,b]),_}function M(e){return e.status==="refused"||e.status==="local_uncertain"?e.status:"unavailable"}function _e(e,r,d){var l;const n=a.useRef(e),o=a.useRef(null),s=a.useRef(null),[C,y]=a.useState({identity:e.identity,phase:"pending",busy:!1});a.useLayoutEffect(()=>{n.current=e},[e]);const b=a.useCallback((i,c)=>{o.current===i&&n.current.identity===i&&n.current.current()&&y(u=>({identity:i,...c,historical:c.historical??(u.identity===i?u.historical:void 0)}))},[]),p=a.useCallback(i=>{o.current!==i||n.current.identity!==i||y(c=>c.identity===i?{...c,phase:"unavailable",busy:!1}:{identity:i,phase:"unavailable",busy:!1})},[]),x=e.identity,_=e.supported;a.useLayoutEffect(()=>{const i=n.current;s.current=null,o.current=x;let c=!1;return _&&r==="ready"&&i.discover().then(u=>{c||(u.status==="observed"?b(x,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(x,{phase:M(u),busy:!1}):p(x))}),()=>{c=!0,s.current=null,o.current===x&&(o.current=null)}},[x,_,r,d,b,p]);const f=C.identity===e.identity?C:void 0,w=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return;s.current=null,y(j=>({identity:c,phase:"pending",busy:!0,historical:j.identity===c?j.historical:void 0}));const u=await i.discover(!0);u.status==="observed"?b(c,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(c,{phase:M(u),busy:!1}):p(c)},[b,p]),R=a.useCallback(async i=>{const c=n.current,u=c.identity;if(o.current!==u||!c.current())return;s.current=null,y(h=>({identity:u,phase:"pending",busy:!0,discovery:h.identity===u?h.discovery:void 0,historical:h.identity===u?h.historical:void 0}));const j=await c.recover(i);j.status==="observed"?b(u,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?b(u,{phase:M(j),busy:!1}):p(u)},[b,p]),m=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return{status:"idle"};const u={};s.current=u,y(h=>h.identity===c?{...h,phase:"pending",busy:!0}:h);const j=await i.inspectCurrent();return s.current!==u?{status:"idle"}:(s.current=null,j.status==="idle"&&p(c),o.current===c&&n.current.identity===c&&i.current()&&j.status!=="idle"&&y(h=>h.identity===c?{...h,phase:j.status==="observed"?"ready":M(j),busy:!1}:h),j)},[p]),T=e.supported&&r==="ready",F=r==="pending"?"pending":(f==null?void 0:f.phase)??"pending",g=T&&(F!=="ready"||((l=f==null?void 0:f.discovery)==null?void 0:l.admission)==="blocked");return{supported:T,phase:F,editBlocked:g,busy:(f==null?void 0:f.busy)??F==="pending",discovery:f==null?void 0:f.discovery,historical:f==null?void 0:f.historical,refresh:w,recover:R,inspectCurrent:m}}const Fe={unavailable:"Couldn’t check previous saves, so editing is off.",refused:"This file can’t be edited from this canvas."};function Pe(e){var r,d,n;return e.supported?e.phase==="unavailable"||e.phase==="refused"||e.phase==="local_uncertain"?!0:((r=e.discovery)==null?void 0:r.admission)==="blocked"||((d=e.discovery)==null?void 0:d.entries.some(o=>o.state==="review"))===!0||((n=e.historical)==null?void 0:n.state)==="receipt":!1}function X({recovery:e,editing:r,loadCurrent:d}){var o;if(e.phase==="unavailable"||e.phase==="refused")return t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",className:"col-start-1 row-start-1 py-1.5",children:Fe[e.phase]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",className:"col-span-2 col-start-1 row-start-2 mb-1.5 justify-self-start @md:col-span-1 @md:col-start-2 @md:row-start-1 @md:mb-0",disabled:e.busy||r,onClick:()=>void e.refresh(),children:"Check again"})]});if(e.phase==="local_uncertain")return t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."});const n=e.discovery;return t.jsxs("div",{className:"space-y-1",children:[(n==null?void 0:n.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),(n==null?void 0:n.hasMore)&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),n&&n.entries.length>0&&t.jsx(t.Fragment,{children:t.jsx("ul",{children:n.entries.map(s=>t.jsxs("li",{children:[t.jsxs("span",{children:[s.eventId,":"," ",s.state==="receipt"?"Historical save recorded":s.state==="review"?"Original save needs review":s.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),s.state==="review"&&(s.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:e.busy||r,onClick:()=>void e.recover(s.eventId),children:"Recover original receipt"})]}))]},s.eventId))})}),(n==null?void 0:n.admission)==="blocked"&&n.entries.length===0&&t.jsx("p",{children:"No matching recent saves."}),((o=e.historical)==null?void 0:o.state)==="receipt"&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("div",{children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:r||e.editBlocked||e.busy,onClick:d,children:"Load current file"})]})]})}function Se({recovery:e,editing:r,loadCurrent:d}){return!e.supported||r?null:t.jsxs(oe,{children:[t.jsx(le,{asChild:!0,children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground","aria-label":"More file actions",children:t.jsx(ue,{className:"size-4"})})}),t.jsxs(de,{align:"end",children:[t.jsx(Z,{disabled:e.busy,onSelect:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(Z,{disabled:e.editBlocked||e.busy,onSelect:()=>d(),children:"Load current file"})]})]})}function De({recovery:e,editing:r,loadCurrent:d,toolbar:n}){const o=Pe(e),s=e.phase==="unavailable"||e.phase==="refused";return t.jsxs(t.Fragment,{children:[e.supported&&e.phase==="pending"&&t.jsx("p",{role:"status",className:"sr-only",children:"Checking previous saves…"}),t.jsx("div",{...o?{role:"region","aria-label":"Previous file saves"}:{},className:O("shrink-0",o?"bg-muted text-foreground mx-2 mt-2 rounded-md py-1 pr-1 pl-3 text-sm":"flex justify-end px-2 pt-1",o&&(s?"@container":"flow-root")),children:t.jsxs("div",{className:O(o&&s&&"grid grid-cols-[1fr_auto] items-center gap-x-2 @md:grid-cols-[1fr_auto_auto]"),children:[t.jsx("div",{className:O("flex items-center gap-1",o&&!s&&"float-right ml-2",o&&s&&"col-start-2 row-start-1 @md:col-start-3"),children:n}),o&&(s?t.jsx(X,{recovery:e,editing:r,loadCurrent:d}):t.jsx("div",{className:"py-1.5",children:t.jsx(X,{recovery:e,editing:r,loadCurrent:d})}))]})})]})}function Le({editing:e,off:r,observation:d,onClick:n}){return t.jsx(fe,{children:t.jsxs(he,{...r?{}:{open:!1},children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:n,"aria-label":e?"Finish editing":"Edit file",disabled:r,"data-document-save-observation":d,children:e?t.jsx(me,{className:"size-4"}):t.jsx(ve,{className:"size-4"})})})}),t.jsx(xe,{children:"Editing is off"})]})})}const Ee=a.lazy(()=>ee(()=>import("./CodeMirrorEditor-DD5tArRn.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ze=a.lazy(()=>ee(()=>import("./BlintzCanvas-7E5uwVms.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),Be=500;function Me(e,r){return r==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function Oe(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function te({content:e,documentId:r,cwd:d,loaded:n,theme:o,isEditing:s,onEditingChange:C,setDocumentEditing:y,observedBinding:b,fileSaveObservation:p="unavailable",recoveryBinding:x}){const _=e.readOnly!==!0,f=Me(e.sourcePath,e.language),w=ge(),[R,m]=a.useState(n),[T,F]=a.useState(),g=a.useRef(b);a.useLayoutEffect(()=>{g.current=b},[b]);const l=ke({documentId:r,sourcePath:e.sourcePath,cwd:d,loadedContent:n,documentSaveBinding:T,documentRecoveryBinding:x}),i=_e(l.recovery,p,x),c=we({cwd:d,sourcePath:f?e.sourcePath:null,content:R,saved:l.status==="saved"}),u=a.useRef(!1),j=a.useRef(s);a.useLayoutEffect(()=>(u.current=!0,j.current=s,()=>{u.current=!1}),[s]);const h=a.useRef(null),S=a.useRef(R),L=a.useRef(0),A=a.useRef(0),I=a.useRef(l.save),K=a.useRef(l.prepareFinalSave),U=a.useRef(l.waitForCloseDrain),E=a.useRef(null),V=a.useRef(C),Y=Ne({documentId:r,sourcePath:e.sourcePath,binding:T,save:l.save,draftRef:S,revisionRef:L,finishAttemptRef:A,timerRef:h,finalSaveRef:E,invalidateConfirmedFile:()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)}).catch(()=>{})}});a.useEffect(()=>{S.current=R,I.current=l.save,K.current=l.prepareFinalSave,U.current=l.waitForCloseDrain,V.current=C});const $=a.useCallback(v=>{var k;L.current+=1,S.current=v,m(v),(k=E.current)==null||k.cancel(),E.current=K.current(v),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,I.current(S.current)},Be)},[]),se=()=>{var P;if(i.editBlocked||p==="pending"||p==="ready"&&!((P=g.current)!=null&&P.current()))return;const v=g.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const N=g.current;return!!N&&be(k,N.incarnation)&&N.current()}}:void 0),L.current+=1,S.current=n,m(n),C(!0),y(r,!0)},ne=async()=>{h.current&&(clearTimeout(h.current),h.current=null);const v=S.current,k=L.current,P=++A.current,N=await I.current(v);if(N.status!=="changed"&&N.status!=="no_op"||L.current!==k||A.current!==P||N.confirmed.content!==v)return;const q=N.confirmed;q.content===S.current&&w.setQueryData(B(d,e.sourcePath),Q=>Q&&{...Q,content:q.content,hash:q.hash}),C(!1),y(r,!1)},re=()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)})};a.useEffect(()=>{var v;s||(h.current&&clearTimeout(h.current),h.current=null,(v=E.current)==null||v.cancel(),E.current=null)},[s]),a.useEffect(()=>{const v=Y.current;return()=>{var N;h.current&&(clearTimeout(h.current),h.current=null);const k=(N=E.current)==null?void 0:N.flush(),P=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>U.current(P))),E.current=null,y(r,!1),V.current(!1)}},[r,y,Y]);const G=async()=>{if(s||!u.current||i.editBlocked)return;const v=L.current,k=await i.inspectCurrent();k.status!=="observed"||!u.current||j.current||L.current!==v||!l.recovery.current()||w.setQueryData(B(d,e.sourcePath),P=>P&&{...P,...k.value})},ae=()=>{const v=l.adoptDisk();v!=null&&m(v)},ie=()=>{l.overwrite(S.current)},J=l.status==="saved"?l.confirmedContent!==R?"Unsaved changes":l.documentReceipt?"Save recorded":"Saved to file":Oe(l.status),W=s?R:n;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsx(De,{recovery:i,editing:s,loadCurrent:()=>void G(),toolbar:t.jsxs(t.Fragment,{children:[_&&J&&t.jsx("span",{className:O("mr-1 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:J}),!s&&p==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!s&&t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:re,"aria-label":"Refresh from disk",children:t.jsx(Te,{className:"size-4"})}),_&&t.jsx(Le,{editing:s,off:!s&&(p==="pending"||i.editBlocked),observation:p,onClick:s?()=>void ne():se}),t.jsx(Se,{recovery:i,editing:s,loadCurrent:()=>void G()})]})}),l.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>void l.retryUnconfirmed(),children:"Retry original save"})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ae,children:"Reload"}),t.jsx(D,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:ie,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:f?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ze,{value:W,editable:s,onChange:s?$:void 0,wikiLinks:c})}):t.jsx(Ee,{value:W,editable:s,filename:e.sourcePath,languageHint:e.language,theme:o,onChange:s?$:void 0})})})]})}function Ae(e){const{fileSaveBinding:r,fileSaveObservation:d}=Re(e.documentId);return t.jsx(te,{...e,observedBinding:r,recoveryBinding:r,fileSaveObservation:d})}function Ie(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function at({content:e,documentId:r}){const d=ye(),n=z(g=>g.selectedCwd),o=z(g=>g.setDocumentEditing),s=z(g=>{var l;return((l=g.openDocuments.find(i=>i.id===r))==null?void 0:l.editing)??!1}),C=je(),y=z(g=>g.canvasSessionId),b=z(g=>g.roomCanvasLiveRoomId),{data:p,error:x,isLoading:_}=Ce({queryKey:B(n,e.sourcePath),enabled:n!==null,queryFn:()=>d.readFileContent(n,e.sourcePath),staleTime:3e4,retry:!1}),[f,w]=a.useState(null),R=g=>{w(g&&p?{pinnedHash:p.hash}:null)};if(n===null)return t.jsx(H,{children:"Open a chat to view files."});if(_)return t.jsx(H,{children:"Loading file…"});if(x||!p)return t.jsx(H,{children:Ie(x)});const m=f!==null&&s,T=(m?f==null?void 0:f.pinnedHash:null)??p.hash,F=y&&!b?Ae:te;return t.jsx(F,{content:e,documentId:r,cwd:n,loaded:p.content,theme:C,isEditing:m,onEditingChange:R,setDocumentEditing:o},`${e.sourcePath}:${T}`)}function H({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{at as CanvasFileContent};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-BqErc378.js","assets/index-BYTLOFNS.js","assets/index-BbPg1hpf.css"])))=>i.map(i=>d[i]);
2
- import{a5 as m,aZ as n,r as s,j as t,a_ as p}from"./index-BYTLOFNS.js";import{r as u}from"./use-session-canvas-Cc04zSW3.js";import"./rotate-cw-CpuoCwEK.js";import"./query-keys-DeYqUDia.js";import"./index.esm-B0kiCgAP.js";import"./WidgetErrorCard-B477vOv2.js";import"./index-D0k8LoLP.js";import"./progress-CNm_pBbE.js";import"./markdown-content-C1i_dR6j.js";import"./table-BrvyPoEL.js";import"./zap-BmeuEI5X.js";import"./package-DHEY3aDq.js";import"./heart-DKWg_e72.js";import"./git-branch-DpByNz2U.js";import"./file-text-CS9s0qOe.js";import"./file-C_57RCIQ.js";import"./McpAppFrame-DAPJUxUi.js";import"./more-details-DNp6DH8i.js";const d=s.lazy(()=>p(()=>import("./Model3dViewer-BqErc378.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.Model3dViewer})));function f(e){var o;const r=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return r==="glb"||r==="gltf"?"gltf":r==="stl"?"stl":r==="obj"?"obj":r==="3mf"?"3mf":r==="ply"?"ply":r==="fbx"?"fbx":r==="dae"?"dae":null}function A({content:e}){const r=m(),o=n(i=>i.selectedCwd),l=s.useMemo(()=>u(e.src,i=>r.mediaUrl(o??"",i)),[e.src,r,o]),a=s.useMemo(()=>f(e.src),[e.src]);return l.url===null||a===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(s.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(d,{url:l.url,format:a,label:e.title??"Canvas 3D model"})})})}export{A as CanvasModel3dContent,f as formatOf};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-HJpWK-JI.js","assets/index-BR1m9FON.js","assets/index-BdVQOlVQ.css"])))=>i.map(i=>d[i]);
2
+ import{a5 as m,aZ as n,r as s,j as t,a_ as p}from"./index-BR1m9FON.js";import{r as u}from"./use-session-canvas-tvLLPQcm.js";import"./rotate-cw-BbHkWN-J.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CJIDYBqd.js";import"./WidgetErrorCard-C5ieVv_9.js";import"./index-CpWxcN5D.js";import"./progress-BA2JPtb6.js";import"./markdown-content-DhAtZOfj.js";import"./table-D0EJT0uP.js";import"./zap-DSllMMHe.js";import"./package-BhKXbvU_.js";import"./heart-Cn3a-UQI.js";import"./git-branch-CsLE6G0Y.js";import"./file-text-Cycq_S0e.js";import"./file-CQGljfDT.js";import"./McpAppFrame-z5JUaCSA.js";import"./more-details-DV7LmY0E.js";const d=s.lazy(()=>p(()=>import("./Model3dViewer-HJpWK-JI.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.Model3dViewer})));function f(e){var o;const r=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return r==="glb"||r==="gltf"?"gltf":r==="stl"?"stl":r==="obj"?"obj":r==="3mf"?"3mf":r==="ply"?"ply":r==="fbx"?"fbx":r==="dae"?"dae":null}function A({content:e}){const r=m(),o=n(i=>i.selectedCwd),l=s.useMemo(()=>u(e.src,i=>r.mediaUrl(o??"",i)),[e.src,r,o]),a=s.useMemo(()=>f(e.src),[e.src]);return l.url===null||a===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(s.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(d,{url:l.url,format:a,label:e.title??"Canvas 3D model"})})})}export{A as CanvasModel3dContent,f as formatOf};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DcUcciFs.js","assets/index-BYTLOFNS.js","assets/index-BbPg1hpf.css","assets/room-files-source-CKjJxFRA.js","assets/markdown-content-C1i_dR6j.js","assets/file-exclamation-point-C7C2dM_w.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-CIokV9hG.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-CpuoCwEK.js","assets/link-2-D1CRDxXB.js","assets/file-C_57RCIQ.js","assets/git-branch-DpByNz2U.js","assets/more-details-DNp6DH8i.js"])))=>i.map(i=>d[i]);
2
- import{O as F,r as c,j as l,B as ue,he as Rn,ny as An,g as Sn,kF as Mn,G as K,a5 as fe,a7 as Be,a8 as Ue,aQ as H,co as He,cp as jn,cZ as _n,nz as On,m8 as En,nA as Tn,h as $n,ay as Dn,cv as We,gM as se,q as ee,dR as Ke,s as pe,my as Pn,nB as Ln,n3 as Fn,nC as Bn,nD as Un,ff as Hn,gm as Wn,a0 as Kn,ei as zn,nw as qn,nE as Vn,nF as Gn,a4 as Jn,bx as Yn,nG as Qn,nH as Xn,Y as Zn,$ as et,gR as nt,lu as Re,nI as ze,b$ as tt,bf as st,lt as X,lx as qe,nJ as ot,cn as ge,ak as at,c3 as he,iX as Ve,cb as rt,_ as Ge,nK as it,cz as Je,nL as ct,fI as lt,kW as Ye,nM as Qe,nN as dt,a_ as ut,gO as Xe,lw as mt,nO as Ze,nP as ft,nQ as pt,nR as gt,nS as Ae,fh as ht,nT as xt,nU as yt,nV as bt,nW as vt,nX as kt,nY as wt,l as It,hr as Nt,ll as Ct,al as Rt,nZ as At,n_ as St,n$ as Mt,b9 as jt,o0 as _t,o1 as Ot,o2 as Et,o3 as Tt,Z as Se,fs as $t}from"./index-BYTLOFNS.js";import{g as Me,m as je,h as xe,f as en,M as Dt,a as Pt,E as Lt,i as Ft,j as Bt,c as P,k as Ut,T as Ht,b as Wt,l as Kt,r as zt,u as qt,C as Vt}from"./registry-3K4FIIyI.js";import"./WidgetErrorCard-B477vOv2.js";import{R as Gt,A as nn}from"./repeat-CK_sumJP.js";import{u as Jt}from"./use-room-sessions-BeiAMSkk.js";import{M as Yt}from"./markdown-content-C1i_dR6j.js";import{W as Qt,a as Xt}from"./find-latest-widget-fence-D_FwbHep.js";import{f as Zt}from"./format-duration-BCr6uzby.js";import{H as es,a as ns,b as ts}from"./RuntimeSetupDialog-BcDt-BYK.js";import{M as _e}from"./mention-pill-DoQBb5VU.js";import{R as ss}from"./rotate-ccw-clock-DzVWecfL.js";import{U as os}from"./unplug-B8oONuTT.js";import{M as Oe}from"./message-square-off-CwB3fRn1.js";import{i as as}from"./registry-DNYPNSm5.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DiM3QX-4.js","assets/index-BR1m9FON.js","assets/index-BdVQOlVQ.css","assets/room-files-source-BkiK4-ZI.js","assets/markdown-content-DhAtZOfj.js","assets/file-exclamation-point-B0a55VME.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-Cgjq7a-8.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-BbHkWN-J.js","assets/link-2-Dzy5BUL3.js","assets/file-CQGljfDT.js","assets/git-branch-CsLE6G0Y.js","assets/more-details-DV7LmY0E.js"])))=>i.map(i=>d[i]);
2
+ import{O as F,r as c,j as l,B as ue,he as Rn,nA as An,g as Sn,kH as Mn,G as K,a5 as fe,a7 as Be,a8 as Ue,aQ as H,co as He,cp as jn,cZ as _n,nB as On,ma as En,nC as Tn,h as $n,ay as Dn,cv as We,gI as se,q as ee,dR as Ke,s as pe,mA as Pn,nD as Ln,n5 as Fn,nE as Bn,nF as Un,ff as Hn,gm as Wn,a0 as Kn,ei as zn,ny as qn,nG as Vn,nH as Gn,a4 as Yn,bx as Jn,nI as Qn,nJ as Xn,Y as Zn,$ as et,gN as nt,lw as Re,nK as ze,b$ as tt,bf as st,lv as X,lz as qe,nL as ot,cn as ge,ak as at,c3 as he,iX as Ve,cb as rt,_ as Ge,nM as it,cz as Ye,nN as ct,fI as lt,kY as Je,nO as Qe,nP as dt,a_ as ut,gK as Xe,ly as mt,nQ as Ze,nR as ft,nS as pt,nT as gt,nU as Ae,fh as ht,nV as xt,nW as yt,nX as bt,nY as vt,nZ as kt,n_ as wt,l as It,hr as Nt,ln as Ct,al as Rt,n$ as At,o0 as St,o1 as Mt,b9 as jt,o2 as _t,o3 as Ot,o4 as Et,o5 as Tt,Z as Se,fs as $t}from"./index-BR1m9FON.js";import{g as Me,m as je,h as xe,f as en,M as Dt,a as Pt,E as Lt,i as Ft,j as Bt,c as P,k as Ut,T as Ht,b as Wt,l as Kt,r as zt,u as qt,C as Vt}from"./registry-Tbt9pcZl.js";import"./WidgetErrorCard-C5ieVv_9.js";import{R as Gt,A as nn}from"./repeat-B8g-x-Sc.js";import{u as Yt}from"./use-room-sessions-DecGrP3E.js";import{M as Jt}from"./markdown-content-DhAtZOfj.js";import{W as Qt,a as Xt}from"./find-latest-widget-fence-B6sJdG3Q.js";import{f as Zt}from"./format-duration-BCr6uzby.js";import{H as es,a as ns,b as ts}from"./RuntimeSetupDialog-DTO5v0dP.js";import{M as _e}from"./mention-pill-DmA8FxL4.js";import{R as ss}from"./rotate-ccw-clock-DRtL-2nr.js";import{U as os}from"./unplug-B-ipHefz.js";import{M as Oe}from"./message-square-off-BowIzJUV.js";import{i as as}from"./registry-jD9zw538.js";/**
3
3
  * @license lucide-react v1.48.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -34,7 +34,7 @@ import{O as F,r as c,j as l,B as ue,he as Rn,ny as An,g as Sn,kF as Mn,G as K,a5
34
34
  *
35
35
  * This source code is licensed under the ISC license.
36
36
  * See the LICENSE file in the root directory of this source tree.
37
- */const ln={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};ln.node;const us=F(ln),ms='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function fs(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=c.useRef(null),r=c.useRef(!1);c.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let p=0,x=0;const b=()=>{var u;const m=(u=a.current)==null?void 0:u.querySelector(ms);if(m)return m.focus();++p<10&&(x=requestAnimationFrame(b))};return b(),()=>cancelAnimationFrame(x)},[t]);const i=c.useCallback(p=>{var x;!p&&((x=a.current)!=null&&x.contains(document.activeElement))||s(p)},[s]),d=c.useCallback(p=>{!o||p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),r.current=!0,s(!0))},[o,s]),f=c.useMemo(()=>({onEscapeKeyDown:()=>{var p;return(p=n.current)==null?void 0:p.focus()},onBlur:p=>{var b,m,u;const x=p.relatedTarget;x&&((b=a.current)!=null&&b.contains(x)||(m=n.current)!=null&&m.contains(x))||(u=a.current)!=null&&u.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:i,onTriggerKeyDown:d,contentHandlers:f}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const i=s||n&&e.shiftKey?-1:1;a[(r+i+a.length)%a.length].focus()}function ps({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function gs({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(Rn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const hs=300;function J({className:e,children:t}){return l.jsx("span",{className:K("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:i}){const{kind:d,displayName:f,handle:p,color:x,emoji:b,imageUrl:m,origin:u,agent:g}=e,w=x??"hsl(var(--muted-foreground))",h=typeof u=="object"&&u!==null,y=d==="agent"&&(g==null?void 0:g.working)!=null?g.working:null,[k,M]=c.useState(!1),j=c.useRef(!0);c.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const R=c.useCallback(A=>{j.current&&(M(A),a==null||a(A))},[a]),N=c.useRef(!1),S=c.useRef(null),_=An({onLongPress:()=>{N.current&&R(!0)}}),{contentRef:O,handleOpenChange:v,onTriggerKeyDown:E,contentHandlers:I}=fs({open:k,setOpen:R,triggerRef:S,enabled:r&&o!==void 0});return l.jsxs(es,{open:k,onOpenChange:v,openDelay:hs,children:[l.jsx(ns,{asChild:!0,ref:S,"data-gesture-priority":"",..._,onPointerDown:A=>{N.current=A.pointerType==="touch"||A.pointerType==="pen",_.onPointerDown(A)},...r?{onClick:()=>R(!0),onKeyDown:E}:{},children:t}),l.jsxs(ts,{ref:O,...I,...o?{role:"dialog","aria-label":f}:{},"data-slot":"identity-hover-card",align:"start",className:K("flex w-64 flex-col gap-0 overflow-hidden p-0",i),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(Sn,{"aria-hidden":!0,color:w,emoji:b,imageUrl:m,fallback:Mn(f),kind:d,origin:u,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:f}),p&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",p]})]})]}),n&&l.jsx(ps,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((g==null?void 0:g.runtime)||(g==null?void 0:g.model))&&l.jsx(J,{children:[g.runtime,g.model].filter(Boolean).join(" · ")}),y&&l.jsxs(J,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Zt(y.forMs)]}),d==="human"&&l.jsx(J,{children:h?u.platform:"On this machine"}),d==="agent"&&(g==null?void 0:g.managedBy)&&l.jsxs(J,{children:["Managed by"," ",g.managedBy.handle?`@${g.managedBy.handle}`:g.managedBy.displayName]})]}),o?l.jsx(gs,{actions:o,onAct:()=>{var A;(A=S.current)==null||A.focus(),R(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var A;(A=S.current)==null||A.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function xs(){const e=fe(),t=Be();return Ue({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var p;const r=t.getQueryData(H.entries(s)),i=(p=r==null?void 0:r.find(x=>x.id===n))==null?void 0:p.reactions,{reactions:d,on:f}=Me(i,o,a);return t.setQueryData(H.entries(s),x=>je(x,n,d)),{on:f}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,f;const r=t.getQueryData(H.entries(s)),i=((f=(d=r==null?void 0:r.find(p=>p.id===n))==null?void 0:d.reactions)==null?void 0:f.some(p=>p.emoji===o&&p.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:i})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},i)=>{i!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const f=(x=d==null?void 0:d.find(b=>b.id===o))==null?void 0:x.reactions,{reactions:p}=Me(f,a,r,!i.on);return je(d,o,p)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function z(e){return e.threadRootEntryId??e.parentEntryId}function ys(e){return z(e)??e.id}function bs(e,t){return Math.max(t??0,e)}function pa(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:bs(e.length,s),lastAt:n.createdAt,unread:o}}function vs(e){var j,R;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=He(),r=jn(),i=a&&o&&t!==void 0,d=_n(i?t:null),f=On(d.member),p=En(),x=Tn(),b=$n(),m=Dn(),{data:u}=We({enabled:i&&r}),g=m.status==="ready"?m.roomId:null,w=u==null?void 0:u.find(N=>N.id===g),h=w?se(w):null,y=(R=(j=d.member)==null?void 0:j.agent)==null?void 0:R.effectiveRuntimeId,k=c.useCallback(()=>{t!==void 0&&(ee.getState().recordOpened("agent",t),p({agentPath:t},y?{runtime:y}:{}))},[t,p,y]),M=c.useCallback(async()=>{if(t===void 0||!b)return;const N=await x(t);if(N===null){Ke(`${s} has no session in ${h??"this room"} yet`);return}b(pe({session:N}))},[t,b,x,s,h]);return c.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:f},actions:{onMessage:k,...n?{onViewProfile:n}:{},...r&&h?{session:{label:`Session in ${h}`,onOpen:()=>void M()}}:{}}},[a,t,d.role,f,k,n,r,h,M])}function ks({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=c.useState(!1),i=vs({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=c.useCallback(f=>{f&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&i!==null,...i?{about:i.about,actions:i.actions}:{},children:o})}function ws(e){return l.jsx(Xt,{code:e.code,isIncomplete:e.isIncomplete})}const Is=[{language:Qt,component:ws}],Ns={turn_failed:{Icon:Jn,warm:!0},agent_busy:{Icon:Gn},agent_gone:{Icon:us,warm:!0},agent_left:{Icon:Ee,warm:!0},room_archived:{Icon:Vn},agent_reseated:{Icon:qn},handle_changed:{Icon:nn},files_set_up:{Icon:zn},handoff_shared:{Icon:Kn},handoff_declined:{Icon:Oe},runtime_gone:{Icon:cs,warm:!0},agent_paused:{Icon:Wn},agent_declined:{Icon:Oe},agent_unavailable:{Icon:Hn},awaiting_approval:{Icon:Un,warm:!0},halted:{Icon:Bn},budget_reached:{Icon:Fn},cascade_stopped:{Icon:Ln},addressing_changed:{Icon:is},bridge_blocked:{Icon:os,warm:!0},bridge_undelivered:{Icon:Pn,warm:!0},bridge_rate_limited:{Icon:ds},bridge_second_agent_refused:{Icon:Ee},bridge_disconnected:{Icon:rs},bridge_agent_swapped:{Icon:Gt},bridge_history_note:{Icon:ss}},Cs={Icon:Yn};function dn(e){return(e&&Ns[e])??Cs}function ga(e){return dn(e).warm===!0}const le=80;function Rs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function As(e,t,s){const n=Ss(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-3",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function Ss(e,t){if(t!==void 0){const n=Qn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Xn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function Ms({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,warm:r}=dn(e.body.notice);return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":Rs(e.body.text)},...xe(t),className:K("focus-ring-inset flex items-start gap-[var(--msg-gap)] px-[var(--msg-padding-x)] py-1.5 text-xs",r?"text-foreground":"text-muted-foreground"),children:[l.jsx("span",{"data-slot":"notice-mark",className:"flex w-[var(--msg-gutter-width)] shrink-0 justify-center",children:l.jsx(a,{"aria-hidden":!0,className:K("mt-0.5 size-(--size-icon-xs) shrink-0",r?"text-status-warning-fg":"text-muted-foreground")})}),l.jsx("span",{className:"min-w-0",children:n?As(e.body.text,n,o):e.body.text})]})}const js=as.moment;function _s({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=en(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-ring-inset px-[var(--msg-padding-x)] py-1",children:l.jsxs("div",{className:"bg-foreground/4 flex items-center gap-2.5 rounded-lg px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Dt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(js,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-(--size-icon-xs) shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Pt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function Os(e,t){const s=X.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
38
- `)?"":" ";s.set(e,`${n}${o}@${t} `)}function Es({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o,onMakeTodo:a}){const r=ys(t),i=t.body.text,d=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,f=s==null?void 0:s.displayName,{copy:p}=Zn({toastOnSettle:!0});return c.useMemo(()=>{const x={reply:{id:"reply",label:"Reply in thread",icon:ls,run:()=>{nt.getState().openThread(e,r,!0),Re.getState().requestFocus(ze(e,r))}},copy:{id:"copy",label:"Copy text",icon:et,run:()=>void p(i)}};return o!==void 0&&(x.profile={id:"profile",label:"View profile",icon:tt,run:o}),a!==void 0&&(x.todo={id:"todo",label:"Make a to-do",icon:st,run:a}),d!==void 0&&(x.mention={id:"mention",label:f===void 0?"Mention author":`Mention ${f}`,icon:nn,run:()=>{Os(e,d),Re.getState().requestFocus(e)}}),Lt.map(b=>x[b]).filter(b=>b!==void 0)},[e,r,i,d,f,o,a,p])}function Ts(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function ha(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function xa(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function $s(e,t,s){const n=t.get(e),o=qe({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function ya(e){const t=new Set;for(const a of e)z(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=z(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const i=n.get(r);i?i.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Ds(e){return`thread-${e}`}function Ps(e){return`thread-row-${e}`}function ba(e){return`thread-panel-entry-${e}`}function Ls(e){return`room-entry-${e}`}function Fs(e,t){const s=e.find(i=>i.id===t);if(s===void 0)return null;const n=z(s)??null,o={rowId:t,domId:Ls(t)};if(n===null)return o;const a=e.find(i=>i.id===n);return a!==void 0&&(z(a)??null)===null?{rowId:Ds(n),domId:Ps(n)}:o}function va(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fs(e,s.id)}const Te=48;function ka(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Te?`${a.slice(0,Te).trimEnd()}…`:a}}function Bs(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=ot({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:at(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Us(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Hs={info:new Map,faces:new Map},be=c.createContext(Hs);function wa({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function Ia(){const e=he(),t=c.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=c.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ve(s),o=c.useMemo(()=>Bs(t,n.data??{}),[t,n.data]),a=c.useMemo(()=>Us(o),[o]);return c.useMemo(()=>({info:o,faces:a}),[o,a])}function ne(e){const t=c.useContext(be);return e===void 0?void 0:t.info.get(e)}function Ws(){return c.useContext(be).faces}const $e={people:"People",agents:"Agents"},Ks=["people","agents"];function zs(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function qs(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Vs(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Vs(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function Y(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Gs(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,i=a.startsWith(" ")?"":" ";return{value:o+r+i+a,cursorPos:o.length+r.length+1}}const Js=/(^|\s)@([A-Za-z0-9_.-]*)$/,un="mention-palette-listbox";function me(e){return`mention-item-${e}`}function Ys({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Ks}){var E;const[o,a]=c.useState(!1),[r,i]=c.useState(""),[d,f]=c.useState(-1),p=rt(s),x=c.useRef(!1),b=c.useMemo(()=>zs(e,t),[e,t]),m=c.useMemo(()=>o?qs(b,r,n):[],[b,r,o,n]),[u,g]=c.useState(null),w=u!==null&&u.query===r&&u.open===o?u.index:Y(m,0,1),h=m[w],y=m.length===0||h!==void 0&&!h.disabled?w:Y(m,0,1),k=c.useCallback((I,A)=>{const $=I.slice(0,A).match(Js);if(!$){a(!1);return}a(!0),i($[2]),f(($.index??0)+$[1].length)},[]),M=c.useCallback(I=>{p.write(I),x.current=!1},[p]),j=c.useCallback(I=>{x.current||k(p.read(),I)},[k,p]),R=c.useCallback(()=>{g({query:r,open:o,index:Y(m,y+1,1)})},[m,y,r,o]),N=c.useCallback(()=>{g({query:r,open:o,index:Y(m,y-1,-1)})},[m,y,r,o]),S=c.useCallback(I=>I.disabled||I.handle===void 0?null:(x.current=!0,a(!1),Gs(p.read(),d,r,I.handle)),[d,r,p]),_=c.useCallback(()=>{const I=m[y];return I?S(I):(a(!1),null)},[m,y,S]),O=c.useCallback(()=>{x.current=!0,a(!1)},[]),v=m.some(I=>!I.disabled);return{isOpen:o,hasSelectableRows:v,rows:m,selectedIndex:y,activeDescendantId:o&&((E=m[y])==null?void 0:E.disabled)===!1?me(y):void 0,listboxId:o?un:void 0,noteTextChange:M,handleCursorChange:j,moveDown:R,moveUp:N,selectHighlighted:_,selectRow:S,dismiss:O}}function Qs({rows:e,selectedIndex:t,onSelect:s}){const n=c.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const i=o[o.length-1];i&&i.section===a.section?i.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return c.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Ge.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:un,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:i,index:d})=>{const f=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":f,"aria-disabled":i.disabled,"data-selected":f,"data-disabled":i.disabled,onClick:()=>{i.disabled||s(i)},className:i.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:i.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:i.label}),i.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",i.handle]}),i.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:i.disabledReason})]},i.authorId)})]},o))})})}const Xs=/(?:^|[^A-Za-z0-9_.@-])cc(?![A-Za-z0-9_])/i;function Zs(e,t){const s=e.lastIndexOf(`
39
- `,t-1)+1;return Xs.test(e.slice(s,t))}function eo(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=s.map(a=>Zs(e,a.offset)),o=new Set(s.filter((a,r)=>!n[r]).map(a=>a.authorId));return s.map((a,r)=>n[r]&&!o.has(a.authorId)?{...a,cc:!0}:a)}function no(e,t){const s=e.length>0?`Woke ${e.join(", ")}.`:"Woke nobody.";return t.length>0?`${s} Cc: ${t.join(", ")}.`:s}function mn(e){const t=new Set(e.filter(n=>!n.cc).map(n=>n.authorId)),s=[];for(const n of e)n.cc&&!t.has(n.authorId)&&!s.includes(n.authorId)&&s.push(n.authorId);return s}const to=/@([A-Za-z0-9][A-Za-z0-9_.-]*)/g,so=/[.\-_]+$/;function oo(e,t){const s=new Map;for(const{author:o}of t)o.handle&&s.set(o.handle.toLowerCase(),o.handle);const n=[];for(const o of e.matchAll(to)){if(o.index===void 0)continue;const a=o[1].toLowerCase(),r=a.replace(so,""),i=s.get(a)??s.get(r);if(!i)continue;const d=(s.has(a)?a.length:r.length)+1;n.push({offset:o.index,length:d,authorId:i,handle:i})}return n}function ao(e,t){const s=eo(e,oo(e,t)),n=[],o=[];for(const r of s){const i=r.cc?o:n;i.includes(r.handle)||i.push(r.handle)}if(o.length===0)return null;const a=r=>r.map(i=>`@${i}`).join(", ");return`${n.length>0?`Wakes ${a(n)}`:"Wakes nobody"} · cc ${a(o)}`}function ro(e,t){const s=e.mentions.filter(r=>r!==e.authorId);if(s.length===0)return null;const n=new Set(mn(e.mentionSpans??[])),o=r=>{var i,d;return`@${((i=t.get(r))==null?void 0:i.handle)??((d=t.get(r))==null?void 0:d.displayName)??r}`},a=s.filter(r=>{var i;return!n.has(r)&&((i=t.get(r))==null?void 0:i.kind)==="agent"});return no(a.map(o),s.filter(r=>n.has(r)).map(o))}function io({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:i}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(i)}}const Z=120,co="code block";function lo(e){if(e.length<=Z&&!e.includes("```"))return null;const t=uo(e);return t.length===0?null:t}function uo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${co} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=Z)return t;const s=mo(t,Z),n=s.lastIndexOf(" ");return`${(n>Z/2?s.slice(0,n):s).trimEnd()}…`}function mo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function fo({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=xs(),i=o===!0||!a,d=c.useMemo(()=>t.reactions??[],[t.reactions]),f=c.useMemo(()=>d.filter(b=>Ft(b,s)).map(b=>b.emoji),[d,s]),p=c.useCallback(b=>r.mutate({roomId:e,entryId:t.id,emoji:b,viewerAuthorId:s}),[r,e,t.id,s]),x=c.useMemo(()=>({quick:n,mine:f,onToggle:p,disabled:i}),[n,f,p,i]);return{reactions:d,toggle:p,quickRow:x}}function po({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function go(e,t){var x,b;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&it.includes(n),a=Jt(e,{enabled:o}),r=Je(),i=Be(),d=fe(),f=o?((b=(x=a.data)==null?void 0:x.bindings.find(m=>m.authorId===s))==null?void 0:b.sessionId)??null:null,p=c.useCallback(m=>{m.button!==0||m.metaKey||m.ctrlKey||m.shiftKey||m.altKey||(m.preventDefault(),!(f===null||s===void 0)&&ct({queryClient:i,transport:d},e,s).then(u=>{u.kind!=="none"&&r(pe({session:u.kind==="bound"?u.sessionId:f}))}))},[s,r,i,e,f,d]);return c.useMemo(()=>f===null?null:{href:lt({session:f}),onOpen:p},[p,f])}const te="mention",ve="author_id",ho={[te]:[ve]},xo=[te];function yo(e,t){if(!t||t.length===0)return e;const s=bo(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:i}=s[o],d=n.slice(0,a),f=n.slice(a,a+r),p=n.slice(a+r);n=`${d}<${te} ${ve}="${i}">${f}</${te}>${p}`}return n}function bo(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const vo=/(?:^|[^\p{L}\p{N}_])cc$/iu;function ko(e,t){const s=new Set;for(const n of t)n.cc&&vo.test(e.slice(0,n.offset).trimEnd())&&s.add(n.authorId);return s}const wo=new Map,fn=c.createContext(wo);function Io({authors:e,children:t}){return l.jsx(fn.Provider,{value:e,children:t})}function No(e){const t=c.useContext(fn);return e===void 0?void 0:t.get(e)}const De=new WeakMap;function Co(e){const t=De.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return De.set(e,s),s}function Ro(e){var n;const s=(n=he().data)==null?void 0:n.agents;return c.useMemo(()=>e===void 0||!s?void 0:Co(s).get(e),[s,e])}function pn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=He(),a=Ro(o?t:void 0),r=ne(t);return c.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const i={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(f,p={})=>l.jsx(ks,{identity:i,agentPath:a,onViewProfile:n,openOnClick:p.openOnClick??!1,children:f});return{wrap:d,wrapAvatar:f=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:f}),{openOnClick:!0}),wrapName:f=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:K(f.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Ao={kind:"human",displayName:""};function So(e){return typeof e=="string"?e.replace(/^@/,""):""}function Mo({authorId:e,children:t,cc:s,ccWord:n}){const o=No(e),a=ne(o==null?void 0:o.agentRef),{open:r}=Ye(),i=o?qe({record:o,override:a==null?void 0:a.visual}):null,d=o?Qe(o,a==null?void 0:a.memberId):void 0,f=c.useMemo(()=>d===void 0?void 0:()=>r(d),[d,r]),p=i==null?void 0:i.color,x=i==null?void 0:i.emoji,b=i==null?void 0:i.imageUrl,m=c.useMemo(()=>o?{kind:o.kind,displayName:o.displayName,handle:o.handle??void 0,color:p,emoji:x,imageUrl:b,origin:o.origin,agent:a&&{runtime:a.runtime,...a.model&&{model:a.model}}}:null,[o,p,x,b,a]),u=pn({agentRef:o==null?void 0:o.agentRef,identity:m??Ao,onViewProfile:f});if(!o||!m)return l.jsx(_e,{kind:"human",label:So(t),resolved:!1});const w=u?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:f?{role:"button",tabIndex:0,"aria-label":`View ${o.displayName}’s profile`,onClick:f,onKeyDown:y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),f())}}:{},h=l.jsx(_e,{kind:o.kind,label:o.displayName,handle:o.handle??void 0,color:o.color,origin:o.origin,resolved:!0,interactive:f!==void 0,...w,cc:s,ccWord:n});return u?u.wrap(h,{openOnClick:!0}):l.jsx(ye,{onViewProfile:f,identity:m,children:h})}function jo(e,t=new Set,s=new Set){return{mention:n=>{const o=n[ve],a=typeof o=="string"?o:void 0;return!a||!e.has(a)?l.jsx(l.Fragment,{children:n.children}):l.jsx(Mo,{authorId:a,cc:t.has(a),ccWord:!s.has(a),children:n.children})}}}function _o({entry:e,authors:t}){const s=c.useMemo(()=>yo(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=c.useMemo(()=>{var i;return new Set(((i=e.mentionSpans)==null?void 0:i.map(d=>d.authorId))??[])},[e.mentionSpans]),o=c.useMemo(()=>new Set(mn(e.mentionSpans??[])),[e.mentionSpans]),a=c.useMemo(()=>ko(e.body.text,e.mentionSpans??[]),[e.body.text,e.mentionSpans]),r=c.useMemo(()=>jo(n,o,a),[n,o,a]);return l.jsx(Io,{authors:t,children:l.jsx(Yt,{content:s,className:"msg-prose",allowedTags:ho,literalTagContent:xo,components:r,renderers:Is})})}function Oo(e){return function(s){return l.jsx(_o,{entry:s,authors:e})}}const gn="the top folder";function Pe(e){return e.slice(e.lastIndexOf("/")+1)}function Eo(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function To(e){return e===""?gn:`${e}/`}function de(e){return e.target!==void 0?e.target===""?gn:e.target:To(Eo(e.paths[0]??""))}function $o(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${Pe(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${Pe(s)} from the chat to ${de(e)}`}}const Do=c.lazy(()=>ut(()=>import("./index-DcUcciFs.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function Na({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:i,streamStalled:d,isMember:f=!0,grouping:p,orphanedReply:x,answers:b,feedPosition:m,rowId:u,roomKind:g,headsThread:w=!1}){const h=en(t.createdAt),y=c.useMemo(()=>{const L=lo(t.body.text),ie=Bt(t.attachments??[]);if(ie===null)return L;const Ce=L??t.body.text.trim();return Ce.length>0?`${Ce} ${ie}`:ie},[t.body.text,t.attachments]),k=c.useId(),M=`${k}-author`,j=`${k}-content`,R=`${k}-summary`,N=c.useRef(null),S=c.useRef(null),_=c.useRef(null),{reactions:O,toggle:v,quickRow:E}=fo({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:i,streamStalled:d,isMember:f}),I=ne(n==null?void 0:n.agentRef),{open:A}=Ye(),$=n===void 0?void 0:Qe(n,I==null?void 0:I.memberId),oe=c.useCallback(()=>{$!==void 0&&A($)},[A,$]),B=$===void 0?void 0:oe,U=dt(t.id,t.body.text),q=Es({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:B,onMakeTodo:U}),C=(n==null?void 0:n.handle)??void 0,V=c.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:C,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,C,s.color,s.emoji,s.imageUrl]),D=pn({agentRef:n==null?void 0:n.agentRef,identity:V,onViewProfile:B}),vn=po({barRef:S,pillsRef:_,hasReactions:O.length>0}),we=c.useCallback(()=>{var L;return(L=N.current)==null?void 0:L.focus()},[]),kn=c.useMemo(()=>Oo(o),[o]),Ie=c.useMemo(()=>g==="channel"&&t.authorId===a?ro(t,o):null,[g,t,a,o]),wn=c.useCallback(L=>l.jsx(c.Suspense,{fallback:null,children:l.jsx(Do,{roomId:e,attachment:L})}),[e]),In=Ws(),ae=t.body.subjectAuthorId??t.authorId,T=o.get(ae),G=ne(T==null?void 0:T.agentRef),Nn=go(e,t),re=Ts(t);if(re.kind==="notice")return l.jsx(Ms,{entry:t,feedPosition:m,rowId:u,sessionLink:Nn,subjectName:T==null?void 0:T.displayName});if(re.kind==="moment")return l.jsx(_s,{entry:t,moment:re.moment,subject:ae===t.authorId?s:$s(ae,o,In),subjectIdentity:{handle:(T==null?void 0:T.handle)??void 0,origin:T==null?void 0:T.origin,agent:G&&{runtime:G.runtime,...G.model&&{model:G.model}}},feedPosition:m,rowId:u});const Cn=p.position==="first"||p.position==="only",Ne=t.authorId===a;return l.jsxs(P.Root,{ref:N,id:u,position:p.position,className:w?"pb-0":void 0,actions:q,reactions:E,"data-testid":"room-entry",tabIndex:0,...io({showAuthorHeader:Cn,headerId:M,displayName:s.displayName,time:h,summary:y,contentId:j,summaryId:R,feedPosition:m}),onKeyDown:vn,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:D?void 0:B,isSelf:Ne,renderAvatar:D==null?void 0:D.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:M,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,isSelf:Ne,renderName:D==null?void 0:D.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs",children:"Replying to an earlier message"}),b!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs",children:`Answering “${b.excerpt}”`}),t.body.via&&l.jsx(Ut,{via:t.body.via}),l.jsx(P.Content,{id:j,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.todo&&n===void 0?l.jsx(Ht,{todoId:t.body.todo.todoId}):t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:$o(t.body.fileChange,(T==null?void 0:T.displayName)??"Somebody")}):kn(t,{rowId:t.id,isStreaming:!1})}),Ie!==null&&l.jsx("p",{"data-testid":"room-entry-reach",className:"text-muted-foreground text-xs",children:Ie}),y!==null&&l.jsx("span",{id:R,className:"hidden",children:y}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:f?wn:void 0}),l.jsx(P.Reactions,{ref:_,reactions:O,viewerAuthorId:a,names:r,frequents:i,onToggle:v,disabled:d===!0||!f,onExit:we}),l.jsx(P.Actions,{actions:q,reactions:E,barRef:S,onExit:we})]})]})}const Ca={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function Po(e){const t=fe(),[s,n]=c.useState([]),o=c.useRef(new Map),a=c.useCallback(m=>{const u=m.map(g=>({id:crypto.randomUUID(),file:g,status:"pending",progress:0}));n(g=>[...g,...u])},[]),r=c.useCallback(m=>{o.current.delete(m),n(u=>u.filter(g=>g.id!==m))},[]),i=c.useCallback(m=>{if(!m){o.current.clear(),n([]);return}const u=new Set(m);for(const g of u)o.current.delete(g);n(g=>g.filter(w=>!u.has(w.id)))},[]),d=c.useCallback(m=>{o.current.delete(m),n(u=>u.map(g=>g.id===m&&g.status==="error"?{...g,status:"pending",progress:0,error:void 0}:g))},[]),f=c.useRef(null),p=Ue({meta:{suppressErrorToast:!0},mutationFn:async m=>{n(h=>h.map(y=>m.some(k=>k.id===y.id)?{...y,status:"uploading"}:y));const u=h=>{n(y=>y.map(k=>k.status==="uploading"?{...k,progress:h.percentage}:k))},g=new AbortController;f.current=g;const w=m.map(h=>h.file);return t.uploadRoomAttachments(e,w,u,g.signal)},onSettled:()=>{f.current=null},onSuccess:(m,u)=>{u.forEach((g,w)=>{const h=m[w];h&&o.current.set(g.id,h.id)}),n(g=>g.map(w=>u.findIndex(y=>y.id===w.id)===-1?w:{...w,status:"uploaded",progress:100}))},onError:m=>{n(u=>u.map(g=>g.status==="uploading"?{...g,status:"error",error:m.message}:g))}}),x=c.useCallback(()=>{var m;(m=f.current)==null||m.abort()},[]),b=c.useCallback(async()=>{const m=s.filter(g=>g.status==="error");if(m.length>0)throw new Error(m.length===1?`${m[0].file.name} didn’t upload. Try again or remove it.`:`${m.length} files didn’t upload. Try again or remove them.`);const u=s.filter(g=>g.status==="pending");return u.length>0&&await p.mutateAsync(u),s.map(g=>o.current.get(g.id)).filter(g=>g!==void 0)},[s,p]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:i,cancelUpload:x,uploadAndGetIds:b,hasPendingFiles:s.length>0,hasFailedUpload:s.some(m=>m.status==="error"),isUploading:p.isPending}}function Ra(e){const{room:t,threadRootId:s}=e,n=Wt(),o=Kt(),a=Po((t==null?void 0:t.id)??""),r=t!==void 0&&Xe(t.members,t.viewerAuthorId),i=c.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});c.useEffect(()=>{i.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=c.useCallback(y=>i.current.attachments.addFiles(y),[]),f=c.useCallback(y=>i.current.attachments.removeFile(y),[]),p=c.useCallback(y=>i.current.attachments.retryFile(y),[]),x=c.useCallback(()=>i.current.attachments.cancelUpload(),[]),{pendingFiles:b,hasFailedUpload:m,isUploading:u}=a,g=c.useMemo(()=>({staged:b,add:d,remove:f,retry:p,cancel:x,hasFailed:m,isUploading:u,holdsSendWhileUploading:!1}),[b,m,u,d,f,p,x]),w=c.useCallback(async y=>{const{attachments:k,post:M,reply:j,room:R,threadRootId:N}=i.current;if(R===void 0)throw new Error("That room isn’t loaded yet.");if(R.archived)throw new Error("This room is archived.");ee.getState().recordOpened("room",R.id);const S=mt(),_=k.pendingFiles.map(I=>I.file.name),O=k.pendingFiles.map(I=>I.id),v=await k.uploadAndGetIds();k.clearFiles(O);const E=y.parentEntryId??N;if(zt({roomId:R.id,threadRootId:E??null},y.text),E!==void 0){j.mutate({roomId:R.id,rootEntryId:E,text:y.text,clientId:S,attachmentIds:v,attachmentNames:_});return}M.mutate({roomId:R.id,text:y.text,clientId:S,attachmentIds:v,attachmentNames:_})},[]);return{target:c.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ze},send:w,attachments:g}),[t,s,r,g,w]),attachments:a}}const hn=8;function xn(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function Lo(e){if(gt(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:xn(e.topic)}function Le(e){return{kind:"session",id:e.id,name:pt(e.title),summary:xn(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function Fo(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:Lo(e),lastActivityAt:e.lastActivityAt,room:e}}function Q(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function Bo(e){return e.kind==="session"?Ae("session",e.id):Ae("room",e.id)}function Fe(e,t){const s=[Q(t[Bo(e)]),...e.kind==="session"?[Q(e.session.lastTouchedByYouAt),Q(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):Q(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function Uo(e){return(t,s)=>Fe(s,e)-Fe(t,e)||s.id.localeCompare(t.id)}function Ho(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function Wo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function Ko({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=hn}){const{yours:a,spinOffs:r,automated:i}=ft(e),d=Uo(n),f=[...a.map(Le),...t.filter(p=>Wo(p,s)).map(Fo)].sort(d);return{items:Ho(f).slice(0,o),automated:[...r,...i].map(Le).sort(d).slice(0,o)}}const zo=3,qo=yt;function Vo({limit:e=hn,mutedRoomIds:t,enabled:s=!0}={}){var f,p;const n=ht(Math.max(e*zo,qo),{enabled:s}),o=We({enabled:s}),a=xt(),r=(f=n.data)==null?void 0:f.sessions,i=o.data;return{...c.useMemo(()=>Ko({sessions:r??[],rooms:i??[],mutedRoomIds:t,interactions:a,limit:e}),[r,i,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((p=n.data)==null?void 0:p.warnings)??[]}}const Go=6,yn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const Jo='[role="combobox"]';function W(e){return e instanceof Element&&e.matches(Jo)}function Yo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=Je(),o=bt(),[a,r]=c.useState(!1),[i,d]=c.useState({stamp:"",index:0}),[f,p]=c.useState(!1),[x,b]=c.useState(!1);e.length>0&&!x&&b(!0);const m=c.useRef(!1);c.useEffect(()=>{m.current=!0},[]);const{data:u}=he({enabled:s}),g=c.useMemo(()=>((u==null?void 0:u.agents)??[]).map(C=>C.projectPath),[u]),{data:w}=Ve(g,{enabled:s}),h=c.useMemo(()=>w??{},[w]),y=c.useMemo(()=>vt(g,h),[g,h]),k=c.useMemo(()=>new Map(g.map(C=>[ge(C),C])),[g]),M=c.useCallback(C=>kt({room:C,agentsByPath:h,pathByAgentRef:k}),[h,k]),j=c.useMemo(()=>wt(o.muted),[o.muted]),{items:R}=Vo({mutedRoomIds:j,enabled:s}),N=c.useMemo(()=>R.slice(0,Go),[R]),S=s&&a&&!f&&!x&&!t&&e.length===0&&N.length>0,_=`${S}:${N.length}`,O=i.stamp===_?i.index:0,v=c.useCallback(C=>{m.current&&W(C.target)&&(p(!1),b(!1),r(!0))},[]),E=c.useCallback(C=>{W(C.target)&&r(!0)},[]),I=c.useCallback(C=>{W(C.target)&&r(!1)},[]),A=c.useCallback(C=>{N.length!==0&&d(V=>{const D=V.stamp===_?V.index:0;return{stamp:_,index:(D+C+N.length)%N.length}})},[N.length,_]),$=c.useCallback(()=>A(1),[A]),oe=c.useCallback(()=>A(-1),[A]),B=c.useCallback(()=>{p(!0)},[]),U=c.useCallback(C=>{if(p(!0),C.kind==="session"){C.session.cwd&&ee.getState().recordOpened("agent",C.session.cwd),n(pe({dir:C.session.cwd??void 0,session:C.session.id}));return}ee.getState().recordOpened("room",C.room.id),n({...It.channels(),search:{id:C.room.id}})},[n]),q=c.useCallback(()=>{const C=N[O];!S||!C||U(C)},[S,N,O,U]);return{isOpen:S,hasRows:N.length>0,rows:N,agents:h,displayNames:y,visualOf:M,selectedIndex:O,activeDescendantId:S&&N[O]!==void 0?ke(O):void 0,listboxId:S?yn:void 0,handleFocus:v,handleBlur:I,handlePointerDown:E,moveDown:$,moveUp:oe,selectHighlighted:q,selectRow:U,dismiss:B}}function bn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:i,onSelect:d}){const f=c.useMemo(()=>Number.isNaN(Date.parse(o))?null:jt(o),[o,i]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),f!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:f})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function Qo({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const i=Ct(t,e.session.cwd??s);return l.jsx(bn,{mark:l.jsx(Rt,{color:i.color,emoji:i.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function Xo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(bn,{mark:l.jsx(St,{room:e.room,participants:e.room.participants,visuals:Mt(t)}),label:l.jsx(At,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function Zo({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=Nt(6e4);return c.useEffect(()=>{var i,d;(d=(i=document.getElementById(ke(t)))==null?void 0:i.scrollIntoView)==null||d.call(i,{block:"nearest"})},[t]),l.jsx(Ge.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:i=>i.preventDefault(),children:l.jsx("div",{id:yn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((i,d)=>{var f;return i.kind==="session"?l.jsx(Qo,{item:i,agent:i.session.cwd&&s[i.session.cwd]||null,displayName:i.session.cwd&&n[i.session.cwd]||((f=i.session.cwd)==null?void 0:f.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`session-${i.id}`):l.jsx(Xo,{item:i,visual:o(i.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`room-${i.id}`)})})})}function Aa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:ze(e.id,t),i=_t(r),{target:d}=qt(),f=Ot(),p=Et(r),x=c.useRef(null),b=Xe(e.members,e.viewerAuthorId),m=c.useRef(!1),u=Ys({members:e.members,viewerAuthorId:e.viewerAuthorId,text:i}),g=c.useMemo(()=>e.kind==="channel"?ao(i,e.members):null,[e.kind,e.members,i]),w=n===!0,h=Yo({value:i,yieldToPalette:u.isOpen,enabled:w}),y=c.useRef(p);c.useEffect(()=>{var v;p!==y.current&&(y.current=p,(v=x.current)==null||v.focus())},[p]),c.useEffect(()=>{var v;s===!0&&((v=x.current)==null||v.focusUnlessTouch())},[]);const k=c.useCallback(v=>X.getState().set(r,v),[r]),[M,j]=c.useState(null);c.useLayoutEffect(()=>{var v;M!==null&&((v=x.current)==null||v.focusAt(M.pos))},[M]);const R=c.useCallback(v=>{v&&(k(v.value),j({pos:v.cursorPos}))},[k]),N=c.useCallback(v=>R(u.selectRow(v)),[u,R]),S=c.useCallback(()=>R(u.selectHighlighted()),[u,R]),_=()=>{if(d===null||!d.canSend||m.current)return;u.dismiss();const v=X.getState().take(r).trim();if(v==="")return;const E=a.pendingFiles.length>0;E&&(m.current=!0),d.send({text:v}).catch(()=>{const I=X.getState(),A=I.drafts[r]??"";I.set(r,A===""?v:`${v}
37
+ */const ln={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};ln.node;const us=F(ln),ms='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function fs(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=c.useRef(null),r=c.useRef(!1);c.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let p=0,x=0;const b=()=>{var u;const m=(u=a.current)==null?void 0:u.querySelector(ms);if(m)return m.focus();++p<10&&(x=requestAnimationFrame(b))};return b(),()=>cancelAnimationFrame(x)},[t]);const i=c.useCallback(p=>{var x;!p&&((x=a.current)!=null&&x.contains(document.activeElement))||s(p)},[s]),d=c.useCallback(p=>{!o||p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),r.current=!0,s(!0))},[o,s]),f=c.useMemo(()=>({onEscapeKeyDown:()=>{var p;return(p=n.current)==null?void 0:p.focus()},onBlur:p=>{var b,m,u;const x=p.relatedTarget;x&&((b=a.current)!=null&&b.contains(x)||(m=n.current)!=null&&m.contains(x))||(u=a.current)!=null&&u.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:i,onTriggerKeyDown:d,contentHandlers:f}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const i=s||n&&e.shiftKey?-1:1;a[(r+i+a.length)%a.length].focus()}function ps({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function gs({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(Rn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const hs=300;function Y({className:e,children:t}){return l.jsx("span",{className:K("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:i}){const{kind:d,displayName:f,handle:p,color:x,emoji:b,imageUrl:m,origin:u,agent:g}=e,w=x??"hsl(var(--muted-foreground))",h=typeof u=="object"&&u!==null,y=d==="agent"&&(g==null?void 0:g.working)!=null?g.working:null,[k,M]=c.useState(!1),j=c.useRef(!0);c.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const R=c.useCallback(A=>{j.current&&(M(A),a==null||a(A))},[a]),N=c.useRef(!1),S=c.useRef(null),_=An({onLongPress:()=>{N.current&&R(!0)}}),{contentRef:O,handleOpenChange:v,onTriggerKeyDown:E,contentHandlers:I}=fs({open:k,setOpen:R,triggerRef:S,enabled:r&&o!==void 0});return l.jsxs(es,{open:k,onOpenChange:v,openDelay:hs,children:[l.jsx(ns,{asChild:!0,ref:S,"data-gesture-priority":"",..._,onPointerDown:A=>{N.current=A.pointerType==="touch"||A.pointerType==="pen",_.onPointerDown(A)},...r?{onClick:()=>R(!0),onKeyDown:E}:{},children:t}),l.jsxs(ts,{ref:O,...I,...o?{role:"dialog","aria-label":f}:{},"data-slot":"identity-hover-card",align:"start",className:K("flex w-64 flex-col gap-0 overflow-hidden p-0",i),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(Sn,{"aria-hidden":!0,color:w,emoji:b,imageUrl:m,fallback:Mn(f),kind:d,origin:u,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:f}),p&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",p]})]})]}),n&&l.jsx(ps,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((g==null?void 0:g.runtime)||(g==null?void 0:g.model))&&l.jsx(Y,{children:[g.runtime,g.model].filter(Boolean).join(" · ")}),y&&l.jsxs(Y,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Zt(y.forMs)]}),d==="human"&&l.jsx(Y,{children:h?u.platform:"On this machine"}),d==="agent"&&(g==null?void 0:g.managedBy)&&l.jsxs(Y,{children:["Managed by"," ",g.managedBy.handle?`@${g.managedBy.handle}`:g.managedBy.displayName]})]}),o?l.jsx(gs,{actions:o,onAct:()=>{var A;(A=S.current)==null||A.focus(),R(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var A;(A=S.current)==null||A.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function xs(){const e=fe(),t=Be();return Ue({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var p;const r=t.getQueryData(H.entries(s)),i=(p=r==null?void 0:r.find(x=>x.id===n))==null?void 0:p.reactions,{reactions:d,on:f}=Me(i,o,a);return t.setQueryData(H.entries(s),x=>je(x,n,d)),{on:f}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,f;const r=t.getQueryData(H.entries(s)),i=((f=(d=r==null?void 0:r.find(p=>p.id===n))==null?void 0:d.reactions)==null?void 0:f.some(p=>p.emoji===o&&p.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:i})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},i)=>{i!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const f=(x=d==null?void 0:d.find(b=>b.id===o))==null?void 0:x.reactions,{reactions:p}=Me(f,a,r,!i.on);return je(d,o,p)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function z(e){return e.threadRootEntryId??e.parentEntryId}function ys(e){return z(e)??e.id}function bs(e,t){return Math.max(t??0,e)}function pa(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:bs(e.length,s),lastAt:n.createdAt,unread:o}}function vs(e){var j,R;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=He(),r=jn(),i=a&&o&&t!==void 0,d=_n(i?t:null),f=On(d.member),p=En(),x=Tn(),b=$n(),m=Dn(),{data:u}=We({enabled:i&&r}),g=m.status==="ready"?m.roomId:null,w=u==null?void 0:u.find(N=>N.id===g),h=w?se(w):null,y=(R=(j=d.member)==null?void 0:j.agent)==null?void 0:R.effectiveRuntimeId,k=c.useCallback(()=>{t!==void 0&&(ee.getState().recordOpened("agent",t),p({agentPath:t},y?{runtime:y}:{}))},[t,p,y]),M=c.useCallback(async()=>{if(t===void 0||!b)return;const N=await x(t);if(N===null){Ke(`${s} has no session in ${h??"this room"} yet`);return}b(pe({session:N}))},[t,b,x,s,h]);return c.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:f},actions:{onMessage:k,...n?{onViewProfile:n}:{},...r&&h?{session:{label:`Session in ${h}`,onOpen:()=>void M()}}:{}}},[a,t,d.role,f,k,n,r,h,M])}function ks({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=c.useState(!1),i=vs({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=c.useCallback(f=>{f&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&i!==null,...i?{about:i.about,actions:i.actions}:{},children:o})}function ws(e){return l.jsx(Xt,{code:e.code,isIncomplete:e.isIncomplete})}const Is=[{language:Qt,component:ws}],Ns={turn_failed:{Icon:Yn,warm:!0},agent_busy:{Icon:Gn},agent_gone:{Icon:us,warm:!0},agent_left:{Icon:Ee,warm:!0},room_archived:{Icon:Vn},agent_reseated:{Icon:qn},handle_changed:{Icon:nn},files_set_up:{Icon:zn},handoff_shared:{Icon:Kn},handoff_declined:{Icon:Oe},runtime_gone:{Icon:cs,warm:!0},agent_paused:{Icon:Wn},agent_declined:{Icon:Oe},agent_unavailable:{Icon:Hn},awaiting_approval:{Icon:Un,warm:!0},halted:{Icon:Bn},budget_reached:{Icon:Fn},cascade_stopped:{Icon:Ln},addressing_changed:{Icon:is},bridge_blocked:{Icon:os,warm:!0},bridge_undelivered:{Icon:Pn,warm:!0},bridge_rate_limited:{Icon:ds},bridge_second_agent_refused:{Icon:Ee},bridge_disconnected:{Icon:rs},bridge_agent_swapped:{Icon:Gt},bridge_history_note:{Icon:ss}},Cs={Icon:Jn};function dn(e){return(e&&Ns[e])??Cs}function ga(e){return dn(e).warm===!0}const le=80;function Rs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function As(e,t,s){const n=Ss(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-3",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function Ss(e,t){if(t!==void 0){const n=Qn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Xn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function Ms({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,warm:r}=dn(e.body.notice);return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":Rs(e.body.text)},...xe(t),className:K("focus-ring-inset flex items-start gap-[var(--msg-gap)] px-[var(--msg-padding-x)] py-1.5 text-xs",r?"text-foreground":"text-muted-foreground"),children:[l.jsx("span",{"data-slot":"notice-mark",className:"flex w-[var(--msg-gutter-width)] shrink-0 justify-center",children:l.jsx(a,{"aria-hidden":!0,className:K("mt-0.5 size-(--size-icon-xs) shrink-0",r?"text-status-warning-fg":"text-muted-foreground")})}),l.jsx("span",{className:"min-w-0",children:n?As(e.body.text,n,o):e.body.text})]})}const js=as.moment;function _s({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=en(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-ring-inset px-[var(--msg-padding-x)] py-1",children:l.jsxs("div",{className:"bg-foreground/4 flex items-center gap-2.5 rounded-lg px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Dt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(js,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-(--size-icon-xs) shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Pt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function Os(e,t){const s=X.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
38
+ `)?"":" ";s.set(e,`${n}${o}@${t} `)}function Es({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o,onMakeTodo:a}){const r=ys(t),i=t.body.text,d=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,f=s==null?void 0:s.displayName,{copy:p}=Zn({toastOnSettle:!0});return c.useMemo(()=>{const x={reply:{id:"reply",label:"Reply in thread",icon:ls,run:()=>{nt.getState().openThread(e,r,!0),Re.getState().requestFocus(ze(e,r))}},copy:{id:"copy",label:"Copy text",icon:et,run:()=>void p(i)}};return o!==void 0&&(x.profile={id:"profile",label:"View profile",icon:tt,run:o}),a!==void 0&&(x.todo={id:"todo",label:"Make a to-do",icon:st,run:a}),d!==void 0&&(x.mention={id:"mention",label:f===void 0?"Mention author":`Mention ${f}`,icon:nn,run:()=>{Os(e,d),Re.getState().requestFocus(e)}}),Lt.map(b=>x[b]).filter(b=>b!==void 0)},[e,r,i,d,f,o,a,p])}function Ts(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function ha(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function xa(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function $s(e,t,s){const n=t.get(e),o=qe({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function ya(e){const t=new Set;for(const a of e)z(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=z(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const i=n.get(r);i?i.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Ds(e){return`thread-${e}`}function Ps(e){return`thread-row-${e}`}function ba(e){return`thread-panel-entry-${e}`}function Ls(e){return`room-entry-${e}`}function Fs(e,t){const s=e.find(i=>i.id===t);if(s===void 0)return null;const n=z(s)??null,o={rowId:t,domId:Ls(t)};if(n===null)return o;const a=e.find(i=>i.id===n);return a!==void 0&&(z(a)??null)===null?{rowId:Ds(n),domId:Ps(n)}:o}function va(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fs(e,s.id)}const Te=48;function ka(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Te?`${a.slice(0,Te).trimEnd()}…`:a}}function Bs(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=ot({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:at(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Us(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Hs={info:new Map,faces:new Map},be=c.createContext(Hs);function wa({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function Ia(){const e=he(),t=c.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=c.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ve(s),o=c.useMemo(()=>Bs(t,n.data??{}),[t,n.data]),a=c.useMemo(()=>Us(o),[o]);return c.useMemo(()=>({info:o,faces:a}),[o,a])}function ne(e){const t=c.useContext(be);return e===void 0?void 0:t.info.get(e)}function Ws(){return c.useContext(be).faces}const $e={people:"People",agents:"Agents"},Ks=["people","agents"];function zs(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function qs(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Vs(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Vs(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function J(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Gs(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,i=a.startsWith(" ")?"":" ";return{value:o+r+i+a,cursorPos:o.length+r.length+1}}const Ys=/(^|\s)@([A-Za-z0-9_.-]*)$/,un="mention-palette-listbox";function me(e){return`mention-item-${e}`}function Js({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Ks}){var E;const[o,a]=c.useState(!1),[r,i]=c.useState(""),[d,f]=c.useState(-1),p=rt(s),x=c.useRef(!1),b=c.useMemo(()=>zs(e,t),[e,t]),m=c.useMemo(()=>o?qs(b,r,n):[],[b,r,o,n]),[u,g]=c.useState(null),w=u!==null&&u.query===r&&u.open===o?u.index:J(m,0,1),h=m[w],y=m.length===0||h!==void 0&&!h.disabled?w:J(m,0,1),k=c.useCallback((I,A)=>{const $=I.slice(0,A).match(Ys);if(!$){a(!1);return}a(!0),i($[2]),f(($.index??0)+$[1].length)},[]),M=c.useCallback(I=>{p.write(I),x.current=!1},[p]),j=c.useCallback(I=>{x.current||k(p.read(),I)},[k,p]),R=c.useCallback(()=>{g({query:r,open:o,index:J(m,y+1,1)})},[m,y,r,o]),N=c.useCallback(()=>{g({query:r,open:o,index:J(m,y-1,-1)})},[m,y,r,o]),S=c.useCallback(I=>I.disabled||I.handle===void 0?null:(x.current=!0,a(!1),Gs(p.read(),d,r,I.handle)),[d,r,p]),_=c.useCallback(()=>{const I=m[y];return I?S(I):(a(!1),null)},[m,y,S]),O=c.useCallback(()=>{x.current=!0,a(!1)},[]),v=m.some(I=>!I.disabled);return{isOpen:o,hasSelectableRows:v,rows:m,selectedIndex:y,activeDescendantId:o&&((E=m[y])==null?void 0:E.disabled)===!1?me(y):void 0,listboxId:o?un:void 0,noteTextChange:M,handleCursorChange:j,moveDown:R,moveUp:N,selectHighlighted:_,selectRow:S,dismiss:O}}function Qs({rows:e,selectedIndex:t,onSelect:s}){const n=c.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const i=o[o.length-1];i&&i.section===a.section?i.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return c.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Ge.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:un,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:i,index:d})=>{const f=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":f,"aria-disabled":i.disabled,"data-selected":f,"data-disabled":i.disabled,onClick:()=>{i.disabled||s(i)},className:i.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:i.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:i.label}),i.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",i.handle]}),i.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:i.disabledReason})]},i.authorId)})]},o))})})}const Xs=/(?:^|[^A-Za-z0-9_.@-])cc(?![A-Za-z0-9_])/i;function Zs(e,t){const s=e.lastIndexOf(`
39
+ `,t-1)+1;return Xs.test(e.slice(s,t))}function eo(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=s.map(a=>Zs(e,a.offset)),o=new Set(s.filter((a,r)=>!n[r]).map(a=>a.authorId));return s.map((a,r)=>n[r]&&!o.has(a.authorId)?{...a,cc:!0}:a)}function no(e,t){const s=e.length>0?`Woke ${e.join(", ")}.`:"Woke nobody.";return t.length>0?`${s} Cc: ${t.join(", ")}.`:s}function mn(e){const t=new Set(e.filter(n=>!n.cc).map(n=>n.authorId)),s=[];for(const n of e)n.cc&&!t.has(n.authorId)&&!s.includes(n.authorId)&&s.push(n.authorId);return s}const to=/@([A-Za-z0-9][A-Za-z0-9_.-]*)/g,so=/[.\-_]+$/;function oo(e,t){const s=new Map;for(const{author:o}of t)o.handle&&s.set(o.handle.toLowerCase(),o.handle);const n=[];for(const o of e.matchAll(to)){if(o.index===void 0)continue;const a=o[1].toLowerCase(),r=a.replace(so,""),i=s.get(a)??s.get(r);if(!i)continue;const d=(s.has(a)?a.length:r.length)+1;n.push({offset:o.index,length:d,authorId:i,handle:i})}return n}function ao(e,t){const s=eo(e,oo(e,t)),n=[],o=[];for(const r of s){const i=r.cc?o:n;i.includes(r.handle)||i.push(r.handle)}if(o.length===0)return null;const a=r=>r.map(i=>`@${i}`).join(", ");return`${n.length>0?`Wakes ${a(n)}`:"Wakes nobody"} · cc ${a(o)}`}function ro(e,t){const s=e.mentions.filter(r=>r!==e.authorId);if(s.length===0)return null;const n=new Set(mn(e.mentionSpans??[])),o=r=>{var i,d;return`@${((i=t.get(r))==null?void 0:i.handle)??((d=t.get(r))==null?void 0:d.displayName)??r}`},a=s.filter(r=>{var i;return!n.has(r)&&((i=t.get(r))==null?void 0:i.kind)==="agent"});return no(a.map(o),s.filter(r=>n.has(r)).map(o))}function io({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:i}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(i)}}const Z=120,co="code block";function lo(e){if(e.length<=Z&&!e.includes("```"))return null;const t=uo(e);return t.length===0?null:t}function uo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${co} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=Z)return t;const s=mo(t,Z),n=s.lastIndexOf(" ");return`${(n>Z/2?s.slice(0,n):s).trimEnd()}…`}function mo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function fo({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=xs(),i=o===!0||!a,d=c.useMemo(()=>t.reactions??[],[t.reactions]),f=c.useMemo(()=>d.filter(b=>Ft(b,s)).map(b=>b.emoji),[d,s]),p=c.useCallback(b=>r.mutate({roomId:e,entryId:t.id,emoji:b,viewerAuthorId:s}),[r,e,t.id,s]),x=c.useMemo(()=>({quick:n,mine:f,onToggle:p,disabled:i}),[n,f,p,i]);return{reactions:d,toggle:p,quickRow:x}}function po({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function go(e,t){var x,b;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&it.includes(n),a=Yt(e,{enabled:o}),r=Ye(),i=Be(),d=fe(),f=o?((b=(x=a.data)==null?void 0:x.bindings.find(m=>m.authorId===s))==null?void 0:b.sessionId)??null:null,p=c.useCallback(m=>{m.button!==0||m.metaKey||m.ctrlKey||m.shiftKey||m.altKey||(m.preventDefault(),!(f===null||s===void 0)&&ct({queryClient:i,transport:d},e,s).then(u=>{u.kind!=="none"&&r(pe({session:u.kind==="bound"?u.sessionId:f}))}))},[s,r,i,e,f,d]);return c.useMemo(()=>f===null?null:{href:lt({session:f}),onOpen:p},[p,f])}const te="mention",ve="author_id",ho={[te]:[ve]},xo=[te];function yo(e,t){if(!t||t.length===0)return e;const s=bo(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:i}=s[o],d=n.slice(0,a),f=n.slice(a,a+r),p=n.slice(a+r);n=`${d}<${te} ${ve}="${i}">${f}</${te}>${p}`}return n}function bo(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const vo=/(?:^|[^\p{L}\p{N}_])cc$/iu;function ko(e,t){const s=new Set;for(const n of t)n.cc&&vo.test(e.slice(0,n.offset).trimEnd())&&s.add(n.authorId);return s}const wo=new Map,fn=c.createContext(wo);function Io({authors:e,children:t}){return l.jsx(fn.Provider,{value:e,children:t})}function No(e){const t=c.useContext(fn);return e===void 0?void 0:t.get(e)}const De=new WeakMap;function Co(e){const t=De.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return De.set(e,s),s}function Ro(e){var n;const s=(n=he().data)==null?void 0:n.agents;return c.useMemo(()=>e===void 0||!s?void 0:Co(s).get(e),[s,e])}function pn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=He(),a=Ro(o?t:void 0),r=ne(t);return c.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const i={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(f,p={})=>l.jsx(ks,{identity:i,agentPath:a,onViewProfile:n,openOnClick:p.openOnClick??!1,children:f});return{wrap:d,wrapAvatar:f=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:f}),{openOnClick:!0}),wrapName:f=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:K(f.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Ao={kind:"human",displayName:""};function So(e){return typeof e=="string"?e.replace(/^@/,""):""}function Mo({authorId:e,children:t,cc:s,ccWord:n}){const o=No(e),a=ne(o==null?void 0:o.agentRef),{open:r}=Je(),i=o?qe({record:o,override:a==null?void 0:a.visual}):null,d=o?Qe(o,a==null?void 0:a.memberId):void 0,f=c.useMemo(()=>d===void 0?void 0:()=>r(d),[d,r]),p=i==null?void 0:i.color,x=i==null?void 0:i.emoji,b=i==null?void 0:i.imageUrl,m=c.useMemo(()=>o?{kind:o.kind,displayName:o.displayName,handle:o.handle??void 0,color:p,emoji:x,imageUrl:b,origin:o.origin,agent:a&&{runtime:a.runtime,...a.model&&{model:a.model}}}:null,[o,p,x,b,a]),u=pn({agentRef:o==null?void 0:o.agentRef,identity:m??Ao,onViewProfile:f});if(!o||!m)return l.jsx(_e,{kind:"human",label:So(t),resolved:!1});const w=u?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:f?{role:"button",tabIndex:0,"aria-label":`View ${o.displayName}’s profile`,onClick:f,onKeyDown:y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),f())}}:{},h=l.jsx(_e,{kind:o.kind,label:o.displayName,handle:o.handle??void 0,color:o.color,origin:o.origin,resolved:!0,interactive:f!==void 0,...w,cc:s,ccWord:n});return u?u.wrap(h,{openOnClick:!0}):l.jsx(ye,{onViewProfile:f,identity:m,children:h})}function jo(e,t=new Set,s=new Set){return{mention:n=>{const o=n[ve],a=typeof o=="string"?o:void 0;return!a||!e.has(a)?l.jsx(l.Fragment,{children:n.children}):l.jsx(Mo,{authorId:a,cc:t.has(a),ccWord:!s.has(a),children:n.children})}}}function _o({entry:e,authors:t}){const s=c.useMemo(()=>yo(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=c.useMemo(()=>{var i;return new Set(((i=e.mentionSpans)==null?void 0:i.map(d=>d.authorId))??[])},[e.mentionSpans]),o=c.useMemo(()=>new Set(mn(e.mentionSpans??[])),[e.mentionSpans]),a=c.useMemo(()=>ko(e.body.text,e.mentionSpans??[]),[e.body.text,e.mentionSpans]),r=c.useMemo(()=>jo(n,o,a),[n,o,a]);return l.jsx(Io,{authors:t,children:l.jsx(Jt,{content:s,className:"msg-prose",allowedTags:ho,literalTagContent:xo,components:r,renderers:Is})})}function Oo(e){return function(s){return l.jsx(_o,{entry:s,authors:e})}}const gn="the top folder";function Pe(e){return e.slice(e.lastIndexOf("/")+1)}function Eo(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function To(e){return e===""?gn:`${e}/`}function de(e){return e.target!==void 0?e.target===""?gn:e.target:To(Eo(e.paths[0]??""))}function $o(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${Pe(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${Pe(s)} from the chat to ${de(e)}`}}const Do=c.lazy(()=>ut(()=>import("./index-DiM3QX-4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function Na({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:i,streamStalled:d,isMember:f=!0,grouping:p,orphanedReply:x,answers:b,feedPosition:m,rowId:u,roomKind:g,headsThread:w=!1}){const h=en(t.createdAt),y=c.useMemo(()=>{const L=lo(t.body.text),ie=Bt(t.attachments??[]);if(ie===null)return L;const Ce=L??t.body.text.trim();return Ce.length>0?`${Ce} ${ie}`:ie},[t.body.text,t.attachments]),k=c.useId(),M=`${k}-author`,j=`${k}-content`,R=`${k}-summary`,N=c.useRef(null),S=c.useRef(null),_=c.useRef(null),{reactions:O,toggle:v,quickRow:E}=fo({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:i,streamStalled:d,isMember:f}),I=ne(n==null?void 0:n.agentRef),{open:A}=Je(),$=n===void 0?void 0:Qe(n,I==null?void 0:I.memberId),oe=c.useCallback(()=>{$!==void 0&&A($)},[A,$]),B=$===void 0?void 0:oe,U=dt(t.id,t.body.text),q=Es({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:B,onMakeTodo:U}),C=(n==null?void 0:n.handle)??void 0,V=c.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:C,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,C,s.color,s.emoji,s.imageUrl]),D=pn({agentRef:n==null?void 0:n.agentRef,identity:V,onViewProfile:B}),vn=po({barRef:S,pillsRef:_,hasReactions:O.length>0}),we=c.useCallback(()=>{var L;return(L=N.current)==null?void 0:L.focus()},[]),kn=c.useMemo(()=>Oo(o),[o]),Ie=c.useMemo(()=>g==="channel"&&t.authorId===a?ro(t,o):null,[g,t,a,o]),wn=c.useCallback(L=>l.jsx(c.Suspense,{fallback:null,children:l.jsx(Do,{roomId:e,attachment:L})}),[e]),In=Ws(),ae=t.body.subjectAuthorId??t.authorId,T=o.get(ae),G=ne(T==null?void 0:T.agentRef),Nn=go(e,t),re=Ts(t);if(re.kind==="notice")return l.jsx(Ms,{entry:t,feedPosition:m,rowId:u,sessionLink:Nn,subjectName:T==null?void 0:T.displayName});if(re.kind==="moment")return l.jsx(_s,{entry:t,moment:re.moment,subject:ae===t.authorId?s:$s(ae,o,In),subjectIdentity:{handle:(T==null?void 0:T.handle)??void 0,origin:T==null?void 0:T.origin,agent:G&&{runtime:G.runtime,...G.model&&{model:G.model}}},feedPosition:m,rowId:u});const Cn=p.position==="first"||p.position==="only",Ne=t.authorId===a;return l.jsxs(P.Root,{ref:N,id:u,position:p.position,className:w?"pb-0":void 0,actions:q,reactions:E,"data-testid":"room-entry",tabIndex:0,...io({showAuthorHeader:Cn,headerId:M,displayName:s.displayName,time:h,summary:y,contentId:j,summaryId:R,feedPosition:m}),onKeyDown:vn,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:D?void 0:B,isSelf:Ne,renderAvatar:D==null?void 0:D.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:M,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,isSelf:Ne,renderName:D==null?void 0:D.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs",children:"Replying to an earlier message"}),b!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs",children:`Answering “${b.excerpt}”`}),t.body.via&&l.jsx(Ut,{via:t.body.via}),l.jsx(P.Content,{id:j,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.todo&&n===void 0?l.jsx(Ht,{todoId:t.body.todo.todoId}):t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:$o(t.body.fileChange,(T==null?void 0:T.displayName)??"Somebody")}):kn(t,{rowId:t.id,isStreaming:!1})}),Ie!==null&&l.jsx("p",{"data-testid":"room-entry-reach",className:"text-muted-foreground text-xs",children:Ie}),y!==null&&l.jsx("span",{id:R,className:"hidden",children:y}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:f?wn:void 0}),l.jsx(P.Reactions,{ref:_,reactions:O,viewerAuthorId:a,names:r,frequents:i,onToggle:v,disabled:d===!0||!f,onExit:we}),l.jsx(P.Actions,{actions:q,reactions:E,barRef:S,onExit:we})]})]})}const Ca={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function Po(e){const t=fe(),[s,n]=c.useState([]),o=c.useRef(new Map),a=c.useCallback(m=>{const u=m.map(g=>({id:crypto.randomUUID(),file:g,status:"pending",progress:0}));n(g=>[...g,...u])},[]),r=c.useCallback(m=>{o.current.delete(m),n(u=>u.filter(g=>g.id!==m))},[]),i=c.useCallback(m=>{if(!m){o.current.clear(),n([]);return}const u=new Set(m);for(const g of u)o.current.delete(g);n(g=>g.filter(w=>!u.has(w.id)))},[]),d=c.useCallback(m=>{o.current.delete(m),n(u=>u.map(g=>g.id===m&&g.status==="error"?{...g,status:"pending",progress:0,error:void 0}:g))},[]),f=c.useRef(null),p=Ue({meta:{suppressErrorToast:!0},mutationFn:async m=>{n(h=>h.map(y=>m.some(k=>k.id===y.id)?{...y,status:"uploading"}:y));const u=h=>{n(y=>y.map(k=>k.status==="uploading"?{...k,progress:h.percentage}:k))},g=new AbortController;f.current=g;const w=m.map(h=>h.file);return t.uploadRoomAttachments(e,w,u,g.signal)},onSettled:()=>{f.current=null},onSuccess:(m,u)=>{u.forEach((g,w)=>{const h=m[w];h&&o.current.set(g.id,h.id)}),n(g=>g.map(w=>u.findIndex(y=>y.id===w.id)===-1?w:{...w,status:"uploaded",progress:100}))},onError:m=>{n(u=>u.map(g=>g.status==="uploading"?{...g,status:"error",error:m.message}:g))}}),x=c.useCallback(()=>{var m;(m=f.current)==null||m.abort()},[]),b=c.useCallback(async()=>{const m=s.filter(g=>g.status==="error");if(m.length>0)throw new Error(m.length===1?`${m[0].file.name} didn’t upload. Try again or remove it.`:`${m.length} files didn’t upload. Try again or remove them.`);const u=s.filter(g=>g.status==="pending");return u.length>0&&await p.mutateAsync(u),s.map(g=>o.current.get(g.id)).filter(g=>g!==void 0)},[s,p]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:i,cancelUpload:x,uploadAndGetIds:b,hasPendingFiles:s.length>0,hasFailedUpload:s.some(m=>m.status==="error"),isUploading:p.isPending}}function Ra(e){const{room:t,threadRootId:s}=e,n=Wt(),o=Kt(),a=Po((t==null?void 0:t.id)??""),r=t!==void 0&&Xe(t.members,t.viewerAuthorId),i=c.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});c.useEffect(()=>{i.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=c.useCallback(y=>i.current.attachments.addFiles(y),[]),f=c.useCallback(y=>i.current.attachments.removeFile(y),[]),p=c.useCallback(y=>i.current.attachments.retryFile(y),[]),x=c.useCallback(()=>i.current.attachments.cancelUpload(),[]),{pendingFiles:b,hasFailedUpload:m,isUploading:u}=a,g=c.useMemo(()=>({staged:b,add:d,remove:f,retry:p,cancel:x,hasFailed:m,isUploading:u,holdsSendWhileUploading:!1}),[b,m,u,d,f,p,x]),w=c.useCallback(async y=>{const{attachments:k,post:M,reply:j,room:R,threadRootId:N}=i.current;if(R===void 0)throw new Error("That room isn’t loaded yet.");if(R.archived)throw new Error("This room is archived.");ee.getState().recordOpened("room",R.id);const S=mt(),_=k.pendingFiles.map(I=>I.file.name),O=k.pendingFiles.map(I=>I.id),v=await k.uploadAndGetIds();k.clearFiles(O);const E=y.parentEntryId??N;if(zt({roomId:R.id,threadRootId:E??null},y.text),E!==void 0){j.mutate({roomId:R.id,rootEntryId:E,text:y.text,clientId:S,attachmentIds:v,attachmentNames:_});return}M.mutate({roomId:R.id,text:y.text,clientId:S,attachmentIds:v,attachmentNames:_})},[]);return{target:c.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ze},send:w,attachments:g}),[t,s,r,g,w]),attachments:a}}const hn=8;function xn(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function Lo(e){if(gt(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:xn(e.topic)}function Le(e){return{kind:"session",id:e.id,name:pt(e.title),summary:xn(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function Fo(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:Lo(e),lastActivityAt:e.lastActivityAt,room:e}}function Q(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function Bo(e){return e.kind==="session"?Ae("session",e.id):Ae("room",e.id)}function Fe(e,t){const s=[Q(t[Bo(e)]),...e.kind==="session"?[Q(e.session.lastTouchedByYouAt),Q(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):Q(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function Uo(e){return(t,s)=>Fe(s,e)-Fe(t,e)||s.id.localeCompare(t.id)}function Ho(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function Wo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function Ko({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=hn}){const{yours:a,spinOffs:r,automated:i}=ft(e),d=Uo(n),f=[...a.map(Le),...t.filter(p=>Wo(p,s)).map(Fo)].sort(d);return{items:Ho(f).slice(0,o),automated:[...r,...i].map(Le).sort(d).slice(0,o)}}const zo=3,qo=yt;function Vo({limit:e=hn,mutedRoomIds:t,enabled:s=!0}={}){var f,p;const n=ht(Math.max(e*zo,qo),{enabled:s}),o=We({enabled:s}),a=xt(),r=(f=n.data)==null?void 0:f.sessions,i=o.data;return{...c.useMemo(()=>Ko({sessions:r??[],rooms:i??[],mutedRoomIds:t,interactions:a,limit:e}),[r,i,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((p=n.data)==null?void 0:p.warnings)??[]}}const Go=6,yn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const Yo='[role="combobox"]';function W(e){return e instanceof Element&&e.matches(Yo)}function Jo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=Ye(),o=bt(),[a,r]=c.useState(!1),[i,d]=c.useState({stamp:"",index:0}),[f,p]=c.useState(!1),[x,b]=c.useState(!1);e.length>0&&!x&&b(!0);const m=c.useRef(!1);c.useEffect(()=>{m.current=!0},[]);const{data:u}=he({enabled:s}),g=c.useMemo(()=>((u==null?void 0:u.agents)??[]).map(C=>C.projectPath),[u]),{data:w}=Ve(g,{enabled:s}),h=c.useMemo(()=>w??{},[w]),y=c.useMemo(()=>vt(g,h),[g,h]),k=c.useMemo(()=>new Map(g.map(C=>[ge(C),C])),[g]),M=c.useCallback(C=>kt({room:C,agentsByPath:h,pathByAgentRef:k}),[h,k]),j=c.useMemo(()=>wt(o.muted),[o.muted]),{items:R}=Vo({mutedRoomIds:j,enabled:s}),N=c.useMemo(()=>R.slice(0,Go),[R]),S=s&&a&&!f&&!x&&!t&&e.length===0&&N.length>0,_=`${S}:${N.length}`,O=i.stamp===_?i.index:0,v=c.useCallback(C=>{m.current&&W(C.target)&&(p(!1),b(!1),r(!0))},[]),E=c.useCallback(C=>{W(C.target)&&r(!0)},[]),I=c.useCallback(C=>{W(C.target)&&r(!1)},[]),A=c.useCallback(C=>{N.length!==0&&d(V=>{const D=V.stamp===_?V.index:0;return{stamp:_,index:(D+C+N.length)%N.length}})},[N.length,_]),$=c.useCallback(()=>A(1),[A]),oe=c.useCallback(()=>A(-1),[A]),B=c.useCallback(()=>{p(!0)},[]),U=c.useCallback(C=>{if(p(!0),C.kind==="session"){C.session.cwd&&ee.getState().recordOpened("agent",C.session.cwd),n(pe({dir:C.session.cwd??void 0,session:C.session.id}));return}ee.getState().recordOpened("room",C.room.id),n({...It.channels(),search:{id:C.room.id}})},[n]),q=c.useCallback(()=>{const C=N[O];!S||!C||U(C)},[S,N,O,U]);return{isOpen:S,hasRows:N.length>0,rows:N,agents:h,displayNames:y,visualOf:M,selectedIndex:O,activeDescendantId:S&&N[O]!==void 0?ke(O):void 0,listboxId:S?yn:void 0,handleFocus:v,handleBlur:I,handlePointerDown:E,moveDown:$,moveUp:oe,selectHighlighted:q,selectRow:U,dismiss:B}}function bn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:i,onSelect:d}){const f=c.useMemo(()=>Number.isNaN(Date.parse(o))?null:jt(o),[o,i]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),f!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:f})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function Qo({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const i=Ct(t,e.session.cwd??s);return l.jsx(bn,{mark:l.jsx(Rt,{color:i.color,emoji:i.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function Xo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(bn,{mark:l.jsx(St,{room:e.room,participants:e.room.participants,visuals:Mt(t)}),label:l.jsx(At,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function Zo({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=Nt(6e4);return c.useEffect(()=>{var i,d;(d=(i=document.getElementById(ke(t)))==null?void 0:i.scrollIntoView)==null||d.call(i,{block:"nearest"})},[t]),l.jsx(Ge.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:i=>i.preventDefault(),children:l.jsx("div",{id:yn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((i,d)=>{var f;return i.kind==="session"?l.jsx(Qo,{item:i,agent:i.session.cwd&&s[i.session.cwd]||null,displayName:i.session.cwd&&n[i.session.cwd]||((f=i.session.cwd)==null?void 0:f.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`session-${i.id}`):l.jsx(Xo,{item:i,visual:o(i.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`room-${i.id}`)})})})}function Aa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:ze(e.id,t),i=_t(r),{target:d}=qt(),f=Ot(),p=Et(r),x=c.useRef(null),b=Xe(e.members,e.viewerAuthorId),m=c.useRef(!1),u=Js({members:e.members,viewerAuthorId:e.viewerAuthorId,text:i}),g=c.useMemo(()=>e.kind==="channel"?ao(i,e.members):null,[e.kind,e.members,i]),w=n===!0,h=Jo({value:i,yieldToPalette:u.isOpen,enabled:w}),y=c.useRef(p);c.useEffect(()=>{var v;p!==y.current&&(y.current=p,(v=x.current)==null||v.focus())},[p]),c.useEffect(()=>{var v;s===!0&&((v=x.current)==null||v.focusUnlessTouch())},[]);const k=c.useCallback(v=>X.getState().set(r,v),[r]),[M,j]=c.useState(null);c.useLayoutEffect(()=>{var v;M!==null&&((v=x.current)==null||v.focusAt(M.pos))},[M]);const R=c.useCallback(v=>{v&&(k(v.value),j({pos:v.cursorPos}))},[k]),N=c.useCallback(v=>R(u.selectRow(v)),[u,R]),S=c.useCallback(()=>R(u.selectHighlighted()),[u,R]),_=()=>{if(d===null||!d.canSend||m.current)return;u.dismiss();const v=X.getState().take(r).trim();if(v==="")return;const E=a.pendingFiles.length>0;E&&(m.current=!0),d.send({text:v}).catch(()=>{const I=X.getState(),A=I.drafts[r]??"";I.set(r,A===""?v:`${v}
40
40
  ${A}`)}).finally(()=>{E&&(m.current=!1)})};if(!b)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ze}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:f.isPending,onClick:()=>f.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Ke.success(`You joined ${se(e)}`)}),children:Tt})]});const O=l.jsx(Vt.Composer,{inputRef:x,value:i,onChange:v=>{k(v),u.noteTextChange(v)},onSubmit:_,footer:g?l.jsx("p",{"data-slot":"cc-line",className:"text-muted-foreground px-3 pb-2 text-xs",children:g}):void 0,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:u.isOpen&&u.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Se,{children:u.isOpen&&l.jsx(Qs,{rows:u.rows,selectedIndex:u.selectedIndex,onSelect:N})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Se,{children:h.isOpen&&l.jsx(Zo,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:u.handleCursorChange,isStreaming:!1,isPaletteOpen:u.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:u.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:u.moveUp,onArrowDown:h.isOpen?h.moveDown:u.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:S,onEscape:h.isOpen?h.dismiss:u.dismiss,tabPicks:!h.isOpen,onClear:()=>{k(""),u.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:u.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:u.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!w&&o===void 0?O:l.jsx("section",{className:"flex flex-col","data-testid":$t.homeComposer,onFocus:v=>{h.handleFocus(v),W(v.target)&&(o==null||o(!0))},onBlur:v=>{h.handleBlur(v),W(v.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:O})}export{wa as A,Aa as C,ye as I,Ca as R,ha as a,Na as b,$s as c,xa as d,Ia as e,ka as f,ya as g,Ds as h,ga as i,bs as j,pa as k,Ps as l,Ls as m,Fs as n,ba as o,va as p,W as q,ys as r,z as t,Ra as u};
@@ -1,4 +1,4 @@
1
- import{O as m,a5 as x,aZ as k,r as v,j as t,B as d,G as p,dR as R}from"./index-BYTLOFNS.js";import{u as y}from"./use-update-config-Bt7fMLqS.js";import{I as O}from"./inline-code-B3u1dOXm.js";/**
1
+ import{O as m,a5 as x,aZ as k,r as v,j as t,B as d,G as p,dR as R}from"./index-BR1m9FON.js";import{u as y}from"./use-update-config-DjL7-nUR.js";import{I as O}from"./inline-code-mh48Uhbi.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.