@dxos/plugin-client 0.7.5-labs.a279d8c → 0.7.5-labs.e27f9b9

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 (96) hide show
  1. package/dist/lib/browser/{chunk-SVBQRT7I.mjs → chunk-MSK3TLIH.mjs} +1 -1
  2. package/dist/lib/browser/{chunk-SVBQRT7I.mjs.map → chunk-MSK3TLIH.mjs.map} +2 -2
  3. package/dist/lib/browser/{chunk-6IF6PREG.mjs → chunk-PDSHZE3P.mjs} +11 -7
  4. package/dist/lib/browser/chunk-PDSHZE3P.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-R4Q6H7RD.mjs → chunk-RGMLBYIF.mjs} +2 -2
  6. package/dist/lib/browser/{chunk-R4Q6H7RD.mjs.map → chunk-RGMLBYIF.mjs.map} +2 -2
  7. package/dist/lib/browser/{client-25GYH6TN.mjs → client-BEJK55IM.mjs} +3 -7
  8. package/dist/lib/browser/client-BEJK55IM.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +18 -12
  10. package/dist/lib/browser/index.mjs.map +3 -3
  11. package/dist/lib/browser/intent-resolver-E6TL7E24.mjs +159 -0
  12. package/dist/lib/browser/intent-resolver-E6TL7E24.mjs.map +7 -0
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{react-context-M3RT6SSG.mjs → react-context-PHX2CVI7.mjs} +2 -2
  15. package/dist/lib/browser/{react-surface-XXONPG5T.mjs → react-surface-K5NKVCIB.mjs} +5 -5
  16. package/dist/lib/browser/react-surface-K5NKVCIB.mjs.map +7 -0
  17. package/dist/lib/browser/schema-AL34NY2M.mjs +33 -0
  18. package/dist/lib/browser/schema-AL34NY2M.mjs.map +7 -0
  19. package/dist/lib/node/{chunk-N3U7KVO3.cjs → chunk-VUJ3ZPK3.cjs} +14 -10
  20. package/dist/lib/node/chunk-VUJ3ZPK3.cjs.map +7 -0
  21. package/dist/lib/node/{chunk-IXVWJCYB.cjs → chunk-XPC4JOPP.cjs} +5 -5
  22. package/dist/lib/node/{chunk-IXVWJCYB.cjs.map → chunk-XPC4JOPP.cjs.map} +2 -2
  23. package/dist/lib/node/{chunk-3OB25QN2.cjs → chunk-ZI7AV5RP.cjs} +4 -4
  24. package/dist/lib/node/{chunk-3OB25QN2.cjs.map → chunk-ZI7AV5RP.cjs.map} +2 -2
  25. package/dist/lib/node/{client-52L4TUYU.cjs → client-AHIW24VM.cjs} +8 -12
  26. package/dist/lib/node/client-AHIW24VM.cjs.map +7 -0
  27. package/dist/lib/node/index.cjs +20 -14
  28. package/dist/lib/node/index.cjs.map +3 -3
  29. package/dist/lib/node/intent-resolver-DUPICQ3F.cjs +167 -0
  30. package/dist/lib/node/intent-resolver-DUPICQ3F.cjs.map +7 -0
  31. package/dist/lib/node/meta.json +1 -1
  32. package/dist/lib/node/{react-context-B2DNULH4.cjs → react-context-WMOFXPT4.cjs} +6 -6
  33. package/dist/lib/node/{react-surface-7USN5NOO.cjs → react-surface-YQ2PKXNV.cjs} +15 -15
  34. package/dist/lib/node/react-surface-YQ2PKXNV.cjs.map +7 -0
  35. package/dist/lib/node/schema-HW4W3QYU.cjs +49 -0
  36. package/dist/lib/node/schema-HW4W3QYU.cjs.map +7 -0
  37. package/dist/lib/node-esm/{chunk-OBGRL3DF.mjs → chunk-B73LKPGU.mjs} +1 -1
  38. package/dist/lib/node-esm/{chunk-OBGRL3DF.mjs.map → chunk-B73LKPGU.mjs.map} +2 -2
  39. package/dist/lib/node-esm/{chunk-73M5MK5Q.mjs → chunk-QR72BXJK.mjs} +2 -2
  40. package/dist/lib/node-esm/{chunk-73M5MK5Q.mjs.map → chunk-QR72BXJK.mjs.map} +2 -2
  41. package/dist/lib/node-esm/{chunk-EHGD3UJH.mjs → chunk-WS4CKCUR.mjs} +11 -7
  42. package/dist/lib/node-esm/chunk-WS4CKCUR.mjs.map +7 -0
  43. package/dist/lib/node-esm/{client-K52NWOUN.mjs → client-FY7IDNRL.mjs} +3 -7
  44. package/dist/lib/node-esm/client-FY7IDNRL.mjs.map +7 -0
  45. package/dist/lib/node-esm/index.mjs +18 -12
  46. package/dist/lib/node-esm/index.mjs.map +3 -3
  47. package/dist/lib/node-esm/intent-resolver-QUQH2LS2.mjs +160 -0
  48. package/dist/lib/node-esm/intent-resolver-QUQH2LS2.mjs.map +7 -0
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/{react-context-IGEHJQK5.mjs → react-context-EEGDXBWA.mjs} +2 -2
  51. package/dist/lib/node-esm/{react-surface-CXLBCMPN.mjs → react-surface-H34XQPWC.mjs} +5 -5
  52. package/dist/lib/node-esm/react-surface-H34XQPWC.mjs.map +7 -0
  53. package/dist/lib/node-esm/schema-74LVJ3EU.mjs +34 -0
  54. package/dist/lib/node-esm/schema-74LVJ3EU.mjs.map +7 -0
  55. package/dist/types/src/ClientPlugin.d.ts.map +1 -1
  56. package/dist/types/src/capabilities/app-graph-builder.d.ts +22 -22
  57. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  58. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  59. package/dist/types/src/capabilities/client.d.ts.map +1 -1
  60. package/dist/types/src/capabilities/index.d.ts +30 -29
  61. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  62. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  63. package/dist/types/src/capabilities/schema.d.ts +4 -0
  64. package/dist/types/src/capabilities/schema.d.ts.map +1 -0
  65. package/dist/types/src/events.d.ts +1 -1
  66. package/dist/types/tsconfig.tsbuildinfo +1 -1
  67. package/package.json +17 -16
  68. package/src/ClientPlugin.ts +10 -5
  69. package/src/capabilities/capabilities.ts +1 -0
  70. package/src/capabilities/client.ts +0 -6
  71. package/src/capabilities/index.ts +1 -0
  72. package/src/capabilities/intent-resolver.ts +95 -66
  73. package/src/capabilities/react-surface.tsx +6 -6
  74. package/src/capabilities/schema.ts +36 -0
  75. package/src/components/IdentityDialog.tsx +3 -3
  76. package/src/components/JoinDialog.tsx +1 -1
  77. package/src/components/RecoveryCodeDialog.stories.tsx +2 -2
  78. package/src/events.ts +1 -1
  79. package/dist/lib/browser/chunk-6IF6PREG.mjs.map +0 -7
  80. package/dist/lib/browser/client-25GYH6TN.mjs.map +0 -7
  81. package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs +0 -132
  82. package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs.map +0 -7
  83. package/dist/lib/browser/react-surface-XXONPG5T.mjs.map +0 -7
  84. package/dist/lib/node/chunk-N3U7KVO3.cjs.map +0 -7
  85. package/dist/lib/node/client-52L4TUYU.cjs.map +0 -7
  86. package/dist/lib/node/intent-resolver-H3Y64MIP.cjs +0 -140
  87. package/dist/lib/node/intent-resolver-H3Y64MIP.cjs.map +0 -7
  88. package/dist/lib/node/react-surface-7USN5NOO.cjs.map +0 -7
  89. package/dist/lib/node-esm/chunk-EHGD3UJH.mjs.map +0 -7
  90. package/dist/lib/node-esm/client-K52NWOUN.mjs.map +0 -7
  91. package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs +0 -133
  92. package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs.map +0 -7
  93. package/dist/lib/node-esm/react-surface-CXLBCMPN.mjs.map +0 -7
  94. /package/dist/lib/browser/{react-context-M3RT6SSG.mjs.map → react-context-PHX2CVI7.mjs.map} +0 -0
  95. /package/dist/lib/node/{react-context-B2DNULH4.cjs.map → react-context-WMOFXPT4.cjs.map} +0 -0
  96. /package/dist/lib/node-esm/{react-context-IGEHJQK5.mjs.map → react-context-EEGDXBWA.mjs.map} +0 -0
