@dxos/plugin-client 0.8.2-staging.7ac8446 → 0.8.2
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/browser/{app-graph-builder-WAS4YZNA.mjs → app-graph-builder-CBRN2DMK.mjs} +36 -32
- package/dist/lib/browser/app-graph-builder-CBRN2DMK.mjs.map +7 -0
- package/dist/lib/browser/chunk-DCUIJY75.mjs +694 -0
- package/dist/lib/browser/chunk-DCUIJY75.mjs.map +7 -0
- package/dist/lib/browser/chunk-IA3AVM4I.mjs +111 -0
- package/dist/lib/browser/chunk-IA3AVM4I.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BGY6BSUC.mjs → chunk-PSSNS4C6.mjs} +2 -2
- package/dist/lib/{node-esm/chunk-K3KGGSJZ.mjs.map → browser/chunk-PSSNS4C6.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-4PLF3BEB.mjs → chunk-UCVFWBKT.mjs} +2 -2
- package/dist/lib/{node-esm/chunk-BP56BGZR.mjs.map → browser/chunk-UCVFWBKT.mjs.map} +1 -1
- package/dist/lib/browser/{client-LV67Q3R7.mjs → client-NMS3MSFP.mjs} +5 -4
- package/dist/lib/browser/client-NMS3MSFP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +12 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-NCISOZW4.mjs → intent-resolver-KGM6A3BF.mjs} +14 -14
- package/dist/lib/browser/intent-resolver-KGM6A3BF.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/migrations-QRQV6ZAM.mjs +23 -0
- package/dist/lib/browser/migrations-QRQV6ZAM.mjs.map +7 -0
- package/dist/lib/browser/{react-context-WEH7SL4I.mjs → react-context-IE2O2OYK.mjs} +2 -2
- package/dist/lib/browser/{react-surface-J7SZR2J6.mjs → react-surface-CKZHHWY3.mjs} +3 -3
- package/dist/lib/browser/schema-defs-DNRDVQQJ.mjs +25 -0
- package/dist/lib/browser/schema-defs-DNRDVQQJ.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-PXOJZJO5.cjs → app-graph-builder-BEEYM3A5.cjs} +45 -41
- package/dist/lib/node/app-graph-builder-BEEYM3A5.cjs.map +7 -0
- package/dist/lib/node/chunk-73HHNJMV.cjs +719 -0
- package/dist/lib/node/chunk-73HHNJMV.cjs.map +7 -0
- package/dist/lib/node/chunk-BL6EBWOS.cjs +131 -0
- package/dist/lib/node/chunk-BL6EBWOS.cjs.map +7 -0
- package/dist/lib/node/{chunk-ZVQIICEN.cjs → chunk-CIYUKY3J.cjs} +5 -5
- package/dist/lib/node/{chunk-ZVQIICEN.cjs.map → chunk-CIYUKY3J.cjs.map} +1 -1
- package/dist/lib/node/{chunk-W64EOF2B.cjs → chunk-DNKJCPU7.cjs} +5 -5
- package/dist/lib/node/{chunk-W64EOF2B.cjs.map → chunk-DNKJCPU7.cjs.map} +1 -1
- package/dist/lib/node/{client-BKTGRBYM.cjs → client-Q3EQS4HA.cjs} +10 -9
- package/dist/lib/node/client-Q3EQS4HA.cjs.map +7 -0
- package/dist/lib/node/index.cjs +19 -19
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-U2576ALY.cjs → intent-resolver-Q4QBA5B2.cjs} +34 -34
- package/dist/lib/node/intent-resolver-Q4QBA5B2.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{migrations-TGNI4FVL.cjs → migrations-6FEWMF7U.cjs} +12 -10
- package/dist/lib/node/migrations-6FEWMF7U.cjs.map +7 -0
- package/dist/lib/node/{react-context-SF3M3YLR.cjs → react-context-JS7Y5ZOK.cjs} +6 -6
- package/dist/lib/node/{react-surface-BSTIXMER.cjs → react-surface-GHKLUOKW.cjs} +24 -24
- package/dist/lib/node/{schema-INQ72F54.cjs → schema-defs-TA52ARBO.cjs} +14 -12
- package/dist/lib/node/schema-defs-TA52ARBO.cjs.map +7 -0
- package/dist/lib/node/types.cjs +3 -3
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{app-graph-builder-KIN6NWFI.mjs → app-graph-builder-OZEAAKNT.mjs} +36 -32
- package/dist/lib/node-esm/app-graph-builder-OZEAAKNT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-K3KGGSJZ.mjs → chunk-37E3EI46.mjs} +2 -2
- package/dist/lib/{browser/chunk-BGY6BSUC.mjs.map → node-esm/chunk-37E3EI46.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-BP56BGZR.mjs → chunk-FJYSQRBO.mjs} +2 -2
- package/dist/lib/{browser/chunk-4PLF3BEB.mjs.map → node-esm/chunk-FJYSQRBO.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-STGGUFV2.mjs +112 -0
- package/dist/lib/node-esm/chunk-STGGUFV2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ULXZABZ4.mjs +695 -0
- package/dist/lib/node-esm/chunk-ULXZABZ4.mjs.map +7 -0
- package/dist/lib/node-esm/{client-QQD6WFOB.mjs → client-EBFQZRSF.mjs} +5 -4
- package/dist/lib/node-esm/client-EBFQZRSF.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +12 -12
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-G25U4UGI.mjs → intent-resolver-2GCG4LCE.mjs} +14 -14
- package/dist/lib/node-esm/intent-resolver-2GCG4LCE.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{migrations-IVGATGZR.mjs → migrations-AK43ZE6G.mjs} +9 -7
- package/dist/lib/node-esm/migrations-AK43ZE6G.mjs.map +7 -0
- package/dist/lib/node-esm/{react-context-EAKKTE5A.mjs → react-context-6N7NMUJE.mjs} +2 -2
- package/dist/lib/node-esm/{react-surface-ZPI7T4EM.mjs → react-surface-UCUL26AF.mjs} +3 -3
- package/dist/lib/node-esm/schema-defs-O2KQQXJH.mjs +26 -0
- package/dist/lib/node-esm/schema-defs-O2KQQXJH.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/client.d.ts +3 -3
- package/dist/types/src/capabilities/client.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -181
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/migrations.d.ts +2 -2
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/schema-defs.d.ts +4 -0
- package/dist/types/src/capabilities/schema-defs.d.ts.map +1 -0
- package/dist/types/src/components/DevicesContainer.d.ts +4 -3
- package/dist/types/src/components/DevicesContainer.d.ts.map +1 -1
- package/dist/types/src/components/DevicesContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/ProfileContainer.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCredentialsContainer.d.ts.map +1 -1
- package/dist/types/src/components/ResetDialog.d.ts.map +1 -1
- package/dist/types/src/components/ResetDialog.stories.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +59 -53
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -26
- package/src/ClientPlugin.ts +2 -2
- package/src/capabilities/app-graph-builder.ts +94 -76
- package/src/capabilities/client.ts +4 -3
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +11 -11
- package/src/capabilities/migrations.ts +14 -11
- package/src/capabilities/schema-defs.ts +29 -0
- package/src/components/DevicesContainer.stories.tsx +7 -3
- package/src/components/DevicesContainer.tsx +85 -61
- package/src/components/ProfileContainer.stories.tsx +1 -1
- package/src/components/ProfileContainer.tsx +30 -21
- package/src/components/RecoveryCodeDialog.stories.tsx +1 -1
- package/src/components/RecoveryCredentialsContainer.stories.tsx +2 -2
- package/src/components/RecoveryCredentialsContainer.tsx +48 -46
- package/src/components/ResetDialog.stories.tsx +7 -1
- package/src/translations.ts +2 -2
- package/src/types.ts +60 -47
- package/dist/lib/browser/app-graph-builder-WAS4YZNA.mjs.map +0 -7
- package/dist/lib/browser/chunk-AN7FJKIJ.mjs +0 -105
- package/dist/lib/browser/chunk-AN7FJKIJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XZ4TQC56.mjs +0 -619
- package/dist/lib/browser/chunk-XZ4TQC56.mjs.map +0 -7
- package/dist/lib/browser/client-LV67Q3R7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-NCISOZW4.mjs.map +0 -7
- package/dist/lib/browser/migrations-3DWFOL5Q.mjs +0 -21
- package/dist/lib/browser/migrations-3DWFOL5Q.mjs.map +0 -7
- package/dist/lib/browser/schema-JQAT6Q7S.mjs +0 -23
- package/dist/lib/browser/schema-JQAT6Q7S.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-PXOJZJO5.cjs.map +0 -7
- package/dist/lib/node/chunk-3JE5BFCT.cjs +0 -644
- package/dist/lib/node/chunk-3JE5BFCT.cjs.map +0 -7
- package/dist/lib/node/chunk-FROKBEVH.cjs +0 -125
- package/dist/lib/node/chunk-FROKBEVH.cjs.map +0 -7
- package/dist/lib/node/client-BKTGRBYM.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-U2576ALY.cjs.map +0 -7
- package/dist/lib/node/migrations-TGNI4FVL.cjs.map +0 -7
- package/dist/lib/node/schema-INQ72F54.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-KIN6NWFI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AD5W5QCQ.mjs +0 -106
- package/dist/lib/node-esm/chunk-AD5W5QCQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LZN2UNN7.mjs +0 -620
- package/dist/lib/node-esm/chunk-LZN2UNN7.mjs.map +0 -7
- package/dist/lib/node-esm/client-QQD6WFOB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-G25U4UGI.mjs.map +0 -7
- package/dist/lib/node-esm/migrations-IVGATGZR.mjs.map +0 -7
- package/dist/lib/node-esm/schema-OK7HY3JJ.mjs +0 -24
- package/dist/lib/node-esm/schema-OK7HY3JJ.mjs.map +0 -7
- package/dist/types/src/capabilities/schema.d.ts +0 -4
- package/dist/types/src/capabilities/schema.d.ts.map +0 -1
- package/src/capabilities/schema.ts +0 -26
- /package/dist/lib/browser/{react-context-WEH7SL4I.mjs.map → react-context-IE2O2OYK.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-J7SZR2J6.mjs.map → react-surface-CKZHHWY3.mjs.map} +0 -0
- /package/dist/lib/node/{react-context-SF3M3YLR.cjs.map → react-context-JS7Y5ZOK.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-BSTIXMER.cjs.map → react-surface-GHKLUOKW.cjs.map} +0 -0
- /package/dist/lib/node-esm/{react-context-EAKKTE5A.mjs.map → react-context-6N7NMUJE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-ZPI7T4EM.mjs.map → react-surface-UCUL26AF.mjs.map} +0 -0
|
@@ -2,94 +2,112 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
+
import { Option, pipe } from 'effect';
|
|
7
|
+
|
|
5
8
|
import { createIntent } from '@dxos/app-framework';
|
|
6
|
-
import { Capabilities, contributes, type
|
|
7
|
-
import { createExtension,
|
|
9
|
+
import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
|
|
10
|
+
import { createExtension, rxFromObservable, ROOT_ID } from '@dxos/plugin-graph';
|
|
8
11
|
import { ConnectionState } from '@dxos/react-client/mesh';
|
|
9
12
|
|
|
10
13
|
import { ClientCapabilities } from './capabilities';
|
|
11
14
|
import { CLIENT_PLUGIN } from '../meta';
|
|
12
15
|
import { Account, ClientAction } from '../types';
|
|
13
16
|
|
|
14
|
-
export default (context:
|
|
17
|
+
export default (context: PluginContext) =>
|
|
15
18
|
contributes(
|
|
16
19
|
Capabilities.AppGraphBuilder,
|
|
17
20
|
createExtension({
|
|
18
21
|
id: CLIENT_PLUGIN,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(onChange) => client.mesh.networkStatus.subscribe(() => onChange()).unsubscribe,
|
|
44
|
-
() => client.mesh.networkStatus.get(),
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
return [
|
|
48
|
-
{
|
|
49
|
-
id: Account.id,
|
|
50
|
-
type: CLIENT_PLUGIN,
|
|
51
|
-
properties: {
|
|
52
|
-
label: ['account label', { ns: CLIENT_PLUGIN }],
|
|
53
|
-
icon: 'ph--user--regular',
|
|
54
|
-
disposition: 'user-account',
|
|
55
|
-
// NOTE: This currently needs to be the identity key because the fallback is generated from hex.
|
|
56
|
-
userId: identity?.identityKey.toHex(),
|
|
57
|
-
hue: identity?.profile?.data?.hue,
|
|
58
|
-
emoji: identity?.profile?.data?.emoji,
|
|
59
|
-
status: status?.swarm === ConnectionState.OFFLINE ? 'error' : 'active',
|
|
60
|
-
},
|
|
61
|
-
nodes: [
|
|
62
|
-
{
|
|
63
|
-
id: Account.Profile,
|
|
64
|
-
data: Account.Profile,
|
|
65
|
-
type: CLIENT_PLUGIN,
|
|
66
|
-
properties: {
|
|
67
|
-
label: ['profile label', { ns: CLIENT_PLUGIN }],
|
|
68
|
-
icon: 'ph--user--regular',
|
|
22
|
+
actions: (node) =>
|
|
23
|
+
Rx.make((get) =>
|
|
24
|
+
pipe(
|
|
25
|
+
get(node),
|
|
26
|
+
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
27
|
+
Option.map(() => {
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
id: `${CLIENT_PLUGIN}/open-user-account`,
|
|
31
|
+
data: async () => {
|
|
32
|
+
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
33
|
+
await dispatch(createIntent(ClientAction.ShareIdentity));
|
|
34
|
+
},
|
|
35
|
+
properties: {
|
|
36
|
+
label: ['open user account label', { ns: CLIENT_PLUGIN }],
|
|
37
|
+
icon: 'ph--user--regular',
|
|
38
|
+
disposition: 'menu',
|
|
39
|
+
keyBinding: {
|
|
40
|
+
macos: 'meta+shift+.',
|
|
41
|
+
// TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
|
|
42
|
+
windows: 'alt+shift+.',
|
|
43
|
+
linux: 'alt+shift+>',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
69
46
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
47
|
+
];
|
|
48
|
+
}),
|
|
49
|
+
Option.getOrElse(() => []),
|
|
50
|
+
),
|
|
51
|
+
),
|
|
52
|
+
connector: (node) =>
|
|
53
|
+
Rx.make((get) =>
|
|
54
|
+
pipe(
|
|
55
|
+
get(node),
|
|
56
|
+
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
57
|
+
Option.map(() => {
|
|
58
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
59
|
+
const identity = get(rxFromObservable(client.halo.identity));
|
|
60
|
+
const status = get(rxFromObservable(client.mesh.networkStatus));
|
|
61
|
+
|
|
62
|
+
return [
|
|
63
|
+
{
|
|
64
|
+
id: Account.id,
|
|
65
|
+
type: CLIENT_PLUGIN,
|
|
66
|
+
properties: {
|
|
67
|
+
label: ['account label', { ns: CLIENT_PLUGIN }],
|
|
68
|
+
icon: 'ph--user--regular',
|
|
69
|
+
disposition: 'user-account',
|
|
70
|
+
// NOTE: This currently needs to be the identity key because the fallback is generated from hex.
|
|
71
|
+
userId: identity?.identityKey.toHex(),
|
|
72
|
+
hue: identity?.profile?.data?.hue,
|
|
73
|
+
emoji: identity?.profile?.data?.emoji,
|
|
74
|
+
status: status.swarm === ConnectionState.OFFLINE ? 'error' : 'active',
|
|
75
|
+
},
|
|
76
|
+
nodes: [
|
|
77
|
+
{
|
|
78
|
+
id: Account.Profile,
|
|
79
|
+
data: Account.Profile,
|
|
80
|
+
type: CLIENT_PLUGIN,
|
|
81
|
+
properties: {
|
|
82
|
+
label: ['profile label', { ns: CLIENT_PLUGIN }],
|
|
83
|
+
icon: 'ph--user--regular',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: Account.Devices,
|
|
88
|
+
data: Account.Devices,
|
|
89
|
+
type: CLIENT_PLUGIN,
|
|
90
|
+
properties: {
|
|
91
|
+
label: ['devices label', { ns: CLIENT_PLUGIN }],
|
|
92
|
+
icon: 'ph--devices--regular',
|
|
93
|
+
testId: 'clientPlugin.devices',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: Account.Security,
|
|
98
|
+
data: Account.Security,
|
|
99
|
+
type: CLIENT_PLUGIN,
|
|
100
|
+
properties: {
|
|
101
|
+
label: ['security label', { ns: CLIENT_PLUGIN }],
|
|
102
|
+
icon: 'ph--key--regular',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
88
106
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
];
|
|
108
|
+
}),
|
|
109
|
+
Option.getOrElse(() => []),
|
|
110
|
+
),
|
|
111
|
+
),
|
|
94
112
|
}),
|
|
95
113
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { contributes, type
|
|
5
|
+
import { contributes, type PluginContext } from '@dxos/app-framework';
|
|
6
6
|
import { Client } from '@dxos/react-client';
|
|
7
7
|
|
|
8
8
|
import { ClientCapabilities } from './capabilities';
|
|
@@ -10,10 +10,10 @@ import { ClientEvents } from '../events';
|
|
|
10
10
|
import { type ClientPluginOptions } from '../types';
|
|
11
11
|
|
|
12
12
|
type ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {
|
|
13
|
-
context:
|
|
13
|
+
context: PluginContext;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {
|
|
16
|
+
export default async ({ context, onClientInitialized, onSpacesReady, ...options }: ClientCapabilityOptions) => {
|
|
17
17
|
const client = new Client(options);
|
|
18
18
|
await client.initialize();
|
|
19
19
|
await onClientInitialized?.(context, client);
|
|
@@ -30,6 +30,7 @@ export default async ({ context, onClientInitialized, ...options }: ClientCapabi
|
|
|
30
30
|
const subscription = client.spaces.isReady.subscribe(async (ready) => {
|
|
31
31
|
if (ready) {
|
|
32
32
|
await context.activatePromise(ClientEvents.SpacesReady);
|
|
33
|
+
await onSpacesReady?.(context, client);
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
|
|
@@ -10,6 +10,6 @@ export const IntentResolver = lazy(async () => import('./intent-resolver'));
|
|
|
10
10
|
export const Migrations = lazy(async () => import('./migrations'));
|
|
11
11
|
export const ReactContext = lazy(async () => import('./react-context'));
|
|
12
12
|
export const ReactSurface = lazy(async () => import('./react-surface'));
|
|
13
|
-
export const
|
|
13
|
+
export const SchemaDefs = lazy(async () => import('./schema-defs'));
|
|
14
14
|
|
|
15
15
|
export * from './capabilities';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createIntent,
|
|
12
12
|
createResolver,
|
|
13
13
|
LayoutAction,
|
|
14
|
-
type
|
|
14
|
+
type PluginContext,
|
|
15
15
|
} from '@dxos/app-framework';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
@@ -24,7 +24,7 @@ import { ClientEvents } from '../events';
|
|
|
24
24
|
import { Account, ClientAction } from '../types';
|
|
25
25
|
|
|
26
26
|
type IntentResolverOptions = {
|
|
27
|
-
context:
|
|
27
|
+
context: PluginContext;
|
|
28
28
|
appName?: string;
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -34,10 +34,10 @@ export default ({ context, appName = 'Composer' }: IntentResolverOptions) =>
|
|
|
34
34
|
contributes(Capabilities.IntentResolver, [
|
|
35
35
|
createResolver({
|
|
36
36
|
intent: ClientAction.CreateIdentity,
|
|
37
|
-
resolve: async () => {
|
|
38
|
-
const manager = context.
|
|
39
|
-
const client = context.
|
|
40
|
-
const data = await client.halo.createIdentity();
|
|
37
|
+
resolve: async (profile) => {
|
|
38
|
+
const manager = context.getCapability(Capabilities.PluginManager);
|
|
39
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
40
|
+
const data = await client.halo.createIdentity(profile);
|
|
41
41
|
await manager.activate(ClientEvents.IdentityCreated);
|
|
42
42
|
return {
|
|
43
43
|
data,
|
|
@@ -132,7 +132,7 @@ export default ({ context, appName = 'Composer' }: IntentResolverOptions) =>
|
|
|
132
132
|
createResolver({
|
|
133
133
|
intent: ClientAction.CreateAgent,
|
|
134
134
|
resolve: async () => {
|
|
135
|
-
const client = context.
|
|
135
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
136
136
|
invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');
|
|
137
137
|
await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });
|
|
138
138
|
},
|
|
@@ -140,7 +140,7 @@ export default ({ context, appName = 'Composer' }: IntentResolverOptions) =>
|
|
|
140
140
|
createResolver({
|
|
141
141
|
intent: ClientAction.CreateRecoveryCode,
|
|
142
142
|
resolve: async () => {
|
|
143
|
-
const client = context.
|
|
143
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
144
144
|
invariant(client.services.services.IdentityService, 'IdentityService not available');
|
|
145
145
|
// TODO(wittjosiah): This needs a proper api.
|
|
146
146
|
const { recoveryCode } = await client.services.services.IdentityService.createRecoveryCredential({});
|
|
@@ -162,7 +162,7 @@ export default ({ context, appName = 'Composer' }: IntentResolverOptions) =>
|
|
|
162
162
|
createResolver({
|
|
163
163
|
intent: ClientAction.CreatePasskey,
|
|
164
164
|
resolve: async () => {
|
|
165
|
-
const client = context.
|
|
165
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
166
166
|
const identity = client.halo.identity.get();
|
|
167
167
|
invariant(identity, 'Identity not available');
|
|
168
168
|
|
|
@@ -207,7 +207,7 @@ export default ({ context, appName = 'Composer' }: IntentResolverOptions) =>
|
|
|
207
207
|
createResolver({
|
|
208
208
|
intent: ClientAction.RedeemPasskey,
|
|
209
209
|
resolve: async () => {
|
|
210
|
-
const client = context.
|
|
210
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
211
211
|
// TODO(wittjosiah): This needs a proper api.
|
|
212
212
|
invariant(client.services.services.IdentityService, 'IdentityService not available');
|
|
213
213
|
const { deviceKey, controlFeedKey, challenge } =
|
|
@@ -238,7 +238,7 @@ export default ({ context, appName = 'Composer' }: IntentResolverOptions) =>
|
|
|
238
238
|
createResolver({
|
|
239
239
|
intent: ClientAction.RedeemToken,
|
|
240
240
|
resolve: async (data) => {
|
|
241
|
-
const client = context.
|
|
241
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
242
242
|
// TODO(wittjosiah): This needs a proper api.
|
|
243
243
|
invariant(client.services.services.IdentityService, 'IdentityService not available');
|
|
244
244
|
await client.services.services.IdentityService.recoverIdentity(
|
|
@@ -2,21 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
|
|
5
|
+
import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
|
|
8
6
|
|
|
9
7
|
import { ClientCapabilities } from './capabilities';
|
|
10
8
|
|
|
11
|
-
export default (context:
|
|
12
|
-
const
|
|
9
|
+
export default (context: PluginContext) => {
|
|
10
|
+
const registry = context.getCapability(Capabilities.RxRegistry);
|
|
11
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
13
12
|
|
|
14
13
|
// NOTE: Migrations are currently unidirectional and idempotent.
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const cancel = registry.subscribe(
|
|
15
|
+
context.capabilities(ClientCapabilities.Migration),
|
|
16
|
+
(_migrations) => {
|
|
17
|
+
const migrations = Array.from(new Set(_migrations.flat()));
|
|
18
|
+
const spaces = client.spaces.get();
|
|
19
|
+
void Promise.all(spaces.map((space) => space.db.runMigrations(migrations)));
|
|
20
|
+
},
|
|
21
|
+
{ immediate: true },
|
|
22
|
+
);
|
|
20
23
|
|
|
21
|
-
return contributes(Capabilities.Null, null, () =>
|
|
24
|
+
return contributes(Capabilities.Null, null, () => cancel());
|
|
22
25
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
|
|
6
|
+
import { type TypedObject } from '@dxos/echo-schema';
|
|
7
|
+
|
|
8
|
+
import { ClientCapabilities } from './capabilities';
|
|
9
|
+
|
|
10
|
+
export default (context: PluginContext) => {
|
|
11
|
+
const registry = context.getCapability(Capabilities.RxRegistry);
|
|
12
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
13
|
+
|
|
14
|
+
// TODO(wittjosiah): Unregister schemas when they are disabled.
|
|
15
|
+
let previous: TypedObject[] = [];
|
|
16
|
+
const cancel = registry.subscribe(
|
|
17
|
+
context.capabilities(ClientCapabilities.Schema),
|
|
18
|
+
(_schemas) => {
|
|
19
|
+
const schemas = Array.from(new Set(_schemas.flat()));
|
|
20
|
+
// TODO(wittjosiah): Filter out schemas which the client has already registered.
|
|
21
|
+
const newSchemas = schemas.filter((schema) => !previous.includes(schema));
|
|
22
|
+
previous = schemas;
|
|
23
|
+
client.addTypes(newSchemas);
|
|
24
|
+
},
|
|
25
|
+
{ immediate: true },
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return contributes(Capabilities.Null, null, () => cancel());
|
|
29
|
+
};
|
|
@@ -21,16 +21,16 @@ const meta: Meta = {
|
|
|
21
21
|
decorators: [
|
|
22
22
|
withPluginManager({
|
|
23
23
|
plugins: [
|
|
24
|
-
IntentPlugin(),
|
|
25
24
|
ClientPlugin({
|
|
26
25
|
onClientInitialized: async (_, client) => {
|
|
27
26
|
await client.halo.createIdentity();
|
|
28
27
|
},
|
|
29
28
|
}),
|
|
29
|
+
IntentPlugin(),
|
|
30
30
|
],
|
|
31
31
|
}),
|
|
32
32
|
withTheme,
|
|
33
|
-
withLayout(
|
|
33
|
+
withLayout(),
|
|
34
34
|
],
|
|
35
35
|
parameters: {
|
|
36
36
|
layout: 'fullscreen',
|
|
@@ -42,4 +42,8 @@ export default meta;
|
|
|
42
42
|
|
|
43
43
|
type Story = StoryObj<typeof DevicesContainer>;
|
|
44
44
|
|
|
45
|
-
export const Default: Story = {
|
|
45
|
+
export const Default: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
createInvitationUrl: () => 'https://example.com',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -13,7 +13,14 @@ import { type Device, useDevices } from '@dxos/react-client/halo';
|
|
|
13
13
|
import { type CancellableInvitationObservable, Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
14
14
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
15
15
|
import { Button, Clipboard, IconButton, List, useId, useTranslation } from '@dxos/react-ui';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
ControlFrame,
|
|
18
|
+
ControlFrameItem,
|
|
19
|
+
ControlGroup,
|
|
20
|
+
ControlItem,
|
|
21
|
+
ControlPage,
|
|
22
|
+
ControlSection,
|
|
23
|
+
} from '@dxos/react-ui-form';
|
|
17
24
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
18
25
|
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
19
26
|
import { AuthCode, Centered, DeviceListItem, Emoji, Viewport } from '@dxos/shell/react';
|
|
@@ -22,11 +29,11 @@ import { hexToEmoji } from '@dxos/util';
|
|
|
22
29
|
import { CLIENT_PLUGIN } from '../meta';
|
|
23
30
|
import { ClientAction } from '../types';
|
|
24
31
|
|
|
25
|
-
export
|
|
26
|
-
createInvitationUrl
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}) => {
|
|
32
|
+
export type DevicesContainerProps = {
|
|
33
|
+
createInvitationUrl?: (invitationCode: string) => string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const DevicesContainer = ({ createInvitationUrl }: DevicesContainerProps) => {
|
|
30
37
|
const { t } = useTranslation('os');
|
|
31
38
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
32
39
|
const devices = useDevices();
|
|
@@ -46,57 +53,69 @@ export const DevicesContainer = ({
|
|
|
46
53
|
|
|
47
54
|
return (
|
|
48
55
|
<Clipboard.Provider>
|
|
49
|
-
<StackItem.Content classNames='
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
</
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
56
|
+
<StackItem.Content classNames='block overflow-y-auto'>
|
|
57
|
+
<ControlPage>
|
|
58
|
+
<ControlSection
|
|
59
|
+
title={t('devices verbose label', { ns: CLIENT_PLUGIN })}
|
|
60
|
+
description={t('devices description', { ns: CLIENT_PLUGIN })}
|
|
61
|
+
>
|
|
62
|
+
<ControlFrame>
|
|
63
|
+
<ControlFrameItem title={t('devices label', { ns: CLIENT_PLUGIN })}>
|
|
64
|
+
<List>
|
|
65
|
+
{devices.map((device: Device) => {
|
|
66
|
+
return (
|
|
67
|
+
<DeviceListItem
|
|
68
|
+
key={device.deviceKey.toHex()}
|
|
69
|
+
device={device}
|
|
70
|
+
connectionState={connectionState}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
})}
|
|
74
|
+
</List>
|
|
75
|
+
</ControlFrameItem>
|
|
76
|
+
{createInvitationUrl && (
|
|
77
|
+
<ControlFrameItem title='Add device'>
|
|
78
|
+
<DeviceInvitation createInvitationUrl={createInvitationUrl} />
|
|
79
|
+
</ControlFrameItem>
|
|
80
|
+
)}
|
|
81
|
+
</ControlFrame>
|
|
82
|
+
</ControlSection>
|
|
83
|
+
<ControlSection
|
|
84
|
+
title={t('danger zone title', { ns: CLIENT_PLUGIN })}
|
|
85
|
+
description={t('danger zone description', { ns: CLIENT_PLUGIN })}
|
|
86
|
+
>
|
|
87
|
+
<ControlGroup>
|
|
88
|
+
<ControlItem
|
|
89
|
+
title={t('reset device label')}
|
|
90
|
+
description={t('reset device description', { ns: CLIENT_PLUGIN })}
|
|
91
|
+
>
|
|
92
|
+
<Button variant='destructive' onClick={handleResetStorage} data-testid='devicesContainer.reset'>
|
|
93
|
+
{t('reset device label')}
|
|
94
|
+
</Button>
|
|
95
|
+
</ControlItem>
|
|
96
|
+
<ControlItem
|
|
97
|
+
title={t('recover identity label')}
|
|
98
|
+
description={t('recover identity description', { ns: CLIENT_PLUGIN })}
|
|
99
|
+
>
|
|
100
|
+
<Button variant='destructive' onClick={handleRecover} data-testid='devicesContainer.recover'>
|
|
101
|
+
{t('recover identity label')}
|
|
102
|
+
</Button>
|
|
103
|
+
</ControlItem>
|
|
104
|
+
<ControlItem
|
|
105
|
+
title={t('join new identity label')}
|
|
106
|
+
description={t('join new identity description', { ns: CLIENT_PLUGIN })}
|
|
107
|
+
>
|
|
108
|
+
<Button
|
|
109
|
+
variant='destructive'
|
|
110
|
+
onClick={handleJoinNewIdentity}
|
|
111
|
+
data-testid='devicesContainer.joinExisting'
|
|
112
|
+
>
|
|
113
|
+
{t('join new identity label')}
|
|
114
|
+
</Button>
|
|
115
|
+
</ControlItem>
|
|
116
|
+
</ControlGroup>
|
|
117
|
+
</ControlSection>
|
|
118
|
+
</ControlPage>
|
|
100
119
|
</StackItem.Content>
|
|
101
120
|
</Clipboard.Provider>
|
|
102
121
|
);
|
|
@@ -239,11 +258,16 @@ const InvitationQR = ({ id, url, onCancel }: { id: string; url: string; onCancel
|
|
|
239
258
|
<span id={qrLabel} className='sr-only'>
|
|
240
259
|
{t('qr label')}
|
|
241
260
|
</span>
|
|
242
|
-
<Clipboard.Button value={url ?? 'never'} />
|
|
243
261
|
</div>
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
262
|
+
{/* TODO(burdon): Factor out button bar */}
|
|
263
|
+
<div className='flex justify-center'>
|
|
264
|
+
<div className='flex gap-2'>
|
|
265
|
+
<Clipboard.Button value={url ?? 'never'} />
|
|
266
|
+
<Button variant='ghost' onClick={onCancel}>
|
|
267
|
+
{t('cancel label')}
|
|
268
|
+
</Button>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
247
271
|
</>
|
|
248
272
|
);
|
|
249
273
|
};
|
|
@@ -15,7 +15,7 @@ import translations from '../translations';
|
|
|
15
15
|
const meta: Meta = {
|
|
16
16
|
title: 'plugins/plugin-client/ProfileContainer',
|
|
17
17
|
component: ProfileContainer,
|
|
18
|
-
decorators: [withClientProvider({ createIdentity: true }), withTheme, withLayout(
|
|
18
|
+
decorators: [withClientProvider({ createIdentity: true }), withTheme, withLayout()],
|
|
19
19
|
parameters: {
|
|
20
20
|
layout: 'fullscreen',
|
|
21
21
|
translations,
|