dorkos 0.101.0 → 0.103.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 (208) hide show
  1. package/README.md +10 -10
  2. package/dist/bin/cli.js +2935 -1738
  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-CwxCTicf.js → AboutPage-BNVLNd3q.js} +1 -1
  6. package/dist/client/assets/{ActivityRow-D0QQ0SFu.js → ActivityRow-CvjAfRBM.js} +1 -1
  7. package/dist/client/assets/AdapterIcon-wGSXBn-k.js +1 -0
  8. package/dist/client/assets/AdapterSetupWizard-CmSJ2sno.js +2 -0
  9. package/dist/client/assets/{AgentRequestCard-BLLmoAES.js → AgentRequestCard-D62XQXBM.js} +4 -4
  10. package/dist/client/assets/{AppearancePage-GqrWckTQ.js → AppearancePage-Bds0L-wm.js} +1 -1
  11. package/dist/client/assets/{AttentionSignalRow-sEhnIPBB.js → AttentionSignalRow-C6RkjCWK.js} +1 -1
  12. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BXjzhT_D.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CerNarG-.js} +24 -24
  13. package/dist/client/assets/{BlintzCanvas-CXi0fvcM.js → BlintzCanvas-CUqethk_.js} +24 -24
  14. package/dist/client/assets/{CanvasCsvContent-QhDSf8Pd.js → CanvasCsvContent-DdbIUPMJ.js} +1 -1
  15. package/dist/client/assets/CanvasFileContent-CX2VNF4o.js +2 -0
  16. package/dist/client/assets/CanvasModel3dContent-OprkQsgq.js +2 -0
  17. package/dist/client/assets/{CodeMirrorDiff-BMG7DBg2.js → CodeMirrorDiff-BnMdmI0K.js} +1 -1
  18. package/dist/client/assets/{CodeMirrorEditor-BYdz0ipX.js → CodeMirrorEditor-C7T-DaVA.js} +1 -1
  19. package/dist/client/assets/ConnectionAccessLists-B3QGnSxM.js +1 -0
  20. package/dist/client/assets/ConnectionsPage-E3br6maQ.js +11 -0
  21. package/dist/client/assets/{ConventionPage-y-Zq3Klp.js → ConventionPage-vMN5qEwP.js} +3 -3
  22. package/dist/client/assets/{ExtensionPageRoute-gZKKPhaj.js → ExtensionPageRoute-DFkPAzjs.js} +2 -2
  23. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CbKIa11X.js → FloatingTanStackRouterDevtools-CqogiFob-BP4itJWW.js} +1 -1
  24. package/dist/client/assets/HandlePage-De4D_IVs.js +1 -0
  25. package/dist/client/assets/{LexicalField-Ceoa9flp.js → LexicalField-BbUXXxTw.js} +1 -1
  26. package/dist/client/assets/{ManagesPage-Dcqdm6I8.js → ManagesPage-DsNSZHug.js} +1 -1
  27. package/dist/client/assets/Marketplace-D4zHIIak.js +36 -0
  28. package/dist/client/assets/MarketplaceSourcesView-DILS8-ca.js +1 -0
  29. package/dist/client/assets/{McpAppFrame-B1ThSf2U.js → McpAppFrame-Cl_2azg-.js} +2 -2
  30. package/dist/client/assets/McpSigninBody-TpoSImsV.js +1 -0
  31. package/dist/client/assets/{Model3dViewer-DlcQ3-LS.js → Model3dViewer-C-iyu5eV.js} +1 -1
  32. package/dist/client/assets/NamePage-C-3w8oeg.js +1 -0
  33. package/dist/client/assets/NewDirectMessageMenu-bJE7b4lX.js +1 -0
  34. package/dist/client/assets/{NotificationsPage-CQQIdLtI.js → NotificationsPage-CL23qwVw.js} +1 -1
  35. package/dist/client/assets/OperatorIdentityForm-ixaqUfIO.js +1 -0
  36. package/dist/client/assets/{PermissionsPage-TX-d7aVQ.js → PermissionsPage-D4xbxTkc.js} +1 -1
  37. package/dist/client/assets/{PersonalityPicker-C_9JVOva.js → PersonalityPicker-CTvPlN-k.js} +1 -1
  38. package/dist/client/assets/{PersonalityPopover-BoTED73t.js → PersonalityPopover-Coy0eaIg.js} +1 -1
  39. package/dist/client/assets/PhotoPage-DpEEXO3e.js +1 -0
  40. package/dist/client/assets/PreviewRefusedNotice-B2GLqLYi.js +1 -0
  41. package/dist/client/assets/{PromptSuggestionChips-B_oUtFMI.js → PromptSuggestionChips-YdKEWyNT.js} +1 -1
  42. package/dist/client/assets/RoomSurface-BwIBBvYq.js +44 -0
  43. package/dist/client/assets/{RoomsPage-zOjjpHdA.js → RoomsPage-DaEXPz65.js} +1 -1
  44. package/dist/client/assets/RunsOnPopover-tvbVPKVf.js +1 -0
  45. package/dist/client/assets/SessionsPage-CAdV_XBY.js +1 -0
  46. package/dist/client/assets/SkillsPage-B4F19LmV.js +1 -0
  47. package/dist/client/assets/{TasksPage-BZapA_v6.js → TasksPage-BXcaEx3V.js} +1 -1
  48. package/dist/client/assets/ToolsPage-BYBwPql_.js +2 -0
  49. package/dist/client/assets/{TopologyGraph-BMcPxZsA.js → TopologyGraph-CZ2Y5I2e.js} +1 -1
  50. package/dist/client/assets/TourHost-BNpDrN0O.js +1 -0
  51. package/dist/client/assets/UnlinkDialog-Zyuh5qZY.js +1 -0
  52. package/dist/client/assets/{UnreadDivider-KSqqcHKN.js → UnreadDivider-Dh67_mAz.js} +1 -1
  53. package/dist/client/assets/_shell-lcu5vkQ7.js +98 -0
  54. package/dist/client/assets/{_shell._home-Bp_p1VUv.js → _shell._home-CPV1Z64k.js} +1 -1
  55. package/dist/client/assets/_shell._home.activity-CEvkKYBD.js +1 -0
  56. package/dist/client/assets/_shell._home.index-tGnRLvY-.js +3 -0
  57. package/dist/client/assets/{_shell._home.tasks-BsBH_4tZ.js → _shell._home.tasks-CtpZNevK.js} +1 -1
  58. package/dist/client/assets/_shell._home.workspaces-D6tkWdS8.js +1 -0
  59. package/dist/client/assets/{_shell.channels-DWAHkDPV.js → _shell.channels-DbrQXIVv.js} +4 -4
  60. package/dist/client/assets/_shell.connections-C3Ho4S8R.js +6 -0
  61. package/dist/client/assets/{_shell.feedback-requests-Hjv640j9.js → _shell.feedback-requests-D9l7SJi1.js} +1 -1
  62. package/dist/client/assets/_shell.marketplace-BfY-kBJk.js +1 -0
  63. package/dist/client/assets/_shell.marketplace_.sources-B0km_EUs.js +1 -0
  64. package/dist/client/assets/_shell.session-O8MC-USm.js +54 -0
  65. package/dist/client/assets/{_shell.team-ctLQztjw.js → _shell.team-DvJK7irE.js} +4 -4
  66. package/dist/client/assets/_shell.x._extensionId-_-fII74H.js +1 -0
  67. package/dist/client/assets/_shell.x._extensionId_._-_-fII74H.js +1 -0
  68. package/dist/client/assets/agent-attention-BvnWcLpc.js +5 -0
  69. package/dist/client/assets/{agent-browser-CCN16ZOz.js → agent-browser-DsDp0cSX.js} +1 -1
  70. package/dist/client/assets/{banner-DOm9_4l-.js → banner-Cja2VfwN.js} +2 -2
  71. package/dist/client/assets/{file-exclamation-point-BKzL0QhY.js → file-exclamation-point-D8KYFYSh.js} +1 -1
  72. package/dist/client/assets/{highlighted-body-KPVGNVTW-DTxMTVdP.js → highlighted-body-KPVGNVTW-Chp5pHWq.js} +1 -1
  73. package/dist/client/assets/{hover-card-qzuFUCaR.js → hover-card-FvX18DHP.js} +1 -1
  74. package/dist/client/assets/{index-Dcs6e-U_.js → index-BFPRILKF.js} +1 -1
  75. package/dist/client/assets/{index-CtOB9fS3.js → index-BKCteC7q.js} +1 -1
  76. package/dist/client/assets/index-Bbffv0TQ.js +1247 -0
  77. package/dist/client/assets/{index-BMOfHKE0.js → index-BhatJcNc.js} +1 -1
  78. package/dist/client/assets/index-BroohPSu.js +1 -0
  79. package/dist/client/assets/{index-DT_v3O-B.js → index-Bt4vTnDj.js} +1 -1
  80. package/dist/client/assets/{index-DwzSdOh3.js → index-BwkmCRvO.js} +1 -1
  81. package/dist/client/assets/{index-CTai_TxZ.js → index-BzS1K2wS.js} +1 -1
  82. package/dist/client/assets/{index-C3XnoXTY.js → index-C6F5gzX-.js} +1 -1
  83. package/dist/client/assets/{index-BaB-skF0.js → index-CIzSi3tA.js} +3 -3
  84. package/dist/client/assets/{index-BPcwoJoz.js → index-CLCbHvV5.js} +1 -1
  85. package/dist/client/assets/{index-DA-i3I4q.js → index-CXjobHw0.js} +1 -1
  86. package/dist/client/assets/{index-DgH_dl1a.js → index-CYcJ7ENW.js} +2 -2
  87. package/dist/client/assets/{index-3lQkXKcq.js → index-CeqzGl3y.js} +1 -1
  88. package/dist/client/assets/{index-DgtF-nBt.js → index-CknNaeS2.js} +1 -1
  89. package/dist/client/assets/{index-Bk98IpMn.js → index-CtK6WJzD.js} +1 -1
  90. package/dist/client/assets/{index-C8ZMfyGc.js → index-CvxLe-_3.js} +1 -1
  91. package/dist/client/assets/{index-CF9fqPef.js → index-D24Ttd-y.js} +4 -4
  92. package/dist/client/assets/{index-CIPHHziB.js → index-D6Jn2eBq.js} +1 -1
  93. package/dist/client/assets/{index-D3DXMH4x.js → index-DDibi3-x.js} +1 -1
  94. package/dist/client/assets/{index-C7B2uRgo.js → index-DElGMXW8.js} +2 -2
  95. package/dist/client/assets/{index-CmlaXay_.js → index-DGNJkiFb.js} +1 -1
  96. package/dist/client/assets/{index-WjW-NUCp.js → index-DI2T-dXr.js} +1 -1
  97. package/dist/client/assets/{index-CLhD0Bno.js → index-DZf_utaG.js} +1 -1
  98. package/dist/client/assets/{index-CTXNRyRE.js → index-D_XtXoLp.js} +1 -1
  99. package/dist/client/assets/{index-CDTumWMC.js → index-DjdQaKwP.js} +1 -1
  100. package/dist/client/assets/index-Do18O9VZ.js +1 -0
  101. package/dist/client/assets/{index-CVl132_4.js → index-Do1vOFrm.js} +1 -1
  102. package/dist/client/assets/{index-BIMClIrX.js → index-Dv1DkyeB.js} +1 -1
  103. package/dist/client/assets/{index-IgIVF9T_.js → index-DyvLJ_Z5.js} +1 -1
  104. package/dist/client/assets/index-HgvJwMGi.js +5 -0
  105. package/dist/client/assets/{index-DR1JT9Uz.js → index-OxwtxTFo.js} +3 -3
  106. package/dist/client/assets/index-QSDTjavn.js +1 -0
  107. package/dist/client/assets/{index-DOxEmnH2.js → index-ZLdoJdwS.js} +1 -1
  108. package/dist/client/assets/index-_GlgFH88.css +1 -0
  109. package/dist/client/assets/{index-CScfHuKF.js → index-euarUu2E.js} +1 -1
  110. package/dist/client/assets/{index-B-z7hA9x.js → index-jYh6X22t.js} +1 -1
  111. package/dist/client/assets/{index-CIfwPLXd.js → index-uQ1vTS05.js} +1 -1
  112. package/dist/client/assets/{index-CejezM4U.js → index-xfBvKz-h.js} +1 -1
  113. package/dist/client/assets/{index-BW5ce4t8.js → index-znQ5q2gV.js} +1 -1
  114. package/dist/client/assets/{layers-CJHXSEKK.js → layers-8-cbYlfw.js} +1 -1
  115. package/dist/client/assets/{lightbulb-DWjxw7lb.js → lightbulb-DoB0IKly.js} +1 -1
  116. package/dist/client/assets/{mention-pill-akMU3IVs.js → mention-pill-BHC6tMG9.js} +1 -1
  117. package/dist/client/assets/{message-square-off-DEagHpQY.js → message-square-off-CEHuZJtY.js} +1 -1
  118. package/dist/client/assets/{owner-notice-CLsx0s7q.js → owner-notice-dtDSKfGs.js} +1 -1
  119. package/dist/client/assets/{page-container-W7byjRmk.js → page-container-BOrdASM1.js} +1 -1
  120. package/dist/client/assets/primer-trigger-CC-cR5zN.js +3 -0
  121. package/dist/client/assets/{radio-B8Ozjv9U.js → radio-BfZPhctR.js} +1 -1
  122. package/dist/client/assets/{room-files-source-Bsc3YA91.js → room-files-source-BHupFaLE.js} +2 -2
  123. package/dist/client/assets/{rotate-ccw-clock-CNcDcTvq.js → rotate-ccw-clock-BvzfP8lR.js} +1 -1
  124. package/dist/client/assets/{rotate-cw-xvfipJLN.js → rotate-cw-BDweizfR.js} +1 -1
  125. package/dist/client/assets/{scroll-area-C95q3ss7.js → scroll-area-Dph6w3a6.js} +1 -1
  126. package/dist/client/assets/{search-x-C6SAxw7a.js → search-x-CoFJOP2l.js} +2 -2
  127. package/dist/client/assets/{shield-x-DxOGc0dW.js → shield-x-BZ6rhiT0.js} +1 -1
  128. package/dist/client/assets/{soul-file-pg0ShYy3.js → soul-file-H8fwhgiL.js} +1 -1
  129. package/dist/client/assets/use-delete-binding-CUsepFIL.js +1 -0
  130. package/dist/client/assets/use-dev-links-DYYe0vvP.js +1 -0
  131. package/dist/client/assets/{use-external-adapter-catalog-B0gcY-k7.js → use-external-adapter-catalog-CAl3MNq-.js} +1 -1
  132. package/dist/client/assets/use-full-activity-feed-Bb7BUusp.js +1 -0
  133. package/dist/client/assets/use-is-below-desktop-CIgGSgoL.js +1 -0
  134. package/dist/client/assets/use-jump-back-in-BdLBzvDr.js +11 -0
  135. package/dist/client/assets/use-mesh-topology-wYtCBbF_.js +1 -0
  136. package/dist/client/assets/use-pending-read-9UcfnDwF.js +1 -0
  137. package/dist/client/assets/{use-personality-commit-OH7d0xl_.js → use-personality-commit-CaxUHrX5.js} +1 -1
  138. package/dist/client/assets/{use-promo-activation-BgdGasXE.js → use-promo-activation-rNaAOdoh.js} +2 -2
  139. package/dist/client/assets/use-pulse-freshness-CygG3s-S.js +1 -0
  140. package/dist/client/assets/use-room-follow-claim-BIK37Iy3.js +1 -0
  141. package/dist/client/assets/{use-roving-tab-list-Be60AWK3.js → use-roving-tab-list-DQgkKGzc.js} +1 -1
  142. package/dist/client/assets/{use-session-canvas-Bqs6IQO7.js → use-session-canvas-Dpy5BEId.js} +5 -5
  143. package/dist/client/assets/use-session-diagnostics-atu9cfgr.js +16 -0
  144. package/dist/client/assets/use-unclaimed-chats-qUI5vY5K.js +1 -0
  145. package/dist/client/index.html +2 -2
  146. package/dist/drizzle/20261008170031_session_touches.sql +5 -0
  147. package/dist/drizzle/20261009171311_chat_messages.sql +41 -0
  148. package/dist/drizzle/20261009173712_started_by_report_back.sql +1 -0
  149. package/dist/drizzle/meta/20261008170031_snapshot.json +12642 -0
  150. package/dist/drizzle/meta/20261009171311_snapshot.json +12906 -0
  151. package/dist/drizzle/meta/20261009173712_snapshot.json +12914 -0
  152. package/dist/drizzle/meta/_journal.json +21 -0
  153. package/dist/server/index.js +23608 -19236
  154. package/dist/server/index.js.map +2 -2
  155. package/package.json +6 -6
  156. package/dist/client/assets/AdapterIcon-CL-MyyKy.js +0 -1
  157. package/dist/client/assets/AdapterSetupWizard-C8HOvHLF.js +0 -2
  158. package/dist/client/assets/CanvasFileContent-ZZhdofR4.js +0 -2
  159. package/dist/client/assets/CanvasModel3dContent-DMMMZh4o.js +0 -2
  160. package/dist/client/assets/ConnectionAccessLists-PW1uzcGU.js +0 -1
  161. package/dist/client/assets/ConnectionsPage-EwitZwOE.js +0 -11
  162. package/dist/client/assets/HandlePage-CL3_n1CI.js +0 -1
  163. package/dist/client/assets/Marketplace-DsU-q1ZZ.js +0 -36
  164. package/dist/client/assets/MarketplaceSourcesView-D72YoKNR.js +0 -1
  165. package/dist/client/assets/McpSigninBody-Btg3PnYN.js +0 -1
  166. package/dist/client/assets/NamePage-Bzqj4Eob.js +0 -1
  167. package/dist/client/assets/NewDirectMessageMenu-89yeGqvy.js +0 -1
  168. package/dist/client/assets/OperatorIdentityForm-BhiB9tQp.js +0 -1
  169. package/dist/client/assets/PhotoPage-C3fMlebQ.js +0 -1
  170. package/dist/client/assets/PreviewRefusedNotice-ChCgdKWN.js +0 -1
  171. package/dist/client/assets/RoomSurface-CgtNuYhl.js +0 -39
  172. package/dist/client/assets/RunsOnPopover-JTm1cYuw.js +0 -1
  173. package/dist/client/assets/SessionsPage-D4kyvHQf.js +0 -6
  174. package/dist/client/assets/SkillsPage-KYUVzuVa.js +0 -1
  175. package/dist/client/assets/ToolsPage-CWpHMlrR.js +0 -2
  176. package/dist/client/assets/TourHost-VY1-sy1Y.js +0 -1
  177. package/dist/client/assets/UnlinkDialog-3p38G_9q.js +0 -1
  178. package/dist/client/assets/_shell-DAjwimLg.js +0 -93
  179. package/dist/client/assets/_shell._home.activity-tk-XApvX.js +0 -1
  180. package/dist/client/assets/_shell._home.index-BNVhSN0y.js +0 -3
  181. package/dist/client/assets/_shell._home.workspaces-DuXnjQh0.js +0 -1
  182. package/dist/client/assets/_shell.connections-DIm3mUHy.js +0 -6
  183. package/dist/client/assets/_shell.marketplace-DF6Y7mc0.js +0 -1
  184. package/dist/client/assets/_shell.marketplace_.sources-Do8cm7kq.js +0 -1
  185. package/dist/client/assets/_shell.session-DlN8iOl-.js +0 -43
  186. package/dist/client/assets/_shell.x._extensionId-0Q1rJtud.js +0 -1
  187. package/dist/client/assets/_shell.x._extensionId_._-0Q1rJtud.js +0 -1
  188. package/dist/client/assets/agent-attention-Dn__3LQE.js +0 -5
  189. package/dist/client/assets/hand-DLUdsiuR.js +0 -6
  190. package/dist/client/assets/index-CQWqpw_G.js +0 -1
  191. package/dist/client/assets/index-D5uYwabS.js +0 -1
  192. package/dist/client/assets/index-DFMDv6qR.js +0 -1
  193. package/dist/client/assets/index-DMYBI16t.js +0 -1252
  194. package/dist/client/assets/index-DbbZNAKk.js +0 -5
  195. package/dist/client/assets/index-Dgp1LmEk.css +0 -1
  196. package/dist/client/assets/primer-trigger-DuM9vVnV.js +0 -3
  197. package/dist/client/assets/use-delete-binding-CZVeHqn0.js +0 -1
  198. package/dist/client/assets/use-dev-links-Df2WkCic.js +0 -1
  199. package/dist/client/assets/use-full-activity-feed-SYcgdMZu.js +0 -1
  200. package/dist/client/assets/use-is-below-desktop-C5_YenEp.js +0 -1
  201. package/dist/client/assets/use-jump-back-in-DWUPb1gi.js +0 -11
  202. package/dist/client/assets/use-mesh-topology-HLzZIgis.js +0 -1
  203. package/dist/client/assets/use-pending-read-BuJknrxG.js +0 -1
  204. package/dist/client/assets/use-pulse-freshness-BlD-dM_g.js +0 -1
  205. package/dist/client/assets/use-rename-session-D3MuyK-F.js +0 -1
  206. package/dist/client/assets/use-room-follow-claim-CyjhzbRJ.js +0 -1
  207. package/dist/client/assets/use-session-diagnostics-CfKdB2iY.js +0 -16
  208. package/dist/client/assets/use-unclaimed-chats-lqMhotUB.js +0 -1