@@ -9,5 +9,6 @@ export const Client = lazy(async () => import('./client'));
9
9
  export const IntentResolver = lazy(async () => import('./intent-resolver'));
10
10
  export const ReactContext = lazy(async () => import('./react-context'));
11
11
  export const ReactSurface = lazy(async () => import('./react-surface'));
12
+ export const Schema = lazy(async () => import('./schema'));
12
13
 
13
14
  export * from './capabilities';
@@ -25,77 +25,106 @@ type IntentResolverOptions = Pick<ClientPluginOptions, 'onReset'> & {
25
25
 
26
26
  export default ({ context, onReset }: IntentResolverOptions) =>
27
27
  contributes(Capabilities.IntentResolver, [
28
- createResolver(ClientAction.CreateIdentity, async () => {
29
- const manager = context.requestCapability(Capabilities.PluginManager);
30
- const client = context.requestCapability(ClientCapabilities.Client);
31
- const data = await client.halo.createIdentity();
32
- await manager.activate(ClientEvents.IdentityCreated);
33
- return { data, intents: [createIntent(ObservabilityAction.SendEvent, { name: 'identity.create' })] };
28
+ createResolver({
29
+ intent: ClientAction.CreateIdentity,
30
+ resolve: async () => {
31
+ const manager = context.requestCapability(Capabilities.PluginManager);
32
+ const client = context.requestCapability(ClientCapabilities.Client);
33
+ const data = await client.halo.createIdentity();
34
+ await manager.activate(ClientEvents.IdentityCreated);
35
+ return { data, intents: [createIntent(ObservabilityAction.SendEvent, { name: 'identity.create' })] };
36
+ },
34
37
  }),
35
- createResolver(ClientAction.JoinIdentity, async (data) => {
36
- return {
37
- intents: [
38
- createIntent(LayoutAction.SetLayout, {
39
- element: 'dialog',
40
- component: JOIN_DIALOG,
41
- dialogBlockAlign: 'start',
42
- subject: {
43
- initialInvitationCode: data.invitationCode,
44
- initialDisposition: 'accept-halo-invitation',
45
- } satisfies Partial<JoinPanelProps>,
46
- }),
47
- ],
48
- };
38
+ createResolver({
39
+ intent: ClientAction.JoinIdentity,
40
+ resolve: async (data) => {
41
+ return {
42
+ intents: [
43
+ createIntent(LayoutAction.UpdateDialog, {
44
+ part: 'dialog',
45
+ subject: JOIN_DIALOG,
46
+ options: {
47
+ blockAlign: 'start',
48
+ props: {
49
+ initialInvitationCode: data.invitationCode,
50
+ initialDisposition: 'accept-halo-invitation',
51
+ },
52
+ },
53
+ }),
54
+ ],
55
+ };
56
+ },
49
57
  }),
50
- createResolver(ClientAction.ShareIdentity, async () => {
51
- return {
52
- intents: [
53
- createIntent(LayoutAction.SetLayout, {
54
- element: 'dialog',
55
- component: IDENTITY_DIALOG,
56
- dialogBlockAlign: 'start',
57
- }),
58
- createIntent(ObservabilityAction.SendEvent, { name: 'identity.share' }),
59
- ],
60
- };
58
+ createResolver({
59
+ intent: ClientAction.ShareIdentity,
60
+ resolve: async () => {
61
+ return {
62
+ intents: [
63
+ createIntent(LayoutAction.UpdateDialog, {
64
+ part: 'dialog',
65
+ subject: IDENTITY_DIALOG,
66
+ options: {
67
+ blockAlign: 'start',
68
+ },
69
+ }),
70
+ createIntent(ObservabilityAction.SendEvent, { name: 'identity.share' }),
71
+ ],
72
+ };
73
+ },
61
74
  }),
62
- createResolver(ClientAction.RecoverIdentity, async () => {
63
- return {
64
- intents: [
65
- createIntent(LayoutAction.SetLayout, {
66
- element: 'dialog',
67
- component: JOIN_DIALOG,
68
- dialogBlockAlign: 'start',
69
- subject: { initialDisposition: 'recover-identity' } satisfies Partial<JoinPanelProps>,
70
- }),
71
- ],
72
- };
75
+ createResolver({
76
+ intent: ClientAction.RecoverIdentity,
77
+ resolve: async () => {
78
+ return {
79
+ intents: [
80
+ createIntent(LayoutAction.UpdateDialog, {
81
+ part: 'dialog',
82
+ subject: JOIN_DIALOG,
83
+ options: {
84
+ blockAlign: 'start',
85
+ props: {
86
+ initialDisposition: 'recover-identity',
87
+ } satisfies Partial<JoinPanelProps>,
88
+ },
89
+ }),
90
+ ],
91
+ };
92
+ },
73
93
  }),
74
- createResolver(ClientAction.ResetStorage, async (data) => {
75
- await onReset?.({ target: data.target });
76
- return {};
94
+ createResolver({
95
+ intent: ClientAction.ResetStorage,
96
+ resolve: async (data) => {
97
+ await onReset?.({ target: data.target });
98
+ },
77
99
  }),
78
- createResolver(ClientAction.CreateAgent, async () => {
79
- const client = context.requestCapability(ClientCapabilities.Client);
80
- invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');
81
- await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });
100
+ createResolver({
101
+ intent: ClientAction.CreateAgent,
102
+ resolve: async () => {
103
+ const client = context.requestCapability(ClientCapabilities.Client);
104
+ invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');
105
+ await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });
106
+ },
82
107
  }),
83
- createResolver(ClientAction.CreateRecoveryCode, async () => {
84
- const client = context.requestCapability(ClientCapabilities.Client);
85
- invariant(client.services.services.IdentityService, 'IdentityService not available');
86
- // TODO(wittjosiah): This needs a proper api. Rename property.
87
- const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
88
- return {
89
- intents: [
90
- createIntent(LayoutAction.SetLayout, {
91
- element: 'dialog',
92
- dialogBlockAlign: 'start',
93
- dialogType: 'alert',
94
- state: true,
95
- component: RECOVER_CODE_DIALOG,
96
- subject: { code: seedphrase },
97
- }),
98
- ],
99
- };
108
+ createResolver({
109
+ intent: ClientAction.CreateRecoveryCode,
110
+ resolve: async () => {
111
+ const client = context.requestCapability(ClientCapabilities.Client);
112
+ invariant(client.services.services.IdentityService, 'IdentityService not available');
113
+ // TODO(wittjosiah): This needs a proper api.
114
+ const { recoveryCode } = await client.services.services.IdentityService.createRecoveryCredential({});
115
+ return {
116
+ intents: [
117
+ createIntent(LayoutAction.UpdateDialog, {
118
+ part: 'dialog',
119
+ subject: RECOVER_CODE_DIALOG,
120
+ options: {
121
+ blockAlign: 'start',
122
+ type: 'alert',
123
+ props: { code: recoveryCode },
124
+ },
125
+ }),
126
+ ],
127
+ };
128
+ },
100
129
  }),
101
130
  ]);
@@ -26,19 +26,19 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
26
26
  createSurface({
27
27
  id: IDENTITY_DIALOG,
28
28
  role: 'dialog',
29
- filter: (data): data is { subject: IdentityPanelProps } => data.component === IDENTITY_DIALOG,
30
- component: ({ data }) => <IdentityDialog {...data.subject} createInvitationUrl={createInvitationUrl} />,
29
+ filter: (data): data is { props: IdentityPanelProps } => data.component === IDENTITY_DIALOG,
30
+ component: ({ data }) => <IdentityDialog {...data.props} createInvitationUrl={createInvitationUrl} />,
31
31
  }),
32
32
  createSurface({
33
33
  id: JOIN_DIALOG,
34
34
  role: 'dialog',
35
- filter: (data): data is { subject: JoinPanelProps } => data.component === JOIN_DIALOG,
36
- component: ({ data }) => <JoinDialog {...data.subject} />,
35
+ filter: (data): data is { props: JoinPanelProps } => data.component === JOIN_DIALOG,
36
+ component: ({ data }) => <JoinDialog {...data.props} />,
37
37
  }),
38
38
  createSurface({
39
39
  id: RECOVER_CODE_DIALOG,
40
40
  role: 'dialog',
41
- filter: (data): data is { subject: RecoveryCodeDialogProps } => data.component === RECOVER_CODE_DIALOG,
42
- component: ({ data }) => <RecoveryCodeDialog {...data.subject} />,
41
+ filter: (data): data is { props: RecoveryCodeDialogProps } => data.component === RECOVER_CODE_DIALOG,
42
+ component: ({ data }) => <RecoveryCodeDialog {...data.props} />,
43
43
  }),
44
44
  ]);
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { effect } from '@preact/signals-core';
6
+
7
+ import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
8
+ import { type TypedObject } from '@dxos/echo-schema';
9
+
10
+ import { ClientCapabilities } from './capabilities';
11
+
12
+ // TODO(wittjosiah): Remove types?
13
+ export default (context: PluginsContext) => {
14
+ const client = context.requestCapability(ClientCapabilities.Client);
15
+
16
+ let previousSystem: TypedObject[] = [];
17
+ const unsubscribeSystem = effect(() => {
18
+ const systemSchemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.SystemSchema).flat()));
19
+ const newSchemas = systemSchemas.filter((schema) => !previousSystem.includes(schema));
20
+ previousSystem = systemSchemas;
21
+ client.addTypes(newSchemas);
22
+ });
23
+
24
+ let previous: TypedObject[] = [];
25
+ const unsubscribe = effect(() => {
26
+ const schemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Schema).flat()));
27
+ const newSchemas = schemas.filter((schema) => !previous.includes(schema));
28
+ previous = schemas;
29
+ client.addTypes(newSchemas);
30
+ });
31
+
32
+ return contributes(Capabilities.Null, null, () => {
33
+ unsubscribeSystem();
34
+ unsubscribe();
35
+ });
36
+ };
@@ -21,9 +21,9 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
21
21
  const handleDone = useCallback(
22
22
  () =>
23
23
  dispatch(
24
- createIntent(LayoutAction.SetLayout, {
25
- element: 'dialog',
26
- state: false,
24
+ createIntent(LayoutAction.UpdateDialog, {
25
+ part: 'dialog',
26
+ options: { state: false },
27
27
  }),
28
28
  ),
29
29
  [dispatch],
@@ -24,7 +24,7 @@ export const JoinDialog = (props: JoinPanelProps) => {
24
24
  async (result: InvitationResult | null) => {
25
25
  if (result?.identityKey) {
26
26
  await Promise.all([
27
- dispatch(createIntent(LayoutAction.SetLayout, { element: 'dialog', state: false })),
27
+ dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } })),
28
28
  dispatch(
29
29
  createIntent(ObservabilityAction.SendEvent, {
30
30
  name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',
@@ -19,8 +19,8 @@ const Render = () => {
19
19
  const client = useClient();
20
20
  const [seedphrase, setSeedphrase] = useState<string>();
21
21
  useAsyncEffect(async () => {
22
- const { seedphrase } = (await client.services.services.IdentityService?.createRecoveryPhrase()) ?? {};
23
- setSeedphrase(seedphrase);
22
+ const { recoveryCode } = (await client.services.services.IdentityService?.createRecoveryCredential({})) ?? {};
23
+ setSeedphrase(recoveryCode);
24
24
  }, [client]);
25
25
 
26
26
  return (
package/src/events.ts CHANGED
@@ -7,8 +7,8 @@ import { defineEvent } from '@dxos/app-framework';
7
7
  import { CLIENT_PLUGIN } from './meta';
8
8
 
9
9
  export namespace ClientEvents {
10
- export const SetupClient = defineEvent(`${CLIENT_PLUGIN}/event/setup-client`);
11
10
  export const ClientReady = defineEvent(`${CLIENT_PLUGIN}/event/client-ready`);
11
+ export const SetupSchema = defineEvent(`${CLIENT_PLUGIN}/event/setup-schema`);
12
12
  export const IdentityCreated = defineEvent(`${CLIENT_PLUGIN}/event/identity-created`);
13
13
  export const SpacesReady = defineEvent(`${CLIENT_PLUGIN}/event/spaces-ready`);
14
14
  }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/components/RecoveryCodeDialog.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { useClient } from '@dxos/react-client';\nimport { Clipboard, Dialog } from '@dxos/react-ui';\nimport { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;\n\nexport const IdentityDialog = (props: IdentityPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n\n const handleDone = useCallback(\n () =>\n dispatch(\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n state: false,\n }),\n ),\n [dispatch],\n );\n\n const handleResetStorage = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage));\n }, [dispatch]);\n\n const handleRecover = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'recoverIdentity' }));\n }, [dispatch]);\n\n const handleJoinNewIdentity = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'deviceInvitation' }));\n }, [dispatch]);\n\n return (\n <Dialog.Content>\n <Clipboard.Provider>\n <IdentityPanel\n {...props}\n doneActionParent={<Dialog.Close asChild />}\n onDone={handleDone}\n onResetStorage={handleResetStorage}\n onRecover={handleRecover}\n onJoinNewIdentity={handleJoinNewIdentity}\n />\n </Clipboard.Provider>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { type InvitationResult } from '@dxos/react-client/invitations';\nimport { Dialog } from '@dxos/react-ui';\nimport { JoinPanel, type JoinPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const handleCancelResetStorage = useCallback(() => dispatch(createIntent(ClientAction.ShareIdentity)), [dispatch]);\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n dispatch(createIntent(LayoutAction.SetLayout, { element: 'dialog', state: false })),\n dispatch(\n createIntent(ObservabilityAction.SendEvent, {\n name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',\n }),\n ),\n ]);\n }\n },\n [dispatch],\n );\n\n return (\n <Dialog.Content>\n <JoinPanel\n mode='halo-only'\n {...props}\n exitActionParent={<Dialog.Close asChild />}\n doneActionParent={<Dialog.Close asChild />}\n onCancelResetStorage={handleCancelResetStorage}\n onDone={handleDone}\n />\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { AlertDialog, Button, Clipboard, Input, useTranslation } from '@dxos/react-ui';\n\nimport { CLIENT_PLUGIN } from '../meta';\n\nexport const RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;\n\nexport type RecoveryCodeDialogProps = {\n code: string;\n};\n\nexport const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {\n const { t } = useTranslation(CLIENT_PLUGIN);\n const [confirmation, setConfirmation] = useState(false);\n\n const handleConfirmation = useCallback((checked: boolean) => setConfirmation(checked), []);\n\n return (\n <AlertDialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>\n <AlertDialog.Title>{t('recovery code dialog title')}</AlertDialog.Title>\n <p className='py-4'>{t('recovery code dialog description')}</p>\n <Clipboard.Provider>\n <Code code={code} />\n </Clipboard.Provider>\n <div className='flex flex-col py-4 gap-2'>\n <p>{t('recovery code dialog warning 1')}</p>\n <p>{t('recovery code dialog warning 2')}</p>\n </div>\n <div className='flex items-center gap-2 pbe-4'>\n <Input.Root>\n <Input.Checkbox\n data-testid='recoveryCode.confirm'\n checked={confirmation}\n onCheckedChange={handleConfirmation}\n />\n <Input.Label>{t('recovery code confirmation label')}</Input.Label>\n </Input.Root>\n </div>\n <div className='flex justify-end'>\n <AlertDialog.Action asChild>\n <Button data-testid='recoveryCode.continue' variant='primary' disabled={!confirmation}>\n {t('continue label')}\n </Button>\n </AlertDialog.Action>\n </div>\n </AlertDialog.Content>\n );\n};\n\nconst Code = ({ code }: { code: string }) => {\n const words = code.split(' ');\n return (\n <div className='relative p-2 border border-separator rounded group'>\n <Clipboard.IconButton value={code} classNames='absolute top-2 right-2 invisible group-hover:visible' />\n <div className='grid grid-cols-4'>\n {words.map((word, i) => (\n <div key={i} className='flex items-center p-2 gap-2 items-center'>\n <div className='w-4 text-xs text-center text-subdued'>{i + 1}</div>\n <div className='text-sm'>{word}</div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;;;AAIA,OAAOA,SAASC,mBAAmB;AAEnC,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,iBAAiB;AAC1B,SAASC,WAAWC,cAAc;AAClC,SAASC,qBAA8C;AAKhD,IAAMC,kBAAkB,GAAGC,aAAAA;AAE3B,IAAMC,iBAAiB,CAACC,UAAAA;AAC7B,QAAM,EAAEC,iBAAiBC,SAAQ,IAAKC,oBAAAA;AACtC,QAAMC,SAASC,UAAAA;AAEf,QAAMC,aAAaC,YACjB,MACEL,SACEM,aAAaC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AAA,cAACK,KAAAA,MAAGb,EAAE,gCAAA,CAAA,GACN,gBAAAQ,OAAA,cAACK,KAAAA,MAAGb,EAAE,gCAAA,CAAA,CAAA,GAER,gBAAAQ,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KACb,gBAAAN,OAAA,cAACW,MAAMC,MAAI,MACT,gBAAAZ,OAAA,cAACW,MAAME,UAAQ;IACbC,eAAY;IACZf,SAASL;IACTqB,iBAAiBlB;MAEnB,gBAAAG,OAAA,cAACW,MAAMK,OAAK,MAAExB,EAAE,kCAAA,CAAA,CAAA,CAAA,GAGpB,gBAAAQ,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KACb,gBAAAN,OAAA,cAACC,YAAYgB,QAAM;IAACC,SAAAA;KAClB,gBAAAlB,OAAA,cAACmB,QAAAA;IAAOL,eAAY;IAAwBM,SAAQ;IAAUC,UAAU,CAAC3B;KACtEF,EAAE,gBAAA,CAAA,CAAA,CAAA,CAAA;AAMf;AAEA,IAAMiB,OAAO,CAAC,EAAElB,KAAI,MAAoB;AACtC,QAAM+B,QAAQ/B,KAAKgC,MAAM,GAAA;AACzB,SACE,gBAAAvB,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KACb,gBAAAN,OAAA,cAACO,WAAUiB,YAAU;IAACC,OAAOlC;IAAMY,YAAW;MAC9C,gBAAAH,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KACZgB,MAAMI,IAAI,CAACC,MAAMC,MAChB,gBAAA5B,OAAA,cAACU,OAAAA;IAAImB,KAAKD;IAAGtB,WAAU;KACrB,gBAAAN,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KAAwCsB,IAAI,CAAA,GAC3D,gBAAA5B,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KAAWqB,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAMtC;",
6
- "names": ["React", "useCallback", "createIntent", "LayoutAction", "useIntentDispatcher", "useClient", "Clipboard", "Dialog", "IdentityPanel", "IDENTITY_DIALOG", "CLIENT_PLUGIN", "IdentityDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "handleDone", "useCallback", "createIntent", "LayoutAction", "SetLayout", "element", "state", "handleResetStorage", "reset", "ClientAction", "ResetStorage", "handleRecover", "target", "handleJoinNewIdentity", "Dialog", "Content", "Clipboard", "Provider", "IdentityPanel", "doneActionParent", "Close", "asChild", "onDone", "onResetStorage", "onRecover", "onJoinNewIdentity", "React", "useCallback", "createIntent", "LayoutAction", "useIntentDispatcher", "ObservabilityAction", "Dialog", "JoinPanel", "JOIN_DIALOG", "CLIENT_PLUGIN", "JoinDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "handleCancelResetStorage", "useCallback", "createIntent", "ClientAction", "ShareIdentity", "handleDone", "result", "identityKey", "Promise", "all", "LayoutAction", "SetLayout", "element", "state", "ObservabilityAction", "SendEvent", "name", "initialDisposition", "React", "Dialog", "Content", "JoinPanel", "mode", "exitActionParent", "Close", "asChild", "doneActionParent", "onCancelResetStorage", "onDone", "React", "useCallback", "useState", "AlertDialog", "Button", "Clipboard", "Input", "useTranslation", "RECOVER_CODE_DIALOG", "CLIENT_PLUGIN", "RecoveryCodeDialog", "code", "t", "useTranslation", "confirmation", "setConfirmation", "useState", "handleConfirmation", "useCallback", "checked", "React", "AlertDialog", "Content", "classNames", "Title", "p", "className", "Clipboard", "Provider", "Code", "div", "Input", "Root", "Checkbox", "data-testid", "onCheckedChange", "Label", "Action", "asChild", "Button", "variant", "disabled", "words", "split", "IconButton", "value", "map", "word", "i", "key"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/client.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { Client } from '@dxos/react-client';\n\nimport { ClientCapabilities } from './capabilities';\nimport { ClientEvents } from '../events';\nimport { type ClientPluginOptions } from '../types';\n\ntype ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n const client = new Client({ config, ...options });\n\n await client.initialize();\n await onClientInitialized?.(context, client);\n\n const systemSchemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.SystemSchema).flat()));\n const schemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Schema).flat()));\n client.addTypes(systemSchemas);\n client.addTypes(schemas);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n\n const subscription = client.spaces.isReady.subscribe(async (ready) => {\n if (ready) {\n await context.activate(ClientEvents.SpacesReady);\n }\n });\n\n return contributes(ClientCapabilities.Client, client, async () => {\n subscription.unsubscribe();\n await client.destroy();\n });\n};\n"],
5
- "mappings": ";;;;;;;;;AAIA,SAASA,mBAAwC;AACjD,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AACvD,SAASC,cAAc;AAUvB,IAAA,iBAAe,OAAO,EAAEC,SAASC,qBAAqB,GAAGC,QAAAA,MAAkC;AACzF,QAAMC,SAAS,IAAIC,OAAO,MAAMC,QAAAA,GAAWC,KAAAA,GAAQC,MAAAA,GAASC,SAAAA,CAAAA;AAC5D,QAAMC,SAAS,IAAIC,OAAO;IAAEP;IAAQ,GAAGD;EAAQ,CAAA;AAE/C,QAAMO,OAAOE,WAAU;AACvB,QAAMV,sBAAsBD,SAASS,MAAAA;AAErC,QAAMG,gBAAgBC,MAAMC,KAAK,IAAIC,IAAIf,QAAQgB,oBAAoBC,mBAAmBC,YAAY,EAAEC,KAAI,CAAA,CAAA;AAC1G,QAAMC,UAAUP,MAAMC,KAAK,IAAIC,IAAIf,QAAQgB,oBAAoBC,mBAAmBI,MAAM,EAAEF,KAAI,CAAA,CAAA;AAC9FV,SAAOa,SAASV,aAAAA;AAChBH,SAAOa,SAASF,OAAAA;AAGhBX,SAAOc,SAASC,GAAG,MAAA;AACjBf,WAAOgB,KAAKC,SAASC,UAAU,OAAOD,aAAAA;AACpC,UAAIA,UAAU;AACZE,eAAOC,SAASC,OAAOF,OAAOC,SAASE;MACzC;IACF,CAAA;EACF,CAAA;AAEA,QAAMC,eAAevB,OAAOwB,OAAOC,QAAQP,UAAU,OAAOQ,UAAAA;AAC1D,QAAIA,OAAO;AACT,YAAMnC,QAAQoC,SAASC,aAAaC,WAAW;IACjD;EACF,CAAA;AAEA,SAAOC,YAAYtB,mBAAmBP,QAAQD,QAAQ,YAAA;AACpDuB,iBAAaQ,YAAW;AACxB,UAAM/B,OAAOgC,QAAO;EACtB,CAAA;AACF;",
6
- "names": ["contributes", "Config", "Defaults", "Envs", "Local", "Storage", "Client", "context", "onClientInitialized", "options", "config", "Config", "Storage", "Envs", "Local", "Defaults", "client", "Client", "initialize", "systemSchemas", "Array", "from", "Set", "requestCapabilities", "ClientCapabilities", "SystemSchema", "flat", "schemas", "Schema", "addTypes", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "subscription", "spaces", "isReady", "ready", "activate", "ClientEvents", "SpacesReady", "contributes", "unsubscribe", "destroy"]
7
- }
@@ -1,132 +0,0 @@
1
- import {
2
- ClientEvents
3
- } from "./chunk-R4Q6H7RD.mjs";
4
- import {
5
- ClientCapabilities
6
- } from "./chunk-SVBQRT7I.mjs";
7
- import {
8
- IDENTITY_DIALOG,
9
- JOIN_DIALOG,
10
- RECOVER_CODE_DIALOG
11
- } from "./chunk-6IF6PREG.mjs";
12
- import {
13
- ClientAction
14
- } from "./chunk-E3OUNOEL.mjs";
15
- import "./chunk-NHIL4T3L.mjs";
16
-
17
- // packages/plugins/plugin-client/src/capabilities/intent-resolver.ts
18
- import { Capabilities, contributes, createIntent, createResolver, LayoutAction } from "@dxos/app-framework";
19
- import { invariant } from "@dxos/invariant";
20
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
21
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/capabilities/intent-resolver.ts";
22
- var intent_resolver_default = ({ context, onReset }) => contributes(Capabilities.IntentResolver, [
23
- createResolver(ClientAction.CreateIdentity, async () => {
24
- const manager = context.requestCapability(Capabilities.PluginManager);
25
- const client = context.requestCapability(ClientCapabilities.Client);
26
- const data = await client.halo.createIdentity();
27
- await manager.activate(ClientEvents.IdentityCreated);
28
- return {
29
- data,
30
- intents: [
31
- createIntent(ObservabilityAction.SendEvent, {
32
- name: "identity.create"
33
- })
34
- ]
35
- };
36
- }),
37
- createResolver(ClientAction.JoinIdentity, async (data) => {
38
- return {
39
- intents: [
40
- createIntent(LayoutAction.SetLayout, {
41
- element: "dialog",
42
- component: JOIN_DIALOG,
43
- dialogBlockAlign: "start",
44
- subject: {
45
- initialInvitationCode: data.invitationCode,
46
- initialDisposition: "accept-halo-invitation"
47
- }
48
- })
49
- ]
50
- };
51
- }),
52
- createResolver(ClientAction.ShareIdentity, async () => {
53
- return {
54
- intents: [
55
- createIntent(LayoutAction.SetLayout, {
56
- element: "dialog",
57
- component: IDENTITY_DIALOG,
58
- dialogBlockAlign: "start"
59
- }),
60
- createIntent(ObservabilityAction.SendEvent, {
61
- name: "identity.share"
62
- })
63
- ]
64
- };
65
- }),
66
- createResolver(ClientAction.RecoverIdentity, async () => {
67
- return {
68
- intents: [
69
- createIntent(LayoutAction.SetLayout, {
70
- element: "dialog",
71
- component: JOIN_DIALOG,
72
- dialogBlockAlign: "start",
73
- subject: {
74
- initialDisposition: "recover-identity"
75
- }
76
- })
77
- ]
78
- };
79
- }),
80
- createResolver(ClientAction.ResetStorage, async (data) => {
81
- await onReset?.({
82
- target: data.target
83
- });
84
- return {};
85
- }),
86
- createResolver(ClientAction.CreateAgent, async () => {
87
- const client = context.requestCapability(ClientCapabilities.Client);
88
- invariant(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
89
- F: __dxlog_file,
90
- L: 80,
91
- S: void 0,
92
- A: [
93
- "client.services.services.EdgeAgentService",
94
- "'Missing EdgeAgentService'"
95
- ]
96
- });
97
- await client.services.services.EdgeAgentService.createAgent(null, {
98
- timeout: 1e4
99
- });
100
- }),
101
- createResolver(ClientAction.CreateRecoveryCode, async () => {
102
- const client = context.requestCapability(ClientCapabilities.Client);
103
- invariant(client.services.services.IdentityService, "IdentityService not available", {
104
- F: __dxlog_file,
105
- L: 85,
106
- S: void 0,
107
- A: [
108
- "client.services.services.IdentityService",
109
- "'IdentityService not available'"
110
- ]
111
- });
112
- const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
113
- return {
114
- intents: [
115
- createIntent(LayoutAction.SetLayout, {
116
- element: "dialog",
117
- dialogBlockAlign: "start",
118
- dialogType: "alert",
119
- state: true,
120
- component: RECOVER_CODE_DIALOG,
121
- subject: {
122
- code: seedphrase
123
- }
124
- })
125
- ]
126
- };
127
- })
128
- ]);
129
- export {
130
- intent_resolver_default as default
131
- };
132
- //# sourceMappingURL=intent-resolver-IWWLWOZD.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n createResolver,\n LayoutAction,\n type PluginsContext,\n} from '@dxos/app-framework';\nimport { invariant } from '@dxos/invariant';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { type JoinPanelProps } from '@dxos/shell/react';\n\nimport { ClientCapabilities } from './capabilities';\nimport { IDENTITY_DIALOG, JOIN_DIALOG, RECOVER_CODE_DIALOG } from '../components';\nimport { ClientEvents } from '../events';\nimport { ClientAction, type ClientPluginOptions } from '../types';\n\ntype IntentResolverOptions = Pick<ClientPluginOptions, 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default ({ context, onReset }: IntentResolverOptions) =>\n contributes(Capabilities.IntentResolver, [\n createResolver(ClientAction.CreateIdentity, async () => {\n const manager = context.requestCapability(Capabilities.PluginManager);\n const client = context.requestCapability(ClientCapabilities.Client);\n const data = await client.halo.createIdentity();\n await manager.activate(ClientEvents.IdentityCreated);\n return { data, intents: [createIntent(ObservabilityAction.SendEvent, { name: 'identity.create' })] };\n }),\n createResolver(ClientAction.JoinIdentity, async (data) => {\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n component: JOIN_DIALOG,\n dialogBlockAlign: 'start',\n subject: {\n initialInvitationCode: data.invitationCode,\n initialDisposition: 'accept-halo-invitation',\n } satisfies Partial<JoinPanelProps>,\n }),\n ],\n };\n }),\n createResolver(ClientAction.ShareIdentity, async () => {\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n component: IDENTITY_DIALOG,\n dialogBlockAlign: 'start',\n }),\n createIntent(ObservabilityAction.SendEvent, { name: 'identity.share' }),\n ],\n };\n }),\n createResolver(ClientAction.RecoverIdentity, async () => {\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n component: JOIN_DIALOG,\n dialogBlockAlign: 'start',\n subject: { initialDisposition: 'recover-identity' } satisfies Partial<JoinPanelProps>,\n }),\n ],\n };\n }),\n createResolver(ClientAction.ResetStorage, async (data) => {\n await onReset?.({ target: data.target });\n return {};\n }),\n createResolver(ClientAction.CreateAgent, async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');\n await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });\n }),\n createResolver(ClientAction.CreateRecoveryCode, async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n // TODO(wittjosiah): This needs a proper api. Rename property.\n const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n dialogBlockAlign: 'start',\n dialogType: 'alert',\n state: true,\n component: RECOVER_CODE_DIALOG,\n subject: { code: seedphrase },\n }),\n ],\n };\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAIA,SACEA,cACAC,aACAC,cACAC,gBACAC,oBAEK;AACP,SAASC,iBAAiB;AAC1B,SAASC,2BAA2B;;AAYpC,IAAA,0BAAe,CAAC,EAAEC,SAASC,QAAO,MAChCC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAeC,aAAaC,gBAAgB,YAAA;AAC1C,UAAMC,UAAUR,QAAQS,kBAAkBN,aAAaO,aAAa;AACpE,UAAMC,SAASX,QAAQS,kBAAkBG,mBAAmBC,MAAM;AAClE,UAAMC,OAAO,MAAMH,OAAOI,KAAKC,eAAc;AAC7C,UAAMR,QAAQS,SAASC,aAAaC,eAAe;AACnD,WAAO;MAAEL;MAAMM,SAAS;QAACC,aAAaC,oBAAoBC,WAAW;UAAEC,MAAM;QAAkB,CAAA;;IAAI;EACrG,CAAA;EACAnB,eAAeC,aAAamB,cAAc,OAAOX,SAAAA;AAC/C,WAAO;MACLM,SAAS;QACPC,aAAaK,aAAaC,WAAW;UACnCC,SAAS;UACTC,WAAWC;UACXC,kBAAkB;UAClBC,SAAS;YACPC,uBAAuBnB,KAAKoB;YAC5BC,oBAAoB;UACtB;QACF,CAAA;;IAEJ;EACF,CAAA;EACA9B,eAAeC,aAAa8B,eAAe,YAAA;AACzC,WAAO;MACLhB,SAAS;QACPC,aAAaK,aAAaC,WAAW;UACnCC,SAAS;UACTC,WAAWQ;UACXN,kBAAkB;QACpB,CAAA;QACAV,aAAaC,oBAAoBC,WAAW;UAAEC,MAAM;QAAiB,CAAA;;IAEzE;EACF,CAAA;EACAnB,eAAeC,aAAagC,iBAAiB,YAAA;AAC3C,WAAO;MACLlB,SAAS;QACPC,aAAaK,aAAaC,WAAW;UACnCC,SAAS;UACTC,WAAWC;UACXC,kBAAkB;UAClBC,SAAS;YAAEG,oBAAoB;UAAmB;QACpD,CAAA;;IAEJ;EACF,CAAA;EACA9B,eAAeC,aAAaiC,cAAc,OAAOzB,SAAAA;AAC/C,UAAMb,UAAU;MAAEuC,QAAQ1B,KAAK0B;IAAO,CAAA;AACtC,WAAO,CAAC;EACV,CAAA;EACAnC,eAAeC,aAAamC,aAAa,YAAA;AACvC,UAAM9B,SAASX,QAAQS,kBAAkBG,mBAAmBC,MAAM;AAClE6B,cAAU/B,OAAOgC,SAASA,SAASC,kBAAkB,4BAAA;;;;;;;;;AACrD,UAAMjC,OAAOgC,SAASA,SAASC,iBAAiBC,YAAY,MAAa;MAAEC,SAAS;IAAO,CAAA;EAC7F,CAAA;EACAzC,eAAeC,aAAayC,oBAAoB,YAAA;AAC9C,UAAMpC,SAASX,QAAQS,kBAAkBG,mBAAmBC,MAAM;AAClE6B,cAAU/B,OAAOgC,SAASA,SAASK,iBAAiB,iCAAA;;;;;;;;;AAEpD,UAAM,EAAEC,WAAU,IAAK,MAAMtC,OAAOgC,SAASA,SAASK,gBAAgBE,qBAAoB;AAC1F,WAAO;MACL9B,SAAS;QACPC,aAAaK,aAAaC,WAAW;UACnCC,SAAS;UACTG,kBAAkB;UAClBoB,YAAY;UACZC,OAAO;UACPvB,WAAWwB;UACXrB,SAAS;YAAEsB,MAAML;UAAW;QAC9B,CAAA;;IAEJ;EACF,CAAA;CACD;",
6
- "names": ["Capabilities", "contributes", "createIntent", "createResolver", "LayoutAction", "invariant", "ObservabilityAction", "context", "onReset", "contributes", "Capabilities", "IntentResolver", "createResolver", "ClientAction", "CreateIdentity", "manager", "requestCapability", "PluginManager", "client", "ClientCapabilities", "Client", "data", "halo", "createIdentity", "activate", "ClientEvents", "IdentityCreated", "intents", "createIntent", "ObservabilityAction", "SendEvent", "name", "JoinIdentity", "LayoutAction", "SetLayout", "element", "component", "JOIN_DIALOG", "dialogBlockAlign", "subject", "initialInvitationCode", "invitationCode", "initialDisposition", "ShareIdentity", "IDENTITY_DIALOG", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "invariant", "services", "EdgeAgentService", "createAgent", "timeout", "CreateRecoveryCode", "IdentityService", "seedphrase", "createRecoveryPhrase", "dialogType", "state", "RECOVER_CODE_DIALOG", "code"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { createSurface, Capabilities, contributes } from '@dxos/app-framework';\nimport { type IdentityPanelProps, type JoinPanelProps } from '@dxos/shell/react';\n\nimport {\n IDENTITY_DIALOG,\n IdentityDialog,\n JOIN_DIALOG,\n JoinDialog,\n RECOVER_CODE_DIALOG,\n RecoveryCodeDialog,\n type RecoveryCodeDialogProps,\n} from '../components';\n\ntype ReactSurfaceOptions = {\n createInvitationUrl: (invitationCode: string) => string;\n};\n\nexport default ({ createInvitationUrl }: ReactSurfaceOptions) =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: IDENTITY_DIALOG,\n role: 'dialog',\n filter: (data): data is { subject: IdentityPanelProps } => data.component === IDENTITY_DIALOG,\n component: ({ data }) => <IdentityDialog {...data.subject} createInvitationUrl={createInvitationUrl} />,\n }),\n createSurface({\n id: JOIN_DIALOG,\n role: 'dialog',\n filter: (data): data is { subject: JoinPanelProps } => data.component === JOIN_DIALOG,\n component: ({ data }) => <JoinDialog {...data.subject} />,\n }),\n createSurface({\n id: RECOVER_CODE_DIALOG,\n role: 'dialog',\n filter: (data): data is { subject: RecoveryCodeDialogProps } => data.component === RECOVER_CODE_DIALOG,\n component: ({ data }) => <RecoveryCodeDialog {...data.subject} />,\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,eAAeC,cAAcC,mBAAmB;AAiBzD,IAAA,wBAAe,CAAC,EAAEC,oBAAmB,MACnCC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAIC;IACJC,MAAM;IACNC,QAAQ,CAACC,SAAkDA,KAAKC,cAAcJ;IAC9EI,WAAW,CAAC,EAAED,KAAI,MAAO,sBAAA,cAACE,gBAAAA;MAAgB,GAAGF,KAAKG;MAASZ;;EAC7D,CAAA;EACAI,cAAc;IACZC,IAAIQ;IACJN,MAAM;IACNC,QAAQ,CAACC,SAA8CA,KAAKC,cAAcG;IAC1EH,WAAW,CAAC,EAAED,KAAI,MAAO,sBAAA,cAACK,YAAeL,KAAKG,OAAO;EACvD,CAAA;EACAR,cAAc;IACZC,IAAIU;IACJR,MAAM;IACNC,QAAQ,CAACC,SAAuDA,KAAKC,cAAcK;IACnFL,WAAW,CAAC,EAAED,KAAI,MAAO,sBAAA,cAACO,oBAAuBP,KAAKG,OAAO;EAC/D,CAAA;CACD;",
6
- "names": ["React", "createSurface", "Capabilities", "contributes", "createInvitationUrl", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "IDENTITY_DIALOG", "role", "filter", "data", "component", "IdentityDialog", "subject", "JOIN_DIALOG", "JoinDialog", "RECOVER_CODE_DIALOG", "RecoveryCodeDialog"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/components/RecoveryCodeDialog.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { useClient } from '@dxos/react-client';\nimport { Clipboard, Dialog } from '@dxos/react-ui';\nimport { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;\n\nexport const IdentityDialog = (props: IdentityPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n\n const handleDone = useCallback(\n () =>\n dispatch(\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n state: false,\n }),\n ),\n [dispatch],\n );\n\n const handleResetStorage = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage));\n }, [dispatch]);\n\n const handleRecover = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'recoverIdentity' }));\n }, [dispatch]);\n\n const handleJoinNewIdentity = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'deviceInvitation' }));\n }, [dispatch]);\n\n return (\n <Dialog.Content>\n <Clipboard.Provider>\n <IdentityPanel\n {...props}\n doneActionParent={<Dialog.Close asChild />}\n onDone={handleDone}\n onResetStorage={handleResetStorage}\n onRecover={handleRecover}\n onJoinNewIdentity={handleJoinNewIdentity}\n />\n </Clipboard.Provider>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { type InvitationResult } from '@dxos/react-client/invitations';\nimport { Dialog } from '@dxos/react-ui';\nimport { JoinPanel, type JoinPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const handleCancelResetStorage = useCallback(() => dispatch(createIntent(ClientAction.ShareIdentity)), [dispatch]);\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n dispatch(createIntent(LayoutAction.SetLayout, { element: 'dialog', state: false })),\n dispatch(\n createIntent(ObservabilityAction.SendEvent, {\n name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',\n }),\n ),\n ]);\n }\n },\n [dispatch],\n );\n\n return (\n <Dialog.Content>\n <JoinPanel\n mode='halo-only'\n {...props}\n exitActionParent={<Dialog.Close asChild />}\n doneActionParent={<Dialog.Close asChild />}\n onCancelResetStorage={handleCancelResetStorage}\n onDone={handleDone}\n />\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { AlertDialog, Button, Clipboard, Input, useTranslation } from '@dxos/react-ui';\n\nimport { CLIENT_PLUGIN } from '../meta';\n\nexport const RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;\n\nexport type RecoveryCodeDialogProps = {\n code: string;\n};\n\nexport const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {\n const { t } = useTranslation(CLIENT_PLUGIN);\n const [confirmation, setConfirmation] = useState(false);\n\n const handleConfirmation = useCallback((checked: boolean) => setConfirmation(checked), []);\n\n return (\n <AlertDialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>\n <AlertDialog.Title>{t('recovery code dialog title')}</AlertDialog.Title>\n <p className='py-4'>{t('recovery code dialog description')}</p>\n <Clipboard.Provider>\n <Code code={code} />\n </Clipboard.Provider>\n <div className='flex flex-col py-4 gap-2'>\n <p>{t('recovery code dialog warning 1')}</p>\n <p>{t('recovery code dialog warning 2')}</p>\n </div>\n <div className='flex items-center gap-2 pbe-4'>\n <Input.Root>\n <Input.Checkbox\n data-testid='recoveryCode.confirm'\n checked={confirmation}\n onCheckedChange={handleConfirmation}\n />\n <Input.Label>{t('recovery code confirmation label')}</Input.Label>\n </Input.Root>\n </div>\n <div className='flex justify-end'>\n <AlertDialog.Action asChild>\n <Button data-testid='recoveryCode.continue' variant='primary' disabled={!confirmation}>\n {t('continue label')}\n </Button>\n </AlertDialog.Action>\n </div>\n </AlertDialog.Content>\n );\n};\n\nconst Code = ({ code }: { code: string }) => {\n const words = code.split(' ');\n return (\n <div className='relative p-2 border border-separator rounded group'>\n <Clipboard.IconButton value={code} classNames='absolute top-2 right-2 invisible group-hover:visible' />\n <div className='grid grid-cols-4'>\n {words.map((word, i) => (\n <div key={i} className='flex items-center p-2 gap-2 items-center'>\n <div className='w-4 text-xs text-center text-subdued'>{i + 1}</div>\n <div className='text-sm'>{word}</div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAmC;AAEnC,2BAAgE;AAChE,0BAA0B;AAC1B,sBAAkC;AAClC,IAAAA,gBAAuD;ACLvD,IAAAA,gBAAmC;AAEnC,IAAAC,wBAAgE;AAChE,mBAAoC;AAEpC,IAAAC,mBAAuB;AACvB,IAAAF,gBAA+C;ACN/C,IAAAA,gBAA6C;AAE7C,IAAAE,mBAAsE;AFQ/D,IAAMC,kBAAkB,GAAGC,mCAAAA;AAE3B,IAAMC,iBAAiB,CAACC,UAAAA;AAC7B,QAAM,EAAEC,iBAAiBC,SAAQ,QAAKC,0CAAAA;AACtC,QAAMC,aAASC,+BAAAA;AAEf,QAAMC,iBAAaC,0BACjB,MACEL,aACEM,mCAAaC,kCAAaC,WAAW;IACnCC,SAAS;IACTC,OAAO;EACT,CAAA,CAAA,GAEJ;IAACV;GAAS;AAGZ,QAAMW,yBAAqBN,0BAAY,YAAA;AACrC,UAAMH,OAAOU,MAAK;AAClB,UAAMZ,aAASM,mCAAaO,mCAAaC,YAAY,CAAA;EACvD,GAAG;IAACd;GAAS;AAEb,QAAMe,oBAAgBV,0BAAY,YAAA;AAChC,UAAMH,OAAOU,MAAK;AAClB,UAAMZ,aAASM,mCAAaO,mCAAaC,cAAc;MAAEE,QAAQ;IAAkB,CAAA,CAAA;EACrF,GAAG;IAAChB;GAAS;AAEb,QAAMiB,4BAAwBZ,0BAAY,YAAA;AACx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A;KAClBR,8BAAAA,QAAA,cAACqD,yBAAAA;IAAOJ,eAAY;IAAwBK,SAAQ;IAAUC,UAAU,CAACrB;KACtEF,EAAE,gBAAA,CAAA,CAAA,CAAA,CAAA;AAMf;AAEA,IAAMY,OAAO,CAAC,EAAEb,KAAI,MAAoB;AACtC,QAAMyB,QAAQzB,KAAK0B,MAAM,GAAA;AACzB,SACEzD,8BAAAA,QAAA,cAAC6C,OAAAA;IAAIF,WAAU;KACb3C,8BAAAA,QAAA,cAACG,iBAAAA,UAAUuD,YAAU;IAACC,OAAO5B;IAAMS,YAAW;MAC9CxC,8BAAAA,QAAA,cAAC6C,OAAAA;IAAIF,WAAU;KACZa,MAAMI,IAAI,CAACC,MAAMC,MAChB9D,8BAAAA,QAAA,cAAC6C,OAAAA;IAAIkB,KAAKD;IAAGnB,WAAU;KACrB3C,8BAAAA,QAAA,cAAC6C,OAAAA;IAAIF,WAAU;KAAwCmB,IAAI,CAAA,GAC3D9D,8BAAAA,QAAA,cAAC6C,OAAAA;IAAIF,WAAU;KAAWkB,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAMtC;",
6
- "names": ["import_react", "import_app_framework", "import_react_ui", "IDENTITY_DIALOG", "CLIENT_PLUGIN", "IdentityDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "handleDone", "useCallback", "createIntent", "LayoutAction", "SetLayout", "element", "state", "handleResetStorage", "reset", "ClientAction", "ResetStorage", "handleRecover", "target", "handleJoinNewIdentity", "React", "Dialog", "Content", "Clipboard", "Provider", "IdentityPanel", "doneActionParent", "Close", "asChild", "onDone", "onResetStorage", "onRecover", "onJoinNewIdentity", "JOIN_DIALOG", "JoinDialog", "handleCancelResetStorage", "ShareIdentity", "result", "identityKey", "Promise", "all", "ObservabilityAction", "SendEvent", "name", "initialDisposition", "JoinPanel", "mode", "exitActionParent", "onCancelResetStorage", "RECOVER_CODE_DIALOG", "RecoveryCodeDialog", "code", "t", "useTranslation", "confirmation", "setConfirmation", "useState", "handleConfirmation", "checked", "AlertDialog", "classNames", "Title", "p", "className", "Code", "div", "Input", "Root", "Checkbox", "data-testid", "onCheckedChange", "Label", "Action", "Button", "variant", "disabled", "words", "split", "IconButton", "value", "map", "word", "i", "key"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/client.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { Client } from '@dxos/react-client';\n\nimport { ClientCapabilities } from './capabilities';\nimport { ClientEvents } from '../events';\nimport { type ClientPluginOptions } from '../types';\n\ntype ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n const client = new Client({ config, ...options });\n\n await client.initialize();\n await onClientInitialized?.(context, client);\n\n const systemSchemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.SystemSchema).flat()));\n const schemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Schema).flat()));\n client.addTypes(systemSchemas);\n client.addTypes(schemas);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n\n const subscription = client.spaces.isReady.subscribe(async (ready) => {\n if (ready) {\n await context.activate(ClientEvents.SpacesReady);\n }\n });\n\n return contributes(ClientCapabilities.Client, client, async () => {\n subscription.unsubscribe();\n await client.destroy();\n });\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAAiD;AACjD,oBAAuD;AACvD,0BAAuB;AAUvB,IAAA,iBAAe,OAAO,EAAEA,SAASC,qBAAqB,GAAGC,QAAAA,MAAkC;AACzF,QAAMC,SAAS,IAAIC,qBAAO,UAAMC,uBAAAA,OAAWC,oBAAAA,OAAQC,qBAAAA,OAASC,wBAAAA,CAAAA;AAC5D,QAAMC,SAAS,IAAIC,2BAAO;IAAEP;IAAQ,GAAGD;EAAQ,CAAA;AAE/C,QAAMO,OAAOE,WAAU;AACvB,QAAMV,sBAAsBD,SAASS,MAAAA;AAErC,QAAMG,gBAAgBC,MAAMC,KAAK,IAAIC,IAAIf,QAAQgB,oBAAoBC,yCAAmBC,YAAY,EAAEC,KAAI,CAAA,CAAA;AAC1G,QAAMC,UAAUP,MAAMC,KAAK,IAAIC,IAAIf,QAAQgB,oBAAoBC,yCAAmBI,MAAM,EAAEF,KAAI,CAAA,CAAA;AAC9FV,SAAOa,SAASV,aAAAA;AAChBH,SAAOa,SAASF,OAAAA;AAGhBX,SAAOc,SAASC,GAAG,MAAA;AACjBf,WAAOgB,KAAKC,SAASC,UAAU,OAAOD,aAAAA;AACpC,UAAIA,UAAU;AACZE,eAAOC,SAASC,OAAOF,OAAOC,SAASE;MACzC;IACF,CAAA;EACF,CAAA;AAEA,QAAMC,eAAevB,OAAOwB,OAAOC,QAAQP,UAAU,OAAOQ,UAAAA;AAC1D,QAAIA,OAAO;AACT,YAAMnC,QAAQoC,SAASC,mCAAaC,WAAW;IACjD;EACF,CAAA;AAEA,aAAOC,kCAAYtB,yCAAmBP,QAAQD,QAAQ,YAAA;AACpDuB,iBAAaQ,YAAW;AACxB,UAAM/B,OAAOgC,QAAO;EACtB,CAAA;AACF;",
6
- "names": ["context", "onClientInitialized", "options", "config", "Config", "Storage", "Envs", "Local", "Defaults", "client", "Client", "initialize", "systemSchemas", "Array", "from", "Set", "requestCapabilities", "ClientCapabilities", "SystemSchema", "flat", "schemas", "Schema", "addTypes", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "subscription", "spaces", "isReady", "ready", "activate", "ClientEvents", "SpacesReady", "contributes", "unsubscribe", "destroy"]
7
- }