@dxos/plugin-thread 0.8.3 → 0.8.4-main.1068cf700f

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 (462) hide show
  1. package/dist/lib/browser/app-graph-builder-XFGLMIGK.mjs +189 -0
  2. package/dist/lib/browser/app-graph-builder-XFGLMIGK.mjs.map +7 -0
  3. package/dist/lib/browser/blueprint-definition-ACPH22F7.mjs +18 -0
  4. package/dist/lib/browser/blueprint-definition-ACPH22F7.mjs.map +7 -0
  5. package/dist/lib/browser/blueprints/index.mjs +8 -0
  6. package/dist/lib/browser/call-manager-GDGIKJKN.mjs +26 -0
  7. package/dist/lib/browser/call-manager-GDGIKJKN.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-2FIHSX35.mjs +293 -0
  9. package/dist/lib/browser/chunk-2FIHSX35.mjs.map +7 -0
  10. package/dist/lib/browser/chunk-4EUEMHNI.mjs +1817 -0
  11. package/dist/lib/browser/chunk-4EUEMHNI.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-JKQUJOTX.mjs → chunk-CP7E2HRE.mjs} +3 -3
  13. package/dist/lib/browser/chunk-CP7E2HRE.mjs.map +7 -0
  14. package/dist/lib/browser/{chunk-4H4A264L.mjs → chunk-ERK254BS.mjs} +407 -305
  15. package/dist/lib/browser/chunk-ERK254BS.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-ISCHODBV.mjs +106 -0
  17. package/dist/lib/browser/chunk-ISCHODBV.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  19. package/dist/lib/browser/chunk-JBB73URQ.mjs +184 -0
  20. package/dist/lib/browser/chunk-JBB73URQ.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-RH7XTXSR.mjs +106 -0
  22. package/dist/lib/browser/chunk-RH7XTXSR.mjs.map +7 -0
  23. package/dist/lib/browser/index.mjs +164 -151
  24. package/dist/lib/browser/index.mjs.map +4 -4
  25. package/dist/lib/browser/markdown-YJCSOWXX.mjs +210 -0
  26. package/dist/lib/browser/markdown-YJCSOWXX.mjs.map +7 -0
  27. package/dist/lib/browser/meta.json +1 -1
  28. package/dist/lib/browser/operation-resolver-PROCP5L4.mjs +441 -0
  29. package/dist/lib/browser/operation-resolver-PROCP5L4.mjs.map +7 -0
  30. package/dist/lib/browser/react-root-FHK2SVPU.mjs +25 -0
  31. package/dist/lib/browser/react-root-FHK2SVPU.mjs.map +7 -0
  32. package/dist/lib/browser/react-surface-7MQA6VSH.mjs +111 -0
  33. package/dist/lib/browser/react-surface-7MQA6VSH.mjs.map +7 -0
  34. package/dist/lib/browser/repair-6OZ75AUU.mjs +38 -0
  35. package/dist/lib/browser/repair-6OZ75AUU.mjs.map +7 -0
  36. package/dist/lib/browser/settings-TWKOTGSU.mjs +33 -0
  37. package/dist/lib/browser/settings-TWKOTGSU.mjs.map +7 -0
  38. package/dist/lib/browser/state-SJR2GL5G.mjs +24 -0
  39. package/dist/lib/browser/state-SJR2GL5G.mjs.map +7 -0
  40. package/dist/lib/browser/types/index.mjs +10 -12
  41. package/dist/lib/node-esm/app-graph-builder-IN6VLJBO.mjs +190 -0
  42. package/dist/lib/node-esm/app-graph-builder-IN6VLJBO.mjs.map +7 -0
  43. package/dist/lib/node-esm/blueprint-definition-SXVKFUNV.mjs +19 -0
  44. package/dist/lib/node-esm/blueprint-definition-SXVKFUNV.mjs.map +7 -0
  45. package/dist/lib/node-esm/blueprints/index.mjs +9 -0
  46. package/dist/lib/node-esm/call-manager-36UAAQCJ.mjs +27 -0
  47. package/dist/lib/node-esm/call-manager-36UAAQCJ.mjs.map +7 -0
  48. package/dist/lib/node-esm/{chunk-PGRP3O4O.mjs → chunk-ABUFOZVX.mjs} +3 -3
  49. package/dist/lib/node-esm/chunk-ABUFOZVX.mjs.map +7 -0
  50. package/dist/lib/node-esm/chunk-G7PZNN3Z.mjs +185 -0
  51. package/dist/lib/node-esm/chunk-G7PZNN3Z.mjs.map +7 -0
  52. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  53. package/dist/lib/node-esm/chunk-OKVE6CLS.mjs +107 -0
  54. package/dist/lib/node-esm/chunk-OKVE6CLS.mjs.map +7 -0
  55. package/dist/lib/node-esm/{chunk-WXNPD542.mjs → chunk-QP3KQOPQ.mjs} +406 -305
  56. package/dist/lib/node-esm/chunk-QP3KQOPQ.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-RBRWHRHE.mjs +1818 -0
  58. package/dist/lib/node-esm/chunk-RBRWHRHE.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-VBI32FGI.mjs +108 -0
  60. package/dist/lib/node-esm/chunk-VBI32FGI.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-WMWUXWAS.mjs +294 -0
  62. package/dist/lib/node-esm/chunk-WMWUXWAS.mjs.map +7 -0
  63. package/dist/lib/node-esm/index.mjs +164 -151
  64. package/dist/lib/node-esm/index.mjs.map +4 -4
  65. package/dist/lib/node-esm/markdown-6LRP3PAP.mjs +211 -0
  66. package/dist/lib/node-esm/markdown-6LRP3PAP.mjs.map +7 -0
  67. package/dist/lib/node-esm/meta.json +1 -1
  68. package/dist/lib/node-esm/operation-resolver-LPEPV5BF.mjs +442 -0
  69. package/dist/lib/node-esm/operation-resolver-LPEPV5BF.mjs.map +7 -0
  70. package/dist/lib/node-esm/react-root-P5P4VGQJ.mjs +26 -0
  71. package/dist/lib/node-esm/react-root-P5P4VGQJ.mjs.map +7 -0
  72. package/dist/lib/node-esm/react-surface-M7VI5XG2.mjs +112 -0
  73. package/dist/lib/node-esm/react-surface-M7VI5XG2.mjs.map +7 -0
  74. package/dist/lib/node-esm/repair-6777EPOM.mjs +39 -0
  75. package/dist/lib/node-esm/repair-6777EPOM.mjs.map +7 -0
  76. package/dist/lib/node-esm/settings-5O254B3Z.mjs +34 -0
  77. package/dist/lib/node-esm/settings-5O254B3Z.mjs.map +7 -0
  78. package/dist/lib/node-esm/state-5R3TZJQE.mjs +25 -0
  79. package/dist/lib/node-esm/state-5R3TZJQE.mjs.map +7 -0
  80. package/dist/lib/node-esm/types/index.mjs +10 -12
  81. package/dist/types/src/ThreadPlugin.d.ts +2 -1
  82. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  83. package/dist/types/src/blueprints/index.d.ts +2 -0
  84. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  85. package/dist/types/src/blueprints/thread-blueprint.d.ts +21 -0
  86. package/dist/types/src/blueprints/thread-blueprint.d.ts.map +1 -0
  87. package/dist/types/src/calls/call-manager.d.ts +40 -30
  88. package/dist/types/src/calls/call-manager.d.ts.map +1 -1
  89. package/dist/types/src/calls/call-swarm-synchronizer.d.ts +2 -2
  90. package/dist/types/src/calls/call-swarm-synchronizer.d.ts.map +1 -1
  91. package/dist/types/src/calls/media-manager.d.ts +2 -2
  92. package/dist/types/src/calls/media-manager.d.ts.map +1 -1
  93. package/dist/types/src/calls/types.d.ts +1 -1
  94. package/dist/types/src/calls/types.d.ts.map +1 -1
  95. package/dist/types/src/calls/util/calls-service.d.ts +9 -4
  96. package/dist/types/src/calls/util/calls-service.d.ts.map +1 -1
  97. package/dist/types/src/calls/util/stub-media-streams.d.ts.map +1 -1
  98. package/dist/types/src/calls/util/task-scheduling.d.ts +2 -2
  99. package/dist/types/src/calls/util/task-scheduling.d.ts.map +1 -1
  100. package/dist/types/src/calls-service.stories.d.ts +23 -0
  101. package/dist/types/src/calls-service.stories.d.ts.map +1 -0
  102. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  103. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  104. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  105. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  106. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
  107. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
  108. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
  109. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
  110. package/dist/types/src/capabilities/call-manager/call-manager.d.ts +6 -0
  111. package/dist/types/src/capabilities/call-manager/call-manager.d.ts.map +1 -0
  112. package/dist/types/src/capabilities/call-manager/index.d.ts +3 -0
  113. package/dist/types/src/capabilities/call-manager/index.d.ts.map +1 -0
  114. package/dist/types/src/capabilities/index.d.ts +10 -15
  115. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  116. package/dist/types/src/capabilities/markdown/index.d.ts +3 -0
  117. package/dist/types/src/capabilities/markdown/index.d.ts.map +1 -0
  118. package/dist/types/src/capabilities/markdown/markdown.d.ts +5 -0
  119. package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -0
  120. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  121. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  122. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  123. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  124. package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
  125. package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
  126. package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
  127. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
  128. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  129. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  130. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  131. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  132. package/dist/types/src/capabilities/repair/index.d.ts +3 -0
  133. package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
  134. package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
  135. package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
  136. package/dist/types/src/capabilities/settings/index.d.ts +3 -0
  137. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  138. package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
  139. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  140. package/dist/types/src/capabilities/state/index.d.ts +3 -0
  141. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  142. package/dist/types/src/capabilities/state/state.d.ts +7 -0
  143. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  144. package/dist/types/src/components/Call/Call.d.ts.map +1 -1
  145. package/dist/types/src/components/Call/Toolbar.d.ts +2 -2
  146. package/dist/types/src/components/Call/Toolbar.d.ts.map +1 -1
  147. package/dist/types/src/components/CallDebugPanel.d.ts +7 -0
  148. package/dist/types/src/components/CallDebugPanel.d.ts.map +1 -1
  149. package/dist/types/src/components/CallSidebar.d.ts.map +1 -1
  150. package/dist/types/src/components/ChannelContainer.d.ts +5 -6
  151. package/dist/types/src/components/ChannelContainer.d.ts.map +1 -1
  152. package/dist/types/src/components/ChannelContainer.stories.d.ts +159 -5
  153. package/dist/types/src/components/ChannelContainer.stories.d.ts.map +1 -1
  154. package/dist/types/src/components/Chat.stories.d.ts +162 -4
  155. package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
  156. package/dist/types/src/components/ChatContainer.d.ts +8 -7
  157. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  158. package/dist/types/src/components/Comments.stories.d.ts +160 -4
  159. package/dist/types/src/components/Comments.stories.d.ts.map +1 -1
  160. package/dist/types/src/components/CommentsContainer.d.ts +6 -6
  161. package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
  162. package/dist/types/src/components/CommentsThreadContainer.d.ts +14 -0
  163. package/dist/types/src/components/CommentsThreadContainer.d.ts.map +1 -0
  164. package/dist/types/src/components/Lobby/Lobby.d.ts.map +1 -1
  165. package/dist/types/src/components/Media/VideoObject.d.ts +3 -3
  166. package/dist/types/src/components/Media/VideoObject.d.ts.map +1 -1
  167. package/dist/types/src/components/Media/VideoObject.stories.d.ts +18 -4
  168. package/dist/types/src/components/Media/VideoObject.stories.d.ts.map +1 -1
  169. package/dist/types/src/components/MessageContainer.d.ts +7 -3
  170. package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
  171. package/dist/types/src/components/Participant/Participant.d.ts.map +1 -1
  172. package/dist/types/src/components/Participant/ParticipantGrid.d.ts.map +1 -1
  173. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts +159 -3
  174. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts.map +1 -1
  175. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts +161 -4
  176. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts.map +1 -1
  177. package/dist/types/src/components/ResponsiveGrid/ResponsiveGridItem.d.ts.map +1 -1
  178. package/dist/types/src/components/ThreadCompanion.d.ts +5 -0
  179. package/dist/types/src/components/ThreadCompanion.d.ts.map +1 -0
  180. package/dist/types/src/components/ThreadSettings.d.ts +4 -2
  181. package/dist/types/src/components/ThreadSettings.d.ts.map +1 -1
  182. package/dist/types/src/components/command-extension.d.ts.map +1 -1
  183. package/dist/types/src/components/index.d.ts +4 -4
  184. package/dist/types/src/components/index.d.ts.map +1 -1
  185. package/dist/types/src/components/testing.d.ts +3 -2
  186. package/dist/types/src/components/testing.d.ts.map +1 -1
  187. package/dist/types/src/extensions/threads.d.ts +8 -3
  188. package/dist/types/src/extensions/threads.d.ts.map +1 -1
  189. package/dist/types/src/functions/create-proposals.d.ts +13 -0
  190. package/dist/types/src/functions/create-proposals.d.ts.map +1 -0
  191. package/dist/types/src/functions/index.d.ts +2 -0
  192. package/dist/types/src/functions/index.d.ts.map +1 -0
  193. package/dist/types/src/hooks/analytics.d.ts +2 -3
  194. package/dist/types/src/hooks/analytics.d.ts.map +1 -1
  195. package/dist/types/src/hooks/index.d.ts +3 -0
  196. package/dist/types/src/hooks/index.d.ts.map +1 -1
  197. package/dist/types/src/hooks/useBlackCanvasStreamTrack.d.ts +2 -0
  198. package/dist/types/src/hooks/useBlackCanvasStreamTrack.d.ts.map +1 -0
  199. package/dist/types/src/hooks/useInaudibleAudioStreamTrack.d.ts +2 -0
  200. package/dist/types/src/hooks/useInaudibleAudioStreamTrack.d.ts.map +1 -0
  201. package/dist/types/src/hooks/useVideoStreamTrack.d.ts +3 -0
  202. package/dist/types/src/hooks/useVideoStreamTrack.d.ts.map +1 -0
  203. package/dist/types/src/index.d.ts +1 -1
  204. package/dist/types/src/index.d.ts.map +1 -1
  205. package/dist/types/src/meta.d.ts +3 -4
  206. package/dist/types/src/meta.d.ts.map +1 -1
  207. package/dist/types/src/testing/stories.d.ts +2 -1
  208. package/dist/types/src/testing/stories.d.ts.map +1 -1
  209. package/dist/types/src/translations.d.ts +146 -194
  210. package/dist/types/src/translations.d.ts.map +1 -1
  211. package/dist/types/src/types/Channel.d.ts +695 -0
  212. package/dist/types/src/types/Channel.d.ts.map +1 -0
  213. package/dist/types/src/types/capabilities.d.ts +23 -0
  214. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  215. package/dist/types/src/types/index.d.ts +2 -1
  216. package/dist/types/src/types/index.d.ts.map +1 -1
  217. package/dist/types/src/types/types.d.ts +3224 -320
  218. package/dist/types/src/types/types.d.ts.map +1 -1
  219. package/dist/types/src/util.d.ts +17 -2
  220. package/dist/types/src/util.d.ts.map +1 -1
  221. package/dist/types/tsconfig.tsbuildinfo +1 -1
  222. package/package.json +93 -67
  223. package/src/ThreadPlugin.tsx +107 -143
  224. package/src/blueprints/index.ts +5 -0
  225. package/src/blueprints/thread-blueprint.ts +32 -0
  226. package/src/calls/call-manager.ts +78 -50
  227. package/src/calls/call-swarm-synchronizer.ts +3 -3
  228. package/src/calls/media-manager.ts +77 -41
  229. package/src/calls/types.ts +8 -4
  230. package/src/calls/util/calls-service.ts +73 -19
  231. package/src/calls/util/stub-media-streams.ts +63 -9
  232. package/src/calls/util/task-scheduling.ts +4 -4
  233. package/src/calls-service.stories.tsx +229 -0
  234. package/src/capabilities/app-graph-builder/app-graph-builder.ts +202 -0
  235. package/src/capabilities/app-graph-builder/index.ts +7 -0
  236. package/src/capabilities/blueprint-definition/blueprint-definition.ts +24 -0
  237. package/src/capabilities/blueprint-definition/index.ts +7 -0
  238. package/src/capabilities/call-manager/call-manager.ts +26 -0
  239. package/src/capabilities/call-manager/index.ts +7 -0
  240. package/src/capabilities/index.ts +10 -12
  241. package/src/capabilities/markdown/index.ts +7 -0
  242. package/src/capabilities/markdown/markdown.ts +83 -0
  243. package/src/capabilities/operation-resolver/index.ts +7 -0
  244. package/src/capabilities/operation-resolver/operation-resolver.ts +400 -0
  245. package/src/capabilities/react-root/index.ts +7 -0
  246. package/src/capabilities/react-root/react-root.tsx +20 -0
  247. package/src/capabilities/react-surface/index.ts +7 -0
  248. package/src/capabilities/react-surface/react-surface.tsx +98 -0
  249. package/src/capabilities/repair/index.ts +7 -0
  250. package/src/capabilities/repair/repair.ts +51 -0
  251. package/src/capabilities/settings/index.ts +7 -0
  252. package/src/capabilities/settings/settings.ts +34 -0
  253. package/src/capabilities/state/index.ts +7 -0
  254. package/src/capabilities/state/state.ts +22 -0
  255. package/src/components/Call/Call.tsx +11 -6
  256. package/src/components/Call/Toolbar.tsx +42 -33
  257. package/src/components/CallDebugPanel.tsx +114 -57
  258. package/src/components/CallSidebar.tsx +6 -3
  259. package/src/components/ChannelContainer.stories.tsx +23 -21
  260. package/src/components/ChannelContainer.tsx +47 -38
  261. package/src/components/Chat.stories.tsx +37 -39
  262. package/src/components/ChatContainer.tsx +56 -44
  263. package/src/components/Comments.stories.tsx +63 -55
  264. package/src/components/CommentsContainer.tsx +20 -16
  265. package/src/components/CommentsThreadContainer.tsx +173 -0
  266. package/src/components/Lobby/Lobby.tsx +10 -8
  267. package/src/components/Media/AudioStream.tsx +2 -2
  268. package/src/components/Media/VideoObject.stories.tsx +36 -28
  269. package/src/components/Media/VideoObject.tsx +2 -2
  270. package/src/components/MessageContainer.tsx +117 -68
  271. package/src/components/Participant/Participant.tsx +34 -15
  272. package/src/components/Participant/ParticipantGrid.tsx +2 -1
  273. package/src/components/ResponsiveGrid/ResponsiveContainer.stories.tsx +9 -9
  274. package/src/components/ResponsiveGrid/ResponsiveContainer.tsx +3 -3
  275. package/src/components/ResponsiveGrid/ResponsiveGrid.stories.tsx +45 -43
  276. package/src/components/ResponsiveGrid/ResponsiveGrid.tsx +7 -7
  277. package/src/components/ResponsiveGrid/ResponsiveGridItem.tsx +10 -7
  278. package/src/components/ThreadCompanion.tsx +194 -0
  279. package/src/components/ThreadSettings.tsx +11 -6
  280. package/src/components/command-extension.ts +7 -4
  281. package/src/components/index.ts +5 -8
  282. package/src/components/testing.ts +28 -8
  283. package/src/extensions/threads.ts +88 -44
  284. package/src/functions/create-proposals.ts +57 -0
  285. package/src/functions/index.ts +5 -0
  286. package/src/hooks/analytics.ts +21 -21
  287. package/src/hooks/index.ts +4 -0
  288. package/src/hooks/useBlackCanvasStreamTrack.tsx +27 -0
  289. package/src/hooks/useDebugMode.ts +1 -1
  290. package/src/hooks/useInaudibleAudioStreamTrack.tsx +27 -0
  291. package/src/hooks/useVideoStreamTrack.tsx +36 -0
  292. package/src/index.ts +1 -1
  293. package/src/meta.ts +11 -7
  294. package/src/testing/stories.ts +23 -17
  295. package/src/translations.ts +18 -10
  296. package/src/types/Channel.ts +30 -0
  297. package/src/types/capabilities.ts +34 -0
  298. package/src/types/index.ts +2 -1
  299. package/src/types/types.ts +171 -75
  300. package/src/typings/peermetrics-webrtc-stats.d.ts +17 -1
  301. package/src/typings.d.ts +8 -0
  302. package/src/util.ts +1 -1
  303. package/dist/lib/browser/ChannelContainer-PKFBVENP.mjs +0 -15
  304. package/dist/lib/browser/ChatContainer-RSOKYAMK.mjs +0 -14
  305. package/dist/lib/browser/app-graph-builder-OY7R7EJP.mjs +0 -171
  306. package/dist/lib/browser/app-graph-builder-OY7R7EJP.mjs.map +0 -7
  307. package/dist/lib/browser/call-manager-APQAZWHT.mjs +0 -23
  308. package/dist/lib/browser/call-manager-APQAZWHT.mjs.map +0 -7
  309. package/dist/lib/browser/chunk-4H4A264L.mjs.map +0 -7
  310. package/dist/lib/browser/chunk-5P5BH5GE.mjs +0 -88
  311. package/dist/lib/browser/chunk-5P5BH5GE.mjs.map +0 -7
  312. package/dist/lib/browser/chunk-6NBVNXTM.mjs +0 -21
  313. package/dist/lib/browser/chunk-6NBVNXTM.mjs.map +0 -7
  314. package/dist/lib/browser/chunk-AEXWNS6Z.mjs +0 -128
  315. package/dist/lib/browser/chunk-AEXWNS6Z.mjs.map +0 -7
  316. package/dist/lib/browser/chunk-IIUTBDVB.mjs +0 -17
  317. package/dist/lib/browser/chunk-IIUTBDVB.mjs.map +0 -7
  318. package/dist/lib/browser/chunk-JKQUJOTX.mjs.map +0 -7
  319. package/dist/lib/browser/chunk-PG5CTFKK.mjs +0 -550
  320. package/dist/lib/browser/chunk-PG5CTFKK.mjs.map +0 -7
  321. package/dist/lib/browser/chunk-R5MDLUPC.mjs +0 -18
  322. package/dist/lib/browser/chunk-R5MDLUPC.mjs.map +0 -7
  323. package/dist/lib/browser/chunk-TAFSCSUR.mjs +0 -351
  324. package/dist/lib/browser/chunk-TAFSCSUR.mjs.map +0 -7
  325. package/dist/lib/browser/chunk-XZKBN3NS.mjs +0 -983
  326. package/dist/lib/browser/chunk-XZKBN3NS.mjs.map +0 -7
  327. package/dist/lib/browser/intent-resolver-FK2MDVDT.mjs +0 -353
  328. package/dist/lib/browser/intent-resolver-FK2MDVDT.mjs.map +0 -7
  329. package/dist/lib/browser/markdown-TE5SWWNJ.mjs +0 -169
  330. package/dist/lib/browser/markdown-TE5SWWNJ.mjs.map +0 -7
  331. package/dist/lib/browser/react-root-NK3A4VG7.mjs +0 -27
  332. package/dist/lib/browser/react-root-NK3A4VG7.mjs.map +0 -7
  333. package/dist/lib/browser/react-surface-VXUJKSOG.mjs +0 -108
  334. package/dist/lib/browser/react-surface-VXUJKSOG.mjs.map +0 -7
  335. package/dist/lib/browser/settings-RB2RSLXV.mjs +0 -22
  336. package/dist/lib/browser/settings-RB2RSLXV.mjs.map +0 -7
  337. package/dist/lib/browser/state-RKL5MSDP.mjs +0 -34
  338. package/dist/lib/browser/state-RKL5MSDP.mjs.map +0 -7
  339. package/dist/lib/node/ChannelContainer-YS5YT2ML.cjs +0 -36
  340. package/dist/lib/node/ChannelContainer-YS5YT2ML.cjs.map +0 -7
  341. package/dist/lib/node/ChatContainer-GCOM3M56.cjs +0 -35
  342. package/dist/lib/node/ChatContainer-GCOM3M56.cjs.map +0 -7
  343. package/dist/lib/node/app-graph-builder-PBHJNDQY.cjs +0 -179
  344. package/dist/lib/node/app-graph-builder-PBHJNDQY.cjs.map +0 -7
  345. package/dist/lib/node/call-manager-HV2XJW5O.cjs +0 -37
  346. package/dist/lib/node/call-manager-HV2XJW5O.cjs.map +0 -7
  347. package/dist/lib/node/chunk-44I33JDT.cjs +0 -1731
  348. package/dist/lib/node/chunk-44I33JDT.cjs.map +0 -7
  349. package/dist/lib/node/chunk-4YSNVPWU.cjs +0 -37
  350. package/dist/lib/node/chunk-4YSNVPWU.cjs.map +0 -7
  351. package/dist/lib/node/chunk-E3WBZTTI.cjs +0 -371
  352. package/dist/lib/node/chunk-E3WBZTTI.cjs.map +0 -7
  353. package/dist/lib/node/chunk-ERG7G6FF.cjs +0 -59
  354. package/dist/lib/node/chunk-ERG7G6FF.cjs.map +0 -7
  355. package/dist/lib/node/chunk-FUXJAVFZ.cjs +0 -108
  356. package/dist/lib/node/chunk-FUXJAVFZ.cjs.map +0 -7
  357. package/dist/lib/node/chunk-HLMCEE5K.cjs +0 -41
  358. package/dist/lib/node/chunk-HLMCEE5K.cjs.map +0 -7
  359. package/dist/lib/node/chunk-IP533AMV.cjs +0 -554
  360. package/dist/lib/node/chunk-IP533AMV.cjs.map +0 -7
  361. package/dist/lib/node/chunk-LR5NENBE.cjs +0 -54
  362. package/dist/lib/node/chunk-LR5NENBE.cjs.map +0 -7
  363. package/dist/lib/node/chunk-UM36TPCT.cjs +0 -984
  364. package/dist/lib/node/chunk-UM36TPCT.cjs.map +0 -7
  365. package/dist/lib/node/chunk-ZGDN3XBR.cjs +0 -149
  366. package/dist/lib/node/chunk-ZGDN3XBR.cjs.map +0 -7
  367. package/dist/lib/node/index.cjs +0 -310
  368. package/dist/lib/node/index.cjs.map +0 -7
  369. package/dist/lib/node/intent-resolver-SYSJ5SJG.cjs +0 -363
  370. package/dist/lib/node/intent-resolver-SYSJ5SJG.cjs.map +0 -7
  371. package/dist/lib/node/markdown-GQIPJS2F.cjs +0 -178
  372. package/dist/lib/node/markdown-GQIPJS2F.cjs.map +0 -7
  373. package/dist/lib/node/meta.json +0 -1
  374. package/dist/lib/node/react-root-6HHDMULJ.cjs +0 -51
  375. package/dist/lib/node/react-root-6HHDMULJ.cjs.map +0 -7
  376. package/dist/lib/node/react-surface-NBH42NN2.cjs +0 -122
  377. package/dist/lib/node/react-surface-NBH42NN2.cjs.map +0 -7
  378. package/dist/lib/node/settings-4LQSFEDK.cjs +0 -36
  379. package/dist/lib/node/settings-4LQSFEDK.cjs.map +0 -7
  380. package/dist/lib/node/state-IY5XX3H2.cjs +0 -50
  381. package/dist/lib/node/state-IY5XX3H2.cjs.map +0 -7
  382. package/dist/lib/node/types/index.cjs +0 -38
  383. package/dist/lib/node/types/index.cjs.map +0 -7
  384. package/dist/lib/node-esm/ChannelContainer-O4QJII2P.mjs +0 -16
  385. package/dist/lib/node-esm/ChatContainer-F6CSADV7.mjs +0 -15
  386. package/dist/lib/node-esm/app-graph-builder-BAHBHYWI.mjs +0 -172
  387. package/dist/lib/node-esm/app-graph-builder-BAHBHYWI.mjs.map +0 -7
  388. package/dist/lib/node-esm/call-manager-UUYXLF4T.mjs +0 -24
  389. package/dist/lib/node-esm/call-manager-UUYXLF4T.mjs.map +0 -7
  390. package/dist/lib/node-esm/chunk-2RNIPFDA.mjs +0 -984
  391. package/dist/lib/node-esm/chunk-2RNIPFDA.mjs.map +0 -7
  392. package/dist/lib/node-esm/chunk-ESQC6SYE.mjs +0 -19
  393. package/dist/lib/node-esm/chunk-ESQC6SYE.mjs.map +0 -7
  394. package/dist/lib/node-esm/chunk-K4KAUOKT.mjs +0 -19
  395. package/dist/lib/node-esm/chunk-K4KAUOKT.mjs.map +0 -7
  396. package/dist/lib/node-esm/chunk-O3V45YJP.mjs +0 -90
  397. package/dist/lib/node-esm/chunk-O3V45YJP.mjs.map +0 -7
  398. package/dist/lib/node-esm/chunk-O63QJPQX.mjs +0 -23
  399. package/dist/lib/node-esm/chunk-O63QJPQX.mjs.map +0 -7
  400. package/dist/lib/node-esm/chunk-P6RLFCNT.mjs +0 -352
  401. package/dist/lib/node-esm/chunk-P6RLFCNT.mjs.map +0 -7
  402. package/dist/lib/node-esm/chunk-PGRP3O4O.mjs.map +0 -7
  403. package/dist/lib/node-esm/chunk-UJMPYKT3.mjs +0 -129
  404. package/dist/lib/node-esm/chunk-UJMPYKT3.mjs.map +0 -7
  405. package/dist/lib/node-esm/chunk-UZWVVFT3.mjs +0 -551
  406. package/dist/lib/node-esm/chunk-UZWVVFT3.mjs.map +0 -7
  407. package/dist/lib/node-esm/chunk-WXNPD542.mjs.map +0 -7
  408. package/dist/lib/node-esm/intent-resolver-BU73VYW3.mjs +0 -354
  409. package/dist/lib/node-esm/intent-resolver-BU73VYW3.mjs.map +0 -7
  410. package/dist/lib/node-esm/markdown-HJUWNBLS.mjs +0 -170
  411. package/dist/lib/node-esm/markdown-HJUWNBLS.mjs.map +0 -7
  412. package/dist/lib/node-esm/react-root-RUXOAQNW.mjs +0 -28
  413. package/dist/lib/node-esm/react-root-RUXOAQNW.mjs.map +0 -7
  414. package/dist/lib/node-esm/react-surface-ELXFYKP6.mjs +0 -109
  415. package/dist/lib/node-esm/react-surface-ELXFYKP6.mjs.map +0 -7
  416. package/dist/lib/node-esm/settings-EA7DFSM6.mjs +0 -23
  417. package/dist/lib/node-esm/settings-EA7DFSM6.mjs.map +0 -7
  418. package/dist/lib/node-esm/state-6AUTNROZ.mjs +0 -35
  419. package/dist/lib/node-esm/state-6AUTNROZ.mjs.map +0 -7
  420. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  421. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  422. package/dist/types/src/capabilities/call-manager.d.ts +0 -5
  423. package/dist/types/src/capabilities/call-manager.d.ts.map +0 -1
  424. package/dist/types/src/capabilities/capabilities.d.ts +0 -27
  425. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  426. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  427. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  428. package/dist/types/src/capabilities/markdown.d.ts +0 -4
  429. package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
  430. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  431. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  432. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  433. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  434. package/dist/types/src/capabilities/settings.d.ts +0 -4
  435. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  436. package/dist/types/src/capabilities/state.d.ts +0 -7
  437. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  438. package/dist/types/src/components/CommentContainer.d.ts +0 -13
  439. package/dist/types/src/components/CommentContainer.d.ts.map +0 -1
  440. package/dist/types/src/components/ThreadComplementary.d.ts +0 -5
  441. package/dist/types/src/components/ThreadComplementary.d.ts.map +0 -1
  442. package/dist/types/src/peers.stories.d.ts +0 -11
  443. package/dist/types/src/peers.stories.d.ts.map +0 -1
  444. package/dist/types/src/types/schema.d.ts +0 -133
  445. package/dist/types/src/types/schema.d.ts.map +0 -1
  446. package/src/capabilities/app-graph-builder.ts +0 -180
  447. package/src/capabilities/call-manager.ts +0 -19
  448. package/src/capabilities/capabilities.ts +0 -33
  449. package/src/capabilities/intent-resolver.ts +0 -296
  450. package/src/capabilities/markdown.ts +0 -68
  451. package/src/capabilities/react-root.tsx +0 -17
  452. package/src/capabilities/react-surface.tsx +0 -88
  453. package/src/capabilities/settings.ts +0 -19
  454. package/src/capabilities/state.ts +0 -25
  455. package/src/components/CommentContainer.tsx +0 -198
  456. package/src/components/ThreadComplementary.tsx +0 -151
  457. package/src/peers.stories.tsx +0 -189
  458. package/src/types/schema.ts +0 -33
  459. /package/dist/lib/browser/{ChannelContainer-PKFBVENP.mjs.map → blueprints/index.mjs.map} +0 -0
  460. /package/dist/lib/browser/{ChatContainer-RSOKYAMK.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  461. /package/dist/lib/node-esm/{ChannelContainer-O4QJII2P.mjs.map → blueprints/index.mjs.map} +0 -0
  462. /package/dist/lib/node-esm/{ChatContainer-F6CSADV7.mjs.map → chunk-HSLMI22Q.mjs.map} +0 -0
@@ -0,0 +1,400 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capabilities, Capability, UndoMapping } from '@dxos/app-framework';
8
+ import { sleep } from '@dxos/async';
9
+ import { Obj, Relation, Type } from '@dxos/echo';
10
+ import { invariant } from '@dxos/invariant';
11
+ import { OperationResolver } from '@dxos/operation';
12
+ import { Operation } from '@dxos/operation';
13
+ import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from '@dxos/plugin-deck/types';
14
+ import { ObservabilityOperation } from '@dxos/plugin-observability/types';
15
+ import { SpaceOperation } from '@dxos/plugin-space/types';
16
+ import { Ref } from '@dxos/react-client/echo';
17
+ import { Collection } from '@dxos/schema';
18
+ import { AnchoredTo, Message, Thread } from '@dxos/types';
19
+
20
+ import { meta } from '../../meta';
21
+ import { Channel, ThreadCapabilities, ThreadOperation } from '../../types';
22
+
23
+ export default Capability.makeModule(
24
+ Effect.fnUntraced(function* () {
25
+ return [
26
+ Capability.contributes(Capabilities.UndoMapping, [
27
+ UndoMapping.make({
28
+ operation: ThreadOperation.Delete,
29
+ inverse: ThreadOperation.Restore,
30
+ deriveContext: (_input, output) => {
31
+ // Return undefined if not undoable (e.g., draft deletion or no db).
32
+ if (!output.thread || !output.anchor) {
33
+ return;
34
+ }
35
+ return {
36
+ thread: output.thread,
37
+ anchor: output.anchor,
38
+ };
39
+ },
40
+ message: ['thread deleted label', { ns: meta.id }],
41
+ }),
42
+ UndoMapping.make({
43
+ operation: ThreadOperation.DeleteMessage,
44
+ inverse: ThreadOperation.RestoreMessage,
45
+ deriveContext: (input, output) => {
46
+ // Return undefined if not undoable (e.g., message not found or thread deleted).
47
+ if (!output.message || output.messageIndex === undefined) {
48
+ return;
49
+ }
50
+ return {
51
+ anchor: input.anchor,
52
+ message: output.message,
53
+ messageIndex: output.messageIndex,
54
+ };
55
+ },
56
+ message: ['message deleted label', { ns: meta.id }],
57
+ }),
58
+ ]),
59
+ Capability.contributes(Capabilities.OperationResolver, [
60
+ //
61
+ // CreateChannel
62
+ //
63
+ OperationResolver.make({
64
+ operation: ThreadOperation.CreateChannel,
65
+ handler: (input) =>
66
+ Effect.sync(() => ({
67
+ object: Channel.make({ name: input.name }),
68
+ })),
69
+ }),
70
+
71
+ //
72
+ // CreateChannelThread
73
+ //
74
+ OperationResolver.make({
75
+ operation: ThreadOperation.CreateChannelThread,
76
+ handler: (input) =>
77
+ Effect.sync(() => {
78
+ const thread = Thread.make({ status: 'active' });
79
+ const threadRef = Ref.make(thread);
80
+ Obj.change(input.channel, (c) => {
81
+ c.threads.push(threadRef);
82
+ });
83
+ return { object: thread };
84
+ }),
85
+ }),
86
+
87
+ //
88
+ // Select
89
+ //
90
+ OperationResolver.make({
91
+ operation: ThreadOperation.Select,
92
+ handler: Effect.fnUntraced(function* (input) {
93
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
94
+ const stateAtom = yield* Capability.get(ThreadCapabilities.State);
95
+ const current = registry.get(stateAtom);
96
+ registry.set(stateAtom, { ...current, current: input.current });
97
+ }),
98
+ }),
99
+
100
+ //
101
+ // ToggleResolved
102
+ //
103
+ OperationResolver.make({
104
+ operation: ThreadOperation.ToggleResolved,
105
+ handler: Effect.fnUntraced(function* (input) {
106
+ const thread = input.thread;
107
+
108
+ Obj.change(thread, (t) => {
109
+ if (t.status === 'active' || t.status === undefined) {
110
+ t.status = 'resolved';
111
+ } else if (t.status === 'resolved') {
112
+ t.status = 'active';
113
+ }
114
+ });
115
+
116
+ const db = Obj.getDatabase(thread);
117
+ invariant(db, 'Database not found');
118
+
119
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
120
+ name: 'threads.toggle-resolved',
121
+ properties: {
122
+ spaceId: db.spaceId,
123
+ threadId: thread.id,
124
+ },
125
+ });
126
+ }),
127
+ }),
128
+
129
+ //
130
+ // OnCreateSpace
131
+ //
132
+ OperationResolver.make({
133
+ operation: ThreadOperation.OnCreateSpace,
134
+ handler: Effect.fnUntraced(function* ({ space, isDefault, rootCollection }) {
135
+ if (isDefault) {
136
+ return;
137
+ }
138
+
139
+ const collection = Collection.makeManaged({ key: Type.getTypename(Channel.Channel) });
140
+ Obj.change(rootCollection, (c) => {
141
+ c.objects.push(Ref.make(collection));
142
+ });
143
+
144
+ const { object: channel } = yield* Operation.invoke(ThreadOperation.CreateChannel, {
145
+ name: 'General',
146
+ spaceId: space.id,
147
+ });
148
+ space.db.add(channel);
149
+ }),
150
+ }),
151
+
152
+ //
153
+ // Create
154
+ //
155
+ OperationResolver.make({
156
+ operation: ThreadOperation.Create,
157
+ handler: Effect.fnUntraced(function* ({ name, anchor: _anchor, subject }) {
158
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
159
+ const stateAtom = yield* Capability.get(ThreadCapabilities.State);
160
+ const subjectId = Obj.getDXN(subject).toString();
161
+ const thread = Thread.make({ name });
162
+ const anchor = Relation.make(AnchoredTo.AnchoredTo, {
163
+ [Relation.Source]: thread,
164
+ [Relation.Target]: subject,
165
+ anchor: _anchor,
166
+ });
167
+
168
+ const state = registry.get(stateAtom);
169
+ const existingDrafts = state.drafts[subjectId];
170
+ registry.set(stateAtom, {
171
+ ...state,
172
+ drafts: {
173
+ ...state.drafts,
174
+ [subjectId]: existingDrafts ? [...existingDrafts, anchor] : [anchor],
175
+ },
176
+ });
177
+
178
+ // Follow-up operations.
179
+ yield* Operation.invoke(ThreadOperation.Select, { current: Obj.getDXN(thread).toString() });
180
+ yield* Operation.invoke(DeckOperation.ChangeCompanion, {
181
+ primary: subjectId,
182
+ companion: `${subjectId}${ATTENDABLE_PATH_SEPARATOR}comments`,
183
+ });
184
+ }),
185
+ }),
186
+
187
+ //
188
+ // Delete
189
+ //
190
+ OperationResolver.make({
191
+ operation: ThreadOperation.Delete,
192
+ handler: Effect.fnUntraced(function* ({ subject, anchor, thread: _thread }) {
193
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
194
+ const stateAtom = yield* Capability.get(ThreadCapabilities.State);
195
+ const thread = _thread ?? (Relation.getSource(anchor) as Thread.Thread);
196
+ const subjectId = Obj.getDXN(subject).toString();
197
+ const state = registry.get(stateAtom);
198
+ const draft = state.drafts[subjectId];
199
+ if (draft) {
200
+ // Check if we're deleting a draft; if so, remove it.
201
+ const index = draft.findIndex((a: { id: string }) => a.id === anchor.id);
202
+ if (index !== -1) {
203
+ registry.set(stateAtom, {
204
+ ...state,
205
+ drafts: {
206
+ ...state.drafts,
207
+ [subjectId]: state.drafts[subjectId]?.filter((_, i) => i !== index),
208
+ },
209
+ });
210
+ // Draft deletion is not undoable.
211
+ return {};
212
+ }
213
+ }
214
+
215
+ const db = Obj.getDatabase(thread);
216
+ if (!db) {
217
+ return {};
218
+ }
219
+
220
+ // TODO(wittjosiah): Without sleep, rendering crashes at `Relation.setSource(anchor)`.
221
+ db.remove(anchor);
222
+ yield* Effect.promise(() => sleep(100));
223
+ db.remove(thread);
224
+
225
+ // Schedule analytics event as followup (doesn't block return).
226
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
227
+ name: 'threads.delete',
228
+ properties: {
229
+ spaceId: db.spaceId,
230
+ threadId: thread.id,
231
+ },
232
+ });
233
+
234
+ // Return data needed for undo.
235
+ return { thread, anchor };
236
+ }),
237
+ }),
238
+
239
+ //
240
+ // AddMessage
241
+ //
242
+ OperationResolver.make({
243
+ operation: ThreadOperation.AddMessage,
244
+ handler: Effect.fnUntraced(function* ({ anchor, subject, sender, text }) {
245
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
246
+ const stateAtom = yield* Capability.get(ThreadCapabilities.State);
247
+ const thread = Relation.getSource(anchor) as Thread.Thread;
248
+ const subjectId = Obj.getDXN(subject).toString();
249
+ const db = Obj.getDatabase(subject);
250
+ invariant(db, 'Database not found');
251
+
252
+ const message = Obj.make(Message.Message, {
253
+ created: new Date().toISOString(),
254
+ sender,
255
+ blocks: [{ _tag: 'text', text }],
256
+ });
257
+ Obj.change(thread, (t) => {
258
+ t.messages.push(Ref.make(message));
259
+ });
260
+
261
+ const state = registry.get(stateAtom);
262
+ const draft = state.drafts[subjectId]?.find((a: { id: string }) => a.id === anchor.id);
263
+ if (draft) {
264
+ // Move draft to document.
265
+ Obj.change(thread, (t) => {
266
+ t.status = 'active';
267
+ });
268
+ registry.set(stateAtom, {
269
+ ...state,
270
+ drafts: {
271
+ ...state.drafts,
272
+ [subjectId]: state.drafts[subjectId]?.filter((a: { id: string }) => a.id !== anchor.id),
273
+ },
274
+ });
275
+ yield* Operation.invoke(SpaceOperation.AddObject, { object: thread, target: db, hidden: true });
276
+ yield* Operation.invoke(SpaceOperation.AddRelation, {
277
+ db,
278
+ schema: AnchoredTo.AnchoredTo,
279
+ source: thread,
280
+ target: subject,
281
+ fields: { anchor: draft.anchor },
282
+ });
283
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
284
+ name: 'threads.create',
285
+ properties: {
286
+ spaceId: db.spaceId,
287
+ threadId: thread.id,
288
+ },
289
+ });
290
+ }
291
+
292
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
293
+ name: 'threads.message.add',
294
+ properties: {
295
+ spaceId: db.spaceId,
296
+ threadId: thread.id,
297
+ threadLength: thread.messages.length,
298
+ messageId: message.id,
299
+ messageLength: text.length,
300
+ },
301
+ });
302
+ }),
303
+ }),
304
+
305
+ //
306
+ // DeleteMessage
307
+ //
308
+ OperationResolver.make({
309
+ operation: ThreadOperation.DeleteMessage,
310
+ handler: Effect.fnUntraced(function* ({ subject, anchor, messageId }) {
311
+ const thread = Relation.getSource(anchor) as Thread.Thread;
312
+ const db = Obj.getDatabase(subject);
313
+ invariant(db, 'Database not found');
314
+
315
+ const msgIndex = thread.messages.findIndex((ref) => ref.target?.id === messageId);
316
+ const msg = thread.messages[msgIndex]?.target;
317
+ if (!msg) {
318
+ return { messageIndex: -1 };
319
+ }
320
+
321
+ if (msgIndex === 0 && thread.messages.length === 1) {
322
+ // TODO(wittjosiah): This doesn't support restoring the thread.
323
+ yield* Operation.invoke(ThreadOperation.Delete, { subject, anchor });
324
+ return { messageIndex: -1 };
325
+ }
326
+
327
+ Obj.change(thread, (t) => {
328
+ t.messages.splice(msgIndex, 1);
329
+ });
330
+
331
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
332
+ name: 'threads.message.delete',
333
+ properties: {
334
+ spaceId: db.spaceId,
335
+ threadId: thread.id,
336
+ threadLength: thread.messages.length,
337
+ messageId,
338
+ },
339
+ });
340
+
341
+ // Return data needed for undo.
342
+ return { message: msg, messageIndex: msgIndex };
343
+ }),
344
+ }),
345
+
346
+ //
347
+ // Restore (inverse of Delete)
348
+ //
349
+ OperationResolver.make({
350
+ operation: ThreadOperation.Restore,
351
+ handler: Effect.fnUntraced(function* ({ thread, anchor }) {
352
+ const db = Obj.getDatabase(thread);
353
+ if (!db) {
354
+ return;
355
+ }
356
+
357
+ // TODO(wittjosiah): Without sleep, rendering crashes at `Relation.setSource(anchor)`.
358
+ db.add(thread);
359
+ yield* Effect.promise(() => sleep(100));
360
+ db.add(anchor);
361
+
362
+ // Schedule analytics event as followup (doesn't block return).
363
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
364
+ name: 'threads.undo-delete',
365
+ properties: {
366
+ spaceId: db.spaceId,
367
+ threadId: thread.id,
368
+ },
369
+ });
370
+ }),
371
+ }),
372
+
373
+ //
374
+ // RestoreMessage (inverse of DeleteMessage)
375
+ //
376
+ OperationResolver.make({
377
+ operation: ThreadOperation.RestoreMessage,
378
+ handler: Effect.fnUntraced(function* ({ anchor, message, messageIndex }) {
379
+ const thread = Relation.getSource(anchor) as Thread.Thread;
380
+ const db = Obj.getDatabase(thread);
381
+ invariant(db, 'Database not found');
382
+
383
+ Obj.change(thread, (t) => {
384
+ t.messages.splice(messageIndex, 0, Ref.make(message));
385
+ });
386
+
387
+ yield* Operation.schedule(ObservabilityOperation.SendEvent, {
388
+ name: 'threads.message.undo-delete',
389
+ properties: {
390
+ spaceId: db.spaceId,
391
+ threadId: thread.id,
392
+ messageId: message.id,
393
+ },
394
+ });
395
+ }),
396
+ }),
397
+ ]),
398
+ ];
399
+ }),
400
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactRoot = Capability.lazy('ReactRoot', () => import('./react-root'));
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React from 'react';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+
10
+ import { Call } from '../../components';
11
+ import { meta } from '../../meta';
12
+
13
+ export default Capability.makeModule(() =>
14
+ Effect.sync(() => {
15
+ return Capability.contributes(Capabilities.ReactRoot, {
16
+ id: meta.id,
17
+ root: () => <Call.Audio />,
18
+ });
19
+ }),
20
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,98 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import React from 'react';
8
+
9
+ import { Capabilities, Capability } from '@dxos/app-framework';
10
+ import { Surface, useCapability, useSettingsState } from '@dxos/app-framework/ui';
11
+ import { AppCapabilities } from '@dxos/app-toolkit';
12
+ import { Obj, type Ref } from '@dxos/echo';
13
+ import { getSpace } from '@dxos/react-client/echo';
14
+ import { Thread } from '@dxos/types';
15
+
16
+ import {
17
+ CallDebugPanel,
18
+ CallSidebar,
19
+ ChannelContainer,
20
+ ChatContainer,
21
+ ThreadCompanion,
22
+ ThreadSettings,
23
+ } from '../../components';
24
+ import { meta } from '../../meta';
25
+ import { Channel, ThreadCapabilities, type ThreadSettingsProps } from '../../types';
26
+
27
+ export default Capability.makeModule(() =>
28
+ Effect.succeed(
29
+ Capability.contributes(Capabilities.ReactSurface, [
30
+ Surface.create({
31
+ id: `${meta.id}/channel`,
32
+ role: 'article',
33
+ filter: (data): data is { subject: Channel.Channel } => Obj.instanceOf(Channel.Channel, data.subject),
34
+ component: ({ data: { subject }, role }) => <ChannelContainer role={role} subject={subject} />,
35
+ }),
36
+ Surface.create({
37
+ id: `${meta.id}/chat-companion`,
38
+ role: 'article',
39
+ filter: (data): data is { companionTo: Channel.Channel; subject: 'chat' } =>
40
+ Obj.instanceOf(Channel.Channel, data.companionTo) && data.subject === 'chat',
41
+ component: ({ data: { companionTo: channel } }) => {
42
+ const space = getSpace(channel);
43
+ const thread = channel.defaultThread.target;
44
+ if (!space || !thread) {
45
+ return null;
46
+ }
47
+
48
+ return <ChatContainer thread={thread} space={space} />;
49
+ },
50
+ }),
51
+ Surface.create({
52
+ id: `${meta.id}/thread`,
53
+ role: 'article',
54
+ filter: (data): data is { subject: Thread.Thread } => Obj.instanceOf(Thread.Thread, data.subject),
55
+ component: ({ data: { subject } }) => {
56
+ const space = getSpace(subject);
57
+ if (!space || !subject) {
58
+ return null;
59
+ }
60
+
61
+ return <ChatContainer thread={subject} space={space} />;
62
+ },
63
+ }),
64
+ Surface.create({
65
+ id: `${meta.id}/comments`,
66
+ role: 'article',
67
+ filter: (data): data is { companionTo: { threads: Ref.Ref<Thread.Thread>[] } } =>
68
+ data.subject === 'comments' && Obj.isObject(data.companionTo),
69
+ // TODO(wittjosiah): This isn't scrolling properly in a plank.
70
+ component: ({ data }) => <ThreadCompanion subject={data.companionTo} />,
71
+ }),
72
+ Surface.create({
73
+ id: `${meta.id}/plugin-settings`,
74
+ role: 'article',
75
+ filter: (data): data is { subject: AppCapabilities.Settings } =>
76
+ AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
77
+ component: ({ data: { subject } }) => {
78
+ const { settings, updateSettings } = useSettingsState<ThreadSettingsProps>(subject.atom);
79
+ return <ThreadSettings settings={settings} onSettingsChange={updateSettings} />;
80
+ },
81
+ }),
82
+ Surface.create({
83
+ id: `${meta.id}/assistant`,
84
+ role: 'deck-companion--active-call',
85
+ component: () => <CallSidebar />,
86
+ }),
87
+ Surface.create({
88
+ id: `${meta.id}/devtools-overview`,
89
+ role: 'devtools-overview',
90
+ component: () => {
91
+ const call = useCapability(ThreadCapabilities.CallManager);
92
+ const state = useAtomValue(call.stateAtom);
93
+ return <CallDebugPanel state={state} />;
94
+ },
95
+ }),
96
+ ]),
97
+ ),
98
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const Repair = Capability.lazy('Repair', () => import('./repair'));
@@ -0,0 +1,51 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Obj, Ref, Type } from '@dxos/echo';
9
+ import { SpaceCapabilities } from '@dxos/plugin-space';
10
+ import { type Space } from '@dxos/react-client/echo';
11
+ import { Collection } from '@dxos/schema';
12
+
13
+ import { Channel } from '../../types';
14
+
15
+ export default Capability.makeModule(() =>
16
+ Effect.succeed(
17
+ Capability.contributes(
18
+ SpaceCapabilities.Repair,
19
+ async ({ space, isDefault }: { space: Space; isDefault: boolean }) => {
20
+ if (isDefault) {
21
+ return;
22
+ }
23
+
24
+ await ensureSystemCollection(space);
25
+ },
26
+ ),
27
+ ),
28
+ );
29
+
30
+ /**
31
+ * Ensure the root collection has a system collection for Channels.
32
+ */
33
+ const ensureSystemCollection = async (space: Space) => {
34
+ const rootCollection: Collection.Collection = await space.properties[Collection.Collection.typename]?.load();
35
+ if (!rootCollection) {
36
+ return;
37
+ }
38
+
39
+ const objects = await Promise.all(rootCollection.objects.map((ref) => ref.load()));
40
+ const channels = objects.find(
41
+ (object) => Obj.instanceOf(Collection.Managed, object) && object.key === Type.getTypename(Channel.Channel),
42
+ );
43
+ if (channels) {
44
+ return;
45
+ }
46
+
47
+ const channelCollectionRef = Ref.make(Collection.makeManaged({ key: Type.getTypename(Channel.Channel) }));
48
+ Obj.change(rootCollection, (c) => {
49
+ c.objects.push(channelCollectionRef);
50
+ });
51
+ };
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ThreadSettings = Capability.lazy('ThreadSettings', () => import('./settings'));
@@ -0,0 +1,34 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { AppCapabilities } from '@dxos/app-toolkit';
9
+ import { createKvsStore } from '@dxos/effect';
10
+
11
+ import { meta } from '../../meta';
12
+ import { ThreadSettingsSchema } from '../../types';
13
+ import { ThreadCapabilities } from '../../types/capabilities';
14
+
15
+ export default Capability.makeModule(() =>
16
+ Effect.sync(() => {
17
+ const settingsAtom = createKvsStore({
18
+ key: meta.id,
19
+ schema: ThreadSettingsSchema,
20
+ defaultValue: () => ({}),
21
+ });
22
+
23
+ return [
24
+ // Expose atom directly for programmatic access.
25
+ Capability.contributes(ThreadCapabilities.Settings, settingsAtom),
26
+ // Contribute to common settings for UI discovery.
27
+ Capability.contributes(AppCapabilities.Settings, {
28
+ prefix: meta.id,
29
+ schema: ThreadSettingsSchema,
30
+ atom: settingsAtom,
31
+ }),
32
+ ];
33
+ }),
34
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ThreadState = Capability.lazy('ThreadState', () => import('./state'));
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Atom } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+
8
+ import { Capability } from '@dxos/app-framework';
9
+
10
+ import { ThreadCapabilities, type ThreadState, type ViewStore } from '../../types';
11
+
12
+ export default Capability.makeModule(
13
+ Effect.fnUntraced(function* () {
14
+ const stateAtom = Atom.make<ThreadState>({ toolbar: {}, drafts: {} }).pipe(Atom.keepAlive);
15
+ const viewStoreAtom = Atom.make<ViewStore>({}).pipe(Atom.keepAlive);
16
+
17
+ return [
18
+ Capability.contributes(ThreadCapabilities.State, stateAtom),
19
+ Capability.contributes(ThreadCapabilities.ViewState, viewStoreAtom),
20
+ ];
21
+ }),
22
+ );