@dxos/plugin-client 0.8.4-main.84f28bd → 0.8.4-main.9735255

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 (407) hide show
  1. package/dist/lib/browser/app-graph-builder-3FGBMLTF.mjs +118 -0
  2. package/dist/lib/browser/app-graph-builder-3FGBMLTF.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-4BZGRIFS.mjs +293 -0
  4. package/dist/lib/browser/chunk-4BZGRIFS.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-F7H2Y3Z2.mjs +18 -0
  6. package/dist/lib/browser/chunk-F7H2Y3Z2.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-G7C3S2BE.mjs +15 -0
  8. package/dist/lib/browser/chunk-G7C3S2BE.mjs.map +7 -0
  9. package/dist/lib/browser/cli/index.mjs +1048 -0
  10. package/dist/lib/browser/cli/index.mjs.map +7 -0
  11. package/dist/lib/browser/client-IX5LMWV4.mjs +86 -0
  12. package/dist/lib/browser/client-IX5LMWV4.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +75 -81
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/migrations-3EBTAW3N.mjs +24 -0
  17. package/dist/lib/browser/migrations-3EBTAW3N.mjs.map +7 -0
  18. package/dist/lib/browser/operation-resolver-2NT3ISVP.mjs +298 -0
  19. package/dist/lib/browser/operation-resolver-2NT3ISVP.mjs.map +7 -0
  20. package/dist/lib/browser/react-context-4UABG3GP.mjs +24 -0
  21. package/dist/lib/browser/react-context-4UABG3GP.mjs.map +7 -0
  22. package/dist/lib/browser/react-surface-RSQ74XCT.mjs +675 -0
  23. package/dist/lib/browser/react-surface-RSQ74XCT.mjs.map +7 -0
  24. package/dist/lib/browser/schema-defs-O7VLP745.mjs +26 -0
  25. package/dist/lib/browser/schema-defs-O7VLP745.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +15 -0
  27. package/dist/lib/node-esm/app-graph-builder-2PIYVUNC.mjs +119 -0
  28. package/dist/lib/node-esm/app-graph-builder-2PIYVUNC.mjs.map +7 -0
  29. package/dist/lib/node-esm/chunk-BCELGXRI.mjs +20 -0
  30. package/dist/lib/node-esm/chunk-BCELGXRI.mjs.map +7 -0
  31. package/dist/lib/node-esm/chunk-JAF64TFQ.mjs +295 -0
  32. package/dist/lib/node-esm/chunk-JAF64TFQ.mjs.map +7 -0
  33. package/dist/lib/node-esm/chunk-PRAFFO54.mjs +16 -0
  34. package/dist/lib/node-esm/chunk-PRAFFO54.mjs.map +7 -0
  35. package/dist/lib/node-esm/cli/index.mjs +1049 -0
  36. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  37. package/dist/lib/node-esm/client-FFPK5UFP.mjs +87 -0
  38. package/dist/lib/node-esm/client-FFPK5UFP.mjs.map +7 -0
  39. package/dist/lib/node-esm/index.mjs +75 -81
  40. package/dist/lib/node-esm/index.mjs.map +4 -4
  41. package/dist/lib/node-esm/meta.json +1 -1
  42. package/dist/lib/node-esm/migrations-WSZSFGDK.mjs +25 -0
  43. package/dist/lib/node-esm/migrations-WSZSFGDK.mjs.map +7 -0
  44. package/dist/lib/node-esm/operation-resolver-VW5R2BE4.mjs +299 -0
  45. package/dist/lib/node-esm/operation-resolver-VW5R2BE4.mjs.map +7 -0
  46. package/dist/lib/node-esm/react-context-UVXMGPW4.mjs +25 -0
  47. package/dist/lib/node-esm/react-context-UVXMGPW4.mjs.map +7 -0
  48. package/dist/lib/node-esm/react-surface-KBHANGGC.mjs +676 -0
  49. package/dist/lib/node-esm/react-surface-KBHANGGC.mjs.map +7 -0
  50. package/dist/lib/node-esm/schema-defs-QLRGBIKY.mjs +27 -0
  51. package/dist/lib/node-esm/schema-defs-QLRGBIKY.mjs.map +7 -0
  52. package/dist/lib/node-esm/types/index.mjs +16 -0
  53. package/dist/types/src/ClientPlugin.d.ts +2 -1
  54. package/dist/types/src/ClientPlugin.d.ts.map +1 -1
  55. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  56. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  57. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  58. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  59. package/dist/types/src/capabilities/client/client.d.ts +8 -0
  60. package/dist/types/src/capabilities/client/client.d.ts.map +1 -0
  61. package/dist/types/src/capabilities/client/index.d.ts +17 -0
  62. package/dist/types/src/capabilities/client/index.d.ts.map +1 -0
  63. package/dist/types/src/capabilities/index.d.ts +7 -19
  64. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  65. package/dist/types/src/capabilities/migrations/index.d.ts +3 -0
  66. package/dist/types/src/capabilities/migrations/index.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/migrations/migrations.d.ts +5 -0
  68. package/dist/types/src/capabilities/migrations/migrations.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/operation-resolver/index.d.ts +5 -0
  70. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +8 -0
  72. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
  74. package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
  76. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/react-surface/index.d.ts +5 -0
  78. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +9 -0
  80. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/schema-defs/index.d.ts +3 -0
  82. package/dist/types/src/capabilities/schema-defs/index.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/schema-defs/schema-defs.d.ts +5 -0
  84. package/dist/types/src/capabilities/schema-defs/schema-defs.d.ts.map +1 -0
  85. package/dist/types/src/cli/commands/config/index.d.ts +5 -0
  86. package/dist/types/src/cli/commands/config/index.d.ts.map +1 -0
  87. package/dist/types/src/cli/commands/config/view.d.ts +5 -0
  88. package/dist/types/src/cli/commands/config/view.d.ts.map +1 -0
  89. package/dist/types/src/cli/commands/device/index.d.ts +7 -0
  90. package/dist/types/src/cli/commands/device/index.d.ts.map +1 -0
  91. package/dist/types/src/cli/commands/device/info/index.d.ts +2 -0
  92. package/dist/types/src/cli/commands/device/info/index.d.ts.map +1 -0
  93. package/dist/types/src/cli/commands/device/info/info.d.ts +7 -0
  94. package/dist/types/src/cli/commands/device/info/info.d.ts.map +1 -0
  95. package/dist/types/src/cli/commands/device/info/info.test.d.ts +2 -0
  96. package/dist/types/src/cli/commands/device/info/info.test.d.ts.map +1 -0
  97. package/dist/types/src/cli/commands/device/list/index.d.ts +2 -0
  98. package/dist/types/src/cli/commands/device/list/index.d.ts.map +1 -0
  99. package/dist/types/src/cli/commands/device/list/list.d.ts +7 -0
  100. package/dist/types/src/cli/commands/device/list/list.d.ts.map +1 -0
  101. package/dist/types/src/cli/commands/device/list/list.test.d.ts +2 -0
  102. package/dist/types/src/cli/commands/device/list/list.test.d.ts.map +1 -0
  103. package/dist/types/src/cli/commands/device/update/index.d.ts +2 -0
  104. package/dist/types/src/cli/commands/device/update/index.d.ts.map +1 -0
  105. package/dist/types/src/cli/commands/device/update/update.d.ts +11 -0
  106. package/dist/types/src/cli/commands/device/update/update.d.ts.map +1 -0
  107. package/dist/types/src/cli/commands/device/util.d.ts +16 -0
  108. package/dist/types/src/cli/commands/device/util.d.ts.map +1 -0
  109. package/dist/types/src/cli/commands/edge/index.d.ts +5 -0
  110. package/dist/types/src/cli/commands/edge/index.d.ts.map +1 -0
  111. package/dist/types/src/cli/commands/edge/status.d.ts +7 -0
  112. package/dist/types/src/cli/commands/edge/status.d.ts.map +1 -0
  113. package/dist/types/src/cli/commands/halo/create/create.d.ts +15 -0
  114. package/dist/types/src/cli/commands/halo/create/create.d.ts.map +1 -0
  115. package/dist/types/src/cli/commands/halo/create/create.test.d.ts +2 -0
  116. package/dist/types/src/cli/commands/halo/create/create.test.d.ts.map +1 -0
  117. package/dist/types/src/cli/commands/halo/create/index.d.ts +2 -0
  118. package/dist/types/src/cli/commands/halo/create/index.d.ts.map +1 -0
  119. package/dist/types/src/cli/commands/halo/credential/add/add.d.ts +13 -0
  120. package/dist/types/src/cli/commands/halo/credential/add/add.d.ts.map +1 -0
  121. package/dist/types/src/cli/commands/halo/credential/add/index.d.ts +2 -0
  122. package/dist/types/src/cli/commands/halo/credential/add/index.d.ts.map +1 -0
  123. package/dist/types/src/cli/commands/halo/credential/index.d.ts +12 -0
  124. package/dist/types/src/cli/commands/halo/credential/index.d.ts.map +1 -0
  125. package/dist/types/src/cli/commands/halo/credential/list/index.d.ts +2 -0
  126. package/dist/types/src/cli/commands/halo/credential/list/index.d.ts.map +1 -0
  127. package/dist/types/src/cli/commands/halo/credential/list/list.d.ts +19 -0
  128. package/dist/types/src/cli/commands/halo/credential/list/list.d.ts.map +1 -0
  129. package/dist/types/src/cli/commands/halo/credential/list/list.test.d.ts +2 -0
  130. package/dist/types/src/cli/commands/halo/credential/list/list.test.d.ts.map +1 -0
  131. package/dist/types/src/cli/commands/halo/identity/identity.d.ts +7 -0
  132. package/dist/types/src/cli/commands/halo/identity/identity.d.ts.map +1 -0
  133. package/dist/types/src/cli/commands/halo/identity/identity.test.d.ts +2 -0
  134. package/dist/types/src/cli/commands/halo/identity/identity.test.d.ts.map +1 -0
  135. package/dist/types/src/cli/commands/halo/identity/index.d.ts +2 -0
  136. package/dist/types/src/cli/commands/halo/identity/index.d.ts.map +1 -0
  137. package/dist/types/src/cli/commands/halo/index.d.ts +3 -0
  138. package/dist/types/src/cli/commands/halo/index.d.ts.map +1 -0
  139. package/dist/types/src/cli/commands/halo/join/index.d.ts +2 -0
  140. package/dist/types/src/cli/commands/halo/join/index.d.ts.map +1 -0
  141. package/dist/types/src/cli/commands/halo/join/join.d.ts +8 -0
  142. package/dist/types/src/cli/commands/halo/join/join.d.ts.map +1 -0
  143. package/dist/types/src/cli/commands/halo/join/join.test.d.ts +2 -0
  144. package/dist/types/src/cli/commands/halo/join/join.test.d.ts.map +1 -0
  145. package/dist/types/src/cli/commands/halo/keys/index.d.ts +2 -0
  146. package/dist/types/src/cli/commands/halo/keys/index.d.ts.map +1 -0
  147. package/dist/types/src/cli/commands/halo/keys/keys.d.ts +7 -0
  148. package/dist/types/src/cli/commands/halo/keys/keys.d.ts.map +1 -0
  149. package/dist/types/src/cli/commands/halo/keys/keys.test.d.ts +2 -0
  150. package/dist/types/src/cli/commands/halo/keys/keys.test.d.ts.map +1 -0
  151. package/dist/types/src/cli/commands/halo/recover/index.d.ts +2 -0
  152. package/dist/types/src/cli/commands/halo/recover/index.d.ts.map +1 -0
  153. package/dist/types/src/cli/commands/halo/recover/recover.d.ts +7 -0
  154. package/dist/types/src/cli/commands/halo/recover/recover.d.ts.map +1 -0
  155. package/dist/types/src/cli/commands/halo/recover/recover.test.d.ts +2 -0
  156. package/dist/types/src/cli/commands/halo/recover/recover.test.d.ts.map +1 -0
  157. package/dist/types/src/cli/commands/halo/seed/index.d.ts +2 -0
  158. package/dist/types/src/cli/commands/halo/seed/index.d.ts.map +1 -0
  159. package/dist/types/src/cli/commands/halo/seed/seed.d.ts +7 -0
  160. package/dist/types/src/cli/commands/halo/seed/seed.d.ts.map +1 -0
  161. package/dist/types/src/cli/commands/halo/share/index.d.ts +2 -0
  162. package/dist/types/src/cli/commands/halo/share/index.d.ts.map +1 -0
  163. package/dist/types/src/cli/commands/halo/share/share.d.ts +15 -0
  164. package/dist/types/src/cli/commands/halo/share/share.d.ts.map +1 -0
  165. package/dist/types/src/cli/commands/halo/update/index.d.ts +2 -0
  166. package/dist/types/src/cli/commands/halo/update/index.d.ts.map +1 -0
  167. package/dist/types/src/cli/commands/halo/update/update.d.ts +11 -0
  168. package/dist/types/src/cli/commands/halo/update/update.d.ts.map +1 -0
  169. package/dist/types/src/cli/commands/halo/update/update.test.d.ts +2 -0
  170. package/dist/types/src/cli/commands/halo/update/update.test.d.ts.map +1 -0
  171. package/dist/types/src/cli/commands/halo/util.d.ts +13 -0
  172. package/dist/types/src/cli/commands/halo/util.d.ts.map +1 -0
  173. package/dist/types/src/cli/commands/index.d.ts +6 -0
  174. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  175. package/dist/types/src/cli/commands/profile/create.d.ts +9 -0
  176. package/dist/types/src/cli/commands/profile/create.d.ts.map +1 -0
  177. package/dist/types/src/cli/commands/profile/delete.d.ts +8 -0
  178. package/dist/types/src/cli/commands/profile/delete.d.ts.map +1 -0
  179. package/dist/types/src/cli/commands/profile/import.d.ts +17 -0
  180. package/dist/types/src/cli/commands/profile/import.d.ts.map +1 -0
  181. package/dist/types/src/cli/commands/profile/index.d.ts +19 -0
  182. package/dist/types/src/cli/commands/profile/index.d.ts.map +1 -0
  183. package/dist/types/src/cli/commands/profile/inspect.d.ts +13 -0
  184. package/dist/types/src/cli/commands/profile/inspect.d.ts.map +1 -0
  185. package/dist/types/src/cli/commands/profile/list.d.ts +6 -0
  186. package/dist/types/src/cli/commands/profile/list.d.ts.map +1 -0
  187. package/dist/types/src/cli/commands/profile/reset.d.ts +8 -0
  188. package/dist/types/src/cli/commands/profile/reset.d.ts.map +1 -0
  189. package/dist/types/src/cli/commands/profile/util.d.ts +24 -0
  190. package/dist/types/src/cli/commands/profile/util.d.ts.map +1 -0
  191. package/dist/types/src/cli/index.d.ts +2 -0
  192. package/dist/types/src/cli/index.d.ts.map +1 -0
  193. package/dist/types/src/cli/plugin.d.ts +4 -0
  194. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  195. package/dist/types/src/cli/testing/test-console.d.ts +37 -0
  196. package/dist/types/src/cli/testing/test-console.d.ts.map +1 -0
  197. package/dist/types/src/components/DevicesContainer.d.ts.map +1 -1
  198. package/dist/types/src/components/DevicesContainer.stories.d.ts +178 -5
  199. package/dist/types/src/components/DevicesContainer.stories.d.ts.map +1 -1
  200. package/dist/types/src/components/JoinDialog.d.ts +0 -1
  201. package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
  202. package/dist/types/src/components/ProfileContainer.d.ts.map +1 -1
  203. package/dist/types/src/components/ProfileContainer.stories.d.ts +11 -5
  204. package/dist/types/src/components/ProfileContainer.stories.d.ts.map +1 -1
  205. package/dist/types/src/components/RecoveryCodeDialog.d.ts +0 -1
  206. package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
  207. package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts +13 -5
  208. package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts.map +1 -1
  209. package/dist/types/src/components/RecoveryCredentialsContainer.d.ts +1 -1
  210. package/dist/types/src/components/RecoveryCredentialsContainer.d.ts.map +1 -1
  211. package/dist/types/src/components/RecoveryCredentialsContainer.stories.d.ts +11 -5
  212. package/dist/types/src/components/RecoveryCredentialsContainer.stories.d.ts.map +1 -1
  213. package/dist/types/src/components/ResetDialog.d.ts +5 -3
  214. package/dist/types/src/components/ResetDialog.d.ts.map +1 -1
  215. package/dist/types/src/components/ResetDialog.stories.d.ts +13 -4
  216. package/dist/types/src/components/ResetDialog.stories.d.ts.map +1 -1
  217. package/dist/types/src/constants.d.ts +4 -0
  218. package/dist/types/src/constants.d.ts.map +1 -0
  219. package/dist/types/src/index.d.ts +3 -3
  220. package/dist/types/src/index.d.ts.map +1 -1
  221. package/dist/types/src/meta.d.ts +2 -3
  222. package/dist/types/src/meta.d.ts.map +1 -1
  223. package/dist/types/src/translations.d.ts +2 -48
  224. package/dist/types/src/translations.d.ts.map +1 -1
  225. package/dist/types/src/types/capabilities.d.ts +10 -0
  226. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  227. package/dist/types/src/types/events.d.ts +9 -0
  228. package/dist/types/src/types/events.d.ts.map +1 -0
  229. package/dist/types/src/types/index.d.ts +4 -0
  230. package/dist/types/src/types/index.d.ts.map +1 -0
  231. package/dist/types/src/types/schema.d.ts +296 -0
  232. package/dist/types/src/types/schema.d.ts.map +1 -0
  233. package/dist/types/tsconfig.tsbuildinfo +1 -1
  234. package/package.json +59 -45
  235. package/src/ClientPlugin.ts +40 -60
  236. package/src/capabilities/app-graph-builder/app-graph-builder.ts +95 -0
  237. package/src/capabilities/app-graph-builder/index.ts +7 -0
  238. package/src/capabilities/client/client.ts +75 -0
  239. package/src/capabilities/client/index.ts +7 -0
  240. package/src/capabilities/index.ts +7 -11
  241. package/src/capabilities/migrations/index.ts +7 -0
  242. package/src/capabilities/migrations/migrations.ts +30 -0
  243. package/src/capabilities/operation-resolver/index.ts +7 -0
  244. package/src/capabilities/operation-resolver/operation-resolver.ts +248 -0
  245. package/src/capabilities/react-context/index.ts +7 -0
  246. package/src/capabilities/react-context/react-context.tsx +25 -0
  247. package/src/capabilities/react-surface/index.ts +7 -0
  248. package/src/capabilities/react-surface/react-surface.tsx +74 -0
  249. package/src/capabilities/schema-defs/index.ts +7 -0
  250. package/src/capabilities/schema-defs/schema-defs.ts +35 -0
  251. package/src/cli/commands/config/index.ts +12 -0
  252. package/src/cli/commands/config/view.ts +26 -0
  253. package/src/cli/commands/device/index.ts +14 -0
  254. package/src/cli/commands/device/info/index.ts +5 -0
  255. package/src/cli/commands/device/info/info.test.ts +29 -0
  256. package/src/cli/commands/device/info/info.ts +50 -0
  257. package/src/cli/commands/device/list/index.ts +5 -0
  258. package/src/cli/commands/device/list/list.test.ts +31 -0
  259. package/src/cli/commands/device/list/list.ts +30 -0
  260. package/src/cli/commands/device/update/index.ts +5 -0
  261. package/src/cli/commands/device/update/update.ts +70 -0
  262. package/src/cli/commands/device/util.ts +55 -0
  263. package/src/cli/commands/edge/index.ts +12 -0
  264. package/src/cli/commands/edge/status.ts +45 -0
  265. package/src/cli/commands/halo/create/create.test.ts +52 -0
  266. package/src/cli/commands/halo/create/create.ts +75 -0
  267. package/src/cli/commands/halo/create/index.ts +5 -0
  268. package/src/cli/commands/halo/credential/add/add.ts +97 -0
  269. package/src/cli/commands/halo/credential/add/index.ts +5 -0
  270. package/src/cli/commands/halo/credential/index.ts +13 -0
  271. package/src/cli/commands/halo/credential/list/index.ts +5 -0
  272. package/src/cli/commands/halo/credential/list/list.test.ts +28 -0
  273. package/src/cli/commands/halo/credential/list/list.ts +118 -0
  274. package/src/cli/commands/halo/identity/identity.test.ts +40 -0
  275. package/src/cli/commands/halo/identity/identity.ts +46 -0
  276. package/src/cli/commands/halo/identity/index.ts +5 -0
  277. package/src/cli/commands/halo/index.ts +21 -0
  278. package/src/cli/commands/halo/join/index.ts +5 -0
  279. package/src/cli/commands/halo/join/join.test.ts +10 -0
  280. package/src/cli/commands/halo/join/join.ts +87 -0
  281. package/src/cli/commands/halo/keys/index.ts +5 -0
  282. package/src/cli/commands/halo/keys/keys.test.ts +29 -0
  283. package/src/cli/commands/halo/keys/keys.ts +42 -0
  284. package/src/cli/commands/halo/recover/index.ts +5 -0
  285. package/src/cli/commands/halo/recover/recover.test.ts +10 -0
  286. package/src/cli/commands/halo/recover/recover.ts +44 -0
  287. package/src/cli/commands/halo/seed/index.ts +5 -0
  288. package/src/cli/commands/halo/seed/seed.ts +38 -0
  289. package/src/cli/commands/halo/share/index.ts +5 -0
  290. package/src/cli/commands/halo/share/share.ts +97 -0
  291. package/src/cli/commands/halo/update/index.ts +5 -0
  292. package/src/cli/commands/halo/update/update.test.ts +29 -0
  293. package/src/cli/commands/halo/update/update.ts +69 -0
  294. package/src/cli/commands/halo/util.ts +18 -0
  295. package/src/cli/commands/index.ts +9 -0
  296. package/src/cli/commands/profile/create.ts +87 -0
  297. package/src/cli/commands/profile/delete.ts +33 -0
  298. package/src/cli/commands/profile/import.ts +101 -0
  299. package/src/cli/commands/profile/index.ts +17 -0
  300. package/src/cli/commands/profile/inspect.ts +64 -0
  301. package/src/cli/commands/profile/list.ts +54 -0
  302. package/src/cli/commands/profile/reset.ts +45 -0
  303. package/src/cli/commands/profile/util.ts +48 -0
  304. package/src/cli/index.ts +5 -0
  305. package/src/cli/plugin.ts +33 -0
  306. package/src/cli/testing/test-console.ts +88 -0
  307. package/src/components/DevicesContainer.stories.tsx +15 -15
  308. package/src/components/DevicesContainer.tsx +72 -82
  309. package/src/components/JoinDialog.tsx +15 -17
  310. package/src/components/ProfileContainer.stories.tsx +8 -9
  311. package/src/components/ProfileContainer.tsx +61 -50
  312. package/src/components/RecoveryCodeDialog.stories.tsx +9 -10
  313. package/src/components/RecoveryCodeDialog.tsx +5 -7
  314. package/src/components/RecoveryCredentialsContainer.stories.tsx +15 -15
  315. package/src/components/RecoveryCredentialsContainer.tsx +48 -53
  316. package/src/components/ResetDialog.stories.tsx +25 -18
  317. package/src/components/ResetDialog.tsx +19 -18
  318. package/src/constants.ts +9 -0
  319. package/src/index.ts +3 -3
  320. package/src/meta.ts +8 -5
  321. package/src/translations.ts +5 -2
  322. package/src/types/capabilities.ts +16 -0
  323. package/src/types/events.ts +15 -0
  324. package/src/types/index.ts +7 -0
  325. package/src/types/schema.ts +243 -0
  326. package/dist/lib/browser/app-graph-builder-3EILEBWW.mjs +0 -123
  327. package/dist/lib/browser/app-graph-builder-3EILEBWW.mjs.map +0 -7
  328. package/dist/lib/browser/chunk-64ANQXYZ.mjs +0 -693
  329. package/dist/lib/browser/chunk-64ANQXYZ.mjs.map +0 -7
  330. package/dist/lib/browser/chunk-AWXKL4UR.mjs +0 -18
  331. package/dist/lib/browser/chunk-AWXKL4UR.mjs.map +0 -7
  332. package/dist/lib/browser/chunk-CAF2COXW.mjs +0 -19
  333. package/dist/lib/browser/chunk-CAF2COXW.mjs.map +0 -7
  334. package/dist/lib/browser/chunk-GS3LDHYD.mjs +0 -12
  335. package/dist/lib/browser/chunk-GS3LDHYD.mjs.map +0 -7
  336. package/dist/lib/browser/chunk-Q7TFRFHI.mjs +0 -111
  337. package/dist/lib/browser/chunk-Q7TFRFHI.mjs.map +0 -7
  338. package/dist/lib/browser/client-JFNMEFOK.mjs +0 -37
  339. package/dist/lib/browser/client-JFNMEFOK.mjs.map +0 -7
  340. package/dist/lib/browser/intent-resolver-YGAQVXI2.mjs +0 -305
  341. package/dist/lib/browser/intent-resolver-YGAQVXI2.mjs.map +0 -7
  342. package/dist/lib/browser/migrations-5COKGS4E.mjs +0 -23
  343. package/dist/lib/browser/migrations-5COKGS4E.mjs.map +0 -7
  344. package/dist/lib/browser/react-context-GBNYT5QK.mjs +0 -24
  345. package/dist/lib/browser/react-context-GBNYT5QK.mjs.map +0 -7
  346. package/dist/lib/browser/react-surface-YKQAUE2M.mjs +0 -66
  347. package/dist/lib/browser/react-surface-YKQAUE2M.mjs.map +0 -7
  348. package/dist/lib/browser/schema-defs-6L7W2RHL.mjs +0 -25
  349. package/dist/lib/browser/schema-defs-6L7W2RHL.mjs.map +0 -7
  350. package/dist/lib/browser/types.mjs +0 -10
  351. package/dist/lib/node-esm/app-graph-builder-GINHOE7A.mjs +0 -124
  352. package/dist/lib/node-esm/app-graph-builder-GINHOE7A.mjs.map +0 -7
  353. package/dist/lib/node-esm/chunk-3BUB64JB.mjs +0 -19
  354. package/dist/lib/node-esm/chunk-3BUB64JB.mjs.map +0 -7
  355. package/dist/lib/node-esm/chunk-GDJMDBWM.mjs +0 -112
  356. package/dist/lib/node-esm/chunk-GDJMDBWM.mjs.map +0 -7
  357. package/dist/lib/node-esm/chunk-K4PIKBQQ.mjs +0 -694
  358. package/dist/lib/node-esm/chunk-K4PIKBQQ.mjs.map +0 -7
  359. package/dist/lib/node-esm/chunk-SZLX4BVJ.mjs +0 -14
  360. package/dist/lib/node-esm/chunk-SZLX4BVJ.mjs.map +0 -7
  361. package/dist/lib/node-esm/chunk-UMO3ETDV.mjs +0 -20
  362. package/dist/lib/node-esm/chunk-UMO3ETDV.mjs.map +0 -7
  363. package/dist/lib/node-esm/client-XDYQARBL.mjs +0 -38
  364. package/dist/lib/node-esm/client-XDYQARBL.mjs.map +0 -7
  365. package/dist/lib/node-esm/intent-resolver-IN7YG7N7.mjs +0 -306
  366. package/dist/lib/node-esm/intent-resolver-IN7YG7N7.mjs.map +0 -7
  367. package/dist/lib/node-esm/migrations-FE4PDX6W.mjs +0 -24
  368. package/dist/lib/node-esm/migrations-FE4PDX6W.mjs.map +0 -7
  369. package/dist/lib/node-esm/react-context-UCK43H3Z.mjs +0 -25
  370. package/dist/lib/node-esm/react-context-UCK43H3Z.mjs.map +0 -7
  371. package/dist/lib/node-esm/react-surface-HDHC6XHQ.mjs +0 -67
  372. package/dist/lib/node-esm/react-surface-HDHC6XHQ.mjs.map +0 -7
  373. package/dist/lib/node-esm/schema-defs-GZIVMHLW.mjs +0 -26
  374. package/dist/lib/node-esm/schema-defs-GZIVMHLW.mjs.map +0 -7
  375. package/dist/lib/node-esm/types.mjs +0 -11
  376. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  377. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  378. package/dist/types/src/capabilities/capabilities.d.ts +0 -10
  379. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  380. package/dist/types/src/capabilities/client.d.ts +0 -9
  381. package/dist/types/src/capabilities/client.d.ts.map +0 -1
  382. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -8
  383. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  384. package/dist/types/src/capabilities/migrations.d.ts +0 -4
  385. package/dist/types/src/capabilities/migrations.d.ts.map +0 -1
  386. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  387. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  388. package/dist/types/src/capabilities/react-surface.d.ts +0 -8
  389. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  390. package/dist/types/src/capabilities/schema-defs.d.ts +0 -4
  391. package/dist/types/src/capabilities/schema-defs.d.ts.map +0 -1
  392. package/dist/types/src/events.d.ts +0 -8
  393. package/dist/types/src/events.d.ts.map +0 -1
  394. package/dist/types/src/types.d.ts +0 -136
  395. package/dist/types/src/types.d.ts.map +0 -1
  396. package/src/capabilities/app-graph-builder.ts +0 -113
  397. package/src/capabilities/capabilities.ts +0 -17
  398. package/src/capabilities/client.ts +0 -41
  399. package/src/capabilities/intent-resolver.ts +0 -250
  400. package/src/capabilities/migrations.ts +0 -25
  401. package/src/capabilities/react-context.tsx +0 -20
  402. package/src/capabilities/react-surface.tsx +0 -67
  403. package/src/capabilities/schema-defs.ts +0 -29
  404. package/src/events.ts +0 -15
  405. package/src/types.ts +0 -131
  406. /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
  407. /package/dist/lib/node-esm/{types.mjs.map → types/index.mjs.map} +0 -0
