@dxos/plugin-thread 0.8.4-main.70d3990 → 0.8.4-main.74a063c4e0

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 (459) hide show
  1. package/dist/lib/browser/add-message-MJDIN4K4.mjs +97 -0
  2. package/dist/lib/browser/add-message-MJDIN4K4.mjs.map +7 -0
  3. package/dist/lib/browser/blueprints/index.mjs +37 -0
  4. package/dist/lib/browser/blueprints/index.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-2QNKWX4H.mjs +259 -0
  6. package/dist/lib/browser/chunk-2QNKWX4H.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-7T7J6ZR6.mjs +61 -0
  8. package/dist/lib/browser/chunk-7T7J6ZR6.mjs.map +7 -0
  9. package/dist/lib/browser/create-N2ZVTONJ.mjs +55 -0
  10. package/dist/lib/browser/create-N2ZVTONJ.mjs.map +7 -0
  11. package/dist/lib/browser/create-channel-Y4H3535D.mjs +21 -0
  12. package/dist/lib/browser/create-channel-Y4H3535D.mjs.map +7 -0
  13. package/dist/lib/browser/create-channel-thread-6N7TKEAW.mjs +28 -0
  14. package/dist/lib/browser/create-channel-thread-6N7TKEAW.mjs.map +7 -0
  15. package/dist/lib/browser/create-proposals-VTOSWUOX.mjs +57 -0
  16. package/dist/lib/browser/create-proposals-VTOSWUOX.mjs.map +7 -0
  17. package/dist/lib/browser/delete-QZZE655Y.mjs +59 -0
  18. package/dist/lib/browser/delete-QZZE655Y.mjs.map +7 -0
  19. package/dist/lib/browser/delete-message-JTBPACDE.mjs +64 -0
  20. package/dist/lib/browser/delete-message-JTBPACDE.mjs.map +7 -0
  21. package/dist/lib/browser/index.mjs +2245 -221
  22. package/dist/lib/browser/index.mjs.map +4 -4
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/on-create-space-2UGS234J.mjs +25 -0
  25. package/dist/lib/browser/on-create-space-2UGS234J.mjs.map +7 -0
  26. package/dist/lib/browser/operations/index.mjs +14 -0
  27. package/dist/lib/browser/operations/index.mjs.map +7 -0
  28. package/dist/lib/browser/restore-KKQHFLYO.mjs +33 -0
  29. package/dist/lib/browser/restore-KKQHFLYO.mjs.map +7 -0
  30. package/dist/lib/browser/restore-message-YN4BJQIZ.mjs +42 -0
  31. package/dist/lib/browser/restore-message-YN4BJQIZ.mjs.map +7 -0
  32. package/dist/lib/browser/select-VBJ3MBLN.mjs +26 -0
  33. package/dist/lib/browser/select-VBJ3MBLN.mjs.map +7 -0
  34. package/dist/lib/browser/toggle-resolved-OX7UEZG5.mjs +45 -0
  35. package/dist/lib/browser/toggle-resolved-OX7UEZG5.mjs.map +7 -0
  36. package/dist/lib/browser/types/index.mjs +5 -6
  37. package/dist/lib/node-esm/add-message-X6IRTANN.mjs +98 -0
  38. package/dist/lib/node-esm/add-message-X6IRTANN.mjs.map +7 -0
  39. package/dist/lib/node-esm/blueprints/index.mjs +38 -0
  40. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-I6LAZYVU.mjs +260 -0
  42. package/dist/lib/node-esm/chunk-I6LAZYVU.mjs.map +7 -0
  43. package/dist/lib/node-esm/chunk-UGSMYQLZ.mjs +62 -0
  44. package/dist/lib/node-esm/chunk-UGSMYQLZ.mjs.map +7 -0
  45. package/dist/lib/node-esm/create-A6XQZR7M.mjs +56 -0
  46. package/dist/lib/node-esm/create-A6XQZR7M.mjs.map +7 -0
  47. package/dist/lib/node-esm/create-channel-KA5T23ZS.mjs +22 -0
  48. package/dist/lib/node-esm/create-channel-KA5T23ZS.mjs.map +7 -0
  49. package/dist/lib/node-esm/create-channel-thread-44PXAPGM.mjs +29 -0
  50. package/dist/lib/node-esm/create-channel-thread-44PXAPGM.mjs.map +7 -0
  51. package/dist/lib/node-esm/create-proposals-HDBVDNUX.mjs +58 -0
  52. package/dist/lib/node-esm/create-proposals-HDBVDNUX.mjs.map +7 -0
  53. package/dist/lib/node-esm/delete-3RAWD5GG.mjs +60 -0
  54. package/dist/lib/node-esm/delete-3RAWD5GG.mjs.map +7 -0
  55. package/dist/lib/node-esm/delete-message-QQHNJBHY.mjs +65 -0
  56. package/dist/lib/node-esm/delete-message-QQHNJBHY.mjs.map +7 -0
  57. package/dist/lib/node-esm/index.mjs +2245 -221
  58. package/dist/lib/node-esm/index.mjs.map +4 -4
  59. package/dist/lib/node-esm/meta.json +1 -1
  60. package/dist/lib/node-esm/on-create-space-ZURB6UKR.mjs +26 -0
  61. package/dist/lib/node-esm/on-create-space-ZURB6UKR.mjs.map +7 -0
  62. package/dist/lib/node-esm/operations/index.mjs +15 -0
  63. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  64. package/dist/lib/node-esm/restore-PDYEKDE3.mjs +34 -0
  65. package/dist/lib/node-esm/restore-PDYEKDE3.mjs.map +7 -0
  66. package/dist/lib/node-esm/restore-message-OB32YYKF.mjs +43 -0
  67. package/dist/lib/node-esm/restore-message-OB32YYKF.mjs.map +7 -0
  68. package/dist/lib/node-esm/select-6KETLVWY.mjs +27 -0
  69. package/dist/lib/node-esm/select-6KETLVWY.mjs.map +7 -0
  70. package/dist/lib/node-esm/toggle-resolved-V74EBRQZ.mjs +46 -0
  71. package/dist/lib/node-esm/toggle-resolved-V74EBRQZ.mjs.map +7 -0
  72. package/dist/lib/node-esm/types/index.mjs +5 -6
  73. package/dist/types/src/ThreadPlugin.d.ts +2 -1
  74. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  75. package/dist/types/src/blueprints/index.d.ts +2 -0
  76. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  77. package/dist/types/src/blueprints/thread-blueprint.d.ts +4 -0
  78. package/dist/types/src/blueprints/thread-blueprint.d.ts.map +1 -0
  79. package/dist/types/src/calls/call-manager.d.ts +40 -30
  80. package/dist/types/src/calls/call-manager.d.ts.map +1 -1
  81. package/dist/types/src/calls/call-swarm-synchronizer.d.ts +2 -2
  82. package/dist/types/src/calls/call-swarm-synchronizer.d.ts.map +1 -1
  83. package/dist/types/src/calls/media-manager.d.ts +1 -1
  84. package/dist/types/src/calls/media-manager.d.ts.map +1 -1
  85. package/dist/types/src/calls/util/calls-service.d.ts +1 -1
  86. package/dist/types/src/calls/util/calls-service.d.ts.map +1 -1
  87. package/dist/types/src/calls/util/task-scheduling.d.ts +2 -2
  88. package/dist/types/src/calls/util/task-scheduling.d.ts.map +1 -1
  89. package/dist/types/src/calls-service.stories.d.ts +2 -2
  90. package/dist/types/src/calls-service.stories.d.ts.map +1 -1
  91. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  92. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  93. package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
  94. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  95. package/dist/types/src/capabilities/call-manager.d.ts +3 -2
  96. package/dist/types/src/capabilities/call-manager.d.ts.map +1 -1
  97. package/dist/types/src/capabilities/index.d.ts +13 -15
  98. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/markdown.d.ts +3 -2
  100. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  101. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  102. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/react-root.d.ts +4 -2
  104. package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  106. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  107. package/dist/types/src/capabilities/settings.d.ts +4 -2
  108. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/state.d.ts +5 -5
  110. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  111. package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
  112. package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
  113. package/dist/types/src/components/Call/Call.d.ts.map +1 -1
  114. package/dist/types/src/components/Call/Toolbar.d.ts +1 -1
  115. package/dist/types/src/components/Call/Toolbar.d.ts.map +1 -1
  116. package/dist/types/src/components/CommentsPanel/CommentsPanel.d.ts +13 -0
  117. package/dist/types/src/components/CommentsPanel/CommentsPanel.d.ts.map +1 -0
  118. package/dist/types/src/components/CommentsPanel/CommentsPanel.stories.d.ts +160 -0
  119. package/dist/types/src/components/CommentsPanel/CommentsPanel.stories.d.ts.map +1 -0
  120. package/dist/types/src/components/{CommentsThreadContainer.d.ts → CommentsPanel/CommentsThread.d.ts} +3 -3
  121. package/dist/types/src/components/CommentsPanel/CommentsThread.d.ts.map +1 -0
  122. package/dist/types/src/components/CommentsPanel/index.d.ts +3 -0
  123. package/dist/types/src/components/CommentsPanel/index.d.ts.map +1 -0
  124. package/dist/types/src/components/Lobby/Lobby.d.ts.map +1 -1
  125. package/dist/types/src/components/Media/VideoObject.d.ts +1 -1
  126. package/dist/types/src/components/Media/VideoObject.stories.d.ts +1 -1
  127. package/dist/types/src/components/Media/VideoObject.stories.d.ts.map +1 -1
  128. package/dist/types/src/components/MessagePanel/MessagePanel.d.ts +15 -0
  129. package/dist/types/src/components/MessagePanel/MessagePanel.d.ts.map +1 -0
  130. package/dist/types/src/components/MessagePanel/index.d.ts +2 -0
  131. package/dist/types/src/components/MessagePanel/index.d.ts.map +1 -0
  132. package/dist/types/src/components/Participant/Participant.d.ts.map +1 -1
  133. package/dist/types/src/components/Participant/ParticipantGrid.d.ts.map +1 -1
  134. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.d.ts.map +1 -1
  135. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts +142 -144
  136. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts.map +1 -1
  137. package/dist/types/src/components/ResponsiveGrid/{ResponsiveContainer.d.ts → ResponsivePanel.d.ts} +4 -4
  138. package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.d.ts.map +1 -0
  139. package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.stories.d.ts +164 -0
  140. package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.stories.d.ts.map +1 -0
  141. package/dist/types/src/components/ResponsiveGrid/index.d.ts +1 -1
  142. package/dist/types/src/components/ResponsiveGrid/index.d.ts.map +1 -1
  143. package/dist/types/src/components/ThreadSettings/ThreadSettings.d.ts +6 -0
  144. package/dist/types/src/components/ThreadSettings/ThreadSettings.d.ts.map +1 -0
  145. package/dist/types/src/components/ThreadSettings/ThreadSettings.stories.d.ts +161 -0
  146. package/dist/types/src/components/ThreadSettings/ThreadSettings.stories.d.ts.map +1 -0
  147. package/dist/types/src/components/ThreadSettings/index.d.ts +2 -0
  148. package/dist/types/src/components/ThreadSettings/index.d.ts.map +1 -0
  149. package/dist/types/src/components/index.d.ts +4 -9
  150. package/dist/types/src/components/index.d.ts.map +1 -1
  151. package/dist/types/src/{components → containers/CallDebugPanel}/CallDebugPanel.d.ts +1 -1
  152. package/dist/types/src/containers/CallDebugPanel/CallDebugPanel.d.ts.map +1 -0
  153. package/dist/types/src/containers/CallDebugPanel/index.d.ts +2 -0
  154. package/dist/types/src/containers/CallDebugPanel/index.d.ts.map +1 -0
  155. package/dist/types/src/{components → containers/CallSidebar}/CallSidebar.d.ts +0 -1
  156. package/dist/types/src/containers/CallSidebar/CallSidebar.d.ts.map +1 -0
  157. package/dist/types/src/containers/CallSidebar/index.d.ts +2 -0
  158. package/dist/types/src/containers/CallSidebar/index.d.ts.map +1 -0
  159. package/dist/types/src/containers/ChannelContainer/ChannelContainer.d.ts +12 -0
  160. package/dist/types/src/containers/ChannelContainer/ChannelContainer.d.ts.map +1 -0
  161. package/dist/types/src/containers/ChannelContainer/ChannelContainer.stories.d.ts +162 -0
  162. package/dist/types/src/containers/ChannelContainer/ChannelContainer.stories.d.ts.map +1 -0
  163. package/dist/types/src/containers/ChannelContainer/index.d.ts +2 -0
  164. package/dist/types/src/containers/ChannelContainer/index.d.ts.map +1 -0
  165. package/dist/types/src/{components → containers/ChatContainer}/ChatContainer.d.ts +8 -6
  166. package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
  167. package/dist/types/src/containers/ChatContainer/ChatContainer.stories.d.ts +162 -0
  168. package/dist/types/src/containers/ChatContainer/ChatContainer.stories.d.ts.map +1 -0
  169. package/dist/types/src/containers/ChatContainer/index.d.ts +4 -0
  170. package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
  171. package/dist/types/src/containers/ThreadCompanion/ThreadCompanion.d.ts +8 -0
  172. package/dist/types/src/containers/ThreadCompanion/ThreadCompanion.d.ts.map +1 -0
  173. package/dist/types/src/containers/ThreadCompanion/index.d.ts +2 -0
  174. package/dist/types/src/containers/ThreadCompanion/index.d.ts.map +1 -0
  175. package/dist/types/src/containers/index.d.ts +7 -0
  176. package/dist/types/src/containers/index.d.ts.map +1 -0
  177. package/dist/types/src/{components/command-extension.d.ts → extensions/command.d.ts} +1 -1
  178. package/dist/types/src/extensions/command.d.ts.map +1 -0
  179. package/dist/types/src/extensions/index.d.ts +1 -0
  180. package/dist/types/src/extensions/index.d.ts.map +1 -1
  181. package/dist/types/src/extensions/threads.d.ts +8 -3
  182. package/dist/types/src/extensions/threads.d.ts.map +1 -1
  183. package/dist/types/src/hooks/analytics.d.ts +1 -2
  184. package/dist/types/src/hooks/analytics.d.ts.map +1 -1
  185. package/dist/types/src/index.d.ts +1 -1
  186. package/dist/types/src/index.d.ts.map +1 -1
  187. package/dist/types/src/meta.d.ts +2 -2
  188. package/dist/types/src/meta.d.ts.map +1 -1
  189. package/dist/types/src/operations/add-message.d.ts +5 -0
  190. package/dist/types/src/operations/add-message.d.ts.map +1 -0
  191. package/dist/types/src/operations/create-channel-thread.d.ts +5 -0
  192. package/dist/types/src/operations/create-channel-thread.d.ts.map +1 -0
  193. package/dist/types/src/operations/create-channel.d.ts +5 -0
  194. package/dist/types/src/operations/create-channel.d.ts.map +1 -0
  195. package/dist/types/src/operations/create-proposals.d.ts +5 -0
  196. package/dist/types/src/operations/create-proposals.d.ts.map +1 -0
  197. package/dist/types/src/operations/create.d.ts +5 -0
  198. package/dist/types/src/operations/create.d.ts.map +1 -0
  199. package/dist/types/src/operations/definitions.d.ts +2789 -0
  200. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  201. package/dist/types/src/operations/delete-message.d.ts +5 -0
  202. package/dist/types/src/operations/delete-message.d.ts.map +1 -0
  203. package/dist/types/src/operations/delete.d.ts +5 -0
  204. package/dist/types/src/operations/delete.d.ts.map +1 -0
  205. package/dist/types/src/operations/index.d.ts +4 -0
  206. package/dist/types/src/operations/index.d.ts.map +1 -0
  207. package/dist/types/src/operations/on-create-space.d.ts +5 -0
  208. package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
  209. package/dist/types/src/operations/restore-message.d.ts +5 -0
  210. package/dist/types/src/operations/restore-message.d.ts.map +1 -0
  211. package/dist/types/src/operations/restore.d.ts +5 -0
  212. package/dist/types/src/operations/restore.d.ts.map +1 -0
  213. package/dist/types/src/operations/select.d.ts +5 -0
  214. package/dist/types/src/operations/select.d.ts.map +1 -0
  215. package/dist/types/src/operations/toggle-resolved.d.ts +5 -0
  216. package/dist/types/src/operations/toggle-resolved.d.ts.map +1 -0
  217. package/dist/types/src/{components/testing.d.ts → testing/data.d.ts} +1 -1
  218. package/dist/types/src/testing/data.d.ts.map +1 -0
  219. package/dist/types/src/testing/stories.d.ts +2 -1
  220. package/dist/types/src/testing/stories.d.ts.map +1 -1
  221. package/dist/types/src/translations.d.ts +140 -142
  222. package/dist/types/src/translations.d.ts.map +1 -1
  223. package/dist/types/src/types/Channel.d.ts +707 -12
  224. package/dist/types/src/types/Channel.d.ts.map +1 -1
  225. package/dist/types/src/types/Settings.d.ts +4 -0
  226. package/dist/types/src/types/Settings.d.ts.map +1 -0
  227. package/dist/types/src/types/capabilities.d.ts +23 -0
  228. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  229. package/dist/types/src/types/index.d.ts +1 -0
  230. package/dist/types/src/types/index.d.ts.map +1 -1
  231. package/dist/types/src/types/types.d.ts +1 -340
  232. package/dist/types/src/types/types.d.ts.map +1 -1
  233. package/dist/types/src/util.d.ts.map +1 -1
  234. package/dist/types/tsconfig.tsbuildinfo +1 -1
  235. package/package.json +108 -69
  236. package/src/ThreadPlugin.tsx +77 -109
  237. package/src/blueprints/index.ts +5 -0
  238. package/src/blueprints/thread-blueprint.ts +37 -0
  239. package/src/calls/call-manager.ts +76 -52
  240. package/src/calls/call-swarm-synchronizer.ts +2 -2
  241. package/src/calls/media-manager.ts +1 -1
  242. package/src/calls/util/calls-service.ts +1 -2
  243. package/src/calls/util/task-scheduling.ts +4 -4
  244. package/src/calls-service.stories.tsx +10 -9
  245. package/src/capabilities/app-graph-builder.ts +171 -172
  246. package/src/capabilities/blueprint-definition.ts +9 -30
  247. package/src/capabilities/call-manager.ts +19 -12
  248. package/src/capabilities/index.ts +15 -13
  249. package/src/capabilities/markdown.ts +50 -39
  250. package/src/capabilities/operation-handler.ts +16 -0
  251. package/src/capabilities/react-root.tsx +12 -9
  252. package/src/capabilities/react-surface.tsx +78 -79
  253. package/src/capabilities/settings.ts +28 -12
  254. package/src/capabilities/state.ts +14 -18
  255. package/src/capabilities/undo-mappings.ts +46 -0
  256. package/src/components/Call/Call.tsx +11 -7
  257. package/src/components/Call/Toolbar.tsx +55 -38
  258. package/src/components/CommentsPanel/CommentsPanel.stories.tsx +93 -0
  259. package/src/components/{CommentsContainer.tsx → CommentsPanel/CommentsPanel.tsx} +15 -14
  260. package/src/components/{CommentsThreadContainer.tsx → CommentsPanel/CommentsThread.tsx} +28 -29
  261. package/src/components/CommentsPanel/index.ts +6 -0
  262. package/src/components/Lobby/Lobby.tsx +15 -12
  263. package/src/components/Media/AudioStream.tsx +2 -2
  264. package/src/components/Media/VideoObject.stories.tsx +6 -7
  265. package/src/components/Media/VideoObject.tsx +2 -2
  266. package/src/components/{MessageContainer.tsx → MessagePanel/MessagePanel.tsx} +74 -39
  267. package/src/components/MessagePanel/index.ts +5 -0
  268. package/src/components/Participant/Participant.tsx +33 -19
  269. package/src/components/Participant/ParticipantGrid.tsx +0 -1
  270. package/src/components/ResponsiveGrid/ResponsiveGrid.stories.tsx +10 -11
  271. package/src/components/ResponsiveGrid/ResponsiveGrid.tsx +9 -9
  272. package/src/components/ResponsiveGrid/ResponsiveGridItem.tsx +10 -10
  273. package/src/components/ResponsiveGrid/{ResponsiveContainer.stories.tsx → ResponsivePanel.stories.tsx} +7 -8
  274. package/src/components/ResponsiveGrid/{ResponsiveContainer.tsx → ResponsivePanel.tsx} +6 -6
  275. package/src/components/ResponsiveGrid/index.ts +1 -1
  276. package/src/components/ThreadSettings/ThreadSettings.stories.tsx +31 -0
  277. package/src/components/ThreadSettings/ThreadSettings.tsx +20 -0
  278. package/src/components/ThreadSettings/index.ts +5 -0
  279. package/src/components/index.ts +4 -11
  280. package/src/{components → containers/CallDebugPanel}/CallDebugPanel.tsx +8 -7
  281. package/src/containers/CallDebugPanel/index.ts +5 -0
  282. package/src/containers/CallSidebar/CallSidebar.tsx +18 -0
  283. package/src/containers/CallSidebar/index.ts +5 -0
  284. package/src/containers/ChannelContainer/ChannelContainer.stories.tsx +61 -0
  285. package/src/{components → containers/ChannelContainer}/ChannelContainer.tsx +90 -72
  286. package/src/containers/ChannelContainer/index.ts +5 -0
  287. package/src/{components/Chat.stories.tsx → containers/ChatContainer/ChatContainer.stories.tsx} +22 -20
  288. package/src/containers/ChatContainer/ChatContainer.tsx +131 -0
  289. package/src/containers/ChatContainer/index.ts +8 -0
  290. package/src/containers/ThreadCompanion/ThreadCompanion.tsx +217 -0
  291. package/src/containers/ThreadCompanion/index.ts +5 -0
  292. package/src/containers/index.ts +11 -0
  293. package/src/{components/command-extension.ts → extensions/command.ts} +3 -3
  294. package/src/extensions/index.ts +1 -0
  295. package/src/extensions/threads.ts +76 -41
  296. package/src/hooks/analytics.ts +24 -20
  297. package/src/index.ts +1 -1
  298. package/src/meta.ts +4 -4
  299. package/src/operations/add-message.ts +81 -0
  300. package/src/operations/create-channel-thread.ts +26 -0
  301. package/src/operations/create-channel.ts +20 -0
  302. package/src/operations/create-proposals.ts +49 -0
  303. package/src/operations/create.ts +48 -0
  304. package/src/operations/definitions.ts +177 -0
  305. package/src/operations/delete-message.ts +53 -0
  306. package/src/operations/delete.ts +63 -0
  307. package/src/operations/index.ts +22 -0
  308. package/src/operations/on-create-space.ts +27 -0
  309. package/src/operations/restore-message.ts +38 -0
  310. package/src/operations/restore.ts +38 -0
  311. package/src/operations/select.ts +24 -0
  312. package/src/operations/toggle-resolved.ts +41 -0
  313. package/src/{components/testing.ts → testing/data.ts} +7 -7
  314. package/src/testing/stories.ts +17 -17
  315. package/src/translations.ts +72 -76
  316. package/src/types/Channel.ts +19 -8
  317. package/src/types/Settings.ts +10 -0
  318. package/src/types/capabilities.ts +36 -0
  319. package/src/types/index.ts +1 -0
  320. package/src/types/types.ts +3 -98
  321. package/src/util.ts +1 -1
  322. package/dist/lib/browser/ChannelContainer-L7MKV7DS.mjs +0 -17
  323. package/dist/lib/browser/ChannelContainer-L7MKV7DS.mjs.map +0 -7
  324. package/dist/lib/browser/ChatContainer-KPY4BAUE.mjs +0 -16
  325. package/dist/lib/browser/ChatContainer-KPY4BAUE.mjs.map +0 -7
  326. package/dist/lib/browser/app-graph-builder-TWJ2UCOZ.mjs +0 -171
  327. package/dist/lib/browser/app-graph-builder-TWJ2UCOZ.mjs.map +0 -7
  328. package/dist/lib/browser/blueprint-definition-TQ4JFMZZ.mjs +0 -101
  329. package/dist/lib/browser/blueprint-definition-TQ4JFMZZ.mjs.map +0 -7
  330. package/dist/lib/browser/call-manager-4YFT4XA6.mjs +0 -25
  331. package/dist/lib/browser/call-manager-4YFT4XA6.mjs.map +0 -7
  332. package/dist/lib/browser/chunk-ALZKJOZK.mjs +0 -989
  333. package/dist/lib/browser/chunk-ALZKJOZK.mjs.map +0 -7
  334. package/dist/lib/browser/chunk-ANTFU4JB.mjs +0 -25
  335. package/dist/lib/browser/chunk-ANTFU4JB.mjs.map +0 -7
  336. package/dist/lib/browser/chunk-CFC7LEPD.mjs +0 -18
  337. package/dist/lib/browser/chunk-CFC7LEPD.mjs.map +0 -7
  338. package/dist/lib/browser/chunk-CP7E2HRE.mjs +0 -31
  339. package/dist/lib/browser/chunk-CP7E2HRE.mjs.map +0 -7
  340. package/dist/lib/browser/chunk-ISCHODBV.mjs +0 -106
  341. package/dist/lib/browser/chunk-ISCHODBV.mjs.map +0 -7
  342. package/dist/lib/browser/chunk-JDJPMI7V.mjs +0 -143
  343. package/dist/lib/browser/chunk-JDJPMI7V.mjs.map +0 -7
  344. package/dist/lib/browser/chunk-KOBXMDCI.mjs +0 -182
  345. package/dist/lib/browser/chunk-KOBXMDCI.mjs.map +0 -7
  346. package/dist/lib/browser/chunk-NPT5S6N4.mjs +0 -611
  347. package/dist/lib/browser/chunk-NPT5S6N4.mjs.map +0 -7
  348. package/dist/lib/browser/chunk-QM34EZQK.mjs +0 -20
  349. package/dist/lib/browser/chunk-QM34EZQK.mjs.map +0 -7
  350. package/dist/lib/browser/chunk-TLOOZTRD.mjs +0 -377
  351. package/dist/lib/browser/chunk-TLOOZTRD.mjs.map +0 -7
  352. package/dist/lib/browser/chunk-ZCW3NSDZ.mjs +0 -1793
  353. package/dist/lib/browser/chunk-ZCW3NSDZ.mjs.map +0 -7
  354. package/dist/lib/browser/intent-resolver-G33FT3NO.mjs +0 -355
  355. package/dist/lib/browser/intent-resolver-G33FT3NO.mjs.map +0 -7
  356. package/dist/lib/browser/markdown-WFZFYJBQ.mjs +0 -172
  357. package/dist/lib/browser/markdown-WFZFYJBQ.mjs.map +0 -7
  358. package/dist/lib/browser/react-root-ED7PHA44.mjs +0 -29
  359. package/dist/lib/browser/react-root-ED7PHA44.mjs.map +0 -7
  360. package/dist/lib/browser/react-surface-AUQQSQQC.mjs +0 -111
  361. package/dist/lib/browser/react-surface-AUQQSQQC.mjs.map +0 -7
  362. package/dist/lib/browser/repair-JFJLEM2O.mjs +0 -35
  363. package/dist/lib/browser/repair-JFJLEM2O.mjs.map +0 -7
  364. package/dist/lib/browser/settings-E6IOLK46.mjs +0 -23
  365. package/dist/lib/browser/settings-E6IOLK46.mjs.map +0 -7
  366. package/dist/lib/browser/state-UYPLBGZJ.mjs +0 -35
  367. package/dist/lib/browser/state-UYPLBGZJ.mjs.map +0 -7
  368. package/dist/lib/node-esm/ChannelContainer-FYONOOZ6.mjs +0 -18
  369. package/dist/lib/node-esm/ChannelContainer-FYONOOZ6.mjs.map +0 -7
  370. package/dist/lib/node-esm/ChatContainer-TLQG23K7.mjs +0 -17
  371. package/dist/lib/node-esm/ChatContainer-TLQG23K7.mjs.map +0 -7
  372. package/dist/lib/node-esm/app-graph-builder-VD6I2V5H.mjs +0 -172
  373. package/dist/lib/node-esm/app-graph-builder-VD6I2V5H.mjs.map +0 -7
  374. package/dist/lib/node-esm/blueprint-definition-TSX5HHW7.mjs +0 -102
  375. package/dist/lib/node-esm/blueprint-definition-TSX5HHW7.mjs.map +0 -7
  376. package/dist/lib/node-esm/call-manager-UMUXEYH5.mjs +0 -26
  377. package/dist/lib/node-esm/call-manager-UMUXEYH5.mjs.map +0 -7
  378. package/dist/lib/node-esm/chunk-2AEIN5MI.mjs +0 -22
  379. package/dist/lib/node-esm/chunk-2AEIN5MI.mjs.map +0 -7
  380. package/dist/lib/node-esm/chunk-7KZWZS2U.mjs +0 -1794
  381. package/dist/lib/node-esm/chunk-7KZWZS2U.mjs.map +0 -7
  382. package/dist/lib/node-esm/chunk-AB42KYF3.mjs +0 -990
  383. package/dist/lib/node-esm/chunk-AB42KYF3.mjs.map +0 -7
  384. package/dist/lib/node-esm/chunk-ABUFOZVX.mjs +0 -33
  385. package/dist/lib/node-esm/chunk-ABUFOZVX.mjs.map +0 -7
  386. package/dist/lib/node-esm/chunk-ATNY37UV.mjs +0 -27
  387. package/dist/lib/node-esm/chunk-ATNY37UV.mjs.map +0 -7
  388. package/dist/lib/node-esm/chunk-E5HNHFYH.mjs +0 -378
  389. package/dist/lib/node-esm/chunk-E5HNHFYH.mjs.map +0 -7
  390. package/dist/lib/node-esm/chunk-FF3QVPY4.mjs +0 -612
  391. package/dist/lib/node-esm/chunk-FF3QVPY4.mjs.map +0 -7
  392. package/dist/lib/node-esm/chunk-P2M364TO.mjs +0 -144
  393. package/dist/lib/node-esm/chunk-P2M364TO.mjs.map +0 -7
  394. package/dist/lib/node-esm/chunk-PZH2EDU5.mjs +0 -183
  395. package/dist/lib/node-esm/chunk-PZH2EDU5.mjs.map +0 -7
  396. package/dist/lib/node-esm/chunk-RT6NRL2I.mjs +0 -19
  397. package/dist/lib/node-esm/chunk-RT6NRL2I.mjs.map +0 -7
  398. package/dist/lib/node-esm/chunk-VBI32FGI.mjs +0 -108
  399. package/dist/lib/node-esm/chunk-VBI32FGI.mjs.map +0 -7
  400. package/dist/lib/node-esm/intent-resolver-4PX3WXQG.mjs +0 -356
  401. package/dist/lib/node-esm/intent-resolver-4PX3WXQG.mjs.map +0 -7
  402. package/dist/lib/node-esm/markdown-CSR5MAPZ.mjs +0 -173
  403. package/dist/lib/node-esm/markdown-CSR5MAPZ.mjs.map +0 -7
  404. package/dist/lib/node-esm/react-root-DZN324JA.mjs +0 -30
  405. package/dist/lib/node-esm/react-root-DZN324JA.mjs.map +0 -7
  406. package/dist/lib/node-esm/react-surface-AMVESEF4.mjs +0 -112
  407. package/dist/lib/node-esm/react-surface-AMVESEF4.mjs.map +0 -7
  408. package/dist/lib/node-esm/repair-RMLR24YR.mjs +0 -36
  409. package/dist/lib/node-esm/repair-RMLR24YR.mjs.map +0 -7
  410. package/dist/lib/node-esm/settings-RGZHWDSO.mjs +0 -24
  411. package/dist/lib/node-esm/settings-RGZHWDSO.mjs.map +0 -7
  412. package/dist/lib/node-esm/state-XNWOLBNE.mjs +0 -36
  413. package/dist/lib/node-esm/state-XNWOLBNE.mjs.map +0 -7
  414. package/dist/types/src/capabilities/capabilities.d.ts +0 -27
  415. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  416. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  417. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  418. package/dist/types/src/capabilities/repair.d.ts +0 -4
  419. package/dist/types/src/capabilities/repair.d.ts.map +0 -1
  420. package/dist/types/src/components/CallDebugPanel.d.ts.map +0 -1
  421. package/dist/types/src/components/CallSidebar.d.ts.map +0 -1
  422. package/dist/types/src/components/ChannelContainer.d.ts +0 -14
  423. package/dist/types/src/components/ChannelContainer.d.ts.map +0 -1
  424. package/dist/types/src/components/ChannelContainer.stories.d.ts +0 -164
  425. package/dist/types/src/components/ChannelContainer.stories.d.ts.map +0 -1
  426. package/dist/types/src/components/Chat.stories.d.ts +0 -164
  427. package/dist/types/src/components/Chat.stories.d.ts.map +0 -1
  428. package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
  429. package/dist/types/src/components/Comments.stories.d.ts +0 -162
  430. package/dist/types/src/components/Comments.stories.d.ts.map +0 -1
  431. package/dist/types/src/components/CommentsContainer.d.ts +0 -13
  432. package/dist/types/src/components/CommentsContainer.d.ts.map +0 -1
  433. package/dist/types/src/components/CommentsThreadContainer.d.ts.map +0 -1
  434. package/dist/types/src/components/MessageContainer.d.ts +0 -16
  435. package/dist/types/src/components/MessageContainer.d.ts.map +0 -1
  436. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.d.ts.map +0 -1
  437. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts +0 -166
  438. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts.map +0 -1
  439. package/dist/types/src/components/ThreadCompanion.d.ts +0 -5
  440. package/dist/types/src/components/ThreadCompanion.d.ts.map +0 -1
  441. package/dist/types/src/components/ThreadSettings.d.ts +0 -6
  442. package/dist/types/src/components/ThreadSettings.d.ts.map +0 -1
  443. package/dist/types/src/components/command-extension.d.ts.map +0 -1
  444. package/dist/types/src/components/testing.d.ts.map +0 -1
  445. package/dist/types/src/functions/create-proposals.d.ts +0 -6
  446. package/dist/types/src/functions/create-proposals.d.ts.map +0 -1
  447. package/dist/types/src/functions/index.d.ts +0 -2
  448. package/dist/types/src/functions/index.d.ts.map +0 -1
  449. package/src/capabilities/capabilities.ts +0 -33
  450. package/src/capabilities/intent-resolver.ts +0 -311
  451. package/src/capabilities/repair.ts +0 -40
  452. package/src/components/CallSidebar.tsx +0 -18
  453. package/src/components/ChannelContainer.stories.tsx +0 -59
  454. package/src/components/ChatContainer.tsx +0 -153
  455. package/src/components/Comments.stories.tsx +0 -90
  456. package/src/components/ThreadCompanion.tsx +0 -188
  457. package/src/components/ThreadSettings.tsx +0 -16
  458. package/src/functions/create-proposals.ts +0 -56
  459. package/src/functions/index.ts +0 -5
