@dxos/plugin-client 0.10.0 → 0.11.1
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/ClientPlugin.mjs +65 -0
- package/dist/lib/ClientPlugin.mjs.map +1 -0
- package/dist/lib/ClientPlugin.node.mjs +904 -0
- package/dist/lib/ClientPlugin.node.mjs.map +1 -0
- package/dist/lib/ClientPlugin.workerd.mjs +10 -0
- package/dist/lib/ClientPlugin.workerd.mjs.map +1 -0
- package/dist/lib/capabilities/node.mjs +13 -0
- package/dist/lib/capabilities/node.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +23 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-AccountContainer.mjs +190 -0
- package/dist/lib/chunk-AccountContainer.mjs.map +1 -0
- package/dist/lib/chunk-DevicesContainer.mjs +275 -0
- package/dist/lib/chunk-DevicesContainer.mjs.map +1 -0
- package/dist/lib/chunk-InvitationsContainer.mjs +149 -0
- package/dist/lib/chunk-InvitationsContainer.mjs.map +1 -0
- package/dist/lib/chunk-JoinDialog.mjs +35 -0
- package/dist/lib/chunk-JoinDialog.mjs.map +1 -0
- package/dist/lib/chunk-ProfileContainer.mjs +145 -0
- package/dist/lib/chunk-ProfileContainer.mjs.map +1 -0
- package/dist/lib/chunk-RecoveryCodeDialog.mjs +72 -0
- package/dist/lib/chunk-RecoveryCodeDialog.mjs.map +1 -0
- package/dist/lib/chunk-RecoveryCredentialsContainer.mjs +65 -0
- package/dist/lib/chunk-RecoveryCredentialsContainer.mjs.map +1 -0
- package/dist/lib/chunk-ResetDialog.mjs +47 -0
- package/dist/lib/chunk-ResetDialog.mjs.map +1 -0
- package/dist/lib/chunk-UsageContainer.mjs +217 -0
- package/dist/lib/chunk-UsageContainer.mjs.map +1 -0
- package/dist/lib/{neutral/account-cache-YVQKLNV2.mjs → chunk-account-cache.mjs} +10 -12
- package/dist/lib/chunk-account-cache.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +111 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-client.mjs +90 -0
- package/dist/lib/chunk-client.mjs.map +1 -0
- package/dist/lib/{neutral/chunk-GSKMAS3S.mjs → chunk-constants.mjs} +5 -8
- package/dist/lib/chunk-constants.mjs.map +1 -0
- package/dist/lib/chunk-create-agent.mjs +23 -0
- package/dist/lib/chunk-create-agent.mjs.map +1 -0
- package/dist/lib/chunk-create-identity.mjs +28 -0
- package/dist/lib/chunk-create-identity.mjs.map +1 -0
- package/dist/lib/chunk-create-passkey.mjs +85 -0
- package/dist/lib/chunk-create-passkey.mjs.map +1 -0
- package/dist/lib/chunk-create-recovery-code.mjs +31 -0
- package/dist/lib/chunk-create-recovery-code.mjs.map +1 -0
- package/dist/lib/chunk-hooks.mjs +29 -0
- package/dist/lib/chunk-hooks.mjs.map +1 -0
- package/dist/lib/chunk-hub-http-client.mjs +14 -0
- package/dist/lib/chunk-hub-http-client.mjs.map +1 -0
- package/dist/lib/chunk-join-identity.mjs +20 -0
- package/dist/lib/chunk-join-identity.mjs.map +1 -0
- package/dist/lib/chunk-layer-specs.mjs +107 -0
- package/dist/lib/chunk-layer-specs.mjs.map +1 -0
- package/dist/lib/{neutral/chunk-6G4KZLBG.mjs → chunk-meta.mjs} +13 -20
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/chunk-migrations.mjs +29 -0
- package/dist/lib/chunk-migrations.mjs.map +1 -0
- package/dist/lib/chunk-navigation-handler.mjs +71 -0
- package/dist/lib/chunk-navigation-handler.mjs.map +1 -0
- package/dist/lib/chunk-navigation-target-loader.mjs +46 -0
- package/dist/lib/chunk-navigation-target-loader.mjs.map +1 -0
- package/dist/lib/chunk-open-usage.mjs +14 -0
- package/dist/lib/chunk-open-usage.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +11 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-operations.mjs +212 -0
- package/dist/lib/chunk-operations.mjs.map +1 -0
- package/dist/lib/chunk-progress.mjs +10 -0
- package/dist/lib/chunk-progress.mjs.map +1 -0
- package/dist/lib/chunk-react-context.mjs +30 -0
- package/dist/lib/chunk-react-context.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +70 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-recover-identity.mjs +17 -0
- package/dist/lib/chunk-recover-identity.mjs.map +1 -0
- package/dist/lib/chunk-redeem-passkey.mjs +72 -0
- package/dist/lib/chunk-redeem-passkey.mjs.map +1 -0
- package/dist/lib/chunk-redeem-token.mjs +24 -0
- package/dist/lib/chunk-redeem-token.mjs.map +1 -0
- package/dist/lib/chunk-remote-trace-monitor.mjs +37 -0
- package/dist/lib/chunk-remote-trace-monitor.mjs.map +1 -0
- package/dist/lib/chunk-reset-storage.mjs +17 -0
- package/dist/lib/chunk-reset-storage.mjs.map +1 -0
- package/dist/lib/chunk-resolve-navigation-targets.mjs +32 -0
- package/dist/lib/chunk-resolve-navigation-targets.mjs.map +1 -0
- package/dist/lib/chunk-schema-defs.mjs +53 -0
- package/dist/lib/chunk-schema-defs.mjs.map +1 -0
- package/dist/lib/chunk-share-identity.mjs +16 -0
- package/dist/lib/chunk-share-identity.mjs.map +1 -0
- package/dist/lib/chunk-space-replication-progress.mjs +94 -0
- package/dist/lib/chunk-space-replication-progress.mjs.map +1 -0
- package/dist/lib/chunk-trace-progress.mjs +69 -0
- package/dist/lib/chunk-trace-progress.mjs.map +1 -0
- package/dist/lib/chunk-update-profile.mjs +15 -0
- package/dist/lib/chunk-update-profile.mjs.map +1 -0
- package/dist/lib/components.mjs +0 -0
- package/dist/lib/containers.mjs +15 -0
- package/dist/lib/containers.mjs.map +1 -0
- package/dist/lib/index.mjs +27 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/operations.mjs +2 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/testing.mjs +21 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/translations.mjs +111 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +139 -0
- package/dist/lib/types.mjs.map +1 -0
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/account-cache.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/client.d.ts +1 -1
- package/dist/types/src/capabilities/client.d.ts.map +1 -1
- package/dist/types/src/capabilities/hub-http-client.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/layer-specs.d.ts +1 -1
- package/dist/types/src/capabilities/migrations.d.ts +1 -1
- package/dist/types/src/capabilities/navigation-handler/navigation-handler.d.ts +3 -1
- package/dist/types/src/capabilities/navigation-handler/navigation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/navigation-target-loader.d.ts +11 -0
- package/dist/types/src/capabilities/navigation-target-loader.d.ts.map +1 -0
- package/dist/types/src/capabilities/node.d.ts +2 -1
- package/dist/types/src/capabilities/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +1 -1
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/remote-trace-monitor.d.ts +15 -0
- package/dist/types/src/capabilities/remote-trace-monitor.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema-defs.d.ts +1 -1
- package/dist/types/src/capabilities/space-replication-progress.d.ts +11 -0
- package/dist/types/src/capabilities/space-replication-progress.d.ts.map +1 -0
- package/dist/types/src/capabilities/trace-progress.d.ts +17 -0
- package/dist/types/src/capabilities/trace-progress.d.ts.map +1 -0
- package/dist/types/src/commands/account/login/login.d.ts +2 -1
- package/dist/types/src/commands/account/login/login.d.ts.map +1 -1
- package/dist/types/src/commands/account/logout/logout.d.ts +1 -1
- package/dist/types/src/commands/account/logout/logout.d.ts.map +1 -1
- package/dist/types/src/commands/halo/index.d.ts.map +1 -1
- package/dist/types/src/commands/halo/share/share.d.ts.map +1 -1
- package/dist/types/src/commands/profile/create.d.ts.map +1 -1
- package/dist/types/src/containers/AccountContainer/AccountContainer.d.ts +4 -1
- package/dist/types/src/containers/AccountContainer/AccountContainer.d.ts.map +1 -1
- package/dist/types/src/containers/AccountContainer/AccountContainer.stories.d.ts +4 -1
- package/dist/types/src/containers/AccountContainer/AccountContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DevicesContainer/DevicesContainer.d.ts +4 -1
- package/dist/types/src/containers/DevicesContainer/DevicesContainer.d.ts.map +1 -1
- package/dist/types/src/containers/DevicesContainer/DevicesContainer.stories.d.ts +4 -1
- package/dist/types/src/containers/DevicesContainer/DevicesContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/InvitationsContainer/InvitationsContainer.d.ts +4 -1
- package/dist/types/src/containers/InvitationsContainer/InvitationsContainer.d.ts.map +1 -1
- package/dist/types/src/containers/InvitationsContainer/InvitationsContainer.stories.d.ts +4 -1
- package/dist/types/src/containers/InvitationsContainer/InvitationsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/JoinDialog/JoinDialog.d.ts +4 -1
- package/dist/types/src/containers/JoinDialog/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/containers/JoinDialog/JoinDialog.stories.d.ts +4 -1
- package/dist/types/src/containers/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ProfileContainer/ProfileContainer.d.ts +4 -1
- package/dist/types/src/containers/ProfileContainer/ProfileContainer.d.ts.map +1 -1
- package/dist/types/src/containers/ProfileContainer/ProfileContainer.stories.d.ts +4 -1
- package/dist/types/src/containers/ProfileContainer/ProfileContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.d.ts +4 -1
- package/dist/types/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.d.ts +4 -1
- package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.d.ts.map +1 -1
- package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.d.ts +4 -1
- package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ResetDialog/ResetDialog.d.ts +4 -1
- package/dist/types/src/containers/ResetDialog/ResetDialog.d.ts.map +1 -1
- package/dist/types/src/containers/ResetDialog/ResetDialog.stories.d.ts +4 -1
- package/dist/types/src/containers/ResetDialog/ResetDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/UsageContainer/UsageContainer.d.ts +4 -5
- package/dist/types/src/containers/UsageContainer/UsageContainer.d.ts.map +1 -1
- package/dist/types/src/containers/UsageContainer/UsageView.d.ts +4 -7
- package/dist/types/src/containers/UsageContainer/UsageView.d.ts.map +1 -1
- package/dist/types/src/containers/UsageContainer/UsageView.stories.d.ts +4 -2
- package/dist/types/src/containers/UsageContainer/UsageView.stories.d.ts.map +1 -1
- package/dist/types/src/halo-services-layer.d.ts +19 -0
- package/dist/types/src/halo-services-layer.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +9 -1
- package/dist/types/src/operations/definitions.d.ts.map +1 -1
- package/dist/types/src/operations/errors.d.ts +109 -0
- package/dist/types/src/operations/errors.d.ts.map +1 -0
- package/dist/types/src/operations/errors.test.d.ts +2 -0
- package/dist/types/src/operations/errors.test.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +1 -0
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/redeem-passkey.d.ts.map +1 -1
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +5 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -0
- package/dist/types/src/operations/update-profile.d.ts +5 -0
- package/dist/types/src/operations/update-profile.d.ts.map +1 -0
- package/dist/types/src/progress/index.d.ts +2 -0
- package/dist/types/src/progress/index.d.ts.map +1 -0
- package/dist/types/src/progress/progress-keys.d.ts +6 -0
- package/dist/types/src/progress/progress-keys.d.ts.map +1 -0
- package/dist/types/src/testing/initializeIdentity.d.ts +5 -1
- package/dist/types/src/testing/initializeIdentity.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +10 -1
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +6 -0
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -55
- package/src/ClientPlugin.ts +25 -2
- package/src/capabilities/app-graph-builder.ts +1 -1
- package/src/capabilities/client.ts +26 -0
- package/src/capabilities/index.ts +10 -0
- package/src/capabilities/layer-specs.ts +64 -2
- package/src/capabilities/migrations.ts +9 -1
- package/src/capabilities/navigation-handler/navigation-handler.ts +20 -3
- package/src/capabilities/navigation-target-loader.ts +70 -0
- package/src/capabilities/react-context.tsx +20 -2
- package/src/capabilities/{react-surface.tsx → react-surface.ts} +14 -12
- package/src/capabilities/remote-trace-monitor.ts +62 -0
- package/src/capabilities/space-replication-progress.ts +143 -0
- package/src/capabilities/trace-progress.ts +84 -0
- package/src/commands/account/login/login.ts +48 -6
- package/src/commands/account/logout/logout.ts +4 -0
- package/src/commands/halo/index.ts +6 -2
- package/src/commands/halo/share/share.ts +16 -5
- package/src/commands/profile/create.ts +23 -40
- package/src/containers/AccountContainer/AccountContainer.tsx +6 -5
- package/src/containers/DevicesContainer/DevicesContainer.tsx +2 -0
- package/src/containers/InvitationsContainer/InvitationsContainer.tsx +2 -0
- package/src/containers/JoinDialog/JoinDialog.tsx +2 -0
- package/src/containers/ProfileContainer/ProfileContainer.tsx +19 -13
- package/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.tsx +2 -0
- package/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.tsx +7 -9
- package/src/containers/ResetDialog/ResetDialog.tsx +2 -0
- package/src/containers/UsageContainer/UsageContainer.tsx +10 -1
- package/src/containers/UsageContainer/UsageView.stories.tsx +0 -12
- package/src/containers/UsageContainer/UsageView.tsx +9 -10
- package/src/halo-services-layer.ts +29 -0
- package/src/index.ts +9 -0
- package/src/operations/definitions.ts +9 -1
- package/src/operations/errors.test.ts +27 -0
- package/src/operations/errors.ts +47 -0
- package/src/operations/index.ts +3 -0
- package/src/operations/open-usage.ts +3 -3
- package/src/operations/redeem-passkey.ts +85 -55
- package/src/operations/resolve-navigation-targets.ts +71 -0
- package/src/operations/share-identity.ts +3 -3
- package/src/operations/update-profile.ts +20 -0
- package/src/progress/index.ts +5 -0
- package/src/progress/progress-keys.ts +15 -0
- package/src/testing/initializeIdentity.ts +10 -2
- package/src/translations.ts +2 -0
- package/src/types/capabilities.ts +15 -1
- package/src/types/schema.ts +7 -0
- package/dist/lib/neutral/AccountContainer-7SF53UON.mjs +0 -186
- package/dist/lib/neutral/AccountContainer-7SF53UON.mjs.map +0 -7
- package/dist/lib/neutral/ClientPlugin.mjs +0 -72
- package/dist/lib/neutral/ClientPlugin.mjs.map +0 -7
- package/dist/lib/neutral/ClientPlugin.node.mjs +0 -1156
- package/dist/lib/neutral/ClientPlugin.node.mjs.map +0 -7
- package/dist/lib/neutral/ClientPlugin.workerd.mjs +0 -16
- package/dist/lib/neutral/ClientPlugin.workerd.mjs.map +0 -7
- package/dist/lib/neutral/DevicesContainer-PRWIN36N.mjs +0 -271
- package/dist/lib/neutral/DevicesContainer-PRWIN36N.mjs.map +0 -7
- package/dist/lib/neutral/InvitationsContainer-BI5RAWET.mjs +0 -143
- package/dist/lib/neutral/InvitationsContainer-BI5RAWET.mjs.map +0 -7
- package/dist/lib/neutral/JoinDialog-4BWV4CYB.mjs +0 -53
- package/dist/lib/neutral/JoinDialog-4BWV4CYB.mjs.map +0 -7
- package/dist/lib/neutral/ProfileContainer-YEAYOTX5.mjs +0 -169
- package/dist/lib/neutral/ProfileContainer-YEAYOTX5.mjs.map +0 -7
- package/dist/lib/neutral/RecoveryCodeDialog-7EPNKCLB.mjs +0 -59
- package/dist/lib/neutral/RecoveryCodeDialog-7EPNKCLB.mjs.map +0 -7
- package/dist/lib/neutral/RecoveryCredentialsContainer-6BZ2IWX7.mjs +0 -60
- package/dist/lib/neutral/RecoveryCredentialsContainer-6BZ2IWX7.mjs.map +0 -7
- package/dist/lib/neutral/ResetDialog-KUWX45JY.mjs +0 -57
- package/dist/lib/neutral/ResetDialog-KUWX45JY.mjs.map +0 -7
- package/dist/lib/neutral/UsageContainer-2DWCVVE4.mjs +0 -241
- package/dist/lib/neutral/UsageContainer-2DWCVVE4.mjs.map +0 -7
- package/dist/lib/neutral/account-cache-YVQKLNV2.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-RVXTD6OE.mjs +0 -159
- package/dist/lib/neutral/app-graph-builder-RVXTD6OE.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/index.mjs +0 -34
- package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/node.mjs +0 -21
- package/dist/lib/neutral/capabilities/node.mjs.map +0 -7
- package/dist/lib/neutral/chunk-6G4KZLBG.mjs.map +0 -7
- package/dist/lib/neutral/chunk-7DEIKHB7.mjs +0 -199
- package/dist/lib/neutral/chunk-7DEIKHB7.mjs.map +0 -7
- package/dist/lib/neutral/chunk-A7WDDIWY.mjs +0 -162
- package/dist/lib/neutral/chunk-A7WDDIWY.mjs.map +0 -7
- package/dist/lib/neutral/chunk-GSKMAS3S.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-JY35S2CN.mjs +0 -27
- package/dist/lib/neutral/chunk-JY35S2CN.mjs.map +0 -7
- package/dist/lib/neutral/chunk-ZFABGG2E.mjs +0 -8
- package/dist/lib/neutral/chunk-ZFABGG2E.mjs.map +0 -7
- package/dist/lib/neutral/client-7I5Y5SOA.mjs +0 -62
- package/dist/lib/neutral/client-7I5Y5SOA.mjs.map +0 -7
- package/dist/lib/neutral/components/index.mjs +0 -1
- package/dist/lib/neutral/components/index.mjs.map +0 -7
- package/dist/lib/neutral/containers/index.mjs +0 -25
- package/dist/lib/neutral/containers/index.mjs.map +0 -7
- package/dist/lib/neutral/create-agent-6UKJMZS5.mjs +0 -26
- package/dist/lib/neutral/create-agent-6UKJMZS5.mjs.map +0 -7
- package/dist/lib/neutral/create-identity-ULCRB3YH.mjs +0 -42
- package/dist/lib/neutral/create-identity-ULCRB3YH.mjs.map +0 -7
- package/dist/lib/neutral/create-passkey-I7VDS3AC.mjs +0 -81
- package/dist/lib/neutral/create-passkey-I7VDS3AC.mjs.map +0 -7
- package/dist/lib/neutral/create-recovery-code-DH2B6EGP.mjs +0 -36
- package/dist/lib/neutral/create-recovery-code-DH2B6EGP.mjs.map +0 -7
- package/dist/lib/neutral/hub-http-client-WOJUCDKV.mjs +0 -19
- package/dist/lib/neutral/hub-http-client-WOJUCDKV.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -25
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/join-identity-PJCHDNLH.mjs +0 -27
- package/dist/lib/neutral/join-identity-PJCHDNLH.mjs.map +0 -7
- package/dist/lib/neutral/layer-specs-YI7BVWKZ.mjs +0 -59
- package/dist/lib/neutral/layer-specs-YI7BVWKZ.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/meta.mjs +0 -8
- package/dist/lib/neutral/meta.mjs.map +0 -7
- package/dist/lib/neutral/migrations-7FTW55ER.mjs +0 -23
- package/dist/lib/neutral/migrations-7FTW55ER.mjs.map +0 -7
- package/dist/lib/neutral/navigation-handler-MQ6MZXLX.mjs +0 -46
- package/dist/lib/neutral/navigation-handler-MQ6MZXLX.mjs.map +0 -7
- package/dist/lib/neutral/open-usage-OJVTPGOY.mjs +0 -27
- package/dist/lib/neutral/open-usage-OJVTPGOY.mjs.map +0 -7
- package/dist/lib/neutral/operation-handler-E3HB7E2T.mjs +0 -13
- package/dist/lib/neutral/operation-handler-E3HB7E2T.mjs.map +0 -7
- package/dist/lib/neutral/operations/index.mjs +0 -12
- package/dist/lib/neutral/operations/index.mjs.map +0 -7
- package/dist/lib/neutral/plugin.mjs +0 -17
- package/dist/lib/neutral/plugin.mjs.map +0 -7
- package/dist/lib/neutral/react-context-V74T6JOJ.mjs +0 -23
- package/dist/lib/neutral/react-context-V74T6JOJ.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-HPXRA65U.mjs +0 -75
- package/dist/lib/neutral/react-surface-HPXRA65U.mjs.map +0 -7
- package/dist/lib/neutral/recover-identity-B7YM2BR4.mjs +0 -26
- package/dist/lib/neutral/recover-identity-B7YM2BR4.mjs.map +0 -7
- package/dist/lib/neutral/redeem-passkey-TYP4XLHO.mjs +0 -66
- package/dist/lib/neutral/redeem-passkey-TYP4XLHO.mjs.map +0 -7
- package/dist/lib/neutral/redeem-token-2J33R3PV.mjs +0 -29
- package/dist/lib/neutral/redeem-token-2J33R3PV.mjs.map +0 -7
- package/dist/lib/neutral/reset-storage-K47HZTGP.mjs +0 -26
- package/dist/lib/neutral/reset-storage-K47HZTGP.mjs.map +0 -7
- package/dist/lib/neutral/schema-defs-IHBCKTMM.mjs +0 -51
- package/dist/lib/neutral/schema-defs-IHBCKTMM.mjs.map +0 -7
- package/dist/lib/neutral/share-identity-TOROBLWL.mjs +0 -31
- package/dist/lib/neutral/share-identity-TOROBLWL.mjs.map +0 -7
- package/dist/lib/neutral/testing/index.mjs +0 -25
- package/dist/lib/neutral/testing/index.mjs.map +0 -7
- package/dist/lib/neutral/translations.mjs +0 -124
- package/dist/lib/neutral/translations.mjs.map +0 -7
- package/dist/lib/neutral/types/index.mjs +0 -16
- package/dist/lib/neutral/types/index.mjs.map +0 -7
|
@@ -0,0 +1,904 @@
|
|
|
1
|
+
import { ActivationEvents, Capabilities, Capability, Plugin } from "@dxos/app-framework";
|
|
2
|
+
import { arrayToBuffer, trim } from "@dxos/util";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
import { AppActivationEvents, AppPlugin, AppSpace } from "@dxos/app-toolkit";
|
|
5
|
+
import { Client, LayerSpecs, Migrations, OperationHandler, SchemaDefs } from "#capabilities";
|
|
6
|
+
import { ClientEvents } from "#types";
|
|
7
|
+
import * as Command from "@effect/cli/Command";
|
|
8
|
+
import * as Args from "@effect/cli/Args";
|
|
9
|
+
import * as Options from "@effect/cli/Options";
|
|
10
|
+
import * as Prompt from "@effect/cli/Prompt";
|
|
11
|
+
import * as Console from "effect/Console";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as Match from "effect/Match";
|
|
14
|
+
import * as Option from "effect/Option";
|
|
15
|
+
import { CommandConfig, Common, FormBuilder, copyToClipboard, flushAndSync, getSpace, openBrowser, performRecoveryOAuthFlow, print, printList, spaceLayer } from "@dxos/cli-util";
|
|
16
|
+
import { ClientService, Config, ConfigService } from "@dxos/client";
|
|
17
|
+
import { Invitation, InvitationEncoder, hostInvitation } from "@dxos/client/invitations";
|
|
18
|
+
import { Context } from "@dxos/context";
|
|
19
|
+
import { HubHttpClient as HubHttpClient$1 } from "@dxos/edge-client";
|
|
20
|
+
import { invariant } from "@dxos/invariant";
|
|
21
|
+
import { ATPROTO_OAUTH_SCOPES, OAuthProvider, ProfileArchiveEntryType } from "@dxos/protocols";
|
|
22
|
+
import { ClientOperation } from "#operations";
|
|
23
|
+
import * as Duration from "effect/Duration";
|
|
24
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
25
|
+
import { DX_CONFIG, DX_DATA, getProfileConfigPath, getProfilePath } from "@dxos/client-protocol";
|
|
26
|
+
import { ConfigService as ConfigService$1 } from "@dxos/config";
|
|
27
|
+
import * as Yaml from "yaml";
|
|
28
|
+
import { DeviceType, MembershipPolicy } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
29
|
+
import { Device, DeviceKind, DeviceType as DeviceType$1 } from "@dxos/client/halo";
|
|
30
|
+
import { createEdgeIdentity } from "@dxos/client/edge";
|
|
31
|
+
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
32
|
+
import { schema } from "@dxos/protocols/proto";
|
|
33
|
+
import * as Path from "@effect/platform/Path";
|
|
34
|
+
import * as Record from "effect/Record";
|
|
35
|
+
import { log } from "@dxos/log";
|
|
36
|
+
//#region src/commands/halo/util.ts
|
|
37
|
+
/**
|
|
38
|
+
* Pretty prints an identity with ANSI colors.
|
|
39
|
+
*/
|
|
40
|
+
var printIdentity = (identity) => FormBuilder.make({ title: "Identity" }).pipe(FormBuilder.set("identityDid", identity.identityDid), FormBuilder.set("displayName", identity.profile?.displayName ?? "<none>"), FormBuilder.build);
|
|
41
|
+
var TERMINAL_FAILURE_STATES = /* @__PURE__ */ new Set([
|
|
42
|
+
Invitation.State.CANCELLED,
|
|
43
|
+
Invitation.State.TIMEOUT,
|
|
44
|
+
Invitation.State.ERROR,
|
|
45
|
+
Invitation.State.EXPIRED
|
|
46
|
+
]);
|
|
47
|
+
/** Await an authenticating invitation reaching the given state. */
|
|
48
|
+
var waitForState = (invitation, state) => Effect.async((resume) => {
|
|
49
|
+
const subscription = invitation.subscribe((inv) => {
|
|
50
|
+
if (inv.state === state) resume(Effect.void);
|
|
51
|
+
else if (TERMINAL_FAILURE_STATES.has(inv.state)) resume(Effect.fail(/* @__PURE__ */ new Error(`Invitation failed with state: ${Invitation.State[inv.state]}`)));
|
|
52
|
+
});
|
|
53
|
+
return Effect.sync(() => subscription.unsubscribe());
|
|
54
|
+
}).pipe(Effect.timeout(Duration.minutes(3)));
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/commands/account/login/login.ts
|
|
57
|
+
var __dxlog_file$4 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/account/login/login.ts";
|
|
58
|
+
var LOGIN_METHODS = [
|
|
59
|
+
"email",
|
|
60
|
+
"atproto",
|
|
61
|
+
"device-invitation",
|
|
62
|
+
"recovery-code"
|
|
63
|
+
];
|
|
64
|
+
var METHOD_CHOICES = [
|
|
65
|
+
{
|
|
66
|
+
title: "Email",
|
|
67
|
+
value: "email"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: "AT Protocol",
|
|
71
|
+
value: "atproto"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: "Device invitation",
|
|
75
|
+
value: "device-invitation"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: "Recovery code",
|
|
79
|
+
value: "recovery-code"
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
var INPUT_PROMPT = {
|
|
83
|
+
"email": "Email address",
|
|
84
|
+
"atproto": "atproto handle or DID (e.g. alice.bsky.social)",
|
|
85
|
+
"device-invitation": "Invitation code or URL",
|
|
86
|
+
"recovery-code": "Recovery code (seed phrase)"
|
|
87
|
+
};
|
|
88
|
+
var login = Command.make("login", {
|
|
89
|
+
method: Options.choice("method", LOGIN_METHODS).pipe(Options.withDescription("Login method (email | atproto | device-invitation | recovery-code). Prompted if omitted."), Options.optional),
|
|
90
|
+
input: Args.text({ name: "input" }).pipe(Args.withDescription("Method input: email address / atproto handle / invitation code / recovery code."), Args.optional)
|
|
91
|
+
}, Effect.fn(function* ({ method, input }) {
|
|
92
|
+
const { json } = yield* CommandConfig;
|
|
93
|
+
const client = yield* ClientService;
|
|
94
|
+
const { invoke } = (yield* Plugin.Service).capabilities.get(Capabilities.OperationInvoker);
|
|
95
|
+
invariant(!client.halo.identity.get(), "Already logged in. Run `dx account logout` first.", {
|
|
96
|
+
"~LogMeta": "~LogMeta",
|
|
97
|
+
F: __dxlog_file$4,
|
|
98
|
+
L: 65,
|
|
99
|
+
S: this,
|
|
100
|
+
A: ["!client.halo.identity.get()", "'Already logged in. Run `dx account logout` first.'"]
|
|
101
|
+
});
|
|
102
|
+
const resolvedMethod = Option.isSome(method) ? method.value : yield* Prompt.select({
|
|
103
|
+
message: "Choose a login method:",
|
|
104
|
+
choices: METHOD_CHOICES
|
|
105
|
+
}).pipe(Prompt.run);
|
|
106
|
+
const resolvedInput = Option.isSome(input) ? input.value : yield* Prompt.text({ message: `${INPUT_PROMPT[resolvedMethod]}:` }).pipe(Prompt.run);
|
|
107
|
+
const identity = yield* Match.value(resolvedMethod).pipe(Match.when("atproto", () => loginWithAtproto(client, resolvedInput)), Match.when("email", () => loginWithEmail(client, resolvedInput, invoke)), Match.when("recovery-code", () => loginWithRecoveryCode(client, resolvedInput)), Match.when("device-invitation", () => loginWithDeviceInvitation(client, resolvedInput)), Match.exhaustive);
|
|
108
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
109
|
+
identityDid: identity.did,
|
|
110
|
+
displayName: identity.profile?.displayName
|
|
111
|
+
}, null, 2));
|
|
112
|
+
else {
|
|
113
|
+
yield* Console.log("Logged in successfully");
|
|
114
|
+
yield* Console.log(print(printIdentity({
|
|
115
|
+
identityDid: identity.did,
|
|
116
|
+
profile: identity.profile
|
|
117
|
+
})));
|
|
118
|
+
}
|
|
119
|
+
})).pipe(Command.withDescription("Log in to an existing DXOS identity (same methods as Composer)."));
|
|
120
|
+
/**
|
|
121
|
+
* atproto / Bluesky OAuth login: runs the gate recovery flow (local server + browser) and redeems
|
|
122
|
+
* the resulting one-time `recoveryProof` to admit this device into the existing identity's HALO.
|
|
123
|
+
*/
|
|
124
|
+
var loginWithAtproto = (client, handle) => Effect.gen(function* () {
|
|
125
|
+
const edgeBaseUrl = client.config.values.runtime?.services?.edge?.url;
|
|
126
|
+
invariant(edgeBaseUrl, "Edge services not configured (runtime.services.edge.url).", {
|
|
127
|
+
"~LogMeta": "~LogMeta",
|
|
128
|
+
F: __dxlog_file$4,
|
|
129
|
+
L: 101,
|
|
130
|
+
S: this,
|
|
131
|
+
A: ["edgeBaseUrl", "'Edge services not configured (runtime.services.edge.url).'"]
|
|
132
|
+
});
|
|
133
|
+
const { recoveryProof } = yield* performRecoveryOAuthFlow({
|
|
134
|
+
edgeBaseUrl,
|
|
135
|
+
provider: OAuthProvider.ATPROTO,
|
|
136
|
+
scopes: ATPROTO_OAUTH_SCOPES,
|
|
137
|
+
loginHint: handle
|
|
138
|
+
});
|
|
139
|
+
return yield* Effect.tryPromise(() => client.halo.recoverIdentity({ recoveryProof }));
|
|
140
|
+
});
|
|
141
|
+
/** Recovery-code (seed phrase) login. */
|
|
142
|
+
var loginWithRecoveryCode = (client, recoveryCode) => Effect.tryPromise(() => client.halo.recoverIdentity({ recoveryCode }));
|
|
143
|
+
/**
|
|
144
|
+
* Email login, mirroring the gate's login tab (`WelcomeScreen.handleLogin`). Hub-service answers in
|
|
145
|
+
* one of three ways:
|
|
146
|
+
*
|
|
147
|
+
* - `needsIdentity`: the address may bind a fresh Account but has no identity yet. Create one
|
|
148
|
+
* locally and retry with its DID; the hub then admits it directly — there is no token because
|
|
149
|
+
* there is nothing to recover — and we provision the agent as the gate does.
|
|
150
|
+
* - `token`: an Account exists and the hub returned a one-time recovery token inline.
|
|
151
|
+
* - neither: the link went out by email, so prompt for the token from the message.
|
|
152
|
+
*/
|
|
153
|
+
var loginWithEmail = (client, email, invoke) => Effect.gen(function* () {
|
|
154
|
+
const hubUrl = client.config.values?.runtime?.app?.env?.DX_HUB_URL;
|
|
155
|
+
invariant(hubUrl, "Hub URL not configured (runtime.app.env.DX_HUB_URL).", {
|
|
156
|
+
"~LogMeta": "~LogMeta",
|
|
157
|
+
F: __dxlog_file$4,
|
|
158
|
+
L: 128,
|
|
159
|
+
S: this,
|
|
160
|
+
A: ["hubUrl", "'Hub URL not configured (runtime.app.env.DX_HUB_URL).'"]
|
|
161
|
+
});
|
|
162
|
+
const hub = new HubHttpClient$1(hubUrl);
|
|
163
|
+
const result = yield* Effect.tryPromise(() => hub.login(Context.default(void 0, {
|
|
164
|
+
"~LogMeta": "~LogMeta",
|
|
165
|
+
F: __dxlog_file$4,
|
|
166
|
+
L: 130
|
|
167
|
+
}), { email }));
|
|
168
|
+
if (result.needsIdentity) {
|
|
169
|
+
yield* invoke(ClientOperation.CreateIdentity, { displayName: email.split("@")[0] });
|
|
170
|
+
const identity = client.halo.identity.get();
|
|
171
|
+
invariant(identity, "identity should exist after create", {
|
|
172
|
+
"~LogMeta": "~LogMeta",
|
|
173
|
+
F: __dxlog_file$4,
|
|
174
|
+
L: 136,
|
|
175
|
+
S: this,
|
|
176
|
+
A: ["identity", "'identity should exist after create'"]
|
|
177
|
+
});
|
|
178
|
+
const notAdmitted = (detail) => /* @__PURE__ */ new Error(`Hub did not admit ${email} (${detail}). A local identity was created and remains bound to this profile; run \`dx account logout\` to clear it before retrying.`);
|
|
179
|
+
if (!(yield* Effect.tryPromise({
|
|
180
|
+
try: () => hub.login(Context.default(void 0, {
|
|
181
|
+
"~LogMeta": "~LogMeta",
|
|
182
|
+
F: __dxlog_file$4,
|
|
183
|
+
L: 148
|
|
184
|
+
}), {
|
|
185
|
+
email,
|
|
186
|
+
identityDid: identity.did,
|
|
187
|
+
identityKey: identity.identityKey.toHex()
|
|
188
|
+
}),
|
|
189
|
+
catch: (cause) => notAdmitted(cause instanceof Error ? cause.message : String(cause))
|
|
190
|
+
})).admitted) return yield* Effect.fail(notAdmitted("no admission granted"));
|
|
191
|
+
yield* invoke(ClientOperation.CreateAgent);
|
|
192
|
+
return identity;
|
|
193
|
+
}
|
|
194
|
+
let token = result.token;
|
|
195
|
+
if (!token) {
|
|
196
|
+
yield* Console.log(`A login link was sent to ${email}. Paste the token from the email below.`);
|
|
197
|
+
token = yield* Prompt.text({ message: "Login token" }).pipe(Prompt.run);
|
|
198
|
+
}
|
|
199
|
+
return yield* Effect.tryPromise(() => client.halo.recoverIdentity({ token }));
|
|
200
|
+
});
|
|
201
|
+
/**
|
|
202
|
+
* Device-invitation login: joins an existing identity from another authorized device.
|
|
203
|
+
*
|
|
204
|
+
* NOTE: p2p networking does not work in bun — this method will likely hang waiting for the peer.
|
|
205
|
+
*/
|
|
206
|
+
var loginWithDeviceInvitation = (client, encoded) => Effect.gen(function* () {
|
|
207
|
+
let code = encoded;
|
|
208
|
+
if (code.startsWith("http") || code.startsWith("socket")) code = new URL(code).searchParams.get("deviceInvitationCode") ?? code;
|
|
209
|
+
const invitation = client.halo.join(InvitationEncoder.decode(code));
|
|
210
|
+
yield* waitForState(invitation, Invitation.State.READY_FOR_AUTHENTICATION);
|
|
211
|
+
const authCode = yield* Prompt.text({ message: "Enter the authentication code" }).pipe(Prompt.run);
|
|
212
|
+
yield* Effect.tryPromise(() => invitation.authenticate(authCode));
|
|
213
|
+
yield* waitForState(invitation, Invitation.State.SUCCESS);
|
|
214
|
+
const identity = client.halo.identity.get();
|
|
215
|
+
invariant(identity, "Device invitation completed but no identity is present.", {
|
|
216
|
+
"~LogMeta": "~LogMeta",
|
|
217
|
+
F: __dxlog_file$4,
|
|
218
|
+
L: 187,
|
|
219
|
+
S: this,
|
|
220
|
+
A: ["identity", "'Device invitation completed but no identity is present.'"]
|
|
221
|
+
});
|
|
222
|
+
return identity;
|
|
223
|
+
});
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/commands/account/logout/logout.ts
|
|
226
|
+
var logout = Command.make("logout", { force: Options.boolean("force", { ifPresent: true }).pipe(Options.withDescription("Skip confirmation prompt.")) }, Effect.fnUntraced(function* ({ force }) {
|
|
227
|
+
const fs = yield* FileSystem.FileSystem;
|
|
228
|
+
const config = yield* ConfigService$1;
|
|
229
|
+
const { json, profile } = yield* CommandConfig;
|
|
230
|
+
const path = config.values.runtime?.client?.storage?.dataRoot ?? getProfilePath(DX_DATA, profile);
|
|
231
|
+
if (!force) {
|
|
232
|
+
if (!(yield* Prompt.confirm({
|
|
233
|
+
message: `Log out of profile (${profile})? This removes the local identity and data; spaces re-sync on next login.`,
|
|
234
|
+
initial: false
|
|
235
|
+
}).pipe(Prompt.run))) return;
|
|
236
|
+
}
|
|
237
|
+
yield* fs.remove(path, { recursive: true }).pipe(Effect.catchIf((e) => e._tag === "SystemError" && e.reason === "NotFound", () => Effect.void));
|
|
238
|
+
yield* fs.makeDirectory(path, { recursive: true });
|
|
239
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
240
|
+
profile,
|
|
241
|
+
loggedOut: true
|
|
242
|
+
}, null, 2));
|
|
243
|
+
else yield* Console.log(`Logged out of profile (${profile}).`);
|
|
244
|
+
})).pipe(Command.withDescription("Log out of the current profile (clears the local identity and data)."));
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/commands/account/index.ts
|
|
247
|
+
var account = Command.make("account").pipe(Command.withDescription("Log in and out of a DXOS identity."), Command.withSubcommands([login, logout]));
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/commands/config/view.ts
|
|
250
|
+
var view = Command.make("view", {}, Effect.fnUntraced(function* () {
|
|
251
|
+
const config = yield* ConfigService;
|
|
252
|
+
const { json, profile } = yield* CommandConfig;
|
|
253
|
+
const configPath = getProfileConfigPath(DX_CONFIG, profile);
|
|
254
|
+
if (json) yield* Console.log(JSON.stringify(config.values, null, 2));
|
|
255
|
+
else {
|
|
256
|
+
yield* Console.log(`Path: ${configPath}`);
|
|
257
|
+
yield* Console.log(Yaml.stringify(config.values));
|
|
258
|
+
}
|
|
259
|
+
}));
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/commands/config/index.ts
|
|
262
|
+
var config = Command.make("config").pipe(Command.withDescription("Config commands."), Command.withSubcommands([view]));
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/commands/device/util.ts
|
|
265
|
+
var maybeTruncateKey = (key, truncate = false) => truncate ? key.truncate() : key.toHex();
|
|
266
|
+
var getDeviceTitle = (device) => {
|
|
267
|
+
if (device.profile?.label) return device.profile.label;
|
|
268
|
+
return `${device.profile?.platform ?? "Unknown"} on ${device.profile?.os ?? "Unknown"}`;
|
|
269
|
+
};
|
|
270
|
+
var mapDevices = (devices, truncateKeys = false) => {
|
|
271
|
+
return devices.map((device) => ({
|
|
272
|
+
label: device.profile?.label,
|
|
273
|
+
type: device.profile?.type ? DeviceType$1[device.profile?.type] : "UNKNOWN",
|
|
274
|
+
key: maybeTruncateKey(device.deviceKey, truncateKeys),
|
|
275
|
+
kind: DeviceKind[device.kind],
|
|
276
|
+
platform: device.profile?.platform,
|
|
277
|
+
platformVersion: device.profile?.platformVersion,
|
|
278
|
+
architecture: device.profile?.architecture,
|
|
279
|
+
os: device.profile?.os,
|
|
280
|
+
osVersion: device.profile?.osVersion,
|
|
281
|
+
presence: device?.kind === DeviceKind.CURRENT ? "THIS DEVICE" : Device.PresenceState[device.presence]
|
|
282
|
+
}));
|
|
283
|
+
};
|
|
284
|
+
var printDevice = (device) => FormBuilder.make({ title: getDeviceTitle(device) }).pipe(FormBuilder.set("deviceKey", device.deviceKey.truncate()), FormBuilder.set("label", device.profile?.label ?? "<none>"), FormBuilder.set("type", device.profile?.type ? DeviceType$1[device.profile?.type] : "UNKNOWN"), FormBuilder.set("kind", DeviceKind[device.kind]), FormBuilder.set("presence", device?.kind === DeviceKind.CURRENT ? "THIS DEVICE" : Device.PresenceState[device.presence]), FormBuilder.set("platform", device.profile?.platform ?? "<none>"), FormBuilder.set("platformVersion", device.profile?.platformVersion ?? "<none>"), FormBuilder.set("architecture", device.profile?.architecture ?? "<none>"), FormBuilder.set("os", device.profile?.os ?? "<none>"), FormBuilder.set("osVersion", device.profile?.osVersion ?? "<none>"), FormBuilder.build);
|
|
285
|
+
var printDevices = (devices) => {
|
|
286
|
+
return devices.map(printDevice);
|
|
287
|
+
};
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/commands/device/info/info.ts
|
|
290
|
+
var handler$12 = Effect.fn(function* () {
|
|
291
|
+
const { json } = yield* CommandConfig;
|
|
292
|
+
const device = (yield* ClientService).halo.device;
|
|
293
|
+
if (!device) {
|
|
294
|
+
if (json) yield* Console.log(JSON.stringify({ error: "No device found" }, null, 2));
|
|
295
|
+
else yield* Console.log("No device found.");
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
299
|
+
deviceKey: device.deviceKey.toHex(),
|
|
300
|
+
profile: {
|
|
301
|
+
...device.profile,
|
|
302
|
+
type: device.profile?.type ? DeviceType[device.profile?.type] : "UNKNOWN"
|
|
303
|
+
}
|
|
304
|
+
}, null, 2));
|
|
305
|
+
else yield* Console.log(print(printDevice(device)));
|
|
306
|
+
});
|
|
307
|
+
var info = Command.make("info", {}, handler$12).pipe(Command.withDescription("Show device info."));
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/commands/device/list/list.ts
|
|
310
|
+
var handler$11 = Effect.fn(function* () {
|
|
311
|
+
const { json } = yield* CommandConfig;
|
|
312
|
+
const devices = (yield* ClientService).halo.devices.get();
|
|
313
|
+
if (json) yield* Console.log(JSON.stringify(mapDevices(devices), null, 2));
|
|
314
|
+
else {
|
|
315
|
+
const formatted = printDevices(devices);
|
|
316
|
+
yield* Console.log(printList(formatted));
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
var list$2 = Command.make("list", {}, handler$11).pipe(Command.withDescription("List devices."));
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/commands/device/update/update.ts
|
|
322
|
+
var handler$10 = Effect.fn(function* ({ label }) {
|
|
323
|
+
const { json } = yield* CommandConfig;
|
|
324
|
+
const client = yield* ClientService;
|
|
325
|
+
const device = client.halo.device;
|
|
326
|
+
if (!device) {
|
|
327
|
+
if (json) yield* Console.log(JSON.stringify({ error: "No device found" }, null, 2));
|
|
328
|
+
else yield* Console.log("No device found.");
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const updatedProfile = {
|
|
332
|
+
...device.profile,
|
|
333
|
+
label
|
|
334
|
+
};
|
|
335
|
+
const devicesService = client.services.services.DevicesService;
|
|
336
|
+
if (!devicesService) {
|
|
337
|
+
if (json) yield* Console.log(JSON.stringify({ error: "DevicesService not found" }, null, 2));
|
|
338
|
+
else yield* Console.log("DevicesService not found.");
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const updatedDevice = yield* Effect.tryPromise(() => devicesService.updateDevice(updatedProfile));
|
|
342
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
343
|
+
deviceKey: updatedDevice.deviceKey.toHex(),
|
|
344
|
+
profile: updatedDevice.profile
|
|
345
|
+
}, null, 2));
|
|
346
|
+
else yield* Console.log(print(printDevice(updatedDevice)));
|
|
347
|
+
});
|
|
348
|
+
var update$1 = Command.make("update", { label: Options.text("label").pipe(Options.withDescription("The device label.")) }, handler$10).pipe(Command.withDescription("Update device label."));
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/commands/device/index.ts
|
|
351
|
+
var device = Command.make("device").pipe(Command.withDescription("Manage HALO devices."), Command.withSubcommands([
|
|
352
|
+
info,
|
|
353
|
+
list$2,
|
|
354
|
+
update$1
|
|
355
|
+
]));
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/commands/edge/status.ts
|
|
358
|
+
var __dxlog_file$3 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/edge/status.ts";
|
|
359
|
+
var getStatus = () => Effect.gen(function* () {
|
|
360
|
+
const client = yield* ClientService;
|
|
361
|
+
const identity = createEdgeIdentity(client);
|
|
362
|
+
client.edge.http.setIdentity(identity);
|
|
363
|
+
const status = yield* Effect.tryPromise(() => client.edge.http.getStatus(Context.default(void 0, {
|
|
364
|
+
"~LogMeta": "~LogMeta",
|
|
365
|
+
F: __dxlog_file$3,
|
|
366
|
+
L: 20
|
|
367
|
+
})));
|
|
368
|
+
if (yield* CommandConfig.isJson) yield* Console.log(JSON.stringify(status, null, 2));
|
|
369
|
+
else if (status.problems.length > 0) for (const problem of status.problems) yield* Console.error(problem);
|
|
370
|
+
else yield* Console.log("No problems found.");
|
|
371
|
+
}).pipe(Effect.catchSome((error) => {
|
|
372
|
+
if (error instanceof Error && error.message === "Identity not available") return Option.some(Console.error(error.message));
|
|
373
|
+
else return Option.none();
|
|
374
|
+
}));
|
|
375
|
+
var status = Command.make("status", {}, getStatus).pipe(Command.withDescription("Get the EDGE status for the current identity."));
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/commands/edge/index.ts
|
|
378
|
+
var edge = Command.make("edge").pipe(Command.withDescription("EDGE commands."), Command.withSubcommands([status]));
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/commands/halo/create/create.ts
|
|
381
|
+
var __dxlog_file$2 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/halo/create/create.ts";
|
|
382
|
+
var handler$9 = Effect.fn(function* ({ agent, displayName }) {
|
|
383
|
+
const { json } = yield* CommandConfig;
|
|
384
|
+
const client = yield* ClientService;
|
|
385
|
+
invariant(!client.halo.identity.get(), "Identity already exists", {
|
|
386
|
+
"~LogMeta": "~LogMeta",
|
|
387
|
+
F: __dxlog_file$2,
|
|
388
|
+
L: 34,
|
|
389
|
+
S: this,
|
|
390
|
+
A: ["!client.halo.identity.get()", "'Identity already exists'"]
|
|
391
|
+
});
|
|
392
|
+
const { invoke } = (yield* Plugin.Service).capabilities.get(Capabilities.OperationInvoker);
|
|
393
|
+
const identity = yield* invoke(ClientOperation.CreateIdentity, { displayName: Option.getOrUndefined(displayName) });
|
|
394
|
+
if (agent) yield* invoke(ClientOperation.CreateAgent);
|
|
395
|
+
const space = yield* Effect.promise(() => client.spaces.create({}, {
|
|
396
|
+
tags: [AppSpace.PERSONAL_SPACE_TAG],
|
|
397
|
+
membershipPolicy: MembershipPolicy.LOCKED
|
|
398
|
+
}));
|
|
399
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
400
|
+
yield* Effect.promise(() => space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED));
|
|
401
|
+
yield* flushAndSync({ indexes: true }).pipe(Effect.provide(spaceLayer(Option.some(space.id))));
|
|
402
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
403
|
+
identityDid: identity.identityDid,
|
|
404
|
+
displayName: identity.profile?.displayName
|
|
405
|
+
}, null, 2));
|
|
406
|
+
else yield* Console.log(print(printIdentity(identity)));
|
|
407
|
+
});
|
|
408
|
+
var create$1 = Command.make("create", {
|
|
409
|
+
agent: Options.boolean("noAgent", { ifPresent: false }).pipe(Options.withDescription("Do not create an EDGE agent for the identity.")),
|
|
410
|
+
displayName: Options.text("displayName").pipe(Options.withDescription("The display name of the identity."), Options.optional)
|
|
411
|
+
}, handler$9).pipe(Command.withDescription("Create a new identity."));
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/commands/halo/credential/add/add.ts
|
|
414
|
+
var __dxlog_file$1 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/halo/credential/add/add.ts";
|
|
415
|
+
var handler$8 = Effect.fn(function* ({ credential }) {
|
|
416
|
+
const { json } = yield* CommandConfig;
|
|
417
|
+
const client = yield* ClientService;
|
|
418
|
+
let credentialHex = Option.getOrUndefined(credential);
|
|
419
|
+
if (!credentialHex) credentialHex = yield* Prompt.text({ message: "Enter credential (hex string)" }).pipe(Prompt.run);
|
|
420
|
+
invariant(credentialHex, "Invalid credential.", {
|
|
421
|
+
"~LogMeta": "~LogMeta",
|
|
422
|
+
F: __dxlog_file$1,
|
|
423
|
+
L: 26,
|
|
424
|
+
S: this,
|
|
425
|
+
A: ["credentialHex", "'Invalid credential.'"]
|
|
426
|
+
});
|
|
427
|
+
if (!client.halo.identity) {
|
|
428
|
+
if (json) yield* Console.log(JSON.stringify({ error: "Profile not initialized" }, null, 2));
|
|
429
|
+
else yield* Console.log("Profile not initialized.");
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
yield* Effect.gen(function* () {
|
|
433
|
+
const codec = schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
434
|
+
const credentialBytes = yield* Effect.try({
|
|
435
|
+
try: () => Buffer.from(credentialHex, "hex"),
|
|
436
|
+
catch: (error) => /* @__PURE__ */ new Error(`Failed to parse hex string: ${error}`)
|
|
437
|
+
});
|
|
438
|
+
const verifyError = codec.protoType.verify(credentialBytes);
|
|
439
|
+
if (verifyError) yield* Effect.fail(new Error(verifyError));
|
|
440
|
+
const credentialObj = yield* Effect.try({
|
|
441
|
+
try: () => codec.decode(credentialBytes),
|
|
442
|
+
catch: (error) => /* @__PURE__ */ new Error(`Failed to decode credential: ${error}`)
|
|
443
|
+
});
|
|
444
|
+
yield* Effect.tryPromise({
|
|
445
|
+
try: () => client.halo.writeCredentials([credentialObj]),
|
|
446
|
+
catch: (error) => /* @__PURE__ */ new Error(`Failed to write credential: ${error}`)
|
|
447
|
+
});
|
|
448
|
+
if (json) yield* Console.log(JSON.stringify({ success: true }, null, 2));
|
|
449
|
+
else yield* Console.log("Credential added successfully.");
|
|
450
|
+
}).pipe(Effect.catchAll((error) => Effect.gen(function* () {
|
|
451
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
452
|
+
error: "Invalid credential",
|
|
453
|
+
message: error instanceof Error ? error.message : String(error)
|
|
454
|
+
}, null, 2));
|
|
455
|
+
else yield* Console.log("Invalid credential.");
|
|
456
|
+
yield* Effect.fail(error);
|
|
457
|
+
})));
|
|
458
|
+
});
|
|
459
|
+
var add = Command.make("add", { credential: Args.text({ name: "credential" }).pipe(Args.withDescription("Credential as hex string."), Args.optional) }, handler$8).pipe(Command.withDescription("Import credential into HALO."));
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/commands/halo/credential/list/list.ts
|
|
462
|
+
var mapCredentials = (credentials) => {
|
|
463
|
+
return credentials.map((credential) => ({
|
|
464
|
+
id: credential.id?.toHex() ?? "<unknown>",
|
|
465
|
+
issuer: credential.issuer?.toHex() ?? "<unknown>",
|
|
466
|
+
subject: credential.subject?.id?.toHex() ?? "<unknown>",
|
|
467
|
+
type: credential.subject.assertion["@type"],
|
|
468
|
+
assertion: credential.subject.assertion
|
|
469
|
+
}));
|
|
470
|
+
};
|
|
471
|
+
var printCredential = (credential) => {
|
|
472
|
+
const type = credential.subject.assertion["@type"] ?? "<unknown>";
|
|
473
|
+
return FormBuilder.make({ title: type }).pipe(FormBuilder.option("id", Option.fromNullable(credential.id?.truncate())), FormBuilder.option("issuer", Option.fromNullable(credential.issuer?.truncate())), FormBuilder.option("subject", Option.fromNullable(credential.subject?.id?.truncate())), FormBuilder.build);
|
|
474
|
+
};
|
|
475
|
+
var handler$7 = Effect.fn(function* ({ type, spaceId, timeout, delay }) {
|
|
476
|
+
const { json } = yield* CommandConfig;
|
|
477
|
+
const client = yield* ClientService;
|
|
478
|
+
let credentials;
|
|
479
|
+
if (Option.isSome(spaceId)) {
|
|
480
|
+
const space = yield* getSpace(spaceId.value);
|
|
481
|
+
credentials = yield* Effect.tryPromise(() => space.internal.getCredentials());
|
|
482
|
+
} else {
|
|
483
|
+
if (!client.halo.identity) {
|
|
484
|
+
if (json) yield* Console.log(JSON.stringify({ error: "Profile not initialized" }, null, 2));
|
|
485
|
+
else yield* Console.log("Profile not initialized.");
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const latch = yield* Effect.makeLatch();
|
|
489
|
+
const subscription = client.halo.credentials.subscribe((creds) => {
|
|
490
|
+
if (creds.length > 0) Effect.runSync(latch.open);
|
|
491
|
+
});
|
|
492
|
+
yield* latch.await.pipe(Effect.timeout(Duration.millis(timeout)), Effect.catchAll(() => Effect.void), Effect.ensuring(Effect.sync(() => {
|
|
493
|
+
subscription.unsubscribe();
|
|
494
|
+
})));
|
|
495
|
+
yield* Effect.sleep(Duration.millis(delay));
|
|
496
|
+
credentials = client.halo.queryCredentials({ type: Option.getOrUndefined(type) });
|
|
497
|
+
}
|
|
498
|
+
if (json) yield* Console.log(JSON.stringify(mapCredentials(credentials), null, 2));
|
|
499
|
+
else {
|
|
500
|
+
const formatted = credentials.map(printCredential);
|
|
501
|
+
yield* Console.log(printList(formatted));
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
var list$1 = Command.make("list", {
|
|
505
|
+
type: Options.text("type").pipe(Options.withDescription("Filter by credential type."), Options.optional),
|
|
506
|
+
spaceId: Common.spaceId.pipe(Options.withDescription("Space ID to show credentials from."), Options.optional),
|
|
507
|
+
timeout: Options.integer("timeout").pipe(Options.withDescription("Time in milliseconds to wait for at least one credential before listing."), Options.withDefault(500)),
|
|
508
|
+
delay: Options.integer("delay").pipe(Options.withDescription("Delay in milliseconds before listing."), Options.withDefault(250))
|
|
509
|
+
}, handler$7).pipe(Command.withDescription("List HALO credentials."));
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/commands/halo/credential/index.ts
|
|
512
|
+
var credential = Command.make("credential").pipe(Command.withDescription("Manage HALO credentials."), Command.withSubcommands([add, list$1]));
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/commands/halo/identity/identity.ts
|
|
515
|
+
var handler$6 = Effect.fn(function* () {
|
|
516
|
+
const { json } = yield* CommandConfig;
|
|
517
|
+
const identity = (yield* ClientService).halo.identity.get();
|
|
518
|
+
if (!identity) if (json) yield* Console.log(JSON.stringify({ error: "Identity not initialized" }, null, 2));
|
|
519
|
+
else yield* Console.log("Identity not initialized.");
|
|
520
|
+
else if (json) yield* Console.log(JSON.stringify({
|
|
521
|
+
identityDid: identity.did,
|
|
522
|
+
displayName: identity.profile?.displayName
|
|
523
|
+
}, null, 2));
|
|
524
|
+
else yield* Console.log(print(printIdentity({
|
|
525
|
+
identityDid: identity.did,
|
|
526
|
+
profile: identity.profile
|
|
527
|
+
})));
|
|
528
|
+
});
|
|
529
|
+
var identity = Command.make("identity", {}, handler$6).pipe(Command.withDescription("Get the current identity."));
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/commands/halo/keys/keys.ts
|
|
532
|
+
var handler$5 = Effect.fn(function* () {
|
|
533
|
+
const { json } = yield* CommandConfig;
|
|
534
|
+
const client = yield* ClientService;
|
|
535
|
+
const identity = client.halo.identity.get();
|
|
536
|
+
const device = client.halo.device;
|
|
537
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
538
|
+
identityKey: identity?.identityKey.toHex(),
|
|
539
|
+
deviceKey: device?.deviceKey.toHex()
|
|
540
|
+
}, null, 2));
|
|
541
|
+
else {
|
|
542
|
+
const builder = FormBuilder.make({ title: "HALO Keys" }).pipe(FormBuilder.option("identityKey", Option.fromNullable(identity?.identityKey.truncate())), FormBuilder.option("deviceKey", Option.fromNullable(device?.deviceKey.truncate())));
|
|
543
|
+
yield* Console.log(print(FormBuilder.build(builder)));
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
var keys = Command.make("keys", {}, handler$5).pipe(Command.withDescription("Show HALO keys."));
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region src/commands/halo/seed/seed.ts
|
|
549
|
+
var handler$4 = Effect.fn(function* () {
|
|
550
|
+
const { json } = yield* CommandConfig;
|
|
551
|
+
const identityService = (yield* ClientService).services.services.IdentityService;
|
|
552
|
+
if (!identityService) {
|
|
553
|
+
if (json) yield* Console.log(JSON.stringify({ error: "IdentityService not found" }, null, 2));
|
|
554
|
+
else yield* Console.log("IdentityService not found.");
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
const result = yield* Effect.tryPromise(() => identityService.createRecoveryCredential({}));
|
|
558
|
+
if (json) yield* Console.log(JSON.stringify({ recoveryCode: result.recoveryCode }, null, 2));
|
|
559
|
+
else yield* Console.log(result.recoveryCode);
|
|
560
|
+
});
|
|
561
|
+
var seed = Command.make("seed", {}, handler$4).pipe(Command.withDescription("Generate a seedphrase that can be used for identity recovery."));
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/commands/halo/share/share.ts
|
|
564
|
+
var handler$3 = Effect.fn(function* ({ lifetime, open, host }) {
|
|
565
|
+
const { json } = yield* CommandConfig;
|
|
566
|
+
const client = yield* ClientService;
|
|
567
|
+
yield* Effect.try({
|
|
568
|
+
try: () => new URL(host),
|
|
569
|
+
catch: () => /* @__PURE__ */ new Error(`--host must be an absolute URL: ${host}`)
|
|
570
|
+
});
|
|
571
|
+
const invitation = yield* hostInvitation({
|
|
572
|
+
observable: client.halo.share({
|
|
573
|
+
authMethod: Invitation.AuthMethod.SHARED_SECRET,
|
|
574
|
+
persistent: true,
|
|
575
|
+
lifetime
|
|
576
|
+
}),
|
|
577
|
+
callbacks: { onConnecting: (invitation) => Effect.gen(function* () {
|
|
578
|
+
const invitationCode = InvitationEncoder.encode(invitation);
|
|
579
|
+
const authCode = invitation.authCode;
|
|
580
|
+
yield* copyToClipboard(authCode).pipe(Effect.catchAll(() => Effect.void));
|
|
581
|
+
const url = new URL(host);
|
|
582
|
+
url.searchParams.set("deviceInvitationCode", invitationCode);
|
|
583
|
+
if (!json) {
|
|
584
|
+
yield* Console.log(`\nSecret: ${authCode} (copied to clipboard)\n`);
|
|
585
|
+
yield* Console.log(`\nInvitation: ${invitationCode}\n`);
|
|
586
|
+
yield* Console.log(`\nURL: ${url.toString()}\n`);
|
|
587
|
+
}
|
|
588
|
+
if (open) yield* openBrowser(url.toString()).pipe(Effect.catchAll(() => Console.error(`Failed to open browser: ${url.toString()}`)));
|
|
589
|
+
}) },
|
|
590
|
+
waitForSuccess: true
|
|
591
|
+
});
|
|
592
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
593
|
+
invitationCode: InvitationEncoder.encode(invitation),
|
|
594
|
+
authCode: invitation.authCode,
|
|
595
|
+
state: Invitation.State[invitation.state]
|
|
596
|
+
}, null, 2));
|
|
597
|
+
else {
|
|
598
|
+
const builder = FormBuilder.make({ title: "HALO Invitation" }).pipe(FormBuilder.set("invitationCode", InvitationEncoder.encode(invitation)), FormBuilder.set("authCode", invitation.authCode ?? "<none>"), FormBuilder.set("state", Invitation.State[invitation.state]));
|
|
599
|
+
yield* Console.log(print(FormBuilder.build(builder)));
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
var share = Command.make("share", {
|
|
603
|
+
lifetime: Options.integer("lifetime").pipe(Options.withDescription("Lifetime of the invitation in seconds."), Options.withDefault(720 * 60)),
|
|
604
|
+
open: Options.boolean("open", { ifPresent: true }).pipe(Options.withDescription("Open browser with invitation.")),
|
|
605
|
+
host: Options.text("host").pipe(Options.withDescription("Application Host URL."), Options.withDefault("https://composer.space"))
|
|
606
|
+
}, handler$3).pipe(Command.withDescription("Create HALO (device) invitation."));
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/commands/halo/update/update.ts
|
|
609
|
+
var handler$2 = Effect.fn(function* ({ displayName }) {
|
|
610
|
+
const { json } = yield* CommandConfig;
|
|
611
|
+
const client = yield* ClientService;
|
|
612
|
+
if (!client.halo.identity.get()) {
|
|
613
|
+
if (json) yield* Console.log(JSON.stringify({ error: "Identity not initialized" }, null, 2));
|
|
614
|
+
else yield* Console.log("Identity not initialized.");
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
const identityService = client.services.services.IdentityService;
|
|
618
|
+
if (!identityService) {
|
|
619
|
+
if (json) yield* Console.log(JSON.stringify({ error: "IdentityService not found" }, null, 2));
|
|
620
|
+
else yield* Console.log("IdentityService not found.");
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
const updatedIdentity = yield* Effect.tryPromise(() => identityService.updateProfile({ displayName }));
|
|
624
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
625
|
+
identityDid: updatedIdentity.did,
|
|
626
|
+
displayName: updatedIdentity.profile?.displayName
|
|
627
|
+
}, null, 2));
|
|
628
|
+
else yield* Console.log(print(printIdentity({
|
|
629
|
+
identityDid: updatedIdentity.did,
|
|
630
|
+
profile: updatedIdentity.profile
|
|
631
|
+
})));
|
|
632
|
+
});
|
|
633
|
+
var update = Command.make("update", { displayName: Options.text("displayName").pipe(Options.withDescription("The display name of the identity.")) }, handler$2).pipe(Command.withDescription("Update identity profile."));
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region src/commands/halo/index.ts
|
|
636
|
+
var halo = Command.make("halo").pipe(Command.withDescription("Manage HALO identity."), Command.withSubcommands([
|
|
637
|
+
create$1,
|
|
638
|
+
credential,
|
|
639
|
+
identity,
|
|
640
|
+
keys,
|
|
641
|
+
seed,
|
|
642
|
+
share,
|
|
643
|
+
update
|
|
644
|
+
]));
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/commands/profile/util.ts
|
|
647
|
+
/**
|
|
648
|
+
* Pretty prints profile creation result with ANSI colors.
|
|
649
|
+
*/
|
|
650
|
+
var printProfileCreated = (name, path) => FormBuilder.make({ title: "Profile created" }).pipe(FormBuilder.set("name", name), FormBuilder.set("path", path), FormBuilder.build);
|
|
651
|
+
/**
|
|
652
|
+
* Pretty prints profile deletion result with ANSI colors.
|
|
653
|
+
*/
|
|
654
|
+
var printProfileDeleted = (name) => FormBuilder.make({ title: "Profile deleted" }).pipe(FormBuilder.set("name", name), FormBuilder.build);
|
|
655
|
+
/**
|
|
656
|
+
* Pretty prints profile reset result with ANSI colors.
|
|
657
|
+
*/
|
|
658
|
+
var printProfileReset = (profile) => FormBuilder.make({ title: "Profile reset" }).pipe(FormBuilder.set("profile", profile), FormBuilder.build);
|
|
659
|
+
/**
|
|
660
|
+
* Pretty prints a profile with ANSI colors.
|
|
661
|
+
*/
|
|
662
|
+
var printProfile = (profile) => {
|
|
663
|
+
const title = profile.isCurrent ? `${profile.name} (current)` : profile.name;
|
|
664
|
+
return FormBuilder.make({ title }).pipe(FormBuilder.set("fullPath", profile.fullPath), FormBuilder.set("storagePath", profile.storagePath), FormBuilder.set("edge", profile.edge ?? "<none>"), FormBuilder.build);
|
|
665
|
+
};
|
|
666
|
+
//#endregion
|
|
667
|
+
//#region src/commands/profile/create.ts
|
|
668
|
+
var makeTemplate = (edgeUrl) => trim`
|
|
669
|
+
version: 1
|
|
670
|
+
runtime:
|
|
671
|
+
client:
|
|
672
|
+
storage:
|
|
673
|
+
persistent: true
|
|
674
|
+
edgeFeatures:
|
|
675
|
+
signaling: true
|
|
676
|
+
subductionReplicator: true
|
|
677
|
+
feedReplicator: true
|
|
678
|
+
agents: true
|
|
679
|
+
services:
|
|
680
|
+
edge:
|
|
681
|
+
url: ${edgeUrl}
|
|
682
|
+
`;
|
|
683
|
+
var TEMPLATES = {
|
|
684
|
+
default: makeTemplate("https://edge-production.dxos.workers.dev"),
|
|
685
|
+
main: makeTemplate("https://edge-main.dxos.workers.dev"),
|
|
686
|
+
dev: makeTemplate("https://edge.dxos.workers.dev"),
|
|
687
|
+
local: makeTemplate("http://localhost:8787")
|
|
688
|
+
};
|
|
689
|
+
var create = Command.make("create", {
|
|
690
|
+
template: Options.choice("template", Record.keys(TEMPLATES)).pipe(Options.withDescription("Template to use"), Options.withDefault("default")),
|
|
691
|
+
name: Options.text("name").pipe(Options.withDescription("Profile name"), Options.optional)
|
|
692
|
+
}, Effect.fnUntraced(function* ({ template, name }) {
|
|
693
|
+
const { json } = yield* CommandConfig;
|
|
694
|
+
const fs = yield* FileSystem.FileSystem;
|
|
695
|
+
const path = yield* Path.Path;
|
|
696
|
+
const profileName = name.pipe(Option.getOrElse(() => template));
|
|
697
|
+
const configPath = getProfileConfigPath(DX_CONFIG, profileName);
|
|
698
|
+
if (yield* fs.exists(configPath)) throw new Error(`Profile ${profileName} already exists`);
|
|
699
|
+
yield* fs.makeDirectory(path.dirname(configPath), { recursive: true });
|
|
700
|
+
yield* fs.writeFileString(configPath, TEMPLATES[template]);
|
|
701
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
702
|
+
name: profileName,
|
|
703
|
+
path: configPath
|
|
704
|
+
}, null, 2));
|
|
705
|
+
else yield* Console.log(print(printProfileCreated(profileName, configPath)));
|
|
706
|
+
}));
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region src/commands/profile/delete.ts
|
|
709
|
+
var del = Command.make("delete", { name: Options.text("name").pipe(Options.withDescription("Profile name"), Options.optional) }, Effect.fnUntraced(function* ({ name }) {
|
|
710
|
+
const { json } = yield* CommandConfig;
|
|
711
|
+
const fs = yield* FileSystem.FileSystem;
|
|
712
|
+
const profileName = name.pipe(Option.getOrElse(() => "default"));
|
|
713
|
+
const configPath = getProfileConfigPath(DX_CONFIG, profileName);
|
|
714
|
+
const pluginsPath = `${DX_CONFIG}/plugins/${profileName}.yml`;
|
|
715
|
+
yield* fs.remove(configPath).pipe(Effect.ignore);
|
|
716
|
+
yield* fs.remove(pluginsPath).pipe(Effect.ignore);
|
|
717
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
718
|
+
name: profileName,
|
|
719
|
+
deleted: true
|
|
720
|
+
}, null, 2));
|
|
721
|
+
else yield* Console.log(print(printProfileDeleted(profileName)));
|
|
722
|
+
}));
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/commands/profile/import.ts
|
|
725
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-client/src/commands/profile/import.ts";
|
|
726
|
+
var handler$1 = Effect.fn(function* ({ file, dataDir, force }) {
|
|
727
|
+
const dataDirValue = Option.getOrUndefined(dataDir);
|
|
728
|
+
const { json, profile } = yield* CommandConfig;
|
|
729
|
+
const fs = yield* FileSystem.FileSystem;
|
|
730
|
+
const path = yield* Path.Path;
|
|
731
|
+
const config = yield* ConfigService$1;
|
|
732
|
+
const { createLevel, createStorageObjects, importProfileData, decodeProfileArchive } = yield* Effect.promise(() => import("@dxos/client-services"));
|
|
733
|
+
let storageConfig;
|
|
734
|
+
if (!dataDirValue) {
|
|
735
|
+
if (!force) {
|
|
736
|
+
yield* Console.log(`Will overwrite profile: ${profile}`);
|
|
737
|
+
if (!(yield* Prompt.confirm({
|
|
738
|
+
message: `Delete all data? (Profile: ${profile})`,
|
|
739
|
+
initial: false
|
|
740
|
+
}).pipe(Prompt.run))) return;
|
|
741
|
+
}
|
|
742
|
+
storageConfig = config.values.runtime.client.storage;
|
|
743
|
+
} else {
|
|
744
|
+
const fullPath = path.resolve(dataDirValue);
|
|
745
|
+
yield* Console.log(`Importing into: ${fullPath}`);
|
|
746
|
+
storageConfig = {
|
|
747
|
+
persistent: true,
|
|
748
|
+
dataRoot: fullPath
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
if (yield* fs.exists(storageConfig.dataRoot)) {
|
|
752
|
+
log.error("data directory already exists", { path: storageConfig.dataRoot }, {
|
|
753
|
+
"~LogMeta": "~LogMeta",
|
|
754
|
+
F: __dxlog_file,
|
|
755
|
+
L: 61,
|
|
756
|
+
S: this
|
|
757
|
+
});
|
|
758
|
+
if (json) yield* Console.log(JSON.stringify({ error: "Data directory already exists" }, null, 2));
|
|
759
|
+
else yield* Console.log("Data directory already exists.");
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
const archive = decodeProfileArchive(yield* fs.readFile(file));
|
|
763
|
+
yield* Console.log(`Importing archive with ${archive.storage.length} entries`);
|
|
764
|
+
const { storage } = createStorageObjects(storageConfig);
|
|
765
|
+
const level = yield* Effect.tryPromise({
|
|
766
|
+
try: () => createLevel(storageConfig),
|
|
767
|
+
catch: (error) => /* @__PURE__ */ new Error(`Failed to create level: ${error}`)
|
|
768
|
+
});
|
|
769
|
+
yield* Console.log("Beginning profile import...");
|
|
770
|
+
yield* Effect.tryPromise({
|
|
771
|
+
try: () => importProfileData({
|
|
772
|
+
storage,
|
|
773
|
+
level
|
|
774
|
+
}, archive),
|
|
775
|
+
catch: (error) => /* @__PURE__ */ new Error(`Failed to import profile data: ${error}`)
|
|
776
|
+
});
|
|
777
|
+
yield* Console.log("Profile import complete");
|
|
778
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
779
|
+
success: true,
|
|
780
|
+
profile,
|
|
781
|
+
entries: archive.storage.length
|
|
782
|
+
}, null, 2));
|
|
783
|
+
});
|
|
784
|
+
var importCommand = Command.make("import", {
|
|
785
|
+
file: Options.text("file").pipe(Options.withDescription("Archive filename."), Options.withAlias("f")),
|
|
786
|
+
dataDir: Options.text("data-dir").pipe(Options.withDescription("Storage directory."), Options.optional),
|
|
787
|
+
force: Options.boolean("force", { ifPresent: true }).pipe(Options.withDescription("Skip confirmation prompt."))
|
|
788
|
+
}, handler$1).pipe(Command.withDescription("Import profile."));
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/commands/profile/inspect.ts
|
|
791
|
+
var handler = Effect.fn(function* ({ file, storage }) {
|
|
792
|
+
const { json } = yield* CommandConfig;
|
|
793
|
+
const fs = yield* FileSystem.FileSystem;
|
|
794
|
+
const { decodeProfileArchive } = yield* Effect.promise(() => import("@dxos/client-services"));
|
|
795
|
+
const archive = decodeProfileArchive(yield* fs.readFile(file));
|
|
796
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
797
|
+
meta: archive.meta,
|
|
798
|
+
...storage ? { storage: archive.storage } : {}
|
|
799
|
+
}, null, 2));
|
|
800
|
+
else {
|
|
801
|
+
const builder = FormBuilder.make({ title: "Profile Archive" }).pipe(FormBuilder.when(archive.meta, FormBuilder.each(Object.entries(archive.meta ?? {}), ([key, value]) => FormBuilder.set(key, String(value)))), FormBuilder.build);
|
|
802
|
+
yield* Console.log(print(builder));
|
|
803
|
+
if (storage) {
|
|
804
|
+
yield* Console.log("\nStorage entries:\n");
|
|
805
|
+
for (const entry of archive.storage) {
|
|
806
|
+
const key = typeof entry.key === "string" ? entry.key : JSON.stringify(arrayToBuffer(entry.key).toString()).slice(1, -1);
|
|
807
|
+
yield* Console.log(` ${ProfileArchiveEntryType[entry.type]} ${key}`);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
var inspect = Command.make("inspect", {
|
|
813
|
+
file: Options.text("file").pipe(Options.withDescription("Archive filename."), Options.withAlias("f")),
|
|
814
|
+
storage: Options.boolean("storage", { ifPresent: true }).pipe(Options.withDescription("List storage entries."))
|
|
815
|
+
}, handler).pipe(Command.withDescription("Inspect profile archive."));
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region src/commands/profile/list.ts
|
|
818
|
+
var list = Command.make("list", {}, Effect.fnUntraced(function* () {
|
|
819
|
+
const { profile: currentProfile } = yield* CommandConfig;
|
|
820
|
+
const fs = yield* FileSystem.FileSystem;
|
|
821
|
+
const path = yield* Path.Path;
|
|
822
|
+
const profileDir = path.join(DX_CONFIG, "profile");
|
|
823
|
+
const profileFiles = (yield* fs.readDirectory(profileDir)).filter((entry) => entry.endsWith(".yml"));
|
|
824
|
+
const profiles = yield* Effect.forEach(profileFiles, (filename) => Effect.gen(function* () {
|
|
825
|
+
const name = filename.slice(0, -4);
|
|
826
|
+
const configPath = path.join(profileDir, filename);
|
|
827
|
+
const configContent = yield* fs.readFileString(configPath).pipe(Effect.catchTag("SystemError", () => Effect.succeed("{}")));
|
|
828
|
+
const configValues = Yaml.parse(configContent) ?? {};
|
|
829
|
+
const config = new Config(configValues);
|
|
830
|
+
return {
|
|
831
|
+
name,
|
|
832
|
+
isCurrent: name === currentProfile,
|
|
833
|
+
fullPath: configPath,
|
|
834
|
+
storagePath: getProfilePath(configValues?.runtime?.client?.storage?.dataRoot ?? DX_DATA, name),
|
|
835
|
+
edge: config.values.runtime?.services?.edge?.url
|
|
836
|
+
};
|
|
837
|
+
}));
|
|
838
|
+
const { json } = yield* CommandConfig;
|
|
839
|
+
if (json) yield* Console.log(JSON.stringify(profiles, null, 2));
|
|
840
|
+
else {
|
|
841
|
+
const formatted = profiles.map(printProfile);
|
|
842
|
+
yield* Console.log(printList(formatted));
|
|
843
|
+
}
|
|
844
|
+
}));
|
|
845
|
+
//#endregion
|
|
846
|
+
//#region src/commands/profile/reset.ts
|
|
847
|
+
var reset = Command.make("reset", { force: Options.boolean("force", { ifPresent: true }).pipe(Options.withDescription("Skip confirmation prompt")) }, Effect.fnUntraced(function* ({ force }) {
|
|
848
|
+
const fs = yield* FileSystem.FileSystem;
|
|
849
|
+
const config = yield* ConfigService$1;
|
|
850
|
+
const { json, profile } = yield* CommandConfig;
|
|
851
|
+
const path = config.values.runtime?.client?.storage?.dataRoot ?? getProfilePath(DX_DATA, profile);
|
|
852
|
+
if (!force) {
|
|
853
|
+
if (!(yield* Prompt.confirm({
|
|
854
|
+
message: `Are you sure you want to reset the profile (${profile})?`,
|
|
855
|
+
initial: false
|
|
856
|
+
}))) return;
|
|
857
|
+
}
|
|
858
|
+
yield* fs.remove(path, { recursive: true });
|
|
859
|
+
if (json) yield* Console.log(JSON.stringify({
|
|
860
|
+
profile,
|
|
861
|
+
reset: true
|
|
862
|
+
}, null, 2));
|
|
863
|
+
else yield* Console.log(print(printProfileReset(profile)));
|
|
864
|
+
}));
|
|
865
|
+
//#endregion
|
|
866
|
+
//#region src/commands/profile/index.ts
|
|
867
|
+
var profile = Command.make("profile").pipe(Command.withDescription("Profile commands."), Command.withSubcommands([
|
|
868
|
+
create,
|
|
869
|
+
del,
|
|
870
|
+
importCommand,
|
|
871
|
+
inspect,
|
|
872
|
+
list,
|
|
873
|
+
reset
|
|
874
|
+
]));
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region src/ClientPlugin.node.ts
|
|
877
|
+
var ClientPlugin = Plugin.define(meta).pipe(AppPlugin.addCommandModule({ commands: [
|
|
878
|
+
account,
|
|
879
|
+
config,
|
|
880
|
+
device,
|
|
881
|
+
edge,
|
|
882
|
+
halo,
|
|
883
|
+
profile
|
|
884
|
+
] }), AppPlugin.addOperationHandlerModule({ activate: OperationHandler }), Plugin.addModule((options) => ({
|
|
885
|
+
id: Capability.getModuleTag(Client),
|
|
886
|
+
activatesOn: ActivationEvents.Startup,
|
|
887
|
+
firesAfterActivation: [ClientEvents.ClientReady],
|
|
888
|
+
activate: () => Client(options)
|
|
889
|
+
})), Plugin.addModule({
|
|
890
|
+
activatesOn: ClientEvents.ClientReady,
|
|
891
|
+
firesBeforeActivation: [AppActivationEvents.SetupSchema],
|
|
892
|
+
activate: SchemaDefs
|
|
893
|
+
}), Plugin.addModule({
|
|
894
|
+
activatesOn: ClientEvents.ClientReady,
|
|
895
|
+
firesBeforeActivation: [ClientEvents.SetupMigration],
|
|
896
|
+
activate: Migrations
|
|
897
|
+
}), Plugin.addModule({
|
|
898
|
+
activatesOn: ActivationEvents.SetupProcessManager,
|
|
899
|
+
activate: LayerSpecs
|
|
900
|
+
}), Plugin.make);
|
|
901
|
+
//#endregion
|
|
902
|
+
export { ClientPlugin, ClientPlugin as default };
|
|
903
|
+
|
|
904
|
+
//# sourceMappingURL=ClientPlugin.node.mjs.map
|