@dxos/plugin-client 0.9.0 → 0.9.1-main.c7dcc2e112

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 (190) hide show
  1. package/dist/lib/neutral/{AccountContainer-FZ3IC6H4.mjs → AccountContainer-LIMGLO2Y.mjs} +3 -3
  2. package/dist/lib/neutral/AccountContainer-LIMGLO2Y.mjs.map +7 -0
  3. package/dist/lib/neutral/ClientPlugin.node.mjs +477 -370
  4. package/dist/lib/neutral/ClientPlugin.node.mjs.map +4 -4
  5. package/dist/lib/neutral/{DevicesContainer-6MWNUC3I.mjs → DevicesContainer-X26OGLFK.mjs} +12 -12
  6. package/dist/lib/neutral/DevicesContainer-X26OGLFK.mjs.map +7 -0
  7. package/dist/lib/neutral/{InvitationsContainer-ME722VKS.mjs → InvitationsContainer-OBBCJ7CJ.mjs} +2 -2
  8. package/dist/lib/neutral/InvitationsContainer-OBBCJ7CJ.mjs.map +7 -0
  9. package/dist/lib/neutral/{JoinDialog-2NXAKPLP.mjs → JoinDialog-4BWV4CYB.mjs} +2 -2
  10. package/dist/lib/neutral/JoinDialog-4BWV4CYB.mjs.map +7 -0
  11. package/dist/lib/neutral/{ProfileContainer-VPX3FPWG.mjs → ProfileContainer-FGS2MVWA.mjs} +2 -2
  12. package/dist/lib/neutral/ProfileContainer-FGS2MVWA.mjs.map +7 -0
  13. package/dist/lib/neutral/{RecoveryCodeDialog-EWHB6U5T.mjs → RecoveryCodeDialog-7EPNKCLB.mjs} +2 -2
  14. package/dist/lib/neutral/RecoveryCodeDialog-7EPNKCLB.mjs.map +7 -0
  15. package/dist/lib/neutral/{RecoveryCredentialsContainer-IPBGDMIA.mjs → RecoveryCredentialsContainer-SL4LYHBE.mjs} +3 -3
  16. package/dist/lib/neutral/RecoveryCredentialsContainer-SL4LYHBE.mjs.map +7 -0
  17. package/dist/lib/neutral/UsageContainer-HBPMLIK7.mjs +226 -0
  18. package/dist/lib/neutral/UsageContainer-HBPMLIK7.mjs.map +7 -0
  19. package/dist/lib/neutral/{app-graph-builder-A74W7C36.mjs → app-graph-builder-FTXJNX37.mjs} +28 -14
  20. package/dist/lib/neutral/app-graph-builder-FTXJNX37.mjs.map +7 -0
  21. package/dist/lib/neutral/capabilities/index.mjs +5 -5
  22. package/dist/lib/neutral/capabilities/node.mjs +3 -3
  23. package/dist/lib/neutral/chunk-54MDDWCV.mjs +8 -0
  24. package/dist/lib/neutral/{chunk-NTVDGDQ3.mjs.map → chunk-54MDDWCV.mjs.map} +2 -2
  25. package/dist/lib/neutral/chunk-6G4KZLBG.mjs +28 -0
  26. package/dist/lib/neutral/chunk-6G4KZLBG.mjs.map +7 -0
  27. package/dist/lib/neutral/{chunk-D6HPCLTS.mjs → chunk-7DEIKHB7.mjs} +16 -2
  28. package/dist/lib/neutral/chunk-7DEIKHB7.mjs.map +7 -0
  29. package/dist/lib/neutral/{chunk-TUK3ELUU.mjs → chunk-DA3LZQSD.mjs} +22 -21
  30. package/dist/lib/neutral/chunk-DA3LZQSD.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-GSKMAS3S.mjs +13 -0
  32. package/dist/lib/neutral/chunk-GSKMAS3S.mjs.map +7 -0
  33. package/dist/lib/neutral/containers/index.mjs +10 -8
  34. package/dist/lib/neutral/containers/index.mjs.map +3 -3
  35. package/dist/lib/neutral/{create-agent-6HLW4D3A.mjs → create-agent-U567RM7Z.mjs} +3 -3
  36. package/dist/lib/neutral/{create-identity-JIWAR5GW.mjs → create-identity-IKN2FJ5B.mjs} +3 -3
  37. package/dist/lib/neutral/{create-passkey-FOXEMXGF.mjs → create-passkey-JAD3ACY7.mjs} +7 -7
  38. package/dist/lib/neutral/create-passkey-JAD3ACY7.mjs.map +7 -0
  39. package/dist/lib/neutral/{create-recovery-code-ZWDKLPH4.mjs → create-recovery-code-JZYXR4BY.mjs} +4 -4
  40. package/dist/lib/neutral/index.mjs +4 -4
  41. package/dist/lib/neutral/{join-identity-QEQFAE2S.mjs → join-identity-PJCHDNLH.mjs} +3 -3
  42. package/dist/lib/neutral/{layer-specs-CQLXQBQJ.mjs → layer-specs-VQCJLV33.mjs} +2 -2
  43. package/dist/lib/neutral/{layer-specs-CQLXQBQJ.mjs.map → layer-specs-VQCJLV33.mjs.map} +2 -2
  44. package/dist/lib/neutral/meta.json +1 -1
  45. package/dist/lib/neutral/meta.mjs +1 -1
  46. package/dist/lib/neutral/{navigation-handler-LU26CDFR.mjs → navigation-handler-MPJAVHWY.mjs} +3 -3
  47. package/dist/lib/neutral/open-usage-24I7RAFL.mjs +27 -0
  48. package/dist/lib/neutral/open-usage-24I7RAFL.mjs.map +7 -0
  49. package/dist/lib/neutral/operations/index.mjs +2 -2
  50. package/dist/lib/neutral/plugin.mjs +3 -3
  51. package/dist/lib/neutral/{react-context-B5LXMHVM.mjs → react-context-V74T6JOJ.mjs} +2 -2
  52. package/dist/lib/neutral/{react-context-B5LXMHVM.mjs.map → react-context-V74T6JOJ.mjs.map} +3 -3
  53. package/dist/lib/neutral/{react-surface-DEKGWTCD.mjs → react-surface-HPXRA65U.mjs} +8 -3
  54. package/dist/lib/neutral/react-surface-HPXRA65U.mjs.map +7 -0
  55. package/dist/lib/neutral/{recover-identity-JNFKLCUD.mjs → recover-identity-B7YM2BR4.mjs} +3 -3
  56. package/dist/lib/neutral/{redeem-passkey-4SBAI4AG.mjs → redeem-passkey-4DR7GPMU.mjs} +10 -10
  57. package/dist/lib/neutral/redeem-passkey-4DR7GPMU.mjs.map +7 -0
  58. package/dist/lib/neutral/{redeem-token-POBD6TMN.mjs → redeem-token-N5MBQG3I.mjs} +3 -3
  59. package/dist/lib/neutral/{reset-storage-LQKUV5RA.mjs → reset-storage-K47HZTGP.mjs} +3 -3
  60. package/dist/lib/neutral/{share-identity-KNQ2XNXV.mjs → share-identity-YJIFDIPJ.mjs} +6 -6
  61. package/dist/lib/neutral/share-identity-YJIFDIPJ.mjs.map +7 -0
  62. package/dist/lib/neutral/testing/index.mjs +2 -2
  63. package/dist/lib/neutral/testing/index.mjs.map +3 -3
  64. package/dist/lib/neutral/translations.mjs +24 -1
  65. package/dist/lib/neutral/translations.mjs.map +3 -3
  66. package/dist/lib/neutral/types/index.mjs +1 -1
  67. package/dist/types/dx.config.d.ts +28 -0
  68. package/dist/types/dx.config.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/index.d.ts +9 -43
  70. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  71. package/dist/types/src/capabilities/navigation-handler/index.d.ts +1 -1
  72. package/dist/types/src/capabilities/navigation-handler/index.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/node.d.ts +6 -6
  74. package/dist/types/src/capabilities/node.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/react-surface.d.ts +2 -2
  76. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  77. package/dist/types/src/commands/account/index.d.ts +3 -0
  78. package/dist/types/src/commands/account/index.d.ts.map +1 -0
  79. package/dist/types/src/commands/account/login/index.d.ts +2 -0
  80. package/dist/types/src/commands/account/login/index.d.ts.map +1 -0
  81. package/dist/types/src/commands/account/login/login.d.ts +12 -0
  82. package/dist/types/src/commands/account/login/login.d.ts.map +1 -0
  83. package/dist/types/src/commands/account/logout/index.d.ts +2 -0
  84. package/dist/types/src/commands/account/logout/index.d.ts.map +1 -0
  85. package/dist/types/src/commands/account/logout/logout.d.ts +9 -0
  86. package/dist/types/src/commands/account/logout/logout.d.ts.map +1 -0
  87. package/dist/types/src/commands/halo/join/join.d.ts +1 -1
  88. package/dist/types/src/commands/halo/join/join.d.ts.map +1 -1
  89. package/dist/types/src/commands/halo/util.d.ts +4 -0
  90. package/dist/types/src/commands/halo/util.d.ts.map +1 -1
  91. package/dist/types/src/commands/index.d.ts +1 -0
  92. package/dist/types/src/commands/index.d.ts.map +1 -1
  93. package/dist/types/src/constants.d.ts.map +1 -1
  94. package/dist/types/src/containers/DevicesContainer/DevicesContainer.d.ts.map +1 -1
  95. package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.d.ts.map +1 -1
  96. package/dist/types/src/containers/UsageContainer/UsageContainer.d.ts +7 -0
  97. package/dist/types/src/containers/UsageContainer/UsageContainer.d.ts.map +1 -0
  98. package/dist/types/src/containers/UsageContainer/UsageView.d.ts +19 -0
  99. package/dist/types/src/containers/UsageContainer/UsageView.d.ts.map +1 -0
  100. package/dist/types/src/containers/UsageContainer/UsageView.stories.d.ts +19 -0
  101. package/dist/types/src/containers/UsageContainer/UsageView.stories.d.ts.map +1 -0
  102. package/dist/types/src/containers/UsageContainer/index.d.ts +2 -0
  103. package/dist/types/src/containers/UsageContainer/index.d.ts.map +1 -0
  104. package/dist/types/src/containers/index.d.ts +1 -0
  105. package/dist/types/src/containers/index.d.ts.map +1 -1
  106. package/dist/types/src/meta.d.ts +28 -2
  107. package/dist/types/src/meta.d.ts.map +1 -1
  108. package/dist/types/src/operations/create-passkey.d.ts.map +1 -1
  109. package/dist/types/src/operations/definitions.d.ts +1 -0
  110. package/dist/types/src/operations/definitions.d.ts.map +1 -1
  111. package/dist/types/src/operations/index.d.ts.map +1 -1
  112. package/dist/types/src/operations/open-usage.d.ts +5 -0
  113. package/dist/types/src/operations/open-usage.d.ts.map +1 -0
  114. package/dist/types/src/testing/initializeIdentity.d.ts.map +1 -1
  115. package/dist/types/src/translations.d.ts.map +1 -1
  116. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  117. package/dist/types/src/types/events.d.ts.map +1 -1
  118. package/dist/types/src/types/schema.d.ts +1 -0
  119. package/dist/types/src/types/schema.d.ts.map +1 -1
  120. package/dist/types/tsconfig.tsbuildinfo +1 -1
  121. package/dx.config.ts +19 -0
  122. package/package.json +37 -35
  123. package/src/ClientPlugin.node.ts +2 -2
  124. package/src/ClientPlugin.test.ts +1 -1
  125. package/src/capabilities/app-graph-builder.ts +22 -13
  126. package/src/capabilities/layer-specs.ts +1 -1
  127. package/src/capabilities/react-context.tsx +1 -1
  128. package/src/capabilities/react-surface.tsx +6 -0
  129. package/src/commands/account/index.ts +13 -0
  130. package/src/commands/account/login/index.ts +5 -0
  131. package/src/commands/account/login/login.ts +147 -0
  132. package/src/commands/account/logout/index.ts +5 -0
  133. package/src/commands/account/logout/logout.ts +49 -0
  134. package/src/commands/halo/create/create.ts +2 -2
  135. package/src/commands/halo/index.ts +6 -6
  136. package/src/commands/halo/join/join.ts +2 -13
  137. package/src/commands/halo/util.ts +24 -0
  138. package/src/commands/index.ts +1 -0
  139. package/src/constants.ts +3 -3
  140. package/src/containers/AccountContainer/AccountContainer.tsx +1 -1
  141. package/src/containers/DevicesContainer/DevicesContainer.tsx +14 -11
  142. package/src/containers/InvitationsContainer/InvitationsContainer.tsx +1 -1
  143. package/src/containers/JoinDialog/JoinDialog.tsx +1 -1
  144. package/src/containers/ProfileContainer/ProfileContainer.tsx +1 -1
  145. package/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.tsx +1 -1
  146. package/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.tsx +2 -2
  147. package/src/containers/UsageContainer/UsageContainer.tsx +47 -0
  148. package/src/containers/UsageContainer/UsageView.stories.tsx +114 -0
  149. package/src/containers/UsageContainer/UsageView.tsx +238 -0
  150. package/src/containers/UsageContainer/index.ts +5 -0
  151. package/src/containers/index.ts +1 -0
  152. package/src/meta.ts +3 -12
  153. package/src/operations/create-passkey.ts +6 -4
  154. package/src/operations/definitions.ts +12 -1
  155. package/src/operations/index.ts +1 -0
  156. package/src/operations/open-usage.ts +24 -0
  157. package/src/operations/redeem-passkey.ts +7 -7
  158. package/src/operations/share-identity.ts +3 -3
  159. package/src/testing/initializeIdentity.ts +4 -2
  160. package/src/translations.ts +25 -1
  161. package/src/types/capabilities.ts +7 -5
  162. package/src/types/events.ts +5 -5
  163. package/src/types/schema.ts +23 -16
  164. package/dist/lib/neutral/AccountContainer-FZ3IC6H4.mjs.map +0 -7
  165. package/dist/lib/neutral/DevicesContainer-6MWNUC3I.mjs.map +0 -7
  166. package/dist/lib/neutral/InvitationsContainer-ME722VKS.mjs.map +0 -7
  167. package/dist/lib/neutral/JoinDialog-2NXAKPLP.mjs.map +0 -7
  168. package/dist/lib/neutral/ProfileContainer-VPX3FPWG.mjs.map +0 -7
  169. package/dist/lib/neutral/RecoveryCodeDialog-EWHB6U5T.mjs.map +0 -7
  170. package/dist/lib/neutral/RecoveryCredentialsContainer-IPBGDMIA.mjs.map +0 -7
  171. package/dist/lib/neutral/app-graph-builder-A74W7C36.mjs.map +0 -7
  172. package/dist/lib/neutral/chunk-D6HPCLTS.mjs.map +0 -7
  173. package/dist/lib/neutral/chunk-JOCCVODY.mjs +0 -21
  174. package/dist/lib/neutral/chunk-JOCCVODY.mjs.map +0 -7
  175. package/dist/lib/neutral/chunk-NTVDGDQ3.mjs +0 -8
  176. package/dist/lib/neutral/chunk-TUK3ELUU.mjs.map +0 -7
  177. package/dist/lib/neutral/chunk-WWCVZG3K.mjs +0 -13
  178. package/dist/lib/neutral/chunk-WWCVZG3K.mjs.map +0 -7
  179. package/dist/lib/neutral/create-passkey-FOXEMXGF.mjs.map +0 -7
  180. package/dist/lib/neutral/react-surface-DEKGWTCD.mjs.map +0 -7
  181. package/dist/lib/neutral/redeem-passkey-4SBAI4AG.mjs.map +0 -7
  182. package/dist/lib/neutral/share-identity-KNQ2XNXV.mjs.map +0 -7
  183. /package/dist/lib/neutral/{create-agent-6HLW4D3A.mjs.map → create-agent-U567RM7Z.mjs.map} +0 -0
  184. /package/dist/lib/neutral/{create-identity-JIWAR5GW.mjs.map → create-identity-IKN2FJ5B.mjs.map} +0 -0
  185. /package/dist/lib/neutral/{create-recovery-code-ZWDKLPH4.mjs.map → create-recovery-code-JZYXR4BY.mjs.map} +0 -0
  186. /package/dist/lib/neutral/{join-identity-QEQFAE2S.mjs.map → join-identity-PJCHDNLH.mjs.map} +0 -0
  187. /package/dist/lib/neutral/{navigation-handler-LU26CDFR.mjs.map → navigation-handler-MPJAVHWY.mjs.map} +0 -0
  188. /package/dist/lib/neutral/{recover-identity-JNFKLCUD.mjs.map → recover-identity-B7YM2BR4.mjs.map} +0 -0
  189. /package/dist/lib/neutral/{redeem-token-POBD6TMN.mjs.map → redeem-token-N5MBQG3I.mjs.map} +0 -0
  190. /package/dist/lib/neutral/{reset-storage-LQKUV5RA.mjs.map → reset-storage-K47HZTGP.mjs.map} +0 -0
