dorkos 0.111.0 → 0.114.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 (192) hide show
  1. package/core-extensions/hello-world/index.ts +2 -2
  2. package/dist/bin/cli.js +13549 -1698
  3. package/dist/browser/native/package-manifest.json +1 -1
  4. package/dist/browser/source-manifest.json +1 -1
  5. package/dist/client/assets/{AboutPage-BKzqcz_A.js → AboutPage-mErbIY0l.js} +1 -1
  6. package/dist/client/assets/{ActivityErrorState-BXOZg9ve.js → ActivityErrorState-AlI4F82u.js} +1 -1
  7. package/dist/client/assets/{ActivityPage-CFN2MEAV.js → ActivityPage-CHUqb-8c.js} +1 -1
  8. package/dist/client/assets/{ActivityRow-CujXx04u.js → ActivityRow-Baqdr6cP.js} +1 -1
  9. package/dist/client/assets/AdapterIcon-C_fBZXHQ.js +1 -0
  10. package/dist/client/assets/{AdapterSetupWizard-3Bt9HEWF.js → AdapterSetupWizard-BL70qy2J.js} +2 -2
  11. package/dist/client/assets/{AgentRequestCard-CAaBGC0L.js → AgentRequestCard-CcMh6JyE.js} +3 -3
  12. package/dist/client/assets/{AppearancePage-BEe-Gssu.js → AppearancePage-t9SnSRs-.js} +1 -1
  13. package/dist/client/assets/{AttentionSignalRow-Cp0AJs73.js → AttentionSignalRow-jlgWaSSd.js} +1 -1
  14. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CN1iW2cB.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-DHr_AhUv.js} +3 -3
  15. package/dist/client/assets/{BlintzCanvas-B7qs2dxW.js → BlintzCanvas-Bq4e7n__.js} +1 -1
  16. package/dist/client/assets/{CanvasCsvContent-DiB5zXOC.js → CanvasCsvContent-OR226CLS.js} +2 -2
  17. package/dist/client/assets/CanvasFileContent-BejM-9Wg.js +2 -0
  18. package/dist/client/assets/CanvasModel3dContent-BD-eCVsX.js +2 -0
  19. package/dist/client/assets/{CodeMirrorDiff-BJhflpbC.js → CodeMirrorDiff-D7BWMOim.js} +1 -1
  20. package/dist/client/assets/{CodeMirrorEditor-SkdXRKSN.js → CodeMirrorEditor-BodwsIG7.js} +1 -1
  21. package/dist/client/assets/{CommitmentList-DsEn6iK1.js → CommitmentList-YVb3yTvO.js} +1 -1
  22. package/dist/client/assets/{CommitmentsPage-W5h0GjRr.js → CommitmentsPage-DL_jJQbw.js} +1 -1
  23. package/dist/client/assets/{ConnectionAccessLists-DVFqelmV.js → ConnectionAccessLists-BPsgToSR.js} +1 -1
  24. package/dist/client/assets/{ConnectionsPage-CZhSh2mO.js → ConnectionsPage-D7vlYnjf.js} +2 -2
  25. package/dist/client/assets/{ConventionPage-DcDBP-vR.js → ConventionPage-BR7I3AdE.js} +3 -3
  26. package/dist/client/assets/{ExtensionPageRoute-mKN8Jqyx.js → ExtensionPageRoute-CzXGvVRm.js} +2 -2
  27. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CGXG-x9g.js → FloatingTanStackRouterDevtools-CqogiFob-BV3h0rFa.js} +1 -1
  28. package/dist/client/assets/HandlePage-B33P0oh0.js +1 -0
  29. package/dist/client/assets/{HeartbeatPage-DFf7Udem.js → HeartbeatPage-CfjZuvtQ.js} +1 -1
  30. package/dist/client/assets/{LexicalField-vJ284m2H.js → LexicalField-Cc6wFZAZ.js} +2 -2
  31. package/dist/client/assets/{ManagesPage-mDuaA2JT.js → ManagesPage-BxHSb65X.js} +1 -1
  32. package/dist/client/assets/{Marketplace-BoiupH2Z.js → Marketplace-EgG6JmBG.js} +4 -4
  33. package/dist/client/assets/{MarketplaceSourcesView-krw9hUyu.js → MarketplaceSourcesView-D9kq9hl6.js} +1 -1
  34. package/dist/client/assets/{McpAppFrame-DmHduNgp.js → McpAppFrame-6zxszx9A.js} +2 -2
  35. package/dist/client/assets/{McpSigninBody-DoY09n4J.js → McpSigninBody-DBWSc6bm.js} +1 -1
  36. package/dist/client/assets/{Model3dViewer-BZEdR7-9.js → Model3dViewer-CgeJ2v-F.js} +1 -1
  37. package/dist/client/assets/NamePage-MfybpnwN.js +1 -0
  38. package/dist/client/assets/NewDirectMessageMenu-BnBO4aGI.js +1 -0
  39. package/dist/client/assets/{NotificationsPage-CybW1eIb.js → NotificationsPage-C5aRITCd.js} +1 -1
  40. package/dist/client/assets/{OpenMeshSwitch-DrmjsCDY.js → OpenMeshSwitch-UKMQeS7-.js} +2 -2
  41. package/dist/client/assets/{OperatorIdentityForm-byU2FeSU.js → OperatorIdentityForm-DH2au7QU.js} +1 -1
  42. package/dist/client/assets/{PermissionsPage-CP3kbqyJ.js → PermissionsPage-BgLLmdg2.js} +1 -1
  43. package/dist/client/assets/{PersonalityPopover-BLsjgaum.js → PersonalityPopover-vLDfndfo.js} +1 -1
  44. package/dist/client/assets/PhotoPage-BgyB3B2_.js +1 -0
  45. package/dist/client/assets/{PreviewRefusedNotice-fTN8MJ1h.js → PreviewRefusedNotice-Dh3SCC_A.js} +1 -1
  46. package/dist/client/assets/{PromptSuggestionChips-BZOaY5Tx.js → PromptSuggestionChips-EO_0zbzq.js} +1 -1
  47. package/dist/client/assets/{ReportsToPopover-B6JvfRt3.js → ReportsToPopover-C9Ceg1AW.js} +1 -1
  48. package/dist/client/assets/{RoomSurface-BM0QO_av.js → RoomSurface-B8ec3_at.js} +8 -8
  49. package/dist/client/assets/{RoomsPage-B-NOCLXC.js → RoomsPage-pPw8vrsB.js} +1 -1
  50. package/dist/client/assets/{RunsOnPopover-D1jQQatj.js → RunsOnPopover-CJoSj8w7.js} +1 -1
  51. package/dist/client/assets/RuntimeSetupDialog-Cqn_Grel.js +1 -0
  52. package/dist/client/assets/SessionsPage-BASybh9v.js +1 -0
  53. package/dist/client/assets/{SkillsPage-CPTFjEUe.js → SkillsPage-DL0909et.js} +1 -1
  54. package/dist/client/assets/{TasksPage-BRUqs3v5.js → TasksPage-BwUW6dia.js} +1 -1
  55. package/dist/client/assets/{ToolsPage-C25kL822.js → ToolsPage-C3xfGWdb.js} +2 -2
  56. package/dist/client/assets/{TopologyGraph-of6Cp5Kj.js → TopologyGraph-D7Ik1Xt6.js} +1 -1
  57. package/dist/client/assets/{TourHost-zwSilkjm.js → TourHost-Db0fxAXo.js} +1 -1
  58. package/dist/client/assets/{UnlinkDialog-BgwHAqdW.js → UnlinkDialog-TTK5Z_QD.js} +1 -1
  59. package/dist/client/assets/{WidgetErrorCard-BQwrR6PJ.js → WidgetErrorCard-D--KcgW1.js} +24 -29
  60. package/dist/client/assets/_shell-CGWsN6Gs.js +88 -0
  61. package/dist/client/assets/{_shell._home-BkP0NafS.js → _shell._home-CzpVyTzo.js} +1 -1
  62. package/dist/client/assets/{_shell._home.activity-BO_2ciGK.js → _shell._home.activity-BbWquOK0.js} +1 -1
  63. package/dist/client/assets/_shell._home.index-Cg0nRFMN.js +3 -0
  64. package/dist/client/assets/_shell._home.tasks-BpoOVihw.js +1 -0
  65. package/dist/client/assets/{_shell._home.workspaces-B34Uk1SP.js → _shell._home.workspaces-DVF1rM3t.js} +1 -1
  66. package/dist/client/assets/_shell.channels-CCGSs0Bn.js +10 -0
  67. package/dist/client/assets/{_shell.connections-BNbeBrxQ.js → _shell.connections-0_34lXIQ.js} +1 -1
  68. package/dist/client/assets/{_shell.feedback-requests-B71l48KB.js → _shell.feedback-requests-C6alx2ox.js} +1 -1
  69. package/dist/client/assets/_shell.marketplace-Dp-p8E3V.js +1 -0
  70. package/dist/client/assets/_shell.marketplace_.sources-SN2Fb1eb.js +1 -0
  71. package/dist/client/assets/{_shell.session-ybAc0bwn.js → _shell.session-Bt3jdQdD.js} +15 -15
  72. package/dist/client/assets/_shell.team-BIwJNdkd.js +28 -0
  73. package/dist/client/assets/_shell.x._extensionId-Bjn-MKsP.js +1 -0
  74. package/dist/client/assets/_shell.x._extensionId_._-Bjn-MKsP.js +1 -0
  75. package/dist/client/assets/{agent-browser-Cs8abkZs.js → agent-browser-CO5haI5Y.js} +1 -1
  76. package/dist/client/assets/{banner-CU2Nh3Kv.js → banner-Dh5mO27l.js} +2 -2
  77. package/dist/client/assets/{card-BTgwskmX.js → card-CKZCX8ol.js} +1 -1
  78. package/dist/client/assets/{file-DlQX-hKl.js → file-CMPbZedq.js} +1 -1
  79. package/dist/client/assets/{file-exclamation-point-Dg2iCyPM.js → file-exclamation-point-emLeXvmw.js} +1 -1
  80. package/dist/client/assets/file-text-9a0DChCq.js +6 -0
  81. package/dist/client/assets/{find-latest-widget-fence-BGiexm6r.js → find-latest-widget-fence--3kWMT1F.js} +3 -3
  82. package/dist/client/assets/{git-branch-Dq_w3Iyx.js → git-branch-hfu8isLA.js} +1 -1
  83. package/dist/client/assets/{heart-Bp14wOx6.js → heart-SRafwnSd.js} +1 -1
  84. package/dist/client/assets/{highlighted-body-KPVGNVTW-kD1HK_wk.js → highlighted-body-KPVGNVTW-Dxwd3mxT.js} +1 -1
  85. package/dist/client/assets/index-3GDQSKet.js +1 -0
  86. package/dist/client/assets/{index-BA-nPsLw.js → index-BB18IeC2.js} +1 -1
  87. package/dist/client/assets/index-BBQMqcO_.js +1 -0
  88. package/dist/client/assets/{index-CcV9S7cO.js → index-BDfoFNcA.js} +1 -1
  89. package/dist/client/assets/{index-DNglWRBB.js → index-BNn3-chz.js} +1 -1
  90. package/dist/client/assets/{index-Dm53S0up.js → index-BRGOMmOM.js} +1 -1
  91. package/dist/client/assets/{index-5OyUurJr.js → index-BTXBESRm.js} +1 -1
  92. package/dist/client/assets/{index-B8R78Nnj.js → index-BTreBsWa.js} +2 -2
  93. package/dist/client/assets/{index-kHXlTLUx.js → index-BUVKya1M.js} +8 -8
  94. package/dist/client/assets/{index-aDNEGBTK.js → index-BYp9xcmS.js} +1 -1
  95. package/dist/client/assets/{index-DnmtTIUB.js → index-BokDvdOG.js} +1 -1
  96. package/dist/client/assets/{index-BxrZwUJp.js → index-C3xuhmPa.js} +2 -2
  97. package/dist/client/assets/{index-B6_ikFYj.js → index-C4nEz6I-.js} +1 -1
  98. package/dist/client/assets/{index-Dr-0P6rd.js → index-C63bLSO4.js} +267 -262
  99. package/dist/client/assets/{index-Cc280M3V.js → index-C7BTAdSc.js} +1 -1
  100. package/dist/client/assets/{index-knGXyHhh.js → index-CAlXjm0N.js} +1 -1
  101. package/dist/client/assets/index-CTxEG5rD.js +1 -0
  102. package/dist/client/assets/{index-gu2JYnOq.js → index-CbFo-7kM.js} +1 -1
  103. package/dist/client/assets/{index-DKlxz3u7.js → index-Ch41JOI2.js} +1 -1
  104. package/dist/client/assets/{index-BxUoa3yn.js → index-CkknQ52Q.js} +5 -5
  105. package/dist/client/assets/{index-C-DN0Vg_.js → index-Cow815Qa.js} +1 -1
  106. package/dist/client/assets/{index-DO6a5Hey.js → index-Cp7oifSs.js} +1 -1
  107. package/dist/client/assets/{index--3UwFg2s.js → index-CpYs0Lli.js} +1 -1
  108. package/dist/client/assets/{index-C99173Ze.js → index-D0Nd2LA-.js} +1 -1
  109. package/dist/client/assets/{index-BeBmUxo_.js → index-D67aFWxz.js} +1 -1
  110. package/dist/client/assets/index-DFEF2MFy.css +1 -0
  111. package/dist/client/assets/{index-CAhJGlSW.js → index-DIlV08Vw.js} +1 -1
  112. package/dist/client/assets/{index-BHsZlKfx.js → index-DLNwEM2Q.js} +1 -1
  113. package/dist/client/assets/{index-PxSRtDpP.js → index-DLZi_nae.js} +1 -1
  114. package/dist/client/assets/{index-LszRbEbX.js → index-DRqEM5Wb.js} +1 -1
  115. package/dist/client/assets/{index-B0OZehWe.js → index-DX-j3Ul0.js} +1 -1
  116. package/dist/client/assets/{index-CKCMjqcu.js → index-DX7V94qe.js} +1 -1
  117. package/dist/client/assets/{index-C_uYJzKi.js → index-D_Wc_qTa.js} +3 -3
  118. package/dist/client/assets/{index-DW6zqLoM.js → index-DdsKmfEH.js} +1 -1
  119. package/dist/client/assets/{index-DHUToGjI.js → index-DmTI5Hye.js} +1 -1
  120. package/dist/client/assets/{index-DKQDBIWq.js → index-YswfjpmW.js} +1 -1
  121. package/dist/client/assets/{index-DSPs6GF4.js → index-g_5oOlG6.js} +1 -1
  122. package/dist/client/assets/{index-DS-thlE8.js → index-iD0epmn3.js} +1 -1
  123. package/dist/client/assets/{index-CDWsIVX7.js → index-lJc8v0Z3.js} +1 -1
  124. package/dist/client/assets/index-t7gsOfUI.js +1 -0
  125. package/dist/client/assets/kickoff-xkt4LpIP.js +3 -0
  126. package/dist/client/assets/{layers-B0oCOfxz.js → layers-Cy8Tme6i.js} +1 -1
  127. package/dist/client/assets/{lightbulb-D80IzMqz.js → lightbulb-tNm7gLYi.js} +1 -1
  128. package/dist/client/assets/{markdown-content-aNzh-54y.js → markdown-content-CoK3F0c0.js} +1 -1
  129. package/dist/client/assets/{mention-pill-BxMK0xuY.js → mention-pill-Bgs_yujj.js} +1 -1
  130. package/dist/client/assets/{message-square-off-D-CJXmTq.js → message-square-off-CF2Bzen3.js} +1 -1
  131. package/dist/client/assets/{owner-notice-BkrTEMDm.js → owner-notice-cgCWG4hG.js} +1 -1
  132. package/dist/client/assets/{package-CoTlAnXZ.js → package-DE8sQpId.js} +1 -1
  133. package/dist/client/assets/{page-container-CPxW5T9E.js → page-container-BoXmmBSs.js} +1 -1
  134. package/dist/client/assets/{paperclip-Cj1P85mz.js → paperclip-IgDeVFea.js} +1 -1
  135. package/dist/client/assets/{radio-DICkTr_p.js → radio-BzTkFBDD.js} +1 -1
  136. package/dist/client/assets/{room-files-source-BywWQPBN.js → room-files-source-CIIDTSTA.js} +2 -2
  137. package/dist/client/assets/{rotate-ccw-clock-cx5RyP4l.js → rotate-ccw-clock-CGcSqHnk.js} +1 -1
  138. package/dist/client/assets/{rotate-cw-DrGRGSwy.js → rotate-cw-DaduzRfP.js} +1 -1
  139. package/dist/client/assets/{scroll-area-XlDz8u4m.js → scroll-area-DW0-Liri.js} +1 -1
  140. package/dist/client/assets/{search-x-LIKnWE64.js → search-x-Sme5ElYi.js} +1 -1
  141. package/dist/client/assets/{shield-x-DioB6qH_.js → shield-x-Bh5xap8N.js} +1 -1
  142. package/dist/client/assets/{soul-file-C7YgkNET.js → soul-file-NcuTUIiB.js} +1 -1
  143. package/dist/client/assets/{table-P4N5xQn2.js → table-BEtvgYmW.js} +1 -1
  144. package/dist/client/assets/{use-connector-management-pgVHbXoO.js → use-connector-management-Cohvs7jD.js} +1 -1
  145. package/dist/client/assets/{use-delete-binding-DxEiOjjh.js → use-delete-binding-C19umm_i.js} +1 -1
  146. package/dist/client/assets/{use-dev-links-BImQrE6g.js → use-dev-links-DRnLdl--.js} +1 -1
  147. package/dist/client/assets/{use-external-adapter-catalog-D8KHMSZU.js → use-external-adapter-catalog-BOn9aj72.js} +1 -1
  148. package/dist/client/assets/use-full-activity-feed-BpQANbns.js +1 -0
  149. package/dist/client/assets/use-is-below-desktop-5LlietdR.js +1 -0
  150. package/dist/client/assets/{use-jump-back-in-D9tBJ4v5.js → use-jump-back-in-CkFErfWY.js} +3 -3
  151. package/dist/client/assets/{use-mesh-topology-DBeqzUoy.js → use-mesh-topology-CIsDeAY0.js} +1 -1
  152. package/dist/client/assets/use-panel-tab-placements-AFrWTQ0a.js +1 -0
  153. package/dist/client/assets/use-pending-read-Dol8yvIx.js +1 -0
  154. package/dist/client/assets/{use-personality-commit-Gfoi__sT.js → use-personality-commit-fUtuc2lC.js} +1 -1
  155. package/dist/client/assets/{use-promo-activation-Bv1gnqKq.js → use-promo-activation-Dxt-1yuT.js} +3 -3
  156. package/dist/client/assets/{use-pulse-freshness-SFRdnugS.js → use-pulse-freshness-DRRM5Hza.js} +1 -1
  157. package/dist/client/assets/{use-room-follow-claim-Cf20JiJ_.js → use-room-follow-claim-huRfaa4e.js} +1 -1
  158. package/dist/client/assets/{use-roving-tab-list-3Pb7ps4E.js → use-roving-tab-list-BZIBAGgJ.js} +1 -1
  159. package/dist/client/assets/{use-session-canvas-BaXuEhw8.js → use-session-canvas-CZIsr9qL.js} +4 -4
  160. package/dist/client/assets/{use-session-diagnostics-7xxJ6zQQ.js → use-session-diagnostics-C41hV7rK.js} +4 -4
  161. package/dist/client/assets/{use-unclaimed-chats-D4k-EK_f.js → use-unclaimed-chats-BMlFQ2v1.js} +1 -1
  162. package/dist/client/index.html +2 -2
  163. package/dist/server/index.js +123677 -118335
  164. package/dist/server/index.js.map +2 -2
  165. package/package.json +7 -8
  166. package/dist/client/assets/AdapterIcon-BdM7K69W.js +0 -1
  167. package/dist/client/assets/CanvasFileContent-CDNfnWMW.js +0 -2
  168. package/dist/client/assets/CanvasModel3dContent-C7EINmuq.js +0 -2
  169. package/dist/client/assets/HandlePage-Bun58ePo.js +0 -1
  170. package/dist/client/assets/NamePage-CXyClUPJ.js +0 -1
  171. package/dist/client/assets/NewDirectMessageMenu-BjqYwnXW.js +0 -1
  172. package/dist/client/assets/PhotoPage-hn5b42qN.js +0 -1
  173. package/dist/client/assets/RuntimeSetupDialog-ufwCvCJB.js +0 -1
  174. package/dist/client/assets/SessionsPage-CBE1KHYg.js +0 -1
  175. package/dist/client/assets/_shell-bcx2y7VT.js +0 -88
  176. package/dist/client/assets/_shell._home.index-B-OFwU9u.js +0 -3
  177. package/dist/client/assets/_shell._home.tasks-jAQczH7j.js +0 -1
  178. package/dist/client/assets/_shell.channels-CGzsxvXD.js +0 -10
  179. package/dist/client/assets/_shell.marketplace-3YAsNaRk.js +0 -1
  180. package/dist/client/assets/_shell.marketplace_.sources-cI3nNBXr.js +0 -1
  181. package/dist/client/assets/_shell.team-BE_60YS4.js +0 -28
  182. package/dist/client/assets/_shell.x._extensionId-jiyP599c.js +0 -1
  183. package/dist/client/assets/_shell.x._extensionId_._-jiyP599c.js +0 -1
  184. package/dist/client/assets/index-B2JJZXsq.js +0 -1
  185. package/dist/client/assets/index-BAjUSKoJ.js +0 -1
  186. package/dist/client/assets/index-BpDY3eoD.js +0 -1
  187. package/dist/client/assets/index-ExcAk4pE.css +0 -1
  188. package/dist/client/assets/index-F7Lcwnfm.js +0 -1
  189. package/dist/client/assets/kickoff-Btbza7bw.js +0 -3
  190. package/dist/client/assets/use-full-activity-feed-2o7GNAMe.js +0 -1
  191. package/dist/client/assets/use-is-below-desktop-DBet5zg_.js +0 -1
  192. package/dist/client/assets/use-pending-read-DmrlNHS0.js +0 -1
