@dxos/plugin-client 0.8.3 → 0.8.4-main.1068cf700f

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