@@ -1,54 +1,259 @@
1
1
  import "./chunk-J5LGTIGS.mjs";
2
2
 
3
3
  // src/ClientPlugin.node.ts
4
- import { ActivationEvents, Capability, Plugin as Plugin2 } from "@dxos/app-framework";
4
+ import { ActivationEvents, Capability, Plugin } from "@dxos/app-framework";
5
5
  import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
6
6
  import { Client, LayerSpecs, Migrations, OperationHandler, SchemaDefs } from "#capabilities";
7
7
  import { meta } from "#meta";
8
8
  import { ClientEvents } from "#types";
9
9
 
10
- // src/commands/config/index.ts
11
- import * as Command2 from "@effect/cli/Command";
10
+ // src/commands/account/index.ts
11
+ import * as Command3 from "@effect/cli/Command";
12
12
 
13
- // src/commands/config/view.ts
13
+ // src/commands/account/login/login.ts
14
+ import * as Args from "@effect/cli/Args";
14
15
  import * as Command from "@effect/cli/Command";
16
+ import * as Options from "@effect/cli/Options";
17
+ import * as Prompt from "@effect/cli/Prompt";
15
18
  import * as Console from "effect/Console";
19
+ import * as Effect2 from "effect/Effect";
20
+ import * as Match from "effect/Match";
21
+ import * as Option from "effect/Option";
22
+ import { CommandConfig, performRecoveryOAuthFlow, print } from "@dxos/cli-util";
23
+ import { ClientService } from "@dxos/client";
24
+ import { Invitation as Invitation2, InvitationEncoder } from "@dxos/client/invitations";
25
+ import { Context as DxContext } from "@dxos/context";
26
+ import { HubHttpClient } from "@dxos/edge-client";
27
+ import { invariant } from "@dxos/invariant";
28
+ import { ATPROTO_OAUTH_SCOPES, OAuthProvider } from "@dxos/protocols";
29
+
30
+ // src/commands/halo/util.ts
31
+ import * as Duration from "effect/Duration";
16
32
  import * as Effect from "effect/Effect";
