@dxos/plugin-thread 0.8.4-main.e8ec1fe → 0.8.4-main.effb148878
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.
- package/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/ChannelArticle-UJHPOUWA.mjs +28 -0
- package/dist/lib/neutral/ChannelArticle-UJHPOUWA.mjs.map +7 -0
- package/dist/lib/neutral/ChannelChat-LZEDFJVD.mjs +10 -0
- package/dist/lib/neutral/CommentsCompanion-3H3ZVIBH.mjs +208 -0
- package/dist/lib/neutral/CommentsCompanion-3H3ZVIBH.mjs.map +7 -0
- package/dist/lib/neutral/ThreadContainer-QWB6WRMI.mjs +61 -0
- package/dist/lib/neutral/ThreadContainer-QWB6WRMI.mjs.map +7 -0
- package/dist/lib/neutral/ThreadPlugin.mjs +96 -0
- package/dist/lib/neutral/ThreadPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ThreadPlugin.node.mjs +40 -0
- package/dist/lib/neutral/ThreadPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ThreadPlugin.workerd.mjs +24 -0
- package/dist/lib/neutral/ThreadPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/ThreadSettings-5MKTDK3A.mjs +15 -0
- package/dist/lib/neutral/ThreadSettings-5MKTDK3A.mjs.map +7 -0
- package/dist/lib/neutral/add-message-DATVSMVU.mjs +122 -0
- package/dist/lib/neutral/add-message-DATVSMVU.mjs.map +7 -0
- package/dist/lib/neutral/agent-runner-JK2Y4RU3.mjs +244 -0
- package/dist/lib/neutral/agent-runner-JK2Y4RU3.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-ACCHZXZA.mjs +120 -0
- package/dist/lib/neutral/app-graph-builder-ACCHZXZA.mjs.map +7 -0
- package/dist/lib/neutral/append-channel-message-4ACLATZY.mjs +40 -0
- package/dist/lib/neutral/append-channel-message-4ACLATZY.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-S3EBOH4R.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-S3EBOH4R.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +27 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5T5LPLBN.mjs +36 -0
- package/dist/lib/neutral/chunk-5T5LPLBN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6HC3NAXD.mjs +164 -0
- package/dist/lib/neutral/chunk-6HC3NAXD.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BHEZLLXG.mjs +55 -0
- package/dist/lib/neutral/chunk-BHEZLLXG.mjs.map +7 -0
- package/dist/lib/neutral/chunk-D3SCNWLT.mjs +335 -0
- package/dist/lib/neutral/chunk-D3SCNWLT.mjs.map +7 -0
- package/dist/lib/{browser/chunk-CP7E2HRE.mjs → neutral/chunk-JLY4NVTA.mjs} +12 -5
- package/dist/lib/neutral/chunk-JLY4NVTA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QFDT33VT.mjs +69 -0
- package/dist/lib/neutral/chunk-QFDT33VT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TT6PWRR5.mjs +8 -0
- package/dist/lib/neutral/chunk-TT6PWRR5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WMP3QCOR.mjs +46 -0
- package/dist/lib/neutral/chunk-WMP3QCOR.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +541 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +15 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-2NJDD73M.mjs +61 -0
- package/dist/lib/neutral/create-2NJDD73M.mjs.map +7 -0
- package/dist/lib/neutral/create-channel-RYSV44N3.mjs +19 -0
- package/dist/lib/neutral/create-channel-RYSV44N3.mjs.map +7 -0
- package/dist/lib/neutral/create-object-D5XEG7MQ.mjs +28 -0
- package/dist/lib/neutral/create-object-D5XEG7MQ.mjs.map +7 -0
- package/dist/lib/neutral/create-proposals-7UZYZ32V.mjs +56 -0
- package/dist/lib/neutral/create-proposals-7UZYZ32V.mjs.map +7 -0
- package/dist/lib/neutral/delete-JVGAPD46.mjs +57 -0
- package/dist/lib/neutral/delete-JVGAPD46.mjs.map +7 -0
- package/dist/lib/neutral/delete-message-5EGR3HWH.mjs +54 -0
- package/dist/lib/neutral/delete-message-5EGR3HWH.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +10 -0
- package/dist/lib/neutral/index.mjs +32 -0
- package/dist/lib/neutral/markdown-B6RNVR2H.mjs +83 -0
- package/dist/lib/neutral/markdown-B6RNVR2H.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/on-create-space-ZQF55KSO.mjs +23 -0
- package/dist/lib/neutral/on-create-space-ZQF55KSO.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-RU6K2S4L.mjs +13 -0
- package/dist/lib/neutral/operation-handler-RU6K2S4L.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-ZSIQHN5P.mjs +76 -0
- package/dist/lib/neutral/react-surface-ZSIQHN5P.mjs.map +7 -0
- package/dist/lib/neutral/respond-to-thread-LVLDZON3.mjs +32 -0
- package/dist/lib/neutral/respond-to-thread-LVLDZON3.mjs.map +7 -0
- package/dist/lib/neutral/restore-Z5PYV7I2.mjs +32 -0
- package/dist/lib/neutral/restore-Z5PYV7I2.mjs.map +7 -0
- package/dist/lib/neutral/restore-message-B263PLUH.mjs +33 -0
- package/dist/lib/neutral/restore-message-B263PLUH.mjs.map +7 -0
- package/dist/lib/neutral/select-GXDEAH5D.mjs +24 -0
- package/dist/lib/neutral/select-GXDEAH5D.mjs.map +7 -0
- package/dist/lib/neutral/set-agent-config-7HHS6KZZ.mjs +20 -0
- package/dist/lib/neutral/set-agent-config-7HHS6KZZ.mjs.map +7 -0
- package/dist/lib/neutral/settings-HK4EB6TF.mjs +30 -0
- package/dist/lib/neutral/settings-HK4EB6TF.mjs.map +7 -0
- package/dist/lib/neutral/state-UU7VEAKV.mjs +22 -0
- package/dist/lib/neutral/state-UU7VEAKV.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +58 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/lib/neutral/toggle-resolved-LBVNAVVF.mjs +36 -0
- package/dist/lib/neutral/toggle-resolved-LBVNAVVF.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +91 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -0
- package/dist/lib/neutral/undo-mappings-HOKL2L3M.mjs +54 -0
- package/dist/lib/neutral/undo-mappings-HOKL2L3M.mjs.map +7 -0
- package/dist/types/src/ThreadPlugin.d.ts +3 -1
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/ThreadPlugin.node.d.ts +4 -0
- package/dist/types/src/ThreadPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ThreadPlugin.test.d.ts +2 -0
- package/dist/types/src/ThreadPlugin.test.d.ts.map +1 -0
- package/dist/types/src/ThreadPlugin.workerd.d.ts +4 -0
- package/dist/types/src/ThreadPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/thread-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/thread-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/agent-runner.d.ts +22 -0
- package/dist/types/src/capabilities/agent-runner.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +16 -15
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +3 -2
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +5 -5
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
- package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +51 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +2 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/CommentsPanel/CommentsPanel.d.ts +13 -0
- package/dist/types/src/components/CommentsPanel/CommentsPanel.d.ts.map +1 -0
- package/dist/types/src/components/CommentsPanel/CommentsPanel.stories.d.ts +160 -0
- package/dist/types/src/components/CommentsPanel/CommentsPanel.stories.d.ts.map +1 -0
- package/dist/types/src/components/{CommentsThreadContainer.d.ts → CommentsPanel/CommentsThread.d.ts} +3 -3
- package/dist/types/src/components/CommentsPanel/CommentsThread.d.ts.map +1 -0
- package/dist/types/src/components/CommentsPanel/index.d.ts +3 -0
- package/dist/types/src/components/CommentsPanel/index.d.ts.map +1 -0
- package/dist/types/src/components/MessagePanel/MessagePanel.d.ts +15 -0
- package/dist/types/src/components/MessagePanel/MessagePanel.d.ts.map +1 -0
- package/dist/types/src/components/MessagePanel/index.d.ts +2 -0
- package/dist/types/src/components/MessagePanel/index.d.ts.map +1 -0
- package/dist/types/src/components/ThreadSettings/ThreadSettings.d.ts +6 -0
- package/dist/types/src/components/ThreadSettings/ThreadSettings.d.ts.map +1 -0
- package/dist/types/src/components/ThreadSettings/ThreadSettings.stories.d.ts +161 -0
- package/dist/types/src/components/ThreadSettings/ThreadSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ThreadSettings/index.d.ts +2 -0
- package/dist/types/src/components/ThreadSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +5 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts +13 -0
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts +162 -0
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ChannelArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelChat/ChannelChat.d.ts +20 -0
- package/dist/types/src/containers/ChannelChat/ChannelChat.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelChat/index.d.ts +4 -0
- package/dist/types/src/containers/ChannelChat/index.d.ts.map +1 -0
- package/dist/types/src/containers/CommentsCompanion/CommentsCompanion.d.ts +11 -0
- package/dist/types/src/containers/CommentsCompanion/CommentsCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/CommentsCompanion/CommentsCompanion.stories.d.ts +198 -0
- package/dist/types/src/containers/CommentsCompanion/CommentsCompanion.stories.d.ts.map +1 -0
- package/dist/types/src/containers/CommentsCompanion/index.d.ts +2 -0
- package/dist/types/src/containers/CommentsCompanion/index.d.ts.map +1 -0
- package/dist/types/src/containers/ThreadContainer/ThreadContainer.d.ts +20 -0
- package/dist/types/src/containers/ThreadContainer/ThreadContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ThreadContainer/ThreadContainer.stories.d.ts +162 -0
- package/dist/types/src/containers/ThreadContainer/ThreadContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ThreadContainer/index.d.ts +4 -0
- package/dist/types/src/containers/ThreadContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/{components/command-extension.d.ts → extensions/command.d.ts} +1 -1
- package/dist/types/src/extensions/command.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +1 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/threads.d.ts +9 -4
- package/dist/types/src/extensions/threads.d.ts.map +1 -1
- package/dist/types/src/hooks/analytics.d.ts +1 -2
- package/dist/types/src/hooks/analytics.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +0 -4
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useStatus.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/add-message.d.ts +5 -0
- package/dist/types/src/operations/add-message.d.ts.map +1 -0
- package/dist/types/src/operations/append-channel-message.d.ts +5 -0
- package/dist/types/src/operations/append-channel-message.d.ts.map +1 -0
- package/dist/types/src/operations/create-channel.d.ts +5 -0
- package/dist/types/src/operations/create-channel.d.ts.map +1 -0
- package/dist/types/src/operations/create-proposals.d.ts +5 -0
- package/dist/types/src/operations/create-proposals.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/delete-message.d.ts +5 -0
- package/dist/types/src/operations/delete-message.d.ts.map +1 -0
- package/dist/types/src/operations/delete.d.ts +5 -0
- package/dist/types/src/operations/delete.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/on-create-space.d.ts +5 -0
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
- package/dist/types/src/operations/respond-to-thread.d.ts +5 -0
- package/dist/types/src/operations/respond-to-thread.d.ts.map +1 -0
- package/dist/types/src/operations/restore-message.d.ts +5 -0
- package/dist/types/src/operations/restore-message.d.ts.map +1 -0
- package/dist/types/src/operations/restore.d.ts +5 -0
- package/dist/types/src/operations/restore.d.ts.map +1 -0
- package/dist/types/src/operations/select.d.ts +5 -0
- package/dist/types/src/operations/select.d.ts.map +1 -0
- package/dist/types/src/operations/set-agent-config.d.ts +5 -0
- package/dist/types/src/operations/set-agent-config.d.ts.map +1 -0
- package/dist/types/src/operations/toggle-resolved.d.ts +5 -0
- package/dist/types/src/operations/toggle-resolved.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/should-trigger-agent.d.ts +22 -0
- package/dist/types/src/should-trigger-agent.d.ts.map +1 -0
- package/dist/types/src/should-trigger-agent.test.d.ts +2 -0
- package/dist/types/src/should-trigger-agent.test.d.ts.map +1 -0
- package/dist/types/src/{components/testing.d.ts → testing/data.d.ts} +1 -1
- package/dist/types/src/testing/data.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +140 -138
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AgentIdentity.d.ts +27 -0
- package/dist/types/src/types/AgentIdentity.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +5 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/ThreadCapabilities.d.ts +34 -0
- package/dist/types/src/types/ThreadCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/ThreadOperation.d.ts +2409 -0
- package/dist/types/src/types/ThreadOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -366
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +6 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +156 -89
- package/src/ThreadPlugin.node.ts +39 -0
- package/src/ThreadPlugin.test.ts +37 -0
- package/src/ThreadPlugin.tsx +57 -131
- package/src/ThreadPlugin.workerd.ts +20 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/thread-blueprint.ts +36 -0
- package/src/capabilities/agent-runner.ts +291 -0
- package/src/capabilities/app-graph-builder.ts +123 -174
- package/src/capabilities/blueprint-definition.ts +11 -30
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +16 -12
- package/src/capabilities/markdown.ts +53 -38
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +64 -80
- package/src/capabilities/settings.ts +26 -12
- package/src/capabilities/state.ts +14 -18
- package/src/capabilities/undo-mappings.ts +46 -0
- package/src/components/Chat/Chat.tsx +259 -0
- package/src/components/Chat/index.ts +5 -0
- package/src/components/CommentsPanel/CommentsPanel.stories.tsx +94 -0
- package/src/components/{CommentsContainer.tsx → CommentsPanel/CommentsPanel.tsx} +16 -15
- package/src/components/{CommentsThreadContainer.tsx → CommentsPanel/CommentsThread.tsx} +42 -39
- package/src/components/CommentsPanel/index.ts +6 -0
- package/src/components/{MessageContainer.tsx → MessagePanel/MessagePanel.tsx} +81 -45
- package/src/components/MessagePanel/index.ts +5 -0
- package/src/components/ThreadSettings/ThreadSettings.stories.tsx +32 -0
- package/src/components/ThreadSettings/ThreadSettings.tsx +19 -0
- package/src/components/ThreadSettings/index.ts +5 -0
- package/src/components/index.ts +5 -12
- package/src/containers/ChannelArticle/ChannelArticle.stories.tsx +105 -0
- package/src/containers/ChannelArticle/ChannelArticle.tsx +42 -0
- package/src/containers/ChannelArticle/index.ts +5 -0
- package/src/containers/ChannelChat/ChannelChat.tsx +75 -0
- package/src/containers/ChannelChat/index.ts +8 -0
- package/src/containers/CommentsCompanion/CommentsCompanion.stories.tsx +339 -0
- package/src/containers/CommentsCompanion/CommentsCompanion.tsx +216 -0
- package/src/containers/CommentsCompanion/index.ts +5 -0
- package/src/{components/Chat.stories.tsx → containers/ThreadContainer/ThreadContainer.stories.tsx} +26 -25
- package/src/containers/ThreadContainer/ThreadContainer.tsx +75 -0
- package/src/containers/ThreadContainer/index.ts +8 -0
- package/src/containers/index.ts +10 -0
- package/src/{components/command-extension.ts → extensions/command.ts} +3 -3
- package/src/extensions/index.ts +1 -0
- package/src/extensions/threads.ts +80 -44
- package/src/hooks/analytics.ts +24 -20
- package/src/hooks/index.ts +0 -5
- package/src/index.ts +4 -4
- package/src/meta.ts +33 -8
- package/src/operations/add-message.ts +94 -0
- package/src/operations/append-channel-message.ts +37 -0
- package/src/operations/create-channel.ts +20 -0
- package/src/operations/create-proposals.ts +49 -0
- package/src/operations/create.ts +63 -0
- package/src/operations/delete-message.ts +53 -0
- package/src/operations/delete.ts +63 -0
- package/src/operations/index.ts +22 -0
- package/src/operations/on-create-space.ts +27 -0
- package/src/operations/respond-to-thread.ts +32 -0
- package/src/operations/restore-message.ts +38 -0
- package/src/operations/restore.ts +38 -0
- package/src/operations/select.ts +24 -0
- package/src/operations/set-agent-config.ts +24 -0
- package/src/operations/toggle-resolved.ts +41 -0
- package/src/plugin.ts +11 -0
- package/src/should-trigger-agent.test.ts +72 -0
- package/src/should-trigger-agent.ts +50 -0
- package/src/{components/testing.ts → testing/data.ts} +7 -7
- package/src/testing/index.ts +1 -1
- package/src/translations.ts +73 -74
- package/src/types/AgentIdentity.ts +35 -0
- package/src/types/Settings.ts +10 -0
- package/src/types/ThreadCapabilities.ts +46 -0
- package/src/types/ThreadOperation.ts +217 -0
- package/src/types/index.ts +5 -1
- package/src/types/types.ts +2 -98
- package/src/util.ts +37 -5
- package/dist/lib/browser/ChannelContainer-NDIH62Q4.mjs +0 -17
- package/dist/lib/browser/ChatContainer-6FVFME3R.mjs +0 -16
- package/dist/lib/browser/app-graph-builder-URVQHGMR.mjs +0 -171
- package/dist/lib/browser/app-graph-builder-URVQHGMR.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-TQ4JFMZZ.mjs +0 -101
- package/dist/lib/browser/blueprint-definition-TQ4JFMZZ.mjs.map +0 -7
- package/dist/lib/browser/call-manager-4YFT4XA6.mjs +0 -25
- package/dist/lib/browser/call-manager-4YFT4XA6.mjs.map +0 -7
- package/dist/lib/browser/chunk-6LWKNZUV.mjs +0 -377
- package/dist/lib/browser/chunk-6LWKNZUV.mjs.map +0 -7
- package/dist/lib/browser/chunk-CFC7LEPD.mjs +0 -18
- package/dist/lib/browser/chunk-CFC7LEPD.mjs.map +0 -7
- package/dist/lib/browser/chunk-CP7E2HRE.mjs.map +0 -7
- package/dist/lib/browser/chunk-F36NHPJG.mjs +0 -989
- package/dist/lib/browser/chunk-F36NHPJG.mjs.map +0 -7
- package/dist/lib/browser/chunk-HKI7FUMB.mjs +0 -611
- package/dist/lib/browser/chunk-HKI7FUMB.mjs.map +0 -7
- package/dist/lib/browser/chunk-ISCHODBV.mjs +0 -106
- package/dist/lib/browser/chunk-ISCHODBV.mjs.map +0 -7
- package/dist/lib/browser/chunk-JDFDDUTH.mjs +0 -23
- package/dist/lib/browser/chunk-JDFDDUTH.mjs.map +0 -7
- package/dist/lib/browser/chunk-KOBXMDCI.mjs +0 -182
- package/dist/lib/browser/chunk-KOBXMDCI.mjs.map +0 -7
- package/dist/lib/browser/chunk-QM34EZQK.mjs +0 -20
- package/dist/lib/browser/chunk-QM34EZQK.mjs.map +0 -7
- package/dist/lib/browser/chunk-R5UOPOO7.mjs +0 -142
- package/dist/lib/browser/chunk-R5UOPOO7.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZCW3NSDZ.mjs +0 -1793
- package/dist/lib/browser/chunk-ZCW3NSDZ.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -312
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-S3F7DVFM.mjs +0 -361
- package/dist/lib/browser/intent-resolver-S3F7DVFM.mjs.map +0 -7
- package/dist/lib/browser/markdown-454GFKEZ.mjs +0 -171
- package/dist/lib/browser/markdown-454GFKEZ.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-root-ZB5ZA4I6.mjs +0 -29
- package/dist/lib/browser/react-root-ZB5ZA4I6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-MBLTXSOC.mjs +0 -111
- package/dist/lib/browser/react-surface-MBLTXSOC.mjs.map +0 -7
- package/dist/lib/browser/settings-JN2HHORY.mjs +0 -23
- package/dist/lib/browser/settings-JN2HHORY.mjs.map +0 -7
- package/dist/lib/browser/state-UYPLBGZJ.mjs +0 -35
- package/dist/lib/browser/state-UYPLBGZJ.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -13
- package/dist/lib/node-esm/ChannelContainer-NGSDMNEE.mjs +0 -18
- package/dist/lib/node-esm/ChatContainer-KWNON7EN.mjs +0 -17
- package/dist/lib/node-esm/app-graph-builder-2IH5RPR7.mjs +0 -172
- package/dist/lib/node-esm/app-graph-builder-2IH5RPR7.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-TSX5HHW7.mjs +0 -102
- package/dist/lib/node-esm/blueprint-definition-TSX5HHW7.mjs.map +0 -7
- package/dist/lib/node-esm/call-manager-UMUXEYH5.mjs +0 -26
- package/dist/lib/node-esm/call-manager-UMUXEYH5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2AEIN5MI.mjs +0 -22
- package/dist/lib/node-esm/chunk-2AEIN5MI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3VRYXHKX.mjs +0 -25
- package/dist/lib/node-esm/chunk-3VRYXHKX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7KZWZS2U.mjs +0 -1794
- package/dist/lib/node-esm/chunk-7KZWZS2U.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ABUFOZVX.mjs +0 -33
- package/dist/lib/node-esm/chunk-ABUFOZVX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-MEIWWPR2.mjs +0 -143
- package/dist/lib/node-esm/chunk-MEIWWPR2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MM6HOX5W.mjs +0 -612
- package/dist/lib/node-esm/chunk-MM6HOX5W.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PZH2EDU5.mjs +0 -183
- package/dist/lib/node-esm/chunk-PZH2EDU5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RT6NRL2I.mjs +0 -19
- package/dist/lib/node-esm/chunk-RT6NRL2I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VBI32FGI.mjs +0 -108
- package/dist/lib/node-esm/chunk-VBI32FGI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y3F2SGNH.mjs +0 -990
- package/dist/lib/node-esm/chunk-Y3F2SGNH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z4GUSLWL.mjs +0 -378
- package/dist/lib/node-esm/chunk-Z4GUSLWL.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -313
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-UES35EMJ.mjs +0 -362
- package/dist/lib/node-esm/intent-resolver-UES35EMJ.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-7JUG6J7B.mjs +0 -172
- package/dist/lib/node-esm/markdown-7JUG6J7B.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-root-3XXULWUN.mjs +0 -30
- package/dist/lib/node-esm/react-root-3XXULWUN.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-DCF4DD7B.mjs +0 -112
- package/dist/lib/node-esm/react-surface-DCF4DD7B.mjs.map +0 -7
- package/dist/lib/node-esm/settings-VSPM3BIM.mjs +0 -24
- package/dist/lib/node-esm/settings-VSPM3BIM.mjs.map +0 -7
- package/dist/lib/node-esm/state-XNWOLBNE.mjs +0 -36
- package/dist/lib/node-esm/state-XNWOLBNE.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -14
- package/dist/types/src/calls/call-manager.d.ts +0 -77
- package/dist/types/src/calls/call-manager.d.ts.map +0 -1
- package/dist/types/src/calls/call-swarm-synchronizer.d.ts +0 -66
- package/dist/types/src/calls/call-swarm-synchronizer.d.ts.map +0 -1
- package/dist/types/src/calls/index.d.ts +0 -7
- package/dist/types/src/calls/index.d.ts.map +0 -1
- package/dist/types/src/calls/media-manager.d.ts +0 -60
- package/dist/types/src/calls/media-manager.d.ts.map +0 -1
- package/dist/types/src/calls/speaking-monitor.d.ts +0 -24
- package/dist/types/src/calls/speaking-monitor.d.ts.map +0 -1
- package/dist/types/src/calls/types.d.ts +0 -45
- package/dist/types/src/calls/types.d.ts.map +0 -1
- package/dist/types/src/calls/util/audio.d.ts +0 -6
- package/dist/types/src/calls/util/audio.d.ts.map +0 -1
- package/dist/types/src/calls/util/calls-service.d.ts +0 -77
- package/dist/types/src/calls/util/calls-service.d.ts.map +0 -1
- package/dist/types/src/calls/util/history-cache.d.ts +0 -11
- package/dist/types/src/calls/util/history-cache.d.ts.map +0 -1
- package/dist/types/src/calls/util/index.d.ts +0 -5
- package/dist/types/src/calls/util/index.d.ts.map +0 -1
- package/dist/types/src/calls/util/media.d.ts +0 -6
- package/dist/types/src/calls/util/media.d.ts.map +0 -1
- package/dist/types/src/calls/util/stub-media-streams.d.ts +0 -18
- package/dist/types/src/calls/util/stub-media-streams.d.ts.map +0 -1
- package/dist/types/src/calls/util/task-scheduling.d.ts +0 -17
- package/dist/types/src/calls/util/task-scheduling.d.ts.map +0 -1
- package/dist/types/src/calls-service.stories.d.ts +0 -23
- package/dist/types/src/calls-service.stories.d.ts.map +0 -1
- package/dist/types/src/capabilities/call-manager.d.ts +0 -5
- package/dist/types/src/capabilities/call-manager.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -27
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts +0 -7
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/components/Call/Call.d.ts +0 -17
- package/dist/types/src/components/Call/Call.d.ts.map +0 -1
- package/dist/types/src/components/Call/Toolbar.d.ts +0 -16
- package/dist/types/src/components/Call/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Call/index.d.ts +0 -3
- package/dist/types/src/components/Call/index.d.ts.map +0 -1
- package/dist/types/src/components/CallDebugPanel.d.ts +0 -15
- package/dist/types/src/components/CallDebugPanel.d.ts.map +0 -1
- package/dist/types/src/components/CallSidebar.d.ts +0 -4
- package/dist/types/src/components/CallSidebar.d.ts.map +0 -1
- package/dist/types/src/components/ChannelContainer.d.ts +0 -14
- package/dist/types/src/components/ChannelContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChannelContainer.stories.d.ts +0 -160
- package/dist/types/src/components/ChannelContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Chat.stories.d.ts +0 -160
- package/dist/types/src/components/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts +0 -18
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/Comments.stories.d.ts +0 -158
- package/dist/types/src/components/Comments.stories.d.ts.map +0 -1
- package/dist/types/src/components/CommentsContainer.d.ts +0 -13
- package/dist/types/src/components/CommentsContainer.d.ts.map +0 -1
- package/dist/types/src/components/CommentsThreadContainer.d.ts.map +0 -1
- package/dist/types/src/components/Lobby/Lobby.d.ts +0 -15
- package/dist/types/src/components/Lobby/Lobby.d.ts.map +0 -1
- package/dist/types/src/components/Lobby/index.d.ts +0 -2
- package/dist/types/src/components/Lobby/index.d.ts.map +0 -1
- package/dist/types/src/components/Media/AudioStream.d.ts +0 -6
- package/dist/types/src/components/Media/AudioStream.d.ts.map +0 -1
- package/dist/types/src/components/Media/VideoObject.d.ts +0 -15
- package/dist/types/src/components/Media/VideoObject.d.ts.map +0 -1
- package/dist/types/src/components/Media/VideoObject.stories.d.ts +0 -22
- package/dist/types/src/components/Media/VideoObject.stories.d.ts.map +0 -1
- package/dist/types/src/components/Media/index.d.ts +0 -3
- package/dist/types/src/components/Media/index.d.ts.map +0 -1
- package/dist/types/src/components/MessageContainer.d.ts +0 -14
- package/dist/types/src/components/MessageContainer.d.ts.map +0 -1
- package/dist/types/src/components/Participant/Participant.d.ts +0 -6
- package/dist/types/src/components/Participant/Participant.d.ts.map +0 -1
- package/dist/types/src/components/Participant/ParticipantGrid.d.ts +0 -11
- package/dist/types/src/components/Participant/ParticipantGrid.d.ts.map +0 -1
- package/dist/types/src/components/Participant/index.d.ts +0 -3
- package/dist/types/src/components/Participant/index.d.ts.map +0 -1
- package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.d.ts +0 -12
- package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.d.ts.map +0 -1
- package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts +0 -162
- package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.d.ts +0 -32
- package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.d.ts.map +0 -1
- package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts +0 -176
- package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts.map +0 -1
- package/dist/types/src/components/ResponsiveGrid/ResponsiveGridItem.d.ts +0 -21
- package/dist/types/src/components/ResponsiveGrid/ResponsiveGridItem.d.ts.map +0 -1
- package/dist/types/src/components/ResponsiveGrid/index.d.ts +0 -4
- package/dist/types/src/components/ResponsiveGrid/index.d.ts.map +0 -1
- package/dist/types/src/components/ThreadCompanion.d.ts +0 -5
- package/dist/types/src/components/ThreadCompanion.d.ts.map +0 -1
- package/dist/types/src/components/ThreadSettings.d.ts +0 -6
- package/dist/types/src/components/ThreadSettings.d.ts.map +0 -1
- package/dist/types/src/components/command-extension.d.ts.map +0 -1
- package/dist/types/src/components/testing.d.ts.map +0 -1
- package/dist/types/src/functions/create-proposals.d.ts +0 -6
- package/dist/types/src/functions/create-proposals.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -2
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlackCanvasStreamTrack.d.ts +0 -2
- package/dist/types/src/hooks/useBlackCanvasStreamTrack.d.ts.map +0 -1
- package/dist/types/src/hooks/useDebugMode.d.ts +0 -2
- package/dist/types/src/hooks/useDebugMode.d.ts.map +0 -1
- package/dist/types/src/hooks/useInaudibleAudioStreamTrack.d.ts +0 -2
- package/dist/types/src/hooks/useInaudibleAudioStreamTrack.d.ts.map +0 -1
- package/dist/types/src/hooks/useVideoStreamTrack.d.ts +0 -3
- package/dist/types/src/hooks/useVideoStreamTrack.d.ts.map +0 -1
- package/dist/types/src/testing/stories.d.ts +0 -2
- package/dist/types/src/testing/stories.d.ts.map +0 -1
- package/dist/types/src/types/Channel.d.ts +0 -16
- package/dist/types/src/types/Channel.d.ts.map +0 -1
- package/src/calls/call-manager.ts +0 -246
- package/src/calls/call-swarm-synchronizer.ts +0 -350
- package/src/calls/index.ts +0 -10
- package/src/calls/media-manager.ts +0 -378
- package/src/calls/speaking-monitor.ts +0 -85
- package/src/calls/types.ts +0 -74
- package/src/calls/util/audio.ts +0 -58
- package/src/calls/util/calls-service.ts +0 -581
- package/src/calls/util/history-cache.ts +0 -27
- package/src/calls/util/index.ts +0 -8
- package/src/calls/util/media.ts +0 -52
- package/src/calls/util/stub-media-streams.ts +0 -127
- package/src/calls/util/task-scheduling.ts +0 -92
- package/src/calls-service.stories.tsx +0 -229
- package/src/capabilities/call-manager.ts +0 -20
- package/src/capabilities/capabilities.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -311
- package/src/capabilities/react-root.tsx +0 -17
- package/src/components/Call/Call.tsx +0 -89
- package/src/components/Call/Toolbar.tsx +0 -182
- package/src/components/Call/index.ts +0 -6
- package/src/components/CallDebugPanel.tsx +0 -172
- package/src/components/CallSidebar.tsx +0 -18
- package/src/components/ChannelContainer.stories.tsx +0 -59
- package/src/components/ChannelContainer.tsx +0 -205
- package/src/components/ChatContainer.tsx +0 -153
- package/src/components/Comments.stories.tsx +0 -90
- package/src/components/Lobby/Lobby.tsx +0 -119
- package/src/components/Lobby/index.ts +0 -5
- package/src/components/Media/AudioStream.tsx +0 -67
- package/src/components/Media/VideoObject.stories.tsx +0 -60
- package/src/components/Media/VideoObject.tsx +0 -58
- package/src/components/Media/index.ts +0 -6
- package/src/components/Participant/Participant.tsx +0 -63
- package/src/components/Participant/ParticipantGrid.tsx +0 -89
- package/src/components/Participant/index.ts +0 -6
- package/src/components/ResponsiveGrid/ResponsiveContainer.stories.tsx +0 -54
- package/src/components/ResponsiveGrid/ResponsiveContainer.tsx +0 -31
- package/src/components/ResponsiveGrid/ResponsiveGrid.stories.tsx +0 -158
- package/src/components/ResponsiveGrid/ResponsiveGrid.tsx +0 -341
- package/src/components/ResponsiveGrid/ResponsiveGridItem.tsx +0 -134
- package/src/components/ResponsiveGrid/index.ts +0 -7
- package/src/components/ThreadCompanion.tsx +0 -188
- package/src/components/ThreadSettings.tsx +0 -16
- package/src/functions/create-proposals.ts +0 -56
- package/src/functions/index.ts +0 -5
- package/src/hooks/useBlackCanvasStreamTrack.tsx +0 -27
- package/src/hooks/useDebugMode.ts +0 -25
- package/src/hooks/useInaudibleAudioStreamTrack.tsx +0 -27
- package/src/hooks/useVideoStreamTrack.tsx +0 -36
- package/src/testing/stories.ts +0 -51
- package/src/types/Channel.ts +0 -26
- package/src/typings/peermetrics-webrtc-stats.d.ts +0 -46
- package/src/typings.d.ts +0 -8
- /package/dist/lib/{browser/ChannelContainer-NDIH62Q4.mjs.map → neutral/ChannelChat-LZEDFJVD.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral/hooks}/index.mjs.map +0 -0
- /package/dist/lib/{browser/ChatContainer-6FVFME3R.mjs.map → neutral/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/ChannelContainer-NGSDMNEE.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/ChatContainer-KWNON7EN.mjs.map → neutral/operations/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/types/index.mjs.map} +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
8
|
+
import { type Space, useMembers } from '@dxos/react-client/echo';
|
|
9
|
+
import { useIdentity } from '@dxos/react-client/halo';
|
|
10
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
+
import { composable, composableProps } from '@dxos/react-ui';
|
|
12
|
+
import { type ThreadRootProps } from '@dxos/react-ui-thread';
|
|
13
|
+
import { Message, type Thread } from '@dxos/types';
|
|
14
|
+
import { isNonNullable } from '@dxos/util';
|
|
15
|
+
|
|
16
|
+
import { Chat } from '#components';
|
|
17
|
+
import { useStatus } from '#hooks';
|
|
18
|
+
|
|
19
|
+
export type ThreadContainerProps = ThemedClassName<
|
|
20
|
+
{
|
|
21
|
+
space: Space;
|
|
22
|
+
thread: Thread.Thread;
|
|
23
|
+
context?: Obj.Unknown;
|
|
24
|
+
autoFocusTextbox?: boolean;
|
|
25
|
+
} & Pick<ThreadRootProps, 'current'>
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Renders an AutoMerge {@link Thread} as a chat: appends new messages by pushing
|
|
30
|
+
* onto `thread.messages`. Used for comment threads and the meeting in-call chat.
|
|
31
|
+
*/
|
|
32
|
+
export const ThreadContainer = composable<HTMLDivElement, ThreadContainerProps>(
|
|
33
|
+
({ space, thread, context, autoFocusTextbox, current, ...props }, forwardedRef) => {
|
|
34
|
+
const id = Obj.getURI(thread);
|
|
35
|
+
const identity = useIdentity()!;
|
|
36
|
+
const members = useMembers(space?.id);
|
|
37
|
+
const activity = useStatus(space, id);
|
|
38
|
+
|
|
39
|
+
const messages = useMemo(
|
|
40
|
+
() => thread.messages.map((message) => message.target).filter(isNonNullable),
|
|
41
|
+
[thread.messages],
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const handleSend = (text: string) => {
|
|
45
|
+
Obj.update(thread, (thread) => {
|
|
46
|
+
thread.messages.push(
|
|
47
|
+
Ref.make(
|
|
48
|
+
Obj.make(Message.Message, {
|
|
49
|
+
created: new Date().toISOString(),
|
|
50
|
+
sender: { identityDid: identity.did },
|
|
51
|
+
blocks: [{ _tag: 'text', text }],
|
|
52
|
+
properties: context ? { context: Ref.make(context) } : undefined,
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
return true;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Chat
|
|
62
|
+
{...composableProps(props)}
|
|
63
|
+
id={id}
|
|
64
|
+
identity={identity}
|
|
65
|
+
members={members}
|
|
66
|
+
messages={messages}
|
|
67
|
+
activity={activity}
|
|
68
|
+
onSend={handleSend}
|
|
69
|
+
autoFocusTextbox={autoFocusTextbox}
|
|
70
|
+
current={current}
|
|
71
|
+
ref={forwardedRef}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const ChannelChat: ComponentType<any> = lazy(() => import('./ChannelChat'));
|
|
8
|
+
export const ChannelArticle: ComponentType<any> = lazy(() => import('./ChannelArticle'));
|
|
9
|
+
export const ThreadContainer: ComponentType<any> = lazy(() => import('./ThreadContainer'));
|
|
10
|
+
export const CommentsCompanion: ComponentType<any> = lazy(() => import('./CommentsCompanion'));
|
|
@@ -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/
|
|
9
|
-
import { mx } from '@dxos/
|
|
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-
|
|
32
|
+
class: mx('dx-tag dx-tag--indigo text-base-foreground font-medium'),
|
|
33
33
|
},
|
|
34
34
|
]);
|
|
35
35
|
|
package/src/extensions/index.ts
CHANGED
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Extension } from '@codemirror/state';
|
|
6
6
|
import { EditorView } from '@codemirror/view';
|
|
7
|
-
import {
|
|
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
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { createDocAccessor, getTextInRange } from '@dxos/echo-db';
|
|
11
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
12
|
+
import { type Markdown } from '@dxos/plugin-markdown';
|
|
14
13
|
import { AnchoredTo, Thread } from '@dxos/types';
|
|
14
|
+
import { comments, createExternalCommentSync } from '@dxos/ui-editor';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { ThreadOperation } from '#types';
|
|
17
|
+
import { type ThreadState } from '#types';
|
|
17
18
|
|
|
18
19
|
// TODO(burdon): Factor out.
|
|
19
20
|
const getName = (doc: Markdown.Document, anchor: string): string | undefined => {
|
|
@@ -23,46 +24,58 @@ const getName = (doc: Markdown.Document, anchor: string): string | undefined =>
|
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
|
|
27
|
+
export type ThreadStore = {
|
|
28
|
+
registry: Registry.Registry;
|
|
29
|
+
stateAtom: Atom.Writable<ThreadState>;
|
|
30
|
+
};
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* Construct plugins.
|
|
28
34
|
*/
|
|
29
|
-
export const threads = (
|
|
30
|
-
|
|
31
|
-
|
|
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) {
|
|
32
42
|
// Include no-op comments extension here to ensure that the facets are always present when they are expected.
|
|
33
43
|
// TODO(wittjosiah): The Editor should only look for these facets when comments are available.
|
|
34
44
|
return [comments()];
|
|
35
45
|
}
|
|
36
46
|
|
|
37
|
-
const
|
|
38
|
-
const
|
|
47
|
+
const { registry, stateAtom } = store;
|
|
48
|
+
const objectId = Obj.getURI(doc);
|
|
49
|
+
const query = db.query(Query.select(Filter.id(doc.id)).targetOf(AnchoredTo.AnchoredTo));
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
// Get current anchors by combining query results with store drafts.
|
|
52
|
+
const getAnchors = () =>
|
|
53
|
+
query.results
|
|
42
54
|
.filter((anchor) => {
|
|
43
55
|
const thread = Relation.getSource(anchor);
|
|
44
56
|
return Obj.instanceOf(Thread.Thread, thread) && thread.status !== 'resolved';
|
|
45
57
|
})
|
|
46
|
-
.concat(
|
|
47
|
-
);
|
|
58
|
+
.concat(registry.get(stateAtom).drafts[objectId] ?? []);
|
|
48
59
|
|
|
49
60
|
return [
|
|
50
61
|
EditorView.domEventHandlers({
|
|
51
62
|
destroy: () => {
|
|
52
|
-
|
|
63
|
+
// Note: cleanup functions for subscriptions are handled by createExternalCommentSync.
|
|
53
64
|
},
|
|
54
65
|
}),
|
|
55
66
|
|
|
56
67
|
EditorView.updateListener.of((update) => {
|
|
57
68
|
if (update.docChanged) {
|
|
58
|
-
|
|
69
|
+
getAnchors().forEach((anchor) => {
|
|
59
70
|
if (anchor.anchor) {
|
|
60
71
|
// Only update if the name has changed, otherwise this will cause an infinite loop.
|
|
61
72
|
// Skip if the name is empty; this means comment text was deleted, but thread name should remain.
|
|
62
73
|
const name = getName(doc, anchor.anchor);
|
|
63
74
|
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
64
75
|
if (name && name !== thread.name) {
|
|
65
|
-
thread
|
|
76
|
+
Obj.update(thread, (thread) => {
|
|
77
|
+
thread.name = name;
|
|
78
|
+
});
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
});
|
|
@@ -70,64 +83,87 @@ export const threads = (state: ThreadState, doc?: Markdown.Document, dispatch?:
|
|
|
70
83
|
}),
|
|
71
84
|
|
|
72
85
|
createExternalCommentSync(
|
|
73
|
-
|
|
74
|
-
(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
|
+
},
|
|
75
96
|
() =>
|
|
76
|
-
|
|
97
|
+
getAnchors()
|
|
77
98
|
.filter((anchor) => anchor.anchor)
|
|
78
99
|
.map((anchor) => ({
|
|
79
|
-
id: Obj.
|
|
100
|
+
id: Obj.getURI(Relation.getSource(anchor)),
|
|
80
101
|
cursor: anchor.anchor,
|
|
81
102
|
})),
|
|
82
103
|
),
|
|
83
104
|
|
|
84
105
|
comments({
|
|
85
|
-
id:
|
|
106
|
+
id: objectId,
|
|
86
107
|
onCreate: ({ cursor }) => {
|
|
87
108
|
const name = getName(doc, cursor);
|
|
88
|
-
void
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}),
|
|
94
|
-
);
|
|
109
|
+
void invokePromise(ThreadOperation.Create, {
|
|
110
|
+
anchor: cursor,
|
|
111
|
+
name,
|
|
112
|
+
subject: doc,
|
|
113
|
+
});
|
|
95
114
|
},
|
|
96
115
|
onDelete: ({ id }) => {
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
const index =
|
|
116
|
+
const drafts = registry.get(stateAtom).drafts[objectId];
|
|
117
|
+
if (drafts) {
|
|
118
|
+
const index = drafts.findIndex((draft) => Relation.getURI(draft) === id);
|
|
100
119
|
if (index !== -1) {
|
|
101
|
-
|
|
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
|
+
});
|
|
102
128
|
}
|
|
103
129
|
}
|
|
104
130
|
|
|
105
|
-
const thread = query.
|
|
131
|
+
const thread = query.results.find((object) => Relation.getSource(object).id === id);
|
|
106
132
|
if (thread) {
|
|
107
|
-
thread
|
|
133
|
+
Relation.update(thread, (thread) => {
|
|
134
|
+
thread.anchor = undefined;
|
|
135
|
+
});
|
|
108
136
|
}
|
|
109
137
|
},
|
|
110
138
|
onUpdate: ({ id, cursor }) => {
|
|
111
|
-
const draft =
|
|
139
|
+
const draft = registry.get(stateAtom).drafts[objectId]?.find((d) => Relation.getURI(d) === id);
|
|
112
140
|
if (draft) {
|
|
113
141
|
const thread = Relation.getSource(draft) as Thread.Thread;
|
|
114
|
-
|
|
115
|
-
|
|
142
|
+
Obj.update(thread, (thread) => {
|
|
143
|
+
thread.name = getName(doc, cursor);
|
|
144
|
+
});
|
|
145
|
+
Relation.update(draft, (draft) => {
|
|
146
|
+
draft.anchor = cursor;
|
|
147
|
+
});
|
|
116
148
|
}
|
|
117
149
|
|
|
118
|
-
const relation = query.
|
|
150
|
+
const relation = query.results.find((object) => Relation.getSource(object).id === id);
|
|
119
151
|
if (relation) {
|
|
120
|
-
const thread = getSource(relation);
|
|
152
|
+
const thread = Relation.getSource(relation);
|
|
121
153
|
if (Obj.instanceOf(Thread.Thread, thread)) {
|
|
122
|
-
|
|
123
|
-
|
|
154
|
+
Obj.update(thread, (thread) => {
|
|
155
|
+
thread.name = getName(doc, cursor);
|
|
156
|
+
});
|
|
157
|
+
Relation.update(relation, (relation) => {
|
|
158
|
+
relation.anchor = cursor;
|
|
159
|
+
});
|
|
124
160
|
}
|
|
125
161
|
}
|
|
126
162
|
},
|
|
127
163
|
onSelect: ({ selection }) => {
|
|
128
164
|
const current = selection.current ?? selection.closest;
|
|
129
165
|
if (current) {
|
|
130
|
-
void
|
|
166
|
+
void invokePromise(ThreadOperation.Select, { current });
|
|
131
167
|
}
|
|
132
168
|
},
|
|
133
169
|
}),
|
package/src/hooks/analytics.ts
CHANGED
|
@@ -4,34 +4,38 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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';
|
|
12
10
|
import { useOnTransition } from '@dxos/react-ui';
|
|
13
11
|
import { type ContentBlock } from '@dxos/types';
|
|
14
12
|
|
|
15
|
-
export const useOnEditAnalytics = (
|
|
16
|
-
|
|
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
|
-
|
|
20
|
-
if (!space || !textBlock) {
|
|
21
|
+
if (!message || !textBlock) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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/hooks/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export * from './blueprints';
|
|
6
|
+
// TODO(wittjosiah): Hooks should not be exported from the plugin package at all.
|
|
7
|
+
// Either refactor callers to not need them or factor them out to a shared package.
|
|
7
8
|
export * from './hooks';
|
|
8
9
|
export * from './meta';
|
|
9
|
-
|
|
10
|
-
export * from './ThreadPlugin';
|
|
10
|
+
export * from './types';
|
package/src/meta.ts
CHANGED
|
@@ -2,20 +2,45 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.thread',
|
|
10
|
+
name: 'Threads',
|
|
11
|
+
author: 'DXOS',
|
|
12
12
|
description: trim`
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
ThreadPlugin renders comment threads anchored to ECHO objects and provides a
|
|
14
|
+
persistent chat channel attached to every workspace. Threads can be created
|
|
15
|
+
inline on any Markdown document, letting collaborators leave contextual
|
|
16
|
+
comments and hold focused discussions without leaving the document surface.
|
|
17
|
+
|
|
18
|
+
Each thread carries an optional AI agent configuration that controls how the
|
|
19
|
+
built-in assistant participates in the conversation. Threads can be set to
|
|
20
|
+
off, mention-only (the agent responds only when @-mentioned by name), or
|
|
21
|
+
auto mode (the agent replies to every new user message). The agent identity —
|
|
22
|
+
display name, DID, and avatar — is resolved at runtime from a pluggable
|
|
23
|
+
Effect capability so host applications can substitute their own assistant
|
|
24
|
+
persona.
|
|
25
|
+
|
|
26
|
+
When the agent is enabled, it executes one LLM turn per trigger via the
|
|
27
|
+
AgentRunner capability. The runner has access to edit tools that can splice
|
|
28
|
+
a replacement range into the anchored document span or replace the entire
|
|
29
|
+
document content, so the assistant can propose inline edits in addition to
|
|
30
|
+
posting chat replies. A self-loop guard prevents the agent from responding
|
|
31
|
+
to its own messages, and resolved threads are excluded from triggering.
|
|
32
|
+
|
|
33
|
+
The toggle UI appears as a per-thread icon button in the CommentsPanel
|
|
34
|
+
header. Clicking it opens a popover with three radio options (off / mention /
|
|
35
|
+
auto) and a read-only label showing the active agent name. All state changes
|
|
36
|
+
go through the SetAgentConfig operation rather than direct schema writes,
|
|
37
|
+
keeping mutation logic in one place and making the feature testable with
|
|
38
|
+
stub runners in storybook.
|
|
15
39
|
`,
|
|
16
40
|
icon: 'ph--video-conference--regular',
|
|
17
41
|
iconHue: 'rose',
|
|
18
42
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-thread',
|
|
43
|
+
spec: 'PLUGIN.mdl',
|
|
19
44
|
};
|
|
20
45
|
|
|
21
|
-
export const THREAD_ITEM = `${meta.id}
|
|
46
|
+
export const THREAD_ITEM = `${meta.id}.item`;
|
|
@@ -0,0 +1,94 @@
|
|
|
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 { Operation } from '@dxos/compute';
|
|
9
|
+
import { Obj, Ref, Relation } from '@dxos/echo';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { ObservabilityOperation } from '@dxos/plugin-observability';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
13
|
+
import { AnchoredTo, Message, Thread } from '@dxos/types';
|
|
14
|
+
|
|
15
|
+
import { shouldTriggerAgent } from '../should-trigger-agent';
|
|
16
|
+
import { AgentIdentity, ThreadCapabilities } from '../types';
|
|
17
|
+
import { ThreadOperation } from '../types';
|
|
18
|
+
|
|
19
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.AddMessage> = ThreadOperation.AddMessage.pipe(
|
|
20
|
+
Operation.withHandler(
|
|
21
|
+
Effect.fnUntraced(function* ({ anchor, subject, sender, text }) {
|
|
22
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
23
|
+
const stateAtom = yield* Capability.get(ThreadCapabilities.State);
|
|
24
|
+
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
25
|
+
const subjectId = Obj.getURI(subject);
|
|
26
|
+
const db = Obj.getDatabase(subject);
|
|
27
|
+
invariant(db, 'Database not found');
|
|
28
|
+
|
|
29
|
+
const message = Obj.make(Message.Message, {
|
|
30
|
+
created: new Date().toISOString(),
|
|
31
|
+
sender,
|
|
32
|
+
blocks: [{ _tag: 'text', text }],
|
|
33
|
+
});
|
|
34
|
+
Obj.update(thread, (thread) => {
|
|
35
|
+
thread.messages.push(Ref.make(message));
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const state = registry.get(stateAtom);
|
|
39
|
+
const draft = state.drafts[subjectId]?.find((a: { id: string }) => a.id === anchor.id);
|
|
40
|
+
if (draft) {
|
|
41
|
+
Obj.update(thread, (thread) => {
|
|
42
|
+
thread.status = 'active';
|
|
43
|
+
});
|
|
44
|
+
registry.set(stateAtom, {
|
|
45
|
+
...state,
|
|
46
|
+
drafts: {
|
|
47
|
+
...state.drafts,
|
|
48
|
+
[subjectId]: state.drafts[subjectId]?.filter((a: { id: string }) => a.id !== anchor.id),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
yield* Operation.invoke(SpaceOperation.AddObject, { object: thread, target: db, hidden: true });
|
|
52
|
+
yield* Operation.invoke(SpaceOperation.AddRelation, {
|
|
53
|
+
db,
|
|
54
|
+
schema: AnchoredTo.AnchoredTo,
|
|
55
|
+
source: thread,
|
|
56
|
+
target: subject,
|
|
57
|
+
fields: { anchor: draft.anchor },
|
|
58
|
+
});
|
|
59
|
+
yield* Operation.schedule(ObservabilityOperation.SendEvent, {
|
|
60
|
+
name: 'threads.create',
|
|
61
|
+
properties: {
|
|
62
|
+
spaceId: db.spaceId,
|
|
63
|
+
threadId: thread.id,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
yield* Operation.schedule(ObservabilityOperation.SendEvent, {
|
|
69
|
+
name: 'threads.message.add',
|
|
70
|
+
properties: {
|
|
71
|
+
spaceId: db.spaceId,
|
|
72
|
+
threadId: thread.id,
|
|
73
|
+
threadLength: thread.messages.length,
|
|
74
|
+
messageId: message.id,
|
|
75
|
+
messageLength: text.length,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Gate the comment-thread agent. Identity is optional — if no capability
|
|
80
|
+
// is contributed we simply never trigger. Schedule (not invoke) so the
|
|
81
|
+
// user's message commit returns immediately and the agent runs out-of-band.
|
|
82
|
+
const identities = yield* Capability.getAll(AgentIdentity);
|
|
83
|
+
const identity = identities[0];
|
|
84
|
+
if (identity && shouldTriggerAgent(thread, message, identity.name)) {
|
|
85
|
+
yield* Operation.schedule(ThreadOperation.RespondToThread, {
|
|
86
|
+
thread: Ref.make(thread),
|
|
87
|
+
subject: Ref.make(subject),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
),
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export default handler;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Database, Feed, Obj } from '@dxos/echo';
|
|
10
|
+
import { createFeedServiceLayer } from '@dxos/echo-db';
|
|
11
|
+
import { invariant } from '@dxos/invariant';
|
|
12
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
13
|
+
import { Message } from '@dxos/types';
|
|
14
|
+
|
|
15
|
+
import { ThreadOperation } from '../types';
|
|
16
|
+
|
|
17
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.AppendChannelMessage> =
|
|
18
|
+
ThreadOperation.AppendChannelMessage.pipe(
|
|
19
|
+
Operation.withHandler(
|
|
20
|
+
Effect.fnUntraced(function* ({ channel, sender, text }) {
|
|
21
|
+
const db = Obj.getDatabase(channel);
|
|
22
|
+
invariant(db, 'Database not found');
|
|
23
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
24
|
+
const space = client.spaces.get(db.spaceId);
|
|
25
|
+
invariant(space, 'Space not found');
|
|
26
|
+
|
|
27
|
+
const feed = yield* Database.load(channel.feed);
|
|
28
|
+
const message = Message.make({
|
|
29
|
+
sender,
|
|
30
|
+
blocks: [{ _tag: 'text', text }],
|
|
31
|
+
});
|
|
32
|
+
yield* Feed.append(feed, [message]).pipe(Effect.provide(createFeedServiceLayer(space.queues)));
|
|
33
|
+
}),
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export default handler;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Channel } from '@dxos/types';
|
|
9
|
+
|
|
10
|
+
import { ThreadOperation } from '../types';
|
|
11
|
+
|
|
12
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.CreateChannel> = ThreadOperation.CreateChannel.pipe(
|
|
13
|
+
Operation.withHandler((input) =>
|
|
14
|
+
Effect.sync(() => ({
|
|
15
|
+
object: Channel.make({ name: input.name }),
|
|
16
|
+
})),
|
|
17
|
+
),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export default handler;
|