@dxos/plugin-client 0.7.4 → 0.7.5-labs.071a3e2
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-6LOTDB4T.mjs +44 -0
- package/dist/lib/browser/app-graph-builder-6LOTDB4T.mjs.map +7 -0
- package/dist/lib/browser/chunk-E3OUNOEL.mjs +76 -0
- package/dist/lib/browser/chunk-E3OUNOEL.mjs.map +7 -0
- package/dist/lib/browser/chunk-MSK3TLIH.mjs +17 -0
- package/dist/lib/browser/chunk-MSK3TLIH.mjs.map +7 -0
- package/dist/lib/browser/chunk-NHIL4T3L.mjs +12 -0
- package/dist/lib/browser/chunk-NHIL4T3L.mjs.map +7 -0
- package/dist/lib/browser/chunk-PDSHZE3P.mjs +162 -0
- package/dist/lib/browser/chunk-PDSHZE3P.mjs.map +7 -0
- package/dist/lib/browser/chunk-RGMLBYIF.mjs +18 -0
- package/dist/lib/browser/chunk-RGMLBYIF.mjs.map +7 -0
- package/dist/lib/browser/client-BEJK55IM.mjs +41 -0
- package/dist/lib/browser/client-BEJK55IM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +76 -428
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-E6TL7E24.mjs +159 -0
- package/dist/lib/browser/intent-resolver-E6TL7E24.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-PHX2CVI7.mjs +24 -0
- package/dist/lib/browser/react-context-PHX2CVI7.mjs.map +7 -0
- package/dist/lib/browser/react-surface-K5NKVCIB.mjs +41 -0
- package/dist/lib/browser/react-surface-K5NKVCIB.mjs.map +7 -0
- package/dist/lib/browser/schema-AL34NY2M.mjs +33 -0
- package/dist/lib/browser/schema-AL34NY2M.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +8 -0
- package/dist/lib/node/app-graph-builder-JCND3P6G.cjs +58 -0
- package/dist/lib/node/app-graph-builder-JCND3P6G.cjs.map +7 -0
- package/dist/lib/node/chunk-NVYWMDF3.cjs +95 -0
- package/dist/lib/node/chunk-NVYWMDF3.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-OIFPM5ZW.cjs} +12 -11
- package/dist/lib/node/chunk-OIFPM5ZW.cjs.map +7 -0
- package/dist/lib/node/chunk-VUJ3ZPK3.cjs +190 -0
- package/dist/lib/node/chunk-VUJ3ZPK3.cjs.map +7 -0
- package/dist/lib/node/chunk-XPC4JOPP.cjs +37 -0
- package/dist/lib/node/chunk-XPC4JOPP.cjs.map +7 -0
- package/dist/lib/node/chunk-ZI7AV5RP.cjs +36 -0
- package/dist/lib/node/chunk-ZI7AV5RP.cjs.map +7 -0
- package/dist/lib/node/client-AHIW24VM.cjs +55 -0
- package/dist/lib/node/client-AHIW24VM.cjs.map +7 -0
- package/dist/lib/node/index.cjs +71 -416
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-DUPICQ3F.cjs +167 -0
- package/dist/lib/node/intent-resolver-DUPICQ3F.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-context-WMOFXPT4.cjs +48 -0
- package/dist/lib/node/react-context-WMOFXPT4.cjs.map +7 -0
- package/dist/lib/node/react-surface-YQ2PKXNV.cjs +62 -0
- package/dist/lib/node/react-surface-YQ2PKXNV.cjs.map +7 -0
- package/dist/lib/node/schema-HW4W3QYU.cjs +49 -0
- package/dist/lib/node/schema-HW4W3QYU.cjs.map +7 -0
- package/dist/lib/node/types.cjs +30 -0
- package/dist/lib/node/types.cjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs +45 -0
- package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-74T33KTB.mjs +77 -0
- package/dist/lib/node-esm/chunk-74T33KTB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-B73LKPGU.mjs +18 -0
- package/dist/lib/node-esm/chunk-B73LKPGU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HO7WDE7C.mjs +14 -0
- package/dist/lib/node-esm/chunk-HO7WDE7C.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QR72BXJK.mjs +19 -0
- package/dist/lib/node-esm/chunk-QR72BXJK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WS4CKCUR.mjs +163 -0
- package/dist/lib/node-esm/chunk-WS4CKCUR.mjs.map +7 -0
- package/dist/lib/node-esm/client-FY7IDNRL.mjs +42 -0
- package/dist/lib/node-esm/client-FY7IDNRL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +76 -428
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-QUQH2LS2.mjs +160 -0
- package/dist/lib/node-esm/intent-resolver-QUQH2LS2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-context-EEGDXBWA.mjs +25 -0
- package/dist/lib/node-esm/react-context-EEGDXBWA.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-H34XQPWC.mjs +42 -0
- package/dist/lib/node-esm/react-surface-H34XQPWC.mjs.map +7 -0
- package/dist/lib/node-esm/schema-74LVJ3EU.mjs +34 -0
- package/dist/lib/node-esm/schema-74LVJ3EU.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +9 -0
- package/dist/types/src/ClientPlugin.d.ts +2 -36
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +8 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/client.d.ts +9 -0
- package/dist/types/src/capabilities/client.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +194 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +8 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +7 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +4 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -0
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +7 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -12
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +98 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +23 -20
- package/src/ClientPlugin.ts +64 -0
- package/src/capabilities/app-graph-builder.ts +39 -0
- package/src/capabilities/capabilities.ts +16 -0
- package/src/capabilities/client.ts +42 -0
- package/src/capabilities/index.ts +14 -0
- package/src/capabilities/intent-resolver.ts +130 -0
- package/src/capabilities/react-context.tsx +20 -0
- package/src/capabilities/react-surface.tsx +44 -0
- package/src/capabilities/schema.ts +36 -0
- package/src/components/IdentityDialog.tsx +15 -13
- package/src/components/JoinDialog.tsx +13 -19
- package/src/components/RecoveryCodeDialog.stories.tsx +2 -2
- package/src/components/RecoveryCodeDialog.tsx +3 -1
- package/src/events.ts +14 -0
- package/src/index.ts +4 -4
- package/src/meta.ts +1 -15
- package/src/types.ts +89 -0
- package/dist/lib/browser/chunk-FGUXUNOK.mjs +0 -26
- package/dist/lib/browser/chunk-FGUXUNOK.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -13
- package/dist/lib/node/chunk-XYLDQWFV.cjs +0 -51
- package/dist/lib/node/chunk-XYLDQWFV.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-C6X363FK.mjs +0 -28
- package/dist/lib/node-esm/chunk-C6X363FK.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -14
- package/src/ClientPlugin.tsx +0 -316
- /package/dist/lib/browser/{meta.mjs.map → types.mjs.map} +0 -0
- /package/dist/lib/node-esm/{meta.mjs.map → types.mjs.map} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type PluginsContext } from '@dxos/app-framework';
|
|
2
|
+
import { S } from '@dxos/echo-schema';
|
|
3
|
+
import { type Client, PublicKey, type ClientOptions } from '@dxos/react-client';
|
|
4
|
+
import { type MaybePromise } from '@dxos/util';
|
|
5
|
+
export declare namespace ClientAction {
|
|
6
|
+
const CreateIdentity_base: S.TaggedClass<CreateIdentity, "dxos.org/plugin/client/action/create-identity", {
|
|
7
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/create-identity">;
|
|
8
|
+
} & {
|
|
9
|
+
input: S.Struct<{
|
|
10
|
+
displayName: S.optional<typeof S.String>;
|
|
11
|
+
}>;
|
|
12
|
+
output: S.Struct<{
|
|
13
|
+
identityKey: S.instanceOf<PublicKey>;
|
|
14
|
+
spaceKey: S.optional<S.instanceOf<PublicKey>>;
|
|
15
|
+
profile: S.optional<S.Struct<{
|
|
16
|
+
displayName: S.optional<typeof S.String>;
|
|
17
|
+
avatarCid: S.optional<typeof S.String>;
|
|
18
|
+
data: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
|
|
19
|
+
}>>;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
export class CreateIdentity extends CreateIdentity_base {
|
|
23
|
+
}
|
|
24
|
+
const JoinIdentity_base: S.TaggedClass<JoinIdentity, "dxos.org/plugin/client/action/join-identity", {
|
|
25
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/join-identity">;
|
|
26
|
+
} & {
|
|
27
|
+
input: S.Struct<{
|
|
28
|
+
invitationCode: typeof S.String;
|
|
29
|
+
}>;
|
|
30
|
+
output: typeof S.Void;
|
|
31
|
+
}>;
|
|
32
|
+
export class JoinIdentity extends JoinIdentity_base {
|
|
33
|
+
}
|
|
34
|
+
const ShareIdentity_base: S.TaggedClass<ShareIdentity, "dxos.org/plugin/client/action/share-identity", {
|
|
35
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/share-identity">;
|
|
36
|
+
} & {
|
|
37
|
+
input: typeof S.Void;
|
|
38
|
+
output: typeof S.Void;
|
|
39
|
+
}>;
|
|
40
|
+
export class ShareIdentity extends ShareIdentity_base {
|
|
41
|
+
}
|
|
42
|
+
const RecoverIdentity_base: S.TaggedClass<RecoverIdentity, "dxos.org/plugin/client/action/recover-identity", {
|
|
43
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/recover-identity">;
|
|
44
|
+
} & {
|
|
45
|
+
input: typeof S.Void;
|
|
46
|
+
output: typeof S.Void;
|
|
47
|
+
}>;
|
|
48
|
+
export class RecoverIdentity extends RecoverIdentity_base {
|
|
49
|
+
}
|
|
50
|
+
const ResetStorage_base: S.TaggedClass<ResetStorage, "dxos.org/plugin/client/action/reset-storage", {
|
|
51
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/reset-storage">;
|
|
52
|
+
} & {
|
|
53
|
+
input: S.Struct<{
|
|
54
|
+
target: S.optional<typeof S.String>;
|
|
55
|
+
}>;
|
|
56
|
+
output: typeof S.Void;
|
|
57
|
+
}>;
|
|
58
|
+
export class ResetStorage extends ResetStorage_base {
|
|
59
|
+
}
|
|
60
|
+
const CreateAgent_base: S.TaggedClass<CreateAgent, "dxos.org/plugin/client/action/create-agent", {
|
|
61
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/create-agent">;
|
|
62
|
+
} & {
|
|
63
|
+
input: typeof S.Void;
|
|
64
|
+
output: typeof S.Void;
|
|
65
|
+
}>;
|
|
66
|
+
export class CreateAgent extends CreateAgent_base {
|
|
67
|
+
}
|
|
68
|
+
const CreateRecoveryCode_base: S.TaggedClass<CreateRecoveryCode, "dxos.org/plugin/client/action/create-recovery-code", {
|
|
69
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/create-recovery-code">;
|
|
70
|
+
} & {
|
|
71
|
+
input: typeof S.Void;
|
|
72
|
+
output: typeof S.Void;
|
|
73
|
+
}>;
|
|
74
|
+
export class CreateRecoveryCode extends CreateRecoveryCode_base {
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
77
|
+
}
|
|
78
|
+
export type ClientPluginOptions = ClientOptions & {
|
|
79
|
+
/**
|
|
80
|
+
* Base URL for the invitation link.
|
|
81
|
+
*/
|
|
82
|
+
invitationUrl?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Query parameter for the invitation code.
|
|
85
|
+
*/
|
|
86
|
+
invitationParam?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Run after the client has been initialized.
|
|
89
|
+
*/
|
|
90
|
+
onClientInitialized?: (context: PluginsContext, client: Client) => MaybePromise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Called when the client is reset.
|
|
93
|
+
*/
|
|
94
|
+
onReset?: (params: {
|
|
95
|
+
target?: string;
|
|
96
|
+
}) => MaybePromise<void>;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,yBAAiB,YAAY,CAAC;;;;;;;;;;;;;;;;;IAC5B,MAAM,OAAO,cAAe,SAAQ,mBAKlC;KAAG;;;;;;;;;IAEL,MAAM,OAAO,YAAa,SAAQ,iBAKhC;KAAG;;;;;;;IAEL,MAAM,OAAO,aAAc,SAAQ,kBAGjC;KAAG;;;;;;;IAEL,MAAM,OAAO,eAAgB,SAAQ,oBAGnC;KAAG;;;;;;;;;IAEL,MAAM,OAAO,YAAa,SAAQ,iBAKhC;KAAG;;;;;;;IAEL,MAAM,OAAO,WAAY,SAAQ,gBAG/B;KAAG;;;;;;;IAEL,MAAM,OAAO,kBAAmB,SAAQ,uBAGtC;KAAG;;CACN;AAED,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IAEtF;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-client",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5-labs.071a3e2",
|
|
4
4
|
"description": "DXOS Surface plugin for DXOS Client",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"browser": "./dist/lib/browser/index.mjs",
|
|
14
14
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
15
15
|
},
|
|
16
|
-
"./
|
|
17
|
-
"types": "./dist/types/src/
|
|
18
|
-
"browser": "./dist/lib/browser/
|
|
19
|
-
"node": "./dist/lib/node-esm/
|
|
16
|
+
"./types": {
|
|
17
|
+
"types": "./dist/types/src/types.d.ts",
|
|
18
|
+
"browser": "./dist/lib/browser/types.mjs",
|
|
19
|
+
"node": "./dist/lib/node-esm/types.mjs"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"types": "dist/types/src/index.d.ts",
|
|
23
23
|
"typesVersions": {
|
|
24
24
|
"*": {
|
|
25
|
-
"
|
|
26
|
-
"dist/types/src/
|
|
25
|
+
"types": [
|
|
26
|
+
"dist/types/src/types.d.ts"
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
29
|
},
|
|
@@ -32,26 +32,29 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/local-storage": "0.7.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/plugin-graph": "0.7.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/react-ui": "0.7.
|
|
46
|
-
"@dxos/
|
|
35
|
+
"@preact/signals-core": "^1.6.0",
|
|
36
|
+
"@dxos/app-framework": "0.7.5-labs.071a3e2",
|
|
37
|
+
"@dxos/config": "0.7.5-labs.071a3e2",
|
|
38
|
+
"@dxos/invariant": "0.7.5-labs.071a3e2",
|
|
39
|
+
"@dxos/echo-signals": "0.7.5-labs.071a3e2",
|
|
40
|
+
"@dxos/local-storage": "0.7.5-labs.071a3e2",
|
|
41
|
+
"@dxos/echo-schema": "0.7.5-labs.071a3e2",
|
|
42
|
+
"@dxos/log": "0.7.5-labs.071a3e2",
|
|
43
|
+
"@dxos/plugin-graph": "0.7.5-labs.071a3e2",
|
|
44
|
+
"@dxos/plugin-observability": "0.7.5-labs.071a3e2",
|
|
45
|
+
"@dxos/react-ui": "0.7.5-labs.071a3e2",
|
|
46
|
+
"@dxos/react-client": "0.7.5-labs.071a3e2",
|
|
47
|
+
"@dxos/shell": "0.7.5-labs.071a3e2",
|
|
48
|
+
"@dxos/util": "0.7.5-labs.071a3e2"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
51
|
+
"@phosphor-icons/react": "^2.1.5",
|
|
49
52
|
"@types/react": "~18.2.0",
|
|
50
53
|
"@types/react-dom": "~18.2.0",
|
|
51
54
|
"react": "~18.2.0",
|
|
52
55
|
"react-dom": "~18.2.0",
|
|
53
56
|
"vite": "5.4.7",
|
|
54
|
-
"@dxos/storybook-utils": "0.7.
|
|
57
|
+
"@dxos/storybook-utils": "0.7.5-labs.071a3e2"
|
|
55
58
|
},
|
|
56
59
|
"peerDependencies": {
|
|
57
60
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes, defineModule, definePlugin, Events, oneOf } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { Client, AppGraphBuilder, IntentResolver, ReactContext, ReactSurface, Schema } from './capabilities';
|
|
8
|
+
import { ClientEvents } from './events';
|
|
9
|
+
import { meta } from './meta';
|
|
10
|
+
import translations from './translations';
|
|
11
|
+
import { type ClientPluginOptions } from './types';
|
|
12
|
+
|
|
13
|
+
export const ClientPlugin = ({
|
|
14
|
+
invitationUrl = window.location.origin,
|
|
15
|
+
invitationParam = 'deviceInvitationCode',
|
|
16
|
+
onReset,
|
|
17
|
+
...options
|
|
18
|
+
}: ClientPluginOptions) => {
|
|
19
|
+
const createInvitationUrl = (invitationCode: string) => {
|
|
20
|
+
const baseUrl = new URL(invitationUrl);
|
|
21
|
+
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
22
|
+
return baseUrl.toString();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return definePlugin(meta, [
|
|
26
|
+
defineModule({
|
|
27
|
+
id: `${meta.id}/module/client`,
|
|
28
|
+
activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
|
|
29
|
+
activatesAfter: [ClientEvents.ClientReady],
|
|
30
|
+
activate: (context) => Client({ ...options, context }),
|
|
31
|
+
}),
|
|
32
|
+
defineModule({
|
|
33
|
+
id: `${meta.id}/module/schema`,
|
|
34
|
+
activatesOn: ClientEvents.ClientReady,
|
|
35
|
+
activatesBefore: [ClientEvents.SetupSchema],
|
|
36
|
+
activate: Schema,
|
|
37
|
+
}),
|
|
38
|
+
defineModule({
|
|
39
|
+
id: `${meta.id}/module/react-context`,
|
|
40
|
+
activatesOn: Events.Startup,
|
|
41
|
+
activate: ReactContext,
|
|
42
|
+
}),
|
|
43
|
+
defineModule({
|
|
44
|
+
id: `${meta.id}/module/react-surface`,
|
|
45
|
+
activatesOn: Events.SetupSurfaces,
|
|
46
|
+
activate: () => ReactSurface({ createInvitationUrl }),
|
|
47
|
+
}),
|
|
48
|
+
defineModule({
|
|
49
|
+
id: `${meta.id}/module/app-graph-builder`,
|
|
50
|
+
activatesOn: Events.SetupAppGraph,
|
|
51
|
+
activate: AppGraphBuilder,
|
|
52
|
+
}),
|
|
53
|
+
defineModule({
|
|
54
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
55
|
+
activatesOn: Events.SetupIntents,
|
|
56
|
+
activate: (context) => IntentResolver({ context, onReset }),
|
|
57
|
+
}),
|
|
58
|
+
defineModule({
|
|
59
|
+
id: `${meta.id}/module/translations`,
|
|
60
|
+
activatesOn: Events.SetupTranslations,
|
|
61
|
+
activate: () => contributes(Capabilities.Translations, translations),
|
|
62
|
+
}),
|
|
63
|
+
]);
|
|
64
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createIntent } from '@dxos/app-framework';
|
|
6
|
+
import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
|
|
7
|
+
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
8
|
+
|
|
9
|
+
import { CLIENT_PLUGIN } from '../meta';
|
|
10
|
+
import { ClientAction } from '../types';
|
|
11
|
+
|
|
12
|
+
export default (context: PluginsContext) =>
|
|
13
|
+
contributes(
|
|
14
|
+
Capabilities.AppGraphBuilder,
|
|
15
|
+
createExtension({
|
|
16
|
+
id: CLIENT_PLUGIN,
|
|
17
|
+
filter: (node): node is Node<null> => node.id === 'root',
|
|
18
|
+
actions: () => [
|
|
19
|
+
{
|
|
20
|
+
id: `${CLIENT_PLUGIN}/open-shell`,
|
|
21
|
+
data: async () => {
|
|
22
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
23
|
+
await dispatch(createIntent(ClientAction.ShareIdentity));
|
|
24
|
+
},
|
|
25
|
+
properties: {
|
|
26
|
+
label: ['open shell label', { ns: CLIENT_PLUGIN }],
|
|
27
|
+
icon: 'ph--address-book--regular',
|
|
28
|
+
keyBinding: {
|
|
29
|
+
macos: 'meta+shift+.',
|
|
30
|
+
// TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
|
|
31
|
+
windows: 'alt+shift+.',
|
|
32
|
+
linux: 'alt+shift+>',
|
|
33
|
+
},
|
|
34
|
+
testId: 'clientPlugin.openShell',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
+
import { type TypedObject } from '@dxos/echo-schema';
|
|
7
|
+
import { type Client } from '@dxos/react-client';
|
|
8
|
+
|
|
9
|
+
import { CLIENT_PLUGIN } from '../meta';
|
|
10
|
+
|
|
11
|
+
export namespace ClientCapabilities {
|
|
12
|
+
export const Client = defineCapability<Client>(`${CLIENT_PLUGIN}/capability/client`);
|
|
13
|
+
export const Schema = defineCapability<TypedObject[]>(`${CLIENT_PLUGIN}/capability/schema`);
|
|
14
|
+
// TODO(wittjosiah): Rename this. Reserve "system" nomenclature for internal use.
|
|
15
|
+
export const SystemSchema = defineCapability<TypedObject[]>(`${CLIENT_PLUGIN}/capability/system-schema`);
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { contributes, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
+
import { Config, Defaults, Envs, Local, Storage } from '@dxos/config';
|
|
7
|
+
import { Client } from '@dxos/react-client';
|
|
8
|
+
|
|
9
|
+
import { ClientCapabilities } from './capabilities';
|
|
10
|
+
import { ClientEvents } from '../events';
|
|
11
|
+
import { type ClientPluginOptions } from '../types';
|
|
12
|
+
|
|
13
|
+
type ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {
|
|
14
|
+
context: PluginsContext;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {
|
|
18
|
+
const config = new Config(await Storage(), Envs(), Local(), Defaults());
|
|
19
|
+
const client = new Client({ config, ...options });
|
|
20
|
+
await client.initialize();
|
|
21
|
+
await onClientInitialized?.(context, client);
|
|
22
|
+
|
|
23
|
+
// TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.
|
|
24
|
+
client.reloaded.on(() => {
|
|
25
|
+
client.halo.identity.subscribe(async (identity) => {
|
|
26
|
+
if (identity) {
|
|
27
|
+
window.location.href = window.location.origin;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const subscription = client.spaces.isReady.subscribe(async (ready) => {
|
|
33
|
+
if (ready) {
|
|
34
|
+
await context.activate(ClientEvents.SpacesReady);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return contributes(ClientCapabilities.Client, client, async () => {
|
|
39
|
+
subscription.unsubscribe();
|
|
40
|
+
await client.destroy();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { lazy } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
export const AppGraphBuilder = lazy(async () => import('./app-graph-builder'));
|
|
8
|
+
export const Client = lazy(async () => import('./client'));
|
|
9
|
+
export const IntentResolver = lazy(async () => import('./intent-resolver'));
|
|
10
|
+
export const ReactContext = lazy(async () => import('./react-context'));
|
|
11
|
+
export const ReactSurface = lazy(async () => import('./react-surface'));
|
|
12
|
+
export const Schema = lazy(async () => import('./schema'));
|
|
13
|
+
|
|
14
|
+
export * from './capabilities';
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Capabilities,
|
|
7
|
+
contributes,
|
|
8
|
+
createIntent,
|
|
9
|
+
createResolver,
|
|
10
|
+
LayoutAction,
|
|
11
|
+
type PluginsContext,
|
|
12
|
+
} from '@dxos/app-framework';
|
|
13
|
+
import { invariant } from '@dxos/invariant';
|
|
14
|
+
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
15
|
+
import { type JoinPanelProps } from '@dxos/shell/react';
|
|
16
|
+
|
|
17
|
+
import { ClientCapabilities } from './capabilities';
|
|
18
|
+
import { IDENTITY_DIALOG, JOIN_DIALOG, RECOVER_CODE_DIALOG } from '../components';
|
|
19
|
+
import { ClientEvents } from '../events';
|
|
20
|
+
import { ClientAction, type ClientPluginOptions } from '../types';
|
|
21
|
+
|
|
22
|
+
type IntentResolverOptions = Pick<ClientPluginOptions, 'onReset'> & {
|
|
23
|
+
context: PluginsContext;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default ({ context, onReset }: IntentResolverOptions) =>
|
|
27
|
+
contributes(Capabilities.IntentResolver, [
|
|
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
|
+
},
|
|
37
|
+
}),
|
|
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
|
+
},
|
|
57
|
+
}),
|
|
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
|
+
},
|
|
74
|
+
}),
|
|
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
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
createResolver({
|
|
95
|
+
intent: ClientAction.ResetStorage,
|
|
96
|
+
resolve: async (data) => {
|
|
97
|
+
await onReset?.({ target: data.target });
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
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
|
+
},
|
|
107
|
+
}),
|
|
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
|
+
},
|
|
129
|
+
}),
|
|
130
|
+
]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
|
|
8
|
+
import { ClientProvider } from '@dxos/react-client';
|
|
9
|
+
|
|
10
|
+
import { ClientCapabilities } from './capabilities';
|
|
11
|
+
import { CLIENT_PLUGIN } from '../meta';
|
|
12
|
+
|
|
13
|
+
export default () =>
|
|
14
|
+
contributes(Capabilities.ReactContext, {
|
|
15
|
+
id: CLIENT_PLUGIN,
|
|
16
|
+
context: ({ children }) => {
|
|
17
|
+
const client = useCapability(ClientCapabilities.Client);
|
|
18
|
+
return <ClientProvider client={client}>{children}</ClientProvider>;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { createSurface, Capabilities, contributes } from '@dxos/app-framework';
|
|
8
|
+
import { type IdentityPanelProps, type JoinPanelProps } from '@dxos/shell/react';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
IDENTITY_DIALOG,
|
|
12
|
+
IdentityDialog,
|
|
13
|
+
JOIN_DIALOG,
|
|
14
|
+
JoinDialog,
|
|
15
|
+
RECOVER_CODE_DIALOG,
|
|
16
|
+
RecoveryCodeDialog,
|
|
17
|
+
type RecoveryCodeDialogProps,
|
|
18
|
+
} from '../components';
|
|
19
|
+
|
|
20
|
+
type ReactSurfaceOptions = {
|
|
21
|
+
createInvitationUrl: (invitationCode: string) => string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
25
|
+
contributes(Capabilities.ReactSurface, [
|
|
26
|
+
createSurface({
|
|
27
|
+
id: IDENTITY_DIALOG,
|
|
28
|
+
role: 'dialog',
|
|
29
|
+
filter: (data): data is { props: IdentityPanelProps } => data.component === IDENTITY_DIALOG,
|
|
30
|
+
component: ({ data }) => <IdentityDialog {...data.props} createInvitationUrl={createInvitationUrl} />,
|
|
31
|
+
}),
|
|
32
|
+
createSurface({
|
|
33
|
+
id: JOIN_DIALOG,
|
|
34
|
+
role: 'dialog',
|
|
35
|
+
filter: (data): data is { props: JoinPanelProps } => data.component === JOIN_DIALOG,
|
|
36
|
+
component: ({ data }) => <JoinDialog {...data.props} />,
|
|
37
|
+
}),
|
|
38
|
+
createSurface({
|
|
39
|
+
id: RECOVER_CODE_DIALOG,
|
|
40
|
+
role: 'dialog',
|
|
41
|
+
filter: (data): data is { props: RecoveryCodeDialogProps } => data.component === RECOVER_CODE_DIALOG,
|
|
42
|
+
component: ({ data }) => <RecoveryCodeDialog {...data.props} />,
|
|
43
|
+
}),
|
|
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
|
+
};
|
|
@@ -4,42 +4,44 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { LayoutAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
7
|
+
import { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { useClient } from '@dxos/react-client';
|
|
9
9
|
import { Clipboard, Dialog } from '@dxos/react-ui';
|
|
10
10
|
import { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { CLIENT_PLUGIN } from '../meta';
|
|
13
|
+
import { ClientAction } from '../types';
|
|
14
|
+
|
|
15
|
+
export const IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;
|
|
13
16
|
|
|
14
17
|
export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
15
|
-
const dispatch = useIntentDispatcher();
|
|
18
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
16
19
|
const client = useClient();
|
|
17
20
|
|
|
18
21
|
const handleDone = useCallback(
|
|
19
22
|
() =>
|
|
20
|
-
dispatch(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}),
|
|
23
|
+
dispatch(
|
|
24
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
25
|
+
part: 'dialog',
|
|
26
|
+
options: { state: false },
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
27
29
|
[dispatch],
|
|
28
30
|
);
|
|
29
31
|
|
|
30
32
|
const handleResetStorage = useCallback(async () => {
|
|
31
33
|
await client.reset();
|
|
32
|
-
await dispatch(
|
|
34
|
+
await dispatch(createIntent(ClientAction.ResetStorage));
|
|
33
35
|
}, [dispatch]);
|
|
34
36
|
|
|
35
37
|
const handleRecover = useCallback(async () => {
|
|
36
38
|
await client.reset();
|
|
37
|
-
await dispatch(
|
|
39
|
+
await dispatch(createIntent(ClientAction.ResetStorage, { target: 'recoverIdentity' }));
|
|
38
40
|
}, [dispatch]);
|
|
39
41
|
|
|
40
42
|
const handleJoinNewIdentity = useCallback(async () => {
|
|
41
43
|
await client.reset();
|
|
42
|
-
await dispatch(
|
|
44
|
+
await dispatch(createIntent(ClientAction.ResetStorage, { target: 'deviceInvitation' }));
|
|
43
45
|
}, [dispatch]);
|
|
44
46
|
|
|
45
47
|
return (
|