dorkos 0.114.0 → 0.115.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 (270) hide show
  1. package/dist/bin/cli.js +39739 -38935
  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-mErbIY0l.js → AboutPage-Cz8ijNrK.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-AlI4F82u.js → ActivityErrorState-BzmfwxSZ.js} +1 -1
  6. package/dist/client/assets/ActivityPage-BK7T3OiI.js +1 -0
  7. package/dist/client/assets/{ActivityRow-Baqdr6cP.js → ActivityRow-Ig5atv15.js} +1 -1
  8. package/dist/client/assets/AdapterIcon-BXPv5J8h.js +1 -0
  9. package/dist/client/assets/{AdapterSetupWizard-BL70qy2J.js → AdapterSetupWizard-BEziztL3.js} +2 -2
  10. package/dist/client/assets/AgentOptionRow-BqFQvFeN.js +1 -0
  11. package/dist/client/assets/AgentPicker-dCfEIsU-.js +1 -0
  12. package/dist/client/assets/{AgentRequestCard-CcMh6JyE.js → AgentRequestCard-BAhfGJxx.js} +3 -3
  13. package/dist/client/assets/AppearancePage-7qHhFeEv.js +1 -0
  14. package/dist/client/assets/ApplyToOverridesDialog-jqOFh0d1.js +1 -0
  15. package/dist/client/assets/AttentionSignalRow-3CgglXkd.js +1 -0
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-DHr_AhUv.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BMKtHI0D.js} +3 -3
  17. package/dist/client/assets/BindingDialog-DSBxRyzA.js +1 -0
  18. package/dist/client/assets/{BlintzCanvas-Bq4e7n__.js → BlintzCanvas-CyRuqAJV.js} +1 -1
  19. package/dist/client/assets/{CanvasCsvContent-OR226CLS.js → CanvasCsvContent-Bd1c6TGx.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-DelYwSH8.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-BExIu4RY.js +2 -0
  22. package/dist/client/assets/ChatAppsOff-SWemSaUp.js +6 -0
  23. package/dist/client/assets/{CodeMirrorDiff-D7BWMOim.js → CodeMirrorDiff-0WF4ITRZ.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorEditor-BodwsIG7.js → CodeMirrorEditor-Bg7wC_Q8.js} +1 -1
  25. package/dist/client/assets/CommitmentList-CTvEGUV3.js +1 -0
  26. package/dist/client/assets/{CommitmentsPage-DL_jJQbw.js → CommitmentsPage-C68etoLe.js} +1 -1
  27. package/dist/client/assets/ConnectionAccessLists-9oeVn_GK.js +1 -0
  28. package/dist/client/assets/ConnectionsPage-CJOY4-kp.js +6 -0
  29. package/dist/client/assets/ConventionPage-DD-f5o6y.js +11 -0
  30. package/dist/client/assets/{ExtensionPageRoute-CzXGvVRm.js → ExtensionPageRoute-C6fW17AG.js} +2 -2
  31. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BV3h0rFa.js → FloatingTanStackRouterDevtools-CqogiFob-Zccd0fv6.js} +1 -1
  32. package/dist/client/assets/HandlePage-DOxlquWl.js +1 -0
  33. package/dist/client/assets/HeartbeatPage-cJM6NuTD.js +1 -0
  34. package/dist/client/assets/KeyEntry-K5k_3TfU.js +6 -0
  35. package/dist/client/assets/{LexicalField-Cc6wFZAZ.js → LexicalField-DB5V20zv.js} +2 -2
  36. package/dist/client/assets/{ManagesPage-BxHSb65X.js → ManagesPage-Cj0-hwfr.js} +1 -1
  37. package/dist/client/assets/{Marketplace-EgG6JmBG.js → Marketplace-eWEtLmd9.js} +2 -2
  38. package/dist/client/assets/{MarketplaceSourcesView-D9kq9hl6.js → MarketplaceSourcesView-B1h70C20.js} +1 -1
  39. package/dist/client/assets/{McpAppFrame-6zxszx9A.js → McpAppFrame-BaJ_r-QR.js} +2 -2
  40. package/dist/client/assets/McpSigninBody-Coaq5Fkf.js +1 -0
  41. package/dist/client/assets/{Model3dViewer-CgeJ2v-F.js → Model3dViewer-cKa-Jnbl.js} +1 -1
  42. package/dist/client/assets/NamePage-W7Frb1yy.js +1 -0
  43. package/dist/client/assets/{NewDirectMessageMenu-BnBO4aGI.js → NewDirectMessageMenu-C4zNIv9x.js} +1 -1
  44. package/dist/client/assets/{NotificationsPage-C5aRITCd.js → NotificationsPage-gKNClvNU.js} +1 -1
  45. package/dist/client/assets/{OpenMeshSwitch-UKMQeS7-.js → OpenMeshSwitch-RzB2u6-Q.js} +2 -2
  46. package/dist/client/assets/OperatorIdentityForm-B_78Vqh8.js +1 -0
  47. package/dist/client/assets/PermissionHistory-DrtlA4YM.js +1 -0
  48. package/dist/client/assets/PermissionsPage-O7kUVaQv.js +1 -0
  49. package/dist/client/assets/{PersonalityPopover-vLDfndfo.js → PersonalityPopover-DiNuuoWu.js} +1 -1
  50. package/dist/client/assets/PhotoPage-DdBke3yj.js +1 -0
  51. package/dist/client/assets/PresetPicker-BUFwg8RS.js +19 -0
  52. package/dist/client/assets/{PreviewRefusedNotice-Dh3SCC_A.js → PreviewRefusedNotice-DXZp669C.js} +1 -1
  53. package/dist/client/assets/ProfileFields-BCfMzNcT.js +1 -0
  54. package/dist/client/assets/ProfilePanelContainer-BzC2MGdi.js +1 -0
  55. package/dist/client/assets/ProfileRolePicker-f0FKXLtu.js +1 -0
  56. package/dist/client/assets/PromptSuggestionChips-EgeMFibt.js +1 -0
  57. package/dist/client/assets/ReportsToPopover-CQ4Xxslu.js +1 -0
  58. package/dist/client/assets/RoomSurface-oDbc6jnO.js +44 -0
  59. package/dist/client/assets/{RoomsPage-pPw8vrsB.js → RoomsPage-D_EbiSZ3.js} +1 -1
  60. package/dist/client/assets/RunsOnPopover-LtmmbIsD.js +1 -0
  61. package/dist/client/assets/RuntimeConnectFlow-Kv2ytk2m.js +1 -0
  62. package/dist/client/assets/RuntimeSetupDialog-CiWxlcPc.js +1 -0
  63. package/dist/client/assets/{SessionsPage-BASybh9v.js → SessionsPage-1rDO0SGV.js} +1 -1
  64. package/dist/client/assets/SettingsDialog-_ctp2AfE.js +12 -0
  65. package/dist/client/assets/SkillsPage-gPuQHKps.js +1 -0
  66. package/dist/client/assets/TaskDialogWrapper-BPFpCgsN.js +1 -0
  67. package/dist/client/assets/TasksEmptyState-D0Jlzmed.js +3 -0
  68. package/dist/client/assets/TasksPage-DvGfg5Bk.js +1 -0
  69. package/dist/client/assets/{ToolsPage-C3xfGWdb.js → ToolsPage-B0qZ85pR.js} +2 -2
  70. package/dist/client/assets/{TopologyGraph-D7Ik1Xt6.js → TopologyGraph-q1ammgpG.js} +3 -3
  71. package/dist/client/assets/TourHost-Dc8qw1Ef.js +1 -0
  72. package/dist/client/assets/{UnlinkDialog-TTK5Z_QD.js → UnlinkDialog-DXdrLsGV.js} +1 -1
  73. package/dist/client/assets/{WidgetErrorCard-D--KcgW1.js → WidgetErrorCard-ChDNC060.js} +23 -23
  74. package/dist/client/assets/_shell-BxPza3Lx.js +88 -0
  75. package/dist/client/assets/{_shell._home-CzpVyTzo.js → _shell._home-DjGunhLV.js} +1 -1
  76. package/dist/client/assets/_shell._home.activity-B014dET1.js +1 -0
  77. package/dist/client/assets/_shell._home.index-DEmtTHZg.js +3 -0
  78. package/dist/client/assets/_shell._home.tasks-CnDEbUOd.js +1 -0
  79. package/dist/client/assets/_shell._home.workspaces-AQtMUWuu.js +1 -0
  80. package/dist/client/assets/{_shell.channels-CCGSs0Bn.js → _shell.channels-C8NOhmJd.js} +4 -4
  81. package/dist/client/assets/_shell.connections-Bxe0wxOB.js +1 -0
  82. package/dist/client/assets/{_shell.feedback-requests-C6alx2ox.js → _shell.feedback-requests-C6ku9F5_.js} +2 -2
  83. package/dist/client/assets/_shell.marketplace-CEnzWFmI.js +1 -0
  84. package/dist/client/assets/_shell.marketplace_.sources-BZq1d2ih.js +1 -0
  85. package/dist/client/assets/_shell.session-Dn0C0mEZ.js +66 -0
  86. package/dist/client/assets/{_shell.team-BIwJNdkd.js → _shell.team-DoLdOMoC.js} +4 -4
  87. package/dist/client/assets/_shell.x._extensionId-DhE3OYMF.js +1 -0
  88. package/dist/client/assets/_shell.x._extensionId_._-DhE3OYMF.js +1 -0
  89. package/dist/client/assets/access-copy-CBGtcTk0.js +1 -0
  90. package/dist/client/assets/{agent-browser-CO5haI5Y.js → agent-browser-DbcLtsAx.js} +1 -1
  91. package/dist/client/assets/{banner-Dh5mO27l.js → banner-rPsz3suJ.js} +2 -2
  92. package/dist/client/assets/{card-CKZCX8ol.js → card-BqN3lfJn.js} +1 -1
  93. package/dist/client/assets/command-ZTLTCj0l.js +1 -0
  94. package/dist/client/assets/cpu-D70xMHl2.js +11 -0
  95. package/dist/client/assets/dead-letter-reasons-DtBHju9v.js +1 -0
  96. package/dist/client/assets/empty-state-yl1dLwLN.js +1 -0
  97. package/dist/client/assets/execution-config-BbBEe6FO.js +1 -0
  98. package/dist/client/assets/{file-CMPbZedq.js → file-CGg2M6ED.js} +1 -1
  99. package/dist/client/assets/{file-exclamation-point-emLeXvmw.js → file-exclamation-point-DZrVsShR.js} +1 -1
  100. package/dist/client/assets/{file-text-9a0DChCq.js → file-text-BYq_4IAt.js} +1 -1
  101. package/dist/client/assets/{find-latest-widget-fence--3kWMT1F.js → find-latest-widget-fence-CWs9nr10.js} +3 -3
  102. package/dist/client/assets/form-vPuXuaYT.js +1 -0
  103. package/dist/client/assets/format-cron-D02Tnupo.js +1 -0
  104. package/dist/client/assets/{git-branch-hfu8isLA.js → git-branch-DbjXDO_F.js} +1 -1
  105. package/dist/client/assets/{heart-SRafwnSd.js → heart-Dblp_miM.js} +1 -1
  106. package/dist/client/assets/{highlighted-body-KPVGNVTW-Dxwd3mxT.js → highlighted-body-KPVGNVTW-CaMXMak-.js} +1 -1
  107. package/dist/client/assets/index-B-WvQ24u.js +23 -0
  108. package/dist/client/assets/{index-Ch41JOI2.js → index-BKuzoeSn.js} +1 -1
  109. package/dist/client/assets/{index-DdsKmfEH.js → index-BOL391En.js} +1 -1
  110. package/dist/client/assets/{index-DLZi_nae.js → index-BPqkuMIa.js} +1 -1
  111. package/dist/client/assets/{index-BTXBESRm.js → index-BPwUl0Bz.js} +1 -1
  112. package/dist/client/assets/{index-DIlV08Vw.js → index-BV0tZnYg.js} +1 -1
  113. package/dist/client/assets/{index-3GDQSKet.js → index-BW98owO8.js} +1 -1
  114. package/dist/client/assets/{index-BTreBsWa.js → index-Bd23EYYT.js} +2 -2
  115. package/dist/client/assets/{index-BYp9xcmS.js → index-BdVOtoFr.js} +1 -1
  116. package/dist/client/assets/{index-CpYs0Lli.js → index-Bi7Um5RU.js} +1 -1
  117. package/dist/client/assets/{index-BRGOMmOM.js → index-BiIbMZ6d.js} +36 -36
  118. package/dist/client/assets/{index-C7BTAdSc.js → index-BxqUb-n7.js} +1 -1
  119. package/dist/client/assets/{index-DmTI5Hye.js → index-BzczIyv5.js} +1 -1
  120. package/dist/client/assets/index-C6NUjpzQ.js +38 -0
  121. package/dist/client/assets/{index-D67aFWxz.js → index-C88NZagl.js} +1 -1
  122. package/dist/client/assets/{index-BDfoFNcA.js → index-CHvi6xUU.js} +1 -1
  123. package/dist/client/assets/{index-CbFo-7kM.js → index-CMWMhbec.js} +1 -1
  124. package/dist/client/assets/{index-BB18IeC2.js → index-CN9fywRC.js} +1 -1
  125. package/dist/client/assets/{index-iD0epmn3.js → index-CRZXSh_q.js} +1 -1
  126. package/dist/client/assets/{index-YswfjpmW.js → index-CWNsRK97.js} +1 -1
  127. package/dist/client/assets/index-CaLw69VE.js +1 -0
  128. package/dist/client/assets/index-CdKpQ1hI.js +1018 -0
  129. package/dist/client/assets/{index-Cp7oifSs.js → index-CrK4rKAq.js} +1 -1
  130. package/dist/client/assets/{index-D_Wc_qTa.js → index-D16KF-iC.js} +3 -3
  131. package/dist/client/assets/index-D6m2SWHr.js +1 -0
  132. package/dist/client/assets/index-DDYi817r.js +1 -0
  133. package/dist/client/assets/{index-BokDvdOG.js → index-Db2EOzA3.js} +1 -1
  134. package/dist/client/assets/index-DdbHrvr0.js +1 -0
  135. package/dist/client/assets/index-Dg_bax15.js +17 -0
  136. package/dist/client/assets/index-DwUdUliR.js +1 -0
  137. package/dist/client/assets/{index-D0Nd2LA-.js → index-DzeYt-GT.js} +1 -1
  138. package/dist/client/assets/{index-lJc8v0Z3.js → index-Gq3gqBhY.js} +1 -1
  139. package/dist/client/assets/index-O_HMols_.js +1 -0
  140. package/dist/client/assets/{index-Cow815Qa.js → index-P5j6zmcN.js} +1 -1
  141. package/dist/client/assets/{index-BNn3-chz.js → index-XE46wAj9.js} +1 -1
  142. package/dist/client/assets/{index-C4nEz6I-.js → index-Z8YcKwIB.js} +1 -1
  143. package/dist/client/assets/{index-DFEF2MFy.css → index-kktlr1TJ.css} +1 -1
  144. package/dist/client/assets/{index-CAlXjm0N.js → index-lNMJBFB0.js} +1 -1
  145. package/dist/client/assets/{index-DX7V94qe.js → index-oWLYcpm4.js} +1 -1
  146. package/dist/client/assets/{index-DRqEM5Wb.js → index-vRc1D4KI.js} +1 -1
  147. package/dist/client/assets/inline-code-Cvn43Gqu.js +1 -0
  148. package/dist/client/assets/{layers-Cy8Tme6i.js → layers-Bmz62WF4.js} +1 -1
  149. package/dist/client/assets/{lightbulb-tNm7gLYi.js → lightbulb-CAd6slmc.js} +1 -1
  150. package/dist/client/assets/link-2-C0mn8T24.js +6 -0
  151. package/dist/client/assets/list-runtime-types-DxwGcKLx.js +1 -0
  152. package/dist/client/assets/{markdown-content-CoK3F0c0.js → markdown-content-1-B7PdbY.js} +1 -1
  153. package/dist/client/assets/{mention-pill-Bgs_yujj.js → mention-pill-D_-KXznh.js} +1 -1
  154. package/dist/client/assets/{message-square-off-CF2Bzen3.js → message-square-off-Di7kQvfe.js} +1 -1
  155. package/dist/client/assets/more-details-C6UGVeDE.js +1 -0
  156. package/dist/client/assets/{owner-notice-cgCWG4hG.js → owner-notice-CudDDBX4.js} +1 -1
  157. package/dist/client/assets/{package-DE8sQpId.js → package-D2eMoFCI.js} +1 -1
  158. package/dist/client/assets/{page-container-BoXmmBSs.js → page-container-CDHAACRA.js} +1 -1
  159. package/dist/client/assets/{paperclip-IgDeVFea.js → paperclip-p0W24D54.js} +1 -1
  160. package/dist/client/assets/path-input-j04LMj9z.js +1 -0
  161. package/dist/client/assets/primer-trigger-DkCcHf2Q.js +3 -0
  162. package/dist/client/assets/profile-errors-CqflLCzu.js +1 -0
  163. package/dist/client/assets/progress-BcuH4Eod.js +6 -0
  164. package/dist/client/assets/query-error-state-CEZs7dhg.js +1 -0
  165. package/dist/client/assets/{radio-BzTkFBDD.js → radio-DGWfQ5Rf.js} +1 -1
  166. package/dist/client/assets/registry-ChxwU0f4.js +1 -0
  167. package/dist/client/assets/relay-trace-schemas-y0nd8fzi.js +6 -0
  168. package/dist/client/assets/{room-files-source-CIIDTSTA.js → room-files-source-C1TCg4W_.js} +2 -2
  169. package/dist/client/assets/{rotate-ccw-clock-CGcSqHnk.js → rotate-ccw-clock-DcBojy-0.js} +1 -1
  170. package/dist/client/assets/{rotate-cw-DaduzRfP.js → rotate-cw-D0vUyeR2.js} +1 -1
  171. package/dist/client/assets/runtime-connect-Dn0T5YWv.js +1 -0
  172. package/dist/client/assets/{scroll-area-DW0-Liri.js → scroll-area-CQ9lO56h.js} +1 -1
  173. package/dist/client/assets/{search-x-Sme5ElYi.js → search-x-EJGj73JB.js} +2 -2
  174. package/dist/client/assets/settings-for-runtime-BoOa-ZFG.js +1 -0
  175. package/dist/client/assets/shield-check-Bp58y9u7.js +6 -0
  176. package/dist/client/assets/{shield-x-Bh5xap8N.js → shield-x-jF_NCCvp.js} +1 -1
  177. package/dist/client/assets/soul-file-Cag2i87x.js +1 -0
  178. package/dist/client/assets/{table-BEtvgYmW.js → table-D89CWVJX.js} +1 -1
  179. package/dist/client/assets/terminal-BUhNMZAt.js +6 -0
  180. package/dist/client/assets/trust-posture-15DMDZTA.js +1 -0
  181. package/dist/client/assets/unplug-opnrSXAi.js +6 -0
  182. package/dist/client/assets/unverified-catalog-notice-DHM5Coia.js +1 -0
  183. package/dist/client/assets/use-adapter-catalog-ClMqVelU.js +1 -0
  184. package/dist/client/assets/use-bindings-Ch6UUBvz.js +1 -0
  185. package/dist/client/assets/use-composer-prefs-Qn7KRpYe.js +1 -0
  186. package/dist/client/assets/{use-connector-management-Cohvs7jD.js → use-connector-management-dX_4x0d3.js} +1 -1
  187. package/dist/client/assets/use-deep-link-scroll-BV2fY4gy.js +1 -0
  188. package/dist/client/assets/use-delete-binding-BklxjB_c.js +1 -0
  189. package/dist/client/assets/{use-dev-links-DRnLdl--.js → use-dev-links-D4Bqam6F.js} +1 -1
  190. package/dist/client/assets/use-external-adapter-catalog-nHiD8BKZ.js +1 -0
  191. package/dist/client/assets/use-full-activity-feed-vYU7wQWT.js +1 -0
  192. package/dist/client/assets/use-is-below-desktop-G-mTu2Ga.js +1 -0
  193. package/dist/client/assets/{use-jump-back-in-CkFErfWY.js → use-jump-back-in-BVunjzyr.js} +3 -3
  194. package/dist/client/assets/use-mesh-topology-NaUKSKol.js +1 -0
  195. package/dist/client/assets/use-mounted-ref-BWpQ8f91.js +1 -0
  196. package/dist/client/assets/use-notification-prefs-qO1zRRFN.js +1 -0
  197. package/dist/client/assets/{use-panel-tab-placements-AFrWTQ0a.js → use-panel-tab-placements-Db6p2vLD.js} +1 -1
  198. package/dist/client/assets/use-pending-read-DUqJZUza.js +1 -0
  199. package/dist/client/assets/use-personality-commit-DUEKxHt_.js +1 -0
  200. package/dist/client/assets/{use-promo-activation-Dxt-1yuT.js → use-promo-activation-CnGaw39P.js} +2 -2
  201. package/dist/client/assets/use-promo-dismissals-bkSHhGhj.js +1 -0
  202. package/dist/client/assets/{use-pulse-freshness-DRRM5Hza.js → use-pulse-freshness-Oc_1gs-Y.js} +1 -1
  203. package/dist/client/assets/use-relay-config-Ba-S4wxY.js +1 -0
  204. package/dist/client/assets/{use-room-follow-claim-huRfaa4e.js → use-room-follow-claim-DqE5b95Z.js} +1 -1
  205. package/dist/client/assets/{use-roving-tab-list-BZIBAGgJ.js → use-roving-tab-list-DnMqliqf.js} +1 -1
  206. package/dist/client/assets/{use-session-canvas-CZIsr9qL.js → use-session-canvas-OdljtBE8.js} +4 -4
  207. package/dist/client/assets/{use-session-diagnostics-C41hV7rK.js → use-session-diagnostics-CtjxsM8_.js} +4 -4
  208. package/dist/client/assets/use-unclaimed-chats-5RCD5wIp.js +1 -0
  209. package/dist/client/assets/use-update-config-xkznZMHr.js +1 -0
  210. package/dist/client/assets/useMutationState-Mjr_y4xX.js +1 -0
  211. package/dist/client/index.html +2 -2
  212. package/dist/server/index.js +11367 -9690
  213. package/dist/server/index.js.map +2 -2
  214. package/package.json +4 -4
  215. package/dist/client/assets/ActivityPage-CHUqb-8c.js +0 -1
  216. package/dist/client/assets/AdapterIcon-C_fBZXHQ.js +0 -1
  217. package/dist/client/assets/AppearancePage-t9SnSRs-.js +0 -1
  218. package/dist/client/assets/AttentionSignalRow-jlgWaSSd.js +0 -1
  219. package/dist/client/assets/CanvasFileContent-BejM-9Wg.js +0 -2
  220. package/dist/client/assets/CanvasModel3dContent-BD-eCVsX.js +0 -2
  221. package/dist/client/assets/CommitmentList-YVb3yTvO.js +0 -1
  222. package/dist/client/assets/ConnectionAccessLists-BPsgToSR.js +0 -1
  223. package/dist/client/assets/ConnectionsPage-D7vlYnjf.js +0 -6
  224. package/dist/client/assets/ConventionPage-BR7I3AdE.js +0 -11
  225. package/dist/client/assets/HandlePage-B33P0oh0.js +0 -1
  226. package/dist/client/assets/HeartbeatPage-CfjZuvtQ.js +0 -1
  227. package/dist/client/assets/McpSigninBody-DBWSc6bm.js +0 -1
  228. package/dist/client/assets/NamePage-MfybpnwN.js +0 -1
  229. package/dist/client/assets/OperatorIdentityForm-DH2au7QU.js +0 -1
  230. package/dist/client/assets/PermissionsPage-BgLLmdg2.js +0 -1
  231. package/dist/client/assets/PhotoPage-BgyB3B2_.js +0 -1
  232. package/dist/client/assets/PromptSuggestionChips-EO_0zbzq.js +0 -1
  233. package/dist/client/assets/ReportsToPopover-C9Ceg1AW.js +0 -1
  234. package/dist/client/assets/RoomSurface-B8ec3_at.js +0 -44
  235. package/dist/client/assets/RunsOnPopover-CJoSj8w7.js +0 -1
  236. package/dist/client/assets/RuntimeSetupDialog-Cqn_Grel.js +0 -1
  237. package/dist/client/assets/SkillsPage-DL0909et.js +0 -1
  238. package/dist/client/assets/TasksPage-BwUW6dia.js +0 -1
  239. package/dist/client/assets/TourHost-Db0fxAXo.js +0 -1
  240. package/dist/client/assets/_shell-CGWsN6Gs.js +0 -88
  241. package/dist/client/assets/_shell._home.activity-BbWquOK0.js +0 -1
  242. package/dist/client/assets/_shell._home.index-Cg0nRFMN.js +0 -3
  243. package/dist/client/assets/_shell._home.tasks-BpoOVihw.js +0 -1
  244. package/dist/client/assets/_shell._home.workspaces-DVF1rM3t.js +0 -1
  245. package/dist/client/assets/_shell.connections-0_34lXIQ.js +0 -1
  246. package/dist/client/assets/_shell.marketplace-Dp-p8E3V.js +0 -1
  247. package/dist/client/assets/_shell.marketplace_.sources-SN2Fb1eb.js +0 -1
  248. package/dist/client/assets/_shell.session-Bt3jdQdD.js +0 -66
  249. package/dist/client/assets/_shell.x._extensionId-Bjn-MKsP.js +0 -1
  250. package/dist/client/assets/_shell.x._extensionId_._-Bjn-MKsP.js +0 -1
  251. package/dist/client/assets/index-BBQMqcO_.js +0 -1
  252. package/dist/client/assets/index-BUVKya1M.js +0 -23
  253. package/dist/client/assets/index-C3xuhmPa.js +0 -38
  254. package/dist/client/assets/index-C63bLSO4.js +0 -1099
  255. package/dist/client/assets/index-CTxEG5rD.js +0 -1
  256. package/dist/client/assets/index-CkknQ52Q.js +0 -17
  257. package/dist/client/assets/index-DLNwEM2Q.js +0 -1
  258. package/dist/client/assets/index-DX-j3Ul0.js +0 -1
  259. package/dist/client/assets/index-g_5oOlG6.js +0 -1
  260. package/dist/client/assets/index-t7gsOfUI.js +0 -1
  261. package/dist/client/assets/kickoff-xkt4LpIP.js +0 -3
  262. package/dist/client/assets/soul-file-NcuTUIiB.js +0 -1
  263. package/dist/client/assets/use-delete-binding-C19umm_i.js +0 -1
  264. package/dist/client/assets/use-external-adapter-catalog-BOn9aj72.js +0 -1
  265. package/dist/client/assets/use-full-activity-feed-BpQANbns.js +0 -1
  266. package/dist/client/assets/use-is-below-desktop-5LlietdR.js +0 -1
  267. package/dist/client/assets/use-mesh-topology-CIsDeAY0.js +0 -1
  268. package/dist/client/assets/use-pending-read-Dol8yvIx.js +0 -1
  269. package/dist/client/assets/use-personality-commit-fUtuc2lC.js +0 -1
  270. package/dist/client/assets/use-unclaimed-chats-BMlFQ2v1.js +0 -1
