@dxos/plugin-thread 0.9.0 → 0.9.1-staging.ee54ba693a
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/dist/lib/neutral/ChannelArticle-CTYSCRTR.mjs +122 -0
- package/dist/lib/neutral/ChannelArticle-CTYSCRTR.mjs.map +7 -0
- package/dist/lib/neutral/ThreadPlugin.mjs +4 -2
- package/dist/lib/neutral/ThreadPlugin.mjs.map +4 -4
- package/dist/lib/neutral/app-graph-builder-NZOWDFE5.mjs +65 -0
- package/dist/lib/neutral/app-graph-builder-NZOWDFE5.mjs.map +7 -0
- package/dist/lib/neutral/{append-channel-message-J6DXDPBH.mjs → append-channel-message-YIIJY6GX.mjs} +2 -2
- package/dist/lib/neutral/capabilities/index.mjs +5 -5
- package/dist/lib/neutral/{channel-backend-feed-FCXGAIEC.mjs → channel-backend-feed-TOS55NID.mjs} +7 -8
- package/dist/lib/neutral/channel-backend-feed-TOS55NID.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-HJHK5O6F.mjs → chunk-5VTDNDBV.mjs} +5 -5
- package/dist/lib/neutral/{chunk-HJHK5O6F.mjs.map → chunk-5VTDNDBV.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-A5JYVGL2.mjs +45 -0
- package/dist/lib/neutral/chunk-A5JYVGL2.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-P4RSGFS4.mjs → chunk-GM3SGQMJ.mjs} +2 -2
- package/dist/lib/neutral/chunk-J7OTCRYF.mjs +12 -0
- package/dist/lib/neutral/chunk-J7OTCRYF.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-SZXFLBZL.mjs → chunk-XPUQE4Y7.mjs} +2 -2
- package/dist/lib/neutral/components/index.mjs +8 -5
- package/dist/lib/neutral/components/index.mjs.map +3 -3
- package/dist/lib/neutral/containers/index.mjs +1 -1
- package/dist/lib/neutral/{create-channel-UW2LSL4G.mjs → create-channel-4CA7P2M5.mjs} +2 -2
- package/dist/lib/neutral/{create-object-RLCOUVAW.mjs → create-object-O3TZ2MCJ.mjs} +3 -4
- package/dist/lib/neutral/{create-object-RLCOUVAW.mjs.map → create-object-O3TZ2MCJ.mjs.map} +3 -3
- package/dist/lib/neutral/hooks/index.mjs +2 -2
- package/dist/lib/neutral/index.mjs +7 -7
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/{navigation-resolver-4X4HCQYX.mjs → navigation-resolver-LSTZL32O.mjs} +7 -3
- package/dist/lib/neutral/navigation-resolver-LSTZL32O.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{react-surface-G6KT7TSU.mjs → react-surface-H2EKIMSK.mjs} +3 -2
- package/dist/lib/neutral/{react-surface-G6KT7TSU.mjs.map → react-surface-H2EKIMSK.mjs.map} +3 -3
- package/dist/lib/neutral/translations.mjs +1 -1
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +1 -1
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/channel-backend-feed.d.ts +1 -1
- package/dist/types/src/capabilities/channel-backend-feed.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +1 -7
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -10
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/navigation-resolver.d.ts +1 -2
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts +6 -6
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts +1 -1
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ThreadArticle/ThreadArticle.stories.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +32 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/paths.d.ts +1 -1
- package/dist/types/src/paths.d.ts.map +1 -1
- package/dist/types/src/types/ThreadCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/ThreadOperation.d.ts +4 -68
- package/dist/types/src/types/ThreadOperation.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +33 -0
- package/package.json +39 -33
- package/src/ThreadPlugin.test.ts +1 -1
- package/src/ThreadPlugin.tsx +3 -2
- package/src/capabilities/app-graph-builder.ts +43 -27
- package/src/capabilities/channel-backend-feed.ts +2 -3
- package/src/capabilities/create-object.ts +0 -1
- package/src/capabilities/navigation-resolver.ts +7 -5
- package/src/capabilities/react-surface.tsx +1 -1
- package/src/components/Chat/Chat.tsx +5 -5
- package/src/containers/ChannelArticle/ChannelArticle.stories.tsx +7 -5
- package/src/containers/ChannelArticle/ChannelArticle.tsx +72 -20
- package/src/containers/ThreadArticle/ThreadArticle.stories.tsx +3 -2
- package/src/meta.ts +3 -27
- package/src/paths.ts +6 -3
- package/src/translations.ts +1 -1
- package/src/types/ThreadCapabilities.ts +1 -1
- package/src/types/ThreadOperation.ts +7 -4
- package/dist/lib/neutral/ChannelArticle-H633OM3U.mjs +0 -57
- package/dist/lib/neutral/ChannelArticle-H633OM3U.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-OLKN3VTB.mjs +0 -50
- package/dist/lib/neutral/app-graph-builder-OLKN3VTB.mjs.map +0 -7
- package/dist/lib/neutral/channel-backend-feed-FCXGAIEC.mjs.map +0 -7
- package/dist/lib/neutral/chunk-AWAQTEU6.mjs +0 -10
- package/dist/lib/neutral/chunk-AWAQTEU6.mjs.map +0 -7
- package/dist/lib/neutral/chunk-OOC6EQ7X.mjs +0 -36
- package/dist/lib/neutral/chunk-OOC6EQ7X.mjs.map +0 -7
- package/dist/lib/neutral/navigation-resolver-4X4HCQYX.mjs.map +0 -7
- /package/dist/lib/neutral/{append-channel-message-J6DXDPBH.mjs.map → append-channel-message-YIIJY6GX.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-P4RSGFS4.mjs.map → chunk-GM3SGQMJ.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-SZXFLBZL.mjs.map → chunk-XPUQE4Y7.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-channel-UW2LSL4G.mjs.map → create-channel-4CA7P2M5.mjs.map} +0 -0
package/dx.config.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Config2 } from '@dxos/app-framework/config';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
7
|
+
|
|
8
|
+
export default Config2.make({
|
|
9
|
+
plugin: {
|
|
10
|
+
key: 'org.dxos.plugin.thread',
|
|
11
|
+
name: 'Threads',
|
|
12
|
+
author: 'DXOS',
|
|
13
|
+
description: trim`
|
|
14
|
+
ThreadPlugin provides chat: channels backed by an ECHO feed and free-standing
|
|
15
|
+
message threads. It renders the channel article and companion surfaces plus a
|
|
16
|
+
thread surface, and contributes the operations that create a default channel on
|
|
17
|
+
space creation, create new channels, and append messages.
|
|
18
|
+
|
|
19
|
+
Channel messages are stored in the channel's feed queue and rendered newest-last
|
|
20
|
+
with a pinned composer; externally-synced channels (carrying foreign-key
|
|
21
|
+
metadata, e.g. Slack/Discord-sourced rooms) render read-only because there is no
|
|
22
|
+
local-write path back to the source. Free-standing threads render their messages
|
|
23
|
+
and append by pushing onto the thread's message list.
|
|
24
|
+
|
|
25
|
+
The shared message and thread UI comes from @dxos/react-ui-thread; the Channel,
|
|
26
|
+
Message, and Thread schema come from @dxos/types. Document comments and the
|
|
27
|
+
comment-thread AI agent live in the @dxos/plugin-comments plugin.
|
|
28
|
+
`,
|
|
29
|
+
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-thread',
|
|
30
|
+
icon: { key: 'ph--video-conference--regular', hue: 'rose' },
|
|
31
|
+
spec: 'PLUGIN.mdl',
|
|
32
|
+
},
|
|
33
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-thread",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-staging.ee54ba693a",
|
|
4
4
|
"description": "DXOS Threads Surface plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -91,48 +91,54 @@
|
|
|
91
91
|
"types": "dist/types/src/index.d.ts",
|
|
92
92
|
"files": [
|
|
93
93
|
"dist",
|
|
94
|
+
"dx.config.ts",
|
|
94
95
|
"src",
|
|
95
96
|
"PLUGIN.mdl"
|
|
96
97
|
],
|
|
97
98
|
"dependencies": {
|
|
98
|
-
"@
|
|
99
|
-
"@dxos/app-toolkit": "0.9.
|
|
100
|
-
"@dxos/
|
|
101
|
-
"@dxos/
|
|
102
|
-
"@dxos/
|
|
103
|
-
"@dxos/
|
|
104
|
-
"@dxos/echo": "0.9.
|
|
105
|
-
"@dxos/
|
|
106
|
-
"@dxos/
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/
|
|
109
|
-
"@dxos/plugin-
|
|
110
|
-
"@dxos/
|
|
111
|
-
"@dxos/
|
|
112
|
-
"@dxos/
|
|
113
|
-
"@dxos/react-client": "0.9.
|
|
114
|
-
"@dxos/
|
|
115
|
-
"@dxos/
|
|
99
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
100
|
+
"@dxos/app-toolkit": "0.9.1-staging.ee54ba693a",
|
|
101
|
+
"@dxos/app-framework": "0.9.1-staging.ee54ba693a",
|
|
102
|
+
"@dxos/client-protocol": "0.9.1-staging.ee54ba693a",
|
|
103
|
+
"@dxos/client": "0.9.1-staging.ee54ba693a",
|
|
104
|
+
"@dxos/display-name": "0.9.1-staging.ee54ba693a",
|
|
105
|
+
"@dxos/echo": "0.9.1-staging.ee54ba693a",
|
|
106
|
+
"@dxos/compute": "0.9.1-staging.ee54ba693a",
|
|
107
|
+
"@dxos/invariant": "0.9.1-staging.ee54ba693a",
|
|
108
|
+
"@dxos/echo-client": "0.9.1-staging.ee54ba693a",
|
|
109
|
+
"@dxos/keys": "0.9.1-staging.ee54ba693a",
|
|
110
|
+
"@dxos/plugin-client": "0.9.1-staging.ee54ba693a",
|
|
111
|
+
"@dxos/plugin-graph": "0.9.1-staging.ee54ba693a",
|
|
112
|
+
"@dxos/random": "0.9.1-staging.ee54ba693a",
|
|
113
|
+
"@dxos/plugin-space": "0.9.1-staging.ee54ba693a",
|
|
114
|
+
"@dxos/react-client": "0.9.1-staging.ee54ba693a",
|
|
115
|
+
"@dxos/react-ui-thread": "0.9.1-staging.ee54ba693a",
|
|
116
|
+
"@dxos/types": "0.9.1-staging.ee54ba693a",
|
|
117
|
+
"@dxos/plugin-calls": "0.9.1-staging.ee54ba693a",
|
|
118
|
+
"@dxos/util": "0.9.1-staging.ee54ba693a"
|
|
116
119
|
},
|
|
117
120
|
"devDependencies": {
|
|
118
|
-
"@types/react": "~19.2.
|
|
121
|
+
"@types/react": "~19.2.17",
|
|
119
122
|
"@types/react-dom": "~19.2.3",
|
|
120
|
-
"effect": "3.21.
|
|
121
|
-
"react": "~19.2.
|
|
122
|
-
"react-dom": "~19.2.
|
|
123
|
+
"effect": "3.21.4",
|
|
124
|
+
"react": "~19.2.7",
|
|
125
|
+
"react-dom": "~19.2.7",
|
|
123
126
|
"vite": "^8.0.16",
|
|
124
|
-
"@dxos/
|
|
125
|
-
"@dxos/react-ui-
|
|
126
|
-
"@dxos/
|
|
127
|
-
"@dxos/ui-
|
|
127
|
+
"@dxos/plugin-testing": "0.9.1-staging.ee54ba693a",
|
|
128
|
+
"@dxos/react-ui-menu": "0.9.1-staging.ee54ba693a",
|
|
129
|
+
"@dxos/ui-theme": "0.9.1-staging.ee54ba693a",
|
|
130
|
+
"@dxos/react-ui-form": "0.9.1-staging.ee54ba693a",
|
|
131
|
+
"@dxos/react-ui": "0.9.1-staging.ee54ba693a"
|
|
128
132
|
},
|
|
129
133
|
"peerDependencies": {
|
|
130
|
-
"effect": "
|
|
131
|
-
"
|
|
132
|
-
"react
|
|
133
|
-
"
|
|
134
|
-
"@dxos/ui
|
|
135
|
-
"@dxos/
|
|
134
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
135
|
+
"effect": "3.21.4",
|
|
136
|
+
"react": "~19.2.7",
|
|
137
|
+
"react-dom": "~19.2.7",
|
|
138
|
+
"@dxos/react-ui": "0.9.1-staging.ee54ba693a",
|
|
139
|
+
"@dxos/ui-theme": "0.9.1-staging.ee54ba693a",
|
|
140
|
+
"@dxos/react-ui-menu": "0.9.1-staging.ee54ba693a",
|
|
141
|
+
"@dxos/react-ui-form": "0.9.1-staging.ee54ba693a"
|
|
136
142
|
},
|
|
137
143
|
"publishConfig": {
|
|
138
144
|
"access": "public"
|
package/src/ThreadPlugin.test.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { ThreadPlugin } from '#plugin';
|
|
|
11
11
|
|
|
12
12
|
import { meta } from './meta';
|
|
13
13
|
|
|
14
|
-
const moduleId = (name: string) => `${meta.
|
|
14
|
+
const moduleId = (name: string) => `${meta.profile.key}.module.${name}`;
|
|
15
15
|
|
|
16
16
|
describe('ThreadPlugin', () => {
|
|
17
17
|
test('modules activate on the expected events', async ({ expect }) => {
|
package/src/ThreadPlugin.tsx
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { ActivationEvents, Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
|
+
import { ClientEvents } from '@dxos/plugin-client';
|
|
7
8
|
import { translations as threadTranslations } from '@dxos/react-ui-thread/translations';
|
|
8
9
|
import { Channel, Message, Thread } from '@dxos/types';
|
|
9
10
|
|
|
@@ -25,7 +26,7 @@ import pluginSpec from '../PLUGIN.mdl?raw';
|
|
|
25
26
|
|
|
26
27
|
export const ThreadPlugin = Plugin.define(meta).pipe(
|
|
27
28
|
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
28
|
-
AppPlugin.addNavigationResolverModule({ activate: NavigationResolver }),
|
|
29
|
+
AppPlugin.addNavigationResolverModule({ activatesOn: ClientEvents.ClientReady, activate: NavigationResolver }),
|
|
29
30
|
AppPlugin.addCreateObjectModule({ activate: CreateObject }),
|
|
30
31
|
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
31
32
|
AppPlugin.addSchemaModule({
|
|
@@ -41,7 +42,7 @@ export const ThreadPlugin = Plugin.define(meta).pipe(
|
|
|
41
42
|
activate: ChannelBackendFeed,
|
|
42
43
|
}),
|
|
43
44
|
AppPlugin.addPluginAssetModule({
|
|
44
|
-
asset: { pluginId: meta.
|
|
45
|
+
asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },
|
|
45
46
|
}),
|
|
46
47
|
Plugin.make,
|
|
47
48
|
);
|
|
@@ -3,46 +3,62 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Option from 'effect/Option';
|
|
7
6
|
|
|
8
7
|
import { Capability } from '@dxos/app-framework';
|
|
9
|
-
import { AppCapabilities,
|
|
10
|
-
import { isSpace } from '@dxos/client/echo';
|
|
8
|
+
import { AppCapabilities, AppNode, AppNodeMatcher, Paths, TypeSection } from '@dxos/app-toolkit';
|
|
11
9
|
import { Operation } from '@dxos/compute';
|
|
12
|
-
import { Type } from '@dxos/echo';
|
|
13
|
-
import {
|
|
10
|
+
import { Obj, Type } from '@dxos/echo';
|
|
11
|
+
import { CallsCapabilities } from '@dxos/plugin-calls/types';
|
|
12
|
+
import { GraphBuilder } from '@dxos/plugin-graph';
|
|
14
13
|
import { SpaceOperation } from '@dxos/plugin-space';
|
|
15
14
|
import { Channel } from '@dxos/types';
|
|
15
|
+
import { Position } from '@dxos/util';
|
|
16
|
+
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
|
|
19
|
+
import { getChannelsPath } from '../paths';
|
|
16
20
|
|
|
17
21
|
const channelTypename = Type.getTypename(Channel.Channel);
|
|
18
22
|
|
|
19
23
|
export default Capability.makeModule(
|
|
20
24
|
Effect.fnUntraced(function* () {
|
|
25
|
+
const capabilities = yield* Capability.Service;
|
|
26
|
+
|
|
21
27
|
const extensions = yield* Effect.all([
|
|
22
|
-
createTypeSectionExtension(Channel.Channel
|
|
28
|
+
TypeSection.createTypeSectionExtension(Channel.Channel, {
|
|
29
|
+
match: AppNodeMatcher.whenNavTreeGroup(Paths.GroupTypes.communications),
|
|
30
|
+
createObject: (space) =>
|
|
31
|
+
Operation.invoke(SpaceOperation.OpenCreateObject, {
|
|
32
|
+
target: space.db,
|
|
33
|
+
typename: channelTypename,
|
|
34
|
+
targetNodeId: getChannelsPath(space.db.spaceId),
|
|
35
|
+
}),
|
|
36
|
+
}),
|
|
23
37
|
|
|
24
|
-
GraphBuilder.
|
|
25
|
-
id: '
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
GraphBuilder.createTypeExtension({
|
|
39
|
+
id: 'channelChatCompanion',
|
|
40
|
+
type: Channel.Channel,
|
|
41
|
+
connector: (channel, get) => {
|
|
42
|
+
const [callManager] = get(capabilities.atom(CallsCapabilities.Manager));
|
|
43
|
+
if (!callManager) {
|
|
44
|
+
return Effect.succeed([]);
|
|
45
|
+
}
|
|
46
|
+
const joined = get(callManager.joinedAtom);
|
|
47
|
+
const roomId = get(callManager.roomIdAtom);
|
|
48
|
+
if (!joined || roomId !== Obj.getURI(channel)) {
|
|
49
|
+
return Effect.succeed([]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return Effect.succeed([
|
|
53
|
+
AppNode.makeCompanion({
|
|
54
|
+
id: 'chat',
|
|
55
|
+
label: ['channel-companion.label', { ns: meta.profile.key }],
|
|
56
|
+
icon: 'ph--hash--regular',
|
|
57
|
+
data: 'chat',
|
|
58
|
+
position: Position.first,
|
|
44
59
|
}),
|
|
45
|
-
])
|
|
60
|
+
]);
|
|
61
|
+
},
|
|
46
62
|
}),
|
|
47
63
|
]);
|
|
48
64
|
|
|
@@ -6,8 +6,7 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
import * as Schema from 'effect/Schema';
|
|
7
7
|
|
|
8
8
|
import { Capability } from '@dxos/app-framework';
|
|
9
|
-
import { Feed, Filter, Obj, Query } from '@dxos/echo';
|
|
10
|
-
import { createFeedServiceLayer } from '@dxos/echo-client';
|
|
9
|
+
import { Database, Feed, Filter, Obj, Query } from '@dxos/echo';
|
|
11
10
|
import { invariant } from '@dxos/invariant';
|
|
12
11
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
13
12
|
import { Channel, Message } from '@dxos/types';
|
|
@@ -45,7 +44,7 @@ export const feedChannelBackend: ThreadCapabilities.ChannelBackendProvider = {
|
|
|
45
44
|
invariant(space, 'Space not found');
|
|
46
45
|
const feed = Channel.getFeed(channel);
|
|
47
46
|
invariant(feed, 'Channel is not feed-backed');
|
|
48
|
-
yield* Feed.append(feed, [message]).pipe(Effect.provide(
|
|
47
|
+
yield* Feed.append(feed, [message]).pipe(Effect.provide(Database.layer(space.db)));
|
|
49
48
|
}),
|
|
50
49
|
readOnly: (channel) => Obj.getMeta(channel).keys.length > 0,
|
|
51
50
|
};
|
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { AppCapabilities,
|
|
8
|
+
import { AppCapabilities, Paths, TypeSection } from '@dxos/app-toolkit';
|
|
9
9
|
import { Channel } from '@dxos/types';
|
|
10
10
|
|
|
11
11
|
export default Capability.makeModule(
|
|
12
12
|
Effect.fnUntraced(function* () {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
return [
|
|
14
|
+
Capability.contributes(
|
|
15
|
+
AppCapabilities.NavigationPathResolver,
|
|
16
|
+
TypeSection.createTypeSectionPathResolver(Channel.Channel, { groupId: Paths.GroupSegments.communications }),
|
|
17
|
+
),
|
|
18
|
+
];
|
|
17
19
|
}),
|
|
18
20
|
);
|
|
@@ -29,7 +29,7 @@ export default Capability.makeModule(() =>
|
|
|
29
29
|
AppSurface.literal(AppSurface.Article, 'chat'),
|
|
30
30
|
AppSurface.companion(AppSurface.Article, Channel.Channel),
|
|
31
31
|
),
|
|
32
|
-
component: ({ data: { companionTo: channel } }) => <ChannelArticle subject={channel} />,
|
|
32
|
+
component: ({ data: { companionTo: channel } }) => <ChannelArticle subject={channel} chatOnly />,
|
|
33
33
|
}),
|
|
34
34
|
// TODO(burdon): Disambiguate with Channel.
|
|
35
35
|
Surface.create({
|
|
@@ -9,7 +9,7 @@ import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
|
9
9
|
import { PublicKey } from '@dxos/react-client';
|
|
10
10
|
import { type SpaceMember } from '@dxos/react-client/echo';
|
|
11
11
|
import { type Identity } from '@dxos/react-client/halo';
|
|
12
|
-
import {
|
|
12
|
+
import { Card, type ThemedClassName, composable, useTranslation } from '@dxos/react-ui';
|
|
13
13
|
import { type ObjectTileComponent, Thread } from '@dxos/react-ui-thread';
|
|
14
14
|
import { type Message } from '@dxos/types';
|
|
15
15
|
import { hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';
|
|
@@ -54,8 +54,8 @@ export type ChatProps = ThemedClassName<{
|
|
|
54
54
|
* `ChannelArticle` and `ThreadArticle`.
|
|
55
55
|
*/
|
|
56
56
|
export const Chat = composable<HTMLDivElement, ChatProps>(
|
|
57
|
-
({ id, identity, members, messages, activity, onSend, autoFocus, current, readOnly }, forwardedRef) => {
|
|
58
|
-
const { t } = useTranslation(meta.
|
|
57
|
+
({ id, identity, members, messages, activity, onSend, autoFocus, current, readOnly, classNames }, forwardedRef) => {
|
|
58
|
+
const { t } = useTranslation(meta.profile.key);
|
|
59
59
|
|
|
60
60
|
const components = useMemo(() => ({ Object: ObjectTile }), []);
|
|
61
61
|
|
|
@@ -80,7 +80,7 @@ export const Chat = composable<HTMLDivElement, ChatProps>(
|
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
<Thread.Root getMetadata={getMetadata} components={components} identityDid={identity?.did} editable={false}>
|
|
83
|
-
<Thread.Content id={id} current={current} classNames='dx-container' ref={forwardedRef}>
|
|
83
|
+
<Thread.Content id={id} current={current} classNames={['dx-container', classNames]} ref={forwardedRef}>
|
|
84
84
|
<Thread.Messages messages={messages} />
|
|
85
85
|
{!readOnly && (
|
|
86
86
|
<>
|
|
@@ -109,7 +109,7 @@ const ObjectTile: ObjectTileComponent = ({ subject }) => {
|
|
|
109
109
|
return (
|
|
110
110
|
<Card.Root className={mx('grid col-span-3 py-1 pr-4', hoverableControls, hoverableFocusedWithinControls)}>
|
|
111
111
|
<Surface.Surface
|
|
112
|
-
type={AppSurface.
|
|
112
|
+
type={AppSurface.CardContent}
|
|
113
113
|
limit={1}
|
|
114
114
|
data={{ subject } satisfies AppSurface.ObjectCardData}
|
|
115
115
|
fallback={Fallback}
|
|
@@ -9,16 +9,17 @@ import React from 'react';
|
|
|
9
9
|
import { Capability } from '@dxos/app-framework';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
11
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
13
|
+
import { Database, Feed, Query } from '@dxos/echo';
|
|
14
14
|
import { invariant } from '@dxos/invariant';
|
|
15
|
+
import { CallsPlugin } from '@dxos/plugin-calls/plugin';
|
|
15
16
|
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
16
17
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
17
18
|
import { SpacePlugin } from '@dxos/plugin-space/testing';
|
|
18
19
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
19
20
|
import { Config } from '@dxos/react-client';
|
|
20
21
|
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
21
|
-
import { withLayout, withTheme
|
|
22
|
+
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
22
23
|
import { Channel, Message, Thread } from '@dxos/types';
|
|
23
24
|
|
|
24
25
|
import { translations } from '#translations';
|
|
@@ -80,11 +81,12 @@ const meta = {
|
|
|
80
81
|
blocks: [{ _tag: 'text', text: 'Messages are stored in the feed.' }],
|
|
81
82
|
}),
|
|
82
83
|
];
|
|
83
|
-
yield* Feed.append(feed, seed).pipe(Effect.provide(
|
|
84
|
+
yield* Feed.append(feed, seed).pipe(Effect.provide(Database.layer(personalSpace.db)));
|
|
84
85
|
}),
|
|
85
86
|
}),
|
|
86
87
|
SpacePlugin({}),
|
|
87
88
|
ThreadPlugin(),
|
|
89
|
+
CallsPlugin(),
|
|
88
90
|
],
|
|
89
91
|
}),
|
|
90
92
|
],
|
|
@@ -102,7 +104,7 @@ export const Default: Story = {
|
|
|
102
104
|
// Fixed room for testing.
|
|
103
105
|
subject: undefined,
|
|
104
106
|
attendableId: 'story',
|
|
105
|
-
role:
|
|
107
|
+
role: AppSurface.Article.role,
|
|
106
108
|
roomId: '04a1d1911703b8e929d0649021a965',
|
|
107
109
|
},
|
|
108
110
|
};
|
|
@@ -2,25 +2,35 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import React, { useCallback } from 'react';
|
|
6
7
|
|
|
7
|
-
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
-
import {
|
|
8
|
+
import { Surface, useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { CallsCapabilities } from '@dxos/plugin-calls/types';
|
|
10
12
|
import { getSpace, useMembers } from '@dxos/react-client/echo';
|
|
11
13
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
12
14
|
import { Panel } from '@dxos/react-ui';
|
|
15
|
+
import { Menu, MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';
|
|
13
16
|
import { type Channel } from '@dxos/types';
|
|
14
17
|
|
|
15
18
|
import { Chat } from '#components';
|
|
16
19
|
import { useMessages, useStatus } from '#hooks';
|
|
20
|
+
import { meta } from '#meta';
|
|
17
21
|
import { ThreadCapabilities, ThreadOperation, resolveProvider } from '#types';
|
|
18
22
|
|
|
23
|
+
// Stable fallbacks so `useAtomValue` always receives an atom when plugin-calls isn't present.
|
|
24
|
+
const NOT_JOINED = Atom.make(false);
|
|
25
|
+
const NO_ROOM = Atom.make<string | undefined>(undefined);
|
|
26
|
+
|
|
19
27
|
export type ChannelArticleProps = AppSurface.ObjectArticleProps<
|
|
20
28
|
Channel.Channel | undefined,
|
|
21
29
|
{
|
|
22
30
|
roomId?: string;
|
|
23
31
|
fullscreen?: boolean;
|
|
32
|
+
/** Always render the chat, even while in this channel's call (used by the in-call chat companion). */
|
|
33
|
+
chatOnly?: boolean;
|
|
24
34
|
}
|
|
25
35
|
>;
|
|
26
36
|
|
|
@@ -29,12 +39,10 @@ export type ChannelArticleProps = AppSurface.ObjectArticleProps<
|
|
|
29
39
|
* are read and written through the channel's backend provider (resolved by
|
|
30
40
|
* `channel.backend.kind`), so the container is agnostic to where messages are
|
|
31
41
|
* stored. Read-only state defaults to the provider's policy, or to "channel
|
|
32
|
-
* carries foreign-key `Obj.Meta`" when the provider has none.
|
|
33
|
-
*
|
|
34
|
-
* The "Start video call" action and the in-call surface are contributed by
|
|
35
|
-
* plugin-calls — this container is call-agnostic.
|
|
42
|
+
* carries foreign-key `Obj.Meta`" when the provider has none. When plugin-calls is present, a
|
|
43
|
+
* "Start video call" action switches the article to the call surface and the chat moves to a companion.
|
|
36
44
|
*/
|
|
37
|
-
export const ChannelArticle = ({ subject: channel }: ChannelArticleProps) => {
|
|
45
|
+
export const ChannelArticle = ({ role, subject: channel, attendableId, chatOnly }: ChannelArticleProps) => {
|
|
38
46
|
const identity = useIdentity();
|
|
39
47
|
const space = channel ? getSpace(channel) : undefined;
|
|
40
48
|
const members = useMembers(space?.id);
|
|
@@ -47,6 +55,36 @@ export const ChannelArticle = ({ subject: channel }: ChannelArticleProps) => {
|
|
|
47
55
|
const messages = useMessages(channel);
|
|
48
56
|
const readOnly = channel ? (provider?.readOnly?.(channel) ?? Obj.getMeta(channel).keys.length > 0) : false;
|
|
49
57
|
|
|
58
|
+
const callProvider = useCapabilities(CallsCapabilities.CallTransportProvider)[0];
|
|
59
|
+
const callManager = useCapabilities(CallsCapabilities.Manager)[0];
|
|
60
|
+
const joined = useAtomValue(callManager?.joinedAtom ?? NOT_JOINED);
|
|
61
|
+
const currentRoomId = useAtomValue(callManager?.roomIdAtom ?? NO_ROOM);
|
|
62
|
+
// `chatOnly` (the in-call chat companion) keeps showing messages so the call lives only in the primary.
|
|
63
|
+
const inThisCall = !!id && joined && currentRoomId === id;
|
|
64
|
+
const showCall = inThisCall && !chatOnly;
|
|
65
|
+
const canStartCall = !!callProvider && !inThisCall;
|
|
66
|
+
|
|
67
|
+
const handleStartCall = useCallback(async () => {
|
|
68
|
+
if (!callProvider || !id) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
await callProvider.join(id);
|
|
72
|
+
}, [callProvider, id]);
|
|
73
|
+
|
|
74
|
+
const menuActions = useMenuBuilder(() => {
|
|
75
|
+
const builder = MenuBuilder.make().root({ label: ['channel-toolbar.title', { ns: meta.profile.key }] });
|
|
76
|
+
if (canStartCall) {
|
|
77
|
+
builder.action(
|
|
78
|
+
'start-video-call',
|
|
79
|
+
{ label: ['start-video-call.menu', { ns: meta.profile.key }], icon: 'ph--video-camera--regular' },
|
|
80
|
+
() => {
|
|
81
|
+
void handleStartCall();
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return builder.build();
|
|
86
|
+
}, [canStartCall, handleStartCall]);
|
|
87
|
+
|
|
50
88
|
const handleSend = (text: string) => {
|
|
51
89
|
if (!channel || !identity || readOnly) {
|
|
52
90
|
return false;
|
|
@@ -66,18 +104,32 @@ export const ChannelArticle = ({ subject: channel }: ChannelArticleProps) => {
|
|
|
66
104
|
}
|
|
67
105
|
|
|
68
106
|
return (
|
|
69
|
-
<Panel.Root
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
107
|
+
<Panel.Root role={role}>
|
|
108
|
+
{canStartCall && (
|
|
109
|
+
<Menu.Root {...menuActions} attendableId={attendableId}>
|
|
110
|
+
<Panel.Toolbar asChild>
|
|
111
|
+
<Menu.Toolbar />
|
|
112
|
+
</Panel.Toolbar>
|
|
113
|
+
</Menu.Root>
|
|
114
|
+
)}
|
|
115
|
+
{showCall ? (
|
|
116
|
+
<Panel.Content>
|
|
117
|
+
<Surface.Surface type={AppSurface.Article} data={{ subject: { roomId: id }, attendableId }} limit={1} />
|
|
118
|
+
</Panel.Content>
|
|
119
|
+
) : (
|
|
120
|
+
<Panel.Content asChild>
|
|
121
|
+
<Chat
|
|
122
|
+
id={id}
|
|
123
|
+
classNames='dx-document'
|
|
124
|
+
identity={identity ?? undefined}
|
|
125
|
+
members={members}
|
|
126
|
+
messages={messages}
|
|
127
|
+
activity={activity}
|
|
128
|
+
onSend={handleSend}
|
|
129
|
+
readOnly={readOnly}
|
|
130
|
+
/>
|
|
131
|
+
</Panel.Content>
|
|
132
|
+
)}
|
|
81
133
|
</Panel.Root>
|
|
82
134
|
);
|
|
83
135
|
};
|
|
@@ -8,6 +8,7 @@ import React, { useState } from 'react';
|
|
|
8
8
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Surface } from '@dxos/app-framework/ui';
|
|
11
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
11
12
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
12
13
|
import { random } from '@dxos/random';
|
|
13
14
|
import { useClient } from '@dxos/react-client';
|
|
@@ -16,7 +17,7 @@ import { useIdentity } from '@dxos/react-client/halo';
|
|
|
16
17
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
17
18
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
18
19
|
import { Thread as ThreadComponent } from '@dxos/react-ui-thread';
|
|
19
|
-
import {
|
|
20
|
+
import { Loading, withLayout } from '@dxos/react-ui/testing';
|
|
20
21
|
import { Message, Thread } from '@dxos/types';
|
|
21
22
|
|
|
22
23
|
import { translations } from '#translations';
|
|
@@ -62,7 +63,7 @@ const meta = {
|
|
|
62
63
|
Capabilities.ReactSurface,
|
|
63
64
|
Surface.create({
|
|
64
65
|
id: 'test',
|
|
65
|
-
|
|
66
|
+
filter: Surface.makeFilter(AppSurface.CardContent),
|
|
66
67
|
component: ({ role }) => <span>{JSON.stringify({ role })}</span>,
|
|
67
68
|
}),
|
|
68
69
|
),
|
package/src/meta.ts
CHANGED
|
@@ -3,33 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Plugin } from '@dxos/app-framework';
|
|
6
|
-
import { DXN } from '@dxos/keys';
|
|
7
|
-
import { trim } from '@dxos/util';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
key: DXN.make('org.dxos.plugin.thread'),
|
|
11
|
-
name: 'Threads',
|
|
12
|
-
author: 'DXOS',
|
|
13
|
-
description: trim`
|
|
14
|
-
ThreadPlugin provides chat: channels backed by an ECHO feed and free-standing
|
|
15
|
-
message threads. It renders the channel article and companion surfaces plus a
|
|
16
|
-
thread surface, and contributes the operations that create a default channel on
|
|
17
|
-
space creation, create new channels, and append messages.
|
|
7
|
+
import config from '../dx.config';
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
with a pinned composer; externally-synced channels (carrying foreign-key
|
|
21
|
-
metadata, e.g. Slack/Discord-sourced rooms) render read-only because there is no
|
|
22
|
-
local-write path back to the source. Free-standing threads render their messages
|
|
23
|
-
and append by pushing onto the thread's message list.
|
|
9
|
+
export const meta = Plugin.getMetaFromConfig(config);
|
|
24
10
|
|
|
25
|
-
|
|
26
|
-
Message, and Thread schema come from @dxos/types. Document comments and the
|
|
27
|
-
comment-thread AI agent live in the @dxos/plugin-comments plugin.
|
|
28
|
-
`,
|
|
29
|
-
icon: 'ph--video-conference--regular',
|
|
30
|
-
iconHue: 'rose',
|
|
31
|
-
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-thread',
|
|
32
|
-
spec: 'PLUGIN.mdl',
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const THREAD_ITEM = `${meta.id}.item`;
|
|
11
|
+
export const THREAD_ITEM = `${meta.profile.key}.item`;
|
package/src/paths.ts
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Paths } from '@dxos/app-toolkit';
|
|
6
6
|
import { Channel } from '@dxos/types';
|
|
7
7
|
|
|
8
|
-
const { getSectionPath: getChannelsPath, getObjectPath: getChannelPath } = createTypeSectionPaths(
|
|
8
|
+
const { getSectionPath: getChannelsPath, getObjectPath: getChannelPath } = Paths.createTypeSectionPaths(
|
|
9
|
+
Channel.Channel,
|
|
10
|
+
{ groupId: Paths.GroupSegments.communications },
|
|
11
|
+
);
|
|
9
12
|
|
|
10
|
-
export {
|
|
13
|
+
export { getChannelPath, getChannelsPath };
|
package/src/translations.ts
CHANGED
|
@@ -23,7 +23,7 @@ export const translations = [
|
|
|
23
23
|
'delete-object.label': 'Delete channel',
|
|
24
24
|
'object-deleted.label': 'Channel deleted',
|
|
25
25
|
},
|
|
26
|
-
[meta.
|
|
26
|
+
[meta.profile.key]: {
|
|
27
27
|
'plugin.name': 'Chat',
|
|
28
28
|
'channel-title.label': 'Title',
|
|
29
29
|
'message.placeholder': 'Reply…',
|
|
@@ -44,4 +44,4 @@ export interface ChannelBackendProvider {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/** Registry of channel-message backends. Collect with `Capability.getAll`. */
|
|
47
|
-
export const ChannelBackend = Capability.make<ChannelBackendProvider>(`${meta.
|
|
47
|
+
export const ChannelBackend = Capability.make<ChannelBackendProvider>(`${meta.profile.key}.capability.channel-backend`);
|