@@ -0,0 +1,217 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import React, { useCallback, useMemo } from 'react';
7
+
8
+ import { Capabilities } from '@dxos/app-framework';
9
+ import { useCapabilities, useCapability, useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
10
+ import { AppCapabilities, CollaborationOperation, LayoutOperation } from '@dxos/app-toolkit';
11
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
12
+ import { Filter, Obj, Query, Relation } from '@dxos/echo';
13
+ import { Ref, useQuery } from '@dxos/react-client/echo';
14
+ import { useIdentity } from '@dxos/react-client/halo';
15
+ import { Panel, ScrollArea, Toolbar, useTranslation } from '@dxos/react-ui';
16
+ import { getParentId, useAttention } from '@dxos/react-ui-attention';
17
+ import { Tabs } from '@dxos/react-ui-tabs';
18
+ import { AnchoredTo, Thread } from '@dxos/types';
19
+
20
+ import { CommentsPanel, type CommentsPanelProps } from '#components';
21
+ import { meta } from '#meta';
22
+ import { ThreadOperation } from '#operations';
23
+ import { ThreadCapabilities, type ViewState } from '#types';
24
+
25
+ const initialViewState: ViewState = { showResolvedThreads: false };
26
+
27
+ export type ThreadCompanionProps = AppSurface.ObjectArticleProps<
28
+ Thread.Thread,
29
+ {
30
+ attendableId?: string;
31
+ }
32
+ >;
33
+
34
+ export const ThreadCompanion = ({ attendableId, subject }: ThreadCompanionProps) => {
35
+ const { t } = useTranslation(meta.id);
36
+ const manager = usePluginManager();
37
+ const { invokePromise } = useOperationInvoker();
38
+ const identity = useIdentity();
39
+ const subjectId = Obj.getDXN(subject).toString();
40
+ const parentId = attendableId ? getParentId(attendableId) : undefined;
41
+ const registry = useCapability(Capabilities.AtomRegistry);
42
+
43
+ const stateAtom = useCapability(ThreadCapabilities.State);
44
+ const viewStoreAtom = useCapability(ThreadCapabilities.ViewState);
45
+ const state = useAtomValue(stateAtom);
46
+ const viewStore = useAtomValue(viewStoreAtom);
47
+ const drafts = state.drafts[subjectId];
48
+
49
+ // Get or initialize view state for this subject.
50
+ const viewState = useMemo(() => {
51
+ if (!viewStore[subjectId]) {
52
+ registry.set(viewStoreAtom, { ...viewStore, [subjectId]: { ...initialViewState } });
53
+ return initialViewState;
54
+ }
55
+ return viewStore[subjectId];
56
+ }, [viewStore, subjectId, registry, viewStoreAtom]);
57
+ const { showResolvedThreads } = viewState;
58
+
59
+ const onChangeViewState = useCallback(
60
+ (nextValue: string) => {
61
+ registry.set(viewStoreAtom, {
62
+ ...registry.get(viewStoreAtom),
63
+ [subjectId]: { ...registry.get(viewStoreAtom)[subjectId], showResolvedThreads: nextValue === 'all' },
64
+ });
65
+ },
66
+ [registry, viewStoreAtom, subjectId],
67
+ );
68
+
69
+ const anchorSorts = useCapabilities(AppCapabilities.AnchorSort);
70
+ const sort = useMemo(
71
+ () => anchorSorts.find(({ key }) => key === Obj.getTypename(subject))?.sort,
72
+ [anchorSorts, subject],
73
+ );
74
+
75
+ const db = Obj.getDatabase(subject);
76
+ const objectsAnchoredTo = useQuery(db, Query.select(Filter.id(subject.id)).targetOf(AnchoredTo.AnchoredTo));
77
+ const anchors = objectsAnchoredTo
78
+ .toSorted((a, b) => sort?.(a, b) ?? 0)
79
+ .filter((anchor) => Obj.instanceOf(Thread.Thread, Relation.getSource(anchor)))
80
+ .concat(drafts ?? []);
81
+
82
+ const { hasAttention, isAncestor, isRelated } = useAttention(parentId);
83
+ const isAttended = hasAttention || isAncestor || isRelated;
84
+
85
+ const handleAttend = useCallback(
86
+ (anchor: AnchoredTo.AnchoredTo) => {
87
+ const thread = Relation.getSource(anchor) as Thread.Thread;
88
+ const threadId = Obj.getDXN(thread).toString();
89
+
90
+ if (state.current !== threadId) {
91
+ registry.set(stateAtom, { ...registry.get(stateAtom), current: threadId });
92
+
93
+ // Scroll plank into view (deck handler).
94
+ void invokePromise(LayoutOperation.ScrollIntoView, { subject: parentId });
95
+
96
+ // Scroll within content to anchor (metadata-driven, per typename).
97
+ if (anchor.anchor && parentId) {
98
+ const typename = Obj.getTypename(subject);
99
+ const metadata = manager.capabilities
100
+ .getAll(AppCapabilities.Metadata)
101
+ .find(({ id }) => id === typename)?.metadata;
102
+ if (metadata?.scrollToAnchor) {
103
+ void invokePromise(metadata.scrollToAnchor, {
104
+ subject: parentId,
105
+ cursor: anchor.anchor,
106
+ ref: threadId,
107
+ });
108
+ }
109
+ }
110
+ }
111
+ },
112
+ [state.current, invokePromise, registry, stateAtom, parentId, subject, manager],
113
+ );
114
+
115
+ const handleComment = useCallback(
116
+ async (anchor: AnchoredTo.AnchoredTo, text: string) => {
117
+ await invokePromise(ThreadOperation.AddMessage, {
118
+ anchor,
119
+ subject,
120
+ sender: { identityDid: identity?.did },
121
+ text,
122
+ });
123
+
124
+ const thread = Relation.getSource(anchor) as Thread.Thread;
125
+ registry.set(stateAtom, { ...registry.get(stateAtom), current: Obj.getDXN(thread).toString() });
126
+ },
127
+ [invokePromise, identity, subject, registry, stateAtom],
128
+ );
129
+
130
+ const handleResolve = useCallback(
131
+ (anchor: AnchoredTo.AnchoredTo) =>
132
+ invokePromise(ThreadOperation.ToggleResolved, {
133
+ thread: Relation.getSource(anchor) as Thread.Thread,
134
+ }),
135
+ [invokePromise],
136
+ );
137
+
138
+ const handleThreadDelete = useCallback(
139
+ (anchor: AnchoredTo.AnchoredTo) => invokePromise(ThreadOperation.Delete, { anchor, subject }),
140
+ [invokePromise, subject],
141
+ );
142
+
143
+ const handleMessageDelete = useCallback(
144
+ (anchor: AnchoredTo.AnchoredTo, messageId: string) =>
145
+ invokePromise(ThreadOperation.DeleteMessage, {
146
+ anchor,
147
+ subject,
148
+ messageId,
149
+ }),
150
+ [invokePromise, subject],
151
+ );
152
+
153
+ const handleAcceptProposal = useCallback<NonNullable<CommentsPanelProps['onAcceptProposal']>>(
154
+ async (anchor, messageId) => {
155
+ const thread = Relation.getSource(anchor) as Thread.Thread;
156
+ const messageIndex = thread.messages.findIndex(Ref.hasObjectId(messageId));
157
+ const message = thread.messages[messageIndex]?.target;
158
+ const proposal = message?.blocks.find((block) => block._tag === 'proposal');
159
+ if (!proposal || !anchor.anchor) {
160
+ return;
161
+ }
162
+
163
+ await invokePromise(CollaborationOperation.AcceptProposal, {
164
+ subject,
165
+ anchor: anchor.anchor,
166
+ proposal,
167
+ });
168
+ await invokePromise(ThreadOperation.ToggleResolved, { thread });
169
+ },
170
+ [invokePromise, subject],
171
+ );
172
+
173
+ const comments = (
174
+ <CommentsPanel
175
+ anchors={anchors}
176
+ currentId={isAttended ? state.current : undefined}
177
+ showResolvedThreads={showResolvedThreads}
178
+ onAttend={handleAttend}
179
+ onComment={handleComment}
180
+ onResolve={handleResolve}
181
+ onMessageDelete={handleMessageDelete}
182
+ onThreadDelete={handleThreadDelete}
183
+ onAcceptProposal={handleAcceptProposal}
184
+ />
185
+ );
186
+
187
+ return (
188
+ <Tabs.Root
189
+ orientation='horizontal'
190
+ value={showResolvedThreads ? 'all' : 'unresolved'}
191
+ onValueChange={onChangeViewState}
192
+ >
193
+ <Panel.Root>
194
+ <Panel.Toolbar asChild>
195
+ <Toolbar.Root>
196
+ <Tabs.Tablist classNames='p-0'>
197
+ <Tabs.Tab classNames='text-sm' value='unresolved'>
198
+ {t('show-unresolved.label')}
199
+ </Tabs.Tab>
200
+ <Tabs.Tab classNames='text-sm' value='all'>
201
+ {t('show-all.label')}
202
+ </Tabs.Tab>
203
+ </Tabs.Tablist>
204
+ </Toolbar.Root>
205
+ </Panel.Toolbar>
206
+ <Panel.Content asChild>
207
+ <ScrollArea.Root thin>
208
+ <ScrollArea.Viewport>
209
+ <Tabs.Panel value='all'>{showResolvedThreads && comments}</Tabs.Panel>
210
+ <Tabs.Panel value='unresolved'>{!showResolvedThreads && comments}</Tabs.Panel>
211
+ </ScrollArea.Viewport>
212
+ </ScrollArea.Root>
213
+ </Panel.Content>
214
+ </Panel.Root>
215
+ </Tabs.Root>
216
+ );
217
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { ThreadCompanion as default } from './ThreadCompanion';
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export const CallDebugPanel: ComponentType<any> = lazy(() => import('./CallDebugPanel'));
8
+ export const CallSidebar: ComponentType<any> = lazy(() => import('./CallSidebar'));
9
+ export const ChannelContainer: ComponentType<any> = lazy(() => import('./ChannelContainer'));
10
+ export const ChatContainer: ComponentType<any> = lazy(() => import('./ChatContainer'));
11
+ export const ThreadCompanion: ComponentType<any> = lazy(() => import('./ThreadCompanion'));
@@ -5,8 +5,8 @@
5
5
  import { HighlightStyle, StreamLanguage, syntaxHighlighting } from '@codemirror/language';
6
6
  import { type Extension } from '@codemirror/state';
7
7
 
8
- import { tags } from '@dxos/react-ui-editor';
9
- import { mx } from '@dxos/react-ui-theme';
8
+ import { tags } from '@dxos/ui-editor';
9
+ import { mx } from '@dxos/ui-theme';
10
10
 
11
11
  /**
12
12
  * https://github.com/codemirror/stream-parser/blob/main/test/test-stream-parser.ts
@@ -29,7 +29,7 @@ const parser = StreamLanguage.define<{ count: number }>({
29
29
  const styles = HighlightStyle.define([
30
30
  {
31
31
  tag: tags.tagName,
32
- class: mx('dx-tag dx-tag--indigo text-baseText font-medium'),
32
+ class: mx('dx-tag dx-tag--indigo text-base-surface-text font-medium'),
33
33
  },
34
34
  ]);
35
35
 
@@ -2,4 +2,5 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ export * from './command';
5
6
  export * from './threads';
@@ -4,17 +4,17 @@
4
4
 
5
5
  import { type Extension } from '@codemirror/state';
6
6
  import { EditorView } from '@codemirror/view';
7
- import { computed, effect } from '@preact/signals-core';
7
+ import { type Atom, type Registry } from '@effect-atom/atom-react';
8
8
 
9
- import { type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
10
9
  import { Filter, Obj, Query, Relation } from '@dxos/echo';
11
10
  import { createDocAccessor, getTextInRange } from '@dxos/echo-db';
11
+ import { type OperationInvoker } from '@dxos/operation';
12
12
  import { type Markdown } from '@dxos/plugin-markdown/types';
13
- import { getSpace } from '@dxos/react-client/echo';
14
- import { comments, createExternalCommentSync } from '@dxos/react-ui-editor';
15
13
  import { AnchoredTo, Thread } from '@dxos/types';
14
+ import { comments, createExternalCommentSync } from '@dxos/ui-editor';
16
15
 
17
- import { ThreadAction, type ThreadState } from '../types';
16
+ import { ThreadOperation } from '#operations';
17
+ import { type ThreadState } from '#types';
18
18
 
19
19
  // TODO(burdon): Factor out.
20
20
  const getName = (doc: Markdown.Document, anchor: string): string | undefined => {
@@ -24,46 +24,58 @@ const getName = (doc: Markdown.Document, anchor: string): string | undefined =>
24
24
  }
25
25
  };
26
26
 
27
+ export type ThreadStore = {
28
+ registry: Registry.Registry;
29
+ stateAtom: Atom.Writable<ThreadState>;
30
+ };
31
+
27
32
  /**
28
33
  * Construct plugins.
29
34
  */
30
- export const threads = (state: ThreadState, doc?: Markdown.Document, dispatch?: PromiseIntentDispatcher): Extension => {
31
- const space = getSpace(doc);
32
- if (!doc || !space || !dispatch) {
35
+ export const threads = (
36
+ store: ThreadStore,
37
+ doc?: Markdown.Document,
38
+ invokePromise?: OperationInvoker.OperationInvoker['invokePromise'],
39
+ ): Extension => {
40
+ const db = doc && Obj.getDatabase(doc);
41
+ if (!doc || !db || !invokePromise) {
33
42
  // Include no-op comments extension here to ensure that the facets are always present when they are expected.
34
43
  // TODO(wittjosiah): The Editor should only look for these facets when comments are available.
35
44
  return [comments()];
36
45
  }
37
46
 
38
- const query = space.db.query(Query.select(Filter.ids(doc.id)).targetOf(AnchoredTo.AnchoredTo));
39
- const unsubscribe = query.subscribe();
47
+ const { registry, stateAtom } = store;
48
+ const objectId = Obj.getDXN(doc).toString();
49
+ const query = db.query(Query.select(Filter.id(doc.id)).targetOf(AnchoredTo.AnchoredTo));
40
50
 
41
- const anchors = computed(() =>
42
- query.objects
51
+ // Get current anchors by combining query results with store drafts.
52
+ const getAnchors = () =>
53
+ query.results
43
54
  .filter((anchor) => {
44
55
  const thread = Relation.getSource(anchor);
45
56
  return Obj.instanceOf(Thread.Thread, thread) && thread.status !== 'resolved';
46
57
  })
47
- .concat(state.drafts[Obj.getDXN(doc).toString()] ?? []),
48
- );
58
+ .concat(registry.get(stateAtom).drafts[objectId] ?? []);
49
59
 
50
60
  return [
51
61
  EditorView.domEventHandlers({
52
62
  destroy: () => {
53
- unsubscribe();
63
+ // Note: cleanup functions for subscriptions are handled by createExternalCommentSync.
54
64
  },
55
65
  }),
56
66
 
57
67
  EditorView.updateListener.of((update) => {
58
68
  if (update.docChanged) {
59
- anchors.value.forEach((anchor) => {
69
+ getAnchors().forEach((anchor) => {
60
70
  if (anchor.anchor) {
61
71
  // Only update if the name has changed, otherwise this will cause an infinite loop.
62
72
  // Skip if the name is empty; this means comment text was deleted, but thread name should remain.
63
73
  const name = getName(doc, anchor.anchor);
64
74
  const thread = Relation.getSource(anchor) as Thread.Thread;
65
75
  if (name && name !== thread.name) {
66
- thread.name = name;
76
+ Obj.change(thread, (obj) => {
77
+ obj.name = name;
78
+ });
67
79
  }
68
80
  }
69
81
  });
@@ -71,10 +83,18 @@ export const threads = (state: ThreadState, doc?: Markdown.Document, dispatch?:
71
83
  }),
72
84
 
73
85
  createExternalCommentSync(
74
- Obj.getDXN(doc).toString(),
75
- (sink) => effect(() => sink()),
86
+ objectId,
87
+ (sink) => {
88
+ // Subscribe to both query changes and store state changes.
89
+ const unsubQuery = query.subscribe(sink);
90
+ const unsubStore = registry.subscribe(stateAtom, sink);
91
+ return () => {
92
+ unsubQuery();
93
+ unsubStore();
94
+ };
95
+ },
76
96
  () =>
77
- anchors.value
97
+ getAnchors()
78
98
  .filter((anchor) => anchor.anchor)
79
99
  .map((anchor) => ({
80
100
  id: Obj.getDXN(Relation.getSource(anchor)).toString(),
@@ -83,52 +103,67 @@ export const threads = (state: ThreadState, doc?: Markdown.Document, dispatch?:
83
103
  ),
84
104
 
85
105
  comments({
86
- id: Obj.getDXN(doc).toString(),
106
+ id: objectId,
87
107
  onCreate: ({ cursor }) => {
88
108
  const name = getName(doc, cursor);
89
- void dispatch(
90
- createIntent(ThreadAction.Create, {
91
- anchor: cursor,
92
- name,
93
- subject: doc,
94
- }),
95
- );
109
+ void invokePromise(ThreadOperation.Create, {
110
+ anchor: cursor,
111
+ name,
112
+ subject: doc,
113
+ });
96
114
  },
97
115
  onDelete: ({ id }) => {
98
- const draft = state.drafts[Obj.getDXN(doc).toString()];
99
- if (draft) {
100
- const index = draft.findIndex((thread) => Obj.getDXN(thread).toString() === id);
116
+ const drafts = registry.get(stateAtom).drafts[objectId];
117
+ if (drafts) {
118
+ const index = drafts.findIndex((draft) => Relation.getDXN(draft).toString() === id);
101
119
  if (index !== -1) {
102
- draft.splice(index, 1);
120
+ const current = registry.get(stateAtom);
121
+ registry.set(stateAtom, {
122
+ ...current,
123
+ drafts: {
124
+ ...current.drafts,
125
+ [objectId]: current.drafts[objectId]?.filter((_, i) => i !== index),
126
+ },
127
+ });
103
128
  }
104
129
  }
105
130
 
106
- const thread = query.objects.find((object) => Relation.getSource(object).id === id);
131
+ const thread = query.results.find((object) => Relation.getSource(object).id === id);
107
132
  if (thread) {
108
- thread.anchor = undefined;
133
+ Relation.change(thread, (obj) => {
134
+ obj.anchor = undefined;
135
+ });
109
136
  }
110
137
  },
111
138
  onUpdate: ({ id, cursor }) => {
112
- const draft = state.drafts[Obj.getDXN(doc).toString()]?.find((thread) => Obj.getDXN(thread).toString() === id);
139
+ const draft = registry.get(stateAtom).drafts[objectId]?.find((d) => Relation.getDXN(d).toString() === id);
113
140
  if (draft) {
114
141
  const thread = Relation.getSource(draft) as Thread.Thread;
115
- thread.name = getName(doc, cursor);
116
- draft.anchor = cursor;
142
+ Obj.change(thread, (obj) => {
143
+ obj.name = getName(doc, cursor);
144
+ });
145
+ Relation.change(draft, (obj) => {
146
+ obj.anchor = cursor;
147
+ });
117
148
  }
118
149
 
119
- const relation = query.objects.find((object) => Relation.getSource(object).id === id);
150
+ const relation = query.results.find((object) => Relation.getSource(object).id === id);
120
151
  if (relation) {
121
152
  const thread = Relation.getSource(relation);
122
153
  if (Obj.instanceOf(Thread.Thread, thread)) {
123
- thread.name = getName(doc, cursor);
124
- relation.anchor = cursor;
154
+ Obj.change(thread, (obj) => {
155
+ obj.name = getName(doc, cursor);
156
+ });
157
+ Relation.change(relation, (obj) => {
158
+ obj.anchor = cursor;
159
+ });
125
160
  }
126
161
  }
127
162
  },
128
163
  onSelect: ({ selection }) => {
129
164
  const current = selection.current ?? selection.closest;
130
165
  if (current) {
131
- void dispatch(createIntent(ThreadAction.Select, { current }));
166
+ void invokePromise(ThreadOperation.Select, { current });
132
167
  }
133
168
  },
134
169
  }),
@@ -4,34 +4,38 @@
4
4
 
5
5
  import { useCallback } from 'react';
6
6
 
7
- import { createIntent } from '@dxos/app-framework';
8
- import { useIntentDispatcher } from '@dxos/app-framework/react';
9
- import { type Live } from '@dxos/live-object';
10
- import { ObservabilityAction } from '@dxos/plugin-observability/types';
11
- import { getSpace } from '@dxos/react-client/echo';
7
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
8
+ import { Obj } from '@dxos/echo';
9
+ import { ObservabilityOperation } from '@dxos/plugin-observability/operations';
12
10
  import { useOnTransition } from '@dxos/react-ui';
13
11
  import { type ContentBlock } from '@dxos/types';
14
12
 
15
- export const useOnEditAnalytics = (message: Live<any>, textBlock: ContentBlock.Text | undefined, editing: boolean) => {
16
- const { dispatchPromise: dispatch } = useIntentDispatcher();
13
+ export const useOnEditAnalytics = (
14
+ message: any | undefined,
15
+ textBlock: ContentBlock.Text | undefined,
16
+ editing: boolean,
17
+ ) => {
18
+ const { invokePromise } = useOperationInvoker();
17
19
 
18
20
  const onEdit = useCallback(() => {
19
- const space = getSpace(message);
20
- if (!space || !textBlock) {
21
+ if (!message || !textBlock) {
21
22
  return;
22
23
  }
23
24
 
24
- void dispatch(
25
- createIntent(ObservabilityAction.SendEvent, {
26
- name: 'threads.message.update',
27
- properties: {
28
- spaceId: space.id,
29
- messageId: message.id,
30
- messageLength: textBlock?.text.length,
31
- },
32
- }),
33
- );
34
- }, [dispatch, message, textBlock]);
25
+ const db = Obj.getDatabase(message);
26
+ if (!db) {
27
+ return;
28
+ }
29
+
30
+ void invokePromise(ObservabilityOperation.SendEvent, {
31
+ name: 'threads.message.update',
32
+ properties: {
33
+ spaceId: db.spaceId,
34
+ messageId: message.id,
35
+ messageLength: textBlock?.text.length,
36
+ },
37
+ });
38
+ }, [invokePromise, message, textBlock]);
35
39
 
36
40
  useOnTransition(editing, true, false, onEdit);
37
41
  };
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export { ThreadCapabilities } from './capabilities';
5
+ export { ThreadCapabilities } from './types';
6
6
  export * from './calls';
7
7
  export * from './hooks';
8
8
  export * from './meta';
package/src/meta.ts CHANGED
@@ -2,12 +2,12 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
6
  import { trim } from '@dxos/util';
7
7
 
8
8
  // TODO(wittjosiah): Needs screenshots.
9
- export const meta: PluginMeta = {
10
- id: 'dxos.org/plugin/thread',
9
+ export const meta: Plugin.Meta = {
10
+ id: 'org.dxos.plugin.thread',
11
11
  name: 'Chat',
12
12
  description: trim`
13
13
  Multi-modal communication platform supporting text chat, voice, and video conferencing.
@@ -18,4 +18,4 @@ export const meta: PluginMeta = {
18
18
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-thread',
19
19
  };
20
20
 
21
- export const THREAD_ITEM = `${meta.id}/item`;
21
+ export const THREAD_ITEM = `${meta.id}.item`;
@@ -0,0 +1,81 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capabilities, Capability } from '@dxos/app-framework';
8
+ import { Obj, Ref, Relation } from '@dxos/echo';
9
+ import { invariant } from '@dxos/invariant';
10
+ import { Operation } from '@dxos/operation';
11
+ import { ObservabilityOperation } from '@dxos/plugin-observability/operations';
12
+ import { SpaceOperation } from '@dxos/plugin-space/operations';
13
+ import { AnchoredTo, Message, Thread } from '@dxos/types';
14
+
15
+ import { ThreadCapabilities } from '../types';
16
+ import { AddMessage } from './definitions';
17
+
18
+ const handler: Operation.WithHandler<typeof AddMessage> = AddMessage.pipe(
19
+ Operation.withHandler(
20
+ Effect.fnUntraced(function* ({ anchor, subject, sender, text }) {
21
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
22
+ const stateAtom = yield* Capability.get(ThreadCapabilities.State);
23
+ const thread = Relation.getSource(anchor) as Thread.Thread;
24
+ const subjectId = Obj.getDXN(subject).toString();
25
+ const db = Obj.getDatabase(subject);
26
+ invariant(db, 'Database not found');
27
+
28
+ const message = Obj.make(Message.Message, {
29
+ created: new Date().toISOString(),
30
+ sender,
31
+ blocks: [{ _tag: 'text', text }],
32
+ });
33
+ Obj.change(thread, (obj) => {
34
+ obj.messages.push(Ref.make(message));
35
+ });
36
+
37
+ const state = registry.get(stateAtom);
38
+ const draft = state.drafts[subjectId]?.find((a: { id: string }) => a.id === anchor.id);
39
+ if (draft) {
40
+ Obj.change(thread, (obj) => {
41
+ obj.status = 'active';
42
+ });
43
+ registry.set(stateAtom, {
44
+ ...state,
45
+ drafts: {
46
+ ...state.drafts,
47
+ [subjectId]: state.drafts[subjectId]?.filter((a: { id: string }) => a.id !== anchor.id),
48
+ },
49
+ });
50
+ yield* Operation.invoke(SpaceOperation.AddObject, { object: thread, target: db, hidden: true });
51
+ yield* Operation.invoke(SpaceOperation.AddRelation, {
52
+ db,
53
+ schema: AnchoredTo.AnchoredTo,
54
+ source: thread,
55
+ target: subject,
56
+ fields: { anchor: draft.anchor },
57
+ });
58
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
59
+ name: 'threads.create',
60
+ properties: {
61
+ spaceId: db.spaceId,
62
+ threadId: thread.id,
63
+ },
64
+ });
65
+ }
66
+
67
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
68
+ name: 'threads.message.add',
69
+ properties: {
70
+ spaceId: db.spaceId,
71
+ threadId: thread.id,
72
+ threadLength: thread.messages.length,
73
+ messageId: message.id,
74
+ messageLength: text.length,
75
+ },
76
+ });
77
+ }),
78
+ ),
79
+ );
80
+
81
+ export default handler;
@@ -0,0 +1,26 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Obj, Ref } from '@dxos/echo';
8
+ import { Operation } from '@dxos/operation';
9
+ import { Thread } from '@dxos/types';
10
+
11
+ import { CreateChannelThread } from './definitions';
12
+
13
+ const handler: Operation.WithHandler<typeof CreateChannelThread> = CreateChannelThread.pipe(
14
+ Operation.withHandler((input) =>
15
+ Effect.sync(() => {
16
+ const thread = Thread.make({ status: 'active' });
17
+ const threadRef = Ref.make(thread);
18
+ Obj.change(input.channel, (obj) => {
19
+ obj.threads.push(threadRef);
20
+ });
21
+ return { object: thread };
22
+ }),
23
+ ),
24
+ );
25
+
26
+ export default handler;