@dxos/plugin-thread 0.8.4-main.422d1c7879 → 0.8.4-main.43cb759274
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/PLUGIN.mdl +271 -0
- 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-FOUIGCEK.mjs +208 -0
- package/dist/lib/neutral/CommentsCompanion-FOUIGCEK.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 +109 -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/{browser/add-message-VPPFFLFL.mjs → neutral/add-message-RDIABSIX.mjs} +48 -23
- package/dist/lib/neutral/add-message-RDIABSIX.mjs.map +7 -0
- package/dist/lib/neutral/agent-runner-RB7N5HLD.mjs +244 -0
- package/dist/lib/neutral/agent-runner-RB7N5HLD.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-PDLRFYSI.mjs +120 -0
- package/dist/lib/neutral/app-graph-builder-PDLRFYSI.mjs.map +7 -0
- package/dist/lib/neutral/append-channel-message-TBBQUVMH.mjs +40 -0
- package/dist/lib/neutral/append-channel-message-TBBQUVMH.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-35GUWXBB.mjs +48 -0
- package/dist/lib/neutral/chunk-35GUWXBB.mjs.map +7 -0
- package/dist/lib/{browser/blueprints/index.mjs → neutral/chunk-5T5LPLBN.mjs} +5 -6
- package/dist/lib/neutral/chunk-5T5LPLBN.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-HQZWTDJC.mjs +164 -0
- package/dist/lib/neutral/chunk-HQZWTDJC.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IQBZZAMX.mjs +335 -0
- package/dist/lib/neutral/chunk-IQBZZAMX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-JJETHBAZ.mjs +8 -0
- package/dist/lib/neutral/chunk-JJETHBAZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-JLY4NVTA.mjs +38 -0
- 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/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/{browser/create-UGT7V733.mjs → neutral/create-VXM6HJMN.mjs} +20 -14
- package/dist/lib/neutral/create-VXM6HJMN.mjs.map +7 -0
- package/dist/lib/neutral/create-channel-FSJOMRHF.mjs +19 -0
- package/dist/lib/neutral/create-channel-FSJOMRHF.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/{browser/create-proposals-CMK7S7VS.mjs → neutral/create-proposals-ILYIYJEN.mjs} +5 -6
- package/dist/lib/neutral/create-proposals-ILYIYJEN.mjs.map +7 -0
- package/dist/lib/{browser/delete-FSFVU6ZA.mjs → neutral/delete-6KZERY6K.mjs} +9 -11
- package/dist/lib/neutral/delete-6KZERY6K.mjs.map +7 -0
- package/dist/lib/{browser/delete-message-XL5M5J33.mjs → neutral/delete-message-PATSHW36.mjs} +9 -19
- package/dist/lib/neutral/delete-message-PATSHW36.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/index.mjs.map +7 -0
- package/dist/lib/neutral/markdown-5UHAAC5Z.mjs +83 -0
- package/dist/lib/neutral/markdown-5UHAAC5Z.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/on-create-space-6NLTBGGD.mjs +23 -0
- package/dist/lib/neutral/on-create-space-6NLTBGGD.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/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-TUMXARMI.mjs +76 -0
- package/dist/lib/neutral/react-surface-TUMXARMI.mjs.map +7 -0
- package/dist/lib/neutral/respond-to-thread-ROQA3B6U.mjs +32 -0
- package/dist/lib/neutral/respond-to-thread-ROQA3B6U.mjs.map +7 -0
- package/dist/lib/{browser/restore-2ZGMKUSD.mjs → neutral/restore-SP4HADCE.mjs} +6 -7
- package/dist/lib/neutral/restore-SP4HADCE.mjs.map +7 -0
- package/dist/lib/{browser/restore-message-OYEGWPII.mjs → neutral/restore-message-TVIC66VL.mjs} +8 -17
- package/dist/lib/neutral/restore-message-TVIC66VL.mjs.map +7 -0
- package/dist/lib/{browser/select-VG2XLULE.mjs → neutral/select-DLHPEKEA.mjs} +7 -9
- package/dist/lib/neutral/select-DLHPEKEA.mjs.map +7 -0
- package/dist/lib/neutral/set-agent-config-7GEYCG7Y.mjs +20 -0
- package/dist/lib/neutral/set-agent-config-7GEYCG7Y.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/{browser/toggle-resolved-MM6YC5BU.mjs → neutral/toggle-resolved-GMAD3SZ2.mjs} +8 -17
- package/dist/lib/neutral/toggle-resolved-GMAD3SZ2.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/types/index.mjs.map +7 -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 +1 -0
- 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/thread-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/thread-blueprint.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +2 -2
- 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 +10 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/components/CommentsPanel/CommentsPanel.stories.d.ts +70 -70
- package/dist/types/src/components/CommentsPanel/CommentsPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/CommentsPanel/CommentsThread.d.ts.map +1 -1
- package/dist/types/src/components/MessagePanel/MessagePanel.d.ts.map +1 -1
- package/dist/types/src/components/ThreadSettings/ThreadSettings.d.ts.map +1 -1
- package/dist/types/src/components/ThreadSettings/ThreadSettings.stories.d.ts +70 -70
- package/dist/types/src/components/ThreadSettings/ThreadSettings.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +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/{CallDebugPanel → ChannelArticle}/index.d.ts.map +1 -1
- 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/{ChatContainer/ChatContainer.stories.d.ts → ThreadContainer/ThreadContainer.stories.d.ts} +71 -71
- 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 +4 -5
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/extensions/threads.d.ts +3 -3
- package/dist/types/src/extensions/threads.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/add-message.d.ts +3 -3
- package/dist/types/src/operations/add-message.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/operations/create-channel.d.ts.map +1 -1
- package/dist/types/src/operations/create-proposals.d.ts +3 -3
- package/dist/types/src/operations/create-proposals.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +3 -3
- package/dist/types/src/operations/create.d.ts.map +1 -1
- package/dist/types/src/operations/delete-message.d.ts +3 -3
- package/dist/types/src/operations/delete-message.d.ts.map +1 -1
- package/dist/types/src/operations/delete.d.ts +3 -3
- package/dist/types/src/operations/delete.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/on-create-space.d.ts +3 -3
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/operations/restore-message.d.ts.map +1 -1
- package/dist/types/src/operations/restore.d.ts +3 -3
- package/dist/types/src/operations/restore.d.ts.map +1 -1
- package/dist/types/src/operations/select.d.ts +3 -3
- package/dist/types/src/operations/select.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/operations/toggle-resolved.d.ts.map +1 -1
- 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/testing/data.d.ts.map +1 -1
- 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 +70 -70
- 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/ThreadCapabilities.d.ts +34 -0
- package/dist/types/src/types/ThreadCapabilities.d.ts.map +1 -0
- package/dist/types/src/{operations/definitions.d.ts → types/ThreadOperation.d.ts} +1882 -1941
- package/dist/types/src/types/ThreadOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -1
- 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 +133 -96
- package/src/ThreadPlugin.node.ts +39 -0
- package/src/ThreadPlugin.test.ts +37 -0
- package/src/ThreadPlugin.tsx +35 -65
- package/src/ThreadPlugin.workerd.ts +20 -0
- package/src/blueprints/thread-blueprint.ts +3 -4
- package/src/capabilities/agent-runner.ts +291 -0
- package/src/capabilities/app-graph-builder.ts +24 -74
- package/src/capabilities/blueprint-definition.ts +2 -0
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +4 -3
- package/src/capabilities/markdown.ts +6 -2
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +11 -27
- package/src/capabilities/settings.ts +1 -3
- package/src/capabilities/undo-mappings.ts +1 -1
- package/src/components/Chat/Chat.tsx +259 -0
- package/src/components/Chat/index.ts +5 -0
- package/src/components/CommentsPanel/CommentsPanel.stories.tsx +8 -7
- package/src/components/CommentsPanel/CommentsPanel.tsx +5 -5
- package/src/components/CommentsPanel/CommentsThread.tsx +16 -12
- package/src/components/MessagePanel/MessagePanel.tsx +8 -9
- package/src/components/ThreadSettings/ThreadSettings.stories.tsx +2 -1
- package/src/components/ThreadSettings/ThreadSettings.tsx +0 -1
- package/src/components/index.ts +1 -1
- 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 +355 -0
- package/src/containers/{ThreadCompanion/ThreadCompanion.tsx → CommentsCompanion/CommentsCompanion.tsx} +33 -34
- package/src/containers/CommentsCompanion/index.ts +5 -0
- package/src/containers/{ChatContainer/ChatContainer.stories.tsx → ThreadContainer/ThreadContainer.stories.tsx} +10 -11
- package/src/containers/ThreadContainer/ThreadContainer.tsx +75 -0
- package/src/containers/ThreadContainer/index.ts +8 -0
- package/src/containers/index.ts +4 -5
- package/src/extensions/command.ts +1 -1
- package/src/extensions/threads.ts +13 -13
- package/src/hooks/analytics.ts +1 -1
- package/src/hooks/index.ts +0 -5
- package/src/index.ts +4 -4
- package/src/meta.ts +34 -8
- package/src/operations/add-message.ts +22 -9
- package/src/operations/append-channel-message.ts +37 -0
- package/src/operations/create-channel.ts +4 -4
- package/src/operations/create-proposals.ts +3 -3
- package/src/operations/create.ts +21 -6
- package/src/operations/delete-message.ts +6 -6
- package/src/operations/delete.ts +5 -5
- package/src/operations/index.ts +4 -4
- package/src/operations/on-create-space.ts +4 -4
- package/src/operations/respond-to-thread.ts +32 -0
- package/src/operations/restore-message.ts +5 -5
- package/src/operations/restore.ts +4 -4
- package/src/operations/select.ts +3 -3
- package/src/operations/set-agent-config.ts +24 -0
- package/src/operations/toggle-resolved.ts +5 -5
- 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/testing/index.ts +1 -1
- package/src/translations.ts +2 -1
- package/src/types/AgentIdentity.ts +35 -0
- package/src/types/ThreadCapabilities.ts +46 -0
- package/src/types/ThreadOperation.ts +225 -0
- package/src/types/index.ts +5 -2
- package/src/types/types.ts +0 -2
- package/src/util.ts +36 -4
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/add-message-VPPFFLFL.mjs.map +0 -7
- package/dist/lib/browser/blueprints/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-MESW3R4Q.mjs +0 -61
- package/dist/lib/browser/chunk-MESW3R4Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-VPM44Z35.mjs +0 -259
- package/dist/lib/browser/chunk-VPM44Z35.mjs.map +0 -7
- package/dist/lib/browser/create-UGT7V733.mjs.map +0 -7
- package/dist/lib/browser/create-channel-EF67LCS6.mjs +0 -21
- package/dist/lib/browser/create-channel-EF67LCS6.mjs.map +0 -7
- package/dist/lib/browser/create-channel-thread-CCZTSWQ6.mjs +0 -28
- package/dist/lib/browser/create-channel-thread-CCZTSWQ6.mjs.map +0 -7
- package/dist/lib/browser/create-proposals-CMK7S7VS.mjs.map +0 -7
- package/dist/lib/browser/delete-FSFVU6ZA.mjs.map +0 -7
- package/dist/lib/browser/delete-message-XL5M5J33.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -2334
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/on-create-space-VYS2JGVT.mjs +0 -25
- package/dist/lib/browser/on-create-space-VYS2JGVT.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -14
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/restore-2ZGMKUSD.mjs.map +0 -7
- package/dist/lib/browser/restore-message-OYEGWPII.mjs.map +0 -7
- package/dist/lib/browser/select-VG2XLULE.mjs.map +0 -7
- package/dist/lib/browser/toggle-resolved-MM6YC5BU.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -12
- package/dist/lib/node-esm/add-message-XWKHLNS6.mjs +0 -98
- package/dist/lib/node-esm/add-message-XWKHLNS6.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -38
- package/dist/lib/node-esm/blueprints/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-JTHXNWKJ.mjs +0 -260
- package/dist/lib/node-esm/chunk-JTHXNWKJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SDRAQNSQ.mjs +0 -62
- package/dist/lib/node-esm/chunk-SDRAQNSQ.mjs.map +0 -7
- package/dist/lib/node-esm/create-XAYNDVU2.mjs +0 -56
- package/dist/lib/node-esm/create-XAYNDVU2.mjs.map +0 -7
- package/dist/lib/node-esm/create-channel-UYWUNB3L.mjs +0 -22
- package/dist/lib/node-esm/create-channel-UYWUNB3L.mjs.map +0 -7
- package/dist/lib/node-esm/create-channel-thread-UQF2SBHS.mjs +0 -29
- package/dist/lib/node-esm/create-channel-thread-UQF2SBHS.mjs.map +0 -7
- package/dist/lib/node-esm/create-proposals-5FJNURKH.mjs +0 -58
- package/dist/lib/node-esm/create-proposals-5FJNURKH.mjs.map +0 -7
- package/dist/lib/node-esm/delete-WRODXR3E.mjs +0 -60
- package/dist/lib/node-esm/delete-WRODXR3E.mjs.map +0 -7
- package/dist/lib/node-esm/delete-message-TAHCYTW2.mjs +0 -65
- package/dist/lib/node-esm/delete-message-TAHCYTW2.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -2335
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/on-create-space-XDY2YXPV.mjs +0 -26
- package/dist/lib/node-esm/on-create-space-XDY2YXPV.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -15
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/restore-T3QA7TSL.mjs +0 -34
- package/dist/lib/node-esm/restore-T3QA7TSL.mjs.map +0 -7
- package/dist/lib/node-esm/restore-message-WFTEVBEV.mjs +0 -43
- package/dist/lib/node-esm/restore-message-WFTEVBEV.mjs.map +0 -7
- package/dist/lib/node-esm/select-Q4UDWJJF.mjs +0 -27
- package/dist/lib/node-esm/select-Q4UDWJJF.mjs.map +0 -7
- package/dist/lib/node-esm/toggle-resolved-33XTAK2H.mjs +0 -46
- package/dist/lib/node-esm/toggle-resolved-33XTAK2H.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -13
- package/dist/types/src/calls/call-manager.d.ts +0 -87
- 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 -6
- package/dist/types/src/capabilities/call-manager.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts +0 -9
- 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/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/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/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 -178
- 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/ResponsivePanel.d.ts +0 -12
- package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.d.ts.map +0 -1
- package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.stories.d.ts +0 -164
- package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.stories.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/containers/CallDebugPanel/CallDebugPanel.d.ts +0 -15
- package/dist/types/src/containers/CallDebugPanel/CallDebugPanel.d.ts.map +0 -1
- package/dist/types/src/containers/CallDebugPanel/index.d.ts +0 -2
- package/dist/types/src/containers/CallSidebar/CallSidebar.d.ts +0 -3
- package/dist/types/src/containers/CallSidebar/CallSidebar.d.ts.map +0 -1
- package/dist/types/src/containers/CallSidebar/index.d.ts +0 -2
- package/dist/types/src/containers/CallSidebar/index.d.ts.map +0 -1
- package/dist/types/src/containers/ChannelContainer/ChannelContainer.d.ts +0 -12
- package/dist/types/src/containers/ChannelContainer/ChannelContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ChannelContainer/ChannelContainer.stories.d.ts +0 -162
- package/dist/types/src/containers/ChannelContainer/ChannelContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/ChannelContainer/index.d.ts +0 -2
- package/dist/types/src/containers/ChannelContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts +0 -16
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/index.d.ts +0 -4
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ThreadCompanion/ThreadCompanion.d.ts +0 -8
- package/dist/types/src/containers/ThreadCompanion/ThreadCompanion.d.ts.map +0 -1
- package/dist/types/src/containers/ThreadCompanion/index.d.ts +0 -2
- package/dist/types/src/containers/ThreadCompanion/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/operations/create-channel-thread.d.ts +0 -5
- package/dist/types/src/operations/create-channel-thread.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/testing/stories.d.ts +0 -3
- package/dist/types/src/testing/stories.d.ts.map +0 -1
- package/dist/types/src/types/Channel.d.ts +0 -715
- package/dist/types/src/types/Channel.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -24
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/src/calls/call-manager.ts +0 -270
- 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 -580
- 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 -230
- package/src/capabilities/call-manager.ts +0 -27
- package/src/capabilities/react-root.tsx +0 -20
- package/src/components/Call/Call.tsx +0 -93
- package/src/components/Call/Toolbar.tsx +0 -199
- package/src/components/Call/index.ts +0 -6
- package/src/components/Lobby/Lobby.tsx +0 -122
- package/src/components/Lobby/index.ts +0 -5
- package/src/components/Media/AudioStream.tsx +0 -67
- package/src/components/Media/VideoObject.stories.tsx +0 -59
- package/src/components/Media/VideoObject.tsx +0 -58
- package/src/components/Media/index.ts +0 -6
- package/src/components/Participant/Participant.tsx +0 -77
- package/src/components/Participant/ParticipantGrid.tsx +0 -88
- package/src/components/Participant/index.ts +0 -6
- package/src/components/ResponsiveGrid/ResponsiveGrid.stories.tsx +0 -157
- package/src/components/ResponsiveGrid/ResponsiveGrid.tsx +0 -341
- package/src/components/ResponsiveGrid/ResponsiveGridItem.tsx +0 -134
- package/src/components/ResponsiveGrid/ResponsivePanel.stories.tsx +0 -53
- package/src/components/ResponsiveGrid/ResponsivePanel.tsx +0 -31
- package/src/components/ResponsiveGrid/index.ts +0 -7
- package/src/containers/CallDebugPanel/CallDebugPanel.tsx +0 -173
- package/src/containers/CallDebugPanel/index.ts +0 -5
- package/src/containers/CallSidebar/CallSidebar.tsx +0 -18
- package/src/containers/CallSidebar/index.ts +0 -5
- package/src/containers/ChannelContainer/ChannelContainer.stories.tsx +0 -61
- package/src/containers/ChannelContainer/ChannelContainer.tsx +0 -223
- package/src/containers/ChannelContainer/index.ts +0 -5
- package/src/containers/ChatContainer/ChatContainer.tsx +0 -131
- package/src/containers/ChatContainer/index.ts +0 -8
- package/src/containers/ThreadCompanion/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/operations/create-channel-thread.ts +0 -26
- package/src/operations/definitions.ts +0 -177
- package/src/testing/stories.ts +0 -51
- package/src/types/Channel.ts +0 -37
- package/src/types/capabilities.ts +0 -36
- package/src/typings/peermetrics-webrtc-stats.d.ts +0 -46
- package/src/typings.d.ts +0 -8
- /package/dist/lib/{browser/chunk-J5LGTIGS.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/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/hooks}/index.mjs.map +0 -0
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
7
8
|
import { Obj, Ref, Relation } from '@dxos/echo';
|
|
8
9
|
import { invariant } from '@dxos/invariant';
|
|
9
|
-
import {
|
|
10
|
-
import { ObservabilityOperation } from '@dxos/plugin-observability/operations';
|
|
10
|
+
import { ObservabilityOperation } from '@dxos/plugin-observability';
|
|
11
11
|
import { Thread } from '@dxos/types';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { ThreadOperation } from '../types';
|
|
14
14
|
|
|
15
|
-
const handler: Operation.WithHandler<typeof RestoreMessage> = RestoreMessage.pipe(
|
|
15
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.RestoreMessage> = ThreadOperation.RestoreMessage.pipe(
|
|
16
16
|
Operation.withHandler(
|
|
17
17
|
Effect.fnUntraced(function* ({ anchor, message, messageIndex }) {
|
|
18
18
|
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
19
19
|
const db = Obj.getDatabase(thread);
|
|
20
20
|
invariant(db, 'Database not found');
|
|
21
21
|
|
|
22
|
-
Obj.
|
|
22
|
+
Obj.update(thread, (thread) => {
|
|
23
23
|
thread.messages.splice(messageIndex, 0, Ref.make(message));
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { sleep } from '@dxos/async';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
8
9
|
import { Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
import { ObservabilityOperation } from '@dxos/plugin-observability/operations';
|
|
10
|
+
import { ObservabilityOperation } from '@dxos/plugin-observability';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { ThreadOperation } from '../types';
|
|
13
13
|
|
|
14
|
-
const handler: Operation.WithHandler<typeof Restore> = Restore.pipe(
|
|
14
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.Restore> = ThreadOperation.Restore.pipe(
|
|
15
15
|
Operation.withHandler(
|
|
16
16
|
Effect.fnUntraced(function* ({ thread, anchor }) {
|
|
17
17
|
const db = Obj.getDatabase(thread);
|
package/src/operations/select.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import { Operation } from '@dxos/
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
import { ThreadCapabilities } from '../types';
|
|
11
|
-
import {
|
|
11
|
+
import { ThreadOperation } from '../types';
|
|
12
12
|
|
|
13
|
-
const handler: Operation.WithHandler<typeof Select> = Select.pipe(
|
|
13
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.Select> = ThreadOperation.Select.pipe(
|
|
14
14
|
Operation.withHandler(
|
|
15
15
|
Effect.fnUntraced(function* (input) {
|
|
16
16
|
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Database, Obj } from '@dxos/echo';
|
|
9
|
+
import { type Thread } from '@dxos/types';
|
|
10
|
+
|
|
11
|
+
import { ThreadOperation } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.SetAgentConfig> = ThreadOperation.SetAgentConfig.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* ({ thread: threadRef, config }) {
|
|
16
|
+
const thread = yield* Database.load(threadRef);
|
|
17
|
+
Obj.update(thread, (thread) => {
|
|
18
|
+
(thread as Obj.Mutable<Thread.Thread>).agent = config;
|
|
19
|
+
});
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default handler;
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
7
8
|
import { Obj } from '@dxos/echo';
|
|
8
9
|
import { invariant } from '@dxos/invariant';
|
|
9
|
-
import {
|
|
10
|
-
import { ObservabilityOperation } from '@dxos/plugin-observability/operations';
|
|
10
|
+
import { ObservabilityOperation } from '@dxos/plugin-observability';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { ThreadOperation } from '../types';
|
|
13
13
|
|
|
14
|
-
const handler: Operation.WithHandler<typeof ToggleResolved> = ToggleResolved.pipe(
|
|
14
|
+
const handler: Operation.WithHandler<typeof ThreadOperation.ToggleResolved> = ThreadOperation.ToggleResolved.pipe(
|
|
15
15
|
Operation.withHandler(
|
|
16
16
|
Effect.fnUntraced(function* (input) {
|
|
17
17
|
const thread = input.thread;
|
|
18
18
|
|
|
19
|
-
Obj.
|
|
19
|
+
Obj.update(thread, (thread) => {
|
|
20
20
|
if (thread.status === 'active' || thread.status === undefined) {
|
|
21
21
|
thread.status = 'resolved';
|
|
22
22
|
} else if (thread.status === 'resolved') {
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const ThreadPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { ThreadOperationHandlerSet } from './operations';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { type Message, type Thread } from '@dxos/types';
|
|
8
|
+
|
|
9
|
+
import { shouldTriggerAgent } from './should-trigger-agent';
|
|
10
|
+
|
|
11
|
+
// `shouldTriggerAgent` is a pure predicate over the schema shapes — these tests
|
|
12
|
+
// build plain object literals shaped like Message/Thread to avoid the ECHO proxy's
|
|
13
|
+
// `Obj.update`-only mutation guard.
|
|
14
|
+
const makeMessage = (role: 'user' | 'assistant' | undefined, text: string): Message.Message =>
|
|
15
|
+
({
|
|
16
|
+
created: new Date().toISOString(),
|
|
17
|
+
sender: role ? { role } : {},
|
|
18
|
+
blocks: [{ _tag: 'text', text }],
|
|
19
|
+
}) as unknown as Message.Message;
|
|
20
|
+
|
|
21
|
+
const makeThread = (overrides: Partial<Thread.Thread> = {}): Thread.Thread =>
|
|
22
|
+
({
|
|
23
|
+
status: 'active',
|
|
24
|
+
messages: [],
|
|
25
|
+
...overrides,
|
|
26
|
+
}) as unknown as Thread.Thread;
|
|
27
|
+
|
|
28
|
+
describe('shouldTriggerAgent', () => {
|
|
29
|
+
test('returns false when agent is undefined', ({ expect }) => {
|
|
30
|
+
expect(shouldTriggerAgent(makeThread(), makeMessage('user', 'hi'), 'echo')).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('returns false when agent is disabled', ({ expect }) => {
|
|
34
|
+
const thread = makeThread({ agent: { enabled: false, mode: 'auto' } });
|
|
35
|
+
expect(shouldTriggerAgent(thread, makeMessage('user', 'hi'), 'echo')).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('returns false on assistant-authored messages (self-loop guard)', ({ expect }) => {
|
|
39
|
+
const thread = makeThread({ agent: { enabled: true, mode: 'auto' } });
|
|
40
|
+
expect(shouldTriggerAgent(thread, makeMessage('assistant', 'hi'), 'echo')).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('treats messages with no role as user messages (current CommentsCompanion pattern)', ({ expect }) => {
|
|
44
|
+
const thread = makeThread({ agent: { enabled: true, mode: 'auto' } });
|
|
45
|
+
expect(shouldTriggerAgent(thread, makeMessage(undefined, 'hi'), 'echo')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('returns false on resolved threads even when enabled', ({ expect }) => {
|
|
49
|
+
const thread = makeThread({ status: 'resolved', agent: { enabled: true, mode: 'auto' } });
|
|
50
|
+
expect(shouldTriggerAgent(thread, makeMessage('user', 'hi'), 'echo')).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('auto mode fires on any user message', ({ expect }) => {
|
|
54
|
+
const thread = makeThread({ agent: { enabled: true, mode: 'auto' } });
|
|
55
|
+
expect(shouldTriggerAgent(thread, makeMessage('user', 'anything goes'), 'echo')).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('mention mode does not fire without @name', ({ expect }) => {
|
|
59
|
+
const thread = makeThread({ agent: { enabled: true, mode: 'mention' } });
|
|
60
|
+
expect(shouldTriggerAgent(thread, makeMessage('user', 'hello world'), 'echo')).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('mention mode fires on @name match (case-insensitive)', ({ expect }) => {
|
|
64
|
+
const thread = makeThread({ agent: { enabled: true, mode: 'mention' } });
|
|
65
|
+
expect(shouldTriggerAgent(thread, makeMessage('user', 'hey @Echo check this'), 'echo')).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('mention mode requires the @ sigil, not just the name', ({ expect }) => {
|
|
69
|
+
const thread = makeThread({ agent: { enabled: true, mode: 'mention' } });
|
|
70
|
+
expect(shouldTriggerAgent(thread, makeMessage('user', 'echo location'), 'echo')).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Message, type Thread } from '@dxos/types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the concatenated text of all 'text' blocks on a message.
|
|
9
|
+
*
|
|
10
|
+
* Proposal blocks (assistant-authored markdown diffs) are intentionally
|
|
11
|
+
* excluded — gating mentions off a proposal text would be meaningless.
|
|
12
|
+
*/
|
|
13
|
+
export const textOf = (message: Message.Message | undefined): string => {
|
|
14
|
+
if (!message) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
return message.blocks
|
|
18
|
+
.filter((block): block is Extract<Message.Message['blocks'][number], { _tag: 'text' }> => block._tag === 'text')
|
|
19
|
+
.map((block) => block.text)
|
|
20
|
+
.join('\n');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Trigger gate for the comment-thread agent.
|
|
25
|
+
*
|
|
26
|
+
* Returns true iff the agent should respond to the latest message. All of:
|
|
27
|
+
* - `thread.agent` exists and `enabled === true`
|
|
28
|
+
* - `message.sender.role !== 'assistant'` (structural self-loop guard).
|
|
29
|
+
* Note: user-authored messages typically have NO role set; only assistant
|
|
30
|
+
* messages carry an explicit role.
|
|
31
|
+
* - `thread.status !== 'resolved'`
|
|
32
|
+
* - Either mode === 'auto', OR text contains an `@{agentName}` mention
|
|
33
|
+
* (case-insensitive substring match; v1 — promote to a parser later).
|
|
34
|
+
*/
|
|
35
|
+
export const shouldTriggerAgent = (thread: Thread.Thread, message: Message.Message, agentName: string): boolean => {
|
|
36
|
+
if (!thread.agent?.enabled) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (message.sender.role === 'assistant') {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (thread.status === 'resolved') {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (thread.agent.mode === 'auto') {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
const needle = '@' + agentName.toLowerCase();
|
|
49
|
+
return textOf(message).toLowerCase().includes(needle);
|
|
50
|
+
};
|
package/src/testing/index.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { Type } from '@dxos/echo';
|
|
6
6
|
import { type Resource } from '@dxos/react-ui';
|
|
7
|
+
import { Channel } from '@dxos/types';
|
|
7
8
|
|
|
8
9
|
import { meta } from '#meta';
|
|
9
|
-
import { Channel } from '#types';
|
|
10
10
|
|
|
11
11
|
export const translations = [
|
|
12
12
|
{
|
|
13
13
|
'en-US': {
|
|
14
|
+
// TODO(burdon): Thread.
|
|
14
15
|
[Type.getTypename(Channel.Channel)]: {
|
|
15
16
|
'typename.label': 'Channel',
|
|
16
17
|
'typename.label_zero': 'Channels',
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from '#meta';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Runtime identity of the comment-thread AI agent.
|
|
11
|
+
*
|
|
12
|
+
* Resolved via a Capability contribution at plugin activation, never stored on
|
|
13
|
+
* Thread.Thread. Renaming the agent globally (e.g. via plugin settings)
|
|
14
|
+
* immediately affects gating and sender metadata on every opted-in thread —
|
|
15
|
+
* past and future.
|
|
16
|
+
*
|
|
17
|
+
* - `name`: display name and @mention token (case-insensitive match).
|
|
18
|
+
* - `identityDid`: optional ECHO DID stamped on assistant messages.
|
|
19
|
+
* - `avatar`: optional icon hint.
|
|
20
|
+
*/
|
|
21
|
+
export interface AgentIdentity {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly identityDid?: string;
|
|
24
|
+
readonly avatar?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const AgentIdentity = Capability.make<AgentIdentity>(`${meta.id}.capability.agent-identity`);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Built-in default identity used by ThreadPlugin when no host has contributed
|
|
31
|
+
* a stronger `AgentIdentity`. Hosts that want to override (e.g. a workspace-
|
|
32
|
+
* scoped bot record, a settings panel) must contribute their identity earlier
|
|
33
|
+
* in plugin order so `Capability.get` returns it first.
|
|
34
|
+
*/
|
|
35
|
+
export const DEFAULT_AGENT_IDENTITY: AgentIdentity = { name: 'Kai' };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
|
|
10
|
+
import { Capability } from '@dxos/app-framework';
|
|
11
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
+
import { type Obj } from '@dxos/echo';
|
|
13
|
+
import { type Thread } from '@dxos/types';
|
|
14
|
+
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
|
|
17
|
+
import { type ThreadState, type ViewStore } from '../types';
|
|
18
|
+
|
|
19
|
+
export const Settings = Capability.make<Atom.Writable<import('./Settings').Settings>>(`${meta.id}.capability.settings`);
|
|
20
|
+
|
|
21
|
+
/** Comment configuration contributed per typename by plugins that support commenting. */
|
|
22
|
+
export type CommentConfig = AppCapabilities.CommentConfig;
|
|
23
|
+
export const CommentConfig: Capability.InterfaceDef<AppCapabilities.CommentConfig> = AppCapabilities.CommentConfig;
|
|
24
|
+
|
|
25
|
+
/** Thread state (drafts, toolbar state, current selection). */
|
|
26
|
+
export const State = Capability.make<Atom.Writable<ThreadState>>(`${meta.id}.capability.state`);
|
|
27
|
+
|
|
28
|
+
/** Per-subject view state (e.g., showResolvedThreads). */
|
|
29
|
+
export const ViewState = Capability.make<Atom.Writable<ViewStore>>(`${meta.id}.capability.view-state`);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Runs one comment-thread agent turn against a thread/subject pair.
|
|
33
|
+
*
|
|
34
|
+
* `run` may depend on `Capability.Service` so implementations can read
|
|
35
|
+
* `AgentIdentity` and any other contributed capabilities. The caller
|
|
36
|
+
* (RespondToThread operation handler) already provides `Capability.Service`.
|
|
37
|
+
*
|
|
38
|
+
* The default implementation (built atop AiSession) is not yet wired; storybook
|
|
39
|
+
* and tests contribute stub implementations via `Capability.contributes` to
|
|
40
|
+
* exercise the trigger plumbing without making network calls.
|
|
41
|
+
*/
|
|
42
|
+
export interface AgentRunner {
|
|
43
|
+
run(input: { thread: Thread.Thread; subject: Obj.Any }): Effect.Effect<void, Error, Capability.Service>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const AgentRunner = Capability.make<AgentRunner>(`${meta.id}.capability.agent-runner`);
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { SpaceSchema } from '@dxos/client-protocol';
|
|
11
|
+
import { Operation } from '@dxos/compute';
|
|
12
|
+
import { Collection, Database, Key, Obj, Ref, Type, DXN } from '@dxos/echo';
|
|
13
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
14
|
+
import { Actor, AnchoredTo, Channel, Message, Thread } from '@dxos/types';
|
|
15
|
+
|
|
16
|
+
import { meta } from '#meta';
|
|
17
|
+
|
|
18
|
+
const makeKey = (name: string) => DXN.make(`${meta.id}.operation.${name}`);
|
|
19
|
+
|
|
20
|
+
export const OnCreateSpace = Operation.make({
|
|
21
|
+
meta: { key: makeKey('onCreateSpace'), name: 'On Create Space', icon: 'ph--chat-text--regular' },
|
|
22
|
+
services: [Capability.Service],
|
|
23
|
+
input: Schema.Struct({
|
|
24
|
+
space: SpaceSchema,
|
|
25
|
+
rootCollection: Type.getSchema(Collection.Collection),
|
|
26
|
+
isDefault: Schema.Boolean.pipe(Schema.optional),
|
|
27
|
+
}),
|
|
28
|
+
output: Schema.Void,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const CreateChannel = Operation.make({
|
|
32
|
+
meta: { key: makeKey('createChannel'), name: 'Create Channel', icon: 'ph--hash--regular' },
|
|
33
|
+
services: [Capability.Service],
|
|
34
|
+
input: Schema.Struct({
|
|
35
|
+
spaceId: Key.SpaceId,
|
|
36
|
+
name: Schema.optional(Schema.String),
|
|
37
|
+
}),
|
|
38
|
+
output: Schema.Struct({
|
|
39
|
+
object: Type.getSchema(Channel.Channel),
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const AppendChannelMessage = Operation.make({
|
|
44
|
+
meta: {
|
|
45
|
+
key: makeKey('appendChannelMessage'),
|
|
46
|
+
name: 'Append Channel Message',
|
|
47
|
+
icon: 'ph--chat-text--regular',
|
|
48
|
+
},
|
|
49
|
+
// Note: Feed.FeedService is provided inside the handler from space.queues, not at the
|
|
50
|
+
// operation level — the runtime can't fulfill it without a space context.
|
|
51
|
+
services: [Capability.Service],
|
|
52
|
+
input: Schema.Struct({
|
|
53
|
+
channel: Type.getSchema(Channel.Channel),
|
|
54
|
+
sender: Actor.Actor,
|
|
55
|
+
text: Schema.String,
|
|
56
|
+
}),
|
|
57
|
+
output: Schema.Void,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const Create = Operation.make({
|
|
61
|
+
meta: { key: makeKey('create'), name: 'Create Thread', icon: 'ph--chat-text--regular' },
|
|
62
|
+
services: [Capability.Service],
|
|
63
|
+
input: Schema.Struct({
|
|
64
|
+
name: Schema.optional(Schema.String),
|
|
65
|
+
anchor: Schema.optional(Schema.String),
|
|
66
|
+
subject: Obj.Unknown,
|
|
67
|
+
}),
|
|
68
|
+
output: Schema.Void,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export const DeleteOutput = Schema.Struct({
|
|
72
|
+
thread: Type.getSchema(Thread.Thread).annotations({ description: 'The deleted thread.' }),
|
|
73
|
+
anchor: Type.getSchema(AnchoredTo.AnchoredTo).annotations({ description: 'The deleted anchor.' }),
|
|
74
|
+
}).pipe(Schema.partial);
|
|
75
|
+
|
|
76
|
+
export type DeleteOutput = Schema.Schema.Type<typeof DeleteOutput>;
|
|
77
|
+
|
|
78
|
+
export const Delete = Operation.make({
|
|
79
|
+
meta: { key: makeKey('delete'), name: 'Delete Thread', icon: 'ph--trash--regular' },
|
|
80
|
+
services: [Capability.Service],
|
|
81
|
+
input: Schema.Struct({
|
|
82
|
+
anchor: Type.getSchema(AnchoredTo.AnchoredTo),
|
|
83
|
+
subject: Obj.Unknown,
|
|
84
|
+
thread: Schema.optional(Type.getSchema(Thread.Thread)),
|
|
85
|
+
}),
|
|
86
|
+
output: DeleteOutput,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const Select = Operation.make({
|
|
90
|
+
meta: { key: makeKey('select'), name: 'Select Thread', icon: 'ph--check--regular' },
|
|
91
|
+
services: [Capability.Service],
|
|
92
|
+
input: Schema.Struct({
|
|
93
|
+
current: Schema.String,
|
|
94
|
+
}),
|
|
95
|
+
output: Schema.Void,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export const ToggleResolved = Operation.make({
|
|
99
|
+
meta: {
|
|
100
|
+
key: makeKey('toggleResolved'),
|
|
101
|
+
name: 'Toggle Resolved',
|
|
102
|
+
icon: 'ph--check-circle--regular',
|
|
103
|
+
},
|
|
104
|
+
services: [Capability.Service],
|
|
105
|
+
input: Schema.Struct({
|
|
106
|
+
thread: Type.getSchema(Thread.Thread),
|
|
107
|
+
}),
|
|
108
|
+
output: Schema.Void,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export const AddMessage = Operation.make({
|
|
112
|
+
meta: { key: makeKey('addMessage'), name: 'Add Message', icon: 'ph--chat-text--regular' },
|
|
113
|
+
services: [Capability.Service],
|
|
114
|
+
input: Schema.Struct({
|
|
115
|
+
subject: Obj.Unknown,
|
|
116
|
+
anchor: Type.getSchema(AnchoredTo.AnchoredTo),
|
|
117
|
+
sender: Actor.Actor,
|
|
118
|
+
text: Schema.String,
|
|
119
|
+
}),
|
|
120
|
+
output: Schema.Void,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export const DeleteMessageOutput = Schema.partial(
|
|
124
|
+
Schema.Struct({
|
|
125
|
+
message: Type.getSchema(Message.Message).annotations({ description: 'The deleted message.' }),
|
|
126
|
+
messageIndex: Schema.Number.annotations({ description: 'The index the message was at.' }),
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
export type DeleteMessageOutput = Schema.Schema.Type<typeof DeleteMessageOutput>;
|
|
131
|
+
|
|
132
|
+
export const DeleteMessage = Operation.make({
|
|
133
|
+
meta: { key: makeKey('deleteMessage'), name: 'Delete Message', icon: 'ph--trash--regular' },
|
|
134
|
+
services: [Capability.Service],
|
|
135
|
+
input: Schema.Struct({
|
|
136
|
+
anchor: Type.getSchema(AnchoredTo.AnchoredTo),
|
|
137
|
+
subject: Obj.Unknown,
|
|
138
|
+
messageId: Schema.String,
|
|
139
|
+
}),
|
|
140
|
+
output: DeleteMessageOutput,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Restore a deleted thread (inverse of Delete).
|
|
145
|
+
*/
|
|
146
|
+
export const Restore = Operation.make({
|
|
147
|
+
meta: {
|
|
148
|
+
key: makeKey('restore'),
|
|
149
|
+
name: 'Restore Thread',
|
|
150
|
+
icon: 'ph--clock-counter-clockwise--regular',
|
|
151
|
+
},
|
|
152
|
+
services: [Capability.Service],
|
|
153
|
+
input: Schema.Struct({
|
|
154
|
+
thread: Type.getSchema(Thread.Thread).annotations({ description: 'The thread to restore.' }),
|
|
155
|
+
anchor: Type.getSchema(AnchoredTo.AnchoredTo).annotations({ description: 'The anchor relation to restore.' }),
|
|
156
|
+
}),
|
|
157
|
+
output: Schema.Void,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Restore a deleted message (inverse of DeleteMessage).
|
|
162
|
+
*/
|
|
163
|
+
export const RestoreMessage = Operation.make({
|
|
164
|
+
meta: {
|
|
165
|
+
key: makeKey('restoreMessage'),
|
|
166
|
+
name: 'Restore Message',
|
|
167
|
+
icon: 'ph--clock-counter-clockwise--regular',
|
|
168
|
+
},
|
|
169
|
+
services: [Capability.Service],
|
|
170
|
+
input: Schema.Struct({
|
|
171
|
+
anchor: Type.getSchema(AnchoredTo.AnchoredTo).annotations({ description: 'The anchor of the thread.' }),
|
|
172
|
+
message: Type.getSchema(Message.Message).annotations({ description: 'The message to restore.' }),
|
|
173
|
+
messageIndex: Schema.Number.annotations({ description: 'The index to restore the message at.' }),
|
|
174
|
+
}),
|
|
175
|
+
output: Schema.Void,
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
export const RespondToThread = Operation.make({
|
|
179
|
+
meta: {
|
|
180
|
+
key: makeKey('respondToThread'),
|
|
181
|
+
name: 'Respond to Thread',
|
|
182
|
+
description: 'Runs one comment-thread agent turn against the given thread + subject.',
|
|
183
|
+
},
|
|
184
|
+
services: [Capability.Service],
|
|
185
|
+
input: Schema.Struct({
|
|
186
|
+
thread: Ref.Ref(Thread.Thread).annotations({ description: 'The thread to respond to.' }),
|
|
187
|
+
subject: Ref.Ref(Obj.Unknown).annotations({ description: 'The object the thread is anchored to.' }),
|
|
188
|
+
}),
|
|
189
|
+
output: Schema.Void,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
export const SetAgentConfig = Operation.make({
|
|
193
|
+
meta: {
|
|
194
|
+
key: makeKey('setAgentConfig'),
|
|
195
|
+
name: 'Set Agent Config',
|
|
196
|
+
description: 'Updates thread.agent. Undefined config disables the agent.',
|
|
197
|
+
},
|
|
198
|
+
services: [Database.Service],
|
|
199
|
+
input: Schema.Struct({
|
|
200
|
+
thread: Ref.Ref(Thread.Thread).annotations({ description: 'The thread to configure.' }),
|
|
201
|
+
config: Schema.optional(Thread.AgentConfig).annotations({
|
|
202
|
+
description: 'New agent config; omit to disable.',
|
|
203
|
+
}),
|
|
204
|
+
}),
|
|
205
|
+
output: Schema.Void,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
export const CreateProposals = Operation.make({
|
|
209
|
+
meta: {
|
|
210
|
+
key: DXN.make('org.dxos.function.thread.createProposals'),
|
|
211
|
+
name: 'Create Proposals',
|
|
212
|
+
description: 'Proposes a set of changes to a document.',
|
|
213
|
+
icon: 'ph--sparkle--regular',
|
|
214
|
+
},
|
|
215
|
+
input: Schema.Struct({
|
|
216
|
+
doc: Ref.Ref(Markdown.Document).annotations({
|
|
217
|
+
description: 'The ID of the document.',
|
|
218
|
+
}),
|
|
219
|
+
diffs: Schema.Array(Schema.String).annotations({
|
|
220
|
+
description: 'The diffs to propose for the document.',
|
|
221
|
+
}),
|
|
222
|
+
}),
|
|
223
|
+
output: Schema.Void,
|
|
224
|
+
services: [Database.Service],
|
|
225
|
+
});
|
package/src/types/index.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './capabilities';
|
|
6
|
-
export * as Channel from './Channel';
|
|
7
5
|
export * from './types';
|
|
6
|
+
|
|
7
|
+
export * from './AgentIdentity';
|
|
8
|
+
export * as Settings from './Settings';
|
|
9
|
+
export * as ThreadCapabilities from './ThreadCapabilities';
|
|
10
|
+
export * as ThreadOperation from './ThreadOperation';
|
package/src/types/types.ts
CHANGED
package/src/util.ts
CHANGED
|
@@ -9,18 +9,50 @@ import { type PublicKey } from '@dxos/react-client';
|
|
|
9
9
|
import { type Identity } from '@dxos/react-client/halo';
|
|
10
10
|
import { type Selection } from '@dxos/react-ui-attention';
|
|
11
11
|
import { type MessageMetadata } from '@dxos/react-ui-thread';
|
|
12
|
-
import { hexToFallback } from '@dxos/util';
|
|
12
|
+
import { hexToFallback, toFallback } from '@dxos/util';
|
|
13
13
|
|
|
14
14
|
export type MessagePropertiesProvider = (identityKey: PublicKey | undefined) => MessageMetadata;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Stable hash for an arbitrary string — used as the avatar-fallback seed for
|
|
18
|
+
* external senders who have no DXOS identity (e.g. Slack/Discord-synced
|
|
19
|
+
* messages). djb2-ish, only stability matters.
|
|
20
|
+
*
|
|
21
|
+
* Coerced to unsigned 32-bit via `>>> 0` because `toFallback` does a plain
|
|
22
|
+
* modulo against `idEmoji.length * idHue.length` and JavaScript's `%`
|
|
23
|
+
* preserves the sign of the dividend — a negative hash would index
|
|
24
|
+
* `idEmoji[-x]` and `idHue[-x]` to `undefined`, causing the avatar to fall
|
|
25
|
+
* through to `Avatar.Content`'s default red/ghost.
|
|
26
|
+
*/
|
|
27
|
+
const hashString = (s: string): number => {
|
|
28
|
+
let h = 0;
|
|
29
|
+
for (let i = 0; i < s.length; i++) {
|
|
30
|
+
h = (h * 31 + s.charCodeAt(i)) | 0;
|
|
31
|
+
}
|
|
32
|
+
return h >>> 0;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const getMessageMetadata = (
|
|
36
|
+
id: string,
|
|
37
|
+
identity?: Identity,
|
|
38
|
+
/**
|
|
39
|
+
* Externally-sourced sender info (Slack/Discord/etc). Used only when no
|
|
40
|
+
* matching DXOS `identity` is available — provides `name`/`email` for the
|
|
41
|
+
* author label and a stable seed for the avatar fallback.
|
|
42
|
+
*/
|
|
43
|
+
fallbackSender?: { name?: string; email?: string },
|
|
44
|
+
): MessageMetadata => {
|
|
45
|
+
const fallback = identity?.identityKey
|
|
46
|
+
? hexToFallback(identity.identityKey.toHex())
|
|
47
|
+
: toFallback(hashString(fallbackSender?.name ?? fallbackSender?.email ?? '0'));
|
|
18
48
|
return {
|
|
19
49
|
id,
|
|
20
50
|
authorId: identity?.did,
|
|
21
51
|
authorName:
|
|
22
52
|
identity?.profile?.displayName ??
|
|
23
|
-
(identity?.identityKey ? generateName(identity.identityKey.toHex()) : undefined)
|
|
53
|
+
(identity?.identityKey ? generateName(identity.identityKey.toHex()) : undefined) ??
|
|
54
|
+
fallbackSender?.name ??
|
|
55
|
+
fallbackSender?.email,
|
|
24
56
|
authorAvatarProps: {
|
|
25
57
|
hue: identity?.profile?.data?.hue ?? fallback.hue,
|
|
26
58
|
emoji: identity?.profile?.data?.emoji ?? fallback.emoji,
|