33
+ import { FormBuilder } from "@dxos/cli-util";
34
+ import { Invitation } from "@dxos/client/invitations";
35
+ var printIdentity = (identity2) => FormBuilder.make({
36
+ title: "Identity"
37
+ }).pipe(FormBuilder.set("identityDid", identity2.identityDid), FormBuilder.set("displayName", identity2.profile?.displayName ?? "<none>"), FormBuilder.build);
38
+ var TERMINAL_FAILURE_STATES = /* @__PURE__ */ new Set([
39
+ Invitation.State.CANCELLED,
40
+ Invitation.State.TIMEOUT,
41
+ Invitation.State.ERROR,
42
+ Invitation.State.EXPIRED
43
+ ]);
44
+ var waitForState = (invitation, state) => Effect.async((resume) => {
45
+ const subscription = invitation.subscribe((inv) => {
46
+ if (inv.state === state) {
47
+ resume(Effect.void);
48
+ } else if (TERMINAL_FAILURE_STATES.has(inv.state)) {
49
+ resume(Effect.fail(new Error(`Invitation failed with state: ${Invitation.State[inv.state]}`)));
50
+ }
51
+ });
52
+ return Effect.sync(() => subscription.unsubscribe());
53
+ }).pipe(Effect.timeout(Duration.minutes(3)));
54
+
55
+ // src/commands/account/login/login.ts
56
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/account/login/login.ts";
57
+ var LOGIN_METHODS = [
58
+ "email",
59
+ "atproto",
60
+ "device-invitation",
61
+ "recovery-code"
62
+ ];
63
+ var METHOD_CHOICES = [
64
+ {
65
+ title: "Email",
66
+ value: "email"
67
+ },
68
+ {
69
+ title: "AT Protocol",
70
+ value: "atproto"
71
+ },
72
+ {
73
+ title: "Device invitation",
74
+ value: "device-invitation"
75
+ },
76
+ {
77
+ title: "Recovery code",
78
+ value: "recovery-code"
79
+ }
80
+ ];
81
+ var INPUT_PROMPT = {
82
+ email: "Email address",
83
+ atproto: "atproto handle or DID (e.g. alice.bsky.social)",
84
+ "device-invitation": "Invitation code or URL",
85
+ "recovery-code": "Recovery code (seed phrase)"
86
+ };
87
+ var login = Command.make("login", {
88
+ method: Options.choice("method", LOGIN_METHODS).pipe(Options.withDescription("Login method (email | atproto | device-invitation | recovery-code). Prompted if omitted."), Options.optional),
89
+ input: Args.text({
90
+ name: "input"
91
+ }).pipe(Args.withDescription("Method input: email address / atproto handle / invitation code / recovery code."), Args.optional)
92
+ }, Effect2.fn(function* ({ method, input }) {
93
+ const { json } = yield* CommandConfig;
94
+ const client = yield* ClientService;
95
+ invariant(!client.halo.identity.get(), "Already logged in. Run `dx account logout` first.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 59, S: this, A: ["!client.halo.identity.get()", "'Already logged in. Run `dx account logout` first.'"] });
96
+ const resolvedMethod = Option.isSome(method) ? method.value : yield* Prompt.select({
97
+ message: "Choose a login method:",
98
+ choices: METHOD_CHOICES
99
+ }).pipe(Prompt.run);
100
+ const resolvedInput = Option.isSome(input) ? input.value : yield* Prompt.text({
101
+ message: `${INPUT_PROMPT[resolvedMethod]}:`
102
+ }).pipe(Prompt.run);
103
+ const identity2 = yield* Match.value(resolvedMethod).pipe(Match.when("atproto", () => loginWithAtproto(client, resolvedInput)), Match.when("email", () => loginWithEmail(client, resolvedInput)), Match.when("recovery-code", () => loginWithRecoveryCode(client, resolvedInput)), Match.when("device-invitation", () => loginWithDeviceInvitation(client, resolvedInput)), Match.exhaustive);
104
+ if (json) {
105
+ yield* Console.log(JSON.stringify({
106
+ identityDid: identity2.did,
107
+ displayName: identity2.profile?.displayName
108
+ }, null, 2));
109
+ } else {
110
+ yield* Console.log("Logged in successfully");
111
+ yield* Console.log(print(printIdentity({
112
+ identityDid: identity2.did,
113
+ profile: identity2.profile
114
+ })));
115
+ }
116
+ })).pipe(Command.withDescription("Log in to an existing DXOS identity (same methods as Composer)."));
117
+ var loginWithAtproto = (client, handle) => Effect2.gen(function* () {
118
+ const edgeBaseUrl = client.config.values.runtime?.services?.edge?.url;
119
+ invariant(edgeBaseUrl, "Edge services not configured (runtime.services.edge.url).", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 86, S: this, A: ["edgeBaseUrl", "'Edge services not configured (runtime.services.edge.url).'"] });
120
+ const { recoveryProof } = yield* performRecoveryOAuthFlow({
121
+ edgeBaseUrl,
122
+ provider: OAuthProvider.ATPROTO,
123
+ scopes: ATPROTO_OAUTH_SCOPES,
124
+ loginHint: handle
125
+ });
126
+ return yield* Effect2.tryPromise(() => client.halo.recoverIdentity({
127
+ recoveryProof
128
+ }));
129
+ });
130
+ var loginWithRecoveryCode = (client, recoveryCode) => Effect2.tryPromise(() => client.halo.recoverIdentity({
131
+ recoveryCode
132
+ }));
133
+ var loginWithEmail = (client, email) => Effect2.gen(function* () {
134
+ const hubUrl = client.config.values?.runtime?.app?.env?.DX_HUB_URL;
135
+ invariant(hubUrl, "Hub URL not configured (runtime.app.env.DX_HUB_URL).", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 105, S: this, A: ["hubUrl", "'Hub URL not configured (runtime.app.env.DX_HUB_URL).'"] });
136
+ const hub = new HubHttpClient(hubUrl);
137
+ const { token: inlineToken } = yield* Effect2.tryPromise(() => hub.login(DxContext.default(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 107 }), {
138
+ email
139
+ }));
140
+ let token = inlineToken;
141
+ if (!token) {
142
+ yield* Console.log(`A login link was sent to ${email}. Paste the token from the email below.`);
143
+ token = yield* Prompt.text({
144
+ message: "Login token"
145
+ }).pipe(Prompt.run);
146
+ }
147
+ return yield* Effect2.tryPromise(() => client.halo.recoverIdentity({
148
+ token
149
+ }));
150
+ });
151
+ var loginWithDeviceInvitation = (client, encoded) => Effect2.gen(function* () {
152
+ let code = encoded;
153
+ if (code.startsWith("http") || code.startsWith("socket")) {
154
+ code = new URL(code).searchParams.get("deviceInvitationCode") ?? code;
155
+ }
156
+ const invitation = client.halo.join(InvitationEncoder.decode(code));
157
+ yield* waitForState(invitation, Invitation2.State.READY_FOR_AUTHENTICATION);
158
+ const authCode = yield* Prompt.text({
159
+ message: "Enter the authentication code"
160
+ }).pipe(Prompt.run);
161
+ yield* Effect2.tryPromise(() => invitation.authenticate(authCode));
162
+ yield* waitForState(invitation, Invitation2.State.SUCCESS);
163
+ const identity2 = client.halo.identity.get();
164
+ invariant(identity2, "Device invitation completed but no identity is present.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 138, S: this, A: ["identity", "'Device invitation completed but no identity is present.'"] });
165
+ return identity2;
166
+ });
167
+
168
+ // src/commands/account/logout/logout.ts
169
+ import * as Command2 from "@effect/cli/Command";
170
+ import * as Options2 from "@effect/cli/Options";
171
+ import * as Prompt2 from "@effect/cli/Prompt";
172
+ import * as FileSystem from "@effect/platform/FileSystem";
173
+ import * as Console2 from "effect/Console";
174
+ import * as Effect3 from "effect/Effect";
175
+ import { CommandConfig as CommandConfig2 } from "@dxos/cli-util";
176
+ import { DX_DATA, getProfilePath } from "@dxos/client-protocol";
177
+ import { ConfigService } from "@dxos/config";
178
+ var logout = Command2.make("logout", {
179
+ force: Options2.boolean("force", {
180
+ ifPresent: true
181
+ }).pipe(Options2.withDescription("Skip confirmation prompt."))
182
+ }, Effect3.fnUntraced(function* ({ force }) {
183
+ const fs = yield* FileSystem.FileSystem;
184
+ const config2 = yield* ConfigService;
185
+ const { json, profile: profile2 } = yield* CommandConfig2;
186
+ const path = config2.values.runtime?.client?.storage?.dataRoot ?? getProfilePath(DX_DATA, profile2);
187
+ if (!force) {
188
+ const confirmed = yield* Prompt2.confirm({
189
+ message: `Log out of profile (${profile2})? This removes the local identity and data; spaces re-sync on next login.`,
190
+ initial: false
191
+ }).pipe(Prompt2.run);
192
+ if (!confirmed) {
193
+ return;
194
+ }
195
+ }
196
+ yield* fs.remove(path, {
197
+ recursive: true
198
+ }).pipe(Effect3.catchIf((e) => e._tag === "SystemError" && e.reason === "NotFound", () => Effect3.void));
199
+ if (json) {
200
+ yield* Console2.log(JSON.stringify({
201
+ profile: profile2,
202
+ loggedOut: true
203
+ }, null, 2));
204
+ } else {
205
+ yield* Console2.log(`Logged out of profile (${profile2}).`);
206
+ }
207
+ })).pipe(Command2.withDescription("Log out of the current profile (clears the local identity and data)."));
208
+
209
+ // src/commands/account/index.ts
210
+ var account = Command3.make("account").pipe(Command3.withDescription("Log in and out of a DXOS identity."), Command3.withSubcommands([
211
+ login,
212
+ logout
213
+ ]));
214
+
215
+ // src/commands/config/index.ts
216
+ import * as Command5 from "@effect/cli/Command";
217
+
218
+ // src/commands/config/view.ts
219
+ import * as Command4 from "@effect/cli/Command";
220
+ import * as Console3 from "effect/Console";
221
+ import * as Effect4 from "effect/Effect";
17
222
  import * as Yaml from "yaml";
18
- import { CommandConfig } from "@dxos/cli-util";
19
- import { ConfigService } from "@dxos/client";
223
+ import { CommandConfig as CommandConfig3 } from "@dxos/cli-util";
224
+ import { ConfigService as ConfigService2 } from "@dxos/client";
20
225
  import { DX_CONFIG, getProfileConfigPath } from "@dxos/client-protocol";
21
- var view = Command.make("view", {}, Effect.fnUntraced(function* () {
22
- const config2 = yield* ConfigService;
23
- const { json, profile: profile2 } = yield* CommandConfig;
226
+ var view = Command4.make("view", {}, Effect4.fnUntraced(function* () {
227
+ const config2 = yield* ConfigService2;
228
+ const { json, profile: profile2 } = yield* CommandConfig3;
24
229
  const configPath = getProfileConfigPath(DX_CONFIG, profile2);
25
230
  if (json) {
26
- yield* Console.log(JSON.stringify(config2.values, null, 2));
231
+ yield* Console3.log(JSON.stringify(config2.values, null, 2));
27
232
  } else {
28
- yield* Console.log(`Path: ${configPath}`);
29
- yield* Console.log(Yaml.stringify(config2.values));
233
+ yield* Console3.log(`Path: ${configPath}`);
234
+ yield* Console3.log(Yaml.stringify(config2.values));
30
235
  }
31
236
  }));
32
237
 
33
238
  // src/commands/config/index.ts
34
- var config = Command2.make("config").pipe(Command2.withDescription("Config commands."), Command2.withSubcommands([
239
+ var config = Command5.make("config").pipe(Command5.withDescription("Config commands."), Command5.withSubcommands([
35
240
  view
36
241
  ]));
37
242
 
38
243
  // src/commands/device/index.ts
39
- import * as Command6 from "@effect/cli/Command";
244
+ import * as Command9 from "@effect/cli/Command";
40
245
 
41
246
  // src/commands/device/info/info.ts
42
- import * as Command3 from "@effect/cli/Command";
43
- import * as Console2 from "effect/Console";
44
- import * as Effect2 from "effect/Effect";
45
- import { CommandConfig as CommandConfig2 } from "@dxos/cli-util";
46
- import { print } from "@dxos/cli-util";
47
- import { ClientService } from "@dxos/client";
247
+ import * as Command6 from "@effect/cli/Command";
248
+ import * as Console4 from "effect/Console";
249
+ import * as Effect5 from "effect/Effect";
250
+ import { CommandConfig as CommandConfig4 } from "@dxos/cli-util";
251
+ import { print as print2 } from "@dxos/cli-util";
252
+ import { ClientService as ClientService2 } from "@dxos/client";
48
253
  import { DeviceType as DeviceType2 } from "@dxos/protocols/proto/dxos/halo/credentials";
49
254
 
50
255
  // src/commands/device/util.ts
51
- import { FormBuilder } from "@dxos/cli-util";
256
+ import { FormBuilder as FormBuilder2 } from "@dxos/cli-util";
52
257
  import { Device, DeviceKind, DeviceType } from "@dxos/client/halo";
53
258
  var maybeTruncateKey = (key, truncate = false) => truncate ? key.truncate() : key.toHex();
54
259
  var getDeviceTitle = (device2) => {
@@ -73,30 +278,30 @@ var mapDevices = (devices, truncateKeys = false) => {
73
278
  presence: device2?.kind === DeviceKind.CURRENT ? "THIS DEVICE" : Device.PresenceState[device2.presence]
74
279
  }));
75
280
  };
76
- var printDevice = (device2) => FormBuilder.make({
281
+ var printDevice = (device2) => FormBuilder2.make({
77
282
  title: getDeviceTitle(device2)
78
- }).pipe(FormBuilder.set("deviceKey", device2.deviceKey.truncate()), FormBuilder.set("label", device2.profile?.label ?? "<none>"), FormBuilder.set("type", device2.profile?.type ? DeviceType[device2.profile?.type] : "UNKNOWN"), FormBuilder.set("kind", DeviceKind[device2.kind]), FormBuilder.set("presence", device2?.kind === DeviceKind.CURRENT ? "THIS DEVICE" : Device.PresenceState[device2.presence]), FormBuilder.set("platform", device2.profile?.platform ?? "<none>"), FormBuilder.set("platformVersion", device2.profile?.platformVersion ?? "<none>"), FormBuilder.set("architecture", device2.profile?.architecture ?? "<none>"), FormBuilder.set("os", device2.profile?.os ?? "<none>"), FormBuilder.set("osVersion", device2.profile?.osVersion ?? "<none>"), FormBuilder.build);
283
+ }).pipe(FormBuilder2.set("deviceKey", device2.deviceKey.truncate()), FormBuilder2.set("label", device2.profile?.label ?? "<none>"), FormBuilder2.set("type", device2.profile?.type ? DeviceType[device2.profile?.type] : "UNKNOWN"), FormBuilder2.set("kind", DeviceKind[device2.kind]), FormBuilder2.set("presence", device2?.kind === DeviceKind.CURRENT ? "THIS DEVICE" : Device.PresenceState[device2.presence]), FormBuilder2.set("platform", device2.profile?.platform ?? "<none>"), FormBuilder2.set("platformVersion", device2.profile?.platformVersion ?? "<none>"), FormBuilder2.set("architecture", device2.profile?.architecture ?? "<none>"), FormBuilder2.set("os", device2.profile?.os ?? "<none>"), FormBuilder2.set("osVersion", device2.profile?.osVersion ?? "<none>"), FormBuilder2.build);
79
284
  var printDevices = (devices) => {
80
285
  return devices.map(printDevice);
81
286
  };
82
287
 
83
288
  // src/commands/device/info/info.ts
84
- var handler = Effect2.fn(function* () {
85
- const { json } = yield* CommandConfig2;
86
- const client = yield* ClientService;
289
+ var handler = Effect5.fn(function* () {
290
+ const { json } = yield* CommandConfig4;
291
+ const client = yield* ClientService2;
87
292
  const device2 = client.halo.device;
88
293
  if (!device2) {
89
294
  if (json) {
90
- yield* Console2.log(JSON.stringify({
295
+ yield* Console4.log(JSON.stringify({
91
296
  error: "No device found"
92
297
  }, null, 2));
93
298
  } else {
94
- yield* Console2.log("No device found.");
299
+ yield* Console4.log("No device found.");
95
300
  }
96
301
  return;
97
302
  }
98
303
  if (json) {
99
- yield* Console2.log(JSON.stringify({
304
+ yield* Console4.log(JSON.stringify({
100
305
  deviceKey: device2.deviceKey.toHex(),
101
306
  profile: {
102
307
  ...device2.profile,
@@ -104,50 +309,50 @@ var handler = Effect2.fn(function* () {
104
309
  }
105
310
  }, null, 2));
106
311
  } else {
107
- yield* Console2.log(print(printDevice(device2)));
312
+ yield* Console4.log(print2(printDevice(device2)));
108
313
  }
109
314
  });
110
- var info = Command3.make("info", {}, handler).pipe(Command3.withDescription("Show device info."));
315
+ var info = Command6.make("info", {}, handler).pipe(Command6.withDescription("Show device info."));
111
316
 
112
317
  // src/commands/device/list/list.ts
113
- import * as Command4 from "@effect/cli/Command";
114
- import * as Console3 from "effect/Console";
115
- import * as Effect3 from "effect/Effect";
116
- import { CommandConfig as CommandConfig3 } from "@dxos/cli-util";
318
+ import * as Command7 from "@effect/cli/Command";
319
+ import * as Console5 from "effect/Console";
320
+ import * as Effect6 from "effect/Effect";
321
+ import { CommandConfig as CommandConfig5 } from "@dxos/cli-util";
117
322
  import { printList } from "@dxos/cli-util";
118
- import { ClientService as ClientService2 } from "@dxos/client";
119
- var handler2 = Effect3.fn(function* () {
120
- const { json } = yield* CommandConfig3;
121
- const client = yield* ClientService2;
323
+ import { ClientService as ClientService3 } from "@dxos/client";
324
+ var handler2 = Effect6.fn(function* () {
325
+ const { json } = yield* CommandConfig5;
326
+ const client = yield* ClientService3;
122
327
  const devices = client.halo.devices.get();
123
328
  if (json) {
124
- yield* Console3.log(JSON.stringify(mapDevices(devices), null, 2));
329
+ yield* Console5.log(JSON.stringify(mapDevices(devices), null, 2));
125
330
  } else {
126
331
  const formatted = printDevices(devices);
127
- yield* Console3.log(printList(formatted));
332
+ yield* Console5.log(printList(formatted));
128
333
  }
129
334
  });
130
- var list = Command4.make("list", {}, handler2).pipe(Command4.withDescription("List devices."));
335
+ var list = Command7.make("list", {}, handler2).pipe(Command7.withDescription("List devices."));
131
336
 
132
337
  // src/commands/device/update/update.ts
133
- import * as Command5 from "@effect/cli/Command";
134
- import * as Options from "@effect/cli/Options";
135
- import * as Console4 from "effect/Console";
136
- import * as Effect4 from "effect/Effect";
137
- import { CommandConfig as CommandConfig4 } from "@dxos/cli-util";
138
- import { print as print2 } from "@dxos/cli-util";
139
- import { ClientService as ClientService3 } from "@dxos/client";
140
- var handler3 = Effect4.fn(function* ({ label }) {
141
- const { json } = yield* CommandConfig4;
142
- const client = yield* ClientService3;
338
+ import * as Command8 from "@effect/cli/Command";
339
+ import * as Options3 from "@effect/cli/Options";
340
+ import * as Console6 from "effect/Console";
341
+ import * as Effect7 from "effect/Effect";
342
+ import { CommandConfig as CommandConfig6 } from "@dxos/cli-util";
343
+ import { print as print3 } from "@dxos/cli-util";
344
+ import { ClientService as ClientService4 } from "@dxos/client";
345
+ var handler3 = Effect7.fn(function* ({ label }) {
346
+ const { json } = yield* CommandConfig6;
347
+ const client = yield* ClientService4;
143
348
  const device2 = client.halo.device;
144
349
  if (!device2) {
145
350
  if (json) {
146
- yield* Console4.log(JSON.stringify({
351
+ yield* Console6.log(JSON.stringify({
147
352
  error: "No device found"
148
353
  }, null, 2));
149
354
  } else {
150
- yield* Console4.log("No device found.");
355
+ yield* Console6.log("No device found.");
151
356
  }
152
357
  return;
153
358
  }
@@ -158,234 +363,171 @@ var handler3 = Effect4.fn(function* ({ label }) {
158
363
  const devicesService = client.services.services.DevicesService;
159
364
  if (!devicesService) {
160
365
  if (json) {
161
- yield* Console4.log(JSON.stringify({
366
+ yield* Console6.log(JSON.stringify({
162
367
  error: "DevicesService not found"
163
368
  }, null, 2));
164
369
  } else {
165
- yield* Console4.log("DevicesService not found.");
370
+ yield* Console6.log("DevicesService not found.");
166
371
  }
167
372
  return;
168
373
  }
169
- const updatedDevice = yield* Effect4.tryPromise(() => devicesService.updateDevice(updatedProfile));
374
+ const updatedDevice = yield* Effect7.tryPromise(() => devicesService.updateDevice(updatedProfile));
170
375
  if (json) {
171
- yield* Console4.log(JSON.stringify({
376
+ yield* Console6.log(JSON.stringify({
172
377
  deviceKey: updatedDevice.deviceKey.toHex(),
173
378
  profile: updatedDevice.profile
174
379
  }, null, 2));
175
380
  } else {
176
- yield* Console4.log(print2(printDevice(updatedDevice)));
381
+ yield* Console6.log(print3(printDevice(updatedDevice)));
177
382
  }
178
383
  });
179
- var update = Command5.make("update", {
180
- label: Options.text("label").pipe(Options.withDescription("The device label."))
181
- }, handler3).pipe(Command5.withDescription("Update device label."));
384
+ var update = Command8.make("update", {
385
+ label: Options3.text("label").pipe(Options3.withDescription("The device label."))
386
+ }, handler3).pipe(Command8.withDescription("Update device label."));
182
387
 
183
388
  // src/commands/device/index.ts
184
- var device = Command6.make("device").pipe(Command6.withDescription("Manage HALO devices."), Command6.withSubcommands([
389
+ var device = Command9.make("device").pipe(Command9.withDescription("Manage HALO devices."), Command9.withSubcommands([
185
390
  info,
186
391
  list,
187
392
  update
188
393
  ]));
189
394
 
190
395
  // src/commands/edge/index.ts
191
- import * as Command8 from "@effect/cli/Command";
396
+ import * as Command11 from "@effect/cli/Command";
192
397
 
193
398
  // src/commands/edge/status.ts
194
- import * as Command7 from "@effect/cli/Command";
195
- import * as Console5 from "effect/Console";
196
- import * as Effect5 from "effect/Effect";
197
- import * as Option from "effect/Option";
198
- import { CommandConfig as CommandConfig5 } from "@dxos/cli-util";
199
- import { ClientService as ClientService4 } from "@dxos/client";
399
+ import * as Command10 from "@effect/cli/Command";
400
+ import * as Console7 from "effect/Console";
401
+ import * as Effect8 from "effect/Effect";
402
+ import * as Option2 from "effect/Option";
403
+ import { CommandConfig as CommandConfig7 } from "@dxos/cli-util";
404
+ import { ClientService as ClientService5 } from "@dxos/client";
200
405
  import { createEdgeIdentity } from "@dxos/client/edge";
201
406
  import { Context } from "@dxos/context";
202
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/edge/status.ts";
203
- var getStatus = () => Effect5.gen(function* () {
204
- const client = yield* ClientService4;
407
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/edge/status.ts";
408
+ var getStatus = () => Effect8.gen(function* () {
409
+ const client = yield* ClientService5;
205
410
  const identity2 = createEdgeIdentity(client);
206
411
  client.edge.http.setIdentity(identity2);
207
- const status2 = yield* Effect5.tryPromise(() => client.edge.http.getStatus(Context.default(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 16 })));
208
- if (yield* CommandConfig5.isJson) {
209
- yield* Console5.log(JSON.stringify(status2, null, 2));
412
+ const status2 = yield* Effect8.tryPromise(() => client.edge.http.getStatus(Context.default(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 16 })));
413
+ if (yield* CommandConfig7.isJson) {
414
+ yield* Console7.log(JSON.stringify(status2, null, 2));
210
415
  } else if (status2.problems.length > 0) {
211
416
  for (const problem of status2.problems) {
212
- yield* Console5.error(problem);
417
+ yield* Console7.error(problem);
213
418
  }
214
419
  } else {
215
- yield* Console5.log("No problems found.");
420
+ yield* Console7.log("No problems found.");
216
421
  }
217
422
  }).pipe(
218
423
  // TODO(wittjosiah): Tagged error.
219
- Effect5.catchSome((error2) => {
424
+ Effect8.catchSome((error2) => {
220
425
  if (error2 instanceof Error && error2.message === "Identity not available") {
221
- return Option.some(Console5.error(error2.message));
426
+ return Option2.some(Console7.error(error2.message));
222
427
  } else {
223
- return Option.none();
428
+ return Option2.none();
224
429
  }
225
430
  })
226
431
  );
227
- var status = Command7.make("status", {}, getStatus).pipe(Command7.withDescription("Get the EDGE status for the current identity."));
432
+ var status = Command10.make("status", {}, getStatus).pipe(Command10.withDescription("Get the EDGE status for the current identity."));
228
433
 
229
434
  // src/commands/edge/index.ts
230
- var edge = Command8.make("edge").pipe(Command8.withDescription("EDGE commands."), Command8.withSubcommands([
435
+ var edge = Command11.make("edge").pipe(Command11.withDescription("EDGE commands."), Command11.withSubcommands([
231
436
  status
232
437
  ]));
233
438
 
234
439
  // src/commands/halo/index.ts
235
- import * as Command18 from "@effect/cli/Command";
236
-
237
- // src/commands/halo/create/create.ts
238
- import * as Command9 from "@effect/cli/Command";
239
- import * as Options2 from "@effect/cli/Options";
240
- import * as Console6 from "effect/Console";
241
- import * as Effect6 from "effect/Effect";
242
- import * as Option2 from "effect/Option";
243
- import { Capabilities, Plugin } from "@dxos/app-framework";
244
- import { PERSONAL_SPACE_TAG } from "@dxos/app-toolkit";
245
- import { CommandConfig as CommandConfig6, flushAndSync, spaceLayer } from "@dxos/cli-util";
246
- import { print as print3 } from "@dxos/cli-util";
247
- import { ClientService as ClientService5 } from "@dxos/client";
248
- import { invariant } from "@dxos/invariant";
249
- import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
250
- import { MembershipPolicy } from "@dxos/protocols/proto/dxos/halo/credentials";
251
- import { ClientOperation } from "#operations";
252
-
253
- // src/commands/halo/util.ts
254
- import { FormBuilder as FormBuilder2 } from "@dxos/cli-util";
255
- var printIdentity = (identity2) => FormBuilder2.make({
256
- title: "Identity"
257
- }).pipe(FormBuilder2.set("identityDid", identity2.identityDid), FormBuilder2.set("displayName", identity2.profile?.displayName ?? "<none>"), FormBuilder2.build);
258
-
259
- // src/commands/halo/create/create.ts
260
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/halo/create/create.ts";
261
- var handler4 = Effect6.fn(function* ({ agent, displayName }) {
262
- const { json } = yield* CommandConfig6;
263
- const client = yield* ClientService5;
264
- invariant(!client.halo.identity.get(), "Identity already exists", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 23, S: this, A: ["!client.halo.identity.get()", "'Identity already exists'"] });
265
- const manager = yield* Plugin.Service;
266
- const { invoke } = manager.capabilities.get(Capabilities.OperationInvoker);
267
- const identity2 = yield* invoke(ClientOperation.CreateIdentity, {
268
- displayName: Option2.getOrUndefined(displayName)
269
- });
270
- if (agent) {
271
- yield* invoke(ClientOperation.CreateAgent);
272
- }
273
- const space = yield* Effect6.promise(() => client.spaces.create({}, {
274
- tags: [
275
- PERSONAL_SPACE_TAG
276
- ],
277
- membershipPolicy: MembershipPolicy.LOCKED
278
- }));
279
- yield* Effect6.promise(() => space.waitUntilReady());
280
- yield* Effect6.promise(() => space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED));
281
- yield* flushAndSync({
282
- indexes: true
283
- }).pipe(Effect6.provide(spaceLayer(Option2.some(space.id))));
284
- if (json) {
285
- yield* Console6.log(JSON.stringify({
286
- identityDid: identity2.identityDid,
287
- displayName: identity2.profile?.displayName
288
- }, null, 2));
289
- } else {
290
- yield* Console6.log(print3(printIdentity(identity2)));
291
- }
292
- });
293
- var create = Command9.make("create", {
294
- agent: Options2.boolean("noAgent", {
295
- ifPresent: false
296
- }).pipe(Options2.withDescription("Do not create an EDGE agent for the identity.")),
297
- displayName: Options2.text("displayName").pipe(Options2.withDescription("The display name of the identity."), Options2.optional)
298
- }, handler4).pipe(Command9.withDescription("Create a new identity."));
440
+ import * as Command19 from "@effect/cli/Command";
299
441
 
300
442
  // src/commands/halo/credential/index.ts
301
- import * as Command12 from "@effect/cli/Command";
443
+ import * as Command14 from "@effect/cli/Command";
302
444
 
303
445
  // src/commands/halo/credential/add/add.ts
304
- import * as Args from "@effect/cli/Args";
305
- import * as Command10 from "@effect/cli/Command";
306
- import * as Prompt from "@effect/cli/Prompt";
307
- import * as Console7 from "effect/Console";
308
- import * as Effect7 from "effect/Effect";
446
+ import * as Args2 from "@effect/cli/Args";
447
+ import * as Command12 from "@effect/cli/Command";
448
+ import * as Prompt3 from "@effect/cli/Prompt";
449
+ import * as Console8 from "effect/Console";
450
+ import * as Effect9 from "effect/Effect";
309
451
  import * as Option3 from "effect/Option";
310
- import { CommandConfig as CommandConfig7 } from "@dxos/cli-util";
452
+ import { CommandConfig as CommandConfig8 } from "@dxos/cli-util";
311
453
  import { ClientService as ClientService6 } from "@dxos/client";
312
454
  import { invariant as invariant2 } from "@dxos/invariant";
313
455
  import { schema } from "@dxos/protocols/proto";
314
456
  var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/halo/credential/add/add.ts";
315
- var handler5 = Effect7.fn(function* ({ credential: credential2 }) {
316
- const { json } = yield* CommandConfig7;
457
+ var handler4 = Effect9.fn(function* ({ credential: credential2 }) {
458
+ const { json } = yield* CommandConfig8;
317
459
  const client = yield* ClientService6;
318
460
  let credentialHex = Option3.getOrUndefined(credential2);
319
461
  if (!credentialHex) {
320
- credentialHex = yield* Prompt.text({
462
+ credentialHex = yield* Prompt3.text({
321
463
  message: "Enter credential (hex string)"
322
- }).pipe(Prompt.run);
464
+ }).pipe(Prompt3.run);
323
465
  }
324
466
  invariant2(credentialHex, "Invalid credential.", { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 23, S: this, A: ["credentialHex", "'Invalid credential.'"] });
325
467
  const identity2 = client.halo.identity;
326
468
  if (!identity2) {
327
469
  if (json) {
328
- yield* Console7.log(JSON.stringify({
470
+ yield* Console8.log(JSON.stringify({
329
471
  error: "Profile not initialized"
330
472
  }, null, 2));
331
473
  } else {
332
- yield* Console7.log("Profile not initialized.");
474
+ yield* Console8.log("Profile not initialized.");
333
475
  }
334
476
  return;
335
477
  }
336
- yield* Effect7.gen(function* () {
478
+ yield* Effect9.gen(function* () {
337
479
  const codec = schema.getCodecForType("dxos.halo.credentials.Credential");
338
- const credentialBytes = yield* Effect7.try({
480
+ const credentialBytes = yield* Effect9.try({
339
481
  try: () => Buffer.from(credentialHex, "hex"),
340
482
  catch: (error2) => new Error(`Failed to parse hex string: ${error2}`)
341
483
  });
342
484
  const verifyError = codec.protoType.verify(credentialBytes);
343
485
  if (verifyError) {
344
- yield* Effect7.fail(new Error(verifyError));
486
+ yield* Effect9.fail(new Error(verifyError));
345
487
  }
346
- const credentialObj = yield* Effect7.try({
488
+ const credentialObj = yield* Effect9.try({
347
489
  try: () => codec.decode(credentialBytes),
348
490
  catch: (error2) => new Error(`Failed to decode credential: ${error2}`)
349
491
  });
350
- yield* Effect7.tryPromise({
492
+ yield* Effect9.tryPromise({
351
493
  try: () => client.halo.writeCredentials([
352
494
  credentialObj
353
495
  ]),
354
496
  catch: (error2) => new Error(`Failed to write credential: ${error2}`)
355
497
  });
356
498
  if (json) {
357
- yield* Console7.log(JSON.stringify({
499
+ yield* Console8.log(JSON.stringify({
358
500
  success: true
359
501
  }, null, 2));
360
502
  } else {
361
- yield* Console7.log("Credential added successfully.");
503
+ yield* Console8.log("Credential added successfully.");
362
504
  }
363
- }).pipe(Effect7.catchAll((error2) => Effect7.gen(function* () {
505
+ }).pipe(Effect9.catchAll((error2) => Effect9.gen(function* () {
364
506
  if (json) {
365
- yield* Console7.log(JSON.stringify({
507
+ yield* Console8.log(JSON.stringify({
366
508
  error: "Invalid credential",
367
509
  message: error2 instanceof Error ? error2.message : String(error2)
368
510
  }, null, 2));
369
511
  } else {
370
- yield* Console7.log("Invalid credential.");
512
+ yield* Console8.log("Invalid credential.");
371
513
  }
372
- yield* Effect7.fail(error2);
514
+ yield* Effect9.fail(error2);
373
515
  })));
374
516
  });
375
- var add = Command10.make("add", {
376
- credential: Args.text({
517
+ var add = Command12.make("add", {
518
+ credential: Args2.text({
377
519
  name: "credential"
378
- }).pipe(Args.withDescription("Credential as hex string."), Args.optional)
379
- }, handler5).pipe(Command10.withDescription("Import credential into HALO."));
520
+ }).pipe(Args2.withDescription("Credential as hex string."), Args2.optional)
521
+ }, handler4).pipe(Command12.withDescription("Import credential into HALO."));
380
522
 
381
523
  // src/commands/halo/credential/list/list.ts
382
- import * as Command11 from "@effect/cli/Command";
383
- import * as Options3 from "@effect/cli/Options";
384
- import * as Console8 from "effect/Console";
385
- import * as Duration from "effect/Duration";
386
- import * as Effect8 from "effect/Effect";
524
+ import * as Command13 from "@effect/cli/Command";
525
+ import * as Options4 from "@effect/cli/Options";
526
+ import * as Console9 from "effect/Console";
527
+ import * as Duration2 from "effect/Duration";
528
+ import * as Effect10 from "effect/Effect";
387
529
  import * as Option4 from "effect/Option";
388
- import { CommandConfig as CommandConfig8, Common, FormBuilder as FormBuilder3, getSpace, printList as printList2 } from "@dxos/cli-util";
530
+ import { CommandConfig as CommandConfig9, Common, FormBuilder as FormBuilder3, getSpace, printList as printList2 } from "@dxos/cli-util";
389
531
  import { ClientService as ClientService7 } from "@dxos/client";
390
532
  var mapCredentials = (credentials) => {
391
533
  return credentials.map((credential2) => ({
@@ -402,109 +544,109 @@ var printCredential = (credential2) => {
402
544
  title: type
403
545
  }).pipe(FormBuilder3.option("id", Option4.fromNullable(credential2.id?.truncate())), FormBuilder3.option("issuer", Option4.fromNullable(credential2.issuer?.truncate())), FormBuilder3.option("subject", Option4.fromNullable(credential2.subject?.id?.truncate())), FormBuilder3.build);
404
546
  };
405
- var handler6 = Effect8.fn(function* ({ type, spaceId, timeout: timeout2, delay }) {
406
- const { json } = yield* CommandConfig8;
547
+ var handler5 = Effect10.fn(function* ({ type, spaceId, timeout: timeout3, delay }) {
548
+ const { json } = yield* CommandConfig9;
407
549
  const client = yield* ClientService7;
408
550
  let credentials;
409
551
  if (Option4.isSome(spaceId)) {
410
552
  const space = yield* getSpace(spaceId.value);
411
- credentials = yield* Effect8.tryPromise(() => space.internal.getCredentials());
553
+ credentials = yield* Effect10.tryPromise(() => space.internal.getCredentials());
412
554
  } else {
413
555
  const identity2 = client.halo.identity;
414
556
  if (!identity2) {
415
557
  if (json) {
416
- yield* Console8.log(JSON.stringify({
558
+ yield* Console9.log(JSON.stringify({
417
559
  error: "Profile not initialized"
418
560
  }, null, 2));
419
561
  } else {
420
- yield* Console8.log("Profile not initialized.");
562
+ yield* Console9.log("Profile not initialized.");
421
563
  }
422
564
  return;
423
565
  }
424
- const latch = yield* Effect8.makeLatch();
566
+ const latch = yield* Effect10.makeLatch();
425
567
  const subscription = client.halo.credentials.subscribe((creds) => {
426
568
  if (creds.length > 0) {
427
- Effect8.runSync(latch.open);
569
+ Effect10.runSync(latch.open);
428
570
  }
429
571
  });
430
- yield* latch.await.pipe(Effect8.timeout(Duration.millis(timeout2)), Effect8.catchAll(() => Effect8.void), Effect8.ensuring(Effect8.sync(() => {
572
+ yield* latch.await.pipe(Effect10.timeout(Duration2.millis(timeout3)), Effect10.catchAll(() => Effect10.void), Effect10.ensuring(Effect10.sync(() => {
431
573
  subscription.unsubscribe();
432
574
  })));
433
- yield* Effect8.sleep(Duration.millis(delay));
575
+ yield* Effect10.sleep(Duration2.millis(delay));
434
576
  credentials = client.halo.queryCredentials({
435
577
  type: Option4.getOrUndefined(type)
436
578
  });
437
579
  }
438
580
  if (json) {
439
- yield* Console8.log(JSON.stringify(mapCredentials(credentials), null, 2));
581
+ yield* Console9.log(JSON.stringify(mapCredentials(credentials), null, 2));
440
582
  } else {
441
583
  const formatted = credentials.map(printCredential);
442
- yield* Console8.log(printList2(formatted));
584
+ yield* Console9.log(printList2(formatted));
443
585
  }
444
586
  });
445
- var list2 = Command11.make("list", {
446
- type: Options3.text("type").pipe(Options3.withDescription("Filter by credential type."), Options3.optional),
447
- spaceId: Common.spaceId.pipe(Options3.withDescription("Space ID to show credentials from."), Options3.optional),
448
- timeout: Options3.integer("timeout").pipe(Options3.withDescription("Time in milliseconds to wait for at least one credential before listing."), Options3.withDefault(500)),
449
- delay: Options3.integer("delay").pipe(Options3.withDescription("Delay in milliseconds before listing."), Options3.withDefault(250))
450
- }, handler6).pipe(Command11.withDescription("List HALO credentials."));
587
+ var list2 = Command13.make("list", {
588
+ type: Options4.text("type").pipe(Options4.withDescription("Filter by credential type."), Options4.optional),
589
+ spaceId: Common.spaceId.pipe(Options4.withDescription("Space ID to show credentials from."), Options4.optional),
590
+ timeout: Options4.integer("timeout").pipe(Options4.withDescription("Time in milliseconds to wait for at least one credential before listing."), Options4.withDefault(500)),
591
+ delay: Options4.integer("delay").pipe(Options4.withDescription("Delay in milliseconds before listing."), Options4.withDefault(250))
592
+ }, handler5).pipe(Command13.withDescription("List HALO credentials."));
451
593
 
452
594
  // src/commands/halo/credential/index.ts
453
- var credential = Command12.make("credential").pipe(Command12.withDescription("Manage HALO credentials."), Command12.withSubcommands([
595
+ var credential = Command14.make("credential").pipe(Command14.withDescription("Manage HALO credentials."), Command14.withSubcommands([
454
596
  add,
455
597
  list2
456
598
  ]));
457
599
 
458
600
  // src/commands/halo/identity/identity.ts
459
- import * as Command13 from "@effect/cli/Command";
460
- import * as Console9 from "effect/Console";
461
- import * as Effect9 from "effect/Effect";
462
- import { CommandConfig as CommandConfig9 } from "@dxos/cli-util";
601
+ import * as Command15 from "@effect/cli/Command";
602
+ import * as Console10 from "effect/Console";
603
+ import * as Effect11 from "effect/Effect";
604
+ import { CommandConfig as CommandConfig10 } from "@dxos/cli-util";
463
605
  import { print as print4 } from "@dxos/cli-util";
464
606
  import { ClientService as ClientService8 } from "@dxos/client";
465
- var handler7 = Effect9.fn(function* () {
466
- const { json } = yield* CommandConfig9;
607
+ var handler6 = Effect11.fn(function* () {
608
+ const { json } = yield* CommandConfig10;
467
609
  const client = yield* ClientService8;
468
610
  const identity2 = client.halo.identity.get();
469
611
  if (!identity2) {
470
612
  if (json) {
471
- yield* Console9.log(JSON.stringify({
613
+ yield* Console10.log(JSON.stringify({
472
614
  error: "Identity not initialized"
473
615
  }, null, 2));
474
616
  } else {
475
- yield* Console9.log("Identity not initialized.");
617
+ yield* Console10.log("Identity not initialized.");
476
618
  }
477
619
  } else {
478
620
  if (json) {
479
- yield* Console9.log(JSON.stringify({
621
+ yield* Console10.log(JSON.stringify({
480
622
  identityDid: identity2.did,
481
623
  displayName: identity2.profile?.displayName
482
624
  }, null, 2));
483
625
  } else {
484
- yield* Console9.log(print4(printIdentity({
626
+ yield* Console10.log(print4(printIdentity({
485
627
  identityDid: identity2.did,
486
628
  profile: identity2.profile
487
629
  })));
488
630
  }
489
631
  }
490
632
  });
491
- var identity = Command13.make("identity", {}, handler7).pipe(Command13.withDescription("Get the current identity."));
633
+ var identity = Command15.make("identity", {}, handler6).pipe(Command15.withDescription("Get the current identity."));
492
634
 
493
635
  // src/commands/halo/keys/keys.ts
494
- import * as Command14 from "@effect/cli/Command";
495
- import * as Console10 from "effect/Console";
496
- import * as Effect10 from "effect/Effect";
636
+ import * as Command16 from "@effect/cli/Command";
637
+ import * as Console11 from "effect/Console";
638
+ import * as Effect12 from "effect/Effect";
497
639
  import * as Option5 from "effect/Option";
498
- import { CommandConfig as CommandConfig10 } from "@dxos/cli-util";
640
+ import { CommandConfig as CommandConfig11 } from "@dxos/cli-util";
499
641
  import { FormBuilder as FormBuilder4, print as print5 } from "@dxos/cli-util";
500
642
  import { ClientService as ClientService9 } from "@dxos/client";
501
- var handler8 = Effect10.fn(function* () {
502
- const { json } = yield* CommandConfig10;
643
+ var handler7 = Effect12.fn(function* () {
644
+ const { json } = yield* CommandConfig11;
503
645
  const client = yield* ClientService9;
504
646
  const identity2 = client.halo.identity.get();
505
647
  const device2 = client.halo.device;
506
648
  if (json) {
507
- yield* Console10.log(JSON.stringify({
649
+ yield* Console11.log(JSON.stringify({
508
650
  identityKey: identity2?.identityKey.toHex(),
509
651
  deviceKey: device2?.deviceKey.toHex()
510
652
  }, null, 2));
@@ -512,54 +654,20 @@ var handler8 = Effect10.fn(function* () {
512
654
  const builder = FormBuilder4.make({
513
655
  title: "HALO Keys"
514
656
  }).pipe(FormBuilder4.option("identityKey", Option5.fromNullable(identity2?.identityKey.truncate())), FormBuilder4.option("deviceKey", Option5.fromNullable(device2?.deviceKey.truncate())));
515
- yield* Console10.log(print5(FormBuilder4.build(builder)));
657
+ yield* Console11.log(print5(FormBuilder4.build(builder)));
516
658
  }
517
659
  });
518
- var keys = Command14.make("keys", {}, handler8).pipe(Command14.withDescription("Show HALO keys."));
519
-
520
- // src/commands/halo/recover/recover.ts
521
- import * as Args2 from "@effect/cli/Args";
522
- import * as Command15 from "@effect/cli/Command";
523
- import * as Console11 from "effect/Console";
524
- import * as Effect11 from "effect/Effect";
525
- import { CommandConfig as CommandConfig11, print as print6 } from "@dxos/cli-util";
526
- import { ClientService as ClientService10 } from "@dxos/client";
527
- import { invariant as invariant3 } from "@dxos/invariant";
528
- var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/halo/recover/recover.ts";
529
- var recover = Command15.make("recover", {
530
- recoveryCode: Args2.text({
531
- name: "recoveryCode"
532
- }).pipe(Args2.withDescription("The recovery code seed phrase."))
533
- }, Effect11.fn(function* ({ recoveryCode }) {
534
- const { json } = yield* CommandConfig11;
535
- const client = yield* ClientService10;
536
- invariant3(!client.halo.identity.get(), "Identity already exists", { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 20, S: this, A: ["!client.halo.identity.get()", "'Identity already exists'"] });
537
- const identity2 = yield* Effect11.tryPromise(() => client.halo.recoverIdentity({
538
- recoveryCode
539
- }));
540
- if (json) {
541
- yield* Console11.log(JSON.stringify({
542
- identityDid: identity2.did,
543
- displayName: identity2.profile?.displayName
544
- }, null, 2));
545
- } else {
546
- yield* Console11.log("Identity recovered successfully");
547
- yield* Console11.log(print6(printIdentity({
548
- identityDid: identity2.did,
549
- profile: identity2.profile
550
- })));
551
- }
552
- })).pipe(Command15.withDescription("Recover an existing identity using a recovery code."));
660
+ var keys = Command16.make("keys", {}, handler7).pipe(Command16.withDescription("Show HALO keys."));
553
661
 
554
662
  // src/commands/halo/seed/seed.ts
555
- import * as Command16 from "@effect/cli/Command";
663
+ import * as Command17 from "@effect/cli/Command";
556
664
  import * as Console12 from "effect/Console";
557
- import * as Effect12 from "effect/Effect";
665
+ import * as Effect13 from "effect/Effect";
558
666
  import { CommandConfig as CommandConfig12 } from "@dxos/cli-util";
559
- import { ClientService as ClientService11 } from "@dxos/client";
560
- var handler9 = Effect12.fn(function* () {
667
+ import { ClientService as ClientService10 } from "@dxos/client";
668
+ var handler8 = Effect13.fn(function* () {
561
669
  const { json } = yield* CommandConfig12;
562
- const client = yield* ClientService11;
670
+ const client = yield* ClientService10;
563
671
  const identityService = client.services.services.IdentityService;
564
672
  if (!identityService) {
565
673
  if (json) {
@@ -571,7 +679,7 @@ var handler9 = Effect12.fn(function* () {
571
679
  }
572
680
  return;
573
681
  }
574
- const result = yield* Effect12.tryPromise(() => identityService.createRecoveryCredential({}));
682
+ const result = yield* Effect13.tryPromise(() => identityService.createRecoveryCredential({}));
575
683
  if (json) {
576
684
  yield* Console12.log(JSON.stringify({
577
685
  recoveryCode: result.recoveryCode
@@ -580,19 +688,19 @@ var handler9 = Effect12.fn(function* () {
580
688
  yield* Console12.log(result.recoveryCode);
581
689
  }
582
690
  });
583
- var seed = Command16.make("seed", {}, handler9).pipe(Command16.withDescription("Generate a seedphrase that can be used for identity recovery."));
691
+ var seed = Command17.make("seed", {}, handler8).pipe(Command17.withDescription("Generate a seedphrase that can be used for identity recovery."));
584
692
 
585
693
  // src/commands/halo/update/update.ts
586
- import * as Command17 from "@effect/cli/Command";
587
- import * as Options4 from "@effect/cli/Options";
694
+ import * as Command18 from "@effect/cli/Command";
695
+ import * as Options5 from "@effect/cli/Options";
588
696
  import * as Console13 from "effect/Console";
589
- import * as Effect13 from "effect/Effect";
697
+ import * as Effect14 from "effect/Effect";
590
698
  import { CommandConfig as CommandConfig13 } from "@dxos/cli-util";
591
- import { print as print7 } from "@dxos/cli-util";
592
- import { ClientService as ClientService12 } from "@dxos/client";
593
- var handler10 = Effect13.fn(function* ({ displayName }) {
699
+ import { print as print6 } from "@dxos/cli-util";
700
+ import { ClientService as ClientService11 } from "@dxos/client";
701
+ var handler9 = Effect14.fn(function* ({ displayName }) {
594
702
  const { json } = yield* CommandConfig13;
595
- const client = yield* ClientService12;
703
+ const client = yield* ClientService11;
596
704
  const identity2 = client.halo.identity.get();
597
705
  if (!identity2) {
598
706
  if (json) {
@@ -615,7 +723,7 @@ var handler10 = Effect13.fn(function* ({ displayName }) {
615
723
  }
616
724
  return;
617
725
  }
618
- const updatedIdentity = yield* Effect13.tryPromise(() => identityService.updateProfile({
726
+ const updatedIdentity = yield* Effect14.tryPromise(() => identityService.updateProfile({
619
727
  displayName
620
728
  }));
621
729
  if (json) {
@@ -624,40 +732,38 @@ var handler10 = Effect13.fn(function* ({ displayName }) {
624
732
  displayName: updatedIdentity.profile?.displayName
625
733
  }, null, 2));
626
734
  } else {
627
- yield* Console13.log(print7(printIdentity({
735
+ yield* Console13.log(print6(printIdentity({
628
736
  identityDid: updatedIdentity.did,
629
737
  profile: updatedIdentity.profile
630
738
  })));
631
739
  }
632
740
  });
633
- var update2 = Command17.make("update", {
634
- displayName: Options4.text("displayName").pipe(Options4.withDescription("The display name of the identity."))
635
- }, handler10).pipe(Command17.withDescription("Update identity profile."));
741
+ var update2 = Command18.make("update", {
742
+ displayName: Options5.text("displayName").pipe(Options5.withDescription("The display name of the identity."))
743
+ }, handler9).pipe(Command18.withDescription("Update identity profile."));
636
744
 
637
745
  // src/commands/halo/index.ts
638
- var halo = Command18.make("halo").pipe(Command18.withDescription("Manage HALO identity."), Command18.withSubcommands([
639
- create,
746
+ var halo = Command19.make("halo").pipe(Command19.withDescription("Manage HALO identity."), Command19.withSubcommands([
640
747
  credential,
641
748
  identity,
642
749
  keys,
643
- recover,
644
750
  seed,
645
751
  update2
646
752
  ]));
647
753
 
648
754
  // src/commands/profile/index.ts
649
- import * as Command25 from "@effect/cli/Command";
755
+ import * as Command26 from "@effect/cli/Command";
650
756
 
651
757
  // src/commands/profile/create.ts
652
- import * as Command19 from "@effect/cli/Command";
653
- import * as Options5 from "@effect/cli/Options";
654
- import * as FileSystem from "@effect/platform/FileSystem";
758
+ import * as Command20 from "@effect/cli/Command";
759
+ import * as Options6 from "@effect/cli/Options";
760
+ import * as FileSystem3 from "@effect/platform/FileSystem";
655
761
  import * as Path from "@effect/platform/Path";
656
762
  import * as Console14 from "effect/Console";
657
- import * as Effect14 from "effect/Effect";
763
+ import * as Effect15 from "effect/Effect";
658
764
  import * as Option6 from "effect/Option";
659
765
  import * as Record from "effect/Record";
660
- import { CommandConfig as CommandConfig14, print as print8 } from "@dxos/cli-util";
766
+ import { CommandConfig as CommandConfig14, print as print7 } from "@dxos/cli-util";
661
767
  import { DX_CONFIG as DX_CONFIG2, getProfileConfigPath as getProfileConfigPath2 } from "@dxos/client-protocol";
662
768
  import { trim } from "@dxos/util";
663
769
 
@@ -722,12 +828,12 @@ var TEMPLATES = {
722
828
  url: http://localhost:8787
723
829
  `
724
830
  };
725
- var create2 = Command19.make("create", {
726
- template: Options5.choice("template", Record.keys(TEMPLATES)).pipe(Options5.withDescription("Template to use"), Options5.withDefault("default")),
727
- name: Options5.text("name").pipe(Options5.withDescription("Profile name"), Options5.optional)
728
- }, Effect14.fnUntraced(function* ({ template, name }) {
831
+ var create = Command20.make("create", {
832
+ template: Options6.choice("template", Record.keys(TEMPLATES)).pipe(Options6.withDescription("Template to use"), Options6.withDefault("default")),
833
+ name: Options6.text("name").pipe(Options6.withDescription("Profile name"), Options6.optional)
834
+ }, Effect15.fnUntraced(function* ({ template, name }) {
729
835
  const { json } = yield* CommandConfig14;
730
- const fs = yield* FileSystem.FileSystem;
836
+ const fs = yield* FileSystem3.FileSystem;
731
837
  const path = yield* Path.Path;
732
838
  const profileName = name.pipe(Option6.getOrElse(() => template));
733
839
  const configPath = getProfileConfigPath2(DX_CONFIG2, profileName);
@@ -744,67 +850,67 @@ var create2 = Command19.make("create", {
744
850
  path: configPath
745
851
  }, null, 2));
746
852
  } else {
747
- yield* Console14.log(print8(printProfileCreated(profileName, configPath)));
853
+ yield* Console14.log(print7(printProfileCreated(profileName, configPath)));
748
854
  }
749
855
  }));
750
856
 
751
857
  // src/commands/profile/delete.ts
752
- import * as Command20 from "@effect/cli/Command";
753
- import * as Options6 from "@effect/cli/Options";
754
- import * as FileSystem3 from "@effect/platform/FileSystem";
858
+ import * as Command21 from "@effect/cli/Command";
859
+ import * as Options7 from "@effect/cli/Options";
860
+ import * as FileSystem5 from "@effect/platform/FileSystem";
755
861
  import * as Console15 from "effect/Console";
756
- import * as Effect15 from "effect/Effect";
862
+ import * as Effect16 from "effect/Effect";
757
863
  import * as Option7 from "effect/Option";
758
- import { CommandConfig as CommandConfig15, print as print9 } from "@dxos/cli-util";
864
+ import { CommandConfig as CommandConfig15, print as print8 } from "@dxos/cli-util";
759
865
  import { DX_CONFIG as DX_CONFIG3, getProfileConfigPath as getProfileConfigPath3 } from "@dxos/client-protocol";
760
- var del = Command20.make("delete", {
761
- name: Options6.text("name").pipe(Options6.withDescription("Profile name"), Options6.optional)
762
- }, Effect15.fnUntraced(function* ({ name }) {
866
+ var del = Command21.make("delete", {
867
+ name: Options7.text("name").pipe(Options7.withDescription("Profile name"), Options7.optional)
868
+ }, Effect16.fnUntraced(function* ({ name }) {
763
869
  const { json } = yield* CommandConfig15;
764
- const fs = yield* FileSystem3.FileSystem;
870
+ const fs = yield* FileSystem5.FileSystem;
765
871
  const profileName = name.pipe(Option7.getOrElse(() => "default"));
766
872
  const configPath = getProfileConfigPath3(DX_CONFIG3, profileName);
767
873
  const pluginsPath = `${DX_CONFIG3}/plugins/${profileName}.yml`;
768
- yield* fs.remove(configPath).pipe(Effect15.ignore);
769
- yield* fs.remove(pluginsPath).pipe(Effect15.ignore);
874
+ yield* fs.remove(configPath).pipe(Effect16.ignore);
875
+ yield* fs.remove(pluginsPath).pipe(Effect16.ignore);
770
876
  if (json) {
771
877
  yield* Console15.log(JSON.stringify({
772
878
  name: profileName,
773
879
  deleted: true
774
880
  }, null, 2));
775
881
  } else {
776
- yield* Console15.log(print9(printProfileDeleted(profileName)));
882
+ yield* Console15.log(print8(printProfileDeleted(profileName)));
777
883
  }
778
884
  }));
779
885
 
780
886
  // src/commands/profile/import.ts
781
- import * as Command21 from "@effect/cli/Command";
782
- import * as Options7 from "@effect/cli/Options";
783
- import * as Prompt2 from "@effect/cli/Prompt";
784
- import * as FileSystem5 from "@effect/platform/FileSystem";
887
+ import * as Command22 from "@effect/cli/Command";
888
+ import * as Options8 from "@effect/cli/Options";
889
+ import * as Prompt4 from "@effect/cli/Prompt";
890
+ import * as FileSystem7 from "@effect/platform/FileSystem";
785
891
  import * as Path3 from "@effect/platform/Path";
786
892
  import * as Console16 from "effect/Console";
787
- import * as Effect16 from "effect/Effect";
893
+ import * as Effect17 from "effect/Effect";
788
894
  import * as Option8 from "effect/Option";
789
895
  import { CommandConfig as CommandConfig16 } from "@dxos/cli-util";
790
- import { ConfigService as ConfigService2 } from "@dxos/config";
896
+ import { ConfigService as ConfigService3 } from "@dxos/config";
791
897
  import { log as log17 } from "@dxos/log";
792
- var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/profile/import.ts";
793
- var handler11 = Effect16.fn(function* ({ file, dataDir, force }) {
898
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/profile/import.ts";
899
+ var handler10 = Effect17.fn(function* ({ file, dataDir, force }) {
794
900
  const dataDirValue = Option8.getOrUndefined(dataDir);
795
901
  const { json, profile: profile2 } = yield* CommandConfig16;
796
- const fs = yield* FileSystem5.FileSystem;
902
+ const fs = yield* FileSystem7.FileSystem;
797
903
  const path = yield* Path3.Path;
798
- const config2 = yield* ConfigService2;
799
- const { createLevel, createStorageObjects, importProfileData, decodeProfileArchive } = yield* Effect16.promise(() => import("@dxos/client-services"));
904
+ const config2 = yield* ConfigService3;
905
+ const { createLevel, createStorageObjects, importProfileData, decodeProfileArchive } = yield* Effect17.promise(() => import("@dxos/client-services"));
800
906
  let storageConfig;
801
907
  if (!dataDirValue) {
802
908
  if (!force) {
803
909
  yield* Console16.log(`Will overwrite profile: ${profile2}`);
804
- const confirmed = yield* Prompt2.confirm({
910
+ const confirmed = yield* Prompt4.confirm({
805
911
  message: `Delete all data? (Profile: ${profile2})`,
806
912
  initial: false
807
- }).pipe(Prompt2.run);
913
+ }).pipe(Prompt4.run);
808
914
  if (!confirmed) {
809
915
  return;
810
916
  }
@@ -821,7 +927,7 @@ var handler11 = Effect16.fn(function* ({ file, dataDir, force }) {
821
927
  if (yield* fs.exists(storageConfig.dataRoot)) {
822
928
  log17.error("data directory already exists", {
823
929
  path: storageConfig.dataRoot
824
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 44, S: this });
930
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 44, S: this });
825
931
  if (json) {
826
932
  yield* Console16.log(JSON.stringify({
827
933
  error: "Data directory already exists"
@@ -835,12 +941,12 @@ var handler11 = Effect16.fn(function* ({ file, dataDir, force }) {
835
941
  const archive = decodeProfileArchive(data);
836
942
  yield* Console16.log(`Importing archive with ${archive.storage.length} entries`);
837
943
  const { storage } = createStorageObjects(storageConfig);
838
- const level = yield* Effect16.tryPromise({
944
+ const level = yield* Effect17.tryPromise({
839
945
  try: () => createLevel(storageConfig),
840
946
  catch: (error2) => new Error(`Failed to create level: ${error2}`)
841
947
  });
842
948
  yield* Console16.log("Beginning profile import...");
843
- yield* Effect16.tryPromise({
949
+ yield* Effect17.tryPromise({
844
950
  try: () => importProfileData({
845
951
  storage,
846
952
  level
@@ -856,27 +962,27 @@ var handler11 = Effect16.fn(function* ({ file, dataDir, force }) {
856
962
  }, null, 2));
857
963
  }
858
964
  });
859
- var importCommand = Command21.make("import", {
860
- file: Options7.text("file").pipe(Options7.withDescription("Archive filename."), Options7.withAlias("f")),
861
- dataDir: Options7.text("data-dir").pipe(Options7.withDescription("Storage directory."), Options7.optional),
862
- force: Options7.boolean("force", {
965
+ var importCommand = Command22.make("import", {
966
+ file: Options8.text("file").pipe(Options8.withDescription("Archive filename."), Options8.withAlias("f")),
967
+ dataDir: Options8.text("data-dir").pipe(Options8.withDescription("Storage directory."), Options8.optional),
968
+ force: Options8.boolean("force", {
863
969
  ifPresent: true
864
- }).pipe(Options7.withDescription("Skip confirmation prompt."))
865
- }, handler11).pipe(Command21.withDescription("Import profile."));
970
+ }).pipe(Options8.withDescription("Skip confirmation prompt."))
971
+ }, handler10).pipe(Command22.withDescription("Import profile."));
866
972
 
867
973
  // src/commands/profile/inspect.ts
868
- import * as Command22 from "@effect/cli/Command";
869
- import * as Options8 from "@effect/cli/Options";
870
- import * as FileSystem7 from "@effect/platform/FileSystem";
974
+ import * as Command23 from "@effect/cli/Command";
975
+ import * as Options9 from "@effect/cli/Options";
976
+ import * as FileSystem9 from "@effect/platform/FileSystem";
871
977
  import * as Console17 from "effect/Console";
872
- import * as Effect17 from "effect/Effect";
873
- import { CommandConfig as CommandConfig17, FormBuilder as FormBuilder6, print as print10 } from "@dxos/cli-util";
978
+ import * as Effect18 from "effect/Effect";
979
+ import { CommandConfig as CommandConfig17, FormBuilder as FormBuilder6, print as print9 } from "@dxos/cli-util";
874
980
  import { ProfileArchiveEntryType } from "@dxos/protocols";
875
981
  import { arrayToBuffer } from "@dxos/util";
876
- var handler12 = Effect17.fn(function* ({ file, storage }) {
982
+ var handler11 = Effect18.fn(function* ({ file, storage }) {
877
983
  const { json } = yield* CommandConfig17;
878
- const fs = yield* FileSystem7.FileSystem;
879
- const { decodeProfileArchive } = yield* Effect17.promise(() => import("@dxos/client-services"));
984
+ const fs = yield* FileSystem9.FileSystem;
985
+ const { decodeProfileArchive } = yield* Effect18.promise(() => import("@dxos/client-services"));
880
986
  const data = yield* fs.readFile(file);
881
987
  const archive = decodeProfileArchive(data);
882
988
  if (json) {
@@ -889,8 +995,8 @@ var handler12 = Effect17.fn(function* ({ file, storage }) {
889
995
  } else {
890
996
  const builder = FormBuilder6.make({
891
997
  title: "Profile Archive"
892
- }).pipe(FormBuilder6.when(archive.meta, FormBuilder6.each(Object.entries(archive.meta ?? {}), ([key, value]) => FormBuilder6.set(key, String(value)))), FormBuilder6.build);
893
- yield* Console17.log(print10(builder));
998
+ }).pipe(FormBuilder6.when(archive.meta, FormBuilder6.each(Object.entries(archive.meta ?? {}), ([key, value2]) => FormBuilder6.set(key, String(value2)))), FormBuilder6.build);
999
+ yield* Console17.log(print9(builder));
894
1000
  if (storage) {
895
1001
  yield* Console17.log("\nStorage entries:\n");
896
1002
  for (const entry of archive.storage) {
@@ -900,41 +1006,41 @@ var handler12 = Effect17.fn(function* ({ file, storage }) {
900
1006
  }
901
1007
  }
902
1008
  });
903
- var inspect = Command22.make("inspect", {
904
- file: Options8.text("file").pipe(Options8.withDescription("Archive filename."), Options8.withAlias("f")),
905
- storage: Options8.boolean("storage", {
1009
+ var inspect = Command23.make("inspect", {
1010
+ file: Options9.text("file").pipe(Options9.withDescription("Archive filename."), Options9.withAlias("f")),
1011
+ storage: Options9.boolean("storage", {
906
1012
  ifPresent: true
907
- }).pipe(Options8.withDescription("List storage entries."))
908
- }, handler12).pipe(Command22.withDescription("Inspect profile archive."));
1013
+ }).pipe(Options9.withDescription("List storage entries."))
1014
+ }, handler11).pipe(Command23.withDescription("Inspect profile archive."));
909
1015
 
910
1016
  // src/commands/profile/list.ts
911
- import * as Command23 from "@effect/cli/Command";
912
- import * as FileSystem9 from "@effect/platform/FileSystem";
1017
+ import * as Command24 from "@effect/cli/Command";
1018
+ import * as FileSystem11 from "@effect/platform/FileSystem";
913
1019
  import * as Path5 from "@effect/platform/Path";
914
1020
  import * as Console18 from "effect/Console";
915
- import * as Effect18 from "effect/Effect";
1021
+ import * as Effect19 from "effect/Effect";
916
1022
  import * as Yaml2 from "yaml";
917
1023
  import { CommandConfig as CommandConfig18, printList as printList3 } from "@dxos/cli-util";
918
1024
  import { Config } from "@dxos/client";
919
- import { DX_CONFIG as DX_CONFIG4, DX_DATA, getProfilePath } from "@dxos/client-protocol";
920
- var list3 = Command23.make("list", {}, Effect18.fnUntraced(function* () {
1025
+ import { DX_CONFIG as DX_CONFIG4, DX_DATA as DX_DATA2, getProfilePath as getProfilePath2 } from "@dxos/client-protocol";
1026
+ var list3 = Command24.make("list", {}, Effect19.fnUntraced(function* () {
921
1027
  const { profile: currentProfile } = yield* CommandConfig18;
922
- const fs = yield* FileSystem9.FileSystem;
1028
+ const fs = yield* FileSystem11.FileSystem;
923
1029
  const path = yield* Path5.Path;
924
1030
  const profileDir = path.join(DX_CONFIG4, "profile");
925
1031
  const entries = yield* fs.readDirectory(profileDir);
926
1032
  const profileFiles = entries.filter((entry) => entry.endsWith(".yml"));
927
- const profiles = yield* Effect18.forEach(profileFiles, (filename) => Effect18.gen(function* () {
1033
+ const profiles = yield* Effect19.forEach(profileFiles, (filename) => Effect19.gen(function* () {
928
1034
  const name = filename.slice(0, -4);
929
1035
  const configPath = path.join(profileDir, filename);
930
- const configContent = yield* fs.readFileString(configPath).pipe(Effect18.catchTag("SystemError", () => Effect18.succeed("{}")));
1036
+ const configContent = yield* fs.readFileString(configPath).pipe(Effect19.catchTag("SystemError", () => Effect19.succeed("{}")));
931
1037
  const configValues = Yaml2.parse(configContent) ?? {};
932
1038
  const config2 = new Config(configValues);
933
1039
  return {
934
1040
  name,
935
1041
  isCurrent: name === currentProfile,
936
1042
  fullPath: configPath,
937
- storagePath: getProfilePath(configValues?.runtime?.client?.storage?.dataRoot ?? DX_DATA, name),
1043
+ storagePath: getProfilePath2(configValues?.runtime?.client?.storage?.dataRoot ?? DX_DATA2, name),
938
1044
  edge: config2.values.runtime?.services?.edge?.url
939
1045
  };
940
1046
  }));
@@ -948,26 +1054,26 @@ var list3 = Command23.make("list", {}, Effect18.fnUntraced(function* () {
948
1054
  }));
949
1055
 
950
1056
  // src/commands/profile/reset.ts
951
- import * as Command24 from "@effect/cli/Command";
952
- import * as Options9 from "@effect/cli/Options";
953
- import * as Prompt3 from "@effect/cli/Prompt";
954
- import * as FileSystem11 from "@effect/platform/FileSystem";
1057
+ import * as Command25 from "@effect/cli/Command";
1058
+ import * as Options10 from "@effect/cli/Options";
1059
+ import * as Prompt5 from "@effect/cli/Prompt";
1060
+ import * as FileSystem13 from "@effect/platform/FileSystem";
955
1061
  import * as Console19 from "effect/Console";
956
- import * as Effect19 from "effect/Effect";
957
- import { CommandConfig as CommandConfig19, print as print11 } from "@dxos/cli-util";
958
- import { DX_DATA as DX_DATA2, getProfilePath as getProfilePath2 } from "@dxos/client-protocol";
959
- import { ConfigService as ConfigService3 } from "@dxos/config";
960
- var reset = Command24.make("reset", {
961
- force: Options9.boolean("force", {
1062
+ import * as Effect20 from "effect/Effect";
1063
+ import { CommandConfig as CommandConfig19, print as print10 } from "@dxos/cli-util";
1064
+ import { DX_DATA as DX_DATA3, getProfilePath as getProfilePath3 } from "@dxos/client-protocol";
1065
+ import { ConfigService as ConfigService4 } from "@dxos/config";
1066
+ var reset = Command25.make("reset", {
1067
+ force: Options10.boolean("force", {
962
1068
  ifPresent: true
963
- }).pipe(Options9.withDescription("Skip confirmation prompt"))
964
- }, Effect19.fnUntraced(function* ({ force }) {
965
- const fs = yield* FileSystem11.FileSystem;
966
- const config2 = yield* ConfigService3;
1069
+ }).pipe(Options10.withDescription("Skip confirmation prompt"))
1070
+ }, Effect20.fnUntraced(function* ({ force }) {
1071
+ const fs = yield* FileSystem13.FileSystem;
1072
+ const config2 = yield* ConfigService4;
967
1073
  const { json, profile: profile2 } = yield* CommandConfig19;
968
- const path = config2.values.runtime?.client?.storage?.dataRoot ?? getProfilePath2(DX_DATA2, profile2);
1074
+ const path = config2.values.runtime?.client?.storage?.dataRoot ?? getProfilePath3(DX_DATA3, profile2);
969
1075
  if (!force) {
970
- const confirmed = yield* Prompt3.confirm({
1076
+ const confirmed = yield* Prompt5.confirm({
971
1077
  message: `Are you sure you want to reset the profile (${profile2})?`,
972
1078
  initial: false
973
1079
  });
@@ -984,13 +1090,13 @@ var reset = Command24.make("reset", {
984
1090
  reset: true
985
1091
  }, null, 2));
986
1092
  } else {
987
- yield* Console19.log(print11(printProfileReset(profile2)));
1093
+ yield* Console19.log(print10(printProfileReset(profile2)));
988
1094
  }
989
1095
  }));
990
1096
 
991
1097
  // src/commands/profile/index.ts
992
- var profile = Command25.make("profile").pipe(Command25.withDescription("Profile commands."), Command25.withSubcommands([
993
- create2,
1098
+ var profile = Command26.make("profile").pipe(Command26.withDescription("Profile commands."), Command26.withSubcommands([
1099
+ create,
994
1100
  del,
995
1101
  importCommand,
996
1102
  inspect,
@@ -999,10 +1105,11 @@ var profile = Command25.make("profile").pipe(Command25.withDescription("Profile
999
1105
  ]));
1000
1106
 
1001
1107
  // src/ClientPlugin.node.ts
1002
- var ClientPlugin = Plugin2.define(meta).pipe(
1108
+ var ClientPlugin = Plugin.define(meta).pipe(
1003
1109
  // TODO(wittjosiah): Could some of these commands make use of operations?
1004
1110
  AppPlugin.addCommandModule({
1005
1111
  commands: [
1112
+ account,
1006
1113
  config,
1007
1114
  device,
1008
1115
  edge,
@@ -1013,7 +1120,7 @@ var ClientPlugin = Plugin2.define(meta).pipe(
1013
1120
  AppPlugin.addOperationHandlerModule({
1014
1121
  activate: OperationHandler
1015
1122
  }),
1016
- Plugin2.addModule((options) => ({
1123
+ Plugin.addModule((options) => ({
1017
1124
  id: Capability.getModuleTag(Client),
1018
1125
  activatesOn: ActivationEvents.Startup,
1019
1126
  firesAfterActivation: [
@@ -1021,25 +1128,25 @@ var ClientPlugin = Plugin2.define(meta).pipe(
1021
1128
  ],
1022
1129
  activate: () => Client(options)
1023
1130
  })),
1024
- Plugin2.addModule({
1131
+ Plugin.addModule({
1025
1132
  activatesOn: ClientEvents.ClientReady,
1026
1133
  firesBeforeActivation: [
1027
1134
  AppActivationEvents.SetupSchema
1028
1135
  ],
1029
1136
  activate: SchemaDefs
1030
1137
  }),
1031
- Plugin2.addModule({
1138
+ Plugin.addModule({
1032
1139
  activatesOn: ClientEvents.ClientReady,
1033
1140
  firesBeforeActivation: [
1034
1141
  ClientEvents.SetupMigration
1035
1142
  ],
1036
1143
  activate: Migrations
1037
1144
  }),
1038
- Plugin2.addModule({
1145
+ Plugin.addModule({
1039
1146
  activatesOn: ActivationEvents.SetupProcessManager,
1040
1147
  activate: LayerSpecs
1041
1148
  }),
1042
- Plugin2.make
1149
+ Plugin.make
1043
1150
  );
1044
1151
  var ClientPlugin_node_default = ClientPlugin;
1045
1152
  export {