@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.
Files changed (156) hide show
  1. package/dist/lib/browser/{app-graph-builder-WAS4YZNA.mjs → app-graph-builder-CBRN2DMK.mjs} +36 -32
  2. package/dist/lib/browser/app-graph-builder-CBRN2DMK.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-DCUIJY75.mjs +694 -0
  4. package/dist/lib/browser/chunk-DCUIJY75.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-IA3AVM4I.mjs +111 -0
  6. package/dist/lib/browser/chunk-IA3AVM4I.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-BGY6BSUC.mjs → chunk-PSSNS4C6.mjs} +2 -2
  8. package/dist/lib/{node-esm/chunk-K3KGGSJZ.mjs.map → browser/chunk-PSSNS4C6.mjs.map} +1 -1
  9. package/dist/lib/browser/{chunk-4PLF3BEB.mjs → chunk-UCVFWBKT.mjs} +2 -2
  10. package/dist/lib/{node-esm/chunk-BP56BGZR.mjs.map → browser/chunk-UCVFWBKT.mjs.map} +1 -1
  11. package/dist/lib/browser/{client-LV67Q3R7.mjs → client-NMS3MSFP.mjs} +5 -4
  12. package/dist/lib/browser/client-NMS3MSFP.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +12 -12
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/{intent-resolver-NCISOZW4.mjs → intent-resolver-KGM6A3BF.mjs} +14 -14
  16. package/dist/lib/browser/intent-resolver-KGM6A3BF.mjs.map +7 -0
  17. package/dist/lib/browser/meta.json +1 -1
  18. package/dist/lib/browser/migrations-QRQV6ZAM.mjs +23 -0
  19. package/dist/lib/browser/migrations-QRQV6ZAM.mjs.map +7 -0
  20. package/dist/lib/browser/{react-context-WEH7SL4I.mjs → react-context-IE2O2OYK.mjs} +2 -2
  21. package/dist/lib/browser/{react-surface-J7SZR2J6.mjs → react-surface-CKZHHWY3.mjs} +3 -3
  22. package/dist/lib/browser/schema-defs-DNRDVQQJ.mjs +25 -0
  23. package/dist/lib/browser/schema-defs-DNRDVQQJ.mjs.map +7 -0
  24. package/dist/lib/browser/types.mjs +1 -1
  25. package/dist/lib/node/{app-graph-builder-PXOJZJO5.cjs → app-graph-builder-BEEYM3A5.cjs} +45 -41
  26. package/dist/lib/node/app-graph-builder-BEEYM3A5.cjs.map +7 -0
  27. package/dist/lib/node/chunk-73HHNJMV.cjs +719 -0
  28. package/dist/lib/node/chunk-73HHNJMV.cjs.map +7 -0
  29. package/dist/lib/node/chunk-BL6EBWOS.cjs +131 -0
  30. package/dist/lib/node/chunk-BL6EBWOS.cjs.map +7 -0
  31. package/dist/lib/node/{chunk-ZVQIICEN.cjs → chunk-CIYUKY3J.cjs} +5 -5
  32. package/dist/lib/node/{chunk-ZVQIICEN.cjs.map → chunk-CIYUKY3J.cjs.map} +1 -1
  33. package/dist/lib/node/{chunk-W64EOF2B.cjs → chunk-DNKJCPU7.cjs} +5 -5
  34. package/dist/lib/node/{chunk-W64EOF2B.cjs.map → chunk-DNKJCPU7.cjs.map} +1 -1
  35. package/dist/lib/node/{client-BKTGRBYM.cjs → client-Q3EQS4HA.cjs} +10 -9
  36. package/dist/lib/node/client-Q3EQS4HA.cjs.map +7 -0
  37. package/dist/lib/node/index.cjs +19 -19
  38. package/dist/lib/node/index.cjs.map +3 -3
  39. package/dist/lib/node/{intent-resolver-U2576ALY.cjs → intent-resolver-Q4QBA5B2.cjs} +34 -34
  40. package/dist/lib/node/intent-resolver-Q4QBA5B2.cjs.map +7 -0
  41. package/dist/lib/node/meta.json +1 -1
  42. package/dist/lib/node/{migrations-TGNI4FVL.cjs → migrations-6FEWMF7U.cjs} +12 -10
  43. package/dist/lib/node/migrations-6FEWMF7U.cjs.map +7 -0
  44. package/dist/lib/node/{react-context-SF3M3YLR.cjs → react-context-JS7Y5ZOK.cjs} +6 -6
  45. package/dist/lib/node/{react-surface-BSTIXMER.cjs → react-surface-GHKLUOKW.cjs} +24 -24
  46. package/dist/lib/node/{schema-INQ72F54.cjs → schema-defs-TA52ARBO.cjs} +14 -12
  47. package/dist/lib/node/schema-defs-TA52ARBO.cjs.map +7 -0
  48. package/dist/lib/node/types.cjs +3 -3
  49. package/dist/lib/node/types.cjs.map +1 -1
  50. package/dist/lib/node-esm/{app-graph-builder-KIN6NWFI.mjs → app-graph-builder-OZEAAKNT.mjs} +36 -32
  51. package/dist/lib/node-esm/app-graph-builder-OZEAAKNT.mjs.map +7 -0
  52. package/dist/lib/node-esm/{chunk-K3KGGSJZ.mjs → chunk-37E3EI46.mjs} +2 -2
  53. package/dist/lib/{browser/chunk-BGY6BSUC.mjs.map → node-esm/chunk-37E3EI46.mjs.map} +1 -1
  54. package/dist/lib/node-esm/{chunk-BP56BGZR.mjs → chunk-FJYSQRBO.mjs} +2 -2
  55. package/dist/lib/{browser/chunk-4PLF3BEB.mjs.map → node-esm/chunk-FJYSQRBO.mjs.map} +1 -1
  56. package/dist/lib/node-esm/chunk-STGGUFV2.mjs +112 -0
  57. package/dist/lib/node-esm/chunk-STGGUFV2.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-ULXZABZ4.mjs +695 -0
  59. package/dist/lib/node-esm/chunk-ULXZABZ4.mjs.map +7 -0
  60. package/dist/lib/node-esm/{client-QQD6WFOB.mjs → client-EBFQZRSF.mjs} +5 -4
  61. package/dist/lib/node-esm/client-EBFQZRSF.mjs.map +7 -0
  62. package/dist/lib/node-esm/index.mjs +12 -12
  63. package/dist/lib/node-esm/index.mjs.map +3 -3
  64. package/dist/lib/node-esm/{intent-resolver-G25U4UGI.mjs → intent-resolver-2GCG4LCE.mjs} +14 -14
  65. package/dist/lib/node-esm/intent-resolver-2GCG4LCE.mjs.map +7 -0
  66. package/dist/lib/node-esm/meta.json +1 -1
  67. package/dist/lib/node-esm/{migrations-IVGATGZR.mjs → migrations-AK43ZE6G.mjs} +9 -7
  68. package/dist/lib/node-esm/migrations-AK43ZE6G.mjs.map +7 -0
  69. package/dist/lib/node-esm/{react-context-EAKKTE5A.mjs → react-context-6N7NMUJE.mjs} +2 -2
  70. package/dist/lib/node-esm/{react-surface-ZPI7T4EM.mjs → react-surface-UCUL26AF.mjs} +3 -3
  71. package/dist/lib/node-esm/schema-defs-O2KQQXJH.mjs +26 -0
  72. package/dist/lib/node-esm/schema-defs-O2KQQXJH.mjs.map +7 -0
  73. package/dist/lib/node-esm/types.mjs +1 -1
  74. package/dist/types/src/ClientPlugin.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
  76. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  77. package/dist/types/src/capabilities/client.d.ts +3 -3
  78. package/dist/types/src/capabilities/client.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/index.d.ts +5 -181
  80. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  81. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
  82. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  83. package/dist/types/src/capabilities/migrations.d.ts +2 -2
  84. package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/schema-defs.d.ts +4 -0
  87. package/dist/types/src/capabilities/schema-defs.d.ts.map +1 -0
  88. package/dist/types/src/components/DevicesContainer.d.ts +4 -3
  89. package/dist/types/src/components/DevicesContainer.d.ts.map +1 -1
  90. package/dist/types/src/components/DevicesContainer.stories.d.ts.map +1 -1
  91. package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
  92. package/dist/types/src/components/ProfileContainer.d.ts.map +1 -1
  93. package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
  94. package/dist/types/src/components/RecoveryCredentialsContainer.d.ts.map +1 -1
  95. package/dist/types/src/components/ResetDialog.d.ts.map +1 -1
  96. package/dist/types/src/components/ResetDialog.stories.d.ts.map +1 -1
  97. package/dist/types/src/types.d.ts +59 -53
  98. package/dist/types/src/types.d.ts.map +1 -1
  99. package/dist/types/tsconfig.tsbuildinfo +1 -1
  100. package/package.json +33 -26
  101. package/src/ClientPlugin.ts +2 -2
  102. package/src/capabilities/app-graph-builder.ts +94 -76
  103. package/src/capabilities/client.ts +4 -3
  104. package/src/capabilities/index.ts +1 -1
  105. package/src/capabilities/intent-resolver.ts +11 -11
  106. package/src/capabilities/migrations.ts +14 -11
  107. package/src/capabilities/schema-defs.ts +29 -0
  108. package/src/components/DevicesContainer.stories.tsx +7 -3
  109. package/src/components/DevicesContainer.tsx +85 -61
  110. package/src/components/ProfileContainer.stories.tsx +1 -1
  111. package/src/components/ProfileContainer.tsx +30 -21
  112. package/src/components/RecoveryCodeDialog.stories.tsx +1 -1
  113. package/src/components/RecoveryCredentialsContainer.stories.tsx +2 -2
  114. package/src/components/RecoveryCredentialsContainer.tsx +48 -46
  115. package/src/components/ResetDialog.stories.tsx +7 -1
  116. package/src/translations.ts +2 -2
  117. package/src/types.ts +60 -47
  118. package/dist/lib/browser/app-graph-builder-WAS4YZNA.mjs.map +0 -7
  119. package/dist/lib/browser/chunk-AN7FJKIJ.mjs +0 -105
  120. package/dist/lib/browser/chunk-AN7FJKIJ.mjs.map +0 -7
  121. package/dist/lib/browser/chunk-XZ4TQC56.mjs +0 -619
  122. package/dist/lib/browser/chunk-XZ4TQC56.mjs.map +0 -7
  123. package/dist/lib/browser/client-LV67Q3R7.mjs.map +0 -7
  124. package/dist/lib/browser/intent-resolver-NCISOZW4.mjs.map +0 -7
  125. package/dist/lib/browser/migrations-3DWFOL5Q.mjs +0 -21
  126. package/dist/lib/browser/migrations-3DWFOL5Q.mjs.map +0 -7
  127. package/dist/lib/browser/schema-JQAT6Q7S.mjs +0 -23
  128. package/dist/lib/browser/schema-JQAT6Q7S.mjs.map +0 -7
  129. package/dist/lib/node/app-graph-builder-PXOJZJO5.cjs.map +0 -7
  130. package/dist/lib/node/chunk-3JE5BFCT.cjs +0 -644
  131. package/dist/lib/node/chunk-3JE5BFCT.cjs.map +0 -7
  132. package/dist/lib/node/chunk-FROKBEVH.cjs +0 -125
  133. package/dist/lib/node/chunk-FROKBEVH.cjs.map +0 -7
  134. package/dist/lib/node/client-BKTGRBYM.cjs.map +0 -7
  135. package/dist/lib/node/intent-resolver-U2576ALY.cjs.map +0 -7
  136. package/dist/lib/node/migrations-TGNI4FVL.cjs.map +0 -7
  137. package/dist/lib/node/schema-INQ72F54.cjs.map +0 -7
  138. package/dist/lib/node-esm/app-graph-builder-KIN6NWFI.mjs.map +0 -7
  139. package/dist/lib/node-esm/chunk-AD5W5QCQ.mjs +0 -106
  140. package/dist/lib/node-esm/chunk-AD5W5QCQ.mjs.map +0 -7
  141. package/dist/lib/node-esm/chunk-LZN2UNN7.mjs +0 -620
  142. package/dist/lib/node-esm/chunk-LZN2UNN7.mjs.map +0 -7
  143. package/dist/lib/node-esm/client-QQD6WFOB.mjs.map +0 -7
  144. package/dist/lib/node-esm/intent-resolver-G25U4UGI.mjs.map +0 -7
  145. package/dist/lib/node-esm/migrations-IVGATGZR.mjs.map +0 -7
  146. package/dist/lib/node-esm/schema-OK7HY3JJ.mjs +0 -24
  147. package/dist/lib/node-esm/schema-OK7HY3JJ.mjs.map +0 -7
  148. package/dist/types/src/capabilities/schema.d.ts +0 -4
  149. package/dist/types/src/capabilities/schema.d.ts.map +0 -1
  150. package/src/capabilities/schema.ts +0 -26
  151. /package/dist/lib/browser/{react-context-WEH7SL4I.mjs.map → react-context-IE2O2OYK.mjs.map} +0 -0
  152. /package/dist/lib/browser/{react-surface-J7SZR2J6.mjs.map → react-surface-CKZHHWY3.mjs.map} +0 -0
  153. /package/dist/lib/node/{react-context-SF3M3YLR.cjs.map → react-context-JS7Y5ZOK.cjs.map} +0 -0
  154. /package/dist/lib/node/{react-surface-BSTIXMER.cjs.map → react-surface-GHKLUOKW.cjs.map} +0 -0
  155. /package/dist/lib/node-esm/{react-context-EAKKTE5A.mjs.map → react-context-6N7NMUJE.mjs.map} +0 -0
  156. /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 PluginsContext } from '@dxos/app-framework';