@@ -1 +1 @@
1
- import{j as o,ch as t}from"./index-DMYBI16t.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,ch as t}from"./index-Bbffv0TQ.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};
@@ -0,0 +1 @@
1
+ import{bN as H,ci as $,r as c,j as e,ab as x,hE as P,be as Y,U as g,B as j,X as G,fr as N,hF as k,an as B,a1 as L,dg as R,dj as F,e as v,c_ as W,c$ as p,aV as K,a5 as z,ae as V,hG as q,hH as U,hI as X,d7 as Q}from"./index-Bbffv0TQ.js";import{P as J}from"./page-container-BOrdASM1.js";import{u as Z}from"./use-full-activity-feed-Bb7BUusp.js";import{C as b,A as ee}from"./ActivityRow-CvjAfRBM.js";const C=["categories","actorType","actorId","since"];function w(){const s=H(),i=$({strict:!1}),t={categories:i.categories,actorType:i.actorType,actorId:i.actorId,since:i.since},n=C.some(u=>i[u]!==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=c.useCallback(u=>{s({search:u})},[s]),l=c.useCallback(u=>{r(h=>{const y=h.categories?h.categories.split(","):[],A=y.includes(u)?y.filter(_=>_!==u):[...y,u];return{...h,categories:A.length>0?A.join(","):void 0}})},[r]),d=c.useCallback(u=>{r(h=>({...h,actorType:u}))},[r]),m=c.useCallback(u=>{r(h=>({...h,actorId:u}))},[r]),o=c.useCallback(u=>{r(h=>({...h,since:u}))},[r]),f=c.useCallback(()=>{r(u=>{const h={...u};for(const y of C)delete h[y];return h})},[r]);return{filters:t,queryFilters:a,isFiltered:n,toggleCategory:l,setActorType:d,setActorId:m,setSince:o,clearAll:f}}const T="dorkos:lastVisitedActivity";function te(){const[s]=c.useState(()=>localStorage.getItem(T)),i=c.useRef(!1);return c.useEffect(()=>{i.current||(localStorage.setItem(T,new Date().toISOString()),i.current=!0)},[]),s}function se(s){const i=c.useRef(null),t=c.useCallback(n=>{var d,m,o;const a=i.current;if(!a)return;const r=a.querySelectorAll("[data-activity-row]"),l=Array.from(r).findIndex(f=>f===document.activeElement||f.contains(document.activeElement));switch(n.key){case"ArrowDown":{n.preventDefault();const f=Math.min(l+1,r.length-1);(d=r[f])==null||d.focus();break}case"ArrowUp":{n.preventDefault();const f=Math.max(l-1,0);(m=r[f])==null||m.focus();break}case"Escape":{(o=document.activeElement)==null||o.blur();break}}},[s]);return{containerRef:i,handleKeyDown:t}}const ne=["Today","Yesterday","This week","Earlier"];function ie(s,i){const t=new Map;for(const n of s){const a=ae(new Date(n.occurredAt),i),r=t.get(a)??[];r.push(n),t.set(a,r)}return ne.filter(n=>t.has(n)).map(n=>({label:n,items:t.get(n)}))}function ae(s,i){const t=new Date(i);t.setHours(0,0,0,0);const n=new Date(t);n.setDate(n.getDate()-1);const a=new Date(t);return a.setDate(a.getDate()-a.getDay()),s>=t?"Today":s>=n?"Yesterday":s>=a?"This week":"Earlier"}function re({label:s,className:i}){return e.jsx("div",{"data-slot":"activity-group-header",className:x("sticky top-0 z-10 -mx-4 px-4 py-2 sm:-mx-6 sm:px-6","bg-background/95 backdrop-blur-sm",i),children:e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wider uppercase",children:s})})}const oe=["tasks","relay","agent","config","system","permissions"],O="group inline-flex min-h-11 shrink-0 items-center outline-none md:min-h-0",M="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 ce({category:s,isActive:i,onToggle:t}){const n=b[s];return e.jsx(g.button,{type:"button",layout:!0,onClick:t,"aria-pressed":i,transition:{duration:.15},className:O,children:e.jsx("span",{className:x(M,i?x(n.bg,n.text):"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:n.label})})}function le({isActive:s,onClick:i}){return e.jsx(g.button,{type:"button",layout:!0,onClick:i,"aria-pressed":s,transition:{duration:.15},className:O,children:e.jsx("span",{className:x(M,s?"bg-foreground text-background":"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:"All"})})}function ue({className:s}){const{filters:i,isFiltered:t,toggleCategory:n,clearAll:a}=w(),r=c.useRef(null),l=P(r,"horizontal"),d=new Set(i.categories?i.categories.split(","):[]),m=()=>{t&&a()};return e.jsxs("div",{className:x("relative",s),children:[e.jsxs("div",{ref:r,onScroll:l.onScroll,"data-slot":"activity-filter-bar",className:"flex items-center gap-1 overflow-x-auto",children:[e.jsx(le,{isActive:!t,onClick:m}),oe.map(o=>e.jsx(ce,{category:o,isActive:d.has(o),onToggle:()=>n(o)},o)),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(j,{variant:"ghost",size:"xs",className:"ml-1",onClick:a,children:[e.jsx(G,{"aria-hidden":!0}),"Clear"]})},"clear-filters")})]}),l.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"}),l.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 de({isFiltered:s=!1,className:i}){const{filters:t,clearAll:n}=w();return s?e.jsx(N,{className:i,icon:k,headline:`No ${me(t.categories)} activity found`,description:"Try other filters.",action:{label:"Clear filters",onClick:n,variant:"outline"}}):e.jsx(N,{className:i,icon:k,headline:"No activity yet",description:"Your agents’ work shows up here."})}function me(s){if(!s)return"matching";const t=s.split(",").map(r=>{var l;return((l=b[r])==null?void 0:l.label)??r});if(t.length===1)return t[0];const n=t[t.length-1];return`${t.slice(0,-1).join(", ")} or ${n}`}function fe({onRetry:s,className:i}){return e.jsxs("div",{"data-slot":"activity-error-state",className:x("flex flex-col items-center justify-center gap-3 py-16 text-center",i),children:[e.jsx("div",{className:"bg-destructive/10 rounded-xl p-3",children:e.jsx(B,{className:"text-destructive size-6","aria-hidden":"true"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-foreground text-sm font-medium",children:"Couldn’t load your activity"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs",children:"The DorkOS server didn’t answer. Check that it’s running."})]}),e.jsx(j,{variant:"outline",size:"sm",onClick:s,children:"Retry"})]})}function xe(s){const i=Date.now()-new Date(s).getTime(),t=Math.floor(i/36e5);return t<1?"recently":t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function he(s,i){const t=new Date(i),n={};for(const a of s)new Date(a.occurredAt)>t&&(n[a.category]=(n[a.category]??0)+1);return n}function ge(s){const i={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,n])=>{const a=i[t];return`${n} ${n===1?a:`${a}s`}`}).join(" · ")}function ye({lastVisitedAt:s,items:i,className:t}){if(!s)return null;const n=he(i,s);if(Object.values(n).reduce((d,m)=>d+(m??0),0)===0)return null;const r=xe(s),l=ge(n);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:x("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:l}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Object.keys(n).map(d=>{const m=n[d];if(!m)return null;const o=b[d];return e.jsxs(L,{shape:"pill",className:x("border-transparent",o.bg,o.text),children:[m," ",o.label]},d)})})]})}const pe={initial:{opacity:0,y:6},animate:{opacity:1,y:0,transition:{duration:.2,ease:"easeOut"}}};function ve(){const s=c.useId(),i=c.useMemo(()=>`${s.split("").reduce((n,a)=>n+a.charCodeAt(0),0)%40+50}%`,[s]);return e.jsxs(W,{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:i}})}),e.jsx(p,{className:"w-16 py-1.5 max-sm:w-10"})]})}function je(){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(R,{children:e.jsx(F,{children:Array.from({length:5}).map((s,i)=>e.jsx(ve,{},i))})})]})}function be({items:s,isLoading:i,isError:t,onRetry:n,isFiltered:a,className:r}){const l=c.useMemo(()=>ie(s,new Date),[s]),{containerRef:d,handleKeyDown:m}=se(s.length);return i&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:x(r),children:e.jsx(je,{})}):t&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:x(r),children:e.jsx(fe,{onRetry:n})}):s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:x(r),children:e.jsx(de,{isFiltered:a})}):e.jsx("div",{ref:d,onKeyDown:m,"data-slot":"activity-timeline",className:x(r),children:l.map(o=>e.jsxs("section",{children:[e.jsx(re,{label:o.label}),e.jsx(g.div,{variants:pe,initial:"initial",animate:"animate",children:e.jsx(R,{children:e.jsx(F,{children:o.items.map(f=>e.jsx(ee,{item:f},f.id))})})})]},o.label))})}function we({onLoadMore:s,isFetching:i,hasNextPage:t,className:n}){return t?e.jsx(g.div,{"data-slot":"activity-load-more",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1},className:x("flex justify-center py-4",n),children:e.jsxs(j,{variant:"outline",size:"sm",onClick:s,disabled:i,className:"gap-2",children:[i&&e.jsx(K,{size:"xs"}),"Load 50 more events"]})}):null}const S=7;function Ae(){var t;const s=z(),{data:i}=V({queryKey:q.dailyCounts(S),queryFn:()=>s.getSessionDailyCounts(S),staleTime:6e4});return!i||i.dailyCounts.length===0?null:{dailyCounts:i.dailyCounts,degraded:(((t=i.warnings)==null?void 0:t.length)??0)>0}}function Ne(s,i){const t=s.reduce((a,r)=>a+r,0),n=t===1?"session":"sessions";return i?t===0?"This week’s count is incomplete":`Your agents started at least ${t} ${n} this week`:t===0?"Your agents started no chats this week":`Your agents started ${t} ${n} this week`}const I=10,ke=4,D=30,E=1;function Ce({data:s,className:i}){const t=Math.max(...s,1);return e.jsx("svg",{viewBox:"0 0 100 30",className:x("text-muted-foreground",i),"aria-hidden":"true",children:s.map((n,a)=>{const r=n/t*D;return e.jsx("rect",{x:a*(I+ke)+1,y:D-Math.max(r,E),width:I,height:Math.max(r,E),rx:2,fill:"currentColor",opacity:.6},a)})})}function Te(){const s=Ae();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:Ne(s.dailyCounts,s.degraded)}),e.jsx(Ce,{data:s.dailyCounts,className:"h-6 w-24 shrink-0"})]})}function Se(){const s=c.useId(),i=U("dashboard.sections"),t=c.useMemo(()=>i.filter(n=>X(n.id)&&(!n.visibleWhen||n.visibleWhen())),[i]);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(n=>e.jsx(n.component,{},n.id))})]})}function Ie(){const{queryFilters:s,isFiltered:i}=w(),t=te(),{data:n,isLoading:a,isError:r,refetch:l,isFetchingNextPage:d,hasNextPage:m,fetchNextPage:o}=Z(s),f=c.useMemo(()=>(n==null?void 0:n.pages.flatMap(u=>u.items))??[],[n]);return e.jsxs(e.Fragment,{children:[e.jsx(Q,{children:"Activity"}),e.jsxs(J,{width:"wide",className:"space-y-4",children:[e.jsx(ue,{}),e.jsx(Te,{}),e.jsx(Se,{}),e.jsx(ye,{lastVisitedAt:t,items:f}),e.jsx(be,{items:f,isLoading:a,isError:r,onRetry:()=>void l(),isFiltered:i}),e.jsx(we,{onLoadMore:()=>void o(),isFetching:d,hasNextPage:!!m})]})]})}const Oe=Ie;export{Oe as component};
@@ -0,0 +1,3 @@
1
+ import{iC as ge,iD as fe,j as t,gp as $,gq as F,gr as L,gs as W,gt as q,a1 as I,iE as xe,am as A,cA as pe,cB as je,C as ve,cC as be,iF as H,B as S,iG as ye,iH as Ne,bN as B,e as C,ab as b,x as z,r as u,aG as Se,iI as ke,gd as we,f_ as Re,dE as Ce,aE as Ie,X as se,iJ as Ae,iK as Pe,aC as De,g5 as ne,hE as Me,be as K,U as R,dI as Oe,iL as Te,iM as Ee,iN as $e,eo as Fe,ep as Le,iO as We,iP as qe,iQ as He,iR as Be,ei as oe,ek as ze,iS as _e,ci as ie,ds as Ue,el as Ke,iT as Ve,l as ae,iU as Ge,iV as Qe,hu as Ye,iW as re,ej as Xe,b1 as Je,aK as Ze,iX as et,g as tt,fi as le,iY as V,gb as G,iZ as st,i_ as nt,i$ as ot,j0 as it,a5 as at,j1 as rt,fl as lt,bq as dt,hR as ct,ew as ut,j2 as mt,eD as O,ib as ht,w as Q,d7 as gt,gH as ft,j3 as xt,j4 as pt,n as jt}from"./index-Bbffv0TQ.js";import{I as vt,i as bt,a as yt}from"./RoomSurface-BwIBBvYq.js";import{S as _}from"./scroll-area-Dph6w3a6.js";import{u as Nt}from"./use-mesh-topology-wYtCBbF_.js";import{A as St}from"./AttentionSignalRow-C6RkjCWK.js";import{P as kt}from"./PromptSuggestionChips-YdKEWyNT.js";import{u as wt,a as de,s as Rt,P as Ct,b as It}from"./use-promo-activation-rNaAOdoh.js";import"./use-jump-back-in-BdLBzvDr.js";import"./use-room-follow-claim-BIK37Iy3.js";import"./index-HgvJwMGi.js";import"./file-drag-GDx2qhdk.js";import"./index-xfBvKz-h.js";import"./UnreadDivider-Dh67_mAz.js";import"./format-duration-BCr6uzby.js";import"./hover-card-FvX18DHP.js";import"./mention-pill-BHC6tMG9.js";import"./rotate-ccw-clock-BvzfP8lR.js";import"./message-square-off-CEHuZJtY.js";import"./AgentRequestCard-D62XQXBM.js";function At({open:e,itemId:n,onClose:o}){const{data:s}=ge(),i=fe(),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(m=>m.source===r&&m.reason===l),c=()=>{!r||!l||i.mutate({source:r,reason:l},{onSuccess:o})};return t.jsx($,{open:e,onOpenChange:m=>!m&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(W,{children:"Messages that never arrived"}),t.jsx(q,{children:r??"Source unknown"})]}),t.jsx(_,{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:xe(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(pe,{children:[t.jsxs(je,{className:"text-muted-foreground hover:text-foreground group flex items-center gap-1 text-xs font-medium transition-colors",children:[t.jsx(ve,{className:"size-3 transition-transform group-data-[state=open]:rotate-90"}),"What one of them looked like"]}),t.jsx(be,{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(H,{children:[d&&t.jsx(S,{variant:"destructive",onClick:c,disabled:i.isPending,children:i.isPending?"Clearing…":"Clear these"}),t.jsx(S,{variant:"outline",onClick:o,children:"Close"})]})]})})}function Pt(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 Dt(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 Mt={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 Ot({open:e,itemId:n,onClose:o}){const{data:s,isLoading:i,isError:a}=ye(e?n??null:null),r=Ne(),l=B(),d=()=>{s!=null&&s.sessionId&&l(z({session:s.sessionId}))},c=()=>{s&&r.mutate(s.id)},m=s?Dt(s.status):null,g=m?Mt[m.tone]:null;return t.jsx($,{open:e,onOpenChange:f=>!f&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(W,{children:(m==null?void 0:m.title)??"Run that needs a look"}),t.jsx(q,{children:n?n.slice(0,8):"Unknown"})]}),t.jsxs(_,{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:m.badge,children:m.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: ",Pt(s.durationMs)]})]}),s.error&&t.jsxs("div",{className:b("rounded-md border p-3",g.box),children:[t.jsx("p",{className:b("text-sm font-medium",g.heading),children:m.heading}),t.jsx("p",{className:b("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(H,{children:[(s==null?void 0:s.sessionId)&&t.jsx(S,{variant:"default",onClick:d,children:"View chat"}),(s==null?void 0:s.status)==="running"&&t.jsx(S,{variant:"destructive",onClick:c,disabled:r.isPending,children:r.isPending?"Cancelling…":"Cancel run"}),t.jsx(S,{variant:"outline",onClick:o,children:"Close"})]})]})})}function Tt({agent:e}){const n=ke(e,e.projectPath??"");return t.jsxs("div",{className:"flex items-center gap-3 py-2",children:[t.jsx(we,{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:Re(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:Ce(e.runtime).label})]})]}),e.lastSeenAt&&t.jsxs("span",{className:"text-muted-foreground shrink-0 text-xs",children:[A(e.lastSeenAt)," ago"]})]})}function Et({open:e,onClose:n}){const{data:o}=Nt(void 0,e),s=u.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(W,{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(_,{className:"flex-1 px-4",children:s.length>0?t.jsx("div",{className:"divide-y",children:s.map(i=>t.jsx(Tt,{agent:i},i.id))}):t.jsxs("div",{className:"flex flex-col items-center gap-2 py-8",children:[t.jsx(Se,{className:"text-status-success size-6"}),t.jsx("p",{className:"text-muted-foreground text-sm",children:"All agents are online"})]})}),t.jsx(H,{children:t.jsx(S,{variant:"outline",onClick:n,children:"Close"})})]})})}function $t(e){return e.content.suggestion!==void 0}function Ft(){const e=wt(),{dismissedIds:n}=de(),o=Ie(s=>s.promoEnabled);return u.useMemo(()=>{if(!o)return null;const[s]=Rt(Ct.filter($t),e,n,1);return s??null},[e,n,o])}function Lt({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(se,{className:"size-3"})})]})}function Wt({promo:e}){const{dismissPromo:n}=de(),{activate:o,dialog:s}=It(e);return t.jsxs(t.Fragment,{children:[t.jsx(Lt,{suggestion:e.content.suggestion,promoTitle:e.content.title,onAccept:o,onDismiss:()=>n(e.id)}),s]})}function qt(){const e=Ft();return e===null?null:t.jsx(Wt,{promo:e},e.id)}const Ht=["report.daily"];function ce(){const{notifications:e}=Ae({kinds:Ht,unread:!0});return u.useMemo(()=>e[0],[e])}function Bt({questions:e,requests:n,schedules:o,approvalsUnavailable:s,attention:i}){const a=[],r=[],l=e+n+o;return l>0?(a.push(`${Pe(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 zt({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(De,{"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(se,{className:"size-3.5"})})]})}const _t="max-h-[40svh] sm:max-h-[50svh]",Ut={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=u.useId();return t.jsxs("section",{"aria-labelledby":s,className:"min-w-0",children:[t.jsx("h2",{id:s,className:b("mb-2 text-xs font-medium",n==="waiting"?"text-status-warning-fg":"text-muted-foreground"),children:e}),o]})}function Y({edge:e}){return t.jsx("div",{"aria-hidden":"true","data-slot":`pinned-triage-fade-${e}`,className:b("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 X={animate:{transition:{staggerChildren:.04}}};function Kt(e){return e?0:.18}function Vt({approvals:e,asks:n,settlingAsks:o,askAgentNames:s,onOpenSession:i,approvalsUnavailable:a,onRetryApprovals:r,scheduleApprovals:l,errorSignals:d,activityItems:c,onOpenActivity:m,shiftReport:g,presence:f,condensed:p,onExpand:j,className:h}){const x=ne(),v=u.useRef(null),N=Me(v),k=e.length>0||n.length>0||o.length>0||l.length>0||a,P=d.length>0,w=c.length>0,me=k||P||w||g!==void 0||(f==null?void 0:f.occupied)===!0,M=Bt({questions:n.length,requests:e.length,schedules:l.length,approvalsUnavailable:a,attention:d.length+c.length}),he=p===!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:[he&&t.jsx(R.div,{"data-slot":"pinned-triage-summary",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:Kt(x===!0)},className:b("bg-background/95 border-border/60 shrink-0 border-b backdrop-blur-sm",h),children:t.jsxs("button",{type:"button",onClick:j,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(Oe,{className:"size-3.5 shrink-0","aria-hidden":!0})]})},"triage-summary"),me&&p!==!0&&t.jsxs(R.div,{"data-slot":"pinned-triage-header",...Ut,transition:{duration:x?0:.25,ease:[0,0,.2,1]},className:b("bg-background/95 border-border/60 relative shrink-0 overflow-hidden border-b backdrop-blur-sm",h),children:[t.jsxs("div",{ref:v,onScroll:N.onScroll,"data-slot":"pinned-triage-scroller",className:b("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",_t),children:[k&&t.jsxs(T,{title:"Waiting on you",children:[(n.length>0||o.length>0)&&t.jsx(Te,{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(Ee,{approvals:e}),e.length===0&&a&&t.jsx($e,{onRetry:r}),t.jsx(K,{initial:!1,children:l.map(y=>t.jsx(Fe,{task:y,className:"mt-2"},y.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:X,initial:"initial",animate:"animate",children:d.map(y=>t.jsx(St,{signal:y},y.id))})})}),g&&t.jsx(zt,{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:X,initial:"initial",animate:"animate",children:c.map(y=>t.jsx(Le,{notification:y,onOpen:()=>m(y)},y.id))})})}),f==null?void 0:f.node]}),N.start&&t.jsx(Y,{edge:"top"}),N.end&&t.jsx(Y,{edge:"bottom"})]},"triage-header")]})]})}function Gt({presence:e,composerFocused:n,onExpand:o,className:s}){const{approvals:i,isError:a,retry:r}=We(),{interactions:l}=qe(),d=He(),c=Be(l),{schedules:m,errors:g,activity:f}=oe(),p=ze(),j=ce(),{mutate:h}=_e(),x=ie({strict:!1}),v=B(),N=Ue(),k=Ke(m),P=Ve(i),w=u.useCallback(()=>{v({...ae.home(),search:{}})},[v]);return t.jsxs(t.Fragment,{children:[t.jsx(Vt,{approvals:P,asks:l,settlingAsks:d,askAgentNames:c,onOpenSession:U=>{v(z({session:U}))},approvalsUnavailable:a&&i.length===0,onRetryApprovals:r,scheduleApprovals:k,errorSignals:g,activityItems:f,onOpenActivity:p,shiftReport:j===void 0?void 0:{notification:j,onDismiss:()=>h(j.id)},presence:e,condensed:N&&n===!0,onExpand:o,className:s}),t.jsx(At,{open:x.detail==="dead-letter",itemId:x.itemId,onClose:w}),t.jsx(Ot,{open:x.detail==="failed-run",itemId:x.itemId,onClose:w}),t.jsx(Et,{open:x.detail==="offline-agent",onClose:w})]})}const Qt=["What can you help with?","Make my first agent","What’s in this project?","Set up a daily run"];function Yt({roomId:e}){const n=u.useCallback(o=>{Ge.getState().set(e,o),Qe.getState().requestFocus(e)},[e]);return t.jsx("div",{className:"w-full px-[var(--msg-padding-x)] pb-1",children:t.jsx(kt,{suggestions:Qt,onChipClick:n,ariaLabel:"Ways to start",size:"comfortable"})})}function Xt(e){var a;const{data:n}=Ye(e),o=((a=n==null?void 0:n.members.find(r=>r.author.id===n.viewerAuthorId))==null?void 0:a.lastReadSeq)??null,[s,i]=u.useState({roomId:null,seq:null});return s.roomId===e?s.seq:o===null?null:(i({roomId:e,seq:o}),o)}function Jt(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 Zt(e,n){const o=new Date(e),s=o.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),i=es(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 es(e,n){const o=s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime();return Math.round((o(n)-o(e))/864e5)}function ts(e,n){return e===null?null:`Next up: ${e.name} runs ${Zt(e.at,n)}.`}function ss({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 ns({roomId:e,presenceOccupied:n}){const o=re(e),s=Xt(e),{items:i,isLoading:a,isAnyError:r}=Xe(),{total:l}=oe(),d=ce(),c=o!==void 0&&o.length>0,m=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&&m&&!g,[p,j]=u.useState("waiting");f&&p==="waiting"?j("shown"):!f&&p==="shown"&&j("retired");const h=f&&p!=="retired",x=Je(),{data:v}=Ze(x&&h),N=et();return h?t.jsx(ss,{forwardLook:ts(Jt(v,N),N),suggestion:t.jsx(qt,{})}):null}const ue="dorkos:home-opened-on";function J(){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 os(){try{return localStorage.getItem(ue)}catch{return null}}function is(e){try{localStorage.setItem(ue,e)}catch{}}function as(){const[e]=u.useState(()=>os()!==J());return u.useEffect(()=>{e&&is(J())},[e]),e}function rs({children:e}){const n=as(),o=ne(),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 ls=5,ds="relative after:absolute after:-inset-x-1 after:-inset-y-2.5 md:after:hidden";function cs(e,n){return e===null||n===null?null:Math.max(0,n-Date.parse(e))}function us({row:e,onFollow:n,onViewProfile:o}){const[s,i]=u.useState(null),a=cs(e.since,s),r=e.profileMemberId,l=o===void 0||r===null?void 0:()=>o(r);return t.jsx(vt,{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:b("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",ds),children:[t.jsx(tt,{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 ms({rows:e,onFollow:n,onViewProfile:o,className:s}){if(e.length===0)return null;const i=e.slice(0,ls),a=e.length-i.length;return t.jsxs("ul",{"data-testid":"presence-strip","aria-label":"Working right now",className:b("flex items-center gap-x-2 overflow-hidden",s),children:[i.map(r=>t.jsx("li",{className:"min-w-0",children:t.jsx(us,{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 hs(e){return`replying in ${e}`}const gs="working in a chat";function fs(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 xs(e){const n=new Map;for(const[o,s]of Object.entries(e))s!==null&&n.set(st(o),{path:o,manifest:s});return n}function Z(e){return{...e,line:ot(e.name,e.binding,e.state),detail:nt(e.binding,e.state)}}function ps(e){const n=xs(e.agents),o=new Set(e.excludeRoomIds??[]),s=[],i=new Set;for(const l of e.claims){const d=fs(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 m=e.rooms[l.roomId],g=m===void 0?null:le(m);s.push(Z({id:`room:${l.roomId}:${l.authorId}`,name:d.author.displayName,handle:d.author.handle,face:V({record:d.author,override:c===void 0?null:G(c.manifest),...d.origin!==void 0?{origin:d.origin}:{}}),binding:g===null?null:hs(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(Z({id:`session:${l.sessionId}`,name:c,handle:null,face:V({record:{id:d.id,kind:"agent",displayName:c},override:G(d)}),binding:gs,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 js(e,n,o){var a;const s=new Set(it(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 ee=[],vs=[],te="\0",D="";function bs(){const e=O(u.useCallback(i=>i.statuses,[])),n=O(u.useCallback(i=>i.statusCwds,[])),o=O(u.useCallback(i=>i.sessions,[])),s=u.useMemo(()=>js(e,n,o).map(i=>`${i.sessionId}${te}${i.cwd}`).sort().join(D),[e,n,o]);return u.useMemo(()=>s.length===0?vs:s.split(D).map(i=>{const[a,r]=i.split(te);return{sessionId:a,cwd:r}}),[s])}function ys(e=[]){const n=at(),o=rt(),s=bs(),{data:i}=lt(),{data:a}=dt(),r=u.useMemo(()=>[...new Set(o.map(h=>h.roomId))].sort().join(`
2
+ `),[o]),l=u.useMemo(()=>r.length===0?[]:r.split(`
3
+ `),[r]),d=ct({queries:l.map(h=>({queryKey:ut.detail(h),queryFn:()=>n.getRoom(h)})),combine:h=>{const x={};for(const v of h)v.data!==void 0&&(x[v.data.id]=v.data);return x}}),c=u.useMemo(()=>{const h={};for(const x of i??[])h[x.id]=x;return h},[i]),m=u.useMemo(()=>((a==null?void 0:a.agents)??[]).map(h=>h.projectPath),[a]),{data:g}=mt(m),f=u.useMemo(()=>g??{},[g]),p=u.useMemo(()=>{const h={};for(const x of(a==null?void 0:a.agents)??[])h[x.projectPath]=x.id;return h},[a]),j=e.join(D);return u.useMemo(()=>{if(o.length===0&&s.length===0)return ee;const h=ps({claims:o,rosters:d,rooms:c,sessions:s,agents:f,meshIdByPath:p,excludeRoomIds:j.length===0?[]:j.split(D)});return h.length===0?ee:h},[o,d,c,s,f,p,j])}function Ns(e=[]){const n=ys(e),o=B(),{open:s}=ht(),i=u.useCallback(r=>{if(r.kind==="room"){Q.getState().recordOpened("room",r.roomId),o({...ae.channels(),search:{id:r.roomId}});return}r.cwd&&Q.getState().recordOpened("agent",r.cwd),o(z({session:r.sessionId,dir:r.cwd}))},[o]),a=u.useMemo(()=>t.jsx(ms,{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(jt,{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 Ss(){return t.jsxs(t.Fragment,{children:[t.jsx(gt,{children:"Home"}),t.jsx(ks,{})]})}function ks(){var g,f;const e=ft(),[n,o]=u.useState(!1),s=u.useCallback(()=>{const p=document.activeElement;bt(p)&&p.blur()},[]),{thread:i,entry:a}=ie({strict:!1}),r=xt(),l=Ns(e.room===null?[]:[e.room.id]),d=re(((g=e.room)==null?void 0:g.id)??null),c=pt(((f=e.room)==null?void 0:f.id)??null,null),m=d!==void 0&&d.length===0&&c.length===0;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(S,{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 p=e.room;return t.jsx(E,{title:`${le(p)} is archived`,action:t.jsx(S,{variant:"outline",size:"sm",className:"mt-2",disabled:r.isPending,onClick:()=>r.mutate({roomId:p.id}),children:r.isPending?"Bringing it back…":"Bring it back"}),children:"Its messages are safe."})}return t.jsx(rs,{children:t.jsx(yt,{roomId:e.room.id,threadId:i,entrySeq:a,threadRoute:"/",offerJumpBackIn:!0,onComposerFocusChange:o,aboveTimeline:t.jsxs(t.Fragment,{children:[t.jsx(Gt,{presence:l,composerFocused:n,onExpand:s}),t.jsx(ns,{roomId:e.room.id,presenceOccupied:l.occupied})]}),aboveComposer:m?t.jsx(Yt,{roomId:e.room.id}):void 0})})}const _s=Ss;export{_s as component};
@@ -1 +1 @@
1
- import{c$ as k,r as n,d0 as w,d1 as C,d2 as E,j as e,e as D,d3 as l,d4 as R,O as x,B as M,d5 as B,d6 as _,b0 as L,aJ as $,d7 as z,aN as G,d8 as H,d9 as K,$ as U,da as V,db as W}from"./index-DMYBI16t.js";import{P as N}from"./page-container-W7byjRmk.js";import{u as J,S as Q}from"./search-x-C6SAxw7a.js";import{S as X}from"./scroll-area-C95q3ss7.js";const q=8,Y={visible:{transition:{staggerChildren:.04}},hidden:{}},Z={hidden:{opacity:0,y:8},visible:{opacity:1,y:0}};function ee({tasks:o,isLoading:c,agentMap:u,onEditTask:j,agentId:h}){const t=J(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(()=>w(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(X,{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(Q,{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(M,{variant:"outline",size:"sm",onClick:t.clearAll,children:"Clear filters"})]}):e.jsx(x.div,{initial:"hidden",animate:"visible",variants:Y,className:"space-y-2",children:g.map((s,p)=>e.jsx(x.div,{variants:p<q?Z:void 0,transition:{duration:.15},children:e.jsx(B,{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}=$(o),[t,r]=n.useState(!1),[f,d]=n.useState(),[i,m]=n.useState(null),g=c.some(a=>a.agentId),{data:s}=z(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:T,clear:A}=G(),[v,y]=n.useState(!1);T&&!v&&!t?(y(!0),d(void 0),r(!0),A()):!T&&v&&y(!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 I=c.length>0;return e.jsxs(e.Fragment,{children:[!I&&!u?e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(N,{width:"full",children:e.jsx(V,{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(N,{width:"full",scroll:!1,children:e.jsx(ee,{tasks:c,isLoading:u,agentMap:p,onEditTask:O})})}),e.jsx(W,{open:t,onOpenChange:P,editTask:f,initialPreset:i})]})}const le=se;export{le as component};
1
+ import{d0 as k,r as n,d1 as w,d2 as C,d3 as E,j as e,e as D,d4 as l,d5 as R,U as x,B as M,d6 as B,d7 as _,b1 as L,aK as K,d8 as U,aO as z,d9 as G,da as H,Y as V,db as W,dc as Q}from"./index-Bbffv0TQ.js";import{P as N}from"./page-container-BOrdASM1.js";import{u as X,S as Y}from"./search-x-CoFJOP2l.js";import{S as $}from"./scroll-area-Dph6w3a6.js";const q=8,J={visible:{transition:{staggerChildren:.04}},hidden:{}},Z={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(()=>w(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(Y,{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(M,{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?Z:void 0,transition:{duration:.15},children:e.jsx(B,{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}=K(o),[t,r]=n.useState(!1),[f,d]=n.useState(),[i,m]=n.useState(null),g=c.some(a=>a.agentId),{data:s}=U(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:T,clear:A}=z(),[v,y]=n.useState(!1);T&&!v&&!t?(y(!0),d(void 0),r(!0),A()):!T&&v&&y(!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(G,{icon:H.tasks,name:"Scheduling",description:"Agents run tasks on a schedule, even while you’re away.",command:"dorkos --tasks"});if(j)return e.jsx(V,{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 I=c.length>0;return e.jsxs(e.Fragment,{children:[!I&&!u?e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(N,{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(N,{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};
@@ -0,0 +1 @@
1
+ import{a5 as j,ae as g,r as f,j as e,d7 as N,dd as i,an as b,de as y,df as w,a1 as u,dg as C,dh as T,c_ as p,di as c,dj as v,c$ as o,dk as k,aW as S}from"./index-Bbffv0TQ.js";import{P as L}from"./page-container-BOrdASM1.js";const F=["workspaces","scan"],P=6e4;function W(){var a,r,l;const s=j(),t=g({queryKey:F,queryFn:()=>s.scanWorktrees(),staleTime:P});return{root:((a=t.data)==null?void 0:a.root)??null,worktrees:((r=t.data)==null?void 0:r.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:r}=s;return r?"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 E({worktree:s}){const t=(s.changedFiles??0)>0;return e.jsxs(p,{children:[e.jsxs(o,{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(o,{className:"max-w-0",children:s.readable?s.branch?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(k,{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(o,{className:t?"text-status-warning-fg":"text-muted-foreground",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:A(s)})}),e.jsx(o,{className:"text-muted-foreground hidden md:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:B(s)})}),e.jsx(o,{className:"text-muted-foreground hidden sm:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:s.lastCommitAt?S(s.lastCommitAt):m})})]})}function H({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(C,{children:[e.jsx(T,{children:e.jsxs(p,{children:[e.jsx(c,{children:"Folder"}),e.jsx(c,{children:"Branch"}),e.jsx(c,{children:"Changes"}),e.jsx(c,{className:"hidden md:table-cell",children:"Compared to remote"}),e.jsx(c,{className:"hidden sm:table-cell",children:"Last commit"})]})}),e.jsx(v,{children:t.map(a=>e.jsx(E,{worktree:a},a.path))})]})})]})}function R(){const{root:s,worktrees:t,warnings:a,isLoading:r,isError:l}=W(),x=f.useMemo(()=>{const n=new Map;for(const d of t){const h=n.get(d.project)??[];h.push(d),n.set(d.project,h)}return[...n.entries()]},[t]);return e.jsxs(L,{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(n=>e.jsxs("li",{className:"truncate",title:n.path,children:[i(n.path)," (",n.reason,")"]},n.path))})]}),r?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(([n,d])=>e.jsx(H,{project:n,worktrees:d},n))})]})}const z=R;export{z as component};
@@ -1,10 +1,10 @@
1
- import{Y as Be,Q as ie,r as m,R as ve,gC as Ce,gD as B,gE as H,gF as Ge,bM as je,l as me,gG as We,d7 as Ve,j as t,B as D,ep as be,dH as Xe,dI as Ze,dJ as et,dK as tt,dL as st,I as nt,fG as Te,gH as rt,fH as Oe,fI as Ke,fJ as Ie,fK as $e,fL as ze,fM as Le,fN as at,gI as it,gJ as de,gK as pe,ft as ot,gL as Ne,gM as qe,gN as ct,gO as lt,gP as Ue,gQ as dt,gR as ut,d6 as Pe,gS as mt,gT as ft,gU as ht,gV as pt,W as gt,am as yt,es as xt,f9 as vt,ci as _e,gW as Ct,gX as jt,dr as Nt,n as Ae}from"./index-DMYBI16t.js";import{T as Rt,R as wt,a as St}from"./RoomSurface-CgtNuYhl.js";import{M as oe,C as ge}from"./index-DbbZNAKk.js";import{o as kt,a as bt,c as At}from"./owner-notice-CLsx0s7q.js";import"./use-jump-back-in-DWUPb1gi.js";import"./use-room-follow-claim-CyjhzbRJ.js";import"./UnreadDivider-KSqqcHKN.js";import"./format-duration-BCr6uzby.js";import"./hover-card-qzuFUCaR.js";import"./mention-pill-akMU3IVs.js";import"./rotate-ccw-clock-CNcDcTvq.js";import"./hand-DLUdsiuR.js";import"./message-square-off-DEagHpQY.js";import"./AgentRequestCard-BLLmoAES.js";import"./file-drag-GDx2qhdk.js";import"./index-CejezM4U.js";/**
1
+ import{V as Ge,a5 as ie,r as m,a6 as ve,gE as Ce,gF as G,gG as B,gH as He,bN as je,l as me,gI as We,d8 as Ve,j as t,B as M,er as be,dJ as Xe,dK as Ze,dL as et,dM as tt,dN as st,I as nt,fI as Te,gJ as rt,fJ as Oe,fK as Ke,fL as Ie,fM as $e,fN as ze,fO as Le,fP as at,gK as it,gL as de,gM as pe,fv as ot,gN as Ne,gO as qe,gP as ct,gQ as lt,gR as Pe,gS as dt,gT as ut,d7 as Ue,gU as mt,gV as ft,gW as ht,gX as pt,cP as gt,an as yt,eu as xt,fb as vt,ci as _e,gY as Ct,gZ as jt,ds as Nt,n as Ae}from"./index-Bbffv0TQ.js";import{T as Rt,R as wt,a as St}from"./RoomSurface-BwIBBvYq.js";import{M as oe,C as ge}from"./index-HgvJwMGi.js";import{o as kt,a as bt,c as At}from"./owner-notice-dtDSKfGs.js";import"./use-jump-back-in-BdLBzvDr.js";import"./use-room-follow-claim-BIK37Iy3.js";import"./UnreadDivider-Dh67_mAz.js";import"./format-duration-BCr6uzby.js";import"./hover-card-FvX18DHP.js";import"./mention-pill-BHC6tMG9.js";import"./rotate-ccw-clock-BvzfP8lR.js";import"./message-square-off-CEHuZJtY.js";import"./AgentRequestCard-D62XQXBM.js";import"./file-drag-GDx2qhdk.js";import"./index-xfBvKz-h.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Je={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"}]]};Je.node;const Et=Be(Je),Dt=500,se=new Map;function Qe(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 xe(e,s){if(s.size===0)return e;let r=!1;const i=e.map(h=>{const p=s.get(h.id),d=p?Qe(h,p):h;return d!==h&&(r=!0),d});return r?i:e}function ue(e,s,...r){const i=new Map;for(const h of r)for(const p of h){if(p.community!==e||p.roomId!==s)throw new Error("Community history contains a different room.");i.set(p.id,p)}return[...i.values()].sort((h,p)=>h.remoteSeq-p.remoteSeq)}function Mt(e,s,r=!0,i=0,h="legacy",p=!1,d){const a=ie(),l=m.useRef(d);m.useEffect(()=>{l.current=d},[d]);const y=ve(),u=Ce(!0,h,e),v=JSON.stringify([u==null?void 0:u.ownerKey,u==null?void 0:u.epoch,u==null?void 0:u.route.epoch,u==null?void 0:u.accessFingerprint,e,s]),[b,w]=m.useState(()=>({address:v,room:null,entries:[],revisions:se,deliveries:[],status:"connecting"}));return m.useEffect(()=>{if(!u||!r)return;const g=u,S=new AbortController;let O,$=0,U,z,_=!1;w({address:v,room:null,entries:[],revisions:se,deliveries:[],status:"connecting"});function G(){_=!0,U=void 0,z=void 0,y.removeQueries({queryKey:H.remote(g,e)}),w({address:v,room:null,entries:[],revisions:se,deliveries:[],status:"removed"})}async function K(){try{await a.subscribeRemoteCommunityRoom(e,s,f=>{var k;if(!(S.signal.aborted||_||!B(g))){if(f.type==="closed"){(f.reason==="removed"||f.reason==="revoked")&&G();return}if($=0,f.type==="snapshot")U=f.cursor??void 0,f.redactionCursor&&(z=f.redactionCursor),y.setQueryData(H.room(g,e,s),f.room),w(c=>({address:v,room:f.room,entries:xe(ue(e,s,c.address===v?c.entries:[],f.entries).slice(-500),c.address===v?c.revisions:se),revisions:c.address===v?c.revisions:se,deliveries:c.deliveries.filter(R=>!f.entries.some(j=>j.originIdempotencyKey===R.idempotencyKey)),status:f.stale?"offline":"live"}));else if(f.type==="revision"){const c=f.entry;f.redactionCursor&&(z=f.redactionCursor);const R=[...H.room(g,e,s),"entries"],L=y.getQueriesData({queryKey:R}).some(([,A])=>A==null?void 0:A.pages.some(M=>M.entries.some(Y=>Y.id===c.id)))||y.isFetching({queryKey:R})>0||((k=l.current)==null?void 0:k.call(l,c.id))===!0;y.setQueriesData({queryKey:R},A=>{if(!A)return A;let M=!1;const Y=A.pages.map(X=>{const Z=X.entries.map(ne=>Qe(ne,c));return Z.some((ne,o)=>ne!==X.entries[o])?(M=!0,{...X,entries:Z}):X});return M?{...A,pages:Y}:A}),w(A=>{if(!L&&!A.entries.some(Y=>Y.id===c.id))return A;const M=new Map(A.revisions);for(M.delete(c.id),M.set(c.id,c);M.size>Dt;)M.delete(M.keys().next().value);return{...A,entries:xe(A.entries,M),revisions:M}})}else f.type==="deliveries"?w(c=>({...c,deliveries:f.deliveries.filter(R=>!c.entries.some(j=>j.originIdempotencyKey===R.idempotencyKey))})):(U=f.entry.cursor,w(c=>({...c,entries:ue(e,s,c.entries,[f.entry]).slice(-500),deliveries:c.deliveries.filter(R=>R.idempotencyKey!==f.entry.originIdempotencyKey),status:"live"})))}},{since:U,redactions:z,signal:S.signal})}catch(f){if(S.signal.aborted||!B(g))return;const k=f&&typeof f=="object"&&"status"in f?f.status:void 0,c=f&&typeof f=="object"&&"code"in f?f.code:void 0;c==="COMMUNITY_DELETED"||c==="COMMUNITY_TAKEN_DOWN"?(G(),y.invalidateQueries({queryKey:H.connections(g)})):k===401||k===403||k===404?G():k===410&&c==="COMMUNITY_CURSOR_STALE"&&(U=void 0)}if(S.signal.aborted||_||!B(g))return;const V=y.getQueryData(H.room(g,e,s));V&&y.setQueryData(H.room(g,e,s),{...V,stale:!0,writable:!1}),w(f=>({...f,room:f.room?{...f.room,stale:!0,writable:!1}:null,status:"offline"})),O=setTimeout(()=>{K()},Math.min(3e4,1e3*2**Math.min($++,5)))}return K(),()=>{S.abort(),clearTimeout(O)}},[v,e,s,r,i,y,a,u,p]),b.address!==v||!u?{address:v,room:null,entries:[],revisions:se,deliveries:[],status:"connecting"}:r?b:p?{...b,room:b.room?{...b.room,stale:!0,writable:!1}:null,deliveries:[],status:"offline"}:{address:v,room:null,entries:[],revisions:se,deliveries:[],status:"removed"}}function Tt(e,s,r){var a;const i=Ge(),h=je(),p=e!==void 0&&((a=i.room)==null?void 0:a.id)===e,d=i.status!=="loading";return m.useEffect(()=>{p&&h({...me.home(),search:{...s===void 0?{}:{thread:s},...r===void 0?{}:{entry:r}},replace:!0})},[p,s,r,h]),e===void 0?"show":p?"redirecting":d?"show":"pending"}function Ot({community:e,roomId:s,online:r,canEnroll:i,accessFingerprint:h}){var k,c,R;const p=ie(),d=ve(),a=Ce(!0,h,e),l=We(e,i,h),y=Ve(),[u,v]=m.useState(""),[b,w]=m.useState(""),[g,S]=m.useState(!1),[O,$]=m.useState(null),[U,z]=m.useState(null),_=m.useId(),G=((k=l.data)==null?void 0:k.filter(j=>j.active))??[],K=((c=y.data)==null?void 0:c.agents.filter(j=>!G.some(L=>L.localAgentId===j.id)))??[];async function V(){a&&B(a)&&await d.invalidateQueries({queryKey:H.remote(a,e)})}async function f(j){if(j.preventDefault(),!u||g||!r||!i||!a)return;const L=a;S(!0),$(null);try{if(await p.enrollRemoteCommunityAgent(e,u,b.trim()?{handle:b.trim()}:{}),!B(L))return;v(""),w(""),await V()}catch(A){B(L)&&$(A instanceof Error?A.message:"Couldn’t add the agent. Try again.")}finally{B(L)&&S(!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."}),l.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(D,{variant:"ghost",size:"sm",onClick:()=>void l.refetch(),children:"Retry"})]}),(R=l.data)==null?void 0:R.map(j=>t.jsx(Kt,{agent:j,roomId:s,online:r,canEnroll:i,onChanged:V,onNotice:z},j.localAgentId)),y.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),i&&K.length>0&&t.jsxs("form",{onSubmit:j=>void f(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(be,{htmlFor:`${_}-agent`,children:"Local agent"}),t.jsxs(Xe,{value:u,onValueChange:v,disabled:!r||g,children:[t.jsx(Ze,{id:`${_}-agent`,children:t.jsx(et,{placeholder:"Choose an agent"})}),t.jsx(tt,{children:K.map(j=>t.jsx(st,{value:j.id,children:j.name},j.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(be,{htmlFor:`${_}-handle`,children:"Space handle (optional)"}),t.jsx(nt,{id:`${_}-handle`,value:b,onChange:j=>w(j.target.value),disabled:!r||g,placeholder:"Use the agent’s handle"})]}),t.jsx(D,{type:"submit",disabled:!u||!r||g,children:g?"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 Kt({agent:e,roomId:s,online:r,canEnroll:i,onChanged:h,onNotice:p}){const d=ie(),[a,l]=m.useState(null),[y,u]=m.useState(null),v=e.roomIds.includes(s);async function b(g,S){if(!a){l(g),u(null);try{await S(),await h()}catch(O){u(O instanceof Error?O.message:"Couldn’t finish that. Try again.")}finally{l(null)}}}function w(g){p(g.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(D,{variant:"outline",size:"sm",disabled:a!==null||!i||!e.active||!v&&!r,onClick:()=>void b("membership",async()=>{v?w(await d.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await d.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:v?"Leave channel":"Join channel"}),t.jsx(D,{variant:"ghost",size:"sm",disabled:a!==null||!i,onClick:()=>void b("stop",()=>d.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(Te,{children:[t.jsx(rt,{asChild:!0,children:t.jsx(D,{variant:"ghost",size:"sm",disabled:a!==null||!i,children:"Remove from space"})}),t.jsxs(Oe,{children:[t.jsxs(Ke,{children:[t.jsxs(Ie,{children:["Remove ",e.displayName,"?"]}),t.jsx($e,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(ze,{children:[t.jsx(Le,{children:"Cancel"}),t.jsx(at,{onClick:()=>void b("remove",async()=>w(await d.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),y&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:y})]})}const It=new Set(["COMMUNITY_DELETED","COMMUNITY_TAKEN_DOWN"]);function Ee(e){return e.filter(s=>s.trim()).join(`
6
+ */const Je={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"}]]};Je.node;const Et=Ge(Je),Mt=500,se=new Map;function Qe(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 xe(e,s){if(s.size===0)return e;let r=!1;const i=e.map(h=>{const p=s.get(h.id),d=p?Qe(h,p):h;return d!==h&&(r=!0),d});return r?i:e}function ue(e,s,...r){const i=new Map;for(const h of r)for(const p of h){if(p.community!==e||p.roomId!==s)throw new Error("Community history contains a different room.");i.set(p.id,p)}return[...i.values()].sort((h,p)=>h.remoteSeq-p.remoteSeq)}function Dt(e,s,r=!0,i=0,h="legacy",p=!1,d){const a=ie(),l=m.useRef(d);m.useEffect(()=>{l.current=d},[d]);const y=ve(),u=Ce(!0,h,e),v=JSON.stringify([u==null?void 0:u.ownerKey,u==null?void 0:u.epoch,u==null?void 0:u.route.epoch,u==null?void 0:u.accessFingerprint,e,s]),[b,w]=m.useState(()=>({address:v,room:null,entries:[],revisions:se,deliveries:[],status:"connecting"}));return m.useEffect(()=>{if(!u||!r)return;const g=u,S=new AbortController;let O,$=0,P,z,_=!1;w({address:v,room:null,entries:[],revisions:se,deliveries:[],status:"connecting"});function H(){_=!0,P=void 0,z=void 0,y.removeQueries({queryKey:B.remote(g,e)}),w({address:v,room:null,entries:[],revisions:se,deliveries:[],status:"removed"})}async function K(){try{await a.subscribeRemoteCommunityRoom(e,s,f=>{var k;if(!(S.signal.aborted||_||!G(g))){if(f.type==="closed"){(f.reason==="removed"||f.reason==="revoked")&&H();return}if($=0,f.type==="snapshot")P=f.cursor??void 0,f.redactionCursor&&(z=f.redactionCursor),y.setQueryData(B.room(g,e,s),f.room),w(c=>({address:v,room:f.room,entries:xe(ue(e,s,c.address===v?c.entries:[],f.entries).slice(-500),c.address===v?c.revisions:se),revisions:c.address===v?c.revisions:se,deliveries:c.deliveries.filter(R=>!f.entries.some(j=>j.originIdempotencyKey===R.idempotencyKey)),status:f.stale?"offline":"live"}));else if(f.type==="revision"){const c=f.entry;f.redactionCursor&&(z=f.redactionCursor);const R=[...B.room(g,e,s),"entries"],L=y.getQueriesData({queryKey:R}).some(([,A])=>A==null?void 0:A.pages.some(D=>D.entries.some(Y=>Y.id===c.id)))||y.isFetching({queryKey:R})>0||((k=l.current)==null?void 0:k.call(l,c.id))===!0;y.setQueriesData({queryKey:R},A=>{if(!A)return A;let D=!1;const Y=A.pages.map(X=>{const Z=X.entries.map(ne=>Qe(ne,c));return Z.some((ne,o)=>ne!==X.entries[o])?(D=!0,{...X,entries:Z}):X});return D?{...A,pages:Y}:A}),w(A=>{if(!L&&!A.entries.some(Y=>Y.id===c.id))return A;const D=new Map(A.revisions);for(D.delete(c.id),D.set(c.id,c);D.size>Mt;)D.delete(D.keys().next().value);return{...A,entries:xe(A.entries,D),revisions:D}})}else f.type==="deliveries"?w(c=>({...c,deliveries:f.deliveries.filter(R=>!c.entries.some(j=>j.originIdempotencyKey===R.idempotencyKey))})):(P=f.entry.cursor,w(c=>({...c,entries:ue(e,s,c.entries,[f.entry]).slice(-500),deliveries:c.deliveries.filter(R=>R.idempotencyKey!==f.entry.originIdempotencyKey),status:"live"})))}},{since:P,redactions:z,signal:S.signal})}catch(f){if(S.signal.aborted||!G(g))return;const k=f&&typeof f=="object"&&"status"in f?f.status:void 0,c=f&&typeof f=="object"&&"code"in f?f.code:void 0;c==="COMMUNITY_DELETED"||c==="COMMUNITY_TAKEN_DOWN"?(H(),y.invalidateQueries({queryKey:B.connections(g)})):k===401||k===403||k===404?H():k===410&&c==="COMMUNITY_CURSOR_STALE"&&(P=void 0)}if(S.signal.aborted||_||!G(g))return;const V=y.getQueryData(B.room(g,e,s));V&&y.setQueryData(B.room(g,e,s),{...V,stale:!0,writable:!1}),w(f=>({...f,room:f.room?{...f.room,stale:!0,writable:!1}:null,status:"offline"})),O=setTimeout(()=>{K()},Math.min(3e4,1e3*2**Math.min($++,5)))}return K(),()=>{S.abort(),clearTimeout(O)}},[v,e,s,r,i,y,a,u,p]),b.address!==v||!u?{address:v,room:null,entries:[],revisions:se,deliveries:[],status:"connecting"}:r?b:p?{...b,room:b.room?{...b.room,stale:!0,writable:!1}:null,deliveries:[],status:"offline"}:{address:v,room:null,entries:[],revisions:se,deliveries:[],status:"removed"}}function Tt(e,s,r){var a;const i=He(),h=je(),p=e!==void 0&&((a=i.room)==null?void 0:a.id)===e,d=i.status!=="loading";return m.useEffect(()=>{p&&h({...me.home(),search:{...s===void 0?{}:{thread:s},...r===void 0?{}:{entry:r}},replace:!0})},[p,s,r,h]),e===void 0?"show":p?"redirecting":d?"show":"pending"}function Ot({community:e,roomId:s,online:r,canEnroll:i,accessFingerprint:h}){var k,c,R;const p=ie(),d=ve(),a=Ce(!0,h,e),l=We(e,i,h),y=Ve(),[u,v]=m.useState(""),[b,w]=m.useState(""),[g,S]=m.useState(!1),[O,$]=m.useState(null),[P,z]=m.useState(null),_=m.useId(),H=((k=l.data)==null?void 0:k.filter(j=>j.active))??[],K=((c=y.data)==null?void 0:c.agents.filter(j=>!H.some(L=>L.localAgentId===j.id)))??[];async function V(){a&&G(a)&&await d.invalidateQueries({queryKey:B.remote(a,e)})}async function f(j){if(j.preventDefault(),!u||g||!r||!i||!a)return;const L=a;S(!0),$(null);try{if(await p.enrollRemoteCommunityAgent(e,u,b.trim()?{handle:b.trim()}:{}),!G(L))return;v(""),w(""),await V()}catch(A){G(L)&&$(A instanceof Error?A.message:"Couldn’t add the agent. Try again.")}finally{G(L)&&S(!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."}),l.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(M,{variant:"ghost",size:"sm",onClick:()=>void l.refetch(),children:"Retry"})]}),(R=l.data)==null?void 0:R.map(j=>t.jsx(Kt,{agent:j,roomId:s,online:r,canEnroll:i,onChanged:V,onNotice:z},j.localAgentId)),y.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),i&&K.length>0&&t.jsxs("form",{onSubmit:j=>void f(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(be,{htmlFor:`${_}-agent`,children:"Local agent"}),t.jsxs(Xe,{value:u,onValueChange:v,disabled:!r||g,children:[t.jsx(Ze,{id:`${_}-agent`,children:t.jsx(et,{placeholder:"Choose an agent"})}),t.jsx(tt,{children:K.map(j=>t.jsx(st,{value:j.id,children:j.name},j.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(be,{htmlFor:`${_}-handle`,children:"Space handle (optional)"}),t.jsx(nt,{id:`${_}-handle`,value:b,onChange:j=>w(j.target.value),disabled:!r||g,placeholder:"Use the agent’s handle"})]}),t.jsx(M,{type:"submit",disabled:!u||!r||g,children:g?"Adding…":"Add to space"})]}),P&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:P}),O&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:O})]})}function Kt({agent:e,roomId:s,online:r,canEnroll:i,onChanged:h,onNotice:p}){const d=ie(),[a,l]=m.useState(null),[y,u]=m.useState(null),v=e.roomIds.includes(s);async function b(g,S){if(!a){l(g),u(null);try{await S(),await h()}catch(O){u(O instanceof Error?O.message:"Couldn’t finish that. Try again.")}finally{l(null)}}}function w(g){p(g.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(M,{variant:"outline",size:"sm",disabled:a!==null||!i||!e.active||!v&&!r,onClick:()=>void b("membership",async()=>{v?w(await d.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await d.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:v?"Leave channel":"Join channel"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:a!==null||!i,onClick:()=>void b("stop",()=>d.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(Te,{children:[t.jsx(rt,{asChild:!0,children:t.jsx(M,{variant:"ghost",size:"sm",disabled:a!==null||!i,children:"Remove from space"})}),t.jsxs(Oe,{children:[t.jsxs(Ke,{children:[t.jsxs(Ie,{children:["Remove ",e.displayName,"?"]}),t.jsx($e,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(ze,{children:[t.jsx(Le,{children:"Cancel"}),t.jsx(at,{onClick:()=>void b("remove",async()=>w(await d.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),y&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:y})]})}const It=new Set(["COMMUNITY_DELETED","COMMUNITY_TAKEN_DOWN"]);function Ee(e){return e.filter(s=>s.trim()).join(`
7
7
 
8
- `)}function $t(e){const s=e==null?void 0:e.code;return typeof s=="string"&&It.has(s)}function ye(e){return e.map(({id:s,file:r})=>({id:s,file:r,status:"pending",progress:0}))}function zt({ref:e,roomId:s,canSend:r,entries:i,onReceipt:h,draft:p,ownerKey:d,contextKey:a=d}){const l=ie(),y=JSON.stringify([d,e,s,a]),u=it(p),v=u.text,b=m.useMemo(()=>ye(u.files),[u.files]),w=m.useRef(p);m.useLayoutEffect(()=>{w.current=p},[p]);function g(o){const x=w.current;if(!x)return;const N=de.getState(),I=N.drafts[pe(x)],T=o({text:(I==null?void 0:I.text)??"",files:ye((I==null?void 0:I.files)??[])});N.write(x,{text:T.text,files:T.files.map(({id:F,file:J})=>({id:F,file:J}))})}function S(o){g(x=>({...x,text:o}))}function O(o){g(x=>({...x,files:o(x.files)}))}const[$,U]=m.useState(null);function z(o){U(o===null?null:{address:y,context:a,message:o})}const[_,G]=m.useState([]),K=m.useRef(new Map),V=m.useRef(0),f=m.useRef(new Map),k=m.useRef(new Set),c=m.useRef(y),R=m.useRef(a),j=m.useRef(!0),L=m.useRef(r),A=m.useRef(h);m.useLayoutEffect(()=>{c.current=y,R.current=a,L.current=r,A.current=h},[y,r,a,h]),m.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]),m.useEffect(()=>{let o=!1;for(const x of i){if(!x.originIdempotencyKey)continue;const N=K.current.get(x.originIdempotencyKey);(N==null?void 0:N.address)===c.current&&N.context===R.current&&K.current.delete(x.originIdempotencyKey)&&(o=!0)}o&&G([...K.current.values()])},[i]);function M(){j.current&&G([...K.current.values()].filter(o=>o.address===c.current&&o.context===R.current).map(o=>({...o})))}async function Y(o){if(!(k.current.has(o.key)||!L.current||!j.current||o.address!==c.current)){k.current.add(o.key),o.status="sending",o.error=void 0,M();try{for(let N=o.attachmentIds.length;N<o.files.length;N++){if(!L.current||!j.current||o.address!==c.current)throw new Error("Reconnect to this channel, then try again.");const I=await l.uploadRemoteCommunityAttachment(o.ref,o.roomId,o.files[N].file,`${o.key}:file:${N}`);o.attachmentIds.push(I.id)}if(!L.current||!j.current||o.address!==c.current)throw new Error("Reconnect to this channel, then try again.");const x=await l.postRemoteCommunityEntry(o.ref,o.roomId,{text:o.text,parentEntryId:o.parentEntryId,attachmentIds:o.attachmentIds,idempotencyKey:o.key});K.current.delete(o.key),j.current&&o.address===c.current&&o.context===R.current&&A.current(x)}catch(x){if($t(x)&&X(o)){K.current.delete(o.key);return}o.status="failed",o.error=x instanceof Error?x.message:"Not confirmed. Try this message again."}finally{k.current.delete(o.key),M()}}}function X(o){const{draft:x}=o.origin,N=pe(x),I=de.getState(),T=I.drafts[N],F=(T==null?void 0:T.text)??"";let J=f.current.get(N)??[];const Q=Ee(J.map(P=>P.origin.typed));let W=F;Q&&F.startsWith(Q)?W=F.slice(Q.length).replace(/^\n+/,""):J=[];const re=[...J,o].sort((P,te)=>P.origin.seq-te.origin.seq),fe=new Set(re.flatMap(P=>P.files.map(te=>te.id))),q=[...re.flatMap(P=>P.files.map(({id:te,file:ce})=>({id:te,file:ce}))),...((T==null?void 0:T.files)??[]).filter(P=>!fe.has(P.id))];return I.write(x,{text:Ee([...re.map(P=>P.origin.typed),W]),files:q}),N in de.getState().drafts?(f.current.set(N,re),!0):!1}function Z(o){const x=w.current;if(!x||!L.current)return;const N=de.getState(),I=N.drafts[pe(x)];if(!I||!I.text.trim()&&I.files.length===0)return;if(K.current.size>=30){z("Too many messages waiting. Let them send, or retry them first.");return}const T=N.take(x),F=ye(T.files),J={address:y,context:a,ref:e,roomId:s,key:crypto.randomUUID(),text:T.text.trim()?T.text:F.map(Q=>Q.file.name).join(", "),parentEntryId:o,files:F,attachmentIds:[],status:"sending",origin:{draft:x,typed:T.text,seq:V.current+=1}};K.current.set(J.key,J),z(null),Y(J)}return{text:v,setText:S,attachments:{staged:b,add(o){if(o.some(x=>x.size>25*1024*1024)){z("Each file must be 25 MB or smaller.");return}O(x=>x.length+o.length>8?(z("Attach up to eight files to one message."),x):[...x,...o.map(N=>({id:crypto.randomUUID(),file:N,status:"pending",progress:0}))])},remove(o){O(x=>x.filter(N=>N.id!==o))},retry(){},cancel(){O(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:_.filter(o=>o.address===y&&o.context===a),error:($==null?void 0:$.address)===y&&$.context===a?$.message:null,send:Z,retry(o){const x=K.current.get(o);x&&Y(x)}}}function Lt({entry:e,onThread:s}){const r=ie(),i=m.useId(),[h,p]=m.useState(null),[d,a]=m.useState(null),l={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function y(u,v){if(d)return;a(u),p(null);let b;try{const w=await r.downloadRemoteCommunityAttachment(e.community,e.roomId,u);b=URL.createObjectURL(w);const g=document.createElement("a");g.href=b,g.download=Array.from(v,S=>S==="/"||S==="\\"||S.charCodeAt(0)<32?"_":S).join(""),document.body.append(g),g.click(),g.remove()}catch(w){p(w instanceof Error?w.message:"Couldn’t download the file. Try again.")}finally{b&&setTimeout(()=>URL.revokeObjectURL(b),1e3),a(null)}}return t.jsxs(oe.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":i,children:[t.jsx(oe.Gutter,{author:l,at:e.createdAt}),t.jsxs(oe.Body,{children:[t.jsx(oe.Author,{id:i,author:l,at:e.createdAt}),t.jsxs(oe.Content,{children:[t.jsx(ot,{content:e.text}),e.attachments.map(u=>t.jsx(D,{variant:"outline",size:"sm",disabled:d!==null,onClick:()=>void y(u.id,u.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:d===u.id?"Downloading…":u.name})},u.id)),h&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:h}),t.jsx(D,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"})]})]})]})}function qt(e,s){var p;const r=new Map;for(const d of e)d.thread&&r.set(d.id,{count:d.thread.replyCount,lastAt:d.thread.lastReplyAt,through:d.threadLastReplySeq});const i=new Map;for(const d of s){const a=d.threadRootEntryId;if(d.depth===0||a===null)continue;const l=(p=r.get(a))==null?void 0:p.through;if(l!==void 0&&d.remoteSeq<=l)continue;const y=i.get(a);i.set(a,{count:((y==null?void 0:y.count)??0)+1,newest:y&&y.newest.remoteSeq>d.remoteSeq?y.newest:d})}const h=new Map;for(const d of new Set([...r.keys(),...i.keys()])){const a=r.get(d),l=i.get(d),y=a===void 0?l.count:a.through===void 0?Math.max(a.count,(l==null?void 0:l.count)??0):a.count+((l==null?void 0:l.count)??0);h.set(d,{count:y,lastAt:(l==null?void 0:l.newest.createdAt)??a.lastAt,unread:0})}return h}const Ut={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function Pt({community:e,roomId:s,threadId:r,onThread:i}){var Re,we,Se,ke;const h=ie(),d=(Re=Ne().data)==null?void 0:Re.find(n=>n.ref===e),a=qe(d==null?void 0:d.access),l=Ce(!0,a.fingerprint,e),y=l?JSON.stringify([l.ownerKey,l.epoch]):"",u=l?JSON.stringify([l.ownerKey,l.epoch,l.route.epoch,l.accessFingerprint]):"",v=ve(),b=ct(),w=lt(),g=(we=b.data)==null?void 0:we.destinations.find(n=>n.ref===e&&n.roomId===s),S=m.useRef(null),O=m.useRef(void 0),$=(g==null?void 0:g.scrollAnchorEntryId)??null,U=m.useCallback(n=>{if(!l)return;S.current&&clearTimeout(S.current),S.current=null;const C=n??null,E=O.current===void 0?$:O.current;C===null&&E===null||(S.current=setTimeout(()=>{S.current=null,O.current=C,w.mutate({ref:e,roomId:s,threadId:r??null,scrollAnchorEntryId:C})},400))},[l,e,w,$,s,r]);m.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]),m.useEffect(()=>{(d==null?void 0:d.status)==="reconnect-required"&&l&&v.removeQueries({queryKey:H.remote(l,e)})},[l,e,d==null?void 0:d.status,v]);const z=Ue(e,s,a.capabilities.read,a.fingerprint),[_,G]=m.useState(0),K=m.useRef([]),V=m.useCallback(n=>K.current.some(C=>C.id===n),[]),f=Mt(e,s,a.capabilities.stream,_,a.fingerprint,a.cacheReadable,V),k=f.status==="removed",c=k?null:f.room??z.data,R=dt(e,s,r,!k&&a.capabilities.read&&(c==null?void 0:c.readable)===!0,a.fingerprint),j=ut(e,s,!k&&a.capabilities.read&&(c==null?void 0:c.readable)===!0,a.fingerprint),[L,A]=m.useState(()=>({address:u,entries:[]})),M=m.useMemo(()=>L.address===u?L.entries:[],[u,L]);m.useEffect(()=>{K.current=M},[M]);const[Y,X]=m.useState(0),[Z,ne]=m.useState(!1),[o,x]=m.useState({address:"",name:null,error:null}),N=o.address===u?o.name:null,I=o.address===u?o.error:null,T=m.useRef(null),F=m.useRef(null),J=m.useRef(null),Q=!k&&a.capabilities.post&&f.status==="live"&&(c==null?void 0:c.writable)===!0,W=m.useMemo(()=>{var n;return k?[]:xe(ue(e,s,...((n=R.data)==null?void 0:n.pages.map(C=>C.entries))??[],f.entries,M),f.revisions)},[e,s,R.data,f.entries,f.revisions,M,k]),re=m.useCallback(n=>{A(C=>({address:u,entries:ue(e,s,C.address===u?C.entries:[],[n]).slice(-500)})),X(C=>C+1)},[u,e,s]);m.useLayoutEffect(()=>{var n;Y>0&&((n=J.current)==null||n.scrollToBottom())},[Y]);const fe=m.useMemo(()=>{var n;return l?{ownerKey:l.ownerKey,epoch:l.epoch,ref:e,generation:((n=l.connection)==null?void 0:n.generation)??0,roomId:s,threadId:r}:null},[l,e,s,r]),q=zt({ref:e,roomId:s,canSend:Q,entries:W,onReceipt:re,draft:fe,ownerKey:y||"unresolved",contextKey:u||"unresolved"}),P=W.filter(n=>r?n.id===r||n.threadRootEntryId===r:n.depth===0),te=m.useMemo(()=>{var n;return r?new Map:qt(((n=R.data)==null?void 0:n.pages.flatMap(C=>C.entries))??[],W)},[r,R.data,W]),ce=P.flatMap(n=>{const C=te.get(n.id);return C?[{kind:"message",entry:n},{kind:"replies",rootId:n.id,summary:C}]:[{kind:"message",entry:n}]}),Fe=ce.map(n=>n.kind==="replies"?{kind:"thread-reply",id:`${n.rootId}:replies`,rootId:n.rootId,replyCount:n.summary.count,lastAt:n.summary.lastAt}:{kind:"message",id:n.entry.id,payload:n.entry,grouping:{position:"only"},author:{id:JSON.stringify([e,n.entry.authorId]),kind:n.entry.authorKind,displayName:n.entry.authorDisplayName},at:n.entry.createdAt}),he={kind:"room",id:JSON.stringify([e,s,r]),placeholder:r?"Reply in thread…":`Message ${(c==null?void 0:c.title)??"this channel"}…`,canSend:Q,canSendReason:k?"You no longer have access to this channel.":!a.capabilities.post&&a.cacheReadable?"This space is read-only.":c!=null&&c.archived?"This channel is archived.":c!=null&&c.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:q.attachments,async send(){q.send(r)}};async function le(n,C){if(N||!l)return;const E=l,ae=u;x({address:ae,name:n,error:null});try{if(await C(),!B(E))return;(n==="join"||n==="leave"||n.startsWith("retry:"))&&G(ee=>ee+1),await v.invalidateQueries({queryKey:H.remote(E,e)})}catch(ee){B(E)&&x({address:ae,name:n,error:ee instanceof Error?ee.message:"Couldn’t finish that. Try again."})}finally{B(E)&&x(ee=>ee.address===ae?{...ee,name:null}:ee)}}function He(){var E;const n=W.at(-1);if(r||R.hasNextPage||!n||f.status!=="live"||((E=T.current)==null?void 0:E.address)===u&&T.current.cursor===n.cursor||!l)return;const C=l;T.current={address:u,cursor:n.cursor},h.setRemoteCommunityReadCursor(e,s,n.cursor).then(()=>{B(C)&&v.invalidateQueries({queryKey:H.rooms(C,e)})}).catch(()=>{var ae;((ae=T.current)==null?void 0:ae.address)===u&&(T.current=null)})}return t.jsx(ge.Root,{surface:"room",capabilities:Ut,target:he,children:t.jsxs("section",{className:"flex h-full min-h-0 flex-col","aria-label":(c==null?void 0:c.title)??"Space channel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-3 py-2",children:[r&&t.jsx(D,{variant:"ghost",size:"sm",onClick:()=>i(),children:"Back to channel"}),!k&&a.capabilities.post&&c&&!c.joined&&!c.stale&&t.jsx(D,{size:"sm",disabled:N!==null,onClick:()=>void le("join",()=>h.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),a.cacheReadable&&t.jsx(D,{variant:"ghost",size:"sm",disabled:k,onClick:()=>ne(!Z),children:Z?"Hide members":"Members"}),a.capabilities.enrollAgent&&t.jsx(D,{variant:"outline",size:"sm",disabled:N!==null,onClick:()=>void le("stop",()=>h.haltRemoteCommunityRoom(e,s)),children:N==="stop"?"Stopping…":"Stop my agents"}),a.capabilities.post&&(c==null?void 0:c.joined)&&t.jsx(D,{variant:"ghost",size:"sm",disabled:N!==null||!Q,onClick:()=>void le("leave",async()=>{await h.leaveRemoteCommunityRoom(e,s),l&&v.removeQueries({queryKey:H.room(l,e,s)})}),children:"Leave channel"})]}),I&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:I}),k?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[f.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:f.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),z.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),Z&&t.jsxs("div",{className:"max-h-48 overflow-auto border-b p-3","aria-label":"Channel members",children:[j.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load members."}),((Se=j.data)==null?void 0:Se.stale)&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved member list"}),(ke=j.data)==null?void 0:ke.members.map(n=>{var C;return t.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[t.jsxs("span",{children:[n.displayName,n.kind==="agent"?" · Agent":"",n.ownerMemberId&&` · owned by ${((C=j.data.members.find(E=>E.memberId===n.ownerMemberId))==null?void 0:C.displayName)??"a space member"}`]}),n.handle&&t.jsxs(D,{variant:"ghost",size:"sm",disabled:!Q,onClick:()=>{var E;q.setText(`${q.text}${q.text&&!q.text.endsWith(" ")?" ":""}@${n.handle} `),(E=F.current)==null||E.focus()},children:["Mention @",n.handle]})]},n.memberId)}),a.capabilities.enrollAgent&&t.jsx(Ot,{community:e,roomId:s,online:f.status==="live",canEnroll:!0,accessFingerprint:a.fingerprint},u)]}),R.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(D,{variant:"ghost",size:"sm",onClick:()=>void R.refetch(),children:"Retry"})]}),R.hasNextPage&&t.jsx(D,{variant:"ghost",size:"sm",disabled:R.isFetchingNextPage,onClick:()=>void R.fetchNextPage(),children:"Load the next page of history"}),t.jsx(ge.Timeline,{ref:J,conversationId:he.id,rows:Fe,label:r?"Space thread":"Space messages",busy:R.isFetching,resumeRow:()=>(g==null?void 0:g.scrollAnchorEntryId)??void 0,onTopRow:U,onReachedBottom:He,onOpenThread:i,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:R.isPending?"Loading messages…":"No messages here yet."}),renderRow:(n,C)=>{const E=ce[C.index];return E.kind==="message"?t.jsx(Lt,{entry:E.entry,onThread:i}):t.jsx(Rt,{summary:E.summary,open:!1,onOpen:()=>i(E.rootId)})}}),f.deliveries.filter(n=>n.parentEntryId===(r??null)&&!W.some(C=>C.originIdempotencyKey===n.idempotencyKey)).map(n=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[n.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:n.text}),n.attachments.map((C,E)=>t.jsx("span",{className:"mr-2",children:C.name},E)),t.jsx("p",{className:"text-muted-foreground",children:n.state==="pending"?"Waiting for the space to confirm…":n.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),n.state==="pending"&&n.retryable&&t.jsx(D,{variant:"outline",size:"sm",disabled:!Q||N!==null,onClick:()=>void le(`retry:${n.idempotencyKey}`,()=>h.retryRemoteCommunityDelivery(e,s,n.idempotencyKey)),children:N===`retry:${n.idempotencyKey}`?"Retrying…":"Retry now"})]},n.idempotencyKey)),q.deliveries.filter(n=>n.parentEntryId===r&&!W.some(C=>C.originIdempotencyKey===n.key)).map(n=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:n.text}),n.files.map(C=>t.jsx("span",{className:"mr-2",children:C.file.name},C.id)),t.jsx("p",{className:"text-muted-foreground",children:n.status==="sending"?"Sending…":"Delivery not confirmed."}),n.error&&t.jsx("p",{children:n.error}),n.status==="failed"&&t.jsx(D,{variant:"outline",size:"sm",disabled:!Q,onClick:()=>q.retry(n.key),children:"Retry message"})]},n.key)),q.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:q.error}),t.jsx(ge.Composer,{inputRef:F,className:"m-3",value:q.text,onChange:q.setText,onSubmit:()=>q.send(r),input:{isStreaming:!1,contextKey:he.id,canSubmit:q.text.trim().length>0||q.attachments.staged.length>0}})]})]})})}function _t({community:e,roomId:s}){var y,u;const r=Ne(),i=(y=r.data)==null?void 0:y.find(v=>v.ref===e),h=qe(i==null?void 0:i.access),p=Ue(e,s??"",!!s&&h.capabilities.read,h.fingerprint),d=(i==null?void 0:i.label)??"Space",a=s?(u=p.data)==null?void 0:u.title:void 0,l=i===void 0&&r.fetchStatus==="fetching"||s!==void 0&&a===void 0&&p.fetchStatus==="fetching";return t.jsx(Pe,{pending:l,children:a?`${d} · ${a}`:d})}function Ye(e){var s,r,i,h;return!e||e.status==="reconnect-required"?null:((r=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:r.lifecycle)==="deleted"?"deleted":((h=(i=e.access)==null?void 0:i.lastKnown)==null?void 0:h.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function De(e,s,r){return`${e} ${e===1?s:r}`}function Jt(e,s){const r=[e>0?De(e,"message from your agents","messages from your agents"):null,s>0?De(s,"draft of yours","drafts of yours"):null].filter(h=>h!==null);if(r.length===0)return null;const i=r.length===1&&(e===1||s===1);return`${r.join(" and ")} ${i?"wasn’t":"weren’t"} sent.`}function Qt({connection:e,onRemoved:s}){const r=Ye(e),i=mt(),[h,p]=m.useState(!1),{ownerKey:d}=ft(),a=ht(d,e.ref),{copied:l,failed:y,copy:u}=pt(),v=e.label,b=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function w(){i.mutate(e,{onSuccess:()=>{p(!1),gt.success(`${v} is removed from DorkOS.`),s()}})}const g=r==="deleted"||r==="taken-down",S=r==="taken-down"?"This space was taken down":r==="deleted"?"This space was deleted":"This space seems to be gone",O=r==="taken-down"?`DorkOS removed its copy here. If ${v} returns, you can connect again.`:r==="deleted"?"DorkOS removed its copy from this computer.":`Since ${b}, ${v} says it doesn’t exist. Its channels, messages and files are still here.`,$=Jt(g?e.undeliveredAgentMessages??0:0,a.length),U=a.length===0?null:a.length===1?"Your unsent draft is cleared too.":`Your ${a.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(Et,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:S}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:O}),$&&t.jsx("p",{role:"status",className:"text-foreground max-w-sm","data-testid":"community-gone-unsent",children:$}),t.jsx("span",{className:"sr-only","aria-live":"polite","data-testid":"community-gone-copy-status",children:l?"Copied.":y?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[a.length>0&&t.jsx(D,{variant:"outline",onClick:()=>void u(a.join(`
8
+ `)}function $t(e){const s=e==null?void 0:e.code;return typeof s=="string"&&It.has(s)}function ye(e){return e.map(({id:s,file:r})=>({id:s,file:r,status:"pending",progress:0}))}function zt({ref:e,roomId:s,canSend:r,entries:i,onReceipt:h,draft:p,ownerKey:d,contextKey:a=d}){const l=ie(),y=JSON.stringify([d,e,s,a]),u=it(p),v=u.text,b=m.useMemo(()=>ye(u.files),[u.files]),w=m.useRef(p);m.useLayoutEffect(()=>{w.current=p},[p]);function g(o){const x=w.current;if(!x)return;const N=de.getState(),I=N.drafts[pe(x)],T=o({text:(I==null?void 0:I.text)??"",files:ye((I==null?void 0:I.files)??[])});N.write(x,{text:T.text,files:T.files.map(({id:F,file:J})=>({id:F,file:J}))})}function S(o){g(x=>({...x,text:o}))}function O(o){g(x=>({...x,files:o(x.files)}))}const[$,P]=m.useState(null);function z(o){P(o===null?null:{address:y,context:a,message:o})}const[_,H]=m.useState([]),K=m.useRef(new Map),V=m.useRef(0),f=m.useRef(new Map),k=m.useRef(new Set),c=m.useRef(y),R=m.useRef(a),j=m.useRef(!0),L=m.useRef(r),A=m.useRef(h);m.useLayoutEffect(()=>{c.current=y,R.current=a,L.current=r,A.current=h},[y,r,a,h]),m.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]),m.useEffect(()=>{let o=!1;for(const x of i){if(!x.originIdempotencyKey)continue;const N=K.current.get(x.originIdempotencyKey);(N==null?void 0:N.address)===c.current&&N.context===R.current&&K.current.delete(x.originIdempotencyKey)&&(o=!0)}o&&H([...K.current.values()])},[i]);function D(){j.current&&H([...K.current.values()].filter(o=>o.address===c.current&&o.context===R.current).map(o=>({...o})))}async function Y(o){if(!(k.current.has(o.key)||!L.current||!j.current||o.address!==c.current)){k.current.add(o.key),o.status="sending",o.error=void 0,D();try{for(let N=o.attachmentIds.length;N<o.files.length;N++){if(!L.current||!j.current||o.address!==c.current)throw new Error("Reconnect to this channel, then try again.");const I=await l.uploadRemoteCommunityAttachment(o.ref,o.roomId,o.files[N].file,`${o.key}:file:${N}`);o.attachmentIds.push(I.id)}if(!L.current||!j.current||o.address!==c.current)throw new Error("Reconnect to this channel, then try again.");const x=await l.postRemoteCommunityEntry(o.ref,o.roomId,{text:o.text,parentEntryId:o.parentEntryId,attachmentIds:o.attachmentIds,idempotencyKey:o.key});K.current.delete(o.key),j.current&&o.address===c.current&&o.context===R.current&&A.current(x)}catch(x){if($t(x)&&X(o)){K.current.delete(o.key);return}o.status="failed",o.error=x instanceof Error?x.message:"Not confirmed. Try this message again."}finally{k.current.delete(o.key),D()}}}function X(o){const{draft:x}=o.origin,N=pe(x),I=de.getState(),T=I.drafts[N],F=(T==null?void 0:T.text)??"";let J=f.current.get(N)??[];const Q=Ee(J.map(U=>U.origin.typed));let W=F;Q&&F.startsWith(Q)?W=F.slice(Q.length).replace(/^\n+/,""):J=[];const re=[...J,o].sort((U,te)=>U.origin.seq-te.origin.seq),fe=new Set(re.flatMap(U=>U.files.map(te=>te.id))),q=[...re.flatMap(U=>U.files.map(({id:te,file:ce})=>({id:te,file:ce}))),...((T==null?void 0:T.files)??[]).filter(U=>!fe.has(U.id))];return I.write(x,{text:Ee([...re.map(U=>U.origin.typed),W]),files:q}),N in de.getState().drafts?(f.current.set(N,re),!0):!1}function Z(o){const x=w.current;if(!x||!L.current)return;const N=de.getState(),I=N.drafts[pe(x)];if(!I||!I.text.trim()&&I.files.length===0)return;if(K.current.size>=30){z("Too many messages waiting. Let them send, or retry them first.");return}const T=N.take(x),F=ye(T.files),J={address:y,context:a,ref:e,roomId:s,key:crypto.randomUUID(),text:T.text.trim()?T.text:F.map(Q=>Q.file.name).join(", "),parentEntryId:o,files:F,attachmentIds:[],status:"sending",origin:{draft:x,typed:T.text,seq:V.current+=1}};K.current.set(J.key,J),z(null),Y(J)}return{text:v,setText:S,attachments:{staged:b,add(o){if(o.some(x=>x.size>25*1024*1024)){z("Each file must be 25 MB or smaller.");return}O(x=>x.length+o.length>8?(z("Attach up to eight files to one message."),x):[...x,...o.map(N=>({id:crypto.randomUUID(),file:N,status:"pending",progress:0}))])},remove(o){O(x=>x.filter(N=>N.id!==o))},retry(){},cancel(){O(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:_.filter(o=>o.address===y&&o.context===a),error:($==null?void 0:$.address)===y&&$.context===a?$.message:null,send:Z,retry(o){const x=K.current.get(o);x&&Y(x)}}}function Lt({entry:e,onThread:s}){const r=ie(),i=m.useId(),[h,p]=m.useState(null),[d,a]=m.useState(null),l={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function y(u,v){if(d)return;a(u),p(null);let b;try{const w=await r.downloadRemoteCommunityAttachment(e.community,e.roomId,u);b=URL.createObjectURL(w);const g=document.createElement("a");g.href=b,g.download=Array.from(v,S=>S==="/"||S==="\\"||S.charCodeAt(0)<32?"_":S).join(""),document.body.append(g),g.click(),g.remove()}catch(w){p(w instanceof Error?w.message:"Couldn’t download the file. Try again.")}finally{b&&setTimeout(()=>URL.revokeObjectURL(b),1e3),a(null)}}return t.jsxs(oe.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":i,children:[t.jsx(oe.Gutter,{author:l,at:e.createdAt}),t.jsxs(oe.Body,{children:[t.jsx(oe.Author,{id:i,author:l,at:e.createdAt}),t.jsxs(oe.Content,{children:[t.jsx(ot,{content:e.text}),e.attachments.map(u=>t.jsx(M,{variant:"outline",size:"sm",disabled:d!==null,onClick:()=>void y(u.id,u.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:d===u.id?"Downloading…":u.name})},u.id)),h&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:h}),t.jsx(M,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"})]})]})]})}function qt(e,s){var p;const r=new Map;for(const d of e)d.thread&&r.set(d.id,{count:d.thread.replyCount,lastAt:d.thread.lastReplyAt,through:d.threadLastReplySeq});const i=new Map;for(const d of s){const a=d.threadRootEntryId;if(d.depth===0||a===null)continue;const l=(p=r.get(a))==null?void 0:p.through;if(l!==void 0&&d.remoteSeq<=l)continue;const y=i.get(a);i.set(a,{count:((y==null?void 0:y.count)??0)+1,newest:y&&y.newest.remoteSeq>d.remoteSeq?y.newest:d})}const h=new Map;for(const d of new Set([...r.keys(),...i.keys()])){const a=r.get(d),l=i.get(d),y=a===void 0?l.count:a.through===void 0?Math.max(a.count,(l==null?void 0:l.count)??0):a.count+((l==null?void 0:l.count)??0);h.set(d,{count:y,lastAt:(l==null?void 0:l.newest.createdAt)??a.lastAt,unread:0})}return h}const Pt={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function Ut({community:e,roomId:s,threadId:r,onThread:i}){var Re,we,Se,ke;const h=ie(),d=(Re=Ne().data)==null?void 0:Re.find(n=>n.ref===e),a=qe(d==null?void 0:d.access),l=Ce(!0,a.fingerprint,e),y=l?JSON.stringify([l.ownerKey,l.epoch]):"",u=l?JSON.stringify([l.ownerKey,l.epoch,l.route.epoch,l.accessFingerprint]):"",v=ve(),b=ct(),w=lt(),g=(we=b.data)==null?void 0:we.destinations.find(n=>n.ref===e&&n.roomId===s),S=m.useRef(null),O=m.useRef(void 0),$=(g==null?void 0:g.scrollAnchorEntryId)??null,P=m.useCallback(n=>{if(!l)return;S.current&&clearTimeout(S.current),S.current=null;const C=n??null,E=O.current===void 0?$:O.current;C===null&&E===null||(S.current=setTimeout(()=>{S.current=null,O.current=C,w.mutate({ref:e,roomId:s,threadId:r??null,scrollAnchorEntryId:C})},400))},[l,e,w,$,s,r]);m.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]),m.useEffect(()=>{(d==null?void 0:d.status)==="reconnect-required"&&l&&v.removeQueries({queryKey:B.remote(l,e)})},[l,e,d==null?void 0:d.status,v]);const z=Pe(e,s,a.capabilities.read,a.fingerprint),[_,H]=m.useState(0),K=m.useRef([]),V=m.useCallback(n=>K.current.some(C=>C.id===n),[]),f=Dt(e,s,a.capabilities.stream,_,a.fingerprint,a.cacheReadable,V),k=f.status==="removed",c=k?null:f.room??z.data,R=dt(e,s,r,!k&&a.capabilities.read&&(c==null?void 0:c.readable)===!0,a.fingerprint),j=ut(e,s,!k&&a.capabilities.read&&(c==null?void 0:c.readable)===!0,a.fingerprint),[L,A]=m.useState(()=>({address:u,entries:[]})),D=m.useMemo(()=>L.address===u?L.entries:[],[u,L]);m.useEffect(()=>{K.current=D},[D]);const[Y,X]=m.useState(0),[Z,ne]=m.useState(!1),[o,x]=m.useState({address:"",name:null,error:null}),N=o.address===u?o.name:null,I=o.address===u?o.error:null,T=m.useRef(null),F=m.useRef(null),J=m.useRef(null),Q=!k&&a.capabilities.post&&f.status==="live"&&(c==null?void 0:c.writable)===!0,W=m.useMemo(()=>{var n;return k?[]:xe(ue(e,s,...((n=R.data)==null?void 0:n.pages.map(C=>C.entries))??[],f.entries,D),f.revisions)},[e,s,R.data,f.entries,f.revisions,D,k]),re=m.useCallback(n=>{A(C=>({address:u,entries:ue(e,s,C.address===u?C.entries:[],[n]).slice(-500)})),X(C=>C+1)},[u,e,s]);m.useLayoutEffect(()=>{var n;Y>0&&((n=J.current)==null||n.scrollToBottom())},[Y]);const fe=m.useMemo(()=>{var n;return l?{ownerKey:l.ownerKey,epoch:l.epoch,ref:e,generation:((n=l.connection)==null?void 0:n.generation)??0,roomId:s,threadId:r}:null},[l,e,s,r]),q=zt({ref:e,roomId:s,canSend:Q,entries:W,onReceipt:re,draft:fe,ownerKey:y||"unresolved",contextKey:u||"unresolved"}),U=W.filter(n=>r?n.id===r||n.threadRootEntryId===r:n.depth===0),te=m.useMemo(()=>{var n;return r?new Map:qt(((n=R.data)==null?void 0:n.pages.flatMap(C=>C.entries))??[],W)},[r,R.data,W]),ce=U.flatMap(n=>{const C=te.get(n.id);return C?[{kind:"message",entry:n},{kind:"replies",rootId:n.id,summary:C}]:[{kind:"message",entry:n}]}),Fe=ce.map(n=>n.kind==="replies"?{kind:"thread-reply",id:`${n.rootId}:replies`,rootId:n.rootId,replyCount:n.summary.count,lastAt:n.summary.lastAt}:{kind:"message",id:n.entry.id,payload:n.entry,grouping:{position:"only"},author:{id:JSON.stringify([e,n.entry.authorId]),kind:n.entry.authorKind,displayName:n.entry.authorDisplayName},at:n.entry.createdAt}),he={kind:"room",id:JSON.stringify([e,s,r]),placeholder:r?"Reply in thread…":`Message ${(c==null?void 0:c.title)??"this channel"}…`,canSend:Q,canSendReason:k?"You no longer have access to this channel.":!a.capabilities.post&&a.cacheReadable?"This space is read-only.":c!=null&&c.archived?"This channel is archived.":c!=null&&c.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:q.attachments,async send(){q.send(r)}};async function le(n,C){if(N||!l)return;const E=l,ae=u;x({address:ae,name:n,error:null});try{if(await C(),!G(E))return;(n==="join"||n==="leave"||n.startsWith("retry:"))&&H(ee=>ee+1),await v.invalidateQueries({queryKey:B.remote(E,e)})}catch(ee){G(E)&&x({address:ae,name:n,error:ee instanceof Error?ee.message:"Couldn’t finish that. Try again."})}finally{G(E)&&x(ee=>ee.address===ae?{...ee,name:null}:ee)}}function Be(){var E;const n=W.at(-1);if(r||R.hasNextPage||!n||f.status!=="live"||((E=T.current)==null?void 0:E.address)===u&&T.current.cursor===n.cursor||!l)return;const C=l;T.current={address:u,cursor:n.cursor},h.setRemoteCommunityReadCursor(e,s,n.cursor).then(()=>{G(C)&&v.invalidateQueries({queryKey:B.rooms(C,e)})}).catch(()=>{var ae;((ae=T.current)==null?void 0:ae.address)===u&&(T.current=null)})}return t.jsx(ge.Root,{surface:"room",capabilities:Pt,target:he,children:t.jsxs("section",{className:"flex h-full min-h-0 flex-col","aria-label":(c==null?void 0:c.title)??"Space channel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-3 py-2",children:[r&&t.jsx(M,{variant:"ghost",size:"sm",onClick:()=>i(),children:"Back to channel"}),!k&&a.capabilities.post&&c&&!c.joined&&!c.stale&&t.jsx(M,{size:"sm",disabled:N!==null,onClick:()=>void le("join",()=>h.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),a.cacheReadable&&t.jsx(M,{variant:"ghost",size:"sm",disabled:k,onClick:()=>ne(!Z),children:Z?"Hide members":"Members"}),a.capabilities.enrollAgent&&t.jsx(M,{variant:"outline",size:"sm",disabled:N!==null,onClick:()=>void le("stop",()=>h.haltRemoteCommunityRoom(e,s)),children:N==="stop"?"Stopping…":"Stop my agents"}),a.capabilities.post&&(c==null?void 0:c.joined)&&t.jsx(M,{variant:"ghost",size:"sm",disabled:N!==null||!Q,onClick:()=>void le("leave",async()=>{await h.leaveRemoteCommunityRoom(e,s),l&&v.removeQueries({queryKey:B.room(l,e,s)})}),children:"Leave channel"})]}),I&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:I}),k?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[f.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:f.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),z.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),Z&&t.jsxs("div",{className:"max-h-48 overflow-auto border-b p-3","aria-label":"Channel members",children:[j.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load members."}),((Se=j.data)==null?void 0:Se.stale)&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved member list"}),(ke=j.data)==null?void 0:ke.members.map(n=>{var C;return t.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[t.jsxs("span",{children:[n.displayName,n.kind==="agent"?" · Agent":"",n.ownerMemberId&&` · owned by ${((C=j.data.members.find(E=>E.memberId===n.ownerMemberId))==null?void 0:C.displayName)??"a space member"}`]}),n.handle&&t.jsxs(M,{variant:"ghost",size:"sm",disabled:!Q,onClick:()=>{var E;q.setText(`${q.text}${q.text&&!q.text.endsWith(" ")?" ":""}@${n.handle} `),(E=F.current)==null||E.focus()},children:["Mention @",n.handle]})]},n.memberId)}),a.capabilities.enrollAgent&&t.jsx(Ot,{community:e,roomId:s,online:f.status==="live",canEnroll:!0,accessFingerprint:a.fingerprint},u)]}),R.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(M,{variant:"ghost",size:"sm",onClick:()=>void R.refetch(),children:"Retry"})]}),R.hasNextPage&&t.jsx(M,{variant:"ghost",size:"sm",disabled:R.isFetchingNextPage,onClick:()=>void R.fetchNextPage(),children:"Load the next page of history"}),t.jsx(ge.Timeline,{ref:J,conversationId:he.id,rows:Fe,label:r?"Space thread":"Space messages",busy:R.isFetching,resumeRow:()=>(g==null?void 0:g.scrollAnchorEntryId)??void 0,onTopRow:P,onReachedBottom:Be,onOpenThread:i,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:R.isPending?"Loading messages…":"No messages here yet."}),renderRow:(n,C)=>{const E=ce[C.index];return E.kind==="message"?t.jsx(Lt,{entry:E.entry,onThread:i}):t.jsx(Rt,{summary:E.summary,open:!1,onOpen:()=>i(E.rootId)})}}),f.deliveries.filter(n=>n.parentEntryId===(r??null)&&!W.some(C=>C.originIdempotencyKey===n.idempotencyKey)).map(n=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[n.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:n.text}),n.attachments.map((C,E)=>t.jsx("span",{className:"mr-2",children:C.name},E)),t.jsx("p",{className:"text-muted-foreground",children:n.state==="pending"?"Waiting for the space to confirm…":n.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),n.state==="pending"&&n.retryable&&t.jsx(M,{variant:"outline",size:"sm",disabled:!Q||N!==null,onClick:()=>void le(`retry:${n.idempotencyKey}`,()=>h.retryRemoteCommunityDelivery(e,s,n.idempotencyKey)),children:N===`retry:${n.idempotencyKey}`?"Retrying…":"Retry now"})]},n.idempotencyKey)),q.deliveries.filter(n=>n.parentEntryId===r&&!W.some(C=>C.originIdempotencyKey===n.key)).map(n=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:n.text}),n.files.map(C=>t.jsx("span",{className:"mr-2",children:C.file.name},C.id)),t.jsx("p",{className:"text-muted-foreground",children:n.status==="sending"?"Sending…":"Delivery not confirmed."}),n.error&&t.jsx("p",{children:n.error}),n.status==="failed"&&t.jsx(M,{variant:"outline",size:"sm",disabled:!Q,onClick:()=>q.retry(n.key),children:"Retry message"})]},n.key)),q.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:q.error}),t.jsx(ge.Composer,{inputRef:F,className:"m-3",value:q.text,onChange:q.setText,onSubmit:()=>q.send(r),input:{isStreaming:!1,contextKey:he.id,canSubmit:q.text.trim().length>0||q.attachments.staged.length>0}})]})]})})}function _t({community:e,roomId:s}){var y,u;const r=Ne(),i=(y=r.data)==null?void 0:y.find(v=>v.ref===e),h=qe(i==null?void 0:i.access),p=Pe(e,s??"",!!s&&h.capabilities.read,h.fingerprint),d=(i==null?void 0:i.label)??"Space",a=s?(u=p.data)==null?void 0:u.title:void 0,l=i===void 0&&r.fetchStatus==="fetching"||s!==void 0&&a===void 0&&p.fetchStatus==="fetching";return t.jsx(Ue,{pending:l,children:a?`${d} · ${a}`:d})}function Ye(e){var s,r,i,h;return!e||e.status==="reconnect-required"?null:((r=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:r.lifecycle)==="deleted"?"deleted":((h=(i=e.access)==null?void 0:i.lastKnown)==null?void 0:h.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function Me(e,s,r){return`${e} ${e===1?s:r}`}function Jt(e,s){const r=[e>0?Me(e,"message from your agents","messages from your agents"):null,s>0?Me(s,"draft of yours","drafts of yours"):null].filter(h=>h!==null);if(r.length===0)return null;const i=r.length===1&&(e===1||s===1);return`${r.join(" and ")} ${i?"wasn’t":"weren’t"} sent.`}function Qt({connection:e,onRemoved:s}){const r=Ye(e),i=mt(),[h,p]=m.useState(!1),{ownerKey:d}=ft(),a=ht(d,e.ref),{copied:l,failed:y,copy:u}=pt(),v=e.label,b=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function w(){i.mutate(e,{onSuccess:()=>{p(!1),gt.success(`${v} is removed from DorkOS.`),s()}})}const g=r==="deleted"||r==="taken-down",S=r==="taken-down"?"This space was taken down":r==="deleted"?"This space was deleted":"This space seems to be gone",O=r==="taken-down"?`DorkOS removed its copy here. If ${v} returns, you can connect again.`:r==="deleted"?"DorkOS removed its copy from this computer.":`Since ${b}, ${v} says it doesn’t exist. Its channels, messages and files are still here.`,$=Jt(g?e.undeliveredAgentMessages??0:0,a.length),P=a.length===0?null:a.length===1?"Your unsent draft is cleared too.":`Your ${a.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(Et,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:S}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:O}),$&&t.jsx("p",{role:"status",className:"text-foreground max-w-sm","data-testid":"community-gone-unsent",children:$}),t.jsx("span",{className:"sr-only","aria-live":"polite","data-testid":"community-gone-copy-status",children:l?"Copied.":y?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[a.length>0&&t.jsx(M,{variant:"outline",onClick:()=>void u(a.join(`
9
9
 
10
- `)),children:l?"Copied":y?"Couldn’t copy":a.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(D,{variant:g?"outline":"destructive",onClick:()=>p(!0),children:g?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(Te,{open:h,onOpenChange:z=>{z||i.reset(),p(z)},children:t.jsxs(Oe,{children:[t.jsxs(Ke,{children:[t.jsx(Ie,{children:g?`Remove ${v} from DorkOS?`:`Remove your copy of ${v}?`}),t.jsx($e,{asChild:!0,children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:g?`${v} leaves this app. Nothing else is stored here.`:"This deletes its channels, messages and files from this computer."}),!g&&t.jsx("p",{children:"Your agents stop answering there. If it’s still around, you can connect again."}),U&&t.jsx("p",{children:U})]})})]}),i.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(Le,{disabled:i.isPending,children:"Cancel"}),t.jsx(D,{variant:"destructive",disabled:i.isPending,onClick:w,children:i.isPending?"Removing…":g?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function Yt({connection:e,dateFormat:s}){var p,d;const r=kt(e);if(!r)return null;const[i,...h]=bt(r,(d=(p=e.access)==null?void 0:p.lastKnown)==null?void 0:d.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(yt,{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:i}),h.map(a=>t.jsx("p",{children:a},a))]}),t.jsxs(D,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>vt(At(e)),children:["Open space",t.jsx(xt,{className:"size-3.5","aria-hidden":!0})]})]})}function Ft(){const{id:e,community:s}=_e({from:"/_shell/channels"}),r=Ct();return s&&!r.enabled?r.isLoading?null:t.jsx(jt,{...me.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(_t,{community:s,roomId:e}):e===void 0&&t.jsx(Pe,{children:"Channels"}),t.jsx(Ht,{})]})}function Ht(){const{id:e,thread:s,entry:r,community:i}=_e({from:"/_shell/channels"}),h=je(),p=Tt(i?void 0:e,s,r),d=Nt();return i&&e?t.jsx(Me,{community:i,children:t.jsx(Pt,{community:i,roomId:e,threadId:s,onThread:a=>{h({...me.channels(),search:{community:i,id:e,thread:a}})}},JSON.stringify([i,e]))}):i?t.jsx(Me,{community:i,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(Ae,{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(wt,{})}):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(Ae,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Pick a conversation"}),t.jsx("p",{className:"max-w-sm",children:d?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(St,{roomId:e,threadId:s,entrySeq:r,threadRoute:"/channels"})}function Me({community:e,children:s}){var h;const r=je(),i=(h=Ne().data)==null?void 0:h.find(p=>p.ref===e);return i&&Ye(i)?t.jsx(Qt,{connection:i,onRemoved:()=>void r({...me.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i&&t.jsx(Yt,{connection:i}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const ds=Ft;export{ds as component};
10
+ `)),children:l?"Copied":y?"Couldn’t copy":a.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(M,{variant:g?"outline":"destructive",onClick:()=>p(!0),children:g?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(Te,{open:h,onOpenChange:z=>{z||i.reset(),p(z)},children:t.jsxs(Oe,{children:[t.jsxs(Ke,{children:[t.jsx(Ie,{children:g?`Remove ${v} from DorkOS?`:`Remove your copy of ${v}?`}),t.jsx($e,{asChild:!0,children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:g?`${v} leaves this app. Nothing else is stored here.`:"This deletes its channels, messages and files from this computer."}),!g&&t.jsx("p",{children:"Your agents stop answering there. If it’s still around, you can connect again."}),P&&t.jsx("p",{children:P})]})})]}),i.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(Le,{disabled:i.isPending,children:"Cancel"}),t.jsx(M,{variant:"destructive",disabled:i.isPending,onClick:w,children:i.isPending?"Removing…":g?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function Yt({connection:e,dateFormat:s}){var p,d;const r=kt(e);if(!r)return null;const[i,...h]=bt(r,(d=(p=e.access)==null?void 0:p.lastKnown)==null?void 0:d.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(yt,{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:i}),h.map(a=>t.jsx("p",{children:a},a))]}),t.jsxs(M,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>vt(At(e)),children:["Open space",t.jsx(xt,{className:"size-3.5","aria-hidden":!0})]})]})}function Ft(){const{id:e,community:s}=_e({from:"/_shell/channels"}),r=Ct();return s&&!r.enabled?r.isLoading?null:t.jsx(jt,{...me.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(_t,{community:s,roomId:e}):e===void 0&&t.jsx(Ue,{children:"Channels"}),t.jsx(Bt,{})]})}function Bt(){const{id:e,thread:s,entry:r,community:i}=_e({from:"/_shell/channels"}),h=je(),p=Tt(i?void 0:e,s,r),d=Nt();return i&&e?t.jsx(De,{community:i,children:t.jsx(Ut,{community:i,roomId:e,threadId:s,onThread:a=>{h({...me.channels(),search:{community:i,id:e,thread:a}})}},JSON.stringify([i,e]))}):i?t.jsx(De,{community:i,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(Ae,{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(wt,{})}):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(Ae,{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:d?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(St,{roomId:e,threadId:s,entrySeq:r,threadRoute:"/channels"})}function De({community:e,children:s}){var h;const r=je(),i=(h=Ne().data)==null?void 0:h.find(p=>p.ref===e);return i&&Ye(i)?t.jsx(Qt,{connection:i,onRemoved:()=>void r({...me.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i&&t.jsx(Yt,{connection:i}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const ls=Ft;export{ls as component};