@@ -0,0 +1,1048 @@
1
+ import {
2
+ Client,
3
+ OperationResolver,
4
+ SchemaDefs
5
+ } from "../chunk-F7H2Y3Z2.mjs";
6
+ import {
7
+ ClientEvents,
8
+ ClientOperation,
9
+ meta
10
+ } from "../chunk-4BZGRIFS.mjs";
11
+
12
+ // src/cli/plugin.ts
13
+ import { Capability, Common as Common3, Plugin as Plugin2 } from "@dxos/app-framework";
14
+
15
+ // src/cli/commands/config/index.ts
16
+ import * as Command2 from "@effect/cli/Command";
17
+
18
+ // src/cli/commands/config/view.ts
19
+ import * as Command from "@effect/cli/Command";
20
+ import * as Console from "effect/Console";
21
+ import * as Effect from "effect/Effect";
22
+ import * as Yaml from "yaml";
23
+ import { CommandConfig } from "@dxos/cli-util";
24
+ import { ConfigService } from "@dxos/client";
25
+ var view = Command.make("view", {}, Effect.fnUntraced(function* () {
26
+ const config2 = yield* ConfigService;
27
+ const { json } = yield* CommandConfig;
28
+ if (json) {
29
+ yield* Console.log(JSON.stringify(config2.values, null, 2));
30
+ } else {
31
+ yield* Console.log(Yaml.stringify(config2.values));
32
+ }
33
+ }));
34
+
35
+ // src/cli/commands/config/index.ts
36
+ var config = Command2.make("config").pipe(Command2.withDescription("Config commands."), Command2.withSubcommands([
37
+ view
38
+ ]));
39
+
40
+ // src/cli/commands/device/index.ts
41
+ import * as Command6 from "@effect/cli/Command";
42
+
43
+ // src/cli/commands/device/info/info.ts
44
+ import * as Command3 from "@effect/cli/Command";
45
+ import * as Console2 from "effect/Console";
46
+ import * as Effect2 from "effect/Effect";
47
+ import { CommandConfig as CommandConfig2 } from "@dxos/cli-util";
48
+ import { print } from "@dxos/cli-util";
49
+ import { ClientService } from "@dxos/client";
50
+ import { DeviceType as DeviceType2 } from "@dxos/protocols/proto/dxos/halo/credentials";
51
+
52
+ // src/cli/commands/device/util.ts
53
+ import { FormBuilder } from "@dxos/cli-util";
54
+ import { Device, DeviceKind, DeviceType } from "@dxos/client/halo";
55
+ var maybeTruncateKey = (key, truncate = false) => truncate ? key.truncate() : key.toHex();
56
+ var getDeviceTitle = (device2) => {
57
+ if (device2.profile?.label) {
58
+ return device2.profile.label;
59
+ }
60
+ const platform = device2.profile?.platform ?? "Unknown";
61
+ const os = device2.profile?.os ?? "Unknown";
62
+ return `${platform} on ${os}`;
63
+ };
64
+ var mapDevices = (devices, truncateKeys = false) => {
65
+ return devices.map((device2) => ({
66
+ label: device2.profile?.label,
67
+ type: device2.profile?.type ? DeviceType[device2.profile?.type] : "UNKNOWN",
68
+ key: maybeTruncateKey(device2.deviceKey, truncateKeys),
69
+ kind: DeviceKind[device2.kind],
70
+ platform: device2.profile?.platform,
71
+ platformVersion: device2.profile?.platformVersion,
72
+ architecture: device2.profile?.architecture,
73
+ os: device2.profile?.os,
74
+ osVersion: device2.profile?.osVersion,
75
+ presence: device2?.kind === DeviceKind.CURRENT ? "THIS DEVICE" : Device.PresenceState[device2.presence]
76
+ }));
77
+ };
78
+ var printDevice = (device2) => FormBuilder.make({
79
+ title: getDeviceTitle(device2)
80
+ }).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);
81
+ var printDevices = (devices) => {
82
+ return devices.map(printDevice);
83
+ };
84
+
85
+ // src/cli/commands/device/info/info.ts
86
+ var handler = Effect2.fn(function* () {
87
+ const { json } = yield* CommandConfig2;
88
+ const client = yield* ClientService;
89
+ yield* Effect2.tryPromise(() => client.spaces.waitUntilReady());
90
+ const device2 = client.halo.device;
91
+ if (!device2) {
92
+ if (json) {
93
+ yield* Console2.log(JSON.stringify({
94
+ error: "No device found"
95
+ }, null, 2));
96
+ } else {
97
+ yield* Console2.log("No device found.");
98
+ }
99
+ return;
100
+ }
101
+ if (json) {
102
+ yield* Console2.log(JSON.stringify({
103
+ deviceKey: device2.deviceKey.toHex(),
104
+ profile: {
105
+ ...device2.profile,
106
+ type: device2.profile?.type ? DeviceType2[device2.profile?.type] : "UNKNOWN"
107
+ }
108
+ }, null, 2));
109
+ } else {
110
+ yield* Console2.log(print(printDevice(device2)));
111
+ }
112
+ });
113
+ var info = Command3.make("info", {}, handler).pipe(Command3.withDescription("Show device info."));
114
+
115
+ // src/cli/commands/device/list/list.ts
116
+ import * as Command4 from "@effect/cli/Command";
117
+ import * as Console3 from "effect/Console";
118
+ import * as Effect3 from "effect/Effect";
119
+ import { CommandConfig as CommandConfig3 } from "@dxos/cli-util";
120
+ import { printList } from "@dxos/cli-util";
121
+ import { ClientService as ClientService2 } from "@dxos/client";
122
+ var handler2 = Effect3.fn(function* () {
123
+ const { json } = yield* CommandConfig3;
124
+ const client = yield* ClientService2;
125
+ yield* Effect3.tryPromise(() => client.spaces.waitUntilReady());
126
+ const devices = client.halo.devices.get();
127
+ if (json) {
128
+ yield* Console3.log(JSON.stringify(mapDevices(devices), null, 2));
129
+ } else {
130
+ const formatted = printDevices(devices);
131
+ yield* Console3.log(printList(formatted));
132
+ }
133
+ });
134
+ var list = Command4.make("list", {}, handler2).pipe(Command4.withDescription("List devices."));
135
+
136
+ // src/cli/commands/device/update/update.ts
137
+ import * as Command5 from "@effect/cli/Command";
138
+ import * as Options from "@effect/cli/Options";
139
+ import * as Console4 from "effect/Console";
140
+ import * as Effect4 from "effect/Effect";
141
+ import { CommandConfig as CommandConfig4 } from "@dxos/cli-util";
142
+ import { print as print2 } from "@dxos/cli-util";
143
+ import { ClientService as ClientService3 } from "@dxos/client";
144
+ var handler3 = Effect4.fn(function* ({ label }) {
145
+ const { json } = yield* CommandConfig4;
146
+ const client = yield* ClientService3;
147
+ yield* Effect4.tryPromise(() => client.spaces.waitUntilReady());
148
+ const device2 = client.halo.device;
149
+ if (!device2) {
150
+ if (json) {
151
+ yield* Console4.log(JSON.stringify({
152
+ error: "No device found"
153
+ }, null, 2));
154
+ } else {
155
+ yield* Console4.log("No device found.");
156
+ }
157
+ return;
158
+ }
159
+ const updatedProfile = {
160
+ ...device2.profile,
161
+ label
162
+ };
163
+ const devicesService = client.services.services.DevicesService;
164
+ if (!devicesService) {
165
+ if (json) {
166
+ yield* Console4.log(JSON.stringify({
167
+ error: "DevicesService not found"
168
+ }, null, 2));
169
+ } else {
170
+ yield* Console4.log("DevicesService not found.");
171
+ }
172
+ return;
173
+ }
174
+ const updatedDevice = yield* Effect4.tryPromise(() => devicesService.updateDevice(updatedProfile));
175
+ if (json) {
176
+ yield* Console4.log(JSON.stringify({
177
+ deviceKey: updatedDevice.deviceKey.toHex(),
178
+ profile: updatedDevice.profile
179
+ }, null, 2));
180
+ } else {
181
+ yield* Console4.log(print2(printDevice(updatedDevice)));
182
+ }
183
+ });
184
+ var update = Command5.make("update", {
185
+ label: Options.text("label").pipe(Options.withDescription("The device label."))
186
+ }, handler3).pipe(Command5.withDescription("Update device label."));
187
+
188
+ // src/cli/commands/device/index.ts
189
+ var device = Command6.make("device").pipe(Command6.withDescription("Manage HALO devices."), Command6.withSubcommands([
190
+ info,
191
+ list,
192
+ update
193
+ ]));
194
+
195
+ // src/cli/commands/edge/index.ts
196
+ import * as Command8 from "@effect/cli/Command";
197
+
198
+ // src/cli/commands/edge/status.ts
199
+ import * as Command7 from "@effect/cli/Command";
200
+ import * as Console5 from "effect/Console";
201
+ import * as Effect5 from "effect/Effect";
202
+ import * as Option from "effect/Option";
203
+ import { CommandConfig as CommandConfig5 } from "@dxos/cli-util";
204
+ import { ClientService as ClientService4 } from "@dxos/client";
205
+ import { createEdgeIdentity } from "@dxos/client/edge";
206
+ var getStatus = () => Effect5.gen(function* () {
207
+ const client = yield* ClientService4;
208
+ const identity2 = createEdgeIdentity(client);
209
+ client.edge.setIdentity(identity2);
210
+ const status2 = yield* Effect5.tryPromise(() => client.edge.getStatus());
211
+ if (yield* CommandConfig5.isJson) {
212
+ yield* Console5.log(JSON.stringify(status2, null, 2));
213
+ } else if (status2.problems.length > 0) {
214
+ for (const problem of status2.problems) {
215
+ yield* Console5.error(problem);
216
+ }
217
+ } else {
218
+ yield* Console5.log("No problems found.");
219
+ }
220
+ }).pipe(
221
+ // TODO(wittjosiah): Tagged error.
222
+ Effect5.catchSome((error2) => {
223
+ if (error2 instanceof Error && error2.message === "Identity not available") {
224
+ return Option.some(Console5.error(error2.message));
225
+ } else {
226
+ return Option.none();
227
+ }
228
+ })
229
+ );
230
+ var status = Command7.make("status", {}, getStatus).pipe(Command7.withDescription("Get the EDGE status for the current identity."));
231
+
232
+ // src/cli/commands/edge/index.ts
233
+ var edge = Command8.make("edge").pipe(Command8.withDescription("EDGE commands."), Command8.withSubcommands([
234
+ status
235
+ ]));
236
+
237
+ // src/cli/commands/halo/index.ts
238
+ import * as Command18 from "@effect/cli/Command";
239
+
240
+ // src/cli/commands/halo/create/create.ts
241
+ import * as Command9 from "@effect/cli/Command";
242
+ import * as Options2 from "@effect/cli/Options";
243
+ import * as Console6 from "effect/Console";
244
+ import * as Effect6 from "effect/Effect";
245
+ import * as Option2 from "effect/Option";
246
+ import { Common, Plugin } from "@dxos/app-framework";
247
+ import { CommandConfig as CommandConfig6, flushAndSync, spaceLayer } from "@dxos/cli-util";
248
+ import { print as print3 } from "@dxos/cli-util";
249
+ import { ClientService as ClientService5 } from "@dxos/client";
250
+ import { invariant } from "@dxos/invariant";
251
+
252
+ // src/cli/commands/halo/util.ts
253
+ import { FormBuilder as FormBuilder2 } from "@dxos/cli-util";
254
+ var printIdentity = (identity2) => FormBuilder2.make({
255
+ title: "Identity"
256
+ }).pipe(FormBuilder2.set("identityKey", identity2.identityKey.truncate()), FormBuilder2.set("displayName", identity2.profile?.displayName ?? "<none>"), FormBuilder2.build);
257
+
258
+ // src/cli/commands/halo/create/create.ts
259
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-client/src/cli/commands/halo/create/create.ts";
260
+ var handler4 = Effect6.fn(function* ({ agent, displayName }) {
261
+ const { json } = yield* CommandConfig6;
262
+ const client = yield* ClientService5;
263
+ invariant(!client.halo.identity.get(), "Identity already exists", {
264
+ F: __dxlog_file,
265
+ L: 30,
266
+ S: this,
267
+ A: [
268
+ "!client.halo.identity.get()",
269
+ "'Identity already exists'"
270
+ ]
271
+ });
272
+ const manager = yield* Plugin.Service;
273
+ const { invoke } = manager.capabilities.get(Common.Capability.OperationInvoker);
274
+ const identity2 = yield* invoke(ClientOperation.CreateIdentity, {
275
+ displayName: Option2.getOrUndefined(displayName)
276
+ });
277
+ if (agent) {
278
+ yield* invoke(ClientOperation.CreateAgent);
279
+ }
280
+ yield* Effect6.promise(() => client.spaces.waitUntilReady());
281
+ yield* Effect6.promise(() => client.spaces.default.waitUntilReady());
282
+ const space = client.spaces.default;
283
+ yield* flushAndSync({
284
+ indexes: true
285
+ }).pipe(Effect6.provide(spaceLayer(Option2.some(space.id))));
286
+ if (json) {
287
+ yield* Console6.log(JSON.stringify({
288
+ identityKey: identity2.identityKey.toHex(),
289
+ displayName: identity2.profile?.displayName
290
+ }, null, 2));
291
+ } else {
292
+ yield* Console6.log(print3(printIdentity(identity2)));
293
+ }
294
+ });
295
+ var create = Command9.make("create", {
296
+ agent: Options2.boolean("noAgent", {
297
+ ifPresent: false
298
+ }).pipe(Options2.withDescription("Do not create an EDGE agent for the identity.")),
299
+ displayName: Options2.text("displayName").pipe(Options2.withDescription("The display name of the identity."), Options2.optional)
300
+ }, handler4).pipe(Command9.withDescription("Create a new identity."));
301
+
302
+ // src/cli/commands/halo/credential/index.ts
303
+ import * as Command12 from "@effect/cli/Command";
304
+
305
+ // src/cli/commands/halo/credential/add/add.ts
306
+ import * as Args from "@effect/cli/Args";
307
+ import * as Command10 from "@effect/cli/Command";
308
+ import * as Prompt from "@effect/cli/Prompt";
309
+ import * as Console7 from "effect/Console";
310
+ import * as Effect7 from "effect/Effect";
311
+ import * as Option3 from "effect/Option";
312
+ import { CommandConfig as CommandConfig7 } from "@dxos/cli-util";
313
+ import { ClientService as ClientService6 } from "@dxos/client";
314
+ import { invariant as invariant2 } from "@dxos/invariant";
315
+ import { schema } from "@dxos/protocols/proto";
316
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/cli/commands/halo/credential/add/add.ts";
317
+ var handler5 = Effect7.fn(function* ({ credential: credential2 }) {
318
+ const { json } = yield* CommandConfig7;
319
+ const client = yield* ClientService6;
320
+ let credentialHex = Option3.getOrUndefined(credential2);
321
+ if (!credentialHex) {
322
+ credentialHex = yield* Prompt.text({
323
+ message: "Enter credential (hex string)"
324
+ }).pipe(Prompt.run);
325
+ }
326
+ invariant2(credentialHex, "Invalid credential.", {
327
+ F: __dxlog_file2,
328
+ L: 26,
329
+ S: this,
330
+ A: [
331
+ "credentialHex",
332
+ "'Invalid credential.'"
333
+ ]
334
+ });
335
+ const identity2 = client.halo.identity;
336
+ if (!identity2) {
337
+ if (json) {
338
+ yield* Console7.log(JSON.stringify({
339
+ error: "Profile not initialized"
340
+ }, null, 2));
341
+ } else {
342
+ yield* Console7.log("Profile not initialized.");
343
+ }
344
+ return;
345
+ }
346
+ yield* Effect7.gen(function* () {
347
+ const codec = schema.getCodecForType("dxos.halo.credentials.Credential");
348
+ const credentialBytes = yield* Effect7.try({
349
+ try: () => Buffer.from(credentialHex, "hex"),
350
+ catch: (error2) => new Error(`Failed to parse hex string: ${error2}`)
351
+ });
352
+ const verifyError = codec.protoType.verify(credentialBytes);
353
+ if (verifyError) {
354
+ yield* Effect7.fail(new Error(verifyError));
355
+ }
356
+ const credentialObj = yield* Effect7.try({
357
+ try: () => codec.decode(credentialBytes),
358
+ catch: (error2) => new Error(`Failed to decode credential: ${error2}`)
359
+ });
360
+ yield* Effect7.tryPromise({
361
+ try: () => client.halo.writeCredentials([
362
+ credentialObj
363
+ ]),
364
+ catch: (error2) => new Error(`Failed to write credential: ${error2}`)
365
+ });
366
+ if (json) {
367
+ yield* Console7.log(JSON.stringify({
368
+ success: true
369
+ }, null, 2));
370
+ } else {
371
+ yield* Console7.log("Credential added successfully.");
372
+ }
373
+ }).pipe(Effect7.catchAll((error2) => Effect7.gen(function* () {
374
+ if (json) {
375
+ yield* Console7.log(JSON.stringify({
376
+ error: "Invalid credential",
377
+ message: error2 instanceof Error ? error2.message : String(error2)
378
+ }, null, 2));
379
+ } else {
380
+ yield* Console7.log("Invalid credential.");
381
+ }
382
+ yield* Effect7.fail(error2);
383
+ })));
384
+ });
385
+ var add = Command10.make("add", {
386
+ credential: Args.text({
387
+ name: "credential"
388
+ }).pipe(Args.withDescription("Credential as hex string."), Args.optional)
389
+ }, handler5).pipe(Command10.withDescription("Import credential into HALO."));
390
+
391
+ // src/cli/commands/halo/credential/list/list.ts
392
+ import * as Command11 from "@effect/cli/Command";
393
+ import * as Options3 from "@effect/cli/Options";
394
+ import * as Console8 from "effect/Console";
395
+ import * as Duration from "effect/Duration";
396
+ import * as Effect8 from "effect/Effect";
397
+ import * as Option4 from "effect/Option";
398
+ import { CommandConfig as CommandConfig8, Common as Common2, FormBuilder as FormBuilder3, getSpace, printList as printList2, spaceIdWithDefault } from "@dxos/cli-util";
399
+ import { ClientService as ClientService7 } from "@dxos/client";
400
+ var mapCredentials = (credentials) => {
401
+ return credentials.map((credential2) => ({
402
+ id: credential2.id?.toHex() ?? "<unknown>",
403
+ issuer: credential2.issuer?.toHex() ?? "<unknown>",
404
+ subject: credential2.subject?.id?.toHex() ?? "<unknown>",
405
+ type: credential2.subject.assertion["@type"],
406
+ assertion: credential2.subject.assertion
407
+ }));
408
+ };
409
+ var printCredential = (credential2) => {
410
+ const type = credential2.subject.assertion["@type"] ?? "<unknown>";
411
+ return FormBuilder3.make({
412
+ title: type
413
+ }).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);
414
+ };
415
+ var handler6 = Effect8.fn(function* ({ type, spaceId, timeout: timeout2, delay }) {
416
+ const { json } = yield* CommandConfig8;
417
+ const client = yield* ClientService7;
418
+ yield* Effect8.tryPromise(() => client.spaces.waitUntilReady());
419
+ let credentials;
420
+ const resolvedSpaceId = yield* spaceIdWithDefault(spaceId);
421
+ if (Option4.isSome(spaceId)) {
422
+ const space = yield* getSpace(resolvedSpaceId);
423
+ credentials = yield* Effect8.tryPromise(() => space.internal.getCredentials());
424
+ } else {
425
+ const identity2 = client.halo.identity;
426
+ if (!identity2) {
427
+ if (json) {
428
+ yield* Console8.log(JSON.stringify({
429
+ error: "Profile not initialized"
430
+ }, null, 2));
431
+ } else {
432
+ yield* Console8.log("Profile not initialized.");
433
+ }
434
+ return;
435
+ }
436
+ const latch = yield* Effect8.makeLatch();
437
+ const subscription = client.halo.credentials.subscribe((creds) => {
438
+ if (creds.length > 0) {
439
+ Effect8.runSync(latch.open);
440
+ }
441
+ });
442
+ yield* latch.await.pipe(Effect8.timeout(Duration.millis(timeout2)), Effect8.catchAll(() => Effect8.void), Effect8.ensuring(Effect8.sync(() => {
443
+ subscription.unsubscribe();
444
+ })));
445
+ yield* Effect8.sleep(Duration.millis(delay));
446
+ credentials = client.halo.queryCredentials({
447
+ type: Option4.getOrUndefined(type)
448
+ });
449
+ }
450
+ if (json) {
451
+ yield* Console8.log(JSON.stringify(mapCredentials(credentials), null, 2));
452
+ } else {
453
+ const formatted = credentials.map(printCredential);
454
+ yield* Console8.log(printList2(formatted));
455
+ }
456
+ });
457
+ var list2 = Command11.make("list", {
458
+ type: Options3.text("type").pipe(Options3.withDescription("Filter by credential type."), Options3.optional),
459
+ spaceId: Common2.spaceId.pipe(Options3.withDescription("Space ID to show credentials from."), Options3.optional),
460
+ timeout: Options3.integer("timeout").pipe(Options3.withDescription("Time in milliseconds to wait for at least one credential before listing."), Options3.withDefault(500)),
461
+ delay: Options3.integer("delay").pipe(Options3.withDescription("Delay in milliseconds before listing."), Options3.withDefault(250))
462
+ }, handler6).pipe(Command11.withDescription("List HALO credentials."));
463
+
464
+ // src/cli/commands/halo/credential/index.ts
465
+ var credential = Command12.make("credential").pipe(Command12.withDescription("Manage HALO credentials."), Command12.withSubcommands([
466
+ add,
467
+ list2
468
+ ]));
469
+
470
+ // src/cli/commands/halo/identity/identity.ts
471
+ import * as Command13 from "@effect/cli/Command";
472
+ import * as Console9 from "effect/Console";
473
+ import * as Effect9 from "effect/Effect";
474
+ import { CommandConfig as CommandConfig9 } from "@dxos/cli-util";
475
+ import { print as print4 } from "@dxos/cli-util";
476
+ import { ClientService as ClientService8 } from "@dxos/client";
477
+ var handler7 = Effect9.fn(function* () {
478
+ const { json } = yield* CommandConfig9;
479
+ const client = yield* ClientService8;
480
+ const identity2 = client.halo.identity.get();
481
+ if (!identity2) {
482
+ if (json) {
483
+ yield* Console9.log(JSON.stringify({
484
+ error: "Identity not initialized"
485
+ }, null, 2));
486
+ } else {
487
+ yield* Console9.log("Identity not initialized.");
488
+ }
489
+ } else {
490
+ yield* Effect9.tryPromise(() => client.spaces.waitUntilReady());
491
+ if (json) {
492
+ yield* Console9.log(JSON.stringify({
493
+ identityKey: identity2.identityKey.toHex(),
494
+ displayName: identity2.profile?.displayName
495
+ }, null, 2));
496
+ } else {
497
+ yield* Console9.log(print4(printIdentity(identity2)));
498
+ }
499
+ }
500
+ });
501
+ var identity = Command13.make("identity", {}, handler7).pipe(Command13.withDescription("Get the current identity."));
502
+
503
+ // src/cli/commands/halo/keys/keys.ts
504
+ import * as Command14 from "@effect/cli/Command";
505
+ import * as Console10 from "effect/Console";
506
+ import * as Effect10 from "effect/Effect";
507
+ import * as Option5 from "effect/Option";
508
+ import { CommandConfig as CommandConfig10 } from "@dxos/cli-util";
509
+ import { FormBuilder as FormBuilder4, print as print5 } from "@dxos/cli-util";
510
+ import { ClientService as ClientService9 } from "@dxos/client";
511
+ var handler8 = Effect10.fn(function* () {
512
+ const { json } = yield* CommandConfig10;
513
+ const client = yield* ClientService9;
514
+ yield* Effect10.tryPromise(() => client.spaces.waitUntilReady());
515
+ const identity2 = client.halo.identity.get();
516
+ const device2 = client.halo.device;
517
+ if (json) {
518
+ yield* Console10.log(JSON.stringify({
519
+ identityKey: identity2?.identityKey.toHex(),
520
+ deviceKey: device2?.deviceKey.toHex()
521
+ }, null, 2));
522
+ } else {
523
+ const builder = FormBuilder4.make({
524
+ title: "HALO Keys"
525
+ }).pipe(FormBuilder4.option("identityKey", Option5.fromNullable(identity2?.identityKey.truncate())), FormBuilder4.option("deviceKey", Option5.fromNullable(device2?.deviceKey.truncate())));
526
+ yield* Console10.log(print5(FormBuilder4.build(builder)));
527
+ }
528
+ });
529
+ var keys = Command14.make("keys", {}, handler8).pipe(Command14.withDescription("Show HALO keys."));
530
+
531
+ // src/cli/commands/halo/recover/recover.ts
532
+ import * as Args2 from "@effect/cli/Args";
533
+ import * as Command15 from "@effect/cli/Command";
534
+ import * as Console11 from "effect/Console";
535
+ import * as Effect11 from "effect/Effect";
536
+ import { CommandConfig as CommandConfig11, print as print6 } from "@dxos/cli-util";
537
+ import { ClientService as ClientService10 } from "@dxos/client";
538
+ import { invariant as invariant3 } from "@dxos/invariant";
539
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/cli/commands/halo/recover/recover.ts";
540
+ var recover = Command15.make("recover", {
541
+ recoveryCode: Args2.text({
542
+ name: "recoveryCode"
543
+ }).pipe(Args2.withDescription("The recovery code seed phrase."))
544
+ }, Effect11.fn(function* ({ recoveryCode }) {
545
+ const { json } = yield* CommandConfig11;
546
+ const client = yield* ClientService10;
547
+ invariant3(!client.halo.identity.get(), "Identity already exists", {
548
+ F: __dxlog_file3,
549
+ L: 25,
550
+ S: this,
551
+ A: [
552
+ "!client.halo.identity.get()",
553
+ "'Identity already exists'"
554
+ ]
555
+ });
556
+ const identity2 = yield* Effect11.tryPromise(() => client.halo.recoverIdentity({
557
+ recoveryCode
558
+ }));
559
+ if (json) {
560
+ yield* Console11.log(JSON.stringify({
561
+ identityKey: identity2.identityKey.toHex(),
562
+ displayName: identity2.profile?.displayName
563
+ }, null, 2));
564
+ } else {
565
+ yield* Console11.log("Identity recovered successfully");
566
+ yield* Console11.log(print6(printIdentity(identity2)));
567
+ }
568
+ })).pipe(Command15.withDescription("Recover an existing identity using a recovery code."));
569
+
570
+ // src/cli/commands/halo/seed/seed.ts
571
+ import * as Command16 from "@effect/cli/Command";
572
+ import * as Console12 from "effect/Console";
573
+ import * as Effect12 from "effect/Effect";
574
+ import { CommandConfig as CommandConfig12 } from "@dxos/cli-util";
575
+ import { ClientService as ClientService11 } from "@dxos/client";
576
+ var handler9 = Effect12.fn(function* () {
577
+ const { json } = yield* CommandConfig12;
578
+ const client = yield* ClientService11;
579
+ yield* Effect12.tryPromise(() => client.spaces.waitUntilReady());
580
+ const identityService = client.services.services.IdentityService;
581
+ if (!identityService) {
582
+ if (json) {
583
+ yield* Console12.log(JSON.stringify({
584
+ error: "IdentityService not found"
585
+ }, null, 2));
586
+ } else {
587
+ yield* Console12.log("IdentityService not found.");
588
+ }
589
+ return;
590
+ }
591
+ const result = yield* Effect12.tryPromise(() => identityService.createRecoveryCredential({}));
592
+ if (json) {
593
+ yield* Console12.log(JSON.stringify({
594
+ recoveryCode: result.recoveryCode
595
+ }, null, 2));
596
+ } else {
597
+ yield* Console12.log(result.recoveryCode);
598
+ }
599
+ });
600
+ var seed = Command16.make("seed", {}, handler9).pipe(Command16.withDescription("Generate a seedphrase that can be used for identity recovery."));
601
+
602
+ // src/cli/commands/halo/update/update.ts
603
+ import * as Command17 from "@effect/cli/Command";
604
+ import * as Options4 from "@effect/cli/Options";
605
+ import * as Console13 from "effect/Console";
606
+ import * as Effect13 from "effect/Effect";
607
+ import { CommandConfig as CommandConfig13 } from "@dxos/cli-util";
608
+ import { print as print7 } from "@dxos/cli-util";
609
+ import { ClientService as ClientService12 } from "@dxos/client";
610
+ var handler10 = Effect13.fn(function* ({ displayName }) {
611
+ const { json } = yield* CommandConfig13;
612
+ const client = yield* ClientService12;
613
+ yield* Effect13.tryPromise(() => client.spaces.waitUntilReady());
614
+ const identity2 = client.halo.identity.get();
615
+ if (!identity2) {
616
+ if (json) {
617
+ yield* Console13.log(JSON.stringify({
618
+ error: "Identity not initialized"
619
+ }, null, 2));
620
+ } else {
621
+ yield* Console13.log("Identity not initialized.");
622
+ }
623
+ return;
624
+ }
625
+ const identityService = client.services.services.IdentityService;
626
+ if (!identityService) {
627
+ if (json) {
628
+ yield* Console13.log(JSON.stringify({
629
+ error: "IdentityService not found"
630
+ }, null, 2));
631
+ } else {
632
+ yield* Console13.log("IdentityService not found.");
633
+ }
634
+ return;
635
+ }
636
+ const updatedIdentity = yield* Effect13.tryPromise(() => identityService.updateProfile({
637
+ displayName
638
+ }));
639
+ if (json) {
640
+ yield* Console13.log(JSON.stringify({
641
+ identityKey: updatedIdentity.identityKey.toHex(),
642
+ displayName: updatedIdentity.profile?.displayName
643
+ }, null, 2));
644
+ } else {
645
+ yield* Console13.log(print7(printIdentity(updatedIdentity)));
646
+ }
647
+ });
648
+ var update2 = Command17.make("update", {
649
+ displayName: Options4.text("displayName").pipe(Options4.withDescription("The display name of the identity."))
650
+ }, handler10).pipe(Command17.withDescription("Update identity profile."));
651
+
652
+ // src/cli/commands/halo/index.ts
653
+ var halo = Command18.make("halo").pipe(Command18.withDescription("Manage HALO identity."), Command18.withSubcommands([
654
+ create,
655
+ credential,
656
+ identity,
657
+ keys,
658
+ recover,
659
+ seed,
660
+ update2
661
+ ]));
662
+
663
+ // src/cli/commands/profile/index.ts
664
+ import * as Command25 from "@effect/cli/Command";
665
+
666
+ // src/cli/commands/profile/create.ts
667
+ import * as Command19 from "@effect/cli/Command";
668
+ import * as Options5 from "@effect/cli/Options";
669
+ import * as FileSystem from "@effect/platform/FileSystem";
670
+ import * as Console14 from "effect/Console";
671
+ import * as Effect14 from "effect/Effect";
672
+ import * as Option6 from "effect/Option";
673
+ import * as Record from "effect/Record";
674
+ import { CommandConfig as CommandConfig14, print as print8 } from "@dxos/cli-util";
675
+ import { DX_CONFIG, getProfilePath } from "@dxos/client-protocol";
676
+ import { trim } from "@dxos/util";
677
+
678
+ // src/cli/commands/profile/util.ts
679
+ import { FormBuilder as FormBuilder5 } from "@dxos/cli-util";
680
+ var printProfileCreated = (name, path) => FormBuilder5.make({
681
+ title: "Profile created"
682
+ }).pipe(FormBuilder5.set("name", name), FormBuilder5.set("path", path), FormBuilder5.build);
683
+ var printProfileDeleted = (name) => FormBuilder5.make({
684
+ title: "Profile deleted"
685
+ }).pipe(FormBuilder5.set("name", name), FormBuilder5.build);
686
+ var printProfileReset = (profile2) => FormBuilder5.make({
687
+ title: "Profile reset"
688
+ }).pipe(FormBuilder5.set("profile", profile2), FormBuilder5.build);
689
+ var printProfile = (profile2) => {
690
+ const title = profile2.isCurrent ? `${profile2.name} (current)` : profile2.name;
691
+ return FormBuilder5.make({
692
+ title
693
+ }).pipe(FormBuilder5.set("fullPath", profile2.fullPath), FormBuilder5.set("storagePath", profile2.storagePath), FormBuilder5.set("edge", profile2.edge ?? "<none>"), FormBuilder5.build);
694
+ };
695
+
696
+ // src/cli/commands/profile/create.ts
697
+ var TEMPLATES = {
698
+ default: trim`
699
+ version: 1
700
+ runtime:
701
+ client:
702
+ storage:
703
+ persistent: true
704
+ services:
705
+ edge:
706
+ url: https://edge-production.dxos.workers.dev
707
+ `,
708
+ main: trim`
709
+ version: 1
710
+ runtime:
711
+ client:
712
+ storage:
713
+ persistent: true
714
+ services:
715
+ edge:
716
+ url: https://edge-main.dxos.workers.dev
717
+ `,
718
+ dev: trim`
719
+ version: 1
720
+ runtime:
721
+ client:
722
+ storage:
723
+ persistent: true
724
+ services:
725
+ edge:
726
+ url: https://edge.dxos.workers.dev
727
+ `,
728
+ local: trim`
729
+ version: 1
730
+ runtime:
731
+ client:
732
+ storage:
733
+ persistent: true
734
+ services:
735
+ edge:
736
+ url: http://localhost:8787
737
+ `
738
+ };
739
+ var create2 = Command19.make("create", {
740
+ template: Options5.choice("template", Record.keys(TEMPLATES)).pipe(Options5.withDescription("Template to use"), Options5.withDefault("default")),
741
+ name: Options5.text("name").pipe(Options5.withDescription("Profile name"), Options5.optional)
742
+ }, Effect14.fnUntraced(function* ({ template, name }) {
743
+ const { json } = yield* CommandConfig14;
744
+ const fs = yield* FileSystem.FileSystem;
745
+ const profileName = name.pipe(Option6.getOrElse(() => template));
746
+ const profilePath = `${getProfilePath(DX_CONFIG, profileName)}.yml`;
747
+ if (yield* fs.exists(profilePath)) {
748
+ throw new Error(`Profile ${profileName} already exists`);
749
+ }
750
+ yield* fs.writeFileString(profilePath, TEMPLATES[template]);
751
+ if (json) {
752
+ yield* Console14.log(JSON.stringify({
753
+ name: profileName,
754
+ path: profilePath
755
+ }, null, 2));
756
+ } else {
757
+ yield* Console14.log(print8(printProfileCreated(profileName, profilePath)));
758
+ }
759
+ }));
760
+
761
+ // src/cli/commands/profile/delete.ts
762
+ import * as Command20 from "@effect/cli/Command";
763
+ import * as Options6 from "@effect/cli/Options";
764
+ import * as FileSystem3 from "@effect/platform/FileSystem";
765
+ import * as Console15 from "effect/Console";
766
+ import * as Effect15 from "effect/Effect";
767
+ import * as Option7 from "effect/Option";
768
+ import { CommandConfig as CommandConfig15, print as print9 } from "@dxos/cli-util";
769
+ import { DX_CONFIG as DX_CONFIG2, getProfilePath as getProfilePath2 } from "@dxos/client-protocol";
770
+ var del = Command20.make("delete", {
771
+ name: Options6.text("name").pipe(Options6.withDescription("Profile name"), Options6.optional)
772
+ }, Effect15.fnUntraced(function* ({ name }) {
773
+ const { json } = yield* CommandConfig15;
774
+ const fs = yield* FileSystem3.FileSystem;
775
+ const profileName = name.pipe(Option7.getOrElse(() => "default"));
776
+ yield* fs.remove(`${getProfilePath2(DX_CONFIG2, profileName)}.yml`);
777
+ if (json) {
778
+ yield* Console15.log(JSON.stringify({
779
+ name: profileName,
780
+ deleted: true
781
+ }, null, 2));
782
+ } else {
783
+ yield* Console15.log(print9(printProfileDeleted(profileName)));
784
+ }
785
+ }));
786
+
787
+ // src/cli/commands/profile/import.ts
788
+ import * as Command21 from "@effect/cli/Command";
789
+ import * as Options7 from "@effect/cli/Options";
790
+ import * as Prompt2 from "@effect/cli/Prompt";
791
+ import * as FileSystem5 from "@effect/platform/FileSystem";
792
+ import * as Path from "@effect/platform/Path";
793
+ import * as Console16 from "effect/Console";
794
+ import * as Effect16 from "effect/Effect";
795
+ import * as Option8 from "effect/Option";
796
+ import { CommandConfig as CommandConfig16 } from "@dxos/cli-util";
797
+ import { ConfigService as ConfigService2 } from "@dxos/config";
798
+ import { log as log17 } from "@dxos/log";
799
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-client/src/cli/commands/profile/import.ts";
800
+ var handler11 = Effect16.fn(function* ({ file, dataDir, force }) {
801
+ const dataDirValue = Option8.getOrUndefined(dataDir);
802
+ const { json, profile: profile2 } = yield* CommandConfig16;
803
+ const fs = yield* FileSystem5.FileSystem;
804
+ const path = yield* Path.Path;
805
+ const config2 = yield* ConfigService2;
806
+ const { createLevel, createStorageObjects, importProfileData, decodeProfileArchive } = yield* Effect16.promise(() => import("@dxos/client-services"));
807
+ let storageConfig;
808
+ if (!dataDirValue) {
809
+ if (!force) {
810
+ yield* Console16.log(`Will overwrite profile: ${profile2}`);
811
+ const confirmed = yield* Prompt2.confirm({
812
+ message: `Delete all data? (Profile: ${profile2})`,
813
+ initial: false
814
+ }).pipe(Prompt2.run);
815
+ if (!confirmed) {
816
+ return;
817
+ }
818
+ }
819
+ storageConfig = config2.values.runtime.client.storage;
820
+ } else {
821
+ const fullPath = path.resolve(dataDirValue);
822
+ yield* Console16.log(`Importing into: ${fullPath}`);
823
+ storageConfig = {
824
+ persistent: true,
825
+ dataRoot: fullPath
826
+ };
827
+ }
828
+ if (yield* fs.exists(storageConfig.dataRoot)) {
829
+ log17.error("data directory already exists", {
830
+ path: storageConfig.dataRoot
831
+ }, {
832
+ F: __dxlog_file4,
833
+ L: 61,
834
+ S: this,
835
+ C: (f, a) => f(...a)
836
+ });
837
+ if (json) {
838
+ yield* Console16.log(JSON.stringify({
839
+ error: "Data directory already exists"
840
+ }, null, 2));
841
+ } else {
842
+ yield* Console16.log("Data directory already exists.");
843
+ }
844
+ return;
845
+ }
846
+ const data = yield* fs.readFile(file);
847
+ const archive = decodeProfileArchive(data);
848
+ yield* Console16.log(`Importing archive with ${archive.storage.length} entries`);
849
+ const { storage } = createStorageObjects(storageConfig);
850
+ const level = yield* Effect16.tryPromise({
851
+ try: () => createLevel(storageConfig),
852
+ catch: (error2) => new Error(`Failed to create level: ${error2}`)
853
+ });
854
+ yield* Console16.log("Beginning profile import...");
855
+ yield* Effect16.tryPromise({
856
+ try: () => importProfileData({
857
+ storage,
858
+ level
859
+ }, archive),
860
+ catch: (error2) => new Error(`Failed to import profile data: ${error2}`)
861
+ });
862
+ yield* Console16.log("Profile import complete");
863
+ if (json) {
864
+ yield* Console16.log(JSON.stringify({
865
+ success: true,
866
+ profile: profile2,
867
+ entries: archive.storage.length
868
+ }, null, 2));
869
+ }
870
+ });
871
+ var importCommand = Command21.make("import", {
872
+ file: Options7.text("file").pipe(Options7.withDescription("Archive filename."), Options7.withAlias("f")),
873
+ dataDir: Options7.text("data-dir").pipe(Options7.withDescription("Storage directory."), Options7.optional),
874
+ force: Options7.boolean("force", {
875
+ ifPresent: true
876
+ }).pipe(Options7.withDescription("Skip confirmation prompt."))
877
+ }, handler11).pipe(Command21.withDescription("Import profile."));
878
+
879
+ // src/cli/commands/profile/inspect.ts
880
+ import * as Command22 from "@effect/cli/Command";
881
+ import * as Options8 from "@effect/cli/Options";
882
+ import * as FileSystem7 from "@effect/platform/FileSystem";
883
+ import * as Console17 from "effect/Console";
884
+ import * as Effect17 from "effect/Effect";
885
+ import { CommandConfig as CommandConfig17, FormBuilder as FormBuilder6, print as print10 } from "@dxos/cli-util";
886
+ import { ProfileArchiveEntryType } from "@dxos/protocols";
887
+ import { arrayToBuffer } from "@dxos/util";
888
+ var handler12 = Effect17.fn(function* ({ file, storage }) {
889
+ const { json } = yield* CommandConfig17;
890
+ const fs = yield* FileSystem7.FileSystem;
891
+ const { decodeProfileArchive } = yield* Effect17.promise(() => import("@dxos/client-services"));
892
+ const data = yield* fs.readFile(file);
893
+ const archive = decodeProfileArchive(data);
894
+ if (json) {
895
+ yield* Console17.log(JSON.stringify({
896
+ meta: archive.meta,
897
+ ...storage ? {
898
+ storage: archive.storage
899
+ } : {}
900
+ }, null, 2));
901
+ } else {
902
+ const builder = FormBuilder6.make({
903
+ title: "Profile Archive"
904
+ }).pipe(FormBuilder6.when(archive.meta, FormBuilder6.each(Object.entries(archive.meta ?? {}), ([key, value]) => FormBuilder6.set(key, String(value)))), FormBuilder6.build);
905
+ yield* Console17.log(print10(builder));
906
+ if (storage) {
907
+ yield* Console17.log("\nStorage entries:\n");
908
+ for (const entry of archive.storage) {
909
+ const key = typeof entry.key === "string" ? entry.key : JSON.stringify(arrayToBuffer(entry.key).toString()).slice(1, -1);
910
+ yield* Console17.log(` ${ProfileArchiveEntryType[entry.type]} ${key}`);
911
+ }
912
+ }
913
+ }
914
+ });
915
+ var inspect = Command22.make("inspect", {
916
+ file: Options8.text("file").pipe(Options8.withDescription("Archive filename."), Options8.withAlias("f")),
917
+ storage: Options8.boolean("storage", {
918
+ ifPresent: true
919
+ }).pipe(Options8.withDescription("List storage entries."))
920
+ }, handler12).pipe(Command22.withDescription("Inspect profile archive."));
921
+
922
+ // src/cli/commands/profile/list.ts
923
+ import * as Command23 from "@effect/cli/Command";
924
+ import * as FileSystem9 from "@effect/platform/FileSystem";
925
+ import * as Path3 from "@effect/platform/Path";
926
+ import * as Console18 from "effect/Console";
927
+ import * as Effect18 from "effect/Effect";
928
+ import * as Yaml2 from "yaml";
929
+ import { CommandConfig as CommandConfig18, printList as printList3 } from "@dxos/cli-util";
930
+ import { Config } from "@dxos/client";
931
+ import { DX_CONFIG as DX_CONFIG3, DX_DATA, getProfilePath as getProfilePath3 } from "@dxos/client-protocol";
932
+ var list3 = Command23.make("list", {}, Effect18.fnUntraced(function* () {
933
+ const { profile: currentProfile } = yield* CommandConfig18;
934
+ const fs = yield* FileSystem9.FileSystem;
935
+ const path = yield* Path3.Path;
936
+ const profileDir = path.join(DX_CONFIG3, "profile");
937
+ const files = yield* fs.readDirectory(profileDir);
938
+ const profiles = yield* Effect18.forEach(files, Effect18.fnUntraced(function* (filename) {
939
+ const ext = path.extname(filename);
940
+ const name = filename.slice(0, -ext.length);
941
+ const fullPath = path.join(DX_CONFIG3, "profile", filename);
942
+ const configContent = yield* fs.readFileString(fullPath);
943
+ const configValues = Yaml2.parse(configContent);
944
+ const config2 = new Config(configValues);
945
+ return {
946
+ name,
947
+ isCurrent: name === currentProfile,
948
+ fullPath,
949
+ storagePath: getProfilePath3(configValues?.runtime?.client?.storage.dataRoot ?? DX_DATA, name),
950
+ edge: config2.values.runtime?.services?.edge?.url
951
+ };
952
+ }));
953
+ const { json } = yield* CommandConfig18;
954
+ if (json) {
955
+ yield* Console18.log(JSON.stringify(profiles, null, 2));
956
+ } else {
957
+ const formatted = profiles.map(printProfile);
958
+ yield* Console18.log(printList3(formatted));
959
+ }
960
+ }));
961
+
962
+ // src/cli/commands/profile/reset.ts
963
+ import * as Command24 from "@effect/cli/Command";
964
+ import * as Options9 from "@effect/cli/Options";
965
+ import * as Prompt3 from "@effect/cli/Prompt";
966
+ import * as FileSystem11 from "@effect/platform/FileSystem";
967
+ import * as Console19 from "effect/Console";
968
+ import * as Effect19 from "effect/Effect";
969
+ import { CommandConfig as CommandConfig19, print as print11 } from "@dxos/cli-util";
970
+ import { DX_DATA as DX_DATA2, getProfilePath as getProfilePath4 } from "@dxos/client-protocol";
971
+ import { ConfigService as ConfigService3 } from "@dxos/config";
972
+ var reset = Command24.make("reset", {
973
+ force: Options9.boolean("force", {
974
+ ifPresent: true
975
+ }).pipe(Options9.withDescription("Skip confirmation prompt"))
976
+ }, Effect19.fnUntraced(function* ({ force }) {
977
+ const fs = yield* FileSystem11.FileSystem;
978
+ const config2 = yield* ConfigService3;
979
+ const { json, profile: profile2 } = yield* CommandConfig19;
980
+ const path = config2.values.runtime?.client?.storage?.dataRoot ?? getProfilePath4(DX_DATA2, profile2);
981
+ if (!force) {
982
+ const confirmed = yield* Prompt3.confirm({
983
+ message: `Are you sure you want to reset the profile (${profile2})?`,
984
+ initial: false
985
+ });
986
+ if (!confirmed) {
987
+ return;
988
+ }
989
+ }
990
+ yield* fs.remove(path, {
991
+ recursive: true
992
+ });
993
+ if (json) {
994
+ yield* Console19.log(JSON.stringify({
995
+ profile: profile2,
996
+ reset: true
997
+ }, null, 2));
998
+ } else {
999
+ yield* Console19.log(print11(printProfileReset(profile2)));
1000
+ }
1001
+ }));
1002
+
1003
+ // src/cli/commands/profile/index.ts
1004
+ var profile = Command25.make("profile").pipe(Command25.withDescription("Profile commands."), Command25.withSubcommands([
1005
+ create2,
1006
+ del,
1007
+ importCommand,
1008
+ inspect,
1009
+ list3,
1010
+ reset
1011
+ ]));
1012
+
1013
+ // src/cli/plugin.ts
1014
+ var ClientPlugin = Plugin2.define(meta).pipe(
1015
+ Plugin2.addModule((options) => ({
1016
+ id: Capability.getModuleTag(Client),
1017
+ activatesOn: Common3.ActivationEvent.Startup,
1018
+ activatesAfter: [
1019
+ ClientEvents.ClientReady
1020
+ ],
1021
+ activate: () => Client(options)
1022
+ })),
1023
+ Plugin2.addModule({
1024
+ activatesOn: ClientEvents.ClientReady,
1025
+ activatesBefore: [
1026
+ Common3.ActivationEvent.SetupSchema
1027
+ ],
1028
+ activate: SchemaDefs
1029
+ }),
1030
+ // TODO(wittjosiah): Could some of these commands make use of operations?
1031
+ Common3.Plugin.addCommandModule({
1032
+ commands: [
1033
+ config,
1034
+ device,
1035
+ edge,
1036
+ halo,
1037
+ profile
1038
+ ]
1039
+ }),
1040
+ Common3.Plugin.addOperationResolverModule({
1041
+ activate: () => OperationResolver()
1042
+ }),
1043
+ Plugin2.make
1044
+ );
1045
+ export {
1046
+ ClientPlugin
1047
+ };
1048
+ //# sourceMappingURL=index.mjs.map