7
- import { createExtension, toSignal, type Node } from '@dxos/plugin-graph';
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: PluginsContext) =>
17
+ export default (context: PluginContext) =>
15
18
  contributes(
16
19
  Capabilities.AppGraphBuilder,
17
20
  createExtension({
18
21
  id: CLIENT_PLUGIN,
19
- filter: (node): node is Node<null> => node.id === 'root',
20
- actions: () => [
21
- {
22
- id: `${CLIENT_PLUGIN}/open-user-account`,
23
- data: async () => {
24
- const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
25
- await dispatch(createIntent(ClientAction.ShareIdentity));
26
- },
27
- properties: {
28
- label: ['open user account label', { ns: CLIENT_PLUGIN }],
29
- icon: 'ph--user--regular',
30
- keyBinding: {
31
- macos: 'meta+shift+.',
32
- // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
33
- windows: 'alt+shift+.',
34
- linux: 'alt+shift+>',
35
- },
36
- },
37
- },
38
- ],
39
- connector: () => {
40
- const client = context.requestCapability(ClientCapabilities.Client);
41
- const identity = client.halo.identity.get();
42
- const status = toSignal(
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
- id: Account.Devices,
73
- data: Account.Devices,
74
- type: CLIENT_PLUGIN,
75
- properties: {
76
- label: ['devices label', { ns: CLIENT_PLUGIN }],
77
- icon: 'ph--devices--regular',
78
- testId: 'clientPlugin.devices',
79
- },
80
- },
81
- {
82
- id: Account.Security,
83
- data: Account.Security,
84
- type: CLIENT_PLUGIN,
85
- properties: {
86
- label: ['security label', { ns: CLIENT_PLUGIN }],
87
- icon: 'ph--key--regular',
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 PluginsContext } from '@dxos/app-framework';
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: PluginsContext;
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 Schema = lazy(async () => import('./schema'));
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 PluginsContext,
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: PluginsContext;
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.requestCapability(Capabilities.PluginManager);
39
- const client = context.requestCapability(ClientCapabilities.Client);
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.requestCapability(ClientCapabilities.Client);
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.requestCapability(ClientCapabilities.Client);
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.requestCapability(ClientCapabilities.Client);
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.requestCapability(ClientCapabilities.Client);
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.requestCapability(ClientCapabilities.Client);
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 { effect } from '@preact/signals-core';
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: PluginsContext) => {
12
- const client = context.requestCapability(ClientCapabilities.Client);
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 unsubscribe = effect(() => {
16
- const migrations = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Migration).flat()));
17
- const spaces = client.spaces.get();
18
- void Promise.all(spaces.map((space) => space.db.runMigrations(migrations)));
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, () => unsubscribe());
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({ tooltips: true }),
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 { ControlFrame, ControlFrameItem, ControlGroup, ControlItem, ControlSection } from '@dxos/react-ui-form';
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 const DevicesContainer = ({
26
- createInvitationUrl,
27
- }: {
28
- createInvitationUrl: (invitationCode: string) => string;
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='p-2 block overflow-y-auto'>
50
- <ControlSection
51
- title={t('devices verbose label', { ns: CLIENT_PLUGIN })}
52
- description={t('devices description', { ns: CLIENT_PLUGIN })}
53
- >
54
- <ControlFrame>
55
- <ControlFrameItem title={t('devices label', { ns: CLIENT_PLUGIN })}>
56
- <List>
57
- {devices.map((device: Device) => {
58
- return (
59
- <DeviceListItem key={device.deviceKey.toHex()} device={device} connectionState={connectionState} />
60
- );
61
- })}
62
- </List>
63
- </ControlFrameItem>
64
- <ControlFrameItem title='Add device'>
65
- <DeviceInvitation createInvitationUrl={createInvitationUrl} />
66
- </ControlFrameItem>
67
- </ControlFrame>
68
- </ControlSection>
69
- <ControlSection
70
- title={t('danger zone title', { ns: CLIENT_PLUGIN })}
71
- description={t('danger zone description', { ns: CLIENT_PLUGIN })}
72
- >
73
- <ControlGroup>
74
- <ControlItem
75
- title={t('reset device label')}
76
- description={t('reset device description', { ns: CLIENT_PLUGIN })}
77
- >
78
- <Button variant='destructive' onClick={handleResetStorage} data-testid='devicesContainer.reset'>
79
- {t('reset device label')}
80
- </Button>
81
- </ControlItem>
82
- <ControlItem
83
- title={t('recover identity label')}
84
- description={t('recover identity description', { ns: CLIENT_PLUGIN })}
85
- >
86
- <Button variant='destructive' onClick={handleRecover} data-testid='devicesContainer.recover'>
87
- {t('recover identity label')}
88
- </Button>
89
- </ControlItem>
90
- <ControlItem
91
- title={t('join new identity label')}
92
- description={t('join new identity description', { ns: CLIENT_PLUGIN })}
93
- >
94
- <Button variant='destructive' onClick={handleJoinNewIdentity} data-testid='devicesContainer.joinExisting'>
95
- {t('join new identity label')}
96
- </Button>
97
- </ControlItem>
98
- </ControlGroup>
99
- </ControlSection>
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
- <Button variant='ghost' onClick={onCancel}>
245
- {t('cancel label')}
246
- </Button>
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({ tooltips: true })],
18
+ decorators: [withClientProvider({ createIdentity: true }), withTheme, withLayout()],
19
19
  parameters: {
20
20
  layout: 'fullscreen',
21
21
  translations,