@@ -1 +1 @@
1
- import{j as o,ch as t}from"./index-Dr-0P6rd.js";function e(){return o.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:o.jsx(t,{})})}const s=e;export{s as component};
1
+ import{j as o,ck as t}from"./index-C63bLSO4.js";function e(){return o.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:o.jsx(t,{})})}const s=e;export{s as component};
@@ -1 +1 @@
1
- import{bV as R,ci as D,r as l,hu as C,hv as O,j as e,bl as Y,a3 as g,B as M,X as G,Z as f,A as j,D as b,hw as W,hx as k,aa as K,e as v,F as q,ae as z,aj as U,hy as X,hz as Q,hA as Z,dv as J}from"./index-Dr-0P6rd.js";import{P as ee}from"./page-container-CPxW5T9E.js";import{g as te,A as se,a as ne,b as ie}from"./ActivityErrorState-BXOZg9ve.js";import{u as ae}from"./use-full-activity-feed-2o7GNAMe.js";import{C as A,A as re}from"./ActivityRow-CujXx04u.js";import{T as P,a as L,b as oe,c as p}from"./table-P4N5xQn2.js";const S=["categories","actorType","actorId","since"];function w(){const s=R(),n=D({strict:!1}),t={categories:n.categories,actorType:n.actorType,actorId:n.actorId,since:n.since},i=S.some(c=>n[c]!==void 0),a={};t.categories&&(a.categories=t.categories),t.actorType&&(a.actorType=t.actorType),t.actorId&&(a.actorId=t.actorId),t.since&&(a.since=t.since);const r=l.useCallback(c=>{s({search:c})},[s]),o=l.useCallback(c=>{r(x=>{const y=x.categories?x.categories.split(","):[],N=y.includes(c)?y.filter(B=>B!==c):[...y,c];return{...x,categories:N.length>0?N.join(","):void 0}})},[r]),d=l.useCallback(c=>{r(x=>({...x,actorType:c}))},[r]),m=l.useCallback(c=>{r(x=>({...x,actorId:c}))},[r]),u=l.useCallback(c=>{r(x=>({...x,since:c}))},[r]),h=l.useCallback(()=>{r(c=>{const x={...c};for(const y of S)delete x[y];return x})},[r]);return{filters:t,queryFilters:a,isFiltered:i,toggleCategory:o,setActorType:d,setActorId:m,setSince:u,clearAll:h}}function ce(){const s=R(),t=D({strict:!1}).view==="all"?"all":"activity",i=l.useCallback(a=>{s({search:(r=>({...r,view:a==="all"?"all":void 0}))})},[s]);return{view:t,setView:i}}function le(){const[s]=l.useState(()=>C.getState().lastSeenAt);return l.useEffect(()=>{const{markSeen:n,setViewing:t}=C.getState();return n(),t(!0),()=>{n(),t(!1)}},[]),s}function ue(s){const n=l.useRef(null),t=l.useCallback(i=>{var d,m,u;const a=n.current;if(!a)return;const r=a.querySelectorAll("[data-activity-row]"),o=Array.from(r).findIndex(h=>h===document.activeElement||h.contains(document.activeElement));switch(i.key){case"ArrowDown":{i.preventDefault();const h=Math.min(o+1,r.length-1);(d=r[h])==null||d.focus();break}case"ArrowUp":{i.preventDefault();const h=Math.max(o-1,0);(m=r[h])==null||m.focus();break}case"Escape":{(u=document.activeElement)==null||u.blur();break}}},[s]);return{containerRef:n,handleKeyDown:t}}const de=["tasks","relay","agent","config","system","permissions"],_="group inline-flex min-h-11 shrink-0 items-center outline-none md:min-h-0",$="inline-flex h-6 items-center rounded-full px-2.5 text-xs font-medium transition-colors group-focus-visible:ring-ring group-focus-visible:ring-2 group-focus-visible:ring-offset-1";function me({category:s,isActive:n,onToggle:t}){const i=A[s];return e.jsx(g.button,{type:"button",layout:!0,onClick:t,"aria-pressed":n,transition:{duration:.15},className:_,children:e.jsx("span",{className:f($,n?f(i.bg,i.text):"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:i.label})})}function he({isActive:s,onClick:n}){return e.jsx(g.button,{type:"button",layout:!0,onClick:n,"aria-pressed":s,transition:{duration:.15},className:_,children:e.jsx("span",{className:f($,s?"bg-foreground text-background":"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:"All"})})}function fe({className:s}){const{filters:n,isFiltered:t,toggleCategory:i,clearAll:a}=w(),r=l.useRef(null),o=O(r,"horizontal"),d=new Set(n.categories?n.categories.split(","):[]),m=()=>{t&&a()};return e.jsxs("div",{className:f("relative",s),children:[e.jsxs("div",{ref:r,onScroll:o.onScroll,"data-slot":"activity-filter-bar",className:"flex items-center gap-1 overflow-x-auto",children:[e.jsx(he,{isActive:!t,onClick:m}),de.map(u=>e.jsx(me,{category:u,isActive:d.has(u),onToggle:()=>i(u)},u)),e.jsx(Y,{children:t&&e.jsx(g.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},children:e.jsxs(M,{variant:"ghost",size:"xs",className:"ml-1",onClick:a,children:[e.jsx(G,{"aria-hidden":!0}),"Clear"]})},"clear-filters")})]}),o.start&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-start",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 left-0 w-8 bg-gradient-to-r to-transparent"}),o.end&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-end",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l to-transparent"})]})}function xe({isFiltered:s=!1,view:n="activity",className:t}){const{filters:i,clearAll:a}=w();return n==="all"?e.jsx(j,{className:t,icon:b,headline:"No actions yet",description:"Every action a person or agent takes shows up here."}):s?e.jsx(j,{className:t,icon:b,headline:`No ${ge(i.categories)} activity found`,description:"Try other filters.",action:{label:"Clear filters",onClick:a,variant:"outline"}}):e.jsx(j,{className:t,icon:b,headline:"No activity yet",description:"Your agents’ work shows up here."})}function ge(s){if(!s)return"matching";const t=s.split(",").map(r=>{var o;return((o=A[r])==null?void 0:o.label)??r});if(t.length===1)return t[0];const i=t[t.length-1];return`${t.slice(0,-1).join(", ")} or ${i}`}function ye({view:s,onViewChange:n,className:t}){return e.jsxs(W,{"aria-label":"Which list to show",className:f("w-fit shrink-0",t),value:s,onValueChange:i=>n(i),children:[e.jsx(k,{value:"activity",children:"Activity"}),e.jsx(k,{value:"all",children:"All actions"})]})}function pe(s){const n=Date.now()-new Date(s).getTime(),t=Math.floor(n/36e5);return t<1?"recently":t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function ve(s,n){const t=new Date(n),i={};for(const a of s)new Date(a.occurredAt)>t&&(i[a.category]=(i[a.category]??0)+1);return i}function je(s){const n={tasks:"scheduled run",relay:"message",agent:"agent update",config:"settings change",system:"system event",permissions:"permission change"};return Object.entries(s).filter(([,t])=>t>0).map(([t,i])=>{const a=n[t];return`${i} ${i===1?a:`${a}s`}`}).join(" · ")}function be({lastVisitedAt:s,items:n,className:t}){if(!s)return null;const i=ve(n,s);if(Object.values(i).reduce((d,m)=>d+(m??0),0)===0)return null;const r=pe(s),o=je(i);return e.jsxs(g.div,{"data-slot":"activity-since-last-visit",initial:{opacity:0,y:-6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:f("rounded-lg border px-4 py-3","bg-card border-border",t),children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.jsx("span",{className:"text-foreground font-medium",children:"Since your last visit"})," ",e.jsxs("span",{children:["(",r,")"]})]}),e.jsx("p",{className:"text-foreground/80 mt-0.5 text-sm",children:o}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Object.keys(i).map(d=>{const m=i[d];if(!m)return null;const u=A[d];return e.jsxs(K,{shape:"pill",className:f("border-transparent",u.bg,u.text),children:[m," ",u.label]},d)})})]})}const Ae={initial:{opacity:0,y:6},animate:{opacity:1,y:0,transition:{duration:.2,ease:"easeOut"}}};function we(){const s=l.useId(),n=l.useMemo(()=>`${s.split("").reduce((i,a)=>i+a.charCodeAt(0),0)%40+50}%`,[s]);return e.jsxs(oe,{children:[e.jsx(p,{className:"w-28 py-1.5 pr-0 pl-2 max-sm:hidden",children:e.jsx(v,{className:"h-3 w-20"})}),e.jsx(p,{className:"w-24 py-1.5 pr-0 max-sm:hidden",children:e.jsx(v,{className:"h-5 w-20 rounded-full"})}),e.jsx(p,{className:"py-1.5 max-sm:pl-2",children:e.jsx(v,{className:"h-3 rounded",style:{width:n}})}),e.jsx(p,{className:"w-16 py-1.5 max-sm:w-10"})]})}function Ne(){return e.jsxs("div",{"data-slot":"activity-timeline-skeleton",className:"space-y-1",children:[e.jsx("div",{className:"py-2",children:e.jsx(v,{className:"h-3 w-16 rounded"})}),e.jsx(P,{children:e.jsx(L,{children:Array.from({length:5}).map((s,n)=>e.jsx(we,{},n))})})]})}function H({items:s,isLoading:n,isError:t,onRetry:i,isFiltered:a,view:r="activity",className:o}){const d=l.useMemo(()=>te(s,new Date),[s]),{containerRef:m,handleKeyDown:u}=ue(s.length);return n&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(Ne,{})}):t&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(se,{onRetry:i})}):s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(xe,{isFiltered:a,view:r})}):e.jsx("div",{ref:m,onKeyDown:u,"data-slot":"activity-timeline",className:f(o),children:d.map(h=>e.jsxs("section",{children:[e.jsx(ne,{label:h.label}),e.jsx(g.div,{variants:Ae,initial:"initial",animate:"animate",children:e.jsx(P,{children:e.jsx(L,{children:h.items.map(c=>e.jsx(re,{item:c},c.id))})})})]},h.label))})}function V({onLoadMore:s,isFetching:n,hasNextPage:t,className:i}){return t?e.jsx(g.div,{"data-slot":"activity-load-more",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1},className:f("flex justify-center py-4",i),children:e.jsxs(M,{variant:"outline",size:"sm",onClick:s,disabled:n,className:"gap-2",children:[n&&e.jsx(q,{size:"xs"}),"Load 50 more events"]})}):null}const T=7;function Ce(){var t;const s=z(),{data:n}=U({queryKey:X.dailyCounts(T),queryFn:()=>s.getSessionDailyCounts(T),staleTime:6e4});return!n||n.dailyCounts.length===0?null:{dailyCounts:n.dailyCounts,degraded:(((t=n.warnings)==null?void 0:t.length)??0)>0}}function ke(s,n){const t=s.reduce((a,r)=>a+r,0),i=t===1?"session":"sessions";return n?t===0?"This week’s count is incomplete":`Your agents started at least ${t} ${i} this week`:t===0?"Your agents started no chats this week":`Your agents started ${t} ${i} this week`}const I=10,Se=4,F=30,E=1;function Te({data:s,className:n}){const t=Math.max(...s,1);return e.jsx("svg",{viewBox:"0 0 100 30",className:f("text-muted-foreground",n),"aria-hidden":"true",children:s.map((i,a)=>{const r=i/t*F;return e.jsx("rect",{x:a*(I+Se)+1,y:F-Math.max(r,E),width:I,height:Math.max(r,E),rx:2,fill:"currentColor",opacity:.6},a)})})}function Ie(){const s=Ce();return s===null?null:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:ke(s.dailyCounts,s.degraded)}),e.jsx(Te,{data:s.dailyCounts,className:"h-6 w-24 shrink-0"})]})}function Fe(){const s=l.useId(),n=Q("dashboard.sections"),t=l.useMemo(()=>n.filter(i=>Z(i.id)&&(!i.visibleWhen||i.visibleWhen())),[n]);return t.length===0?null:e.jsxs("section",{className:"space-y-3","aria-labelledby":s,children:[e.jsx("h2",{id:s,className:"text-muted-foreground text-xs font-medium tracking-widest uppercase",children:"From your extensions"}),e.jsx("div",{className:"space-y-4",children:t.map(i=>e.jsx(i.component,{},i.id))})]})}function Ee(){const{view:s,setView:n}=ce();return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:"Activity"}),e.jsxs(ee,{width:"wide",className:"space-y-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(ye,{view:s,onViewChange:n}),s==="activity"&&e.jsx(fe,{className:"min-w-0 flex-1"})]}),e.jsx(Ie,{}),e.jsx(Fe,{}),s==="all"?e.jsx(De,{}):e.jsx(Re,{})]})]})}function Re(){const{queryFilters:s,isFiltered:n}=w(),t=le(),{data:i,isLoading:a,isError:r,refetch:o,isFetchingNextPage:d,hasNextPage:m,fetchNextPage:u}=ae(s),h=l.useMemo(()=>(i==null?void 0:i.pages.flatMap(c=>c.items))??[],[i]);return e.jsxs(e.Fragment,{children:[e.jsx(be,{lastVisitedAt:t,items:h}),e.jsx(H,{items:h,isLoading:a,isError:r,onRetry:()=>void o(),isFiltered:n}),e.jsx(V,{onLoadMore:()=>void u(),isFetching:d,hasNextPage:!!m})]})}function De(){const{data:s,isLoading:n,isError:t,refetch:i,isFetchingNextPage:a,hasNextPage:r,fetchNextPage:o}=ie();return e.jsxs(e.Fragment,{children:[e.jsx(H,{items:s??[],isLoading:n,isError:t,onRetry:()=>void i(),isFiltered:!1,view:"all"}),e.jsx(V,{onLoadMore:()=>void o(),isFetching:a,hasNextPage:!!r})]})}const Ve=Ee;export{Ve as component};
1
+ import{bY as R,cl as D,r as l,hL as C,hM as V,j as e,bo as Y,a3 as g,B as M,X as G,Z as f,A as j,D as b,eR as W,eS as k,aa as K,e as v,F as q,ae as z,aj as U,hN as X,eN as Q,hO as Z,dy as J}from"./index-C63bLSO4.js";import{P as ee}from"./page-container-BoXmmBSs.js";import{g as te,A as se,a as ne,b as ie}from"./ActivityErrorState-AlI4F82u.js";import{u as ae}from"./use-full-activity-feed-BpQANbns.js";import{C as A,A as re}from"./ActivityRow-Baqdr6cP.js";import{T as P,a as L,b as oe,c as p}from"./table-BEtvgYmW.js";const S=["categories","actorType","actorId","since"];function w(){const s=R(),n=D({strict:!1}),t={categories:n.categories,actorType:n.actorType,actorId:n.actorId,since:n.since},i=S.some(c=>n[c]!==void 0),a={};t.categories&&(a.categories=t.categories),t.actorType&&(a.actorType=t.actorType),t.actorId&&(a.actorId=t.actorId),t.since&&(a.since=t.since);const r=l.useCallback(c=>{s({search:c})},[s]),o=l.useCallback(c=>{r(x=>{const y=x.categories?x.categories.split(","):[],N=y.includes(c)?y.filter(B=>B!==c):[...y,c];return{...x,categories:N.length>0?N.join(","):void 0}})},[r]),d=l.useCallback(c=>{r(x=>({...x,actorType:c}))},[r]),m=l.useCallback(c=>{r(x=>({...x,actorId:c}))},[r]),u=l.useCallback(c=>{r(x=>({...x,since:c}))},[r]),h=l.useCallback(()=>{r(c=>{const x={...c};for(const y of S)delete x[y];return x})},[r]);return{filters:t,queryFilters:a,isFiltered:i,toggleCategory:o,setActorType:d,setActorId:m,setSince:u,clearAll:h}}function ce(){const s=R(),t=D({strict:!1}).view==="all"?"all":"activity",i=l.useCallback(a=>{s({search:(r=>({...r,view:a==="all"?"all":void 0}))})},[s]);return{view:t,setView:i}}function le(){const[s]=l.useState(()=>C.getState().lastSeenAt);return l.useEffect(()=>{const{markSeen:n,setViewing:t}=C.getState();return n(),t(!0),()=>{n(),t(!1)}},[]),s}function ue(s){const n=l.useRef(null),t=l.useCallback(i=>{var d,m,u;const a=n.current;if(!a)return;const r=a.querySelectorAll("[data-activity-row]"),o=Array.from(r).findIndex(h=>h===document.activeElement||h.contains(document.activeElement));switch(i.key){case"ArrowDown":{i.preventDefault();const h=Math.min(o+1,r.length-1);(d=r[h])==null||d.focus();break}case"ArrowUp":{i.preventDefault();const h=Math.max(o-1,0);(m=r[h])==null||m.focus();break}case"Escape":{(u=document.activeElement)==null||u.blur();break}}},[s]);return{containerRef:n,handleKeyDown:t}}const de=["tasks","relay","agent","config","system","permissions"],_="group inline-flex min-h-11 shrink-0 items-center outline-none md:min-h-0",$="inline-flex h-6 items-center rounded-full px-2.5 text-xs font-medium transition-colors group-focus-visible:ring-ring group-focus-visible:ring-2 group-focus-visible:ring-offset-1";function me({category:s,isActive:n,onToggle:t}){const i=A[s];return e.jsx(g.button,{type:"button",layout:!0,onClick:t,"aria-pressed":n,transition:{duration:.15},className:_,children:e.jsx("span",{className:f($,n?f(i.bg,i.text):"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:i.label})})}function he({isActive:s,onClick:n}){return e.jsx(g.button,{type:"button",layout:!0,onClick:n,"aria-pressed":s,transition:{duration:.15},className:_,children:e.jsx("span",{className:f($,s?"bg-foreground text-background":"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:"All"})})}function fe({className:s}){const{filters:n,isFiltered:t,toggleCategory:i,clearAll:a}=w(),r=l.useRef(null),o=V(r,"horizontal"),d=new Set(n.categories?n.categories.split(","):[]),m=()=>{t&&a()};return e.jsxs("div",{className:f("relative",s),children:[e.jsxs("div",{ref:r,onScroll:o.onScroll,"data-slot":"activity-filter-bar",className:"flex items-center gap-1 overflow-x-auto",children:[e.jsx(he,{isActive:!t,onClick:m}),de.map(u=>e.jsx(me,{category:u,isActive:d.has(u),onToggle:()=>i(u)},u)),e.jsx(Y,{children:t&&e.jsx(g.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},children:e.jsxs(M,{variant:"ghost",size:"xs",className:"ml-1",onClick:a,children:[e.jsx(G,{"aria-hidden":!0}),"Clear"]})},"clear-filters")})]}),o.start&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-start",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 left-0 w-8 bg-gradient-to-r to-transparent"}),o.end&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-end",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l to-transparent"})]})}function xe({isFiltered:s=!1,view:n="activity",className:t}){const{filters:i,clearAll:a}=w();return n==="all"?e.jsx(j,{className:t,icon:b,headline:"No actions yet",description:"Every action a person or agent takes shows up here."}):s?e.jsx(j,{className:t,icon:b,headline:`No ${ge(i.categories)} activity found`,description:"Try other filters.",action:{label:"Clear filters",onClick:a,variant:"outline"}}):e.jsx(j,{className:t,icon:b,headline:"No activity yet",description:"Your agents’ work shows up here."})}function ge(s){if(!s)return"matching";const t=s.split(",").map(r=>{var o;return((o=A[r])==null?void 0:o.label)??r});if(t.length===1)return t[0];const i=t[t.length-1];return`${t.slice(0,-1).join(", ")} or ${i}`}function ye({view:s,onViewChange:n,className:t}){return e.jsxs(W,{"aria-label":"Which list to show",className:f("w-fit shrink-0",t),value:s,onValueChange:i=>n(i),children:[e.jsx(k,{value:"activity",children:"Activity"}),e.jsx(k,{value:"all",children:"All actions"})]})}function pe(s){const n=Date.now()-new Date(s).getTime(),t=Math.floor(n/36e5);return t<1?"recently":t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function ve(s,n){const t=new Date(n),i={};for(const a of s)new Date(a.occurredAt)>t&&(i[a.category]=(i[a.category]??0)+1);return i}function je(s){const n={tasks:"scheduled run",relay:"message",agent:"agent update",config:"settings change",system:"system event",permissions:"permission change"};return Object.entries(s).filter(([,t])=>t>0).map(([t,i])=>{const a=n[t];return`${i} ${i===1?a:`${a}s`}`}).join(" · ")}function be({lastVisitedAt:s,items:n,className:t}){if(!s)return null;const i=ve(n,s);if(Object.values(i).reduce((d,m)=>d+(m??0),0)===0)return null;const r=pe(s),o=je(i);return e.jsxs(g.div,{"data-slot":"activity-since-last-visit",initial:{opacity:0,y:-6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:f("rounded-lg border px-4 py-3","bg-card border-border",t),children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.jsx("span",{className:"text-foreground font-medium",children:"Since your last visit"})," ",e.jsxs("span",{children:["(",r,")"]})]}),e.jsx("p",{className:"text-foreground/80 mt-0.5 text-sm",children:o}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Object.keys(i).map(d=>{const m=i[d];if(!m)return null;const u=A[d];return e.jsxs(K,{shape:"pill",className:f("border-transparent",u.bg,u.text),children:[m," ",u.label]},d)})})]})}const Ae={initial:{opacity:0,y:6},animate:{opacity:1,y:0,transition:{duration:.2,ease:"easeOut"}}};function we(){const s=l.useId(),n=l.useMemo(()=>`${s.split("").reduce((i,a)=>i+a.charCodeAt(0),0)%40+50}%`,[s]);return e.jsxs(oe,{children:[e.jsx(p,{className:"w-28 py-1.5 pr-0 pl-2 max-sm:hidden",children:e.jsx(v,{className:"h-3 w-20"})}),e.jsx(p,{className:"w-24 py-1.5 pr-0 max-sm:hidden",children:e.jsx(v,{className:"h-5 w-20 rounded-full"})}),e.jsx(p,{className:"py-1.5 max-sm:pl-2",children:e.jsx(v,{className:"h-3 rounded",style:{width:n}})}),e.jsx(p,{className:"w-16 py-1.5 max-sm:w-10"})]})}function Ne(){return e.jsxs("div",{"data-slot":"activity-timeline-skeleton",className:"space-y-1",children:[e.jsx("div",{className:"py-2",children:e.jsx(v,{className:"h-3 w-16 rounded"})}),e.jsx(P,{children:e.jsx(L,{children:Array.from({length:5}).map((s,n)=>e.jsx(we,{},n))})})]})}function H({items:s,isLoading:n,isError:t,onRetry:i,isFiltered:a,view:r="activity",className:o}){const d=l.useMemo(()=>te(s,new Date),[s]),{containerRef:m,handleKeyDown:u}=ue(s.length);return n&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(Ne,{})}):t&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(se,{onRetry:i})}):s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(xe,{isFiltered:a,view:r})}):e.jsx("div",{ref:m,onKeyDown:u,"data-slot":"activity-timeline",className:f(o),children:d.map(h=>e.jsxs("section",{children:[e.jsx(ne,{label:h.label}),e.jsx(g.div,{variants:Ae,initial:"initial",animate:"animate",children:e.jsx(P,{children:e.jsx(L,{children:h.items.map(c=>e.jsx(re,{item:c},c.id))})})})]},h.label))})}function O({onLoadMore:s,isFetching:n,hasNextPage:t,className:i}){return t?e.jsx(g.div,{"data-slot":"activity-load-more",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1},className:f("flex justify-center py-4",i),children:e.jsxs(M,{variant:"outline",size:"sm",onClick:s,disabled:n,className:"gap-2",children:[n&&e.jsx(q,{size:"xs"}),"Load 50 more events"]})}):null}const T=7;function Ce(){var t;const s=z(),{data:n}=U({queryKey:X.dailyCounts(T),queryFn:()=>s.getSessionDailyCounts(T),staleTime:6e4});return!n||n.dailyCounts.length===0?null:{dailyCounts:n.dailyCounts,degraded:(((t=n.warnings)==null?void 0:t.length)??0)>0}}function ke(s,n){const t=s.reduce((a,r)=>a+r,0),i=t===1?"session":"sessions";return n?t===0?"This week’s count is incomplete":`Your agents started at least ${t} ${i} this week`:t===0?"Your agents started no chats this week":`Your agents started ${t} ${i} this week`}const I=10,Se=4,F=30,E=1;function Te({data:s,className:n}){const t=Math.max(...s,1);return e.jsx("svg",{viewBox:"0 0 100 30",className:f("text-muted-foreground",n),"aria-hidden":"true",children:s.map((i,a)=>{const r=i/t*F;return e.jsx("rect",{x:a*(I+Se)+1,y:F-Math.max(r,E),width:I,height:Math.max(r,E),rx:2,fill:"currentColor",opacity:.6},a)})})}function Ie(){const s=Ce();return s===null?null:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:ke(s.dailyCounts,s.degraded)}),e.jsx(Te,{data:s.dailyCounts,className:"h-6 w-24 shrink-0"})]})}function Fe(){const s=l.useId(),n=Q("dashboard.sections"),t=l.useMemo(()=>n.filter(i=>Z(i.id)&&(!i.visibleWhen||i.visibleWhen())),[n]);return t.length===0?null:e.jsxs("section",{className:"space-y-3","aria-labelledby":s,children:[e.jsx("h2",{id:s,className:"text-muted-foreground text-xs font-medium tracking-widest uppercase",children:"From your extensions"}),e.jsx("div",{className:"space-y-4",children:t.map(i=>e.jsx(i.component,{},i.id))})]})}function Ee(){const{view:s,setView:n}=ce();return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:"Activity"}),e.jsxs(ee,{width:"wide",className:"space-y-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(ye,{view:s,onViewChange:n}),s==="activity"&&e.jsx(fe,{className:"min-w-0 flex-1"})]}),e.jsx(Ie,{}),e.jsx(Fe,{}),s==="all"?e.jsx(De,{}):e.jsx(Re,{})]})]})}function Re(){const{queryFilters:s,isFiltered:n}=w(),t=le(),{data:i,isLoading:a,isError:r,refetch:o,isFetchingNextPage:d,hasNextPage:m,fetchNextPage:u}=ae(s),h=l.useMemo(()=>(i==null?void 0:i.pages.flatMap(c=>c.items))??[],[i]);return e.jsxs(e.Fragment,{children:[e.jsx(be,{lastVisitedAt:t,items:h}),e.jsx(H,{items:h,isLoading:a,isError:r,onRetry:()=>void o(),isFiltered:n}),e.jsx(O,{onLoadMore:()=>void u(),isFetching:d,hasNextPage:!!m})]})}function De(){const{data:s,isLoading:n,isError:t,refetch:i,isFetchingNextPage:a,hasNextPage:r,fetchNextPage:o}=ie();return e.jsxs(e.Fragment,{children:[e.jsx(H,{items:s??[],isLoading:n,isError:t,onRetry:()=>void i(),isFiltered:!1,view:"all"}),e.jsx(O,{onLoadMore:()=>void o(),isFetching:a,hasNextPage:!!r})]})}const Oe=Ee;export{Oe as component};
@@ -0,0 +1,3 @@
1
+ import{iM as be,iN as ye,j as t,h1 as $,h2 as F,h3 as L,h4 as B,h5 as q,aa as I,iO as Se,av as A,cD as Ne,cE as ke,C as we,cF as Re,iP as z,B as b,iQ as Ce,iR as Ie,bY as W,e as C,Z as y,x as H,r as m,$ as Ae,iS as Pe,iT as De,eU as Me,de as Oe,iU as oe,aQ as Te,X as ie,iV as Ee,iW as $e,aO as Fe,df as ae,hM as Le,bo as K,a3 as R,di as Be,iX as qe,iY as ze,iZ as We,ei as He,ej as _e,i_ as Ue,i$ as Ve,j0 as Ke,j1 as Qe,ec as re,ee as Ge,j2 as Ye,cl as le,dM as Xe,ef as Je,j3 as Ze,l as de,j4 as ce,j5 as ue,hF as et,j6 as _,ed as tt,bb as st,aV as nt,gT as ot,fk as it,j7 as at,ap as rt,j8 as me,g as lt,eV as he,j9 as Q,ja as G,jb as dt,jc as ct,jd as ut,je as mt,ae as ht,jf as gt,eT as ft,bC as xt,it as pt,ek as jt,jg as vt,eo as O,jh as bt,w as Y,dy as yt,hX as St,ji as Nt,n as kt}from"./index-C63bLSO4.js";import{I as wt,i as Rt,a as Ct}from"./RoomSurface-B8ec3_at.js";import{u as It}from"./index-BUVKya1M.js";import{P as ge}from"./PromptSuggestionChips-EO_0zbzq.js";import{S as U}from"./scroll-area-DW0-Liri.js";import{u as At}from"./use-mesh-topology-CIsDeAY0.js";import{A as Pt}from"./AttentionSignalRow-jlgWaSSd.js";import{u as Dt,s as Mt,P as Ot,a as Tt}from"./use-promo-activation-Dxt-1yuT.js";import"./use-jump-back-in-CkFErfWY.js";import"./use-room-follow-claim-huRfaa4e.js";import"./WidgetErrorCard-D--KcgW1.js";import"./card-CKZCX8ol.js";import"./markdown-content-CoK3F0c0.js";import"./table-BEtvgYmW.js";import"./package-DE8sQpId.js";import"./heart-SRafwnSd.js";import"./git-branch-hfu8isLA.js";import"./file-text-9a0DChCq.js";import"./file-CMPbZedq.js";import"./find-latest-widget-fence--3kWMT1F.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-Cqn_Grel.js";import"./mention-pill-Bgs_yujj.js";import"./rotate-ccw-clock-CGcSqHnk.js";import"./message-square-off-CF2Bzen3.js";import"./use-connector-management-Cohvs7jD.js";import"./AgentRequestCard-CcMh6JyE.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-IgDeVFea.js";import"./index-BDfoFNcA.js";function Et({open:e,itemId:n,onClose:o}){const{data:s}=be(),i=ye(),a=(n==null?void 0:n.indexOf("::"))??-1,r=a>=0?n.slice(0,a):void 0,l=a>=0?n.slice(a+2):void 0,d=s==null?void 0:s.find(h=>h.source===r&&h.reason===l),c=()=>{!r||!l||i.mutate({source:r,reason:l},{onSuccess:o})};return t.jsx($,{open:e,onOpenChange:h=>!h&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:"Messages that never arrived"}),t.jsx(q,{children:r??"Source unknown"})]}),t.jsx(U,{className:"flex-1 px-4",children:d?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"These never reached an agent. Clearing them doesn’t send them."}),t.jsxs("p",{className:"text-foreground text-sm",children:[d.count," message",d.count===1?"":"s"," couldn’t be delivered"]}),t.jsx(I,{variant:"secondary",children:Se(d.reason)})]}),t.jsxs("div",{className:"space-y-1 text-sm",children:[t.jsxs("p",{className:"text-muted-foreground",children:["First happened ",A(d.firstSeen)," ago"]}),t.jsxs("p",{className:"text-muted-foreground",children:["Last happened ",A(d.lastSeen)," ago"]})]}),d.sample!=null&&t.jsxs(Ne,{children:[t.jsxs(ke,{className:"text-muted-foreground hover:text-foreground group flex items-center gap-1 text-xs font-medium transition-colors",children:[t.jsx(we,{className:"size-3 transition-transform group-data-[state=open]:rotate-90"}),"What one of them looked like"]}),t.jsx(Re,{children:t.jsx("pre",{className:"bg-muted mt-1 overflow-x-auto rounded-md p-3 font-mono text-xs",children:JSON.stringify(d.sample,null,2)})})]})]}):t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"These are cleared already."})}),t.jsxs(z,{children:[d&&t.jsx(b,{variant:"destructive",onClick:c,disabled:i.isPending,children:i.isPending?"Clearing…":"Clear these"}),t.jsx(b,{variant:"outline",onClick:o,children:"Close"})]})]})})}function $t(e){const n=Math.floor(e/1e3);if(n<60)return`${n}s`;const o=Math.floor(n/60),s=n%60;if(o<60)return`${o}m ${s}s`;const i=Math.floor(o/60),a=o%60;return`${i}h ${a}m`}function Ft(e){switch(e){case"blocked":return{label:"Blocked",badge:"outline",tone:"warning",heading:"What it needed",title:"Run that couldn’t use its tools"};case"failed":return{label:"Didn’t finish",badge:"destructive",tone:"error",heading:"Error",title:"Run that didn’t finish"};case"cancelled":return{label:"Cancelled",badge:"secondary",tone:"neutral",heading:"Stopped",title:"Run that was stopped"};case"skipped":return{label:"Skipped",badge:"secondary",tone:"neutral",heading:"Why",title:"Run that never started"};case"running":return{label:"Running",badge:"secondary",tone:"neutral",heading:"Latest",title:"Run that is still going"};default:return{label:"Completed",badge:"secondary",tone:"neutral",heading:"Note",title:"Run that finished"}}}const Lt={error:{box:"bg-destructive/10 border-destructive/20",heading:"text-destructive",body:"text-destructive"},warning:{box:"bg-status-warning-bg border-status-warning-border",heading:"text-status-warning-fg",body:"text-status-warning-fg"},neutral:{box:"bg-muted border-border",heading:"text-foreground",body:"text-foreground/80"}};function Bt({open:e,itemId:n,onClose:o}){const{data:s,isLoading:i,isError:a}=Ce(e?n??null:null),r=Ie(),l=W(),d=()=>{s!=null&&s.sessionId&&l(H({session:s.sessionId}))},c=()=>{s&&r.mutate(s.id)},h=s?Ft(s.status):null,g=h?Lt[h.tone]:null;return t.jsx($,{open:e,onOpenChange:f=>!f&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:(h==null?void 0:h.title)??"Run that needs a look"}),t.jsx(q,{children:n?n.slice(0,8):"Unknown"})]}),t.jsxs(U,{className:"flex-1 px-4",children:[i&&t.jsxs("div",{className:"space-y-4",children:[t.jsx(C,{className:"h-6 w-24"}),t.jsx(C,{className:"h-4 w-48"}),t.jsx(C,{className:"h-20 w-full"})]}),a&&t.jsx("p",{className:"text-destructive py-8 text-center text-sm",children:"Couldn’t load this run."}),!i&&!a&&!s&&t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"Already resolved."}),s&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(I,{variant:h.badge,children:h.label}),t.jsx(I,{variant:"secondary",children:s.trigger==="scheduled"?"Scheduled":"Manual"})]}),t.jsxs("div",{className:"space-y-1 text-sm",children:[s.startedAt&&t.jsxs("p",{className:"text-muted-foreground",children:["Started: ",A(s.startedAt)," ago"]}),s.finishedAt&&t.jsxs("p",{className:"text-muted-foreground",children:["Finished: ",A(s.finishedAt)," ago"]}),s.durationMs!=null&&t.jsxs("p",{className:"text-muted-foreground",children:["Duration: ",$t(s.durationMs)]})]}),s.error&&t.jsxs("div",{className:y("rounded-md border p-3",g.box),children:[t.jsx("p",{className:y("text-sm font-medium",g.heading),children:h.heading}),t.jsx("p",{className:y("mt-1 text-sm",g.body),children:s.error})]}),s.outputSummary&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Output"}),t.jsx("pre",{className:"bg-muted max-h-48 overflow-auto rounded-md p-3 font-mono text-xs",children:s.outputSummary})]})]})]}),t.jsxs(z,{children:[(s==null?void 0:s.sessionId)&&t.jsx(b,{variant:"default",onClick:d,children:"View chat"}),(s==null?void 0:s.status)==="running"&&t.jsx(b,{variant:"destructive",onClick:c,disabled:r.isPending,children:r.isPending?"Cancelling…":"Cancel run"}),t.jsx(b,{variant:"outline",onClick:o,children:"Close"})]})]})})}function qt({agent:e}){const n=Pe(e,e.projectPath??"");return t.jsxs("div",{className:"flex items-center gap-3 py-2",children:[t.jsx(De,{color:n.color,emoji:n.emoji,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:Me(e)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(I,{variant:"destructive",children:"Unreachable"}),e.runtime&&t.jsx(I,{variant:"secondary",children:Oe(e.runtime).label})]})]}),e.lastSeenAt&&t.jsxs("span",{className:"text-muted-foreground shrink-0 text-xs",children:[A(e.lastSeenAt)," ago"]})]})}function zt({open:e,onClose:n}){const{data:o}=At(void 0,e),s=m.useMemo(()=>o?o.namespaces.flatMap(i=>i.agents).filter(i=>i.healthStatus==="unreachable"):[],[o]);return t.jsx($,{open:e,onOpenChange:i=>!i&&n(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:"Agents that aren’t answering"}),t.jsxs(q,{children:["DorkOS can’t reach ",s.length," agent",s.length===1?"":"s"," right now"]})]}),t.jsx(U,{className:"flex-1 px-4",children:s.length>0?t.jsx("div",{className:"divide-y",children:s.map(i=>t.jsx(qt,{agent:i},i.id))}):t.jsxs("div",{className:"flex flex-col items-center gap-2 py-8",children:[t.jsx(Ae,{className:"text-status-success size-6"}),t.jsx("p",{className:"text-muted-foreground text-sm",children:"All agents are online"})]})}),t.jsx(z,{children:t.jsx(b,{variant:"outline",onClick:n,children:"Close"})})]})})}function Wt(e){return e.content.suggestion!==void 0}function Ht(){const e=Dt(),{dismissedIds:n}=oe(),o=Te(s=>s.promoEnabled);return m.useMemo(()=>{if(!o)return null;const[s]=Mt(Ot.filter(Wt),e,n,1);return s??null},[e,n,o])}function _t({suggestion:e,promoTitle:n,onAccept:o,onDismiss:s}){return t.jsxs("p",{"data-slot":"quiet-suggestion",className:"text-muted-foreground/70 text-2xs mt-1",children:[e.question," ",t.jsx("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm font-medium underline-offset-4 transition-colors hover:underline focus-visible:underline",children:e.action}),t.jsx("button",{type:"button","aria-label":`Dismiss suggestion: ${n}`,onClick:s,className:"text-muted-foreground/60 hover:text-foreground focus-ring -my-1.5 ml-0.5 inline-flex translate-y-[3px] items-center justify-center rounded-sm p-1.5 align-baseline transition-colors",children:t.jsx(ie,{className:"size-3"})})]})}function Ut({promo:e}){const{dismissPromo:n}=oe(),{activate:o,dialog:s}=Tt(e);return t.jsxs(t.Fragment,{children:[t.jsx(_t,{suggestion:e.content.suggestion,promoTitle:e.content.title,onAccept:o,onDismiss:()=>n(e.id)}),s]})}function Vt(){const e=Ht();return e===null?null:t.jsx(Ut,{promo:e},e.id)}const Kt=["report.daily"];function fe(){const{notifications:e}=Ee({kinds:Kt,unread:!0});return m.useMemo(()=>e[0],[e])}function Qt({questions:e,requests:n,schedules:o,approvalsUnavailable:s,attention:i}){const a=[],r=[],l=e+n+o;return l>0?(a.push(`${$e(e,n,o)} ${l===1?"is":"are"} waiting on you.`),r.push(`${l} waiting`)):s&&(a.push("Couldn’t read approvals."),r.push("Couldn’t read approvals")),i===1?(a.push("1 thing needs attention."),r.push("1 needs attention")):i>1&&(a.push(`${i} things need attention.`),r.push(`${i} need attention`)),{spoken:a.join(" "),compact:r.join(" · ")}}function Gt({notification:e,onDismiss:n}){return t.jsxs("div",{"data-slot":"shift-report-card",className:"border-border/60 bg-background/60 relative rounded-lg border p-3 pr-8",children:[t.jsxs("div",{className:"flex items-start gap-2.5",children:[t.jsx(Fe,{"aria-hidden":!0,className:"text-muted-foreground mt-0.5 size-3.5 shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-foreground text-xs font-medium",children:e.title}),e.body!==void 0&&t.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:e.body})]})]}),t.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss",className:"text-muted-foreground hover:text-foreground focus-ring absolute top-2 right-2 rounded-md p-1 transition-colors",children:t.jsx(ie,{className:"size-3.5"})})]})}const Yt="max-h-[40svh] sm:max-h-[50svh]",Xt={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0}};function T({title:e,tone:n="waiting",children:o}){const s=m.useId();return t.jsxs("section",{"aria-labelledby":s,className:"min-w-0",children:[t.jsx("h2",{id:s,className:y("mb-2 text-xs font-medium",n==="waiting"?"text-status-warning-fg":"text-muted-foreground"),children:e}),o]})}function X({edge:e}){return t.jsx("div",{"aria-hidden":"true","data-slot":`pinned-triage-fade-${e}`,className:y("from-background/95 via-background/65 pointer-events-none absolute inset-x-0 h-6 to-transparent",e==="bottom"?"bottom-0 bg-gradient-to-t":"top-0 bg-gradient-to-b")})}const J={animate:{transition:{staggerChildren:.04}}};function Jt(e){return e?0:.18}function Zt({approvals:e,asks:n,settlingAsks:o,askAgentNames:s,onOpenSession:i,approvalsUnavailable:a,onRetryApprovals:r,scheduleApprovals:l,errorSignals:d,activityItems:c,onOpenActivity:h,shiftReport:g,presence:f,condensed:j,onExpand:p,className:u}){const x=ae(),v=m.useRef(null),N=Le(v),k=e.length>0||n.length>0||o.length>0||l.length>0||a,P=d.length>0,w=c.length>0,je=k||P||w||g!==void 0||(f==null?void 0:f.occupied)===!0,M=Qt({questions:n.length,requests:e.length,schedules:l.length,approvalsUnavailable:a,attention:d.length+c.length}),ve=j===!0&&M.compact!=="";return t.jsxs(t.Fragment,{children:[t.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:M.spoken}),t.jsxs(K,{initial:!1,children:[ve&&t.jsx(R.div,{"data-slot":"pinned-triage-summary",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:Jt(x===!0)},className:y("bg-background/95 border-border/60 shrink-0 border-b backdrop-blur-sm",u),children:t.jsxs("button",{type:"button",onClick:p,className:"text-muted-foreground hover:text-foreground flex min-h-11 w-full min-w-0 items-center gap-2 px-[var(--msg-padding-x)] text-left text-xs",children:[t.jsx("span",{className:"bg-status-warning-dot size-1.5 shrink-0 rounded-full","aria-hidden":!0}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:M.compact}),t.jsx(Be,{className:"size-3.5 shrink-0","aria-hidden":!0})]})},"triage-summary"),je&&j!==!0&&t.jsxs(R.div,{"data-slot":"pinned-triage-header",...Xt,transition:{duration:x?0:.25,ease:[0,0,.2,1]},className:y("bg-background/95 border-border/60 relative shrink-0 overflow-hidden border-b backdrop-blur-sm",u),children:[t.jsxs("div",{ref:v,onScroll:N.onScroll,"data-slot":"pinned-triage-scroller",className:y("flex w-full min-w-0 scroll-py-6 flex-col gap-3 overflow-y-auto overscroll-contain px-[var(--msg-padding-x)] py-3",Yt),children:[k&&t.jsxs(T,{title:"Waiting on you",children:[(n.length>0||o.length>0)&&t.jsx(qe,{asks:n,agentNames:s,onOpenSession:i,emptyState:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Nothing needs you"})}),e.length>0&&t.jsx(ze,{approvals:e}),e.length===0&&a&&t.jsx(We,{onRetry:r}),t.jsx(K,{initial:!1,children:l.map(S=>t.jsx(He,{task:S,className:"mt-2"},S.id))})]}),P&&t.jsx(T,{title:"Needs attention",children:t.jsx("div",{className:"border-status-warning-border/40 bg-background/60 rounded-lg border p-2",children:t.jsx(R.div,{variants:J,initial:"initial",animate:"animate",children:d.map(S=>t.jsx(Pt,{signal:S},S.id))})})}),g&&t.jsx(Gt,{notification:g.notification,onDismiss:g.onDismiss}),w&&t.jsx(T,{title:"Recent activity",tone:"neutral",children:t.jsx("div",{className:"border-border/60 bg-background/60 rounded-lg border p-2",children:t.jsx(R.div,{variants:J,initial:"initial",animate:"animate",children:c.map(S=>t.jsx(_e,{notification:S,onOpen:()=>h(S)},S.id))})})}),f==null?void 0:f.node]}),N.start&&t.jsx(X,{edge:"top"}),N.end&&t.jsx(X,{edge:"bottom"})]},"triage-header")]})]})}function es({presence:e,composerFocused:n,onExpand:o,className:s}){const{approvals:i,isError:a,retry:r}=Ue(),{interactions:l}=Ve(),d=Ke(),c=Qe(l),{schedules:h,errors:g,activity:f}=re(),j=Ge(),p=fe(),{mutate:u}=Ye(),x=le({strict:!1}),v=W(),N=Xe(),k=Je(h),P=Ze(i),w=m.useCallback(()=>{v({...de.home(),search:{}})},[v]);return t.jsxs(t.Fragment,{children:[t.jsx(Zt,{approvals:P,asks:l,settlingAsks:d,askAgentNames:c,onOpenSession:V=>{v(H({session:V}))},approvalsUnavailable:a&&i.length===0,onRetryApprovals:r,scheduleApprovals:k,errorSignals:g,activityItems:f,onOpenActivity:j,shiftReport:p===void 0?void 0:{notification:p,onDismiss:()=>u(p.id)},presence:e,condensed:N&&n===!0,onExpand:o,className:s}),t.jsx(Et,{open:x.detail==="dead-letter",itemId:x.itemId,onClose:w}),t.jsx(Bt,{open:x.detail==="failed-run",itemId:x.itemId,onClose:w}),t.jsx(zt,{open:x.detail==="offline-agent",onClose:w})]})}const ts=["What can you help with?","Make my first agent","What’s in this project?","Set up a daily run"];function ss({roomId:e}){const n=m.useCallback(o=>{ce.getState().set(e,o),ue.getState().requestFocus(e)},[e]);return t.jsx("div",{className:"w-full px-[var(--msg-padding-x)] pb-1",children:t.jsx(ge,{suggestions:ts,onChipClick:n,ariaLabel:"Ways to start",size:"comfortable"})})}function ns(e){var a;const{data:n}=et(e),o=((a=n==null?void 0:n.members.find(r=>r.author.id===n.viewerAuthorId))==null?void 0:a.lastReadSeq)??null,[s,i]=m.useState({roomId:null,seq:null});return s.roomId===e?s.seq:o===null?null:(i({roomId:e,seq:o}),o)}function os(e,n){if(e===void 0)return null;let o=null,s=1/0;for(const i of e){if(!i.enabled||i.status!=="active")continue;const a=i.nextRun;if(a==null)continue;const r=Date.parse(a);Number.isNaN(r)||r<=n||r>=s||(s=r,o={name:i.displayName??i.name,at:a})}return o}function is(e,n){const o=new Date(e),s=o.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),i=as(new Date(n),o);return i===0?`today at ${s}`:i===1?`tomorrow at ${s}`:`on ${o.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})} at ${s}`}function as(e,n){const o=s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime();return Math.round((o(n)-o(e))/864e5)}function rs(e,n){return e===null?null:`Next up: ${e.name} runs ${is(e.at,n)}.`}function ls({forwardLook:e,suggestion:n}){return t.jsx(R.div,{"data-slot":"home-quiet-state",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"border-border/60 shrink-0 border-b",children:t.jsxs("div",{className:"w-full px-[var(--msg-padding-x)] py-2",children:[t.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.jsx("span",{className:"text-foreground/80 font-medium",children:"All quiet."}),e!==null&&t.jsxs(t.Fragment,{children:[" ",e]})]}),n]})})}function ds({roomId:e,presenceOccupied:n}){const o=_(e),s=ns(e),{items:i,isLoading:a,isAnyError:r}=tt(),{total:l}=re(),d=fe(),c=o!==void 0&&o.length>0,h=s!==null&&o!==void 0&&o.every(k=>k.seq<=s),g=i.length>0||a||r||l>0||d!==void 0||n,f=c&&h&&!g,[j,p]=m.useState("waiting");f&&j==="waiting"?p("shown"):!f&&j==="shown"&&p("retired");const u=f&&j!=="retired",x=st(),{data:v}=nt(x&&u),N=ot();return u?t.jsx(ls,{forwardLook:rs(os(v,N),N),suggestion:t.jsx(Vt,{})}):null}const xe="dorkos:home-opened-on";function Z(){const e=new Date,n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${n}-${o}`}function cs(){try{return localStorage.getItem(xe)}catch{return null}}function us(e){try{localStorage.setItem(xe,e)}catch{}}function ms(){const[e]=m.useState(()=>cs()!==Z());return m.useEffect(()=>{e&&us(Z())},[e]),e}function hs({children:e}){const n=ms(),o=ae(),s=n&&o!==!0;return t.jsx(R.div,{className:"h-full",initial:s?{opacity:0}:!1,animate:{opacity:1},transition:{duration:.45,ease:[0,0,.2,1]},children:e})}const ee="@dorkbot",gs="Build me a tracker for my customers",fs="Make a daily plan board",pe="Something else",xs=[gs,fs,pe];function ps({roomId:e,mode:n}){const o=It(),s=it(),i=m.useCallback(a=>{if(a===pe){ce.getState().set(e,`${ee} `),ue.getState().requestFocus(e);return}o.mutate({roomId:e,text:`${ee} ${a}`,clientId:at()})},[e,o]);return n==="starters"?t.jsx("div",{className:"w-full px-[var(--msg-padding-x)] pb-1","data-testid":"first-run-chips",children:t.jsx(ge,{suggestions:xs,onChipClick:i,ariaLabel:"First jobs for DorkBot",size:"comfortable"})}):t.jsxs("div",{className:"flex w-full flex-wrap gap-2 px-[var(--msg-padding-x)] pb-1","data-testid":"first-run-connect-chips",children:[t.jsx(b,{size:"sm",onClick:()=>s.open("account"),children:"Continue with DorkOS"}),t.jsx(b,{size:"sm",variant:"outline",onClick:()=>s.open("runtimes"),children:"Use my own AI"})]})}function js(e){var r,l;const{data:n}=rt(),o=_(e),s=me(e,null),i=((r=n==null?void 0:n.onboarding)==null?void 0:r.welcomeEntryId)??null;if(e===null||i===null||!o||s.length>0)return null;const a=o.reduce((d,c)=>d===void 0||c.seq>d.seq?c:d,void 0);return(a==null?void 0:a.id)!==i?null:((l=n==null?void 0:n.onboarding)==null?void 0:l.firstRunPath)==="none"?"connect":"starters"}const vs=5,bs="relative after:absolute after:-inset-x-1 after:-inset-y-2.5 md:after:hidden";function ys(e,n){return e===null||n===null?null:Math.max(0,n-Date.parse(e))}function Ss({row:e,onFollow:n,onViewProfile:o}){const[s,i]=m.useState(null),a=ys(e.since,s),r=e.profileMemberId,l=o===void 0||r===null?void 0:()=>o(r);return t.jsx(wt,{onViewProfile:l,identity:{kind:e.face.kind,displayName:e.name,...e.handle!==null?{handle:e.handle}:{},color:e.face.color,...e.face.emoji!==void 0?{emoji:e.face.emoji}:{},...e.face.imageUrl!==void 0?{imageUrl:e.face.imageUrl}:{},...e.face.origin!==void 0?{origin:e.face.origin}:{},...e.face.kind==="agent"?{agent:{...e.runtime!==null?{runtime:e.runtime}:{},...a!==null?{working:{...e.roomTitle!==null?{room:e.roomTitle}:{},forMs:a}}:{}}}:{}},children:t.jsxs("button",{type:"button","aria-label":e.detail===null?`Watch ${e.name}`:`Watch ${e.name}: ${e.detail}`,onClick:()=>n(e.follow),onPointerEnter:()=>i(Date.now()),onPointerLeave:()=>i(null),onFocus:()=>i(Date.now()),onBlur:()=>i(null),className:y("focus-ring group/identity hover:bg-muted/60 flex min-w-0 items-center gap-1.5 rounded-full py-1 pr-2.5 pl-1 text-xs transition-colors",bs),children:[t.jsx(lt,{size:"xs",kind:e.face.kind,color:e.face.color,...e.face.emoji!==void 0?{emoji:e.face.emoji}:{},...e.face.imageUrl!==void 0?{imageUrl:e.face.imageUrl}:{},...e.face.origin!==void 0?{origin:e.face.origin}:{},fallback:e.face.fallback,status:"working"}),t.jsx("span",{className:"text-foreground shrink-0 font-medium",children:e.name}),e.detail!==null&&t.jsxs("span",{"aria-hidden":!0,className:"text-muted-foreground truncate",children:["· ",e.detail]})]})})}function Ns({rows:e,onFollow:n,onViewProfile:o,className:s}){if(e.length===0)return null;const i=e.slice(0,vs),a=e.length-i.length;return t.jsxs("ul",{"data-testid":"presence-strip","aria-label":"Working right now",className:y("flex items-center gap-x-2 overflow-hidden",s),children:[i.map(r=>t.jsx("li",{className:"min-w-0",children:t.jsx(Ss,{row:r,onFollow:n,onViewProfile:o})},r.id)),a>0&&t.jsx("li",{"aria-label":a===1?"1 more agent is working":`${a} more agents are working`,className:"text-muted-foreground shrink-0 text-xs",children:t.jsxs("span",{"aria-hidden":!0,children:["+",a," more"]})})]})}function ks(e){return`replying in ${e}`}const ws="working in a chat";function Rs(e,n){var i;const o=n.rosters[e];if(o!==void 0)return o.members.map(a=>({author:a.author,origin:a.origin}));const s=(i=n.rooms[e])==null?void 0:i.participants;return s==null?[]:s.map(a=>({author:a}))}function Cs(e){const n=new Map;for(const[o,s]of Object.entries(e))s!==null&&n.set(dt(o),{path:o,manifest:s});return n}function te(e){return{...e,line:ut(e.name,e.binding,e.state),detail:ct(e.binding,e.state)}}function Is(e){const n=Cs(e.agents),o=new Set(e.excludeRoomIds??[]),s=[],i=new Set;for(const l of e.claims){const d=Rs(l.roomId,e).find(f=>f.author.id===l.authorId);if(d===void 0)continue;const c=d.author.agentRef===void 0?void 0:n.get(d.author.agentRef);if(c!==void 0&&i.add(c.path),o.has(l.roomId))continue;const h=e.rooms[l.roomId],g=h===void 0?null:he(h);s.push(te({id:`room:${l.roomId}:${l.authorId}`,name:d.author.displayName,handle:d.author.handle,face:Q({record:d.author,override:c===void 0?null:G(c.manifest),...d.origin!==void 0?{origin:d.origin}:{}}),binding:g===null?null:ks(g),state:l.state,since:l.since,roomTitle:g,runtime:(c==null?void 0:c.manifest.runtime)??null,profileMemberId:c===void 0?null:e.meshIdByPath[c.path]??null,follow:{kind:"room",roomId:l.roomId}}))}const a=new Set(i),r=[];for(const l of e.sessions){if(a.has(l.cwd))continue;const d=e.agents[l.cwd];if(d==null)continue;a.add(l.cwd);const c=d.displayName??d.name;r.push(te({id:`session:${l.sessionId}`,name:c,handle:null,face:Q({record:{id:d.id,kind:"agent",displayName:c},override:G(d)}),binding:ws,state:"working",since:null,roomTitle:null,runtime:d.runtime,profileMemberId:e.meshIdByPath[l.cwd]??null,follow:{kind:"session",sessionId:l.sessionId,cwd:l.cwd}}))}return r.sort((l,d)=>l.name.localeCompare(d.name)||l.id.localeCompare(d.id)),[...s,...r]}function As(e,n,o){var a;const s=new Set(mt(Object.keys(n),Object.values(o))),i=[];for(const[r,l]of Object.entries(n))((a=e[r])==null?void 0:a.lifecycle)==="streaming"&&s.has(r)&&i.push({sessionId:r,cwd:l});return i}const se=[],Ps=[],ne="\0",D="";function Ds(){const e=O(m.useCallback(i=>i.statuses,[])),n=O(m.useCallback(i=>i.statusCwds,[])),o=O(m.useCallback(i=>i.sessions,[])),s=m.useMemo(()=>As(e,n,o).map(i=>`${i.sessionId}${ne}${i.cwd}`).sort().join(D),[e,n,o]);return m.useMemo(()=>s.length===0?Ps:s.split(D).map(i=>{const[a,r]=i.split(ne);return{sessionId:a,cwd:r}}),[s])}function Ms(e=[]){const n=ht(),o=gt(),s=Ds(),{data:i}=ft(),{data:a}=xt(),r=m.useMemo(()=>[...new Set(o.map(u=>u.roomId))].sort().join(`
2
+ `),[o]),l=m.useMemo(()=>r.length===0?[]:r.split(`
3
+ `),[r]),d=pt({queries:l.map(u=>({queryKey:jt.detail(u),queryFn:()=>n.getRoom(u)})),combine:u=>{const x={};for(const v of u)v.data!==void 0&&(x[v.data.id]=v.data);return x}}),c=m.useMemo(()=>{const u={};for(const x of i??[])u[x.id]=x;return u},[i]),h=m.useMemo(()=>((a==null?void 0:a.agents)??[]).map(u=>u.projectPath),[a]),{data:g}=vt(h),f=m.useMemo(()=>g??{},[g]),j=m.useMemo(()=>{const u={};for(const x of(a==null?void 0:a.agents)??[])u[x.projectPath]=x.id;return u},[a]),p=e.join(D);return m.useMemo(()=>{if(o.length===0&&s.length===0)return se;const u=Is({claims:o,rosters:d,rooms:c,sessions:s,agents:f,meshIdByPath:j,excludeRoomIds:p.length===0?[]:p.split(D)});return u.length===0?se:u},[o,d,c,s,f,j,p])}function Os(e=[]){const n=Ms(e),o=W(),{open:s}=bt(),i=m.useCallback(r=>{if(r.kind==="room"){Y.getState().recordOpened("room",r.roomId),o({...de.channels(),search:{id:r.roomId}});return}r.cwd&&Y.getState().recordOpened("agent",r.cwd),o(H({session:r.sessionId,dir:r.cwd}))},[o]),a=m.useMemo(()=>t.jsx(Ns,{rows:n,onFollow:i,onViewProfile:s}),[n,i,s]);return{occupied:n.length>0,node:a}}function E({title:e,children:n,action:o}){return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(kt,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:e}),t.jsx("p",{className:"max-w-sm",children:n}),o]})}function Ts(){return t.jsxs(t.Fragment,{children:[t.jsx(yt,{children:"Home"}),t.jsx(Es,{})]})}function Es(){var f,j,p;const e=St(),[n,o]=m.useState(!1),s=m.useCallback(()=>{const u=document.activeElement;Rt(u)&&u.blur()},[]),{thread:i,entry:a}=le({strict:!1}),r=Nt(),l=Os(e.room===null?[]:[e.room.id]),d=_(((f=e.room)==null?void 0:f.id)??null),c=me(((j=e.room)==null?void 0:j.id)??null,null),h=d!==void 0&&d.length===0&&c.length===0,g=js(((p=e.room)==null?void 0:p.id)??null);if(e.status==="loading")return t.jsxs("div",{className:"flex h-full flex-col","aria-busy":!0,children:[t.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",children:[t.jsx(C,{className:"size-7 rounded-full"}),t.jsx(C,{className:"h-4 w-40"})]}),t.jsx("div",{className:"flex-1"})]});if(e.status==="error")return t.jsx(E,{title:"Couldn’t load your team room",action:t.jsx(b,{variant:"outline",size:"sm",className:"mt-2",onClick:e.retry,children:"Try again"}),children:"Its messages are safe."});if(e.status==="missing")return t.jsx(E,{title:"Your team room isn’t open yet",children:"DorkOS opens it at startup. Still missing? Restart DorkOS."});if(e.status==="archived"){const u=e.room;return t.jsx(E,{title:`${he(u)} is archived`,action:t.jsx(b,{variant:"outline",size:"sm",className:"mt-2",disabled:r.isPending,onClick:()=>r.mutate({roomId:u.id}),children:r.isPending?"Bringing it back…":"Bring it back"}),children:"Its messages are safe."})}return t.jsx(hs,{children:t.jsx(Ct,{roomId:e.room.id,threadId:i,entrySeq:a,threadRoute:"/",offerJumpBackIn:!0,onComposerFocusChange:o,aboveTimeline:t.jsxs(t.Fragment,{children:[t.jsx(es,{presence:l,composerFocused:n,onExpand:s}),t.jsx(ds,{roomId:e.room.id,presenceOccupied:l.occupied})]}),aboveComposer:g?t.jsx(ps,{roomId:e.room.id,mode:g}):h?t.jsx(ss,{roomId:e.room.id}):void 0})})}const hn=Ts;export{hn as component};
@@ -0,0 +1 @@
1
+ import{dr as k,r as n,ds as I,dt as C,du as E,j as e,e as D,dv as l,dw as R,a3 as x,B,dx as M,dy as _,bb as L,aV as z,dz as V,aZ as G,dA as H,dB as K,a6 as U,dC as W,dD as Q}from"./index-C63bLSO4.js";import{P as A}from"./page-container-BoXmmBSs.js";import{u as X,S as Z}from"./search-x-Sme5ElYi.js";import{S as $}from"./scroll-area-DW0-Liri.js";const q=8,J={visible:{transition:{staggerChildren:.04}},hidden:{}},Y={hidden:{opacity:0,y:8},visible:{opacity:1,y:0}};function ee({tasks:o,isLoading:c,agentMap:u,onEditTask:j,agentId:h}){const t=X(k,{debounce:{search:200}}),[r]=n.useState(0),[f,d]=n.useState(null),i=n.useMemo(()=>h?o.filter(s=>s.agentId===h):o,[o,h]),m=n.useMemo(()=>[...new Set(i.map(s=>s.agentId).filter(s=>!!s))],[i]),g=n.useMemo(()=>I(i,k,t.values,E,{field:t.sortField||C,direction:t.sortDirection}),[i,t.values,t.sortField,t.sortDirection]);return c?e.jsx("div",{className:"space-y-3 py-4",children:Array.from({length:3}).map((s,p)=>e.jsx(D,{className:"h-14 w-full rounded-xl"},p))}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs(l,{state:t,className:"px-0",children:[e.jsx(l.Search,{placeholder:"Filter tasks…"}),e.jsx(l.Primary,{name:"status"}),e.jsx(l.AddFilter,{dynamicOptions:{agent:m}}),e.jsx(l.Sort,{options:E,defaultField:C}),e.jsx(l.ResultCount,{count:g.length,total:i.length,noun:"task"}),e.jsx(l.ActiveFilters,{})]}),e.jsx($,{className:"min-h-0 flex-1","data-testid":R.tasksList,children:e.jsx("div",{className:"space-y-2 pb-4",children:g.length===0&&i.length>0?e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[e.jsx(Z,{className:"text-muted-foreground/50 size-10"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t.describeActive()?`No tasks match ${t.describeActive()}`:"No tasks match your filters"}),e.jsx(B,{variant:"outline",size:"sm",onClick:t.clearAll,children:"Clear filters"})]}):e.jsx(x.div,{initial:"hidden",animate:"visible",variants:J,className:"space-y-2",children:g.map((s,p)=>e.jsx(x.div,{variants:p<q?Y:void 0,transition:{duration:.15},children:e.jsx(M,{task:s,agent:(s.agentId?u.get(s.agentId):void 0)??null,expanded:f===s.id,onToggleExpand:()=>d(f===s.id?null:s.id),onEdit:()=>j(s)})},s.id))},r)})})]})}function se(){return e.jsxs(e.Fragment,{children:[e.jsx(_,{children:"Schedules"}),e.jsx(te,{})]})}function te(){const o=L(),{data:c=[],isLoading:u,isError:j,refetch:h}=z(o),[t,r]=n.useState(!1),[f,d]=n.useState(),[i,m]=n.useState(null),g=c.some(a=>a.agentId),{data:s}=V(void 0,g||!u),p=n.useMemo(()=>{const a=new Map;for(const S of(s==null?void 0:s.agents)??[])a.set(S.id,S);return a},[s]),{externalTrigger:v,clear:N}=G(),[y,T]=n.useState(!1);v&&!y&&!t?(T(!0),d(void 0),r(!0),N()):!v&&y&&T(!1);const F=a=>{m(a),d(void 0),r(!0)},b=()=>{m(null),d(void 0),r(!0)},O=a=>{d(a),r(!0)},P=a=>{r(a),a||m(null)};if(!o)return e.jsx(H,{icon:K.tasks,name:"Scheduling",description:"Agents run tasks on a schedule, even while you’re away.",command:"dorkos --tasks"});if(j)return e.jsx(U,{className:"h-full",title:"Couldn’t load your scheduled tasks",description:"The DorkOS server didn’t answer. Check that it’s running.",onRetry:()=>void h()});const w=c.length>0;return e.jsxs(e.Fragment,{children:[!w&&!u?e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(A,{width:"full",children:e.jsx(W,{onCreateWithPreset:F,onCreateBlank:b})})}):e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(A,{width:"full",scroll:!1,children:e.jsx(ee,{tasks:c,isLoading:u,agentMap:p,onEditTask:O})})}),e.jsx(Q,{open:t,onOpenChange:P,editTask:f,initialPreset:i})]})}const le=se;export{le as component};
@@ -1 +1 @@
1
- import{ae as j,aj as g,r as f,j as e,dv as N,dB as i,at as b,dC as y,dg as w,aa as u,b1 as C}from"./index-Dr-0P6rd.js";import{T,d as v,b as p,e as d,a as S,c}from"./table-P4N5xQn2.js";import{P as k}from"./page-container-CPxW5T9E.js";import{G as L}from"./git-branch-Dq_w3Iyx.js";const B=["workspaces","scan"],F=6e4;function P(){var a,n,l;const s=j(),t=g({queryKey:B,queryFn:()=>s.scanWorktrees(),staleTime:F});return{root:((a=t.data)==null?void 0:a.root)??null,worktrees:((n=t.data)==null?void 0:n.worktrees)??[],warnings:((l=t.data)==null?void 0:l.warnings)??[],isLoading:t.isLoading,isError:t.isError}}const m="—";function A(s){return s.changedFiles===null?m:s.changedFiles===0?"Clean":`${s.changedFiles} changed`}function E(s){const{ahead:t,behind:a,upstreamGone:n}=s;return n?"Branch merged or deleted":t===null||a===null?m:t===0&&a===0?"In sync":[t>0&&`${t} ahead`,a>0&&`${a} behind`].filter(Boolean).join(" · ")}function W({worktree:s}){const t=(s.changedFiles??0)>0;return e.jsxs(p,{children:[e.jsxs(c,{className:"max-w-0",children:[e.jsx("div",{className:"truncate font-medium",children:s.name}),e.jsx("div",{className:"text-muted-foreground truncate text-xs",title:s.path,children:i(s.path)})]}),e.jsx(c,{className:"max-w-0",children:s.readable?s.branch?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(L,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("span",{className:"truncate text-xs",children:s.branch})]}):e.jsx("span",{className:"text-muted-foreground text-xs",children:"No branch"}):e.jsx(u,{variant:"outline",title:"DorkOS couldn’t read this folder with git.",children:"Can’t read"})}),e.jsx(c,{className:t?"text-status-warning-fg":"text-muted-foreground",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:A(s)})}),e.jsx(c,{className:"text-muted-foreground hidden md:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:E(s)})}),e.jsx(c,{className:"text-muted-foreground hidden sm:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:s.lastCommitAt?C(s.lastCommitAt):m})})]})}function G({project:s,worktrees:t}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 text-sm font-semibold",children:[s,e.jsx(u,{variant:"secondary",children:t.length})]}),e.jsx("div",{className:"bg-card rounded-lg border",children:e.jsxs(T,{children:[e.jsx(v,{children:e.jsxs(p,{children:[e.jsx(d,{children:"Folder"}),e.jsx(d,{children:"Branch"}),e.jsx(d,{children:"Changes"}),e.jsx(d,{className:"hidden md:table-cell",children:"Compared to remote"}),e.jsx(d,{className:"hidden sm:table-cell",children:"Last commit"})]})}),e.jsx(S,{children:t.map(a=>e.jsx(W,{worktree:a},a.path))})]})})]})}function H(){const{root:s,worktrees:t,warnings:a,isLoading:n,isError:l}=P(),x=f.useMemo(()=>{const r=new Map;for(const o of t){const h=r.get(o.project)??[];h.push(o),r.set(o.project,h)}return[...r.entries()]},[t]);return e.jsxs(k,{width:"wide",children:[e.jsx(N,{children:"Workspaces"}),e.jsx("p",{className:"text-muted-foreground mb-6 text-sm",children:"Copies of your code, per agent."}),a.length>0&&e.jsxs("div",{className:"mb-6 rounded-lg border border-amber-600/40 bg-amber-500/10 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Some folders couldn’t be read"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"This list may be missing what’s inside them."}),e.jsx("ul",{className:"text-muted-foreground mt-2 space-y-0.5 text-xs",children:a.map(r=>e.jsxs("li",{className:"truncate",title:r.path,children:[i(r.path)," (",r.reason,")"]},r.path))})]}),n?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Looking for your worktrees…"}):l?e.jsxs("div",{className:"bg-card rounded-xl border p-10 text-center",children:[e.jsx(b,{className:"text-muted-foreground/60 mx-auto size-8"}),e.jsx("p",{className:"mt-3 font-medium",children:"Couldn’t check your worktrees"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"The scan didn’t finish. DorkOS tries again on its own."})]}):x.length===0?e.jsxs("div",{className:"bg-card rounded-xl border p-10 text-center",children:[e.jsx(y,{className:"text-muted-foreground/60 mx-auto size-8"}),e.jsx("p",{className:"mt-3 font-medium",children:"No worktrees yet"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"A worktree is a copy of your project, so agents’ edits never collide."}),s&&e.jsxs("p",{className:"text-muted-foreground mt-3 truncate text-xs",title:s,"data-slot":"workspaces-root-path",children:["Looking in ",e.jsx(w,{children:i(s)})]})]}):e.jsx("div",{className:"flex flex-col gap-8",children:x.map(([r,o])=>e.jsx(G,{project:r,worktrees:o},r))})]})}const M=H;export{M as component};
1
+ import{ae as j,aj as g,r as f,j as e,dy as N,dE as i,aw as b,dF as y,dj as w,aa as u,b4 as C}from"./index-C63bLSO4.js";import{T,d as v,b as p,e as d,a as S,c}from"./table-BEtvgYmW.js";import{P as k}from"./page-container-BoXmmBSs.js";import{G as L}from"./git-branch-hfu8isLA.js";const F=["workspaces","scan"],E=6e4;function P(){var a,n,l;const s=j(),t=g({queryKey:F,queryFn:()=>s.scanWorktrees(),staleTime:E});return{root:((a=t.data)==null?void 0:a.root)??null,worktrees:((n=t.data)==null?void 0:n.worktrees)??[],warnings:((l=t.data)==null?void 0:l.warnings)??[],isLoading:t.isLoading,isError:t.isError}}const m="—";function A(s){return s.changedFiles===null?m:s.changedFiles===0?"Clean":`${s.changedFiles} changed`}function B(s){const{ahead:t,behind:a,upstreamGone:n}=s;return n?"Branch merged or deleted":t===null||a===null?m:t===0&&a===0?"In sync":[t>0&&`${t} ahead`,a>0&&`${a} behind`].filter(Boolean).join(" · ")}function W({worktree:s}){const t=(s.changedFiles??0)>0;return e.jsxs(p,{children:[e.jsxs(c,{className:"max-w-0",children:[e.jsx("div",{className:"truncate font-medium",children:s.name}),e.jsx("div",{className:"text-muted-foreground truncate text-xs",title:s.path,children:i(s.path)})]}),e.jsx(c,{className:"max-w-0",children:s.readable?s.branch?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(L,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("span",{className:"truncate text-xs",children:s.branch})]}):e.jsx("span",{className:"text-muted-foreground text-xs",children:"No branch"}):e.jsx(u,{variant:"outline",title:"DorkOS couldn’t read this folder with git.",children:"Can’t read"})}),e.jsx(c,{className:t?"text-status-warning-fg":"text-muted-foreground",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:A(s)})}),e.jsx(c,{className:"text-muted-foreground hidden md:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:B(s)})}),e.jsx(c,{className:"text-muted-foreground hidden sm:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:s.lastCommitAt?C(s.lastCommitAt):m})})]})}function G({project:s,worktrees:t}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 text-sm font-semibold",children:[s,e.jsx(u,{variant:"secondary",children:t.length})]}),e.jsx("div",{className:"bg-card rounded-lg border",children:e.jsxs(T,{children:[e.jsx(v,{children:e.jsxs(p,{children:[e.jsx(d,{children:"Folder"}),e.jsx(d,{children:"Branch"}),e.jsx(d,{children:"Changes"}),e.jsx(d,{className:"hidden md:table-cell",children:"Compared to remote"}),e.jsx(d,{className:"hidden sm:table-cell",children:"Last commit"})]})}),e.jsx(S,{children:t.map(a=>e.jsx(W,{worktree:a},a.path))})]})})]})}function H(){const{root:s,worktrees:t,warnings:a,isLoading:n,isError:l}=P(),x=f.useMemo(()=>{const r=new Map;for(const o of t){const h=r.get(o.project)??[];h.push(o),r.set(o.project,h)}return[...r.entries()]},[t]);return e.jsxs(k,{width:"wide",children:[e.jsx(N,{children:"Workspaces"}),e.jsx("p",{className:"text-muted-foreground mb-6 text-sm",children:"Copies of your code, per agent."}),a.length>0&&e.jsxs("div",{className:"mb-6 rounded-lg border border-amber-600/40 bg-amber-500/10 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Some folders couldn’t be read"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"This list may be missing what’s inside them."}),e.jsx("ul",{className:"text-muted-foreground mt-2 space-y-0.5 text-xs",children:a.map(r=>e.jsxs("li",{className:"truncate",title:r.path,children:[i(r.path)," (",r.reason,")"]},r.path))})]}),n?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Looking for your worktrees…"}):l?e.jsxs("div",{className:"bg-card rounded-xl border p-10 text-center",children:[e.jsx(b,{className:"text-muted-foreground/60 mx-auto size-8"}),e.jsx("p",{className:"mt-3 font-medium",children:"Couldn’t check your worktrees"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"The scan didn’t finish. DorkOS tries again on its own."})]}):x.length===0?e.jsxs("div",{className:"bg-card rounded-xl border p-10 text-center",children:[e.jsx(y,{className:"text-muted-foreground/60 mx-auto size-8"}),e.jsx("p",{className:"mt-3 font-medium",children:"No worktrees yet"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"A worktree is a copy of your project, so agents’ edits never collide."}),s&&e.jsxs("p",{className:"text-muted-foreground mt-3 truncate text-xs",title:s,"data-slot":"workspaces-root-path",children:["Looking in ",e.jsx(w,{children:i(s)})]})]}):e.jsx("div",{className:"flex flex-col gap-8",children:x.map(([r,o])=>e.jsx(G,{project:r,worktrees:o},r))})]})}const M=H;export{M as component};
@@ -0,0 +1,10 @@
1
+ import{a4 as yt,r as m,j as t,hT as vt,ae as se,af as he,hU as ge,hV as V,hW as Q,hX as Ct,bY as be,l as je,aj as jt,ag as Ae,hY as Rt,hZ as wt,h_ as Nt,h$ as ve,i0 as we,B as S,i1 as St,dz as kt,e5 as pe,d_ as bt,d$ as At,e0 as Dt,e1 as Et,e2 as Tt,I as Je,gb as Be,i2 as Mt,gc as Ge,gd as We,ge as Ve,gf as Xe,gg as Ze,gh as et,gi as Ot,cY as De,cZ as Ee,c_ as Te,c$ as Me,d0 as Oe,dd as Ue,d1 as $e,cT as tt,i3 as Ut,i4 as $t,g$ as It,i5 as Kt,i6 as Ie,i7 as st,i8 as _t,i9 as Lt,ia as nt,ib as zt,ic as Pt,dy as rt,id as qt,ie as Ft,ig as Yt,ih as Ht,aw as Qt,e9 as Jt,fL as Bt,cl as at,ii as Gt,ij as Wt,dM as Vt,n as qe}from"./index-C63bLSO4.js";import{T as Xt,R as Zt,a as es}from"./RoomSurface-B8ec3_at.js";import{M as me,C as Ne}from"./index-BUVKya1M.js";import{M as ts}from"./markdown-content-CoK3F0c0.js";import{o as ss,a as ns,c as rs}from"./owner-notice-cgCWG4hG.js";import"./use-jump-back-in-CkFErfWY.js";import"./use-room-follow-claim-huRfaa4e.js";import"./WidgetErrorCard-D--KcgW1.js";import"./card-CKZCX8ol.js";import"./table-BEtvgYmW.js";import"./package-DE8sQpId.js";import"./heart-SRafwnSd.js";import"./git-branch-hfu8isLA.js";import"./file-text-9a0DChCq.js";import"./file-CMPbZedq.js";import"./find-latest-widget-fence--3kWMT1F.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-Cqn_Grel.js";import"./mention-pill-Bgs_yujj.js";import"./rotate-ccw-clock-CGcSqHnk.js";import"./message-square-off-CF2Bzen3.js";import"./use-connector-management-Cohvs7jD.js";import"./AgentRequestCard-CcMh6JyE.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-IgDeVFea.js";import"./index-BDfoFNcA.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 it={name:"circle-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]};it.node;const as=yt(it),is=5e3;function os({connection:e}){var p;const s=e.official===!0&&e.status==="connected"&&((p=e.access)==null?void 0:p.state)==="unverified",n=m.useMemo(()=>s?{}:null,[s]),[r,l]=m.useState(null);return m.useEffect(()=>{if(!n)return;const c=setTimeout(()=>l(n),is);return()=>clearTimeout(c)},[n]),n===null||r!==n?null:t.jsx(vt,{tone:"info",role:"status",className:"m-3","data-testid":"official-space-unreachable",children:"The DorkOS community isn’t reachable right now. Try again in a few minutes."})}const ls=500,ie=new Map;function ot(e,s){return e.id!==s.id||e.community!==s.community||e.roomId!==s.roomId||e.text===s.text&&e.authorDisplayName===s.authorDisplayName&&JSON.stringify(e.mentions)===JSON.stringify(s.mentions)&&JSON.stringify(e.attachments)===JSON.stringify(s.attachments)?e:{...e,text:s.text,mentions:s.mentions,attachments:s.attachments,authorDisplayName:s.authorDisplayName}}function ke(e,s){if(s.size===0)return e;let n=!1;const r=e.map(l=>{const p=s.get(l.id),c=p?ot(l,p):l;return c!==l&&(n=!0),c});return n?r:e}function Ce(e,s,...n){const r=new Map;for(const l of n)for(const p of l){if(p.community!==e||p.roomId!==s)throw new Error("Community history contains a different room.");r.set(p.id,p)}return[...r.values()].sort((l,p)=>l.remoteSeq-p.remoteSeq)}function cs(e,s,n=!0,r=0,l="legacy",p=!1,c){const i=se(),a=m.useRef(c);m.useEffect(()=>{a.current=c},[c]);const u=he(),d=ge(!0,l,e),g=JSON.stringify([d==null?void 0:d.ownerKey,d==null?void 0:d.epoch,d==null?void 0:d.route.epoch,d==null?void 0:d.accessFingerprint,e,s]),[A,k]=m.useState(()=>({address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"}));return m.useEffect(()=>{if(!d||!n)return;const y=d,w=new AbortController;let O,z=0,U,F,P=!1;k({address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"});function E(){P=!0,U=void 0,F=void 0,u.removeQueries({queryKey:Q.remote(y,e)}),k({address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"removed"})}async function _(){try{await i.subscribeRemoteCommunityRoom(e,s,x=>{var T;if(!(w.signal.aborted||P||!V(y))){if(x.type==="closed"){(x.reason==="removed"||x.reason==="revoked")&&E();return}if(z=0,x.type==="snapshot")U=x.cursor??void 0,x.redactionCursor&&(F=x.redactionCursor),u.setQueryData(Q.room(y,e,s),x.room),k(h=>({address:g,room:x.room,entries:ke(Ce(e,s,h.address===g?h.entries:[],x.entries).slice(-500),h.address===g?h.revisions:ie),revisions:h.address===g?h.revisions:ie,deliveries:h.deliveries.filter(C=>!x.entries.some(j=>j.originIdempotencyKey===C.idempotencyKey)),status:x.stale?"offline":"live"}));else if(x.type==="revision"){const h=x.entry;x.redactionCursor&&(F=x.redactionCursor);const C=[...Q.room(y,e,s),"entries"],I=u.getQueriesData({queryKey:C}).some(([,D])=>D==null?void 0:D.pages.some(K=>K.entries.some(J=>J.id===h.id)))||u.isFetching({queryKey:C})>0||((T=a.current)==null?void 0:T.call(a,h.id))===!0;u.setQueriesData({queryKey:C},D=>{if(!D)return D;let K=!1;const J=D.pages.map(Z=>{const ee=Z.entries.map(ne=>ot(ne,h));return ee.some((ne,oe)=>ne!==Z.entries[oe])?(K=!0,{...Z,entries:ee}):Z});return K?{...D,pages:J}:D}),k(D=>{if(!I&&!D.entries.some(J=>J.id===h.id))return D;const K=new Map(D.revisions);for(K.delete(h.id),K.set(h.id,h);K.size>ls;)K.delete(K.keys().next().value);return{...D,entries:ke(D.entries,K),revisions:K}})}else x.type==="deliveries"?k(h=>({...h,deliveries:x.deliveries.filter(C=>!h.entries.some(j=>j.originIdempotencyKey===C.idempotencyKey))})):(U=x.entry.cursor,k(h=>({...h,entries:Ce(e,s,h.entries,[x.entry]).slice(-500),deliveries:h.deliveries.filter(C=>C.idempotencyKey!==x.entry.originIdempotencyKey),status:"live"})))}},{since:U,redactions:F,signal:w.signal})}catch(x){if(w.signal.aborted||!V(y))return;const T=x&&typeof x=="object"&&"status"in x?x.status:void 0,h=x&&typeof x=="object"&&"code"in x?x.code:void 0;h==="COMMUNITY_DELETED"||h==="COMMUNITY_TAKEN_DOWN"?(E(),u.invalidateQueries({queryKey:Q.connections(y)})):T===401||T===403||T===404?E():T===410&&h==="COMMUNITY_CURSOR_STALE"&&(U=void 0)}if(w.signal.aborted||P||!V(y))return;const $=u.getQueryData(Q.room(y,e,s));$&&u.setQueryData(Q.room(y,e,s),{...$,stale:!0,writable:!1}),k(x=>({...x,room:x.room?{...x.room,stale:!0,writable:!1}:null,status:"offline"})),O=setTimeout(()=>{_()},Math.min(3e4,1e3*2**Math.min(z++,5)))}return _(),()=>{w.abort(),clearTimeout(O)}},[g,e,s,n,r,u,i,d,p]),A.address!==g||!d?{address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"}:n?A:p?{...A,room:A.room?{...A.room,stale:!0,writable:!1}:null,deliveries:[],status:"offline"}:{address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"removed"}}function us(e,s,n){var i;const r=Ct(),l=be(),p=e!==void 0&&((i=r.room)==null?void 0:i.id)===e,c=r.status!=="loading";return m.useEffect(()=>{p&&l({...je.home(),search:{...s===void 0?{}:{thread:s},...n===void 0?{}:{entry:n}},replace:!0})},[p,s,n,l]),e===void 0?"show":p?"redirecting":c?"show":"pending"}const ds=new Set(["COMMUNITY_MUTED","COMMUNITY_SLOW_MODE","COMMUNITY_RULES_NOT_ACCEPTED"]);function ms(e){const s=e==null?void 0:e.code;return typeof s=="string"&&ds.has(s)}function fs(e,s=new Date){return e.kind==="muted"?`You’re muted here until ${Rt(e.until,s)??"later"}.`:e.kind==="rules"?"Accept this space’s rules to post.":`Slow mode. Post again in ${e.secondsLeft}s.`}function ps(e,s){if(!e)return null;if(e.mutedUntil&&Date.parse(e.mutedUntil)>s)return{kind:"muted",until:e.mutedUntil};const{rules:n}=e;return n.text!==null&&n.version>0&&n.acceptedVersion<n.version?{kind:"rules"}:null}function hs({community:e,roomId:s,enabled:n,accessFingerprint:r}){var P;const l=se(),p=he(),c=ge(n,r,e),i=c?[...Q.room(c,e,s),"standing"]:[...Q.all,"owner","unresolved",e,"room",s,"standing"],a=jt({queryKey:i,queryFn:()=>wt(c,()=>l.getRemoteCommunityStanding(e,s)),enabled:n&&c!==null,staleTime:3e4,retry:!1,refetchInterval:E=>{var _;return(_=E.state.data)!=null&&_.mutedUntil&&Date.parse(E.state.data.mutedUntil)>Date.now()?6e4:!1}}),[u,d]=m.useState(null),[g,A]=m.useState(()=>Date.now()),k=(P=a.data)!=null&&P.mutedUntil?Date.parse(a.data.mutedUntil):null;m.useEffect(()=>{if(u!==null&&u>g){const E=setTimeout(()=>A(Date.now()),1e3);return()=>clearTimeout(E)}if(k!==null&&k>g){const E=setTimeout(()=>A(Date.now()),Math.min(k-g+50,1073741824));return()=>clearTimeout(E)}},[k,g,u]);const y=a.refetch,w=m.useCallback(E=>{if((E==null?void 0:E.code)==="COMMUNITY_SLOW_MODE"){const $=E.retryAfterMs;typeof $=="number"&&$>0&&(A(Date.now()),d(Date.now()+$));return}y()},[y]),O=Ae({meta:{suppressErrorToast:!0},mutationFn:E=>l.acceptRemoteCommunityRules(e,E),onSuccess:E=>{p.setQueryData(i,_=>_&&{..._,rules:E})},onError:()=>void y()}),z=ps(a.data,g),U=u===null?0:Math.ceil((u-g)/1e3),F=z??(U>0?{kind:"slow",secondsLeft:U}:null);return{standing:a.data,hold:F,noteHold:w,accept:O}}const gs=new Set(["COMMUNITY_DELETED","COMMUNITY_TAKEN_DOWN"]),xs=30*6e4,fe=new Map;function lt(e,s,n){return JSON.stringify([e,s,n])}function ct(e){return Date.now()-e<xs}function ys(e){for(const[s,n]of fe)ct(n.at)||fe.delete(s);return fe.get(e)}function vs(){return Date.now()}function Cs(e,s,n){fe.set(e,{attachmentId:s,at:n})}function Fe(e){for(const s of e.files)fe.delete(lt(e.ref,e.roomId,s.id))}function Ye(e){return e.filter(s=>s.trim()).join(`
7
+
8
+ `)}function js(e){const s=e==null?void 0:e.code;return typeof s=="string"&&gs.has(s)}function Se(e){return e.map(({id:s,file:n})=>({id:s,file:n,status:"pending",progress:0}))}function Rs({ref:e,roomId:s,canSend:n,entries:r,onReceipt:l,draft:p,ownerKey:c,contextKey:i=c,onHold:a}){const u=se(),d=JSON.stringify([c,e,s,i]),g=Nt(p),A=g.text,k=m.useMemo(()=>Se(g.files),[g.files]),y=m.useRef(p);m.useLayoutEffect(()=>{y.current=p},[p]);function w(o){const v=y.current;if(!v)return;const N=ve.getState(),M=N.drafts[we(v)],R=o({text:(M==null?void 0:M.text)??"",files:Se((M==null?void 0:M.files)??[])});N.write(v,{text:R.text,files:R.files.map(({id:B,file:q})=>({id:B,file:q}))})}function O(o){w(v=>({...v,text:o}))}function z(o){w(v=>({...v,files:o(v.files)}))}const[U,F]=m.useState(null);function P(o){F(o===null?null:{address:d,context:i,message:o})}const[E,_]=m.useState([]),$=m.useRef(new Map),x=m.useRef(0),T=m.useRef(new Map),h=m.useRef(new Set),C=m.useRef(d),j=m.useRef(i),I=m.useRef(!0),D=m.useRef(n),K=m.useRef(l),J=m.useRef(a);m.useLayoutEffect(()=>{C.current=d,j.current=i,D.current=n,K.current=l,J.current=a},[d,n,i,l,a]),m.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]),m.useEffect(()=>{let o=!1;for(const v of r){if(!v.originIdempotencyKey)continue;const N=$.current.get(v.originIdempotencyKey);(N==null?void 0:N.address)===C.current&&N.context===j.current&&$.current.delete(v.originIdempotencyKey)&&(Fe(N),o=!0)}o&&_([...$.current.values()])},[r]);function Z(){I.current&&_([...$.current.values()].filter(o=>o.address===C.current&&o.context===j.current).map(o=>({...o})))}async function ee(o){var v,N;if(!(h.current.has(o.key)||!D.current||!I.current||o.address!==C.current)){h.current.add(o.key),o.status="sending",o.error=void 0,Z();try{!o.posted&&o.uploadedAt.some(R=>!ct(R))&&(o.attachmentIds=[],o.uploadedAt=[],o.triedAt=[],o.uploadRound+=1);for(let R=o.attachmentIds.length;R<o.files.length;R++){if(!D.current||!I.current||o.address!==C.current)throw new Error("Reconnect to this channel, then try again.");const B=o.files[R],q=lt(o.ref,o.roomId,B.id),G=ys(q);if(G){o.attachmentIds.push(G.attachmentId),o.uploadedAt.push(G.at);continue}const W=(v=o.triedAt)[R]??(v[R]=vs()),X=await u.uploadRemoteCommunityAttachment(o.ref,o.roomId,B.file,o.uploadRound?`${o.key}:file:${R}:${o.uploadRound}`:`${o.key}:file:${R}`);Cs(q,X.id,W),o.uploadedAt.push(W),o.attachmentIds.push(X.id)}if(!D.current||!I.current||o.address!==C.current)throw new Error("Reconnect to this channel, then try again.");o.posted=!0;const M=await u.postRemoteCommunityEntry(o.ref,o.roomId,{text:o.text,parentEntryId:o.parentEntryId,attachmentIds:o.attachmentIds,idempotencyKey:o.key});$.current.delete(o.key),Fe(o),I.current&&o.address===C.current&&o.context===j.current&&K.current(M)}catch(M){if(js(M)&&ne(o)){$.current.delete(o.key);return}if(ms(M)&&ne(o)){$.current.delete(o.key),I.current&&o.address===C.current&&((N=J.current)==null||N.call(J,M));return}o.status="failed",o.error=M instanceof Error?M.message:"Not confirmed. Try this message again."}finally{h.current.delete(o.key),Z()}}}function ne(o){const{draft:v}=o.origin,N=we(v),M=ve.getState(),R=M.drafts[N],B=(R==null?void 0:R.text)??"";let q=T.current.get(N)??[];const G=Ye(q.map(H=>H.origin.typed));let W=B;G&&B.startsWith(G)?W=B.slice(G.length).replace(/^\n+/,""):q=[];const X=[...q,o].sort((H,te)=>H.origin.seq-te.origin.seq),ae=new Set(X.flatMap(H=>H.files.map(te=>te.id))),xe=[...X.flatMap(H=>H.files.map(({id:te,file:de})=>({id:te,file:de}))),...((R==null?void 0:R.files)??[]).filter(H=>!ae.has(H.id))];return M.write(v,{text:Ye([...X.map(H=>H.origin.typed),W]),files:xe}),N in ve.getState().drafts?(T.current.set(N,X),!0):!1}function oe(o){const v=y.current;if(!v||!D.current)return;const N=ve.getState(),M=N.drafts[we(v)];if(!M||!M.text.trim()&&M.files.length===0)return;if($.current.size>=30){P("Too many messages waiting. Let them send, or retry them first.");return}const R=N.take(v),B=Se(R.files),q={address:d,context:i,ref:e,roomId:s,key:crypto.randomUUID(),text:R.text.trim()?R.text:B.map(G=>G.file.name).join(", "),parentEntryId:o,files:B,attachmentIds:[],uploadedAt:[],triedAt:[],posted:!1,uploadRound:0,status:"sending",origin:{draft:v,typed:R.text,seq:x.current+=1}};$.current.set(q.key,q),P(null),ee(q)}return{text:A,setText:O,attachments:{staged:k,add(o){if(o.some(v=>v.size>25*1024*1024)){P("Each file must be 25 MB or smaller.");return}z(v=>v.length+o.length>8?(P("Attach up to eight files to one message."),v):[...v,...o.map(N=>({id:crypto.randomUUID(),file:N,status:"pending",progress:0}))])},remove(o){z(v=>v.filter(N=>N.id!==o))},retry(){},cancel(){z(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:E.filter(o=>o.address===d&&o.context===i),error:(U==null?void 0:U.address)===d&&U.context===i?U.message:null,send:oe,retry(o){const v=$.current.get(o);v&&ee(v)}}}function ws({entry:e,onThread:s,onReport:n}){const r=se(),l=m.useId(),[p,c]=m.useState(null),[i,a]=m.useState(null),u={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function d(g,A){if(i)return;a(g),c(null);let k;try{const y=await r.downloadRemoteCommunityAttachment(e.community,e.roomId,g);k=URL.createObjectURL(y);const w=document.createElement("a");w.href=k,w.download=Array.from(A,O=>O==="/"||O==="\\"||O.charCodeAt(0)<32?"_":O).join(""),document.body.append(w),w.click(),w.remove()}catch(y){c(y instanceof Error?y.message:"Couldn’t download the file. Try again.")}finally{k&&setTimeout(()=>URL.revokeObjectURL(k),1e3),a(null)}}return t.jsxs(me.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":l,children:[t.jsx(me.Gutter,{author:u,at:e.createdAt}),t.jsxs(me.Body,{children:[t.jsx(me.Author,{id:l,author:u,at:e.createdAt}),t.jsxs(me.Content,{children:[t.jsx(ts,{content:e.text}),e.attachments.map(g=>t.jsx(S,{variant:"outline",size:"sm",disabled:i!==null,onClick:()=>void d(g.id,g.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:i===g.id?"Downloading…":g.name})},g.id)),p&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:p}),t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"}),n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:n,children:"Report"})]})]})]})}function Ns({community:e,roomId:s,online:n,canEnroll:r,accessFingerprint:l}){var T,h,C;const p=se(),c=he(),i=ge(!0,l,e),a=St(e,r,l),u=kt(),[d,g]=m.useState(""),[A,k]=m.useState(""),[y,w]=m.useState(!1),[O,z]=m.useState(null),[U,F]=m.useState(null),P=m.useId(),E=((T=a.data)==null?void 0:T.filter(j=>j.active))??[],_=((h=u.data)==null?void 0:h.agents.filter(j=>!E.some(I=>I.localAgentId===j.id)))??[];async function $(){i&&V(i)&&await c.invalidateQueries({queryKey:Q.remote(i,e)})}async function x(j){if(j.preventDefault(),!d||y||!n||!r||!i)return;const I=i;w(!0),z(null);try{if(await p.enrollRemoteCommunityAgent(e,d,A.trim()?{handle:A.trim()}:{}),!V(I))return;g(""),k(""),await $()}catch(D){V(I)&&z(D instanceof Error?D.message:"Couldn’t add the agent. Try again.")}finally{V(I)&&w(!1)}}return t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-label":"Your agents in this space",children:[t.jsx("h3",{className:"text-sm font-medium",children:"My agents"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Add an agent from here, then choose whether it joins this channel."}),a.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Retry"})]}),(C=a.data)==null?void 0:C.map(j=>t.jsx(Ss,{agent:j,roomId:s,online:n,canEnroll:r,onChanged:$,onNotice:F},j.localAgentId)),u.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),r&&_.length>0&&t.jsxs("form",{onSubmit:j=>void x(j),className:"flex flex-wrap items-end gap-2",children:[t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(pe,{htmlFor:`${P}-agent`,children:"Local agent"}),t.jsxs(bt,{value:d,onValueChange:g,disabled:!n||y,children:[t.jsx(At,{id:`${P}-agent`,children:t.jsx(Dt,{placeholder:"Choose an agent"})}),t.jsx(Et,{children:_.map(j=>t.jsx(Tt,{value:j.id,children:j.name},j.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(pe,{htmlFor:`${P}-handle`,children:"Space handle (optional)"}),t.jsx(Je,{id:`${P}-handle`,value:A,onChange:j=>k(j.target.value),disabled:!n||y,placeholder:"Use the agent’s handle"})]}),t.jsx(S,{type:"submit",disabled:!d||!n||y,children:y?"Adding…":"Add to space"})]}),U&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:U}),O&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:O})]})}function Ss({agent:e,roomId:s,online:n,canEnroll:r,onChanged:l,onNotice:p}){const c=se(),[i,a]=m.useState(null),[u,d]=m.useState(null),g=e.roomIds.includes(s);async function A(y,w){if(!i){a(y),d(null);try{await w(),await l()}catch(O){d(O instanceof Error?O.message:"Couldn’t finish that. Try again.")}finally{a(null)}}}function k(y){p(y.remoteRevoked?"Stopped taking part.":"Stopped here, but the space wasn’t told. Try again when it’s reachable.")}return t.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[t.jsxs("p",{className:"text-sm font-medium",children:[e.displayName,!e.active&&" · stopped here"," ",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["· owned by ",e.ownerDisplayName]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx(S,{variant:"outline",size:"sm",disabled:i!==null||!r||!e.active||!g&&!n,onClick:()=>void A("membership",async()=>{g?k(await c.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await c.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:g?"Leave channel":"Join channel"}),t.jsx(S,{variant:"ghost",size:"sm",disabled:i!==null||!r,onClick:()=>void A("stop",()=>c.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(Be,{children:[t.jsx(Mt,{asChild:!0,children:t.jsx(S,{variant:"ghost",size:"sm",disabled:i!==null||!r,children:"Remove from space"})}),t.jsxs(Ge,{children:[t.jsxs(We,{children:[t.jsxs(Ve,{children:["Remove ",e.displayName,"?"]}),t.jsx(Xe,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(Ze,{children:[t.jsx(et,{children:"Cancel"}),t.jsx(Ot,{onClick:()=>void A("remove",async()=>k(await c.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),u&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:u})]})}function ks({roster:e,failed:s,canMention:n,onMention:r,community:l,roomId:p,online:c,canEnroll:i,agentsKey:a,accessFingerprint:u}){return t.jsxs("div",{className:"max-h-48 overflow-auto border-b p-3","aria-label":"Channel members",children:[s&&t.jsx("p",{role:"alert",children:"Couldn’t load members."}),(e==null?void 0:e.stale)&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved member list"}),e==null?void 0:e.members.map(d=>{var g;return t.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[t.jsxs("span",{children:[d.displayName,d.kind==="agent"?" · Agent":"",d.ownerMemberId&&` · owned by ${((g=e.members.find(A=>A.memberId===d.ownerMemberId))==null?void 0:g.displayName)??"a space member"}`]}),d.handle&&t.jsxs(S,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>r(d.handle),children:["Mention @",d.handle]})]},d.memberId)}),i&&t.jsx(Ns,{community:l,roomId:p,online:c,canEnroll:!0,accessFingerprint:u},a)]})}function ut(e,s){return e instanceof Error&&e.message?e.message:s}function bs({conduct:e,staff:s,onReadRules:n}){const{hold:r,standing:l}=e;return(r==null?void 0:r.kind)==="rules"?t.jsx("div",{className:"px-1 pb-1",children:t.jsx(S,{size:"sm",variant:"outline",onClick:n,children:"Read the rules"})}):r||s||!(l!=null&&l.slowModeSeconds)?null:t.jsxs("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:["Slow mode: one message every ",l.slowModeSeconds,"s."]})}function As({conduct:e,open:s,onOpenChange:n}){var p;const r=(p=e.standing)==null?void 0:p.rules,l=r?r.acceptedVersion>=r.version:!1;return t.jsx(De,{open:s,onOpenChange:n,children:t.jsxs(Ee,{className:"sm:max-w-lg",children:[t.jsxs(Te,{children:[t.jsx(Me,{children:"Space rules"}),t.jsx(Oe,{children:l?"You accepted these rules.":"Accept these rules to post here."})]}),t.jsxs(Ue,{children:[t.jsx("div",{className:"max-h-[50vh] overflow-y-auto rounded-md border p-3 text-sm leading-relaxed whitespace-pre-wrap",children:(r==null?void 0:r.text)??"This space has no rules."}),e.accept.error&&t.jsx("p",{role:"alert",className:"text-destructive mt-2 text-sm",children:ut(e.accept.error,"Couldn’t accept the rules. Try again.")})]}),t.jsxs($e,{children:[t.jsx(S,{variant:"outline",onClick:()=>n(!1),children:"Close"}),(r==null?void 0:r.text)&&!l&&t.jsx(S,{disabled:e.accept.isPending,onClick:()=>e.accept.mutate(r.version,{onSuccess:()=>n(!1)}),children:e.accept.isPending?"Accepting…":"Accept rules"})]})]})})}function Ds({community:e,accessFingerprint:s,currentName:n,open:r,onOpenChange:l}){return t.jsx(De,{open:r,onOpenChange:l,children:t.jsx(Ee,{className:"sm:max-w-md",children:r&&t.jsx(Es,{community:e,accessFingerprint:s,currentName:n,onDone:()=>l(!1)})})})}function Es({community:e,accessFingerprint:s,currentName:n,onDone:r}){const l=se(),p=he(),c=ge(!0,s,e),[i,a]=m.useState(n),u=Ae({meta:{suppressErrorToast:!0},mutationFn:g=>l.setRemoteCommunityDisplayName(e,g),onSuccess:async()=>{c&&await p.invalidateQueries({queryKey:Q.content(c,e)}),r()}}),d=i.trim();return t.jsxs("form",{onSubmit:g=>{g.preventDefault(),d&&d!==n&&u.mutate(d)},children:[t.jsxs(Te,{children:[t.jsx(Me,{children:"Your name in this space"}),t.jsx(Oe,{children:"Other spaces keep the name they show."})]}),t.jsxs(Ue,{className:"space-y-2",children:[t.jsx(pe,{htmlFor:"remote-community-display-name",children:"Name"}),t.jsx(Je,{id:"remote-community-display-name",value:i,maxLength:128,autoComplete:"nickname",onChange:g=>a(g.target.value)}),u.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:ut(u.error,"Couldn’t change your name. Try again.")})]}),t.jsxs($e,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!d||d===n||u.isPending,children:u.isPending?"Saving…":"Save name"})]})]})}const Ts=[{value:"spam",label:"Spam"},{value:"harassment",label:"Harassment"},{value:"off_topic",label:"Off topic"},{value:"illegal",label:"Against the law"},{value:"other",label:"Something else"}];function Ms({entry:e,onClose:s}){return t.jsx(De,{open:e!==null,onOpenChange:n=>!n&&s(),children:t.jsx(Ee,{className:"sm:max-w-md",children:e&&t.jsx(Os,{entry:e,onClose:s},e.id)})})}function Os({entry:e,onClose:s}){const n=se(),r=m.useId(),[l,p]=m.useState(null),[c,i]=m.useState(""),a=Ae({meta:{suppressErrorToast:!0},mutationFn:u=>n.reportRemoteCommunityEntry(e.community,e.roomId,e.id,u),onSuccess:()=>{tt("Message reported"),s()}});return t.jsxs("form",{onSubmit:u=>{u.preventDefault(),l&&a.mutate({reason:l,...c.trim()?{note:c.trim()}:{}})},children:[t.jsxs(Te,{children:[t.jsx(Me,{children:"Report message"}),t.jsx(Oe,{children:"This space’s owners and admins review reports."})]}),t.jsxs(Ue,{className:"space-y-4",children:[t.jsxs("p",{className:"text-muted-foreground line-clamp-3 text-sm",children:[e.authorDisplayName,": ",e.text]}),t.jsx(Ut,{"aria-label":"Reason",value:l??"",onValueChange:u=>p(u),children:Ts.map(u=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx($t,{value:u.value,id:`${r}-${u.value}`}),t.jsx(pe,{htmlFor:`${r}-${u.value}`,children:u.label})]},u.value))}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(pe,{htmlFor:`${r}-note`,children:"Note (optional)"}),t.jsx(It,{id:`${r}-note`,value:c,maxLength:Kt,onChange:u=>i(u.target.value),rows:3}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Only owners and admins see this."})]}),a.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:a.error instanceof Error&&a.error.message?a.error.message:"Couldn’t send the report. Try again."})]}),t.jsxs($e,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!l||a.isPending,children:a.isPending?"Sending…":"Send report"})]})]})}function Us({agentDeliveries:e,drafts:s,entries:n,threadId:r,canSend:l,action:p,onRetryAgent:c,onRetryDraft:i}){return t.jsxs(t.Fragment,{children:[e.filter(a=>a.parentEntryId===(r??null)&&!n.some(u=>u.originIdempotencyKey===a.idempotencyKey)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[a.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.attachments.map((u,d)=>t.jsx("span",{className:"mr-2",children:u.name},d)),t.jsx("p",{className:"text-muted-foreground",children:a.state==="pending"?"Waiting for the space to confirm…":a.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),a.state==="pending"&&a.retryable&&t.jsx(S,{variant:"outline",size:"sm",disabled:!l||p!==null,onClick:()=>c(a.idempotencyKey),children:p===`retry:${a.idempotencyKey}`?"Retrying…":"Retry now"})]},a.idempotencyKey)),s.filter(a=>a.parentEntryId===r&&!n.some(u=>u.originIdempotencyKey===a.key)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.files.map(u=>t.jsx("span",{className:"mr-2",children:u.file.name},u.id)),t.jsx("p",{className:"text-muted-foreground",children:a.status==="sending"?"Sending…":"Delivery not confirmed."}),a.error&&t.jsx("p",{children:a.error}),a.status==="failed"&&t.jsx(S,{variant:"outline",size:"sm",disabled:!l,onClick:()=>i(a.key),children:"Retry message"})]},a.key))]})}function $s(e,s){var p;const n=new Map;for(const c of e)c.thread&&n.set(c.id,{count:c.thread.replyCount,lastAt:c.thread.lastReplyAt,through:c.threadLastReplySeq});const r=new Map;for(const c of s){const i=c.threadRootEntryId;if(c.depth===0||i===null)continue;const a=(p=n.get(i))==null?void 0:p.through;if(a!==void 0&&c.remoteSeq<=a)continue;const u=r.get(i);r.set(i,{count:((u==null?void 0:u.count)??0)+1,newest:u&&u.newest.remoteSeq>c.remoteSeq?u.newest:c})}const l=new Map;for(const c of new Set([...n.keys(),...r.keys()])){const i=n.get(c),a=r.get(c),u=i===void 0?a.count:i.through===void 0?Math.max(i.count,(a==null?void 0:a.count)??0):i.count+((a==null?void 0:a.count)??0);l.set(c,{count:u,lastAt:(a==null?void 0:a.newest.createdAt)??i.lastAt,unread:0})}return l}const Is={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function Ks({community:e,roomId:s,threadId:n,onThread:r}){var _e,Le,ze,Pe;const l=se(),c=(_e=Ie().data)==null?void 0:_e.find(f=>f.ref===e),i=st(c==null?void 0:c.access),a=ge(!0,i.fingerprint,e),u=a?JSON.stringify([a.ownerKey,a.epoch]):"",d=a?JSON.stringify([a.ownerKey,a.epoch,a.route.epoch,a.accessFingerprint]):"",g=he(),A=_t(),k=Lt(),y=(Le=A.data)==null?void 0:Le.destinations.find(f=>f.ref===e&&f.roomId===s),w=m.useRef(null),O=m.useRef(void 0),z=(y==null?void 0:y.scrollAnchorEntryId)??null,U=m.useCallback(f=>{if(!a||n)return;w.current&&clearTimeout(w.current),w.current=null;const b=f??null,L=O.current===void 0?z:O.current;b===null&&L===null||(w.current=setTimeout(()=>{w.current=null,O.current=b,k.mutate({ref:e,roomId:s,threadId:n??null,scrollAnchorEntryId:b})},400))},[a,e,k,z,s,n]);m.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]),m.useEffect(()=>{(c==null?void 0:c.status)==="reconnect-required"&&a&&g.removeQueries({queryKey:Q.remote(a,e)})},[a,e,c==null?void 0:c.status,g]);const F=nt(e,s,i.capabilities.read,i.fingerprint),[P,E]=m.useState(0),_=m.useRef([]),$=m.useCallback(f=>_.current.some(b=>b.id===f),[]),x=cs(e,s,i.capabilities.stream,P,i.fingerprint,i.cacheReadable,$),T=x.status==="removed",h=T?null:x.room??F.data,C=zt(e,s,n,!T&&i.capabilities.read&&(h==null?void 0:h.readable)===!0,i.fingerprint),j=Pt(e,s,!T&&i.capabilities.read&&(h==null?void 0:h.readable)===!0,i.fingerprint),[I,D]=m.useState(()=>({address:d,entries:[]})),K=m.useMemo(()=>I.address===d?I.entries:[],[d,I]);m.useEffect(()=>{_.current=K},[K]);const[J,Z]=m.useState(0),[ee,ne]=m.useState(!1),[oe,le]=m.useState(null),[o,v]=m.useState(null),N=hs({community:e,roomId:s,enabled:!T&&i.capabilities.read&&(h==null?void 0:h.readable)===!0,accessFingerprint:i.fingerprint}),M=(c==null?void 0:c.connectedHumanMemberId)??null,R=(ze=j.data)==null?void 0:ze.members.find(f=>f.memberId===M),B=f=>{var b;return f===M||((b=j.data)==null?void 0:b.members.some(L=>L.memberId===f&&L.ownerMemberId===M))===!0},[q,G]=m.useState({address:"",name:null,error:null}),W=q.address===d?q.name:null,X=q.address===d?q.error:null,ae=m.useRef(null),xe=m.useRef(null),H=m.useRef(null),te=!T&&i.capabilities.post&&x.status==="live"&&(h==null?void 0:h.writable)===!0,de=te&&N.hold===null,ce=m.useMemo(()=>{var f;return T?[]:ke(Ce(e,s,...((f=C.data)==null?void 0:f.pages.map(b=>b.entries))??[],x.entries,K),x.revisions)},[e,s,C.data,x.entries,x.revisions,K,T]),mt=m.useCallback(f=>{D(b=>({address:d,entries:Ce(e,s,b.address===d?b.entries:[],[f]).slice(-500)})),Z(b=>b+1)},[d,e,s]);m.useLayoutEffect(()=>{var f;J>0&&((f=H.current)==null||f.scrollToBottom())},[J]);const ft=m.useMemo(()=>{var f;return a?{ownerKey:a.ownerKey,epoch:a.epoch,ref:e,generation:((f=a.connection)==null?void 0:f.generation)??0,roomId:s,threadId:n}:null},[a,e,s,n]),Y=Rs({ref:e,roomId:s,canSend:de,entries:ce,onReceipt:mt,draft:ft,ownerKey:u||"unresolved",contextKey:d||"unresolved",onHold:N.noteHold}),pt=ce.filter(f=>n?f.id===n||f.threadRootEntryId===n:f.depth===0),ht=m.useMemo(()=>{var f;return n?new Map:$s(((f=C.data)==null?void 0:f.pages.flatMap(b=>b.entries))??[],ce)},[n,C.data,ce]),Ke=pt.flatMap(f=>{const b=ht.get(f.id);return b?[{kind:"message",entry:f},{kind:"replies",rootId:f.id,summary:b}]:[{kind:"message",entry:f}]}),gt=Ke.map(f=>f.kind==="replies"?{kind:"thread-reply",id:`${f.rootId}:replies`,rootId:f.rootId,replyCount:f.summary.count,lastAt:f.summary.lastAt}:{kind:"message",id:f.entry.id,payload:f.entry,grouping:{position:"only"},author:{id:JSON.stringify([e,f.entry.authorId]),kind:f.entry.authorKind,displayName:f.entry.authorDisplayName},at:f.entry.createdAt}),Re={kind:"room",id:JSON.stringify([e,s,n]),placeholder:n?"Reply in thread…":`Message ${(h==null?void 0:h.title)??"this channel"}…`,canSend:de,canSendReason:T?"You no longer have access to this channel.":N.hold?fs(N.hold):!i.capabilities.post&&i.cacheReadable?"This space is read-only.":h!=null&&h.archived?"This channel is archived.":h!=null&&h.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:Y.attachments,async send(){Y.send(n)}};async function ye(f,b){if(W||!a)return;const L=a,ue=d;G({address:ue,name:f,error:null});try{if(await b(),!V(L))return;(f==="join"||f==="leave"||f.startsWith("retry:"))&&E(re=>re+1),await g.invalidateQueries({queryKey:Q.remote(L,e)})}catch(re){V(L)&&G({address:ue,name:f,error:re instanceof Error?re.message:"Couldn’t finish that. Try again."})}finally{V(L)&&G(re=>re.address===ue?{...re,name:null}:re)}}function xt(){var L;const f=ce.at(-1);if(n||C.hasNextPage||!f||x.status!=="live"||((L=ae.current)==null?void 0:L.address)===d&&ae.current.cursor===f.cursor||!a)return;const b=a;ae.current={address:d,cursor:f.cursor},l.setRemoteCommunityReadCursor(e,s,f.cursor).then(()=>{V(b)&&g.invalidateQueries({queryKey:Q.rooms(b,e)})}).catch(()=>{var ue;((ue=ae.current)==null?void 0:ue.address)===d&&(ae.current=null)})}return t.jsxs(Ne.Root,{surface:"room",capabilities:Is,target:Re,children:[t.jsxs("section",{className:"flex h-full min-h-0 flex-col","aria-label":(h==null?void 0:h.title)??"Space channel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-3 py-2",children:[n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>r(),children:"Back to channel"}),!T&&i.capabilities.post&&h&&!h.joined&&!h.stale&&t.jsx(S,{size:"sm",disabled:W!==null,onClick:()=>void ye("join",()=>l.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),i.cacheReadable&&t.jsx(S,{variant:"ghost",size:"sm",disabled:T,onClick:()=>ne(!ee),children:ee?"Hide members":"Members"}),((Pe=N.standing)==null?void 0:Pe.rules.text)&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>le("rules"),children:"Rules"}),i.capabilities.post&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>le("name"),children:"Your name"}),i.capabilities.enrollAgent&&t.jsx(S,{variant:"outline",size:"sm",disabled:W!==null,onClick:()=>void ye("stop",()=>l.haltRemoteCommunityRoom(e,s)),children:W==="stop"?"Stopping…":"Stop my agents"}),i.capabilities.post&&(h==null?void 0:h.joined)&&t.jsx(S,{variant:"ghost",size:"sm",disabled:W!==null||!te,onClick:()=>void ye("leave",async()=>{await l.leaveRemoteCommunityRoom(e,s),a&&g.removeQueries({queryKey:Q.room(a,e,s)})}),children:"Leave channel"})]}),X&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:X}),T?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[x.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:x.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),F.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),ee&&t.jsx(ks,{roster:j.data,failed:j.isError,canMention:te,onMention:f=>{var b;Y.setText(`${Y.text}${Y.text&&!Y.text.endsWith(" ")?" ":""}@${f} `),(b=xe.current)==null||b.focus()},community:e,roomId:s,online:x.status==="live",canEnroll:i.capabilities.enrollAgent,agentsKey:d,accessFingerprint:i.fingerprint}),C.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void C.refetch(),children:"Retry"})]}),C.hasNextPage&&t.jsx(S,{variant:"ghost",size:"sm",disabled:C.isFetchingNextPage,onClick:()=>void C.fetchNextPage(),children:"Load the next page of history"}),t.jsx(Ne.Timeline,{ref:H,conversationId:Re.id,rows:gt,label:n?"Space thread":"Space messages",busy:C.isFetching,resumeRow:()=>n?void 0:z??void 0,onTopRow:U,onReachedBottom:xt,onOpenThread:r,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:C.isPending?"Loading messages…":"No messages here yet."}),renderRow:(f,b)=>{const L=Ke[b.index];return L.kind==="message"?t.jsx(ws,{entry:L.entry,onThread:r,onReport:i.capabilities.post&&j.data&&!B(L.entry.authorId)?()=>v(L.entry):void 0}):t.jsx(Xt,{summary:L.summary,open:!1,onOpen:()=>r(L.rootId)})}}),t.jsx(Us,{agentDeliveries:x.deliveries,drafts:Y.deliveries,entries:ce,threadId:n,canSend:de,action:W,onRetryAgent:f=>void ye(`retry:${f}`,()=>l.retryRemoteCommunityDelivery(e,s,f)),onRetryDraft:Y.retry}),Y.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:Y.error}),t.jsx(Ne.Composer,{inputRef:xe,aboveInput:t.jsx(bs,{conduct:N,staff:["owner","admin"].includes((R==null?void 0:R.role)??""),onReadRules:()=>le("rules")}),className:"m-3",value:Y.text,onChange:Y.setText,onSubmit:()=>Y.send(n),input:{isStreaming:!1,contextKey:Re.id,canSubmit:Y.text.trim().length>0||Y.attachments.staged.length>0}})]})]}),t.jsx(As,{conduct:N,open:oe==="rules",onOpenChange:f=>le(f?"rules":null)}),t.jsx(Ds,{community:e,accessFingerprint:i.fingerprint,currentName:(R==null?void 0:R.displayName)??"",open:oe==="name",onOpenChange:f=>le(f?"name":null)}),t.jsx(Ms,{entry:o,onClose:()=>v(null)})]})}function _s({community:e,roomId:s}){var u,d;const n=Ie(),r=(u=n.data)==null?void 0:u.find(g=>g.ref===e),l=st(r==null?void 0:r.access),p=nt(e,s??"",!!s&&l.capabilities.read,l.fingerprint),c=(r==null?void 0:r.label)??"Space",i=s?(d=p.data)==null?void 0:d.title:void 0,a=r===void 0&&n.fetchStatus==="fetching"||s!==void 0&&i===void 0&&p.fetchStatus==="fetching";return t.jsx(rt,{pending:a,children:i?`${c} · ${i}`:c})}function dt(e){var s,n,r,l;return!e||e.status==="reconnect-required"?null:((n=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:n.lifecycle)==="deleted"?"deleted":((l=(r=e.access)==null?void 0:r.lastKnown)==null?void 0:l.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function He(e,s,n){return`${e} ${e===1?s:n}`}function Ls(e,s){const n=[e>0?He(e,"message from your agents","messages from your agents"):null,s>0?He(s,"draft of yours","drafts of yours"):null].filter(l=>l!==null);if(n.length===0)return null;const r=n.length===1&&(e===1||s===1);return`${n.join(" and ")} ${r?"wasn’t":"weren’t"} sent.`}function zs({connection:e,onRemoved:s}){const n=dt(e),r=qt(),[l,p]=m.useState(!1),{ownerKey:c}=Ft(),i=Yt(c,e.ref),{copied:a,failed:u,copy:d}=Ht(),g=e.label,A=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function k(){r.mutate(e,{onSuccess:()=>{p(!1),tt.success(`${g} is removed from DorkOS.`),s()}})}const y=n==="deleted"||n==="taken-down",w=n==="taken-down"?"This space was taken down":n==="deleted"?"This space was deleted":"This space seems to be gone",O=n==="taken-down"?`DorkOS removed its copy here. If ${g} returns, you can connect again.`:n==="deleted"?"DorkOS removed its copy from this computer.":`Since ${A}, ${g} says it doesn’t exist. Its channels, messages and files are still here.`,z=Ls(y?e.undeliveredAgentMessages??0:0,i.length),U=i.length===0?null:i.length===1?"Your unsent draft is cleared too.":`Your ${i.length} unsent drafts are cleared too.`;return t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-10 text-center text-sm","data-testid":"community-gone",children:[t.jsx(as,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:w}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:O}),z&&t.jsx("p",{role:"status",className:"text-foreground max-w-sm","data-testid":"community-gone-unsent",children:z}),t.jsx("span",{className:"sr-only","aria-live":"polite","data-testid":"community-gone-copy-status",children:a?"Copied.":u?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i.length>0&&t.jsx(S,{variant:"outline",onClick:()=>void d(i.join(`
9
+
10
+ `)),children:a?"Copied":u?"Couldn’t copy":i.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(S,{variant:y?"outline":"destructive",onClick:()=>p(!0),children:y?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(Be,{open:l,onOpenChange:F=>{F||r.reset(),p(F)},children:t.jsxs(Ge,{children:[t.jsxs(We,{children:[t.jsx(Ve,{children:y?`Remove ${g} from DorkOS?`:`Remove your copy of ${g}?`}),t.jsx(Xe,{asChild:!0,children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:y?`${g} leaves this app. Nothing else is stored here.`:"This deletes its channels, messages and files from this computer."}),!y&&t.jsx("p",{children:"Your agents stop answering there. If it’s still around, you can connect again."}),U&&t.jsx("p",{children:U})]})})]}),r.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t remove it. Check that DorkOS is running, then try again."}),t.jsxs(Ze,{children:[t.jsx(et,{disabled:r.isPending,children:"Cancel"}),t.jsx(S,{variant:"destructive",disabled:r.isPending,onClick:k,children:r.isPending?"Removing…":y?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function Ps({connection:e,dateFormat:s}){var p,c;const n=ss(e);if(!n)return null;const[r,...l]=ns(n,(c=(p=e.access)==null?void 0:p.lastKnown)==null?void 0:c.lifecycle,s);return t.jsxs("section",{"aria-label":"Request to take over this space",className:"border-status-warning-border bg-status-warning-bg text-status-warning-fg flex flex-wrap items-start gap-x-3 gap-y-2 border-b px-4 py-3 text-sm",children:[t.jsx(Qt,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1 basis-60 space-y-1",children:[t.jsx("p",{className:"text-foreground font-medium",children:r}),l.map(i=>t.jsx("p",{children:i},i))]}),t.jsxs(S,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>Bt(rs(e)),children:["Open space",t.jsx(Jt,{className:"size-3.5","aria-hidden":!0})]})]})}function qs(){const{id:e,community:s}=at({from:"/_shell/channels"}),n=Gt(s);return s&&!n.visible?n.isLoading?null:t.jsx(Wt,{...je.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(_s,{community:s,roomId:e}):e===void 0&&t.jsx(rt,{children:"Channels"}),t.jsx(Fs,{})]})}function Fs(){const{id:e,thread:s,entry:n,community:r}=at({from:"/_shell/channels"}),l=be(),p=us(r?void 0:e,s,n),c=Vt();return r&&e?t.jsx(Qe,{community:r,children:t.jsx(Ks,{community:r,roomId:e,threadId:s,onThread:i=>{l({...je.channels(),search:{community:r,id:e,thread:i}})}},JSON.stringify([r,e]))}):r?t.jsx(Qe,{community:r,children:t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"No channel selected"}),t.jsx("p",{className:"max-w-sm",children:"Choose a channel from this space."})]})}):p==="pending"?t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(Zt,{})}):p==="redirecting"?null:e===void 0?t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Pick a channel or DM"}),t.jsx("p",{className:"max-w-sm",children:c?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(es,{roomId:e,threadId:s,entrySeq:n,threadRoute:"/channels"})}function Qe({community:e,children:s}){var l;const n=be(),r=(l=Ie().data)==null?void 0:l.find(p=>p.ref===e);return r&&dt(r)?t.jsx(zs,{connection:r,onRemoved:()=>void n({...je.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r&&t.jsx(Ps,{connection:r}),r&&t.jsx(os,{connection:r}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const xn=qs;export{xn as component};