@@ -1 +1 @@
1
- import{ae as R,af as b,ag as j,ek as x,cT as P,el as C,r as d,j as e,cY as k,cZ as E,c_ as M,c$ as T,d0 as K,dd as I,e5 as L,I as F,aC as N,B as D,dH as O,dI as _,em as B,f as H,dJ as Q,dK as Y,en as q}from"./index-C63bLSO4.js";function w(t){return Promise.all([t.invalidateQueries({queryKey:x.lists()}),t.invalidateQueries({queryKey:x.details()}),t.invalidateQueries({queryKey:x.threads()})]).then(()=>{})}function S(t){return(t==null?void 0:t.code)==="SLUG_TAKEN"}function $({isInlineErrorVisible:t}){const n=R(),r=b();return j({mutationFn:({title:a,agentPaths:l})=>n.createRoom({kind:"channel",title:a,members:[],agentPaths:l}),onSuccess:()=>w(r),meta:{suppressErrorToast:!0},onError:a=>{S(a)&&t()||P.error("Couldn’t create that channel.",{description:a.message})}})}function U(){const t=R(),n=b();return j({mutationFn:({agentPaths:r,title:a})=>t.createRoom({kind:"dm",title:a,members:[],agentPaths:r}),onSettled:()=>w(n),meta:{errorLabel:"Couldn’t start that DM"}})}const y=200;function W({open:t,onOpenChange:n,onCreated:r}){const a=C(),[l,m]=d.useState(""),h=d.useRef(null),c=d.useRef(null),u=d.useRef(!0);d.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const o=$({isInlineErrorVisible:()=>u.current}),g=S(o.error)?o.error.message:null,f=l.trim(),p=f.length>0&&f.length<=y,v=s=>{!p||o.isPending||o.mutate({title:f,agentPaths:s.map(i=>i.agentPath)},{onSuccess:i=>{n(!1),r(i)}})},A=s=>{var i;s.key==="Enter"&&(s.preventDefault(),p&&((i=c.current)==null||i.focus()))};return e.jsx(k,{open:t,onOpenChange:n,children:e.jsxs(E,{className:"sm:max-w-md",onOpenAutoFocus:s=>{var i;s.preventDefault(),(i=h.current)==null||i.focus()},children:[e.jsxs(M,{children:[e.jsx(T,{children:"New channel"}),e.jsx(K,{children:"Name it, then pick who’s in it."})]}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"channel-name",children:"Channel name"}),e.jsx(F,{ref:h,id:"channel-name",value:l,maxLength:y,placeholder:"Backend",autoComplete:"off",onChange:s=>{m(s.target.value),o.error&&o.reset()},onKeyDown:A,"aria-invalid":g?!0:void 0,"aria-describedby":g?"channel-name-error":void 0}),g&&e.jsx("p",{id:"channel-name-error",role:"alert",className:"text-destructive text-xs",children:g})]}),e.jsxs("section",{"aria-label":"Agents in this channel",className:"space-y-2 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Who’s in it"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Agents read everything here and reply when @mentioned."}),e.jsx(N,{roster:a,onSubmit:v,submitLabel:s=>s.length===0?"Create channel":s.length===1?"Create channel with 1 agent":`Create channel with ${s.length} agents`,emptyRosterMessage:"You don’t have any agents yet. You can add them to the channel later.",allChosenMessage:"That’s every agent you have.",isSubmitting:o.isPending,submitDisabled:!p,inputRef:c})]}),e.jsx("div",{className:"flex justify-center border-t pt-3",children:e.jsx(D,{type:"button",variant:"ghost",size:"sm",disabled:!p||o.isPending,onClick:()=>v([]),children:"Create it without agents"})})]})]})})}const z="One agent opens a chat. Two or more start a group message.";function G(t){return t.length===1}function V(t){const n=t[0];return n!==void 0&&G(t)?`Open chat with ${n.displayName}`:"Start group message"}function X({onStart:t,open:n,onOpenChange:r,hideTrigger:a=!1}){const l=C(),m=d.useRef(null),h=()=>{r(!1),q.getState().open()};return e.jsxs(O,{open:n,onOpenChange:r,modal:!0,fullHeight:!0,children:[e.jsx(_,{asChild:!0,children:e.jsx(B,{...a?{"aria-hidden":!0,tabIndex:-1,className:"sr-only"}:{"aria-label":"New message"},children:e.jsx(H,{})})}),e.jsxs(Q,{side:"right",align:"start",className:"flex w-64 flex-col p-2","aria-label":"New message",onOpenAutoFocus:c=>{var u;c.preventDefault(),(u=m.current)==null||u.focus()},children:[e.jsx(Y,{children:"New message"}),e.jsx(N,{inputRef:m,roster:l,onSubmit:c=>{r(!1),t(c)},submitLabel:V,emptyRosterMessage:"You don’t have any agents yet.",emptyRosterAction:e.jsx(D,{type:"button",size:"sm",variant:"outline",onClick:h,children:"Create agent"}),allChosenMessage:"Everyone is already here."}),e.jsx("p",{className:"text-muted-foreground mt-2 shrink-0 px-2 text-xs",children:z})]})]})}export{W as C,X as N,z as O,G as a,V as o,U as u};
1
+ import{a8 as b,aa as R,ab as j,bs as x,ae as P,ef as C,r as d,j as e,cE as E,cF as M,cH as k,cI as K,cJ as T,dB as I,e1 as L,I as F,aK as N,B as D,bG as B,bH as H,eg as O,f as Q,bI as _,bK as q,eh as G}from"./index-CdKpQ1hI.js";function w(t){return Promise.all([t.invalidateQueries({queryKey:x.lists()}),t.invalidateQueries({queryKey:x.details()}),t.invalidateQueries({queryKey:x.threads()})]).then(()=>{})}function S(t){return(t==null?void 0:t.code)==="SLUG_TAKEN"}function Y({isInlineErrorVisible:t}){const n=b(),r=R();return j({mutationFn:({title:a,agentPaths:l})=>n.createRoom({kind:"channel",title:a,members:[],agentPaths:l}),onSuccess:()=>w(r),meta:{suppressErrorToast:!0},onError:a=>{S(a)&&t()||P.error("Couldn’t create that channel.",{description:a.message})}})}function U(){const t=b(),n=R();return j({mutationFn:({agentPaths:r,title:a})=>t.createRoom({kind:"dm",title:a,members:[],agentPaths:r}),onSettled:()=>w(n),meta:{errorLabel:"Couldn’t start that DM"}})}const y=200;function W({open:t,onOpenChange:n,onCreated:r}){const a=C(),[l,m]=d.useState(""),h=d.useRef(null),c=d.useRef(null),u=d.useRef(!0);d.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const o=Y({isInlineErrorVisible:()=>u.current}),g=S(o.error)?o.error.message:null,f=l.trim(),p=f.length>0&&f.length<=y,v=s=>{!p||o.isPending||o.mutate({title:f,agentPaths:s.map(i=>i.agentPath)},{onSuccess:i=>{n(!1),r(i)}})},A=s=>{var i;s.key==="Enter"&&(s.preventDefault(),p&&((i=c.current)==null||i.focus()))};return e.jsx(E,{open:t,onOpenChange:n,children:e.jsxs(M,{className:"sm:max-w-md",onOpenAutoFocus:s=>{var i;s.preventDefault(),(i=h.current)==null||i.focus()},children:[e.jsxs(k,{children:[e.jsx(K,{children:"New channel"}),e.jsx(T,{children:"Name it, then pick who’s in it."})]}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"channel-name",children:"Channel name"}),e.jsx(F,{ref:h,id:"channel-name",value:l,maxLength:y,placeholder:"Backend",autoComplete:"off",onChange:s=>{m(s.target.value),o.error&&o.reset()},onKeyDown:A,"aria-invalid":g?!0:void 0,"aria-describedby":g?"channel-name-error":void 0}),g&&e.jsx("p",{id:"channel-name-error",role:"alert",className:"text-destructive text-xs",children:g})]}),e.jsxs("section",{"aria-label":"Agents in this channel",className:"space-y-2 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Who’s in it"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Agents read everything here and reply when @mentioned."}),e.jsx(N,{roster:a,onSubmit:v,submitLabel:s=>s.length===0?"Create channel":s.length===1?"Create channel with 1 agent":`Create channel with ${s.length} agents`,emptyRosterMessage:"You don’t have any agents yet. You can add them to the channel later.",allChosenMessage:"That’s every agent you have.",isSubmitting:o.isPending,submitDisabled:!p,inputRef:c})]}),e.jsx("div",{className:"flex justify-center border-t pt-3",children:e.jsx(D,{type:"button",variant:"ghost",size:"sm",disabled:!p||o.isPending,onClick:()=>v([]),children:"Create it without agents"})})]})]})})}const z="One agent opens a chat. Two or more start a group message.";function V(t){return t.length===1}function $(t){const n=t[0];return n!==void 0&&V(t)?`Open chat with ${n.displayName}`:"Start group message"}function X({onStart:t,open:n,onOpenChange:r,hideTrigger:a=!1}){const l=C(),m=d.useRef(null),h=()=>{r(!1),G.getState().open()};return e.jsxs(B,{open:n,onOpenChange:r,modal:!0,fullHeight:!0,children:[e.jsx(H,{asChild:!0,children:e.jsx(O,{...a?{"aria-hidden":!0,tabIndex:-1,className:"sr-only"}:{"aria-label":"New message"},children:e.jsx(Q,{})})}),e.jsxs(_,{side:"right",align:"start",className:"flex w-64 flex-col p-2","aria-label":"New message",onOpenAutoFocus:c=>{var u;c.preventDefault(),(u=m.current)==null||u.focus()},children:[e.jsx(q,{children:"New message"}),e.jsx(N,{inputRef:m,roster:l,onSubmit:c=>{r(!1),t(c)},submitLabel:$,emptyRosterMessage:"You don’t have any agents yet.",emptyRosterAction:e.jsx(D,{type:"button",size:"sm",variant:"outline",onClick:h,children:"Create agent"}),allChosenMessage:"Everyone is already here."}),e.jsx("p",{className:"text-muted-foreground mt-2 shrink-0 px-2 text-xs",children:z})]})]})}export{W as C,X as N,z as O,V as a,$ as o,U as u};
@@ -1 +1 @@
1
- import{j as t,z as s}from"./index-C63bLSO4.js";function o({member:e}){var n;const i=((n=e.agent)==null?void 0:n.manifestId)??null;return i===null?t.jsx("div",{className:"min-h-0 flex-1 px-4 py-3","data-slot":"profile-notifications",children:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Notifications are set per agent."})}):t.jsx("div",{className:"min-h-0 flex-1 px-2 py-2","data-slot":"profile-notifications",children:t.jsx(s,{lens:{agentId:i},emptyLabel:`${e.displayName} has not told you anything yet.`})})}export{o as NotificationsPage};
1
+ import{j as t,w as s}from"./index-CdKpQ1hI.js";function o({member:e}){var n;const i=((n=e.agent)==null?void 0:n.manifestId)??null;return i===null?t.jsx("div",{className:"min-h-0 flex-1 px-4 py-3","data-slot":"profile-notifications",children:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Notifications are set per agent."})}):t.jsx("div",{className:"min-h-0 flex-1 px-2 py-2","data-slot":"profile-notifications",children:t.jsx(s,{lens:{agentId:i},emptyLabel:`${e.displayName} has not told you anything yet.`})})}export{o as NotificationsPage};
@@ -1,5 +1,5 @@
1
- import{eo as A,r as f,ep as K,eq as T,ae as p,aj as _,af as m,ag as v,er as M,j as d,es as S,dz as j,Z as R}from"./index-C63bLSO4.js";import{u as w}from"./use-mesh-topology-CIsDeAY0.js";const O={activeWithinMs:3600*1e3,inactiveAfterMs:10080*60*1e3};function P(e){if(e.liveKinds.includes("pendingApproval")||e.liveKinds.includes("error")||e.hasBrokenExecutionConfig===!0)return"needs-attention";if(e.liveKinds.includes("streaming"))return"active";if(e.lastActivityAt===null)return"fresh";if(e.now-e.lastActivityAt<=O.activeWithinMs)return"active";const s=Math.max(e.lastActivityAt,e.lastInteractionAt??e.lastActivityAt);return e.now-s>O.inactiveAfterMs?"inactive":"idle"}function q(e,t,s){var a;const n=new Map;for(const[i,o]of Object.entries(e)){if(!s.has(o))continue;const r=T((a=t[i])==null?void 0:a.lifecycle);if(!r)continue;const c=n.get(o);c?c.push(r):n.set(o,[r])}return n}const x=Object.freeze({});function B(e,t=[],s=x){const n=e.join(`
1
+ import{ej as A,r as f,ek as K,el as T,a8 as p,a9 as _,aa as O,ab as v,em as M,j as d,en as S,cB as j,Q as R}from"./index-CdKpQ1hI.js";import{u as w}from"./use-mesh-topology-NaUKSKol.js";const m={activeWithinMs:3600*1e3,inactiveAfterMs:10080*60*1e3};function P(e){if(e.liveKinds.includes("pendingApproval")||e.liveKinds.includes("error")||e.hasBrokenExecutionConfig===!0)return"needs-attention";if(e.liveKinds.includes("streaming"))return"active";if(e.lastActivityAt===null)return"fresh";if(e.now-e.lastActivityAt<=m.activeWithinMs)return"active";const s=Math.max(e.lastActivityAt,e.lastInteractionAt??e.lastActivityAt);return e.now-s>m.inactiveAfterMs?"inactive":"idle"}function x(e,t,s){var a;const n=new Map;for(const[i,o]of Object.entries(e)){if(!s.has(o))continue;const r=T((a=t[i])==null?void 0:a.lifecycle);if(!r)continue;const c=n.get(o);c?c.push(r):n.set(o,[r])}return n}const q=Object.freeze({});function F(e,t=[],s=q){const n=e.join(`
2
2
  `),a=t.join(`
3
3
  `),i=A(f.useCallback(u=>u.statusCwds,[])),o=A(f.useCallback(u=>u.statuses,[])),{data:r}=K(),c=r==null?void 0:r.agentActivity;return f.useMemo(()=>{const u=n.length===0?[]:n.split(`
4
4
  `),N=new Set(a.length===0?[]:a.split(`
5
- `)),b=q(i,o,new Set(u)),k=Date.now(),y={};for(const l of u){const g=c==null?void 0:c[l];y[l]=P({liveKinds:b.get(l)??[],lastActivityAt:g?new Date(g).getTime():null,lastInteractionAt:s[l]??null,now:k,hasBrokenExecutionConfig:N.has(l)})}return y},[n,a,i,o,c,s])}function z(e){const t=p();return _({queryKey:["mesh","agent-health",e],queryFn:()=>t.getMeshAgentHealth(e),enabled:e!==null})}const h=["mesh","topology"];function W(){const e=p(),t=m();return v({mutationFn:s=>e.updateMeshAccessRule(s),onSuccess:()=>{t.invalidateQueries({queryKey:h})}})}function E(){const e=p(),t=m();return v({mutationFn:s=>e.updateMeshAccessRule({sourceNamespace:M,targetNamespace:M,action:s?"allow":"deny"}),onMutate:async s=>{await t.cancelQueries({queryKey:h});const n=t.getQueriesData({queryKey:h});return t.setQueriesData({queryKey:h},a=>a&&{...a,openMesh:s}),{previous:n}},onError:(s,n,a)=>{for(const[i,o]of(a==null?void 0:a.previous)??[])t.setQueryData(i,o)},onSettled:()=>{t.invalidateQueries({queryKey:h})}})}const C="Let all my agents talk to each other",L="On: any agent can message any other. Off: same project, plus pairs below.",D="New agents reach only their own project. Change it later in Team → Access.";function H({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(S,{label:C,description:L,checked:e,onCheckedChange:t,disabled:s,className:n})}function Q({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(S,{label:C,description:D,checked:e,onCheckedChange:t,disabled:s,className:R("bg-muted/40 rounded-xl px-4 py-3",n)})}function Y(){const{data:e}=w(),{mutate:t,isPending:s}=E();return d.jsx(H,{checked:(e==null?void 0:e.openMesh)??!1,onCheckedChange:t,disabled:s})}function G({className:e}){const{data:t}=w(),{data:s}=j(),{mutate:n,isPending:a}=E(),i=((s==null?void 0:s.agents)??[]).filter(o=>!o.isSystem).length;return(t==null?void 0:t.openMesh)!==!1||i===0?null:d.jsx(Q,{checked:!1,onCheckedChange:n,disabled:a,className:e})}export{Y as O,W as a,z as b,E as c,G as d,B as u};
5
+ `)),b=x(i,o,new Set(u)),k=Date.now(),y={};for(const l of u){const g=c==null?void 0:c[l];y[l]=P({liveKinds:b.get(l)??[],lastActivityAt:g?new Date(g).getTime():null,lastInteractionAt:s[l]??null,now:k,hasBrokenExecutionConfig:N.has(l)})}return y},[n,a,i,o,c,s])}function W(e){const t=p();return _({queryKey:["mesh","agent-health",e],queryFn:()=>t.getMeshAgentHealth(e),enabled:e!==null})}const h=["mesh","topology"];function Y(){const e=p(),t=O();return v({mutationFn:s=>e.updateMeshAccessRule(s),onSuccess:()=>{t.invalidateQueries({queryKey:h})}})}function E(){const e=p(),t=O();return v({mutationFn:s=>e.updateMeshAccessRule({sourceNamespace:M,targetNamespace:M,action:s?"allow":"deny"}),onMutate:async s=>{await t.cancelQueries({queryKey:h});const n=t.getQueriesData({queryKey:h});return t.setQueriesData({queryKey:h},a=>a&&{...a,openMesh:s}),{previous:n}},onError:(s,n,a)=>{for(const[i,o]of(a==null?void 0:a.previous)??[])t.setQueryData(i,o)},onSettled:()=>{t.invalidateQueries({queryKey:h})}})}const C="Let all my agents talk to each other",L="On: any agent can message any other. Off: same project, plus pairs below.",Q="New agents reach only their own project. Change it later in Team → Access.";function D({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(S,{label:C,description:L,checked:e,onCheckedChange:t,disabled:s,className:n})}function H({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(S,{label:C,description:Q,checked:e,onCheckedChange:t,disabled:s,className:R("bg-muted/40 rounded-xl px-4 py-3",n)})}function z(){const{data:e}=w(),{mutate:t,isPending:s}=E();return d.jsx(D,{checked:(e==null?void 0:e.openMesh)??!1,onCheckedChange:t,disabled:s})}function G({className:e}){const{data:t}=w(),{data:s}=j(),{mutate:n,isPending:a}=E(),i=((s==null?void 0:s.agents)??[]).filter(o=>!o.isSystem).length;return(t==null?void 0:t.openMesh)!==!1||i===0?null:d.jsx(H,{checked:!1,onCheckedChange:n,disabled:a,className:e})}export{z as O,Y as a,W as b,G as c,F as u};
@@ -0,0 +1 @@
1
+ import{bp as j,fk as F,fl as H,b0 as x,r as g,ca as P,fm as w,fn as B,a8 as D,a9 as G,b$ as q,bW as K,fo as M,L as Y,bq as W,j as i,e1 as N,I as A,B as R}from"./index-CdKpQ1hI.js";import{d as z,c as Q,n as U,h as V}from"./profile-errors-CqflLCzu.js";import{u as $}from"./use-mounted-ref-BWpQ8f91.js";import{u as L,F as I}from"./ProfileFields-BCfMzNcT.js";function J(e){return{name:e.displayName.trim()===""||e.displayName===j,handle:!e.handle}}function le(e){const r=J(e);return r.name||r.handle}function X(e,r){var t,s,d;const a=(d=(s=(t=e.person)==null?void 0:t.email)==null?void 0:s.split("@")[0])==null?void 0:d.trim();if(!a)return"";const o=new Set([...F,...r.filter(l=>l.id!==e.id&&l.handle).map(l=>l.handle.toLowerCase())]);return H(a,o)??""}function ie(){const e=x(a=>a.setRightPanelOpen),r=x(a=>a.setActiveRightPanelTab);g.useEffect(()=>{const a=o=>{if((o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="A"){o.preventDefault();const{rightPanelOpen:t,activeRightPanelTab:s}=x.getState();t&&s===P?e(!1):(r(P),e(!0))}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r])}const Z="agent-hub",ee={sessions:"sessions",tasks:"tasks",tools:"tools",channels:"rooms",config:null,toolkit:null,identity:null,overview:null,profile:null,personality:null};function te(e){return(typeof e=="string"?ee[e]:null)??void 0}const k=new Set(["identity","personality","channels","tools"]);function ce(){var n;const e=w(),r=D(),a=G({queryKey:["profile-location",e.profileRef],queryFn:()=>r.getSessionLocation(e.profileRef),enabled:!!e.profileRef}),o=q(h=>h.openProfileDockedFromLink),t=x(h=>h.requestRightPanel),s=x(h=>h.setExplicitAgentPath),d=K(),l=e.panel===P,c=e.agentPath??((n=a.data)==null?void 0:n.cwd)??null,u=M(e.profilePage)??void 0,m=g.useRef(null);g.useEffect(()=>{!l&&c&&m.current!==c&&(m.current=c,s(c))},[l,c,s]);const f=g.useRef(new Map);g.useEffect(()=>{if(!l){f.current.clear();return}if(e.profileRef&&!c)return;const h=c??d;if(h){const p=f.current.get(h);if(p!==void 0&&(u===void 0||p.has(u)))return;f.current.set(h,(p??new Set).add(u??"")),o(h,u);return}t(P,null)},[l,e.profileRef,c,d,u,o,t])}function de(){const e=w(),r=B(),a=D(),o=e.panel===Z,t=e.dialog==="agent"||!!e.agent&&k.has(e.agent),s=o||t,d=o?e.hubTab:e.agent;g.useEffect(()=>{if(!s&&!e.agentPath||!r)return;let l=!1;return(async()=>{const u=e.profileRef??(e.agentPath?(await a.createSessionLocation(e.agentPath)).id:void 0);if(l)return;const m=te(d);r({search:f=>{const n={...f};return e.dialog==="agent"&&delete n.dialog,typeof n.agent=="string"&&k.has(n.agent)&&delete n.agent,u&&(n.profileRef=u,delete n.agentPath),s&&(delete n.hubTab,n.panel=P,m?n.profilePage=m:delete n.profilePage),n},replace:!0})})().catch(()=>{}),()=>{l=!0}},[s,e.dialog,e.agentPath,e.profileRef,d,r,a])}function ae(){var b,S;const r=((b=Y().data)==null?void 0:b.members)??[],a=r.find(y=>y.isSelf),o=$(),t=z({isShownInline:()=>o.current}),s=Q({isShownInline:()=>o.current}),[d,l]=g.useState(!1),c=!a||a.displayName===j?"":a.displayName,u=(a==null?void 0:a.handle)??"",[m,f]=L(c),[n,h]=L(a?u||X(a,r):""),p=m.trim(),v=n.trim(),E=a?W(a):null,T=p.length>0&&(p!==c||E!==null),C=t.isError&&t.variables===p?U(t.error):null,O=s.isError&&((S=s.variables)==null?void 0:S.handle)===v?V(s.error,v):null,_=async()=>{if(!a)return!1;l(!0);let y=!0;return T&&(y=await t.mutateAsync(p).then(()=>y,()=>!1)),v&&v!==u&&(y=await s.mutateAsync({authorId:a.id,handle:v}).then(()=>y,()=>!1)),l(!1),y};return{ready:a!==void 0,name:m,setName:f,handle:n,setHandle:h,canSave:a!==void 0&&!d&&(p.length>0||v.length>0),saving:d,nameError:C,nameSuggestion:E!==null&&p===c?E:null,handleError:O,save:_}}function ue({onSaved:e,confirmLabel:r="Save",onSkip:a,skipLabel:o="Skip"}){const t=ae(),s=g.useId(),d=g.useId(),l=g.useId(),c=f=>{f.preventDefault(),t.canSave&&t.save().then(n=>{n&&e()})},u=t.nameError!==null||t.handleError!==null;let m=r;return t.saving?m="Saving…":u&&(m="Try again"),i.jsxs("form",{onSubmit:c,className:"flex flex-col gap-3","data-testid":"operator-identity-form",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:s,className:"text-xs",children:"Your name"}),i.jsx(A,{id:s,value:t.name,maxLength:80,autoComplete:"name",placeholder:"What you go by",disabled:!t.ready,onChange:f=>t.setName(f.target.value),className:"h-8 text-sm"}),t.nameSuggestion&&!t.nameError&&i.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.nameSuggestion,". Save it to make it yours."]}),t.nameError&&i.jsx(I,{tone:"error",children:t.nameError})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:d,className:"text-xs",children:"Handle"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-sm",children:"@"}),i.jsx(A,{id:d,value:t.handle,maxLength:64,autoComplete:"username",autoCapitalize:"none",spellCheck:!1,placeholder:"yourname","aria-describedby":l,disabled:!t.ready,onChange:f=>t.setHandle(f.target.value),className:"h-8 pl-6 text-sm"})]}),i.jsx("p",{id:l,className:"text-muted-foreground text-xs",children:"What others type after @ to reach you."}),t.handleError&&i.jsx(I,{tone:"error",children:t.handleError})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx(R,{type:"submit",size:"sm",disabled:!t.canSave,"data-testid":"confirm-identity",children:m}),a&&i.jsx(R,{type:"button",size:"sm",variant:"ghost",onClick:a,disabled:t.saving,"data-testid":"skip-identity",children:o})]})]})}export{ue as O,ce as a,ie as b,le as i,de as u};
@@ -0,0 +1 @@
1
+ import{j as s,eL as A,eM as P,Q as k,gf as Y,a8 as E,a9 as q,g6 as R,r as N,aa as Z,ab as ee,aA as se,ae as te,bg as ne,B as x,h5 as v,bG as L,bH as U,C as W,bI as D,bK as H,$ as ae,g7 as f,h6 as w,gv as K,gw as _,e as C,be as ie,h7 as le}from"./index-CdKpQ1hI.js";import{u as y,c as re,a as p,l as B,S as g,P as b,s as z,d as T,f as $,b as M,e as S,g as oe,A as de}from"./ApplyToOverridesDialog-jqOFh0d1.js";const I=[{value:"blocked",label:"Blocked"},{value:"ask",label:"Ask"},{value:"allowed",label:"Allowed"}];function Q({value:e,onChange:t,floor:n=!1,disabled:a=!1,className:l,"aria-label":o}){const d=n?I.filter(i=>i.value!=="allowed"):I;return s.jsx(A,{"aria-label":o,value:e??"",onValueChange:i=>t(i),disabled:a,className:k("w-full md:w-auto",l),children:d.map(i=>s.jsx(P,{value:i.value,className:k(Y,"md:min-h-0 md:min-w-16"),children:i.label},i.value))})}function ce(e){const t=E();return q({queryKey:R.agent(e??""),queryFn:()=>t.getAgentPermissions(e),enabled:!!e})}function ue(e){const{data:t}=y();return N.useMemo(()=>{const n=new Map;for(const a of(t==null?void 0:t.exceptions)??[]){if(a.area!==e)continue;const l=n.get(a.agentId);(!l||l.action&&!a.action)&&n.set(a.agentId,a)}return[...n.values()]},[t,e])}function me(e){const t=E();return q({queryKey:R.history(e),queryFn:()=>t.getPermissionHistory(e?{agentId:e,limit:50}:{limit:50})})}function he(e){var n;const t=e;return(t==null?void 0:t.code)!=="UNDO_CONFLICT"?null:((n=t.body)==null?void 0:n.conflicts)??[]}function xe(){const e=E(),t=Z();return ee({mutationFn:({eventId:n,force:a})=>e.undoPermissionChange(n,a?{force:!0}:{}),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:R.all}),t.invalidateQueries({queryKey:["mesh","agents"]}),t.invalidateQueries({queryKey:se.all})}})}function F(e){const{data:t}=y();return t?re(t,e):void 0}function j(e){te.error(e instanceof Error&&e.message?e.message:"Couldn’t save that change. Try again.")}function V({areaId:e,label:t,description:n,floor:a,value:l,sourceText:o,why:d,changed:i=!1,onChange:m,onReset:r,disabled:u=!1,footer:c,details:h}){return s.jsxs("div",{className:"@container","data-testid":`permission-row-${e}`,children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[i?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:t}),a?s.jsx(ne,{className:"text-muted-foreground size-3.5","aria-label":"Never Allowed"}):null]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:n}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:o}),d?s.jsxs(s.Fragment,{children:[o?" · ":null,d]}):null]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(Q,{value:l,onChange:m,floor:a,disabled:u,"aria-label":t}),i&&r?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:r,disabled:u,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null,c]})]}),h]})}function ge({area:e,exception:t}){const n=p({kind:"agent",agentId:t.agentId}),a=()=>n.mutate({kind:"patch",...t.action?{actions:{[t.action]:null}}:{areas:{[e]:null}},surface:"settings"}),l=B(t.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[t.agentName,": ",g[t.state],t.action?" (one action)":""]}),l?s.jsx("span",{className:"text-muted-foreground block text-xs",children:l}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",onClick:a,disabled:n.isPending,"aria-label":`Reset ${t.agentName} to the default`,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function fe({area:e,areaLabel:t,agents:n}){if(n.length===0)return null;const a=n.length===1?"1 agent differs":`${n.length} agents differ`;return s.jsxs(L,{children:[s.jsx(U,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start md:self-end",children:[a,s.jsx(W,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(D,{className:"w-80 space-y-2",children:[s.jsxs(H,{className:"text-sm font-medium",children:["Set differently for ",t]}),s.jsx("ul",{className:"space-y-1",children:n.map(l=>s.jsx(ge,{area:e,exception:l},l.agentId))})]})]})}function G(e,t){return e.resolved.source===(t.kind==="agent"?"agent-action":"default-action")}function J({action:e,preset:t,agentName:n}){const a=g[e.resolved.state];return s.jsx(b,{question:`Why is ${e.title} set to ${a}${n?` for ${n}`:""}?`,sentence:z({...e.resolved,preset:t,fromExtension:e.source!==void 0}),...e.lastChange?{lastChange:e.lastChange}:{}})}function pe({action:e,area:t,scope:n,preset:a,agentName:l,disabled:o,reset:d,onSave:i}){const m=G(e,n),r=F({kind:"action",action:e.id,area:t.id}),u=m?"Set on its own":e.alwaysAsks?e.source?"Always asks: an extension tool that can delete things":"Always asks, so you see the change first":e.resolved.destructiveAsk?"Always asks unless you set it here":`Follows ${t.label}`,c=n.kind==="default"&&r!==void 0?T(r):null;return s.jsxs("li",{className:"flex flex-col gap-2 py-2 @md:flex-row @md:items-center @md:justify-between","data-testid":`permission-action-${e.id}`,children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm",children:e.title}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.source?s.jsxs("span",{children:["From ",e.source.name," · "]}):null,s.jsx("span",{children:u}),c?s.jsxs("span",{children:[" · ",c]}):null," ·"," ",s.jsx(J,{action:e,preset:a,...l?{agentName:l}:{}})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[m?d:null,s.jsx(Q,{value:e.resolved.state,floor:t.floor||e.alwaysAsks===!0,disabled:o,"aria-label":e.title,onChange:h=>{h!==e.resolved.state&&i(h)}})]})]})}function X({scope:e,area:t,surface:n,preset:a,agentName:l}){const o=p(e),[d,i]=N.useState(!1);if(t.actions.length===0)return null;const m=t.actions.filter(c=>G(c,e)),r=(c,h)=>o.mutate({kind:"patch",actions:{[c.id]:h},surface:n},{onError:j}),u=c=>s.jsxs(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:o.isPending,"aria-label":`Put ${c.title} back to ${t.label}`,onClick:()=>r(c,null),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]});return s.jsxs("div",{className:"flex flex-col items-start gap-1 pb-3","data-testid":`permission-actions-${t.id}`,children:[!d&&m.length>0?s.jsx("ul",{className:"w-full space-y-1","data-testid":`permission-action-exceptions-${t.id}`,children:m.map(c=>s.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[s.jsxs("span",{className:"text-muted-foreground min-w-0",children:[s.jsxs("span",{children:["Except ",c.title,": ",g[c.resolved.state]]})," ","·"," ",s.jsx(J,{action:c,preset:a,...l?{agentName:l}:{}})]}),u(c)]},c.id))}):null,s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground -ml-2 h-7 px-2 text-xs","aria-expanded":d,onClick:()=>i(c=>!c),children:[s.jsx(ae,{className:k("size-3.5 transition-transform",d&&"rotate-180"),"aria-hidden":!0}),d?"Hide individual actions":"Show individual actions"]}),d?s.jsx("ul",{className:"divide-border w-full divide-y","aria-label":`${t.label} actions`,children:t.actions.map(c=>s.jsx(pe,{action:c,area:t,scope:e,preset:a,...l?{agentName:l}:{},disabled:o.isPending,reset:u(c),onSave:h=>r(c,h)},c.id))}):null]})}function je({agentId:e,agentName:t,files:n}){const a=p({kind:"agent",agentId:e}),l=n.source==="agent",o=n.inherited.stop,d=n.stop,i=r=>a.mutate({kind:"patch",filesAndCommands:r,surface:"agent-page"},{onError:j}),m=o?`${l?`Everyone else: ${f(o)}`:`Same as everyone (${f(o)})`}${n.inherited.source==="runtime"?` · ${$("runtime")}`:""}`:$(n.inherited.source);return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[l?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands in this agent’s chats"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:m})," ·"," ",s.jsx(b,{question:`Why is Files & commands ${d?`set to ${f(d)}`:"not set"} for ${t}?`,sentence:M(d,n.source),...n.lastChange?{lastChange:n.lastChange}:{}})]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:d??"",disabled:a.isPending,onValueChange:r=>{r&&r!==d&&i(r)},children:w.map(r=>s.jsxs(P,{value:r.id,"aria-label":r.label,children:[s.jsx(K,{descriptor:r,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:r.label})]},r.id))}),l?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:()=>i(null),disabled:a.isPending,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null]})]}),s.jsx(_,{descriptor:w.find(r=>r.stop===d),className:"pb-3"})]})}function Ee({files:e,preset:t,onChange:n,disabled:a=!1,runtimeLabel:l=o=>o}){const o=F({kind:"files"}),d=e.stop===null?$("runtime-own"):e.stop===e.presetStop?`From ${S[t??"trusted"]}`:"Changed from your preset";return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:[d,o!==void 0?T(o):""].filter(Boolean).join(" · ")})," ","·"," ",s.jsx(b,{question:`Why is Files & commands ${e.stop?`set to ${f(e.stop)}`:"not set"}?`,sentence:M(e.stop,e.stop===null?"runtime-own":"default"),...e.lastChange?{lastChange:e.lastChange}:{}})]}),e.runtimes.map(i=>s.jsxs("p",{className:"text-muted-foreground text-xs",children:[l(i.runtime)," starts at ",f(i.stop)," (Settings → Runtimes)"]},i.runtime))]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:e.stop??"",disabled:a,onValueChange:i=>{i&&i!==e.stop&&n(i)},children:w.map(i=>s.jsxs(P,{value:i.id,"aria-label":i.label,children:[s.jsx(K,{descriptor:i,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:i.label})]},i.id))}),s.jsx(ve,{agents:e.exceptions})]})]}),s.jsx(_,{descriptor:w.find(i=>i.stop===e.stop),className:"pb-3"})]})}function Ne({agent:e}){const t=p({kind:"agent",agentId:e.agentId}),n=B(e.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[e.agentName,": ",f(e.stop)]}),n?s.jsx("span",{className:"text-muted-foreground block text-xs",children:n}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",disabled:t.isPending,"aria-label":`Reset ${e.agentName} to the default`,onClick:()=>t.mutate({kind:"patch",filesAndCommands:null,surface:"settings"},{onError:j}),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function ve({agents:e}){return e.length===0?null:s.jsxs(L,{children:[s.jsx(U,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start @lg:self-end",children:[e.length===1?"1 agent differs":`${e.length} agents differ`,s.jsx(W,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(D,{className:"w-80 space-y-2",children:[s.jsx(H,{className:"text-sm font-medium",children:"Set differently for Files & commands"}),s.jsx("ul",{className:"space-y-1",children:e.map(t=>s.jsx(Ne,{agent:t},t.agentId))})]})]})}function O(e){return e.filter(t=>t.kind==="state")}function be({area:e,overview:t}){const n=p({kind:"default"}),a=ue(e.id),l=F({kind:"area",area:e.id})??0,[o,d]=N.useState(null),i=(r,u)=>{n.mutate({kind:"patch",areas:{[e.id]:r},...u&&u.length>0?{applyToAgents:u}:{},surface:"settings"},{onError:j,onSettled:()=>d(null)})},m=r=>{r!==e.resolved.state&&(a.length>0?d(r):i(r))};return s.jsxs(s.Fragment,{children:[s.jsx(V,{areaId:e.id,label:e.label,description:e.description,floor:e.floor,value:e.resolved.state,sourceText:[oe(e.resolved.source,t.preset),T(l)].filter(Boolean).join(" · "),why:s.jsx(b,{question:`Why is ${e.label} set to ${g[e.resolved.state]}?`,sentence:z({...e.resolved,preset:t.preset}),...e.lastChange?{lastChange:e.lastChange}:{}}),onChange:m,disabled:n.isPending,footer:s.jsx(fe,{area:e.id,areaLabel:e.label,agents:a}),details:s.jsx(X,{scope:{kind:"default"},area:e,surface:"settings",preset:t.preset})}),s.jsx(de,{open:o!==null,onCancel:()=>d(null),subject:e.label,next:o??"ask",agents:a.map(r=>({agentId:r.agentId,agentName:r.agentName,detail:`${g[r.state]}${r.action?" (one action)":""}`})),affectedCount:l,onKeep:()=>o&&i(o),onUpdate:r=>o&&i(o,r),pending:n.isPending})]})}function we({agentId:e,agentName:t,area:n}){var r;const a=((r=y().data)==null?void 0:r.preset)??null,l=p({kind:"agent",agentId:e}),o=n.resolved.source==="agent-area"||n.resolved.source==="agent-action",d=o?`Everyone else: ${g[n.inherited.state]}`:`Same as everyone (${g[n.inherited.state]})`,i=n.changedOutsideAt?`Changed outside DorkOS · ${d}`:d,m=u=>l.mutate({kind:"patch",areas:{[n.id]:u},surface:"agent-page"},{onError:j});return s.jsx(V,{areaId:n.id,label:n.label,description:n.description,floor:n.floor,value:n.resolved.state,sourceText:i,why:s.jsx(b,{question:`Why is ${n.label} set to ${g[n.resolved.state]} for ${t}?`,sentence:z({...n.resolved,preset:a}),...n.lastChange?{lastChange:n.lastChange}:{}}),changed:o,onChange:u=>{u!==n.resolved.state&&m(u)},onReset:()=>m(null),disabled:l.isPending,details:s.jsx(X,{scope:{kind:"agent",agentId:e},area:n,surface:"agent-page",preset:a,agentName:t})})}function Re({scope:e}){const t=y(),n=ce(e.kind==="agent"?e.agentId:void 0);return e.kind==="default"?t.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the permissions."}):t.data?s.jsx("div",{className:"divide-border divide-y","data-testid":"permission-list-default",children:O(t.data.areas).map(a=>s.jsx(be,{area:a,overview:t.data},a.id))}):s.jsx(C,{className:"h-20 w-full"}):n.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s permissions."}):n.data?s.jsxs("div",{className:"divide-border divide-y","data-testid":"permission-list-agent",children:[s.jsx(je,{agentId:e.agentId,agentName:n.data.agentName,files:n.data.filesAndCommands}),O(n.data.areas).map(a=>s.jsx(we,{agentId:e.agentId,agentName:n.data.agentName,area:a},a.id))]}):s.jsx(C,{className:"h-20 w-full"})}function ye(e,t){if(e===null)return t.target.kind==="agent"?"the default":"the preset";switch(t.key.kind){case"files":return ke(e)?f(e):e;case"preset":return e in S?S[e]:e;default:return e in g?g[e]:e}}function ke(e){return le.includes(e)}function Ce(e){if(e.length===1){const{change:t}=e[0];return`This has changed since. Set it back to ${ye(t.before,t)} anyway?`}return"Some of this has changed since. Set it all back anyway?"}function $e(e){if(e.suggestionRestored)return null;if(e.changes.length===0&&e.skipped.length===0)return"Nothing to undo. It was already back.";if(e.skipped.length===0)return null;const t=e.changes.length,n=`Undid ${t} ${t===1?"change":"changes"}.`,a=e.skipped.filter(i=>i.reason==="changed-since").length,l=e.skipped.filter(i=>i.reason==="floor").length,o=e.skipped.filter(i=>i.reason==="gone").length,d=[];if(a>0&&d.push(`${a} had changed since and ${a===1?"was":"were"} left alone.`),l>0&&d.push(`${l} can’t be set to Allowed and ${l===1?"was":"were"} left alone.`),o>0&&d.push(`${o} ${o===1?"was about an agent":"were about agents"} no longer here.`),d.length>1){const i=e.skipped.length;return`${n} ${i} ${i===1?"was":"were"} left alone.`}return[n,...d].join(" ")}function Se({item:e}){const t=xe(),[n,a]=N.useState(null),[l,o]=N.useState(null),d=e.undone,i=e.undoable&&!d,m=ie(e.occurredAt),r=u=>t.mutate({eventId:e.id,...u?{force:!0}:{}},{onSuccess:c=>{a(null),o($e(c))},onError:c=>{const h=he(c);h?a(h):j(c)}});return s.jsxs("li",{className:"space-y-1","data-testid":"permission-history-row",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[s.jsx("p",{className:"text-sm",children:e.summary}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.actorLabel," · ",m]}),e.actorDetail?s.jsx("p",{className:"text-muted-foreground text-xs",children:e.actorDetail}):null]}),d?s.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5 text-xs",children:"Undone"}):i&&n===null?s.jsx(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:t.isPending,"aria-label":`Undo: ${e.summary}, ${m}`,onClick:()=>r(!1),children:"Undo"}):null]}),n!==null?s.jsxs("div",{role:"group","aria-label":"Undo conflict",className:"bg-muted/50 flex flex-col gap-2 rounded-md p-2 @md:flex-row @md:items-center @md:justify-between",children:[s.jsx("p",{className:"text-sm",children:Ce(n)}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(x,{variant:"outline",size:"sm",disabled:t.isPending,onClick:()=>a(null),children:"Cancel"}),s.jsx(x,{size:"sm",disabled:t.isPending,onClick:()=>r(!0),children:"Set it back"})]})]}):null,l?s.jsx("p",{className:"text-muted-foreground text-xs",role:"status",children:l}):null]})}function ze({agentId:e}){const{data:t,isPending:n,isError:a}=me(e);if(a)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the history."});if(n)return s.jsx(C,{className:"h-12 w-full"});const l=(t==null?void 0:t.items)??[];return l.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No permission changes yet."}):s.jsx("ul",{className:"@container space-y-3","aria-label":"Permission history",children:l.map(o=>s.jsx(Se,{item:o},o.id))})}export{Ee as D,Re as P,ze as a};
@@ -0,0 +1 @@
1
+ import{y as n,j as s}from"./index-CdKpQ1hI.js";import{P as r,a}from"./PermissionHistory-DrtlA4YM.js";import"./ApplyToOverridesDialog-jqOFh0d1.js";function d({member:t}){var o;const e=n((o=t.agent)==null?void 0:o.runtime),i=(e==null?void 0:e.supportsMcp)??!0;return s.jsxs("div",{className:"space-y-6",children:[i?null:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent can’t use DorkOS tools, so these don’t apply."}),s.jsx(r,{scope:{kind:"agent",agentId:t.id}}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"History"}),s.jsx(a,{agentId:t.id})]})]})}export{d as PermissionsPage};
@@ -1 +1 @@
1
- import{b as n,j as t,e as i}from"./index-C63bLSO4.js";import{u as m,P as p}from"./use-personality-commit-fUtuc2lC.js";import"./dorkbot-templates-8Yu9POWJ.js";import"./sound-D3r8dGFH.js";import"./soul-file-NcuTUIiB.js";function P({member:r}){const{agent:e,isPending:o,update:a}=n(r),s=m(e,a);return o?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(p,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{P as PersonalityPopover};
1
+ import{b as n,j as t,e as i}from"./index-CdKpQ1hI.js";import{u as m,P as p}from"./use-personality-commit-DUEKxHt_.js";import"./dorkbot-templates-8Yu9POWJ.js";import"./sound-D3r8dGFH.js";import"./soul-file-Cag2i87x.js";function P({member:r}){const{agent:e,isPending:o,update:a}=n(r),s=m(e,a);return o?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(p,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{P as PersonalityPopover};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-CdKpQ1hI.js";import{b as t}from"./ProfileFields-BCfMzNcT.js";import"./profile-errors-CqflLCzu.js";import"./use-mounted-ref-BWpQ8f91.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
@@ -0,0 +1,19 @@
1
+ import{a2 as ge,r as b,j as o,I as Ie,Q as k,ay as he,$ as je,hU as Ne,hV as we,hW as Te,B as D,e3 as Pe,hX as Ae,a8 as v,dz as ve,bY as _e,hb as $e,dU as Oe,af as P,hY as Re,dR as Me,hZ as Le,hc as Be,dC as De,a9 as U,h_ as Ue,h$ as Ke,aa as qe,aw as Fe,eL as le,i0 as xe,eM as ue,e as We,gw as Ye,h6 as ze,ae as Ge}from"./index-CdKpQ1hI.js";import{u as He}from"./use-update-config-xkznZMHr.js";import{u as Qe}from"./use-promo-dismissals-bkSHhGhj.js";import{a as Ve,d as Je,k as Xe}from"./execution-config-BbBEe6FO.js";import{s as Ze}from"./settings-for-runtime-BoOa-ZFG.js";import{u as et,a as tt,e as C,c as nt,h as st,P as rt,A as at,d as ot}from"./ApplyToOverridesDialog-jqOFh0d1.js";/**
2
+ * @license lucide-react v1.48.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const be={name:"users-round",size:24,node:[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],aliases:["users-2"]};be.node;const it=ge(be);/**
7
+ * @license lucide-react v1.48.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ye={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};ye.node;const Bt=ge(ye);function Dt({value:e,min:t,max:s,onCommit:n,disabled:r,className:a,"aria-label":l,"aria-describedby":u}){const[i,m]=b.useState(null),x=b.useId(),h=i===null?e:Number(i),c=i!==null&&(i.trim()===""||!Number.isInteger(h)||h<t||h>s),y=()=>{i!==null&&(c||(m(null),h!==e&&n(h)))};return o.jsxs("div",{"data-slot":"bounded-number-input",className:"flex flex-col items-start gap-1",children:[o.jsx(Ie,{type:"number",inputMode:"numeric",min:t,max:s,step:1,disabled:r,"aria-label":l,"aria-invalid":c||void 0,"aria-describedby":[u,c?x:void 0].filter(Boolean).join(" ")||void 0,value:i??String(e),onChange:E=>m(E.target.value),onBlur:y,onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),y()),E.key==="Escape"&&m(null)},className:k("w-24 tabular-nums",a)}),c&&o.jsxs("p",{id:x,className:"text-destructive text-xs",children:["Enter a whole number from ",t," to ",s,"."]})]})}function Ut(){const{data:e}=he(),t=He(),s=e==null?void 0:e.welcomeBack,n=b.useCallback(a=>{t.mutate({welcomeBack:{enabled:a}})},[t]),r=b.useCallback(a=>{t.mutate({welcomeBack:{offersEnabled:a}})},[t]);return{enabled:(s==null?void 0:s.enabled)??!1,absenceThresholdMinutes:(s==null?void 0:s.absenceThresholdMinutes)??0,maxPosts:(s==null?void 0:s.maxPosts)??0,offersEnabled:(s==null?void 0:s.offersEnabled)??!1,setEnabled:n,setOffersEnabled:r,isAvailable:s!==void 0,isPending:t.isPending}}const lt=`{
12
+ "instanceId": "a1b2c3d4-...", // random, not you
13
+ "dorkosVersion": "0.47.0",
14
+ "os": "darwin-arm64",
15
+ "runtimesConfigured": ["claude-code", "codex"],
16
+ "tunnelEnabled": false,
17
+ "cloudLinked": false,
18
+ "counts": { "agents": 4, "tasks": 2, "relayAdapters": 1 }
19
+ }`;function Kt({className:e}){return o.jsxs("div",{className:k("space-y-1.5 text-left",e),children:[o.jsx("pre",{className:"text-muted-foreground bg-background/60 max-w-full overflow-x-auto rounded-md border p-3 text-xs",children:o.jsx("code",{children:lt})}),o.jsx("p",{className:"text-muted-foreground text-xs",children:"That’s the whole daily ping."})]})}function qt({open:e,onToggle:t,className:s}){return o.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:k("text-foreground focus-visible:ring-ring inline-flex items-center gap-1 rounded-sm text-xs font-medium underline underline-offset-2 outline-none hover:no-underline focus-visible:ring-2",s),children:["See what’s sent",o.jsx(je,{"aria-hidden":!0,className:k("size-3 transition-transform duration-200",e&&"rotate-180")})]})}const B="official-space-join";function ut(){var x;const{officialLink:e}=Ne(),t=we(e!==null),{dismissedIds:s,dismissPromo:n}=Qe(),r=Te(h=>h.ask),a=((x=t.data)==null?void 0:x.some(h=>h.official===!0))??!1,l=e!==null&&t.data!==void 0&&!a&&!s.includes(B),u=e!==null&&t.isLoading===!0&&!s.includes(B),i=b.useCallback(()=>{e!==null&&r(e)},[r,e]),m=b.useCallback(()=>n(B),[n]);return{link:e,joined:a,offered:l,pending:u,join:i,skip:m}}function Ft({className:e,onDone:t,compact:s=!1}){const n=ut(),r=b.useId();if(!n.offered)return null;const a=s?"h4":"h3";return o.jsxs("section",{"aria-labelledby":r,"data-testid":"official-space-offer",className:k("flex items-start",s?"gap-2":"gap-3 rounded-md border p-3",e),children:[o.jsx(it,{className:k("text-muted-foreground mt-0.5 shrink-0",s?"size-3.5":"size-4"),"aria-hidden":!0}),o.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[o.jsx(a,{id:r,className:k("font-medium",s?"text-xs":"text-sm"),children:"Join the DorkOS community"}),o.jsx("p",{className:k("text-muted-foreground",s?"text-xs":"text-sm"),children:"One space for everyone using DorkOS. Your agents join only if you add them."}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx(D,{size:"sm",onClick:()=>{n.join(),t==null||t()},children:"Join"}),o.jsx(D,{size:"sm",variant:"ghost",onClick:()=>{n.skip(),t==null||t()},children:"Not now"})]})]})]})}const ct="Paid plans and hosted spaces are for people in the United States, 18 or older.",dt="Paid plans are for people in the United States, 18 or older.",ft=Ae("/pricing#faq");function Wt({className:e,withSpaces:t=!0}){return o.jsxs("p",{className:k("text-muted-foreground text-xs",e),children:[t?ct:dt," ",o.jsx(Pe,{href:ft,className:"text-foreground underline underline-offset-2",children:"Who can buy a plan?"})]})}const mt=[];function ce(e,t){return t?`${e}\0credits`:e}function pt(e){const[t,s]=e.split("\0");return s?{runtime:t,account:P}:{runtime:t}}function Yt(e){var H,Q,V,J,X,Z,ee,te,ne,se;const t=(e==null?void 0:e.checkModels)??!1,s=v(),{data:n}=he(),{data:r}=ve(),{data:a}=_e(),l=b.useMemo(()=>((a==null?void 0:a.agents)??[]).map(d=>d.projectPath),[a]),{data:u}=$e(l),i=((H=n==null?void 0:n.executionDefaults)==null?void 0:H.runtime)??"claude-code",m=r?Object.keys(r.capabilities):void 0,x=(Q=n==null?void 0:n.executionDefaults)==null?void 0:Q.perRuntime,h=(V=n==null?void 0:n.claudeCode)==null?void 0:V.accounts,c=(J=n==null?void 0:n.claudeCode)==null?void 0:J.accountsUnavailable,y=h&&[...h.flatMap(d=>d.id===null?[]:[{id:d.id,label:Re(d.path,h)}]),...(X=n==null?void 0:n.claudeCode)!=null&&X.credits?[{id:P,label:Oe}]:[]],E=new Set(((ee=(Z=n==null?void 0:n.claudeCode)==null?void 0:Z.credits)==null?void 0:ee.allowedAgents)??[]),Se=d=>{var f;return((f=x==null?void 0:x.find(g=>g.runtime===d))==null?void 0:f.model)??null},M=m==null?void 0:m.join(","),Y=(te=n==null?void 0:n.claudeCode)==null?void 0:te.credits,w=(ne=Me().data)==null?void 0:ne.defaults,L=b.useCallback(d=>Ve(d,{defaultRuntime:i,runtimeDeclaresCredits:f=>{var g;return((g=r==null?void 0:r.capabilities[f])==null?void 0:g.credits)!==void 0},credits:Y,runtimeDefaultsToCredits:f=>{var g;return((g=w==null?void 0:w[f])==null?void 0:g.runsOn)==="credits"}}),[i,r,Y,w]),z=b.useMemo(()=>{if(!t||!u)return[];const d=M===void 0?null:new Set(M.split(",")),f=new Set;for(const g of Object.values(u)){if(!(g!=null&&g.model)&&!(g!=null&&g.effort))continue;const S=g.runtime??i;d&&!d.has(S)||f.add(ce(S,L(g)))}return[...f].sort()},[t,u,i,M,L]),ke=Le({queries:z.map(d=>({...Be(s,pt(d)),retry:!1}))}),G=new Map;if(z.forEach((d,f)=>{var S;const g=(S=ke[f])==null?void 0:S.data;g&&G.set(d,g)}),!u)return{exceptions:mt,brokenPaths:[],defaultRuntime:i};const T=[];for(const[d,f]of Object.entries(u)){if(!f)continue;const g=f.runtime??i,S=G.get(ce(g,L(f))),re=Se(g),ae=f.model??re,oe=ae?S==null?void 0:S.find(j=>j.value===ae):void 0,ie=Je({agent:{runtime:f.runtime,model:f.model,effort:f.effort,account:f.account},defaultRuntime:i,serverDefaultModel:re,knownRuntimes:m,knownModels:Xe(S),knownAccounts:f.account===P&&!E.has(f.id)?y==null?void 0:y.filter(j=>j.id!==P):y,accountsUnavailable:c,modelSupportsEffort:oe?oe.supportsEffort??!1:void 0,runtimeSupportsEffort:(se=Ze(r,g))==null?void 0:se.supportsEffort,runtimeLabel:j=>De(j).label});ie.isException&&T.push({path:d,agent:f,report:ie})}return T.sort((d,f)=>d.report.isBroken!==f.report.isBroken?d.report.isBroken?-1:1:d.agent.name.localeCompare(f.agent.name)),{exceptions:T,brokenPaths:T.filter(d=>d.report.isBroken).map(d=>d.path),defaultRuntime:i}}const A={all:["cloud","communities"],list:()=>[...A.all,"list"],move:e=>[...A.all,"move",e],name:e=>[...A.all,"name",e]};function zt(){var s;const e=v();return((s=U({queryKey:Ke,queryFn:()=>e.getCloudStatus(),staleTime:3e4}).data)==null?void 0:s.linked)===!0}function Gt(e){const t=v(),s=Ue();return U({queryKey:A.list(),queryFn:()=>t.listHostedCommunities(),enabled:e&&s,staleTime:15e3})}const gt=/^-?(0|[1-9][0-9]*)$/,ht=/^[1-9][0-9]*$/,xt=/^[A-Z]{3}$/,_=6,bt=BigInt(10)**BigInt(_),p=BigInt(0),$=BigInt(1),yt=BigInt(2),O=BigInt(10);function Ce(e,t){const s=e/t;return e%t!==p&&e<p?s-$:s}function K(e,t){const s=e<p?-e:e;let n=s/t;return s%t*yt>=t&&(n+=$),e<p?-n:n}function I(e){return typeof e!="string"||!gt.test(e)?null:BigInt(e)}function R(e){if(typeof e!="object"||e===null)return null;const{microPerCredit:t}=e;return typeof t!="string"||!ht.test(t)||q(e)===null?null:BigInt(t)}const de=new Map;function Ct(e){const t=de.get(e);if(t!==void 0)return t;let s=null;try{const n=new Intl.NumberFormat("en-US",{style:"currency",currency:e}),r=n.formatToParts(0),a=new Set(["integer","group","decimal","fraction"]),l=r.findIndex(m=>a.has(m.type));let u=-1;r.forEach((m,x)=>{a.has(m.type)&&(u=x)});const i=n.resolvedOptions().maximumFractionDigits??0;if(l>=0&&i>=0&&i<=_){const m=x=>x.filter(h=>h.type!=="minusSign"&&h.type!=="plusSign").map(h=>h.value).join("");s={prefix:m(r.slice(0,l)),suffix:m(r.slice(u+1)),minorDigits:i}}}catch{s=null}return de.set(e,s),s}function q(e){if(typeof e!="object"||e===null)return null;const{currency:t}=e;return typeof t!="string"||!xt.test(t)?null:Ct(t)}function N(e){const t=e.toString();let s="";for(let n=0;n<t.length;n+=1)n>0&&(t.length-n)%3===0&&(s+=","),s+=t[n];return s}function F(e,t,s){const n=O**BigInt(t),r=e/n;let a=t>0?(e%n).toString().padStart(t,"0"):"";for(;a.length>s&&a.endsWith("0");)a=a.slice(0,-1);return a.length>0?`${N(r)}.${a}`:N(r)}function W(e){return e<p?`-${N(-e)}`:N(e)}function fe(e,t,s){const n=e<p?-e:e,r=s?N(n/O**BigInt(t.minorDigits)):F(n,t.minorDigits,t.minorDigits);return`${e<p?"-":""}${t.prefix}${r}${t.suffix}`}function Et(e,t,s){const n=I(e),r=q(t);if(n===null||r===null)return null;const a=O**BigInt(_-r.minorDigits),l=s(n,a);if(l===p&&n!==p){const u=fe($,r,r.minorDigits===0);return n<p?`-<${u}`:`<${u}`}return fe(l,r,n%bt===p)}function St(e,t){const s=I(e),n=R(t);return s===null||n===null?null:W(Ce(s,n))}function Ht(e,t){const s=I(e),n=R(t);if(s===null||n===null)return null;if(s===p)return"0";const r=K(s,n);return r===p?s<p?"-<1":"<1":W(r)}function kt(e,t){const s=I(e),n=R(t);if(s===null||n===null)return null;let r=0,a=s<p?-s:s,l=$;for(;a*l%n!==p;)if(r+=1,l*=O,r>n.toString().length*4)return null;a=a*l/n;const u=F(a,r,0);return s<p?`-${u}`:u}function me(e,t){return Et(e,t,K)}function It(e,t){const s=I(e),n=q(t);if(s===null||n===null)return null;const r=s<p?-s:s;return`${s<p?"-":""}${n.prefix}${F(r,_,n.minorDigits)}${n.suffix}`}function Qt(e,t,s){const n=I(e),r=R(t);if(n===null||r===null)return null;const a=i=>i==="1"||i==="-1"?`${i} credit`:`${i} credits`;if(s==="rate"){const i=kt(e,t),m=It(e,t);return i===null||m===null?null:`${a(i)} (${m})`}let l;if(s==="position")l=Ce(n,r);else if(l=n===p?p:K(n,r),l===p&&n!==p){const i=me(r.toString(),t);if(i===null)return null;const m=i.startsWith("<")?i:`<${i}`;return n<p?`-<1 credit (-${m})`:`<1 credit (${m})`}const u=me((l*r).toString(),t);return u===null?null:`${a(W(l))} (${u})`}function Vt(e){return St("0",e)!==null}function Jt(e){return e===null?null:`${e} ${e==="1"||e==="-1"||e==="<1"||e==="-<1"?"credit":"credits"}`}const pe=1n<<16n;function Xt(e,t){if(!/^\d+$/.test(e)||!/^\d+$/.test(t))return null;const s=BigInt(t);if(s===0n)return null;const n=BigInt(e);return n>=s?1:n<=0n?0:Number(n*pe/s)/Number(pe)}const Ee=["keep-awake"],jt=5*6e4;function Zt(){const e=v(),{data:t}=U({queryKey:[...Ee],queryFn:()=>e.getKeepAwake(),staleTime:jt});return t}function Nt(e){if(typeof e!="object"||e===null)return!1;const t=e,s=t.working;return typeof t.enabled=="boolean"&&typeof t.supported=="boolean"&&typeof t.asserted=="boolean"&&typeof s=="object"&&s!==null&&typeof s.chats=="number"&&typeof s.rooms=="number"&&typeof s.tasks=="number"}function en(){const e=qe();Fe("keep_awake_status",t=>{Nt(t)&&e.setQueryData([...Ee],t)})}const tn={tab:"tools",section:"sleep"},wt=[["chats","chat","chats"],["rooms","room","rooms"],["tasks","task","tasks"]];function Tt(e){const t=wt.filter(([s])=>e[s]>0).map(([s,n,r])=>`${e[s]} ${e[s]===1?n:r}`);return t.length===0?null:t.length===1?`${t[0]} running`:t.join(", ")}function nn(e){return(e==null?void 0:e.asserted)===!0&&Tt(e.working)!==null}const sn={container:"Not available in a container.","tool-missing":"Not available: this computer has no sleep control tool.",denied:"This computer refused to stay awake. Tries again while agents work.",platform:"Not available on this operating system."};function rn(e){return e.supported||e.reason==="denied"}const an="Closing the lid usually still sleeps. The screen still locks. Uses more battery.";function Pt(e,t){return t===0?C[e]:`${C[e]}, ${t} ${t===1?"change":"changes"}`}function At(e){const t=new Map,s=(n,r)=>{const a=t.get(n)??{agentName:r,count:0};a.count+=1,t.set(n,a)};for(const n of e.exceptions)s(n.agentId,n.agentName);for(const n of e.filesAndCommands.exceptions)s(n.agentId,n.agentName);return[...t].map(([n,{agentName:r,count:a}])=>({agentId:n,agentName:r,detail:`${a} ${a===1?"setting":"settings"} of its own`}))}function vt(e){const t=xe;return t.includes(e)?t:[...t,e]}function on({surface:e}){const t=et(),s=tt({kind:"default"}),[n,r]=b.useState(null),a=b.useMemo(()=>t.data?At(t.data):[],[t.data]);if(t.isError)return o.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the permissions."});if(!t.data)return o.jsxs("div",{className:"flex flex-col gap-3","data-testid":"preset-picker","aria-busy":"true",children:[o.jsx(le,{"aria-label":"Preset",className:"w-full",value:"",onValueChange:()=>{},children:xe.map(c=>o.jsx(ue,{value:c,"aria-label":C[c],children:o.jsx("span",{className:"truncate",children:C[c]})},c))}),o.jsx(We,{className:"h-4 w-2/3"})]});const l=t.data,u=l.preset??"trusted",i=nt(l,{kind:"preset"}),m=`Changing it ${ot(i)}`,x=(c,y)=>s.mutate({kind:"preset",preset:c,surface:e,...y&&y.length>0?{applyToAgents:y}:{}},{onError:E=>Ge.error(E instanceof Error?E.message:"Couldn’t save that change. Try again.")}),h=c=>{c===l.preset&&l.changeCount===0||(a.length>0?r(c):x(c))};return o.jsxs("div",{className:"flex flex-col gap-3","data-testid":"preset-picker",children:[o.jsx(le,{"aria-label":"Preset",className:"w-full",value:u,onValueChange:c=>c&&h(c),disabled:s.isPending,children:vt(u).map(c=>o.jsx(ue,{value:c,"aria-label":C[c],children:o.jsx("span",{className:"truncate",children:C[c]})},c))}),o.jsxs("div",{className:"flex flex-col gap-1 @lg:flex-row @lg:items-center @lg:justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("p",{className:"text-sm","data-testid":"permissions-preset",children:[o.jsx("span",{className:"font-medium",children:Pt(u,l.changeCount)}),o.jsxs("span",{className:"text-muted-foreground",children:[" · ",st[u]]})]}),o.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"permissions-preset-preview",children:[m," ·"," ",o.jsx(rt,{question:`Why is the preset set to ${C[u]}?`,sentence:`${C[u]} is the preset every agent starts from.`,...l.presetLastChange?{lastChange:l.presetLastChange}:{}})]})]}),l.changeCount>0?o.jsxs(D,{variant:"ghost",size:"sm",className:"self-start",disabled:s.isPending,onClick:()=>h(u),children:["Reset to ",C[u]]}):null]}),o.jsx(Ye,{descriptor:ze.find(c=>c.stop===l.filesAndCommands.stop)}),o.jsx(at,{open:n!==null,onCancel:()=>r(null),subject:"Preset",title:n?`Switch everyone to ${C[n]}?`:void 0,next:n?C[n]:"",agents:a,affectedCount:i,onKeep:()=>{n&&x(n),r(null)},onUpdate:c=>{n&&x(n,c),r(null)},pending:s.isPending})]})}export{Dt as B,Wt as C,Ee as K,Ft as O,on as P,tn as S,qt as T,sn as U,Bt as W,Kt as a,St as b,Qt as c,me as d,Ut as e,Ht as f,Zt as g,rn as h,Vt as i,an as j,Yt as k,ut as l,A as m,zt as n,it as o,nn as p,Tt as q,Xt as r,en as s,Gt as u,Jt as w};
@@ -1 +1 @@
1
- import{r as b,j as n,bc as _,bf as p,bg as I,eF as j,bk as S,d3 as E,eG as N,eH as R,eI as A,bd as T,bl as h,eJ as M,eK as $,eL as D,eM as F,ae as O,aj as G,ak as L}from"./index-C63bLSO4.js";import{S as V}from"./shield-x-Bh5xap8N.js";var K=Object.defineProperty,g=(e,t)=>K(e,"name",{value:t,configurable:!0}),x="Tabs",[H,oe]=I(x,[j]),C=j(),[U,y]=H(x),q=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,onValueChange:o,defaultValue:d,orientation:i="horizontal",dir:l,activationMode:v="automatic",...m}=t,u=S(l),[c,f]=E({prop:s,onChange:o,defaultProp:d??"",caller:x});return n.jsx(U,{scope:r,baseId:N(),value:c,onValueChange:f,orientation:i,dir:u,activationMode:v,children:n.jsx(p.div,{dir:u,"data-orientation":i,...m,ref:a})})},"Tabs")),z="TabsList",B=b.forwardRef(g(function(t,a){const{__scopeTabs:r,loop:s=!0,...o}=t,d=y(z,r),i=C(r);return n.jsx(R,{asChild:!0,...i,orientation:d.orientation,dir:d.dir,loop:s,children:n.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:a})})},"TabsList")),J="TabsTrigger",Q=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,disabled:o=!1,...d}=t,i=y(J,r),l=C(r),v=k(i.baseId,s),m=w(i.baseId,s),u=s===i.value;return n.jsx(A,{asChild:!0,...l,focusable:!o,active:u,children:n.jsx(p.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:v,...d,ref:a,onMouseDown:T(t.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?i.onValueChange(s):c.preventDefault()}),onKeyDown:T(t.onKeyDown,c=>{o||c.target!==c.currentTarget||[" ","Enter"].includes(c.key)&&i.onValueChange(s)}),onFocus:T(t.onFocus,()=>{const c=i.activationMode!=="manual";!u&&!o&&c&&i.onValueChange(s)})})})},"TabsTrigger")),W="TabsContent",X=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,forceMount:o,children:d,...i}=t,l=y(W,r),v=k(l.baseId,s),m=w(l.baseId,s),u=s===l.value,c=b.useRef(u);return b.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),n.jsx(_,{present:o||u,children:({present:f})=>n.jsx(p.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":v,hidden:!f,id:m,tabIndex:0,...i,ref:a,style:{...t.style,animationDuration:c.current?"0s":void 0},children:f&&d})})},"TabsContent"));function k(e,t){return`${e}-trigger-${t}`}g(k,"makeTriggerId");function w(e,t){return`${e}-content-${t}`}g(w,"makeContentId");var Y=q,Z=B,ee=Q,te=X;function ie({...e}){return n.jsx(Y,{"data-slot":"tabs",...e})}function ce({className:e,responsive:t=!0,...a}){return n.jsx(Z,{"data-slot":"tabs-list",className:h("bg-dui-muted text-dui-muted-foreground inline-flex items-center justify-center rounded-lg p-1",t?M:"h-9",e),...a})}function ue({className:e,...t}){return n.jsx(ee,{"data-slot":"tabs-trigger",className:h("ring-offset-dui-background inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,box-shadow,opacity] motion-reduce:transition-none! md:py-1","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-dui-background data-[state=active]:text-dui-foreground data-[state=active]:shadow",e),...t})}function de({className:e,...t}){return n.jsx(te,{"data-slot":"tabs-content",className:h("ring-offset-dui-background mt-2","data-[state=active]:animate-in data-[state=active]:fade-in-0 data-[state=active]:duration-150 motion-reduce:animate-none!","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...t})}const ae={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function le(e){return ae[e]??!1}function se(e){try{return F.toString(e)}catch{return`On the schedule ${e}`}}function fe(e){const t=e.cron?se(e.cron):"Runs only when you ask",a=$(e.startsEnabled);return`${t}, ${a}. This job ${D(e.permissionMode)}.`}function be(e,t){const a=O(),{enabled:r=!0,...s}=t??{},o=Object.keys(s).length>0;return G({queryKey:L.permissionPreview(e??"",o?s:void 0),queryFn:()=>a.previewMarketplacePackage(e,o?s:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function P(e){const t=e==null?void 0:e.body,a=Array.isArray(t==null?void 0:t.errors)?t.errors.filter(r=>typeof r=="string"):[];return a.length>0?{reasons:a,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function ge(e){return P(e).checked}function ve({error:e}){const{reasons:t,checked:a}=P(e);return n.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[n.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[n.jsx(V,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:a?"What it found:":"It couldn’t check what this package does."}),t.length>0&&n.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:t.map(r=>n.jsx("li",{children:r},r))})]})}export{ve as P,ie as T,ce as a,ue as b,de as c,fe as d,ge as i,le as r,be as u};
1
+ import{r as b,j as n,bt as _,bw as p,bx as E,eA as k,bB as S,dr as I,di as A,eB as N,eC as R,bu as T,bC as h,eD as M,eE as D,eF as $,eG as F,a8 as O,a9 as G,ah as V}from"./index-CdKpQ1hI.js";import{S as L}from"./shield-x-jF_NCCvp.js";var K=Object.defineProperty,g=(e,t)=>K(e,"name",{value:t,configurable:!0}),x="Tabs",[B,oe]=E(x,[k]),C=k(),[U,y]=B(x),q=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,onValueChange:o,defaultValue:d,orientation:i="horizontal",dir:l,activationMode:v="automatic",...m}=t,u=S(l),[c,f]=I({prop:s,onChange:o,defaultProp:d??"",caller:x});return n.jsx(U,{scope:r,baseId:A(),value:c,onValueChange:f,orientation:i,dir:u,activationMode:v,children:n.jsx(p.div,{dir:u,"data-orientation":i,...m,ref:a})})},"Tabs")),H="TabsList",z=b.forwardRef(g(function(t,a){const{__scopeTabs:r,loop:s=!0,...o}=t,d=y(H,r),i=C(r);return n.jsx(N,{asChild:!0,...i,orientation:d.orientation,dir:d.dir,loop:s,children:n.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:a})})},"TabsList")),Q="TabsTrigger",W=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,disabled:o=!1,...d}=t,i=y(Q,r),l=C(r),v=w(i.baseId,s),m=j(i.baseId,s),u=s===i.value;return n.jsx(R,{asChild:!0,...l,focusable:!o,active:u,children:n.jsx(p.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:v,...d,ref:a,onMouseDown:T(t.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?i.onValueChange(s):c.preventDefault()}),onKeyDown:T(t.onKeyDown,c=>{o||c.target!==c.currentTarget||[" ","Enter"].includes(c.key)&&i.onValueChange(s)}),onFocus:T(t.onFocus,()=>{const c=i.activationMode!=="manual";!u&&!o&&c&&i.onValueChange(s)})})})},"TabsTrigger")),X="TabsContent",J=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,forceMount:o,children:d,...i}=t,l=y(X,r),v=w(l.baseId,s),m=j(l.baseId,s),u=s===l.value,c=b.useRef(u);return b.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),n.jsx(_,{present:o||u,children:({present:f})=>n.jsx(p.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":v,hidden:!f,id:m,tabIndex:0,...i,ref:a,style:{...t.style,animationDuration:c.current?"0s":void 0},children:f&&d})})},"TabsContent"));function w(e,t){return`${e}-trigger-${t}`}g(w,"makeTriggerId");function j(e,t){return`${e}-content-${t}`}g(j,"makeContentId");var Y=q,Z=z,ee=W,te=J;function ie({...e}){return n.jsx(Y,{"data-slot":"tabs",...e})}function ce({className:e,responsive:t=!0,...a}){return n.jsx(Z,{"data-slot":"tabs-list",className:h("bg-dui-muted text-dui-muted-foreground inline-flex items-center justify-center rounded-lg p-1",t?M:"h-9",e),...a})}function ue({className:e,...t}){return n.jsx(ee,{"data-slot":"tabs-trigger",className:h("ring-offset-dui-background inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,box-shadow,opacity] motion-reduce:transition-none! md:py-1","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-dui-background data-[state=active]:text-dui-foreground data-[state=active]:shadow",e),...t})}function de({className:e,...t}){return n.jsx(te,{"data-slot":"tabs-content",className:h("ring-offset-dui-background mt-2","data-[state=active]:animate-in data-[state=active]:fade-in-0 data-[state=active]:duration-150 motion-reduce:animate-none!","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...t})}const ae={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function le(e){return ae[e]??!1}function se(e){try{return F.toString(e)}catch{return`On the schedule ${e}`}}function fe(e){const t=e.cron?se(e.cron):"Runs only when you ask",a=D(e.startsEnabled);return`${t}, ${a}. This job ${$(e.permissionMode)}.`}function be(e,t){const a=O(),{enabled:r=!0,...s}=t??{},o=Object.keys(s).length>0;return G({queryKey:V.permissionPreview(e??"",o?s:void 0),queryFn:()=>a.previewMarketplacePackage(e,o?s:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function P(e){const t=e==null?void 0:e.body,a=Array.isArray(t==null?void 0:t.errors)?t.errors.filter(r=>typeof r=="string"):[];return a.length>0?{reasons:a,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function ge(e){return P(e).checked}function ve({error:e}){const{reasons:t,checked:a}=P(e);return n.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[n.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[n.jsx(L,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:a?"What it found:":"It couldn’t check what this package does."}),t.length>0&&n.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:t.map(r=>n.jsx("li",{children:r},r))})]})}export{ve as P,ie as T,ce as a,ue as b,de as c,fe as d,ge as i,le as r,be as u};
@@ -0,0 +1 @@
1
+ import{r as x,t as S,j as e,bm as u,bn as h,bo as m,g as E,B as d,I as g,bp as p,bq as b}from"./index-CdKpQ1hI.js";import{u as y,a as C,b as f,c as k,h as A,d as F,n as I}from"./profile-errors-CqflLCzu.js";import{u as j}from"./use-mounted-ref-BWpQ8f91.js";function v(t){const[n,a]=x.useState(t),[r,s]=x.useState(t);return r!==t&&(s(t),a(t)),[n,a]}const D="image/png,image/jpeg,image/webp";function l({tone:t,children:n}){return e.jsx("p",{role:t==="error"?"alert":"status",className:t==="error"?"text-destructive text-xs":"text-muted-foreground text-xs",children:n})}function U({member:t}){const n=S(t),a=x.useRef(null),r=y(),s=C();function c(i){const o=i==null?void 0:i[0];o&&(r.mutate({file:o}),a.current&&(a.current.value=""))}return e.jsx(u,{children:e.jsxs(h,{className:"space-y-3",children:[e.jsx(m,{label:"Photo",description:"PNG, JPEG or WebP, up to 2 MB.",orientation:"vertical",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(E,{size:"lg",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:a,type:"file",accept:D,className:"hidden","data-testid":"profile-photo-input",onChange:i=>c(i.target.files)}),e.jsx(d,{size:"sm",variant:"outline",disabled:r.isPending,onClick:()=>{var i;return(i=a.current)==null?void 0:i.click()},children:t.imageUrl?"Change photo":"Upload a photo"}),t.imageUrl&&e.jsx(d,{size:"sm",variant:"ghost",disabled:s.isPending,onClick:()=>s.mutate(),children:"Remove"})]})]})}),r.isError&&e.jsx(l,{tone:"error",children:f(r.error)}),s.isError&&e.jsx(l,{tone:"error",children:f(s.error)})]})})}function H({member:t}){const n=j(),a=F({isShownInline:()=>n.current}),r=t.displayName===p?"":t.displayName,[s,c]=v(r),i=b(t),o=s.trim().length>0&&s.trim()!==r,N=s.trim().length>0&&(o||i!==null);return e.jsx(u,{children:e.jsxs(h,{className:"space-y-3",children:[e.jsx(m,{label:"Display name",description:i?`${i}. Save it to make it yours.`:"What DorkOS calls you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{value:s,maxLength:80,"aria-label":"Display name",placeholder:p,onChange:P=>c(P.target.value)}),e.jsx(d,{size:"sm",disabled:!N||a.isPending,onClick:()=>a.mutate(s.trim()),children:"Save"})]})}),a.isError&&e.jsx(l,{tone:"error",children:I(a.error)}),a.isSuccess&&s.trim()===a.variables&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function w({member:t}){var i;const n=j(),a=k({isShownInline:()=>n.current}),[r,s]=v(t.handle??""),c=r.trim()!==(t.handle??"");return e.jsx(u,{children:e.jsxs(h,{className:"space-y-3",children:[e.jsx(m,{label:"Handle",description:"What others type after @ to reach you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{value:r,maxLength:64,placeholder:"yourname","aria-label":"Handle",onChange:o=>s(o.target.value)}),e.jsx(d,{size:"sm",disabled:!c||a.isPending,onClick:()=>a.mutate({authorId:t.id,handle:r.trim()}),children:"Save"})]})}),a.isError&&e.jsx(l,{tone:"error",children:A(a.error,r.trim())}),a.isSuccess&&r.trim()===((i=a.variables)==null?void 0:i.handle)&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function z({member:t}){var n,a;return e.jsx(u,{children:e.jsx(h,{children:e.jsx(m,{label:"Email",description:(n=t.person)!=null&&n.email?"From your sign-in. Change it in Settings › Login & security.":"No login on this machine. Turn one on in Settings › Login & security.",orientation:"vertical",children:e.jsx(g,{readOnly:!0,"aria-label":"Email",value:((a=t.person)==null?void 0:a.email)??"",placeholder:"No email on this machine",className:"text-muted-foreground"})})})})}export{l as F,H as P,w as a,U as b,z as c,v as u};
@@ -0,0 +1 @@
1
+ import{r as f,j as t,bm as D,bn as R,bo as E,dW as _,dX as H,dY as M,dZ as Z,d_ as A,Q as V,I as v,B as P,L as Y}from"./index-CdKpQ1hI.js";import{F as j,b as B,P as K,a as $,c as G}from"./ProfileFields-BCfMzNcT.js";import{u as I,P as Q,b as X}from"./ProfileRolePicker-f0FKXLtu.js";function U(e,s){if(e.length!==s.length)return!1;const n=new Set(s);return e.every(r=>n.has(r))}function q(){const{roles:e,isLoading:s,saveRoles:n}=I(),[r,i]=f.useState(e),[l,o]=f.useState(e),[d,u]=f.useState("idle"),[x,m]=f.useState(null);!s&&!U(l,e)&&(o(e),i(e));const h=()=>{u("saving"),n(r).then(()=>{u("idle"),m(r)}).catch(()=>u("error"))};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-3",children:[t.jsx(E,{label:"What kind of work you do",description:"Only DorkBot and your agents read this. It stays on this machine.",orientation:"vertical",children:t.jsx(Q,{selected:r,onChange:i,onConfirm:h,confirmLabel:d==="saving"?"Saving…":"Save",busy:d==="saving"||s})}),d==="error"&&t.jsx(j,{tone:"error",children:"Couldn’t save that. Try again."}),d!=="error"&&x&&U(r,x)&&t.jsx(j,{tone:"ok",children:"Saved."})]})})}const J=Object.freeze({days:[1,2,3,4,5],start:"09:00",end:"17:00"});function ee(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}const k=new Map;function te(e){let s=k.get(e);return s||(s=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short"}),k.set(e,s)),s}const ne={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function w(e,s){const n={};for(const r of te(s).formatToParts(new Date(e)))n[r.type]=r.value;return{year:Number(n.year),month:Number(n.month),day:Number(n.day),hour:Number(n.hour),minute:Number(n.minute),second:Number(n.second),weekday:ne[n.weekday??""]??0}}function z(e,s){const n=w(e,s);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-Math.floor(e/1e3)*1e3}function se(e){const[s,n]=e.split(":").map(Number);return(s??0)*60+(n??0)}function ae(e,s,n,r,i){const l=se(r),o=Date.UTC(e,s-1,n,Math.floor(l/60),l%60),d=o-z(o-864e5,i),u=o-z(o+864e5,i),x=h=>{const y=w(h,i);return y.year===e&&y.month===s&&y.day===n&&y.hour*60+y.minute===l},m=[d,u].filter(x);return m.length>0?Math.min(...m):Math.max(d,u)}function re(e,s,n){const[r,i,l]=e.split("-").map(Number);return new Date(ae(r??1970,i??1,l??1,s,n))}function oe(e,s){const n=w(e.getTime(),s);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}const ie=[{day:1,short:"M",name:"Monday"},{day:2,short:"T",name:"Tuesday"},{day:3,short:"W",name:"Wednesday"},{day:4,short:"T",name:"Thursday"},{day:5,short:"F",name:"Friday"},{day:6,short:"S",name:"Saturday"},{day:0,short:"S",name:"Sunday"}];function le(e){const s=typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[];return s.includes(e)?s:[e,...s]}function de(e,s,n){const r=e??X()??ee(),i=s??J;return{timezone:r,days:[...i.days],start:i.start,end:i.end,awayUntil:n!=null&&n.until?oe(new Date(n.until),r):""}}function b(e,s){return e.timezone===s.timezone&&e.start===s.start&&e.end===s.end&&e.awayUntil===s.awayUntil&&[...e.days].sort().join()===[...s.days].sort().join()}function ue(e){return e.days.length===0?"Pick at least one working day.":!e.start||!e.end?"Set a start and an end time.":e.end<=e.start?"The day has to end after it starts.":null}function ce(e,s,n){return e.awayUntil===s.awayUntil?n:e.awayUntil?{...n,until:re(e.awayUntil,"00:00",e.timezone).toISOString()}:null}function me(){const{timezone:e,workingHours:s,away:n,isLoading:r,saveHours:i}=I(),l=de(e,s,n),[o,d]=f.useState(l),[u,x]=f.useState(l),[m,h]=f.useState("idle"),[y,C]=f.useState(null),[F,O]=f.useState(null);!r&&!b(u,l)&&(x(l),d(l));const p=ue(o),g=a=>d(c=>({...c,...a})),W=a=>g({days:o.days.includes(a)?o.days.filter(c=>c!==a):[...o.days,a]}),L=()=>{if(p)return;h("saving");const a=o;i({timezone:a.timezone,workingHours:{days:[...a.days].sort((c,S)=>c-S),start:a.start,end:a.end},away:ce(a,u,n)}).then(()=>{h("idle"),C(null),O(a)}).catch(c=>{h("error"),C(c instanceof Error?c.message:null)})};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-4",children:[t.jsx(E,{label:"Your hours",description:"Your time zone and working hours.",orientation:"vertical",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-timezone",className:"text-muted-foreground text-xs",children:"Time zone"}),t.jsxs(_,{value:o.timezone,onValueChange:a=>g({timezone:a}),children:[t.jsx(H,{id:"profile-timezone",className:"h-8 text-sm",responsive:!1,children:t.jsx(M,{})}),t.jsx(Z,{children:le(o.timezone).map(a=>t.jsx(A,{value:a,responsive:!1,children:a.replace(/_/g," ")},a))})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{id:"profile-days-label",className:"text-muted-foreground text-xs",children:"Working days"}),t.jsx("div",{role:"group","aria-labelledby":"profile-days-label",className:"flex gap-1",children:ie.map(({day:a,short:c,name:S})=>{const T=o.days.includes(a);return t.jsx("button",{type:"button","aria-label":S,"aria-pressed":T,onClick:()=>W(a),className:V("size-8 rounded-md border text-xs font-medium",T?"bg-primary text-primary-foreground border-transparent":"text-muted-foreground hover:bg-accent"),children:c},a)})})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-start",className:"text-muted-foreground text-xs",children:"Start"}),t.jsx(v,{id:"profile-hours-start",type:"time",value:o.start,onChange:a=>g({start:a.target.value})})]}),t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-end",className:"text-muted-foreground text-xs",children:"End"}),t.jsx(v,{id:"profile-hours-end",type:"time",value:o.end,onChange:a=>g({end:a.target.value})})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-away-until",className:"text-muted-foreground text-xs",children:"Away until"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(v,{id:"profile-away-until",type:"date",value:o.awayUntil,onChange:a=>g({awayUntil:a.target.value})}),o.awayUntil&&t.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>g({awayUntil:""}),children:"Clear"})]})]})]})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(P,{type:"button",size:"sm",onClick:L,disabled:r||m==="saving"||p!==null||b(o,u),children:m==="saving"?"Saving…":"Save"}),p&&t.jsx(j,{tone:"error",children:p}),!p&&m==="error"&&t.jsx(j,{tone:"error",children:y??"Couldn’t save that. Try again."}),!p&&m!=="error"&&F&&b(o,F)&&t.jsx(j,{tone:"ok",children:"Saved."})]})]})})}function fe({member:e}){return t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"How you appear on your team page, in rooms and beside your messages."}),t.jsx(B,{member:e}),t.jsx(K,{member:e}),t.jsx($,{member:e}),t.jsx(G,{member:e}),t.jsx(q,{}),t.jsx(me,{})]})}function N({children:e}){return t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:e})}function pe(){var n;const e=Y(),s=(n=e.data)==null?void 0:n.members.find(r=>r.isSelf);return e.isPending?t.jsx(N,{children:"Loading your profile…"}):e.isError?t.jsx(N,{children:"Couldn’t load your profile. Reopen this tab to try again."}):s?t.jsx(fe,{member:s}):t.jsx(N,{children:"Couldn’t find your profile. Reopen this tab to try again."})}export{fe as P,pe as a};
@@ -0,0 +1 @@
1
+ import{a8 as O,aa as E,a9 as S,aA as h,ab as j,az as D,ei as T,r as b,j as l,Q as z,I as q,B as k}from"./index-CdKpQ1hI.js";function B(){var a,d,c,m,g,p;const r=O(),s=E(),{data:e,isLoading:o}=S({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:T}),i=j({mutationKey:D,mutationFn:u=>r.updateConfig({profile:u}),onSuccess:()=>{s.invalidateQueries({queryKey:h.all})}});return{roles:((a=e==null?void 0:e.profile)==null?void 0:a.roles)??[],rolePromptDismissedAt:((d=e==null?void 0:e.profile)==null?void 0:d.rolePromptDismissedAt)??null,identityPromptDismissedAt:((c=e==null?void 0:e.profile)==null?void 0:c.identityPromptDismissedAt)??null,timezone:((m=e==null?void 0:e.profile)==null?void 0:m.timezone)??null,workingHours:((g=e==null?void 0:e.profile)==null?void 0:g.workingHours)??null,away:((p=e==null?void 0:e.profile)==null?void 0:p.away)??null,isLoading:o,saveHours:u=>i.mutateAsync(u).then(()=>{}),saveRoles:u=>i.mutateAsync({roles:u}).then(()=>{}),dismissRolePrompt:()=>i.mutateAsync({rolePromptDismissedAt:new Date().toISOString()}).then(()=>{}),dismissIdentityPrompt:()=>i.mutateAsync({identityPromptDismissedAt:new Date().toISOString()}).then(()=>{})}}let x=!1;function K(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function G(){const r=O(),s=E(),{data:e,isSuccess:o}=S({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:T}),i=e==null?void 0:e.profile;b.useEffect(()=>{if(x||!o||!i)return;if(i.timezone!=null){x=!0;return}const a=K();a&&(x=!0,r.updateConfig({profile:{timezone:a}}).then(()=>s.invalidateQueries({queryKey:h.all})).catch(()=>{}))},[o,i,r,s])}const w=[{id:"software-development",label:"Building software"},{id:"hiring",label:"Hiring people"},{id:"marketing",label:"Marketing"},{id:"writing",label:"Writing"},{id:"research",label:"Research"},{id:"business-ops",label:"Running a business"},{id:"design",label:"Design"},{id:"sales",label:"Sales"}],M=6,F={developer:"software-development",engineer:"software-development",programmer:"software-development",coder:"software-development","software engineer":"software-development",recruiter:"hiring",recruiting:"hiring",talent:"hiring",marketer:"marketing",growth:"marketing",writer:"writing",author:"writing",researcher:"research",scientist:"research",founder:"business-ops",entrepreneur:"business-ops",operations:"business-ops",ops:"business-ops",designer:"design",seller:"sales",salesperson:"sales"};function H(r){var i;const s=r.trim().toLowerCase();if(s.length===0)return;const e=w.find(a=>a.id===s);if(e)return e.id;const o=F[s];return o||((i=w.find(a=>a.label.toLowerCase()===s))==null?void 0:i.id)}const A=10,N=60;function v(r,s){const e=s.trim().toLowerCase();return r.some(o=>o.trim().toLowerCase()===e)}function W({selected:r,onChange:s,onConfirm:e,confirmLabel:o,onSkip:i,skipLabel:a,busy:d=!1,error:c=null}){const[m,g]=b.useState(!1),[p,u]=b.useState(""),C=b.useRef(null),y=w.slice(0,M),I=r.filter(t=>!y.some(n=>n.id===t)),f=r.length>=A,P=t=>{v(r,t)?s(r.filter(n=>n!==t)):f||s([...r,t])},L=()=>{const t=p.trim().slice(0,N);if(!t)return;const n=H(t),R=n&&y.some(_=>_.id===n)?n:t;!v(r,R)&&r.length<A&&s([...r,R]),u("")};return l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"What kind of work you do",children:[y.map(t=>{const n=v(r,t.id);return l.jsx("button",{type:"button","aria-pressed":n,disabled:f&&!n,onClick:()=>P(t.id),className:z("focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",n?"border-primary bg-primary text-primary-foreground":"border-input bg-background text-foreground hover:bg-accent"),children:t.label},t.id)}),I.map(t=>l.jsx("button",{type:"button","aria-pressed":!0,onClick:()=>s(r.filter(n=>n!==t)),className:"border-primary bg-primary text-primary-foreground focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:t},t)),!m&&l.jsx("button",{type:"button",disabled:f,onClick:()=>{g(!0),setTimeout(()=>{var t;return(t=C.current)==null?void 0:t.focus()},0)},className:"border-input text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring rounded-md border border-dashed px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",children:"Something else"})]}),f&&l.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"profile-role-cap-hint",children:"Ten at most. Remove a role to add another."}),m&&!f&&l.jsx(q,{ref:C,value:p,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),L())},maxLength:N,placeholder:"Type your work and press Enter","aria-label":"Something else: describe your work",className:"h-8 text-xs"}),c&&l.jsx("p",{className:"text-destructive text-sm",role:"alert","data-testid":"profile-save-error",children:c}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(k,{size:"sm",onClick:e,disabled:d||r.length===0,"data-testid":"confirm-profile",children:o}),i&&l.jsx(k,{size:"sm",variant:"ghost",onClick:i,disabled:d,"data-testid":"skip-profile",children:a})]})]})}export{W as P,G as a,K as b,B as u};
@@ -0,0 +1 @@
1
+ import{j as e,W as c,aT as l,Q as i}from"./index-CdKpQ1hI.js";const p=4,m={compact:"max-w-[200px] gap-1.5 px-2.5 py-1 text-xs",comfortable:"min-h-9 max-w-[280px] gap-2 px-3 py-1.5 text-sm"};function u({suggestions:o,onChipClick:s,ariaLabel:r="Suggested follow-ups",size:a="compact"}){const n=o.slice(0,p);return e.jsx(c.div,{"data-slot":"prompt-suggestion-chips",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},role:"group","aria-label":r,className:"mt-1.5 flex flex-wrap items-center gap-2",children:n.map(t=>e.jsxs("button",{type:"button","aria-label":t,title:t,onClick:()=>s(t),className:i("bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring inline-flex items-center truncate rounded-md transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-offset-2",m[a]),children:[e.jsx(l,{className:i("shrink-0",a==="compact"?"size-3":"size-3.5")}),e.jsx("span",{className:"truncate",children:t})]},t))})}export{u as P};
@@ -0,0 +1 @@
1
+ import{r as g,b as O,L as P,j as e,e as D,N as _,O as U,Q as C,t as z,g as F,R as M,T as Y}from"./index-CdKpQ1hI.js";import{u as q}from"./use-mounted-ref-BWpQ8f91.js";const A="REPORTS_TO_CYCLE",B="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function H({option:a,selected:d,focusable:i,isDefault:p,disabled:x,onPick:c}){const n=z(a.member);return e.jsxs("button",{type:"button",role:"radio","aria-checked":d,tabIndex:i?0:-1,disabled:x,onClick:c,className:C(Y,"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-left text-sm","hover:bg-accent disabled:opacity-60"),children:[e.jsx(F,{size:"xs",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin,badge:null}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[a.label,p&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"text-muted-foreground",children:"(default)"})]})]}),d&&e.jsx(M,{"aria-hidden":!0,className:"size-3.5 shrink-0"})]})}function W({member:a}){var y,R;const d=q(),i=g.useRef(null),p=g.useId(),x=g.useId(),{agent:c,isPending:n,isSaving:h,error:u,update:b}=O(a,{errorLabel:"Couldn’t change who this agent reports to",isShownInline:t=>d.current===!0&&t.code===A}),j=P();if(n||j.isPending)return e.jsx(D,{className:"h-24 w-full"});if(!c)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const I=((y=j.data)==null?void 0:y.members)??[],l=_(c,I,a),m=U(c.id,I,a),E=m.some(t=>t.accountId===l.accountId)?l.accountId:((R=m[0])==null?void 0:R.accountId)??null,L=t=>{var v;const s=Array.from(((v=i.current)==null?void 0:v.querySelectorAll('[role="radio"]'))??[]),r=s.indexOf(document.activeElement),o={ArrowDown:r+1,ArrowRight:r+1,ArrowUp:r-1,ArrowLeft:r-1,Home:0,End:s.length-1}[t.key];if(o===void 0||s.length===0)return;t.preventDefault();const f=s[(o+s.length)%s.length];s.forEach(N=>N.tabIndex=N===f?0:-1),f==null||f.focus()},T=m.filter(t=>t.kind==="person"),S=m.filter(t=>t.kind==="agent"),k=(u==null?void 0:u.code)===A?u.message:null,w=(t,s,r)=>r.length>0&&e.jsxs("div",{role:"group","aria-labelledby":s,className:"space-y-0.5",children:[e.jsx("div",{id:s,className:C(B,"px-1.5"),children:t}),r.map(o=>e.jsx(H,{option:o,selected:l.accountId===o.accountId,focusable:E===o.accountId,isDefault:l.isDefault&&l.accountId===o.accountId,disabled:h,onPick:()=>{o.accountId!==c.reportsTo&&b({reportsTo:o.accountId})}},o.accountId))]});return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-reports-to",children:[e.jsxs("div",{ref:i,role:"radiogroup","aria-label":"Reports to",onKeyDown:L,className:"max-h-72 space-y-2 overflow-y-auto",children:[w("People",p,T),w("Agents",x,S)]}),k&&e.jsx("p",{role:"alert",className:"text-status-error px-1.5 text-xs",children:k}),!l.isDefault&&e.jsx("button",{type:"button",disabled:h,onClick:()=>b({reportsTo:null}),className:"text-muted-foreground hover:text-foreground px-1.5 text-xs underline-offset-2 hover:underline",children:"Use the default"})]})}export{W as ReportsToPopover};
@@ -0,0 +1,44 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dg_bax15.js","assets/index-CdKpQ1hI.js","assets/index-kktlr1TJ.css","assets/room-files-source-C1TCg4W_.js","assets/markdown-content-1-B7PdbY.js","assets/file-exclamation-point-DZrVsShR.js","assets/composer-insert-BpyATrmR.js","assets/index-CHvi6xUU.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-D0vUyeR2.js","assets/link-2-C0mn8T24.js","assets/file-CGg2M6ED.js","assets/git-branch-DbjXDO_F.js","assets/more-details-C6UGVeDE.js"])))=>i.map(i=>d[i]);
2
+ import{a2 as ee,r as a,lI as Gt,j as i,g as Qt,hv as Vt,Q as V,a8 as te,a9 as Yt,bs as K,aa as ye,kk as Ke,b0 as ne,lJ as oe,lK as Jt,lL as Xt,aQ as Zt,lM as re,lN as en,lO as tn,ab as le,lP as nn,lQ as ke,lR as Ge,lS as sn,lT as on,lU as rn,l7 as an,lV as ln,l9 as cn,lW as dn,dE as un,fX as mn,lX as fn,lY as pn,a7 as hn,bE as gn,lZ as xn,l_ as yn,iq as bn,hg as vn,hI as Y,jh as Qe,l$ as lt,bU as Rn,jg as ue,jl as ct,m0 as kn,jm as dt,ap as wn,bY as ut,hb as mt,B as Oe,x as Sn,m1 as Nn,cd as Te,m2 as In,s as fe,eq as jn,jr as ft,m3 as pt,b3 as Cn,e as ae,m4 as be,gO as ht,jk as gt,m5 as An,m6 as Mn,n as En,q as Ie,jj as On,m7 as xt,eO as se,ae as yt,fn as Tn,m8 as _n,m9 as Pn,ma as Dn,mb as $n,l as bt,W as _e,j4 as Ln,aq as Fn,mc as qn,md as Bn,me as Hn,be as zn,c4 as Un,mf as Wn,mg as Kn,mh as Gn,mi as Qn,bF as je,dM as Vn,ja as Yn,jf as Jn,j8 as Xn,mj as Zn,mk as es,ml as ts,mm as ns,eN as ss,jb as os,mn as rs,mo as as,mp as is,hj as ls,X as cs,mq as ds,mr as Ve,ms as us,ak as ms,mt as fs,hH as ps,mu as hs,mv as gs,aN as Ye}from"./index-CdKpQ1hI.js";import{R as xs,A as ys,u as bs,P as vs,a as Rs}from"./use-jump-back-in-BVunjzyr.js";import{m as Ce,a as Je,f as Pe,b as De,d as vt,e as Rt,g as kt,E as ks,h as ws,i as Ss,M as Q,F as Ns,D as Is,U as js,C as X,u as Cs,j as As,k as Ms}from"./index-B-WvQ24u.js";import{a as Es}from"./use-room-follow-claim-DqE5b95Z.js";import"./WidgetErrorCard-ChDNC060.js";import{M as Os}from"./markdown-content-1-B7PdbY.js";import{W as Ts,a as _s}from"./find-latest-widget-fence-CWs9nr10.js";import{f as Ps}from"./format-duration-BCr6uzby.js";import{H as Ds,a as $s,b as Ls}from"./RuntimeSetupDialog-CiWxlcPc.js";import{M as Xe}from"./mention-pill-D_-KXznh.js";import{R as Fs}from"./rotate-ccw-clock-DcBojy-0.js";import{U as qs}from"./unplug-opnrSXAi.js";import{M as Bs}from"./message-square-off-Di7kQvfe.js";import{i as Hs}from"./registry-ChxwU0f4.js";import{f as zs}from"./use-connector-management-dX_4x0d3.js";import{A as Us}from"./AgentRequestCard-BAhfGJxx.js";/**
3
+ * @license lucide-react v1.48.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const wt={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};wt.node;const Ws=ee(wt);/**
8
+ * @license lucide-react v1.48.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const St={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};St.node;const Ks=ee(St);/**
13
+ * @license lucide-react v1.48.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const Nt={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};Nt.node;const Gs=ee(Nt);/**
18
+ * @license lucide-react v1.48.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const It={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};It.node;const Qs=ee(It);/**
23
+ * @license lucide-react v1.48.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const jt={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};jt.node;const Vs=ee(jt);/**
28
+ * @license lucide-react v1.48.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Ct={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};Ct.node;const Ys=ee(Ct);/**
33
+ * @license lucide-react v1.48.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const At={name:"user-minus",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:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};At.node;const Ze=ee(At);/**
38
+ * @license lucide-react v1.48.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const Mt={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"}]]};Mt.node;const Js=ee(Mt),Xs=300;function ce({className:e,children:t}){return i.jsx("span",{className:V("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 Et({identity:e,children:t,onViewProfile:s,className:n}){const{kind:o,displayName:r,handle:l,color:c,emoji:h,imageUrl:p,origin:u,agent:d}=e,k=c??"hsl(var(--muted-foreground))",f=typeof u=="object"&&u!==null,g=o==="agent"&&(d==null?void 0:d.working)!=null?d.working:null,[y,x]=a.useState(!1),N=a.useRef(!1),m=a.useRef(null),b=Gt({onLongPress:()=>{N.current&&x(!0)}});return i.jsxs(Ds,{open:y,onOpenChange:x,openDelay:Xs,children:[i.jsx($s,{asChild:!0,ref:m,"data-gesture-priority":"",...b,onPointerDown:E=>{N.current=E.pointerType==="touch"||E.pointerType==="pen",b.onPointerDown(E)},children:t}),i.jsxs(Ls,{"data-slot":"identity-hover-card",align:"start",className:V("flex w-64 flex-col gap-0 overflow-hidden p-0",n),children:[i.jsxs("div",{className:"flex items-center gap-3 p-3",children:[i.jsx(Qt,{"aria-hidden":!0,color:k,emoji:h,imageUrl:p,fallback:Vt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&i.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((d==null?void 0:d.runtime)||(d==null?void 0:d.model))&&i.jsx(ce,{children:[d.runtime,d.model].filter(Boolean).join(" · ")}),g&&i.jsxs(ce,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Ps(g.forMs)]}),o==="human"&&i.jsx(ce,{children:f?u.platform:"On this machine"}),o==="agent"&&(d==null?void 0:d.managedBy)&&i.jsxs(ce,{children:["Managed by"," ",d.managedBy.handle?`@${d.managedBy.handle}`:d.managedBy.displayName]})]}),s?i.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var E;(E=m.current)==null||E.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand 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"}):i.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[i.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),i.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function Ot(e,t={}){const s=te();return Yt({queryKey:K.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&t.enabled===!0})}function Zs(e,t){const s=e??[];return s.some(n=>n.seq===t.seq)?s:s.length===0||s[s.length-1].seq<t.seq?[...s,t]:[...s,t].sort((n,o)=>n.seq-o.seq)}function eo(e,t){const s=e??[],n=s.findIndex(c=>c.id===t.id);if(n===-1)return s;const o=s[n];if(o.seq!==t.seq||o.roomId!==t.roomId||JSON.stringify(o.body)===JSON.stringify(t.body)&&JSON.stringify(o.mentions)===JSON.stringify(t.mentions)&&JSON.stringify(o.mentionSpans)===JSON.stringify(t.mentionSpans))return s;const l=[...s];return l[n]={...o,body:t.body,mentions:t.mentions,mentionSpans:t.mentionSpans},l}function to(e,t){if(t.kind!=="notice"||t.body.notice!=="turn_failed")return;const s=t.body.subjectAuthorId;s!==void 0&&re.getState().clearAuthor(e,s)}function no(e,t){const s=e.getQueryData(K.entries(t));return s&&s.length>0?s[s.length-1].seq:0}function so(e,t){var s;return((s=e.getQueryData(K.detail(t)))==null?void 0:s.viewerAuthorId)??null}const oo=2e3;function ro(){const e=a.useRef(null),t=a.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),s=a.useCallback(o=>{t(),ne.getState().endRoomCanvasCycle(o)},[t]),n=a.useCallback(o=>{t(),e.current=setTimeout(()=>{e.current=null,ne.getState().endRoomCanvasCycle(o)},oo)},[t]);return a.useEffect(()=>t,[t]),{arm:n,now:s}}function ao(e){const t=Math.min(oe.BACKOFF_CAP_MS,oe.BACKOFF_BASE_MS*2**e);return Math.random()*t}const io=50;function lo(e,t){return new Promise(s=>{if(t.aborted)return s();const n=()=>{clearTimeout(o),t.removeEventListener("abort",n),s()},o=setTimeout(n,e);t.addEventListener("abort",n,{once:!0})})}function co(e,t){const s=te(),n=ye(),[o,r]=a.useState(null),[l,c]=a.useState(null),[h,p]=a.useState(0),u=a.useRef(!1),d=ro(),k=a.useCallback(()=>p(y=>y+1),[]),f=a.useRef(null),g=a.useCallback(()=>{f.current===null&&(f.current=setTimeout(()=>{f.current=null,p(y=>y+1)},io))},[]);return a.useEffect(()=>{if(e===null)return;const y=()=>g();let x=null;const N=()=>{if(document.visibilityState!=="visible"){x=Date.now();return}const E=x===null?0:Date.now()-x;x=null,(u.current||E>=oe.VISIBILITY_GRACE_MS)&&g()};let m=Ke.getListConnectionState();const b=Ke.subscribeListConnectionState(E=>{const O=E==="connected"&&m==="reconnecting";m=E,O&&g()});return window.addEventListener("online",y),document.addEventListener("visibilitychange",N),()=>{window.removeEventListener("online",y),document.removeEventListener("visibilitychange",N),b(),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[e,g]),a.useEffect(()=>(ne.getState().setRoomCanvasLiveRoom(e),()=>ne.getState().setRoomCanvasLiveRoom(null)),[e]),a.useEffect(()=>{if(e===null||!t)return;const y=new AbortController;let x=!0,N;return(async()=>{r(null),c(null),u.current=!1;let m=0,b=!1;const E=()=>{m=0,u.current=!1,b&&(b=!1,r(O=>O===e?null:O))};for(;x&&!y.signal.aborted;){const O=Date.now();u.current=!1,ne.getState().beginRoomCanvasCycle(e),d.arm(e);const D=setTimeout(E,oe.STABILITY_WINDOW_MS);let j;try{if(j=Jt(s,e,no(n,e),y.signal),N=j,!x||y.signal.aborted){j.retire();return}for await(const S of j.stream){if(!x||y.signal.aborted||(E(),!j.current()))return;if(S.type==="canvas_event"||S.type==="canvas_channel_snapshot"){if(j.publish(S),!j.current())return;continue}if(S.type==="signal"){Xt(S)?Zt.getState().observe(e,S):(re.getState().observe(e,S),ne.getState().applyRoomCanvasPresence(e,S));continue}if(S.type==="reaction"){n.setQueryData(K.entries(e),_=>Ce(_,S.entryId,S.reactions));continue}if(S.type==="revision"){if(S.entry.roomId!==e)continue;n.setQueryData(K.entries(e),_=>eo(_,S.entry));continue}if(S.type==="canvas"){ne.getState().applyRoomCanvasFrame(e,S,so(n,e)),S.change!==void 0?d.now(e):d.arm(e);continue}re.getState().clearAuthor(e,S.entry.authorId),to(e,S.entry),en.getState().settle(e,S.entry.id),n.setQueryData(K.entries(e),_=>Zs(_,S.entry))}}catch(S){if(y.signal.aborted)return;if(console.warn("[rooms] live stream dropped",{roomId:e,err:S}),tn(S)){re.getState().clearRoom(e),c(e),r(e),clearTimeout(D);return}}finally{try{j==null||j.retire()}finally{clearTimeout(D)}}if(y.signal.aborted)return;Date.now()-O>=oe.STABILITY_WINDOW_MS&&(m=0),m+=1,u.current=!0,m>=oe.DISCONNECTED_THRESHOLD&&!b&&(re.getState().clearRoom(e),r(e),b=!0),await lo(ao(m),y.signal)}})(),()=>{x=!1;try{N==null||N.retire()}finally{y.abort()}}},[e,t,s,n,h]),{stalled:o!==null&&o===e,unavailable:l!==null&&l===e,retry:k}}function uo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.haltRoomAgent(t,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function mo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.promoteHold(t,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function fo(){const e=te(),t=ye();return le({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var u;const l=t.getQueryData(K.entries(s)),c=(u=l==null?void 0:l.find(d=>d.id===n))==null?void 0:u.reactions,{reactions:h,on:p}=Je(c,o,r);return t.setQueryData(K.entries(s),d=>Ce(d,n,h)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var h,p;const l=t.getQueryData(K.entries(s)),c=((p=(h=l==null?void 0:l.find(u=>u.id===n))==null?void 0:h.reactions)==null?void 0:p.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:r,viewerAuthorId:l},c)=>{c!==void 0&&t.setQueryData(K.entries(n),h=>{var d;const p=(d=h==null?void 0:h.find(k=>k.id===o))==null?void 0:d.reactions,{reactions:u}=Je(p,r,l,!c.on);return Ce(h,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(K.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 Tt(e){return Z(e)??e.id}function $e(e,t){return Math.max(t??0,e)}function po(e,t,s){let n=e[0],o=0;for(const r of e)r.seq>n.seq&&(n=r),t!==null&&r.seq>t&&(o+=1);return{count:$e(e.length,s),lastAt:n.createdAt,unread:o}}function ho(e){const t=te(),s=ye(),n=nn(e),o=ke(u=>{var d;return e===null?null:((d=u.paging[e])==null?void 0:d.cursor)??null}),r=le({mutationFn:async u=>{var x;const d=(x=ke.getState().paging[u])==null?void 0:x.cursor;if(d==null)return;const k=await t.listRoomEntries(u,{before:d,limit:Ge}),f=K.entries(u),g=s.getQueryData(f),y=sn(g,k);s.setQueryData(f,y),ke.getState().notePage(u,on(k)??d,rn(k,Ge)||y.length===((g==null?void 0:g.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:c}=r,h=a.useRef(!1),p=a.useCallback(async()=>{if(!(e===null||h.current)){h.current=!0;try{await l(e).catch(()=>{})}finally{h.current=!1}}},[e,l]);return{canLoadOlder:n,isLoadingOlder:c,cursor:o,loadOlder:p}}function go(e){return i.jsx(_s,{code:e.code,isIncomplete:e.isIncomplete})}const xo=[{language:Ts,component:go}],yo={turn_failed:{Icon:hn,tone:"text-status-warning"},agent_busy:{Icon:pn},agent_gone:{Icon:Js,tone:"text-status-warning"},agent_left:{Icon:Ze,tone:"text-status-warning"},room_archived:{Icon:fn},runtime_gone:{Icon:Qs,tone:"text-status-warning"},agent_paused:{Icon:mn},agent_declined:{Icon:Bs},agent_unavailable:{Icon:un},awaiting_approval:{Icon:Ws,tone:"text-status-warning"},halted:{Icon:dn},budget_reached:{Icon:cn},cascade_stopped:{Icon:ln},addressing_changed:{Icon:Gs},bridge_blocked:{Icon:qs,tone:"text-status-warning"},bridge_undelivered:{Icon:an,tone:"text-status-warning"},bridge_rate_limited:{Icon:Ys},bridge_second_agent_refused:{Icon:Ze},bridge_disconnected:{Icon:Ks},bridge_agent_swapped:{Icon:xs},bridge_history_note:{Icon:Fs}},bo={Icon:gn},we=80;function vo(e){const t=e.trim();if(t.length<=we)return t;const s=t.slice(0,we),n=s.lastIndexOf(" ");return`${(n>we/2?s.slice(0,n):s).trimEnd()}…`}function Ro(e,t,s){const n=ko(e,s),o=r=>i.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-2",children:r});return n===null?i.jsxs(i.Fragment,{children:[e," ",o("Open chat")]}):i.jsxs(i.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function ko(e,t){if(t!==void 0){const n=xn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=yn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function wo({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&yo[e.body.notice])??bo;return i.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":vo(e.body.text)},...Pe(t),className:V("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",l??"text-muted-foreground"),children:[i.jsx(r,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),i.jsx("span",{children:n?Ro(e.body.text,n,o):e.body.text})]})}const So=Hs.moment;function No({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:r}){const l=De(e.createdAt);return i.jsx("div",{id:r,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...Pe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:i.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[i.jsx(Et,{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:i.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[i.jsx(vt,{author:s}),i.jsx("span",{className:"sr-only",children:s.displayName})]})}),i.jsx(So,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),i.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),l.length>0&&i.jsx("time",{dateTime:e.createdAt,title:Rt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:l})]})})}function Io({id:e,summary:t,open:s,onOpen:n}){const{capabilities:o}=kt(),{count:r,lastAt:l,unread:c}=t,h=De(l),[p,u]=a.useState({count:r,bumped:!1});p.count!==r&&u({count:r,bumped:!0});const d=p.count===r&&p.bumped;return o.threads?i.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":c>0?"":void 0,"aria-expanded":s,onClick:n,className:V("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",c>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[i.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),i.jsx("span",{className:V(d&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:r},r),r===1?" reply":" replies",h.length>0&&i.jsxs(i.Fragment,{children:[" · last ",i.jsx("time",{dateTime:l,title:Rt(l),children:h})]}),c>0&&` · ${c} new`]}):null}function jo(e,t){const s=ue.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
43
+ `)?"":" ";s.set(e,`${n}${o}@${t} `)}function Co({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const r=Tt(t),l=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,h=s==null?void 0:s.displayName,{copy:p}=bn({toastOnSettle:!0});return a.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Vs,run:()=>{Y.getState().openThread(e,r,!0),Qe.getState().requestFocus(lt(e,r))}},copy:{id:"copy",label:"Copy text",icon:vn,run:()=>void p(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Rn,run:o}),c!==void 0&&(u.mention={id:"mention",label:h===void 0?"Mention author":`Mention ${h}`,icon:ys,run:()=>{jo(e,c),Qe.getState().requestFocus(e)}}),ks.map(d=>u[d]).filter(d=>d!==void 0)},[e,r,l,c,h,o,p])}function Ao(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Le(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 pe(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function J(e,t,s){const n=t.get(e),o=ct({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 Mo(e){const t=new Set;for(const r of e)Z(r)===null&&t.add(r.id);const s=[],n=new Map,o=new Set;for(const r of e){const l=Z(r);if(l===null){s.push(r);continue}if(!t.has(l)){s.push(r),o.add(r.id);continue}const c=n.get(l);c?c.push(r):n.set(l,[r])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function _t(e){return`thread-${e}`}function he(e){return`thread-row-${e}`}function Ae(e){return`thread-panel-entry-${e}`}function ge(e){return`room-entry-${e}`}function Fe(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=Z(s)??null,o={rowId:t,domId:ge(t)};if(n===null)return o;const r=e.find(c=>c.id===n);return r!==void 0&&(Z(r)??null)===null?{rowId:_t(n),domId:he(n)}:o}function Eo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fe(e,s.id)}const et=48;function Pt(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 r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:n,excerpt:r.length>et?`${r.slice(0,et).trimEnd()}…`:r}}function Oo(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const r=kn({runtime:o.runtime,model:o.model});s.set(dt(n.projectPath),{memberId:n.id,visual:wn(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function To(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const _o={info:new Map,faces:new Map},qe=a.createContext(_o);function Dt({known:e,children:t}){return i.jsx(qe.Provider,{value:e,children:t})}function Be(){const e=ut(),t=a.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=a.useMemo(()=>t.map(l=>l.projectPath),[t]),n=mt(s),o=a.useMemo(()=>Oo(t,n.data??{}),[t,n.data]),r=a.useMemo(()=>To(o),[o]);return a.useMemo(()=>({info:o,faces:r}),[o,r])}function Me(e){const t=a.useContext(qe);return e===void 0?void 0:t.info.get(e)}function Po(){return a.useContext(qe).faces}function Do({loading:e,onLoad:t}){return i.jsx("div",{className:"flex justify-center px-4 py-3",children:i.jsxs(Oe,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&i.jsx(Sn,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function $o({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:r,summaryId:l,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?r:l,...Pe(c)}}const me=120,Lo="code block";function Fo(e){if(e.length<=me&&!e.includes("```"))return null;const t=qo(e);return t.length===0?null:t}function qo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Lo} `).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<=me)return t;const s=Bo(t,me),n=s.lastIndexOf(" ");return`${(n>me/2?s.slice(0,n):s).trimEnd()}…`}function Bo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of n.segment(e)){if(o.length+r.length>t)break;o+=r}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Ho({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:r=!0}){const l=fo(),c=o===!0||!r,h=a.useMemo(()=>t.reactions??[],[t.reactions]),p=a.useMemo(()=>h.filter(k=>ws(k,s)).map(k=>k.emoji),[h,s]),u=a.useCallback(k=>l.mutate({roomId:e,entryId:t.id,emoji:k,viewerAuthorId:s}),[l,e,t.id,s]),d=a.useMemo(()=>({quick:n,mine:p,onToggle:u,disabled:c}),[n,p,u,c]);return{reactions:h,toggle:u,quickRow:d}}function zo({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var r,l;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(r=t.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(l=e.current)==null||l.focusFirst())}}function Uo(e,t){var d,k;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Nn.includes(n),r=Ot(e,{enabled:o}),l=Te(),c=ye(),h=te(),p=o?((k=(d=r.data)==null?void 0:d.bindings.find(f=>f.authorId===s))==null?void 0:k.sessionId)??null:null,u=a.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(p===null||s===void 0)&&In({queryClient:c,transport:h},e,s).then(g=>{g.kind!=="none"&&l(fe({session:g.kind==="bound"?g.sessionId:p}))}))},[s,l,c,e,p,h]);return a.useMemo(()=>p===null?null:{href:jn({session:p}),onOpen:u},[u,p])}const xe="mention",He="author_id",Wo={[xe]:[He]},Ko=[xe];function Go(e,t){if(!t||t.length===0)return e;const s=Qo(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:c}=s[o],h=n.slice(0,r),p=n.slice(r,r+l),u=n.slice(r+l);n=`${h}<${xe} ${He}="${c}">${p}</${xe}>${u}`}return n}function Qo(e,t){const s=[...t].sort((r,l)=>r.offset-l.offset),n=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(n.push(r),o=r.offset+r.length);return n}const Vo=new Map,$t=a.createContext(Vo);function Yo({authors:e,children:t}){return i.jsx($t.Provider,{value:e,children:t})}function Jo(e){const t=a.useContext($t);return e===void 0?void 0:t.get(e)}function Xo(e){return typeof e=="string"?e.replace(/^@/,""):""}function Zo({authorId:e,children:t}){const s=Jo(e),n=Me(s==null?void 0:s.agentRef),{open:o}=ft();if(!s)return i.jsx(Xe,{kind:"human",label:Xo(t),resolved:!1});const r=ct({record:s,override:n==null?void 0:n.visual}),l=pt(s,n==null?void 0:n.memberId),c=l===void 0?void 0:()=>o(l),h=c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),c())}}:{};return i.jsx(Et,{onViewProfile:c,identity:{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}},children:i.jsx(Xe,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...h})})}function er(e){return{mention:t=>{const s=t[He],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?i.jsx(i.Fragment,{children:t.children}):i.jsx(Zo,{authorId:n,children:t.children})}}}function tr({entry:e,authors:t}){const s=a.useMemo(()=>Go(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=a.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=a.useMemo(()=>er(n),[n]);return i.jsx(Yo,{authors:t,children:i.jsx(Os,{content:s,className:"msg-prose",allowedTags:Wo,literalTagContent:Ko,components:o,renderers:xo})})}function nr(e){return function(s){return i.jsx(tr,{entry:s,authors:e})}}const Lt="the top folder";function tt(e){return e.slice(e.lastIndexOf("/")+1)}function sr(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function or(e){return e===""?Lt:`${e}/`}function Se(e){return e.target!==void 0?e.target===""?Lt:e.target:or(sr(e.paths[0]??""))}function rr(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 ${tt(s)} to ${Se(e)}`:`${t} uploaded ${e.pathCount} files to ${Se(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 ${tt(s)} from the chat to ${Se(e)}`}}const ar=a.lazy(()=>Cn(()=>import("./index-Dg_bax15.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.SaveToRoomFilesButton})));function Ft({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:c,streamStalled:h,isMember:p=!0,grouping:u,orphanedReply:d,answers:k,feedPosition:f,rowId:g}){const y=De(t.createdAt),x=a.useMemo(()=>{const G=Fo(t.body.text),Re=Ss(t.attachments??[]);if(Re===null)return G;const We=G??t.body.text.trim();return We.length>0?`${We} ${Re}`:Re},[t.body.text,t.attachments]),N=a.useId(),m=`${N}-author`,b=`${N}-content`,E=`${N}-summary`,O=a.useRef(null),D=a.useRef(null),j=a.useRef(null),{reactions:S,toggle:_,quickRow:I}=Ho({roomId:e,entry:t,viewerAuthorId:r,reactionFrequents:c,streamStalled:h,isMember:p}),L=Me(n==null?void 0:n.agentRef),{open:$}=ft(),T=n===void 0?void 0:pt(n,L==null?void 0:L.memberId),B=a.useCallback(()=>{T!==void 0&&$(T)},[$,T]),F=T===void 0?void 0:B,H=Co({roomId:e,entry:t,author:n,viewerAuthorId:r,onViewProfile:F}),W=zo({barRef:D,pillsRef:j,hasReactions:S.length>0}),q=a.useCallback(()=>{var G;return(G=O.current)==null?void 0:G.focus()},[]),z=a.useMemo(()=>nr(o),[o]),w=a.useCallback(G=>i.jsx(a.Suspense,{fallback:null,children:i.jsx(ar,{roomId:e,attachment:G})}),[e]),v=Po(),P=t.body.subjectAuthorId??t.authorId,M=o.get(P),R=Me(M==null?void 0:M.agentRef),A=Uo(e,t),C=Ao(t);if(C.kind==="notice")return i.jsx(wo,{entry:t,feedPosition:f,rowId:g,sessionLink:A,subjectName:M==null?void 0:M.displayName});if(C.kind==="moment")return i.jsx(No,{entry:t,moment:C.moment,subject:P===t.authorId?s:J(P,o,v),subjectIdentity:{handle:(M==null?void 0:M.handle)??void 0,origin:M==null?void 0:M.origin,agent:R&&{runtime:R.runtime,...R.model&&{model:R.model}}},feedPosition:f,rowId:g});const U=u.position==="first"||u.position==="only";return i.jsxs(Q.Root,{ref:O,id:g,position:u.position,actions:H,reactions:I,"data-testid":"room-entry",tabIndex:0,...$o({showAuthorHeader:U,headerId:m,displayName:s.displayName,time:y,summary:x,contentId:b,summaryId:E,feedPosition:f}),onKeyDown:W,children:[i.jsx(Q.Gutter,{author:s,at:t.createdAt,onViewProfile:F,isSelf:t.authorId===r}),i.jsxs(Q.Body,{children:[i.jsx(Q.Author,{id:m,author:s,at:t.createdAt,origin:n==null?void 0:n.origin}),d===!0&&i.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),k!=null&&i.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${k.excerpt}”`}),i.jsx(Q.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:t.body.fileChange?i.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:rr(t.body.fileChange,(M==null?void 0:M.displayName)??"Somebody")}):z(t,{rowId:t.id,isStreaming:!1})}),x!==null&&i.jsx("span",{id:E,className:"hidden",children:x}),i.jsx(Q.Attachments,{items:t.attachments??[],renderAction:p?w:void 0}),i.jsx(Q.Reactions,{ref:j,reactions:S,viewerAuthorId:r,names:l,frequents:c,onToggle:_,disabled:h===!0||!p,onExit:q}),i.jsx(Q.Actions,{actions:H,reactions:I,barRef:D,onExit:q})]})]})}const ir="room-load-older",lr=4;function qt({roomName:e}){return i.jsx(Ns,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:lr},(t,s)=>i.jsxs("div",{className:"flex gap-3",children:[i.jsx(ae,{className:"size-7 shrink-0 rounded-full"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function cr({roomId:e,roomName:t,viewerAuthorId:s,entries:n,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:c,streamStalled:h,isLoading:p,error:u,onAddAgents:d,openThreadId:k,onOpenThread:f,resumeRow:g,landOnRow:y,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:m=!1,onLoadOlder:b,ref:E}){const O=a.useMemo(()=>Le(o,r),[o,r]),D=be(o,s),j=Be(),S=a.useMemo(()=>new Map([...O].map(([v,P])=>[v,P.displayName])),[O]),_=ht(),I=gt(e,null),{topLevel:L,repliesByRoot:$,orphaned:T}=a.useMemo(()=>Mo(n),[n]),B=a.useMemo(()=>new Map(n.map(v=>[v.id,v])),[n]),F=a.useMemo(()=>{const v=An(L,l),P=Mn(L.map(R=>({id:R.id,authorId:R.body.moment?`moment:${R.id}`:R.authorId,timestamp:R.createdAt})),{now:_,lastSeenId:v.lastSeenId,unreadFromStart:v.fromStart}),M=[];N&&!p&&M.push({kind:"load-older",id:ir});for(const R of P){if(R.kind==="day-divider"){M.push({kind:"day-divider",id:R.key,label:R.label});continue}if(R.kind==="unread-divider"){M.push({kind:"unread-divider",id:R.key});continue}const A=L[R.index];M.push({kind:"message",id:A.id,entry:A,grouping:R.grouping,position:R.index+1,answers:Pt(A,L[R.index-1],B.get.bind(B))});const C=$.get(A.id);C&&M.push({kind:"thread-reply",id:_t(A.id),rootId:A.id,replies:C,totalReplies:A.threadReplyCount})}return M},[L,$,B,l,_,N,p]),H=a.useMemo(()=>F.map(v=>v.kind==="load-older"?{kind:"notice",id:v.id,at:"",body:null}:v.kind==="day-divider"?{kind:"day-divider",id:v.id,label:v.label}:v.kind==="unread-divider"?{kind:"unread-divider",id:v.id}:v.kind==="thread-reply"?{kind:"thread-reply",id:v.id,rootId:v.rootId,replyCount:$e(v.replies.length,v.totalReplies),lastAt:v.replies[v.replies.length-1].createdAt}:{kind:"message",id:v.id,payload:v.entry,grouping:v.grouping,author:J(pe(v.entry,O),O,j.faces),at:v.entry.createdAt}),[F,O,j.faces]),W=a.useCallback((v,P)=>{const M=F[P.index];if(M.kind==="load-older")return b===void 0?null:i.jsx(Do,{loading:m,onLoad:b});if(M.kind==="day-divider")return i.jsx(Is,{label:M.label});if(M.kind==="unread-divider")return i.jsx(js,{});if(M.kind==="thread-reply"){if(P.onOpenThread===void 0)return null;const A=P.onOpenThread;return i.jsx(Io,{id:he(M.rootId),summary:po(M.replies,l,M.totalReplies),open:k===M.rootId,onOpen:()=>A(M.rootId)})}const R=pe(M.entry,O);return i.jsx(Ft,{roomId:e,entry:M.entry,author:J(R,O,j.faces),authorRef:O.get(R),authors:O,viewerAuthorId:s,authorNames:S,reactionFrequents:c,streamStalled:h,isMember:D,grouping:M.grouping,orphanedReply:T.has(M.entry.id),answers:M.answers,feedPosition:{index:M.position,total:-1},rowId:ge(M.entry.id)})},[F,e,O,j.faces,s,S,c,h,D,T,l,k,m,b]),q=a.useCallback(v=>{if(v.kind==="message")return ge(v.id);if(v.kind==="thread-reply")return he(v.rootId)},[]);if(u)return i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),i.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const z=o.some(v=>v.author.kind==="agent"),w=i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx(En,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),i.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),i.jsx("p",{className:"max-w-sm",children:z?"Say something to get it going.":"Nothing answers until you add an agent."}),i.jsx(Oe,{type:"button",size:"sm",variant:z?"ghost":"default",onClick:d,className:"mt-1",children:z?"Add more agents":"Add agents"})]});return i.jsx(Dt,{known:j,children:i.jsx(X.Timeline,{ref:E,conversationId:e,label:`Messages in ${t}`,rows:H,renderRow:W,onOpenThread:f,domIdOf:q,...g===void 0?{}:{resumeRow:g},...y===void 0?{}:{landOnRow:y},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:p?i.jsx(qt,{roomName:t}):void 0,empty:w,feedTestId:"room-timeline"})})}const ze={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function dr(e){const t=te(),[s,n]=a.useState([]),o=a.useRef(new Map),r=a.useCallback(f=>{const g=f.map(y=>({id:crypto.randomUUID(),file:y,status:"pending",progress:0}));n(y=>[...y,...g])},[]),l=a.useCallback(f=>{o.current.delete(f),n(g=>g.filter(y=>y.id!==f))},[]),c=a.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const g=new Set(f);for(const y of g)o.current.delete(y);n(y=>y.filter(x=>!g.has(x.id)))},[]),h=a.useCallback(f=>{o.current.delete(f),n(g=>g.map(y=>y.id===f&&y.status==="error"?{...y,status:"pending",progress:0,error:void 0}:y))},[]),p=a.useRef(null),u=le({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(N=>N.map(m=>f.some(b=>b.id===m.id)?{...m,status:"uploading"}:m));const g=N=>{n(m=>m.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},y=new AbortController;p.current=y;const x=f.map(N=>N.file);return t.uploadRoomAttachments(e,x,g,y.signal)},onSettled:()=>{p.current=null},onSuccess:(f,g)=>{g.forEach((y,x)=>{const N=f[x];N&&o.current.set(y.id,N.id)}),n(y=>y.map(x=>g.findIndex(m=>m.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:f=>{n(g=>g.map(y=>y.status==="uploading"?{...y,status:"error",error:f.message}:y))}}),d=a.useCallback(()=>{var f;(f=p.current)==null||f.abort()},[]),k=a.useCallback(async()=>{const f=s.filter(y=>y.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const g=s.filter(y=>y.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(y=>o.current.get(y.id)).filter(y=>y!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:h,clearFiles:c,cancelUpload:d,uploadAndGetIds:k,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function Bt(e){const{room:t,threadRootId:s}=e,n=Cs(),o=As(),r=dr((t==null?void 0:t.id)??""),l=t!==void 0&&be(t.members,t.viewerAuthorId),c=a.useRef({attachments:r,post:n,reply:o,room:t,threadRootId:s});a.useEffect(()=>{c.current={attachments:r,post:n,reply:o,room:t,threadRootId:s}});const h=a.useCallback(m=>c.current.attachments.addFiles(m),[]),p=a.useCallback(m=>c.current.attachments.removeFile(m),[]),u=a.useCallback(m=>c.current.attachments.retryFile(m),[]),d=a.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:k,hasFailedUpload:f,isUploading:g}=r,y=a.useMemo(()=>({staged:k,add:h,remove:p,retry:u,cancel:d,hasFailed:f,isUploading:g,holdsSendWhileUploading:!1}),[k,f,g,h,p,u,d]),x=a.useCallback(async m=>{const{attachments:b,post:E,reply:O,room:D,threadRootId:j}=c.current;if(D===void 0)throw new Error("That room isn’t loaded yet.");if(D.archived)throw new Error("This room is archived.");Ie.getState().recordOpened("room",D.id);const S=On(),_=b.pendingFiles.map(T=>T.file.name),I=b.pendingFiles.map(T=>T.id),L=await b.uploadAndGetIds();b.clearFiles(I);const $=m.parentEntryId??j;if($!==void 0){O.mutate({roomId:D.id,rootEntryId:$,text:m.text,clientId:S,attachmentIds:L,attachmentNames:_});return}E.mutate({roomId:D.id,text:m.text,clientId:S,attachmentIds:L,attachmentNames:_})},[]);return{target:a.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&&l,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:xt},send:x,attachments:y}),[t,s,l,y,x]),attachments:r}}function ur(e){const{roomId:t,entrySeq:s,entries:n,historyLoaded:o}=e,r=s===void 0?null:`${t}:${s}`,l=a.useMemo(()=>{if(s===void 0)return null;const g=n.find(m=>m.seq===s);if(g===void 0)return null;const y=Fe(n,g.id);if(y===null)return null;const x=Z(g)??null,N=x!==null&&y.rowId!==g.id;return{roomRowId:y.rowId,threadRootId:N?x:null,entryId:g.id}},[n,s]),c=a.useRef(null),h=(l==null?void 0:l.threadRootId)??null;a.useEffect(()=>{r===null||h===null||c.current!==r&&(c.current=r,Y.getState().openThread(t,h))},[r,t,h]);const p=a.useRef(null);a.useEffect(()=>{r===null||!o||l===null&&p.current!==r&&(p.current=r,yt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=a.useRef(null),d=a.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),k=a.useRef(null),f=a.useCallback(()=>{if(!(r===null||k.current===r))return k.current=r,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[r,l]);return{roomRow:s===void 0?void 0:d,threadRow:s===void 0?void 0:f}}function mr(e,t){const[s,n]=a.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(n({roomId:null,seq:null}),null):t===null?null:(n({roomId:e,seq:t}),t)}const fr=600;function pr(e){return document.getElementById(he(e))??document.getElementById(ge(e))}function hr(){const e=a.useRef(null);return a.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:a.useCallback(s=>{var c;(c=e.current)==null||c.call(e);let n=0;const o=Date.now()+fr;let r=!1;const l=()=>{if(r)return;const h=document.activeElement;if(h===null||h===document.body||!h.isConnected){const u=pr(s);if(u!==null){u.focus();return}}Date.now()>=o||(n=requestAnimationFrame(l))};n=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(n)}},[])}}function gr({roomId:e,route:t,urlThreadId:s,openThreadId:n,entries:o,historyLoaded:r}){const l=Tn(),c=a.useRef(null);a.useEffect(()=>{if(e!==null){if(c.current!==e&&(c.current=e,s!==void 0)){Y.getState().openThread(e,s);return}if(r&&n!==void 0){const h=o.find(u=>u.id===n),p=h===void 0?void 0:Tt(h);if(p!==void 0&&p!==n){const u=Y.getState().open[e];Y.getState().openThread(e,p,(u==null?void 0:u.focusComposer)??!1);return}}n!==s&&(l==null||l({to:t,search:h=>({...h,thread:n}),replace:!0}))}},[e,t,n,s,o,r,l])}const xr=6,Ht="jump-back-in-listbox";function Ue(e){return`jump-back-in-item-${e}`}const yr='[role="combobox"]';function ie(e){return e instanceof Element&&e.matches(yr)}function br({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=Te(),o=_n(),[r,l]=a.useState(!1),[c,h]=a.useState({stamp:"",index:0}),[p,u]=a.useState(!1),[d,k]=a.useState(!1);e.length>0&&!d&&k(!0);const f=a.useRef(!1);a.useEffect(()=>{f.current=!0},[]);const{data:g}=ut({enabled:s}),y=a.useMemo(()=>((g==null?void 0:g.agents)??[]).map(w=>w.projectPath),[g]),{data:x}=mt(y,{enabled:s}),N=a.useMemo(()=>x??{},[x]),m=a.useMemo(()=>Pn(y,N),[y,N]),b=a.useMemo(()=>new Map(y.map(w=>[dt(w),w])),[y]),E=a.useCallback(w=>Dn({room:w,agentsByPath:N,pathByAgentRef:b}),[N,b]),O=a.useMemo(()=>$n(o.muted),[o.muted]),{items:D}=bs({mutedRoomIds:O,enabled:s}),j=a.useMemo(()=>D.slice(0,xr),[D]),S=s&&r&&!p&&!d&&!t&&e.length===0&&j.length>0,_=`${S}:${j.length}`,I=c.stamp===_?c.index:0,L=a.useCallback(w=>{f.current&&ie(w.target)&&(u(!1),k(!1),l(!0))},[]),$=a.useCallback(w=>{ie(w.target)&&l(!0)},[]),T=a.useCallback(w=>{ie(w.target)&&l(!1)},[]),B=a.useCallback(w=>{j.length!==0&&h(v=>{const P=v.stamp===_?v.index:0;return{stamp:_,index:(P+w+j.length)%j.length}})},[j.length,_]),F=a.useCallback(()=>B(1),[B]),H=a.useCallback(()=>B(-1),[B]),W=a.useCallback(()=>{u(!0)},[]),q=a.useCallback(w=>{if(u(!0),w.kind==="session"){w.session.cwd&&Ie.getState().recordOpened("agent",w.session.cwd),n(fe({dir:w.session.cwd??void 0,session:w.session.id}));return}Ie.getState().recordOpened("room",w.room.id),n({...bt.channels(),search:{id:w.room.id}})},[n]),z=a.useCallback(()=>{const w=j[I];!S||!w||q(w)},[S,j,I,q]);return{isOpen:S,hasRows:j.length>0,rows:j,agents:N,displayNames:m,visualOf:E,selectedIndex:I,activeDescendantId:S&&j[I]!==void 0?Ue(I):void 0,listboxId:S?Ht:void 0,handleFocus:L,handleBlur:T,handlePointerDown:$,moveDown:F,moveUp:H,selectHighlighted:z,selectRow:q,dismiss:W}}function zt({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:r,isSelected:l,now:c,onSelect:h}){const p=a.useMemo(()=>Number.isNaN(Date.parse(o))?null:zn(o),[o,c]);return i.jsxs("div",{id:Ue(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:h,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:[i.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),i.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),p!==null&&i.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function vr({item:e,agent:t,displayName:s,index:n,isSelected:o,now:r,onSelect:l}){const c=Ln(t,e.session.cwd??s);return i.jsx(zt,{mark:i.jsx(Fn,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:r,onSelect:l})}function Rr({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:r}){return i.jsx(zt,{mark:i.jsx(Bn,{room:e.room,participants:e.room.participants,visuals:Hn(t)}),label:i.jsx(qn,{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:r})}function kr({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:r}){const l=ht(6e4);return a.useEffect(()=>{var c,h;(h=(c=document.getElementById(Ue(t)))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"})},[t]),i.jsx(_e.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:c=>c.preventDefault(),children:i.jsx("div",{id:Ht,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,h)=>{var p;return c.kind==="session"?i.jsx(vr,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((p=c.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`session-${c.id}`):i.jsx(Rr,{item:c,visual:o(c.room),index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`room-${c.id}`)})})})}const nt={people:"People",agents:"Agents"},wr=["people","agents"];function Sr(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 Nr(e,t,s){const n=t.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:Ir(r,n)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function Ir(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let n=null;for(const r of s){const l=r===t?0:r.startsWith(t)?1:r.includes(t)?2:null;l!==null&&(n===null||l<n)&&(n=l)}return n}function de(e,t,s){var r;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let l=0;l<n;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+n)%n}return 0}function jr(e,t,s,n){const o=e.slice(0,t),r=e.slice(t+1+s.length),l=`@${n}`,c=r.startsWith(" ")?"":" ";return{value:o+l+c+r,cursorPos:o.length+l.length+1}}const Cr=/(^|\s)@([A-Za-z0-9_.-]*)$/,Ut="mention-palette-listbox";function Ee(e){return`mention-item-${e}`}function Ar({members:e,viewerAuthorId:t,text:s,sectionOrder:n=wr}){var $;const[o,r]=a.useState(!1),[l,c]=a.useState(""),[h,p]=a.useState(-1),u=Un(s),d=a.useRef(!1),k=a.useMemo(()=>Sr(e,t),[e,t]),f=a.useMemo(()=>o?Nr(k,l,n):[],[k,l,o,n]),[g,y]=a.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:de(f,0,1),N=f[x],m=f.length===0||N!==void 0&&!N.disabled?x:de(f,0,1),b=a.useCallback((T,B)=>{const F=T.slice(0,B).match(Cr);if(!F){r(!1);return}r(!0),c(F[2]),p((F.index??0)+F[1].length)},[]),E=a.useCallback(T=>{u.write(T),d.current=!1},[u]),O=a.useCallback(T=>{d.current||b(u.read(),T)},[b,u]),D=a.useCallback(()=>{y({query:l,open:o,index:de(f,m+1,1)})},[f,m,l,o]),j=a.useCallback(()=>{y({query:l,open:o,index:de(f,m-1,-1)})},[f,m,l,o]),S=a.useCallback(T=>T.disabled||T.handle===void 0?null:(d.current=!0,r(!1),jr(u.read(),h,l,T.handle)),[h,l,u]),_=a.useCallback(()=>{const T=f[m];return T?S(T):(r(!1),null)},[f,m,S]),I=a.useCallback(()=>{d.current=!0,r(!1)},[]),L=f.some(T=>!T.disabled);return{isOpen:o,hasSelectableRows:L,rows:f,selectedIndex:m,activeDescendantId:o&&(($=f[m])==null?void 0:$.disabled)===!1?Ee(m):void 0,listboxId:o?Ut:void 0,noteTextChange:E,handleCursorChange:O,moveDown:D,moveUp:j,selectHighlighted:_,selectRow:S,dismiss:I}}function Mr({rows:e,selectedIndex:t,onSelect:s}){const n=a.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const c=o[o.length-1];c&&c.section===r.section?c.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return a.useEffect(()=>{var o;(o=document.getElementById(Ee(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),i.jsx(_e.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:i.jsx("div",{id:Ut,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?i.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:r},l)=>i.jsxs("div",{role:"group","aria-label":nt[o],children:[l>0&&i.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),i.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:nt[o]}),r.map(({row:c,index:h})=>{const p=h===t;return i.jsxs("div",{id:Ee(h),role:"option","aria-selected":p,"aria-disabled":c.disabled,"data-selected":p,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.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:[i.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),i.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&i.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function Wt({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:r}){const l=t===void 0?e.id:lt(e.id,t),c=Wn(l),{target:h}=kt(),p=Kn(),u=Gn(l),d=a.useRef(null),k=be(e.members,e.viewerAuthorId),f=a.useRef(!1),g=Ar({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),y=n===!0,x=br({value:c,yieldToPalette:g.isOpen,enabled:y}),N=a.useRef(u);a.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=d.current)==null||I.focus())},[u]),a.useEffect(()=>{var I;s===!0&&((I=d.current)==null||I.focusUnlessTouch())},[]);const m=a.useCallback(I=>ue.getState().set(l,I),[l]),[b,E]=a.useState(null);a.useLayoutEffect(()=>{var I;b!==null&&((I=d.current)==null||I.focusAt(b.pos))},[b]);const O=a.useCallback(I=>{I&&(m(I.value),E({pos:I.cursorPos}))},[m]),D=a.useCallback(I=>O(g.selectRow(I)),[g,O]),j=a.useCallback(()=>O(g.selectHighlighted()),[g,O]),S=()=>{if(h===null||!h.canSend||f.current)return;g.dismiss();const I=ue.getState().take(l).trim();if(I==="")return;const L=r.pendingFiles.length>0;L&&(f.current=!0),h.send({text:I}).catch(()=>{const $=ue.getState(),T=$.drafts[l]??"";$.set(l,T===""?I:`${I}
44
+ ${T}`)}).finally(()=>{L&&(f.current=!1)})};if(!k)return i.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:xt}),i.jsx(Oe,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>yt.success(`You joined ${se(e)}`)}),children:Qn})]});const _=i.jsx(X.Composer,{inputRef:d,value:c,onChange:I=>{m(I),g.noteTextChange(I)},onSubmit:S,head:i.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g.isOpen&&g.rows.length===0?"No one by that name.":""}),mentionPicker:i.jsx(je,{children:g.isOpen&&i.jsx(Mr,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:D})}),overlays:i.jsx(i.Fragment,{children:i.jsx(je,{children:x.isOpen&&i.jsx(kr,{rows:x.rows,selectedIndex:x.selectedIndex,agents:x.agents,displayNames:x.displayNames,visualOf:x.visualOf,onSelect:x.selectRow})})}),input:{onCursorChange:g.handleCursorChange,isStreaming:!1,isPaletteOpen:g.isOpen||x.isOpen,paletteHasResults:x.isOpen?x.hasRows:g.hasSelectableRows,onArrowUp:x.isOpen?x.moveUp:g.moveUp,onArrowDown:x.isOpen?x.moveDown:g.moveDown,onCommandSelect:x.isOpen?x.selectHighlighted:j,onEscape:x.isOpen?x.dismiss:g.dismiss,tabPicks:!x.isOpen,onClear:()=>{m(""),g.dismiss()},activeDescendantId:x.isOpen?x.activeDescendantId:g.activeDescendantId,paletteListboxId:x.isOpen?x.listboxId:g.listboxId,contextKey:l,...r.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!y&&o===void 0?_:i.jsx("section",{className:"flex flex-col","data-testid":Vn.homeComposer,onFocus:I=>{x.handleFocus(I),ie(I.target)&&(o==null||o(!0))},onBlur:I=>{x.handleBlur(I),ie(I.target)&&(o==null||o(!1))},onPointerDown:x.handlePointerDown,children:_})}function Er(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(t=>t.author.kind==="agent")}function Or({room:e,hasEntries:t,onAddAgents:s}){return!t||!Er(e)?null:i.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",i.jsx("button",{type:"button",onClick:s,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function Tr({roomId:e}){const{approvals:t}=Yn(),s=Jn(t).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:i.jsx(Xn,{approvals:s})})}function _r({roomId:e}){const{data:t}=zs("pending"),s=(t??[]).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:s.map(n=>i.jsx(Us,{request:n},n.requestId))})}const Pr="An agent",st=64,Ne=3,Dr=new Set;function Kt({room:e,entries:t,scope:s,laneScope:n,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:c}){const h=Te(),p=Zn(e.id,s),u=es(e.id,s),d=ts(e.id,s),[k,f]=a.useState(!1),g=Ot(e.id,{enabled:k}),y=ns(),{mutate:x}=uo(),[N,m]=a.useState(Dr),b=a.useCallback(R=>{m(A=>new Set(A).add(R)),x({roomId:e.id,authorId:R},{onSettled:()=>m(A=>{const C=new Set(A);return C.delete(R),C})})},[x,e.id]),E=mo(),[O,D]=a.useState(()=>new Map),j=ss(),S=Be(),_=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=a.useCallback(R=>{var A;return((A=_.get(R))==null?void 0:A.displayName)??Pr},[_]),{interactions:L}=os(),$=a.useMemo(()=>L.filter(R=>R.roomId===e.id),[L,e.id]),T=a.useMemo(()=>{var A;const R={};for(const C of $){if(C.roomAuthorId===void 0)continue;const U=(A=_.get(C.roomAuthorId))==null?void 0:A.displayName;U!==void 0&&(R[C.sessionId]=U)}return R},[$,_]),B=a.useMemo(()=>p.map(R=>({authorId:R.authorId,name:I(R.authorId),state:R.state,since:R.since,activity:R.activity??null})),[p,I]),F=a.useMemo(()=>u.map(R=>{var C;const A=(C=j.data)==null?void 0:C.find(U=>U.id===R.behindRoomId);return{authorId:R.authorId,name:I(R.authorId),since:R.since,behind:{roomId:R.behindRoomId,title:A===void 0?null:se(A)},othersWaiting:R.othersWaiting,severalInTheWay:R.severalInTheWay}}),[u,I,j.data]),H=a.useMemo(()=>{const R=new Set;for(const A of u)O.get(A.authorId)===A.entryId&&R.add(A.authorId);return R},[u,O]),W=a.useMemo(()=>d===null?null:{authorId:d.authorId,name:I(d.authorId)},[d,I]),q=a.useMemo(()=>Ms({capabilities:ze,asks:$,agentNames:T,stalled:o,presence:B,held:F,silentFinish:W,turn:null}),[$,T,B,F,W,o]),z=a.useMemo(()=>{var A;const R=new Map;for(const C of((A=g.data)==null?void 0:A.bindings)??[])R.set(C.authorId,C.sessionId);return R},[g.data]),w=a.useCallback(R=>{const A=t.find(U=>U.id===R);if(A===void 0)return null;const C=A.body.text.replace(/\s+/gu," ").trim();return C.length===0?null:C.length>st?`${C.slice(0,st).trimEnd()}…`:C},[t]),v=a.useCallback(R=>{var A;return n==="thread"?Ae(R):((A=Fe(t,R))==null?void 0:A.domId)??null},[t,n]),P=a.useMemo(()=>{const R=p.map(C=>{const U=w(C.entryId),G=v(C.entryId);return{authorId:C.authorId,author:J(C.authorId,_,S.faces),state:C.state,since:C.since,doing:rs(C.activity),replyingTo:U===null||G===null?null:{entryId:C.entryId,excerpt:U,rowId:G},sessionId:z.get(C.authorId)??null}}),A=F.map(C=>({authorId:C.authorId,author:J(C.authorId,_,S.faces),state:"held",since:C.since,doing:null,replyingTo:null,sessionId:null,behind:C.behind,othersWaiting:C.othersWaiting}));return[...R,...A]},[p,F,_,S.faces,w,v,z]),M=a.useMemo(()=>{if(p.length===0)return null;const R=p.slice(0,Ne);return i.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[R.map(A=>i.jsx(vt,{author:J(A.authorId,_,S.faces),className:"ring-background size-4 ring-2"},A.authorId)),p.length>Ne&&i.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${p.length-Ne}`})]})},[p,_,S.faces]);return i.jsx(X.LiveLane,{state:q,scope:n,onRetry:l,unavailable:r,faces:M,onPeekOpenChange:f,askCard:q.kind==="ask"?i.jsx(as,{ask:q.ask,...T[q.ask.sessionId]?{agentName:T[q.ask.sessionId]}:{},onOpenSession:R=>{h(fe({session:R}))},className:"border-l-0"}):void 0,peek:i.jsx(X.LivePeek,{rows:P,onScrollToRow:c,onOpenSession:R=>{h(fe({session:R}))},onOpenRoom:R=>{h({...bt.channels(),search:{id:R}})},onAnswerFirst:R=>{const A=u.find(C=>C.authorId===R);A!==void 0&&D(C=>new Map(C).set(R,A.entryId)),E.mutate({roomId:e.id,authorId:R})},promoted:H,onStopAll:()=>y.mutate({roomId:e.id}),stopping:y.isPending,onStopAgent:b,stoppingAgents:N})})}const ot=3e3;function $r(e,t,s,n=Date.now){const o=a.useRef(null),r=a.useRef(new Map),l=a.useRef(new Map),c=o.current,h=r.current,p=l.current,u=n();for(const d of e){if(p.has(d.id))continue;if(c===null){p.set(d.id,"at-rest");continue}const k=h.get(d.authorId);p.set(d.id,k!==void 0&&u-k<ot?"handed-off":"dropped")}return a.useEffect(()=>{if(!s)return;o.current=new Set(e.map(k=>k.id));const d=n();for(const k of t)r.current.set(k,d);for(const[k,f]of r.current)d-f>ot&&r.current.delete(k);for(const k of l.current.keys())o.current.has(k)||l.current.delete(k)}),p}function Lr({kind:e}){return e==="thread-error"?i.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),i.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?i.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-sm"})]}):i.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function Fr({room:e,rootEntryId:t,focusComposer:s,entries:n,reactionFrequents:o,streamStalled:r,streamUnavailable:l,onRetryStream:c,historyLoaded:h,historyFailed:p=!1,landOnRow:u,pushed:d,onClose:k}){const f=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=Bt({room:e,threadRootId:t}),y=be(e.members,e.viewerAuthorId),x=Be(),N=a.useMemo(()=>new Map([...f].map(([w,v])=>[w,v.displayName])),[f]),{root:m,replies:b}=a.useMemo(()=>{let w;const v=[];for(const P of n)P.id===t?w=P:Z(P)===t&&v.push(P);return{root:w,replies:v}},[n,t]),E=m==null?void 0:m.threadReplyCount,O=E!==void 0&&E>b.length,D=m===void 0||O?-1:1+b.length,j=$e(b.length,E),S=a.useMemo(()=>new Set(b.map(w=>w.id)),[b]),_=a.useMemo(()=>({replyIds:S,inside:!0}),[S]),I=is(e.id,_),L=gt(e.id,t),$=$r(b,I,h),T=a.useRef(null),B=a.useCallback(w=>{var v;(v=T.current)==null||v.scrollToRow(w)},[]),F=a.useRef(null);a.useEffect(()=>{var w;s||(w=F.current)==null||w.focus()},[t,s]);const H=w=>{w.key!=="Escape"||w.defaultPrevented||(w.stopPropagation(),k())},W=a.useMemo(()=>{const w=[];if(m===void 0){const v=p?"thread-error":h?"thread-orphan":"thread-waiting";w.push({kind:"notice",id:v,at:"",body:null})}else w.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:J(pe(m,f),f,x.faces),at:m.createdAt});for(const v of b)w.push({kind:"message",id:v.id,payload:v,grouping:{position:"only"},author:J(pe(v,f),f,x.faces),at:v.createdAt});return w},[m,b,f,x.faces,p,h]),q=a.useCallback(w=>{if(w.kind==="notice")return i.jsx(Lr,{kind:w.id});if(w.kind!=="message")return null;const v=w.payload,P=m!==void 0&&v.id===m.id,M=b.findIndex(C=>C.id===v.id),R=i.jsx(Ft,{roomId:e.id,entry:v,rowId:Ae(v.id),author:w.author,authorRef:f.get(v.authorId),authors:f,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:y,grouping:{position:"only"},answers:Pt(v,M<=0?m:b[M-1],C=>(m==null?void 0:m.id)===C?m:b.find(U=>U.id===C)),feedPosition:{index:P?1:(m===void 0?0:1)+M+1,total:D}});if(P)return j===0?R:i.jsxs(i.Fragment,{children:[R,i.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[i.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:j===1?"1 reply":`${j} replies`}),i.jsx("span",{className:"bg-border h-px flex-1"})]})]});const A=$.get(v.id)??"at-rest";return i.jsx("div",{className:V(A==="dropped"&&"motion-safe:animate-thread-reply-in",A==="handed-off"&&"motion-safe:animate-reply-settle"),children:R})},[m,b,j,$,e.id,e.viewerAuthorId,f,N,o,r,y,D]),z=a.useCallback(w=>w.kind==="message"?Ae(w.id):void 0,[]);return i.jsx(Dt,{known:x,children:i.jsx(X.Root,{surface:"room",capabilities:ze,target:g.target,anchor:"rail",children:i.jsxs("section",{ref:F,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:H,className:V("bg-card flex min-h-0 flex-col outline-none",d?"h-full w-full":"w-full border-l"),children:[i.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[i.jsx("button",{type:"button",onClick:k,"aria-label":d?`Back to ${se(e)}`:"Close thread",className:V("focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1","after:absolute after:-inset-2.5 md:after:hidden"),children:d?i.jsx(ls,{"aria-hidden":!0,className:"size-4"}):i.jsx(cs,{"aria-hidden":!0,className:"size-4"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Thread"}),i.jsx("p",{className:"text-muted-foreground truncate text-xs",children:se(e)})]})]}),i.jsx(X.Timeline,{ref:T,conversationId:`thread-${t}`,label:`Thread in ${se(e)}`,busy:!h&&!p,rows:W,renderRow:q,domIdOf:z,...u===void 0?{}:{landOnRow:u},pending:L,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),i.jsx(Kt,{room:e,entries:n,scope:_,laneScope:"thread",stalled:d&&r===!0,unavailable:l,onRetry:d?c:void 0,onScrollToRow:B}),i.jsx(Wt,{room:e,threadRootId:t,attachments:g.attachments,focusOnMount:s},t)]})})})}const ve="room-thread-split",qr=320,Br=360,Hr=40,zr=50,Ur=25;function rt(e,t){return t<=0?Ur:Math.min(Math.round(e/t*1e3)/10,zr)}function Wr(e){const t=rt(qr,e),s=Math.round((100-rt(Br,e))*10)/10;return{minPct:t,maxPct:s,defaultPct:Math.min(Math.max(Hr,t),s)}}function Kr(e,t,s){if(e===null||t===null||t<=0)return s.defaultPct;const n=e/t*100;return Math.round(Math.min(Math.max(n,s.minPct),s.maxPct)*10)/10}function Gr(e){try{const t=localStorage.getItem(e),s=t===null?NaN:Number(t);return Number.isFinite(s)&&s>0?s:null}catch{return null}}function Qr(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}const Vr="react-resizable-panels:room-thread-split";function Yr(){try{localStorage.removeItem(Vr)}catch{}}function Jr(){const[e,t]=a.useState(null),[s,n]=a.useState(null);return{ref:a.useCallback(r=>{if(r===null)return;t(r);const l=()=>n(r.offsetWidth);l();const c=new ResizeObserver(l);return c.observe(r),()=>{c.disconnect(),t(null),n(null)}},[]),element:e,width:s,sizing:Wr(s??0)}}const Xr=`${ve}-room`,at=`${ve}-thread`,it=`${ve}-handle`,Zr=4;function ea({room:e,thread:t,storageKey:s=us.ROOM_THREAD_WIDTH}){const{ref:n,element:o,width:r,sizing:l}=Jr(),[c,h]=a.useState(()=>Gr(s)),[p,u]=a.useState(null),d=a.useRef(null),k=Kr(c,r,l),f=r===null||(l.maxPct-l.minPct)/100*r<Zr,g=t!==!1;a.useEffect(Yr,[]);const y=a.useRef(!1);a.useLayoutEffect(()=>{var b;y.current&&((b=d.current)==null||b.resize(k))},[k,g]);const x=a.useRef(null),N=()=>{var D;const b=(D=d.current)==null?void 0:D.getSize(),E=x.current;if(x.current=null,b===void 0||r===null||r<=0||E===b)return;const O=Math.round(b/100*r);h(O),Qr(s,O)},m=p??k;return a.useLayoutEffect(()=>{const b=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${it}"]`);b&&(b.setAttribute("aria-controls",at),b.setAttribute("aria-valuenow",String(Math.round(m))),b.setAttribute("aria-valuemin",String(Math.round(l.minPct))),b.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),i.jsx("div",{ref:n,className:"h-full overflow-hidden",children:i.jsxs(ds,{direction:"horizontal",id:ve,onLayout:b=>{y.current=b.length>1,u(y.current?b[1]:null)},children:[i.jsx(Ve,{id:Xr,order:1,className:"flex",children:e}),g&&i.jsxs(i.Fragment,{children:[i.jsx(vs,{id:it,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:f,onDragging:b=>{var E;b&&(x.current=((E=d.current)==null?void 0:E.getSize())??null)},onKeyDownCapture:b=>{var E,O;f||(x.current=((E=d.current)==null?void 0:E.getSize())??null,!(b.key!=="Home"&&b.key!=="End")&&(b.preventDefault(),(O=d.current)==null||O.resize(b.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),i.jsx(Ve,{ref:d,id:at,order:2,defaultSize:k,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:t})]})]})})}function xa({roomId:e,threadId:t,entrySeq:s,threadRoute:n,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:c}){const h=ms(),p=Rs(),u=fs(e),d=u==null?void 0:u.rootEntryId,k=hr(),f=a.useCallback(()=>{var P;const v=(P=Y.getState().open[e])==null?void 0:P.rootEntryId;Y.getState().closeThread(e),v!==void 0&&k.arm(v)},[e,k]),g=a.useCallback(v=>{Y.getState().openThread(e,v)},[e]),y=ps(e),x=hs(e),N=co(e,x.isSuccess);Es(e);const m=y.data,b=a.useMemo(()=>x.data??[],[x.data]),E=Bt({room:m});gr({roomId:e,route:n,urlThreadId:t,openThreadId:d,entries:b,historyLoaded:x.isSuccess});const O=a.useMemo(()=>{var v;return((v=m==null?void 0:m.members.find(P=>P.author.id===m.viewerAuthorId))==null?void 0:v.lastReadSeq)??null},[m]),D=mr(e,O);gs(m,b);const j=a.useRef(null),S=a.useRef(void 0),_=a.useCallback(v=>{S.current=v},[]),I=a.useCallback(()=>S.current,[]);a.useLayoutEffect(()=>{S.current=void 0},[e]);const L=a.useCallback(v=>{var P;(P=j.current)==null||P.scrollToRow(v)},[]),$=ho(e),{loadOlder:T,cursor:B}=$,F=a.useCallback(()=>{const v=Eo(b,B);T().then(()=>{v!==null&&requestAnimationFrame(()=>{var P;return(P=j.current)==null?void 0:P.scrollToRow(v.domId)})})},[b,B,T]),H=ur({roomId:e,entrySeq:s,entries:b,historyLoaded:x.isSuccess}),W=a.useMemo(()=>d===void 0?void 0:{replyIds:new Set(b.filter(P=>Z(P)===d).map(P=>P.id)),inside:!1},[b,d]);if(y.isLoading)return i.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:i.jsx(qt,{})});if(y.isError||!m)return i.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),i.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const q=u!==void 0&&i.jsx(Fr,{room:m,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:b,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...H.threadRow===void 0?{}:{landOnRow:H.threadRow},pushed:h,onClose:f},u.rootEntryId),z=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,i.jsx(cr,{ref:j,roomId:m.id,roomName:se(m),viewerAuthorId:m.viewerAuthorId,entries:b,members:m.members,formerAuthors:m.formerAuthors,lastReadSeq:D,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>Ye("add",m.id),openThreadId:d,onOpenThread:g,resumeRow:I,...H.roomRow===void 0?{}:{landOnRow:H.roomRow},onTopRow:_,canLoadOlder:$.canLoadOlder,isLoadingOlder:$.isLoadingOlder,onLoadOlder:F}),r,i.jsx(Tr,{roomId:m.id}),i.jsx(_r,{roomId:m.id}),i.jsx(Kt,{room:m,entries:b,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:L}),i.jsx(Or,{room:m,hasEntries:b.length>0,onAddAgents:()=>Ye("add",m.id)}),i.jsx(Wt,{room:m,attachments:E.attachments,offerJumpBackIn:l,onFocusChange:c},m.id)]}),w={surface:"room",capabilities:ze,target:E.target,anchor:"rail"};return h?i.jsx(X.Root,{...w,children:i.jsx(je,{initial:!1,mode:"wait",children:i.jsx(_e.div,{initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:16},transition:{duration:.15,ease:[0,0,.2,1]},style:{paddingBottom:p},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:q===!1?z:q},q?`thread-${d}`:"room")})}):i.jsx(X.Root,{...w,children:i.jsx(ea,{room:z,thread:q})})}export{Et as I,qt as R,Io as T,xa as a,ie as i};
@@ -1 +1 @@
1
- import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-C63bLSO4.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
1
+ import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-CdKpQ1hI.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};