@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,339 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as AnthropicClient from '@effect/ai-anthropic/AnthropicClient';
|
|
6
|
+
import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Layer from 'effect/Layer';
|
|
10
|
+
import React, { useEffect, useMemo } from 'react';
|
|
11
|
+
|
|
12
|
+
import { AiModelResolver } from '@dxos/ai';
|
|
13
|
+
import { AnthropicResolver } from '@dxos/ai/resolvers';
|
|
14
|
+
import { ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';
|
|
15
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
16
|
+
import { Surface, useCapability } from '@dxos/app-framework/ui';
|
|
17
|
+
import {
|
|
18
|
+
AppActivationEvents,
|
|
19
|
+
AppCapabilities,
|
|
20
|
+
AppPlugin,
|
|
21
|
+
LayoutOperation,
|
|
22
|
+
createObjectNode,
|
|
23
|
+
getPersonalSpace,
|
|
24
|
+
} from '@dxos/app-toolkit';
|
|
25
|
+
import { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';
|
|
26
|
+
import { Operation, OperationHandlerSet } from '@dxos/compute';
|
|
27
|
+
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
28
|
+
import { AtomQuery } from '@dxos/echo-atom';
|
|
29
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
30
|
+
import { ClientPlugin, initializeIdentity } from '@dxos/plugin-client/testing';
|
|
31
|
+
import { Graph, GraphBuilder, Node, NodeMatcher, qualifyId } from '@dxos/plugin-graph';
|
|
32
|
+
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '@dxos/plugin-markdown';
|
|
33
|
+
import { MarkdownPlugin } from '@dxos/plugin-markdown/testing';
|
|
34
|
+
import { SpacePlugin } from '@dxos/plugin-space/testing';
|
|
35
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
36
|
+
import { random } from '@dxos/random';
|
|
37
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
38
|
+
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
39
|
+
import { Loading, withLayout } from '@dxos/react-ui/testing';
|
|
40
|
+
import { Text } from '@dxos/schema';
|
|
41
|
+
import { AnchoredTo, Message, Thread } from '@dxos/types';
|
|
42
|
+
import { isNonNullable } from '@dxos/util';
|
|
43
|
+
|
|
44
|
+
import { translations } from '#translations';
|
|
45
|
+
|
|
46
|
+
import { textOf } from '../../should-trigger-agent';
|
|
47
|
+
import { ThreadPlugin } from '../../ThreadPlugin';
|
|
48
|
+
import { AgentIdentity, ThreadCapabilities } from '../../types';
|
|
49
|
+
|
|
50
|
+
random.seed(1);
|
|
51
|
+
|
|
52
|
+
const STORY_AGENT_NAME = 'Kai';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Canned echo runner — never makes network calls. On each turn finds the
|
|
56
|
+
* last non-assistant message and appends an assistant message that quotes it.
|
|
57
|
+
* Used by the WithMentionAgent / WithAutoAgent variants.
|
|
58
|
+
*/
|
|
59
|
+
const StubAgentRunner: ThreadCapabilities.AgentRunner = {
|
|
60
|
+
run: ({ thread }) =>
|
|
61
|
+
Effect.gen(function* () {
|
|
62
|
+
const identity = yield* Capability.get(AgentIdentity);
|
|
63
|
+
// User-authored messages have no role set; only assistant messages do.
|
|
64
|
+
const lastUser = [...thread.messages].reverse().find((ref) => ref.target?.sender.role !== 'assistant');
|
|
65
|
+
const echoText = textOf(lastUser?.target);
|
|
66
|
+
const reply = Obj.make(Message.Message, {
|
|
67
|
+
created: new Date().toISOString(),
|
|
68
|
+
sender: { role: 'assistant', name: identity.name, identityDid: identity.identityDid },
|
|
69
|
+
blocks: [{ _tag: 'text', text: `(${identity.name}) you said: "${echoText}"` }],
|
|
70
|
+
});
|
|
71
|
+
Obj.update(thread, (thread) => {
|
|
72
|
+
(thread.messages as Ref.Ref<Message.Message>[]).push(Ref.make(reply));
|
|
73
|
+
});
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Live `AppCapabilities.AiServiceLayer` wired through the DXOS edge so
|
|
79
|
+
* `ThreadPlugin`'s default `AgentRunner` can call Claude. The edge endpoint is
|
|
80
|
+
* open in dev — no API key is needed for the storybook to round-trip a real
|
|
81
|
+
* LLM response. Used by the WithLiveAgent variant.
|
|
82
|
+
*
|
|
83
|
+
* Headless `test-storybook` runs render the story but don't submit a comment,
|
|
84
|
+
* so no network call is made there either.
|
|
85
|
+
*/
|
|
86
|
+
const anthropicResolverLayer = AnthropicResolver.make().pipe(
|
|
87
|
+
Layer.provide(
|
|
88
|
+
AnthropicClient.layer({
|
|
89
|
+
apiUrl: 'https://ai-service.dxos.workers.dev/provider/anthropic',
|
|
90
|
+
}),
|
|
91
|
+
),
|
|
92
|
+
Layer.provide(FetchHttpClient.layer),
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const aiServiceLayer = AiModelResolver.AiModelResolver.buildAiService.pipe(
|
|
96
|
+
Layer.provide(
|
|
97
|
+
anthropicResolverLayer.pipe(
|
|
98
|
+
Layer.provide(AiModelResolver.AiModelResolver.fromModelMap({ name: 'Fallback' }, Effect.succeed({}))),
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Common story-only plugin:
|
|
105
|
+
* 1. Exposes Markdown documents in the personal space as direct children of the
|
|
106
|
+
* graph root, so ThreadPlugin's `comment-toolbar` extension can attach the
|
|
107
|
+
* `comment` action to the doc's node.
|
|
108
|
+
* 2. Stubs out plugin-deck's layout operations (`UpdateCompanion`,
|
|
109
|
+
* `ScrollIntoView`) that ThreadPlugin and the CommentsCompanion invoke —
|
|
110
|
+
* no handler errors otherwise.
|
|
111
|
+
* 3. Contributes a static `AgentIdentity` ("Kai") so any AgentRunner has a name
|
|
112
|
+
* to stamp on assistant messages.
|
|
113
|
+
*
|
|
114
|
+
* Agent runner / LLM hookup is contributed separately by `StoryStubAgentPlugin`
|
|
115
|
+
* (no network) or `StoryLiveAgentPlugin` (real Anthropic via DXOS edge),
|
|
116
|
+
* selected per-story via the `liveAgent` arg.
|
|
117
|
+
*/
|
|
118
|
+
const StoryGraphPlugin = Plugin.define({ id: 'story-graph', name: 'Story Graph' }).pipe(
|
|
119
|
+
AppPlugin.addAppGraphModule({
|
|
120
|
+
activate: Effect.fnUntraced(function* () {
|
|
121
|
+
const capabilities = yield* Capability.Service;
|
|
122
|
+
const extensions = yield* GraphBuilder.createExtension({
|
|
123
|
+
id: 'story-docs',
|
|
124
|
+
match: NodeMatcher.whenRoot,
|
|
125
|
+
connector: (_, get) =>
|
|
126
|
+
Effect.gen(function* () {
|
|
127
|
+
const client = capabilities.get(ClientCapabilities.Client);
|
|
128
|
+
const space = getPersonalSpace(client);
|
|
129
|
+
if (!space) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
const docs = get(AtomQuery.make(space.db, Filter.type(Markdown.Document)));
|
|
133
|
+
return docs
|
|
134
|
+
.map((object) => createObjectNode({ db: space.db, object, droppable: false }))
|
|
135
|
+
.filter(isNonNullable);
|
|
136
|
+
}),
|
|
137
|
+
});
|
|
138
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
139
|
+
}),
|
|
140
|
+
}),
|
|
141
|
+
AppPlugin.addOperationHandlerModule({
|
|
142
|
+
activate: () =>
|
|
143
|
+
Effect.succeed(
|
|
144
|
+
Capability.contributes(
|
|
145
|
+
Capabilities.OperationHandler,
|
|
146
|
+
OperationHandlerSet.make(
|
|
147
|
+
Operation.withHandler(LayoutOperation.UpdateCompanion, () => Effect.void),
|
|
148
|
+
Operation.withHandler(LayoutOperation.ScrollIntoView, () => Effect.void),
|
|
149
|
+
),
|
|
150
|
+
),
|
|
151
|
+
),
|
|
152
|
+
}),
|
|
153
|
+
Plugin.addModule({
|
|
154
|
+
id: 'story-graph.identity',
|
|
155
|
+
activatesOn: ActivationEvents.Startup,
|
|
156
|
+
activate: () => Effect.succeed(Capability.contributes(AgentIdentity, { name: STORY_AGENT_NAME })),
|
|
157
|
+
}),
|
|
158
|
+
Plugin.make,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Stub agent runner — used by the WithMentionAgent / WithAutoAgent variants.
|
|
163
|
+
* Loaded BEFORE ThreadPlugin so its `AgentRunner` contribution wins over
|
|
164
|
+
* ThreadPlugin's default LLM-backed runner.
|
|
165
|
+
*/
|
|
166
|
+
const StoryStubAgentPlugin = Plugin.define({ id: 'story-stub-agent', name: 'Story Stub Agent' }).pipe(
|
|
167
|
+
Plugin.addModule({
|
|
168
|
+
id: 'story-stub-agent.runner',
|
|
169
|
+
activatesOn: ActivationEvents.Startup,
|
|
170
|
+
activate: () => Effect.succeed(Capability.contributes(ThreadCapabilities.AgentRunner, StubAgentRunner)),
|
|
171
|
+
}),
|
|
172
|
+
Plugin.make,
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Live agent runner hookup — contributes `AppCapabilities.AiServiceLayer` so
|
|
177
|
+
* ThreadPlugin's default `AgentRunner` routes through Anthropic via the DXOS
|
|
178
|
+
* edge. Used by the WithLiveAgent variant.
|
|
179
|
+
*/
|
|
180
|
+
const StoryLiveAgentPlugin = Plugin.define({ id: 'story-live-agent', name: 'Story Live Agent' }).pipe(
|
|
181
|
+
Plugin.addModule({
|
|
182
|
+
id: 'story-live-agent.ai-service',
|
|
183
|
+
activatesOn: ActivationEvents.Startup,
|
|
184
|
+
activate: () => Effect.succeed(Capability.contributes(AppCapabilities.AiServiceLayer, aiServiceLayer)),
|
|
185
|
+
}),
|
|
186
|
+
Plugin.make,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
type StoryArgs = {
|
|
190
|
+
/**
|
|
191
|
+
* Sets the Markdown plugin's `commentAgentMode` setting so newly-created
|
|
192
|
+
* comment threads on the seeded doc are stamped with the matching agent
|
|
193
|
+
* config by ThreadOperation.Create.
|
|
194
|
+
*/
|
|
195
|
+
agentMode?: Markdown.Settings['commentAgentMode'];
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* When true, contributes a live `AiServiceLayer` (Anthropic via DXOS edge)
|
|
199
|
+
* so ThreadPlugin's default `AgentRunner` makes a real LLM call.
|
|
200
|
+
* Defaults to `false` — variants use the stub echo runner.
|
|
201
|
+
*/
|
|
202
|
+
liveAgent?: boolean;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const DefaultStory = ({ agentMode }: StoryArgs) => {
|
|
206
|
+
const { graph } = useAppGraph();
|
|
207
|
+
const [space] = useSpaces();
|
|
208
|
+
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
209
|
+
const attendableId = doc && qualifyId(Node.RootId, doc.id);
|
|
210
|
+
const attentionAttrs = useAttentionAttributes(attendableId);
|
|
211
|
+
|
|
212
|
+
// Story renders surfaces directly (no deck), so expand graph actions for the doc node.
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
if (attendableId) {
|
|
215
|
+
void Graph.expand(graph, attendableId, 'action');
|
|
216
|
+
}
|
|
217
|
+
}, [graph, attendableId]);
|
|
218
|
+
|
|
219
|
+
// Push the variant's `agentMode` into the markdown plugin settings so that
|
|
220
|
+
// ThreadOperation.Create stamps new threads with the matching agent config.
|
|
221
|
+
const markdownSettings = useCapability(MarkdownCapabilities.Settings);
|
|
222
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
223
|
+
useEffect(() => {
|
|
224
|
+
if (!markdownSettings) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
registry.set(markdownSettings, { ...registry.get(markdownSettings), commentAgentMode: agentMode ?? 'off' });
|
|
228
|
+
}, [markdownSettings, registry, agentMode]);
|
|
229
|
+
|
|
230
|
+
const articleData = useMemo(() => ({ subject: doc, attendableId: attendableId ?? 'story' }), [doc, attendableId]);
|
|
231
|
+
const companionData = useMemo(
|
|
232
|
+
() => ({ subject: 'comments', companionTo: doc, attendableId: attendableId ?? 'story' }),
|
|
233
|
+
[doc, attendableId],
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
if (!doc) {
|
|
237
|
+
return <Loading data={{ doc: !!doc }} />;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return (
|
|
241
|
+
<div className='dx-container grid grid-cols-[3fr_2fr] gap-4' {...attentionAttrs}>
|
|
242
|
+
<Surface.Surface type={AppSurface.Article} data={articleData} limit={1} />
|
|
243
|
+
<Surface.Surface type={AppSurface.Article} data={companionData} limit={1} />
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const meta = {
|
|
249
|
+
title: 'plugins/plugin-thread/containers/CommentsCompanion',
|
|
250
|
+
render: DefaultStory,
|
|
251
|
+
decorators: [
|
|
252
|
+
withLayout({ layout: 'fullscreen' }),
|
|
253
|
+
withPluginManager<StoryArgs>((context) => ({
|
|
254
|
+
setupEvents: [AppActivationEvents.SetupSettings, MarkdownEvents.SetupExtensions],
|
|
255
|
+
plugins: [
|
|
256
|
+
...corePlugins(),
|
|
257
|
+
ClientPlugin({
|
|
258
|
+
types: [Markdown.Document, Text.Text, Thread.Thread, Message.Message, AnchoredTo.AnchoredTo],
|
|
259
|
+
onClientInitialized: ({ client }) =>
|
|
260
|
+
Effect.gen(function* () {
|
|
261
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
262
|
+
personalSpace.db.add(
|
|
263
|
+
Markdown.make({
|
|
264
|
+
name: 'Sample',
|
|
265
|
+
content: [
|
|
266
|
+
'# Sample',
|
|
267
|
+
'',
|
|
268
|
+
'This document has comment threads attached to it.',
|
|
269
|
+
'',
|
|
270
|
+
'Select text in the editor to add a new comment, or view existing threads in the companion.',
|
|
271
|
+
'',
|
|
272
|
+
].join('\n'),
|
|
273
|
+
}),
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
yield* Effect.promise(() => personalSpace.db.flush({ indexes: true }));
|
|
277
|
+
}),
|
|
278
|
+
}),
|
|
279
|
+
SpacePlugin({}),
|
|
280
|
+
MarkdownPlugin(),
|
|
281
|
+
StoryGraphPlugin(),
|
|
282
|
+
// The stub agent plugin must come BEFORE ThreadPlugin so its
|
|
283
|
+
// `AgentRunner` contribution wins over ThreadPlugin's default
|
|
284
|
+
// (LLM-backed) runner — `Capability.get` returns the first match.
|
|
285
|
+
// The live variant simply doesn't contribute a stub, letting the
|
|
286
|
+
// default runner reach Anthropic via the AiServiceLayer.
|
|
287
|
+
...(context.args.liveAgent ? [] : [StoryStubAgentPlugin()]),
|
|
288
|
+
ThreadPlugin(),
|
|
289
|
+
...(context.args.liveAgent ? [StoryLiveAgentPlugin()] : []),
|
|
290
|
+
],
|
|
291
|
+
})),
|
|
292
|
+
],
|
|
293
|
+
parameters: {
|
|
294
|
+
layout: 'fullscreen',
|
|
295
|
+
controls: { disable: true },
|
|
296
|
+
translations,
|
|
297
|
+
},
|
|
298
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
299
|
+
|
|
300
|
+
export default meta;
|
|
301
|
+
|
|
302
|
+
type Story = StoryObj<typeof meta>;
|
|
303
|
+
|
|
304
|
+
export const Default: Story = {};
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Thread opted in to the AI agent in `mention` mode.
|
|
308
|
+
* Type `@Kai …` in the comment input to trigger the stub runner; plain messages are ignored.
|
|
309
|
+
*/
|
|
310
|
+
export const WithMentionAgent: Story = {
|
|
311
|
+
args: {
|
|
312
|
+
agentMode: 'mention',
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Thread opted in to the AI agent in `auto` mode.
|
|
318
|
+
* Each user message triggers the stub runner, which appends a canned echo reply.
|
|
319
|
+
*/
|
|
320
|
+
export const WithAutoAgent: Story = {
|
|
321
|
+
args: {
|
|
322
|
+
agentMode: 'auto',
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Thread opted in to the AI agent in `auto` mode with the LIVE runner —
|
|
328
|
+
* ThreadPlugin's default `AgentRunner` calls Anthropic Claude via the DXOS
|
|
329
|
+
* edge proxy. Each user message triggers a real LLM response.
|
|
330
|
+
*
|
|
331
|
+
* Note: headless `test-storybook` only renders the story (no comment is
|
|
332
|
+
* submitted) so this variant does not make a network call in CI.
|
|
333
|
+
*/
|
|
334
|
+
export const WithLiveAgent: Story = {
|
|
335
|
+
args: {
|
|
336
|
+
agentMode: 'auto',
|
|
337
|
+
liveAgent: true,
|
|
338
|
+
},
|
|
339
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import React, { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
9
|
+
import { useCapabilities, useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppCapabilities, CollaborationOperation, LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { Filter, Obj, Query, Ref, Relation } from '@dxos/echo';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { useIdentity } from '@dxos/react-client/halo';
|
|
15
|
+
import { Panel, ScrollArea, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
16
|
+
import { getParentId, useAttention } from '@dxos/react-ui-attention';
|
|
17
|
+
import { Tabs } from '@dxos/react-ui-tabs';
|
|
18
|
+
import { AnchoredTo, Thread } from '@dxos/types';
|
|
19
|
+
|
|
20
|
+
import { CommentsPanel, type CommentsPanelProps } from '#components';
|
|
21
|
+
import { meta } from '#meta';
|
|
22
|
+
import { ThreadOperation } from '#types';
|
|
23
|
+
import { ThreadCapabilities, type ViewState } from '#types';
|
|
24
|
+
|
|
25
|
+
const initialViewState: ViewState = { showResolvedThreads: false };
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Subject is the host object being commented on (e.g. a Markdown.Document),
|
|
29
|
+
* not a Thread — the threads anchored to that host are discovered via the
|
|
30
|
+
* `AnchoredTo` query inside the component.
|
|
31
|
+
*/
|
|
32
|
+
export type CommentsCompanionProps = AppSurface.ObjectArticleProps<Obj.Any>;
|
|
33
|
+
|
|
34
|
+
export const CommentsCompanion = ({ attendableId, subject }: CommentsCompanionProps) => {
|
|
35
|
+
const { t } = useTranslation(meta.id);
|
|
36
|
+
const { invokePromise } = useOperationInvoker();
|
|
37
|
+
const identity = useIdentity();
|
|
38
|
+
const subjectId = Obj.getURI(subject);
|
|
39
|
+
const parentId = attendableId ? getParentId(attendableId) : undefined;
|
|
40
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
41
|
+
|
|
42
|
+
const stateAtom = useCapability(ThreadCapabilities.State);
|
|
43
|
+
const viewStoreAtom = useCapability(ThreadCapabilities.ViewState);
|
|
44
|
+
const state = useAtomValue(stateAtom);
|
|
45
|
+
const viewStore = useAtomValue(viewStoreAtom);
|
|
46
|
+
const drafts = state.drafts[subjectId];
|
|
47
|
+
|
|
48
|
+
// Get or initialize view state for this subject.
|
|
49
|
+
const viewState = useMemo(() => {
|
|
50
|
+
if (!viewStore[subjectId]) {
|
|
51
|
+
registry.set(viewStoreAtom, { ...viewStore, [subjectId]: { ...initialViewState } });
|
|
52
|
+
return initialViewState;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return viewStore[subjectId];
|
|
56
|
+
}, [viewStore, subjectId, registry, viewStoreAtom]);
|
|
57
|
+
const { showResolvedThreads } = viewState;
|
|
58
|
+
|
|
59
|
+
const commentConfigs = useCapabilities(AppCapabilities.CommentConfig);
|
|
60
|
+
const anchorSorts = useCapabilities(AppCapabilities.AnchorSort);
|
|
61
|
+
const sort = useMemo(
|
|
62
|
+
() => anchorSorts.find(({ key }) => key === Obj.getTypename(subject))?.sort,
|
|
63
|
+
[anchorSorts, subject],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const db = Obj.getDatabase(subject);
|
|
67
|
+
const objectsAnchoredTo = useQuery(db, Query.select(Filter.id(subject.id)).targetOf(AnchoredTo.AnchoredTo));
|
|
68
|
+
const anchors = objectsAnchoredTo
|
|
69
|
+
.toSorted((a, b) => sort?.(a, b) ?? 0)
|
|
70
|
+
.filter((anchor) => Obj.instanceOf(Thread.Thread, Relation.getSource(anchor)))
|
|
71
|
+
.concat(drafts ?? []);
|
|
72
|
+
|
|
73
|
+
const handleChangeViewState = useCallback(
|
|
74
|
+
(nextValue: string) => {
|
|
75
|
+
registry.set(viewStoreAtom, {
|
|
76
|
+
...registry.get(viewStoreAtom),
|
|
77
|
+
[subjectId]: { ...registry.get(viewStoreAtom)[subjectId], showResolvedThreads: nextValue === 'all' },
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
[registry, viewStoreAtom, subjectId],
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const { hasAttention, isAncestor, isRelated } = useAttention(parentId);
|
|
84
|
+
const isAttended = hasAttention || isAncestor || isRelated;
|
|
85
|
+
|
|
86
|
+
const handleAttend = useCallback(
|
|
87
|
+
(anchor: AnchoredTo.AnchoredTo) => {
|
|
88
|
+
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
89
|
+
const threadId = Obj.getURI(thread);
|
|
90
|
+
|
|
91
|
+
if (state.current !== threadId) {
|
|
92
|
+
registry.set(stateAtom, { ...registry.get(stateAtom), current: threadId });
|
|
93
|
+
|
|
94
|
+
// Scroll plank into view (deck handler).
|
|
95
|
+
void invokePromise(LayoutOperation.ScrollIntoView, { subject: parentId });
|
|
96
|
+
|
|
97
|
+
// Scroll within content to anchor (comment config per typename).
|
|
98
|
+
if (anchor.anchor && parentId) {
|
|
99
|
+
const typename = Obj.getTypename(subject);
|
|
100
|
+
const commentConfig = commentConfigs.find(({ id }) => id === typename);
|
|
101
|
+
if (commentConfig?.scrollToAnchor) {
|
|
102
|
+
void invokePromise(commentConfig.scrollToAnchor, {
|
|
103
|
+
subject: parentId,
|
|
104
|
+
cursor: anchor.anchor,
|
|
105
|
+
ref: threadId,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
[state.current, invokePromise, registry, stateAtom, parentId, subject, commentConfigs],
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const handleComment = useCallback(
|
|
115
|
+
async (anchor: AnchoredTo.AnchoredTo, text: string) => {
|
|
116
|
+
await invokePromise(ThreadOperation.AddMessage, {
|
|
117
|
+
anchor,
|
|
118
|
+
subject,
|
|
119
|
+
sender: { identityDid: identity?.did },
|
|
120
|
+
text,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
124
|
+
registry.set(stateAtom, { ...registry.get(stateAtom), current: Obj.getURI(thread) });
|
|
125
|
+
},
|
|
126
|
+
[invokePromise, identity, subject, registry, stateAtom],
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const handleResolve = useCallback(
|
|
130
|
+
(anchor: AnchoredTo.AnchoredTo) =>
|
|
131
|
+
invokePromise(ThreadOperation.ToggleResolved, {
|
|
132
|
+
thread: Relation.getSource(anchor) as Thread.Thread,
|
|
133
|
+
}),
|
|
134
|
+
[invokePromise],
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const handleThreadDelete = useCallback(
|
|
138
|
+
(anchor: AnchoredTo.AnchoredTo) => invokePromise(ThreadOperation.Delete, { anchor, subject }),
|
|
139
|
+
[invokePromise, subject],
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const handleMessageDelete = useCallback(
|
|
143
|
+
(anchor: AnchoredTo.AnchoredTo, messageId: string) =>
|
|
144
|
+
invokePromise(ThreadOperation.DeleteMessage, {
|
|
145
|
+
anchor,
|
|
146
|
+
subject,
|
|
147
|
+
messageId,
|
|
148
|
+
}),
|
|
149
|
+
[invokePromise, subject],
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const handleAcceptProposal = useCallback<NonNullable<CommentsPanelProps['onAcceptProposal']>>(
|
|
153
|
+
async (anchor, messageId) => {
|
|
154
|
+
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
155
|
+
const messageIndex = thread.messages.findIndex(Ref.hasObjectId(messageId));
|
|
156
|
+
const message = thread.messages[messageIndex]?.target;
|
|
157
|
+
const proposal = message?.blocks.find((block) => block._tag === 'proposal');
|
|
158
|
+
if (!proposal || !anchor.anchor) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
await invokePromise(CollaborationOperation.AcceptProposal, {
|
|
163
|
+
subject,
|
|
164
|
+
anchor: anchor.anchor,
|
|
165
|
+
proposal,
|
|
166
|
+
});
|
|
167
|
+
await invokePromise(ThreadOperation.ToggleResolved, { thread });
|
|
168
|
+
},
|
|
169
|
+
[invokePromise, subject],
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
const comments = (
|
|
173
|
+
<CommentsPanel
|
|
174
|
+
anchors={anchors}
|
|
175
|
+
currentId={isAttended ? state.current : undefined}
|
|
176
|
+
showResolvedThreads={showResolvedThreads}
|
|
177
|
+
onAttend={handleAttend}
|
|
178
|
+
onComment={handleComment}
|
|
179
|
+
onResolve={handleResolve}
|
|
180
|
+
onMessageDelete={handleMessageDelete}
|
|
181
|
+
onThreadDelete={handleThreadDelete}
|
|
182
|
+
onAcceptProposal={handleAcceptProposal}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<Tabs.Root
|
|
188
|
+
orientation='horizontal'
|
|
189
|
+
value={showResolvedThreads ? 'all' : 'unresolved'}
|
|
190
|
+
onValueChange={handleChangeViewState}
|
|
191
|
+
>
|
|
192
|
+
<Panel.Root>
|
|
193
|
+
<Panel.Toolbar asChild>
|
|
194
|
+
<Toolbar.Root>
|
|
195
|
+
<Tabs.Tablist classNames='p-0'>
|
|
196
|
+
<Tabs.Tab classNames='text-sm' value='unresolved'>
|
|
197
|
+
{t('show-unresolved.label')}
|
|
198
|
+
</Tabs.Tab>
|
|
199
|
+
<Tabs.Tab classNames='text-sm' value='all'>
|
|
200
|
+
{t('show-all.label')}
|
|
201
|
+
</Tabs.Tab>
|
|
202
|
+
</Tabs.Tablist>
|
|
203
|
+
</Toolbar.Root>
|
|
204
|
+
</Panel.Toolbar>
|
|
205
|
+
<Panel.Content asChild>
|
|
206
|
+
<ScrollArea.Root thin>
|
|
207
|
+
<ScrollArea.Viewport>
|
|
208
|
+
<Tabs.Panel value='all'>{showResolvedThreads && comments}</Tabs.Panel>
|
|
209
|
+
<Tabs.Panel value='unresolved'>{!showResolvedThreads && comments}</Tabs.Panel>
|
|
210
|
+
</ScrollArea.Viewport>
|
|
211
|
+
</ScrollArea.Root>
|
|
212
|
+
</Panel.Content>
|
|
213
|
+
</Panel.Root>
|
|
214
|
+
</Tabs.Root>
|
|
215
|
+
);
|
|
216
|
+
};
|
package/src/{components/Chat.stories.tsx → containers/ThreadContainer/ThreadContainer.stories.tsx}
RENAMED
|
@@ -5,64 +5,62 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Capabilities,
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import {
|
|
10
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
11
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
12
|
+
import { random } from '@dxos/random';
|
|
11
13
|
import { useClient } from '@dxos/react-client';
|
|
12
14
|
import { type Space } from '@dxos/react-client/echo';
|
|
13
15
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
14
16
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
17
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
16
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
17
18
|
import { Thread as ThreadComponent } from '@dxos/react-ui-thread';
|
|
18
|
-
import {
|
|
19
|
+
import { withLayout, Loading } from '@dxos/react-ui/testing';
|
|
19
20
|
import { Message, Thread } from '@dxos/types';
|
|
20
21
|
|
|
21
|
-
import { translations } from '
|
|
22
|
-
import { Channel } from '../types';
|
|
22
|
+
import { translations } from '#translations';
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import { ThreadContainer } from './ThreadContainer';
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
random.seed(1);
|
|
27
27
|
|
|
28
28
|
const DefaultStory = () => {
|
|
29
29
|
const client = useClient();
|
|
30
30
|
const identity = useIdentity();
|
|
31
31
|
const [space, setSpace] = useState<Space>();
|
|
32
|
-
const [
|
|
32
|
+
const [thread, setThread] = useState<Thread.Thread | null>();
|
|
33
33
|
|
|
34
34
|
useAsyncEffect(async () => {
|
|
35
35
|
if (identity) {
|
|
36
36
|
const space = await client.spaces.create();
|
|
37
|
-
const
|
|
37
|
+
const thread = space.db.add(Thread.make({ status: 'active' }));
|
|
38
38
|
setSpace(space);
|
|
39
|
-
|
|
39
|
+
setThread(thread);
|
|
40
40
|
}
|
|
41
41
|
}, [identity]);
|
|
42
42
|
|
|
43
|
-
if (!identity || !
|
|
44
|
-
return
|
|
43
|
+
if (!identity || !thread || !space) {
|
|
44
|
+
return <Loading data={{ identity: !!identity, space: !!space, thread: !!thread }} />;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
return
|
|
48
|
-
<main className='is-full max-is-prose mli-auto bs-dvh overflow-hidden'>
|
|
49
|
-
<ChatContainer space={space} thread={channel.defaultThread.target} />
|
|
50
|
-
</main>
|
|
51
|
-
);
|
|
47
|
+
return <ThreadContainer space={space} thread={thread} />;
|
|
52
48
|
};
|
|
53
49
|
|
|
54
50
|
const meta = {
|
|
55
|
-
title: 'plugins/plugin-thread/
|
|
51
|
+
title: 'plugins/plugin-thread/containers/ThreadContainer',
|
|
56
52
|
component: ThreadComponent.Root as any,
|
|
57
|
-
render:
|
|
53
|
+
render: DefaultStory,
|
|
58
54
|
decorators: [
|
|
59
|
-
|
|
55
|
+
withLayout({ layout: 'column' }),
|
|
56
|
+
// TODO(wittjosiah): This shouldn't depend on app framework (use withClientProvider instead).
|
|
57
|
+
// Currently this is required due to useOnEditAnalytics.
|
|
60
58
|
withPluginManager({
|
|
61
|
-
plugins:
|
|
59
|
+
plugins: corePlugins(),
|
|
62
60
|
capabilities: [
|
|
63
|
-
contributes(
|
|
61
|
+
Capability.contributes(
|
|
64
62
|
Capabilities.ReactSurface,
|
|
65
|
-
|
|
63
|
+
Surface.create({
|
|
66
64
|
id: 'test',
|
|
67
65
|
role: 'card',
|
|
68
66
|
component: ({ role }) => <span>{JSON.stringify({ role })}</span>,
|
|
@@ -70,7 +68,10 @@ const meta = {
|
|
|
70
68
|
),
|
|
71
69
|
],
|
|
72
70
|
}),
|
|
73
|
-
withClientProvider({
|
|
71
|
+
withClientProvider({
|
|
72
|
+
createSpace: true,
|
|
73
|
+
types: [Thread.Thread, Message.Message],
|
|
74
|
+
}),
|
|
74
75
|
],
|
|
75
76
|
parameters: {
|
|
76
77
|
layout: 'fullscreen',
|