@dxos/plugin-registry 0.8.4-main.d05673bc65 → 0.8.4-main.dfabb4ec29

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 (234) hide show
  1. package/dist/lib/neutral/RegistryPlugin.mjs +27 -0
  2. package/dist/lib/neutral/RegistryPlugin.mjs.map +7 -0
  3. package/dist/lib/{browser/cli/index.mjs → neutral/RegistryPlugin.node.mjs} +28 -97
  4. package/dist/lib/neutral/RegistryPlugin.node.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-XK2JMH3H.mjs +33 -0
  6. package/dist/lib/neutral/chunk-XK2JMH3H.mjs.map +7 -0
  7. package/dist/lib/{browser/chunk-KMUDYITM.mjs → neutral/chunk-YV7A523U.mjs} +11 -3
  8. package/dist/lib/neutral/chunk-YV7A523U.mjs.map +7 -0
  9. package/dist/lib/neutral/index.mjs +21 -0
  10. package/dist/lib/neutral/index.mjs.map +7 -0
  11. package/dist/lib/neutral/meta.json +1 -0
  12. package/dist/lib/neutral/open-plugin-registry-II735N76.mjs +15 -0
  13. package/dist/lib/neutral/open-plugin-registry-II735N76.mjs.map +7 -0
  14. package/dist/lib/neutral/plugin.mjs +18 -0
  15. package/dist/lib/neutral/plugin.mjs.map +7 -0
  16. package/dist/lib/neutral/translations.mjs +61 -0
  17. package/dist/lib/neutral/translations.mjs.map +7 -0
  18. package/dist/types/src/RegistryPlugin.d.ts +1 -0
  19. package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
  20. package/dist/types/src/{cli/plugin.d.ts → RegistryPlugin.node.d.ts} +2 -1
  21. package/dist/types/src/RegistryPlugin.node.d.ts.map +1 -0
  22. package/dist/types/src/RegistryPlugin.test.d.ts +2 -0
  23. package/dist/types/src/RegistryPlugin.test.d.ts.map +1 -0
  24. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  25. package/dist/types/src/capabilities/dev-plugin-loader.d.ts +11 -0
  26. package/dist/types/src/capabilities/dev-plugin-loader.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/index.d.ts +15 -3
  28. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  29. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  30. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/settings.d.ts +14 -0
  33. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  34. package/dist/types/src/{cli/commands → commands}/disable.d.ts +2 -2
  35. package/dist/types/src/commands/disable.d.ts.map +1 -0
  36. package/dist/types/src/{cli/commands → commands}/enable.d.ts +2 -2
  37. package/dist/types/src/commands/enable.d.ts.map +1 -0
  38. package/dist/types/src/commands/index.d.ts.map +1 -0
  39. package/dist/types/src/commands/list.d.ts +7 -0
  40. package/dist/types/src/commands/list.d.ts.map +1 -0
  41. package/dist/types/src/commands/util.d.ts.map +1 -0
  42. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +39 -2
  43. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -1
  44. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +51 -16
  45. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts.map +1 -1
  46. package/dist/types/src/components/PluginFailureBadge/PluginFailureBadge.d.ts +20 -0
  47. package/dist/types/src/components/PluginFailureBadge/PluginFailureBadge.d.ts.map +1 -0
  48. package/dist/types/src/components/PluginFailureBadge/index.d.ts +2 -0
  49. package/dist/types/src/components/PluginFailureBadge/index.d.ts.map +1 -0
  50. package/dist/types/src/components/PluginList/PluginItem.d.ts +29 -2
  51. package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -1
  52. package/dist/types/src/components/PluginList/PluginList.d.ts +18 -3
  53. package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -1
  54. package/dist/types/src/components/PluginList/PluginList.stories.d.ts +49 -16
  55. package/dist/types/src/components/PluginList/PluginList.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/RegistrySettings/RegistrySettings.d.ts +18 -0
  57. package/dist/types/src/components/RegistrySettings/RegistrySettings.d.ts.map +1 -0
  58. package/dist/types/src/components/RegistrySettings/index.d.ts +2 -0
  59. package/dist/types/src/components/RegistrySettings/index.d.ts.map +1 -0
  60. package/dist/types/src/components/index.d.ts +2 -0
  61. package/dist/types/src/components/index.d.ts.map +1 -1
  62. package/dist/types/src/containers/BaseRegistryArticle/BaseRegistryArticle.d.ts +20 -0
  63. package/dist/types/src/containers/BaseRegistryArticle/BaseRegistryArticle.d.ts.map +1 -0
  64. package/dist/types/src/containers/BaseRegistryArticle/index.d.ts +2 -0
  65. package/dist/types/src/containers/BaseRegistryArticle/index.d.ts.map +1 -0
  66. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts +4 -0
  67. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts.map +1 -0
  68. package/dist/types/src/containers/LoadPluginDialog/index.d.ts +2 -0
  69. package/dist/types/src/containers/LoadPluginDialog/index.d.ts.map +1 -0
  70. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -1
  71. package/dist/types/src/containers/PluginArticle/index.d.ts +1 -2
  72. package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -1
  73. package/dist/types/src/containers/PublicRegistryArticle/PublicRegistryArticle.d.ts +8 -0
  74. package/dist/types/src/containers/PublicRegistryArticle/PublicRegistryArticle.d.ts.map +1 -0
  75. package/dist/types/src/containers/PublicRegistryArticle/index.d.ts +2 -0
  76. package/dist/types/src/containers/PublicRegistryArticle/index.d.ts.map +1 -0
  77. package/dist/types/src/containers/RegistryArticle/RegistryArticle.d.ts +14 -0
  78. package/dist/types/src/containers/RegistryArticle/RegistryArticle.d.ts.map +1 -0
  79. package/dist/types/src/containers/RegistryArticle/index.d.ts +2 -0
  80. package/dist/types/src/containers/RegistryArticle/index.d.ts.map +1 -0
  81. package/dist/types/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.d.ts +13 -0
  82. package/dist/types/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.d.ts.map +1 -0
  83. package/dist/types/src/containers/RegistrySettingsContainer/index.d.ts +2 -0
  84. package/dist/types/src/containers/RegistrySettingsContainer/index.d.ts.map +1 -0
  85. package/dist/types/src/containers/index.d.ts +5 -1
  86. package/dist/types/src/containers/index.d.ts.map +1 -1
  87. package/dist/types/src/hooks/index.d.ts +4 -0
  88. package/dist/types/src/hooks/index.d.ts.map +1 -0
  89. package/dist/types/src/hooks/use-auto-tags.d.ts +20 -0
  90. package/dist/types/src/hooks/use-auto-tags.d.ts.map +1 -0
  91. package/dist/types/src/hooks/use-registry-plugins.d.ts +15 -0
  92. package/dist/types/src/hooks/use-registry-plugins.d.ts.map +1 -0
  93. package/dist/types/src/hooks/use-update-available.d.ts +18 -0
  94. package/dist/types/src/hooks/use-update-available.d.ts.map +1 -0
  95. package/dist/types/src/index.d.ts +1 -1
  96. package/dist/types/src/index.d.ts.map +1 -1
  97. package/dist/types/src/meta.d.ts +3 -1
  98. package/dist/types/src/meta.d.ts.map +1 -1
  99. package/dist/types/src/operations/index.d.ts +3 -0
  100. package/dist/types/src/operations/index.d.ts.map +1 -0
  101. package/dist/types/src/operations/open-plugin-registry.d.ts +5 -0
  102. package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -0
  103. package/dist/types/src/plugin.d.ts +4 -0
  104. package/dist/types/src/plugin.d.ts.map +1 -0
  105. package/dist/types/src/storage.d.ts.map +1 -0
  106. package/dist/types/src/translations.d.ts +48 -16
  107. package/dist/types/src/translations.d.ts.map +1 -1
  108. package/dist/types/src/types.d.ts +30 -1
  109. package/dist/types/src/types.d.ts.map +1 -1
  110. package/dist/types/tsconfig.tsbuildinfo +1 -1
  111. package/package.json +57 -36
  112. package/src/{cli/plugin.ts → RegistryPlugin.node.ts} +3 -1
  113. package/src/RegistryPlugin.test.ts +24 -0
  114. package/src/RegistryPlugin.tsx +13 -5
  115. package/src/capabilities/app-graph-builder.ts +200 -0
  116. package/src/capabilities/dev-plugin-loader.ts +39 -0
  117. package/src/capabilities/index.ts +11 -3
  118. package/src/capabilities/operation-handler.ts +16 -0
  119. package/src/capabilities/react-surface.tsx +136 -0
  120. package/src/capabilities/settings.ts +34 -0
  121. package/src/components/PluginDetail/PluginDetail.stories.tsx +4 -4
  122. package/src/components/PluginDetail/PluginDetail.tsx +175 -60
  123. package/src/components/PluginFailureBadge/PluginFailureBadge.tsx +68 -0
  124. package/src/components/PluginFailureBadge/index.ts +5 -0
  125. package/src/components/PluginList/PluginItem.tsx +116 -14
  126. package/src/components/PluginList/PluginList.stories.tsx +17 -14
  127. package/src/components/PluginList/PluginList.tsx +32 -4
  128. package/src/components/RegistrySettings/RegistrySettings.tsx +120 -0
  129. package/src/components/RegistrySettings/index.ts +5 -0
  130. package/src/components/index.ts +2 -0
  131. package/src/containers/BaseRegistryArticle/BaseRegistryArticle.tsx +163 -0
  132. package/src/containers/BaseRegistryArticle/index.ts +5 -0
  133. package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +87 -0
  134. package/src/containers/LoadPluginDialog/index.ts +5 -0
  135. package/src/containers/PluginArticle/PluginArticle.tsx +317 -9
  136. package/src/containers/PluginArticle/index.ts +1 -3
  137. package/src/containers/PublicRegistryArticle/PublicRegistryArticle.tsx +192 -0
  138. package/src/containers/PublicRegistryArticle/index.ts +5 -0
  139. package/src/containers/RegistryArticle/RegistryArticle.tsx +53 -0
  140. package/src/containers/RegistryArticle/index.ts +5 -0
  141. package/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.tsx +59 -0
  142. package/src/containers/RegistrySettingsContainer/index.ts +5 -0
  143. package/src/containers/index.ts +5 -1
  144. package/src/hooks/index.ts +7 -0
  145. package/src/hooks/use-auto-tags.ts +51 -0
  146. package/src/hooks/use-registry-plugins.ts +29 -0
  147. package/src/hooks/use-update-available.ts +31 -0
  148. package/src/index.ts +1 -1
  149. package/src/meta.ts +10 -1
  150. package/src/operations/index.ts +7 -0
  151. package/src/operations/open-plugin-registry.ts +21 -0
  152. package/src/plugin.ts +11 -0
  153. package/src/translations.ts +52 -15
  154. package/src/types.ts +33 -1
  155. package/dist/lib/browser/PluginArticle-74DKRXJH.mjs +0 -29
  156. package/dist/lib/browser/PluginArticle-74DKRXJH.mjs.map +0 -7
  157. package/dist/lib/browser/PluginRegistry-DORQQ7GM.mjs +0 -78
  158. package/dist/lib/browser/PluginRegistry-DORQQ7GM.mjs.map +0 -7
  159. package/dist/lib/browser/app-graph-builder-AHS5BI4Y.mjs +0 -167
  160. package/dist/lib/browser/app-graph-builder-AHS5BI4Y.mjs.map +0 -7
  161. package/dist/lib/browser/chunk-KMUDYITM.mjs.map +0 -7
  162. package/dist/lib/browser/chunk-QQUG6FNW.mjs +0 -191
  163. package/dist/lib/browser/chunk-QQUG6FNW.mjs.map +0 -7
  164. package/dist/lib/browser/cli/index.mjs.map +0 -7
  165. package/dist/lib/browser/index.mjs +0 -65
  166. package/dist/lib/browser/index.mjs.map +0 -7
  167. package/dist/lib/browser/meta.json +0 -1
  168. package/dist/lib/browser/operation-resolver-PK4B2BZQ.mjs +0 -25
  169. package/dist/lib/browser/operation-resolver-PK4B2BZQ.mjs.map +0 -7
  170. package/dist/lib/browser/react-surface-HPLHM3SK.mjs +0 -85
  171. package/dist/lib/browser/react-surface-HPLHM3SK.mjs.map +0 -7
  172. package/dist/lib/node-esm/PluginArticle-JPVC7NXQ.mjs +0 -30
  173. package/dist/lib/node-esm/PluginArticle-JPVC7NXQ.mjs.map +0 -7
  174. package/dist/lib/node-esm/PluginRegistry-3ZB4DFF7.mjs +0 -79
  175. package/dist/lib/node-esm/PluginRegistry-3ZB4DFF7.mjs.map +0 -7
  176. package/dist/lib/node-esm/app-graph-builder-DBDL5WWF.mjs +0 -168
  177. package/dist/lib/node-esm/app-graph-builder-DBDL5WWF.mjs.map +0 -7
  178. package/dist/lib/node-esm/chunk-ENSNUFQK.mjs +0 -23
  179. package/dist/lib/node-esm/chunk-ENSNUFQK.mjs.map +0 -7
  180. package/dist/lib/node-esm/chunk-II5WBDYI.mjs +0 -192
  181. package/dist/lib/node-esm/chunk-II5WBDYI.mjs.map +0 -7
  182. package/dist/lib/node-esm/cli/index.mjs +0 -223
  183. package/dist/lib/node-esm/cli/index.mjs.map +0 -7
  184. package/dist/lib/node-esm/index.mjs +0 -66
  185. package/dist/lib/node-esm/index.mjs.map +0 -7
  186. package/dist/lib/node-esm/meta.json +0 -1
  187. package/dist/lib/node-esm/operation-resolver-CCHN4NBP.mjs +0 -26
  188. package/dist/lib/node-esm/operation-resolver-CCHN4NBP.mjs.map +0 -7
  189. package/dist/lib/node-esm/react-surface-GM64KKI3.mjs +0 -86
  190. package/dist/lib/node-esm/react-surface-GM64KKI3.mjs.map +0 -7
  191. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  192. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  193. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  194. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  195. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  196. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  197. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  198. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  199. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  200. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  201. package/dist/types/src/cli/commands/disable.d.ts.map +0 -1
  202. package/dist/types/src/cli/commands/enable.d.ts.map +0 -1
  203. package/dist/types/src/cli/commands/index.d.ts.map +0 -1
  204. package/dist/types/src/cli/commands/list.d.ts +0 -7
  205. package/dist/types/src/cli/commands/list.d.ts.map +0 -1
  206. package/dist/types/src/cli/commands/util.d.ts.map +0 -1
  207. package/dist/types/src/cli/index.d.ts +0 -3
  208. package/dist/types/src/cli/index.d.ts.map +0 -1
  209. package/dist/types/src/cli/plugin.d.ts.map +0 -1
  210. package/dist/types/src/cli/storage.d.ts.map +0 -1
  211. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts +0 -8
  212. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts.map +0 -1
  213. package/dist/types/src/containers/PluginRegistry/index.d.ts +0 -3
  214. package/dist/types/src/containers/PluginRegistry/index.d.ts.map +0 -1
  215. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -137
  216. package/src/capabilities/app-graph-builder/index.ts +0 -7
  217. package/src/capabilities/operation-resolver/index.ts +0 -7
  218. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -24
  219. package/src/capabilities/react-surface/index.ts +0 -7
  220. package/src/capabilities/react-surface/react-surface.tsx +0 -88
  221. package/src/cli/index.ts +0 -6
  222. package/src/containers/PluginRegistry/PluginRegistry.tsx +0 -86
  223. package/src/containers/PluginRegistry/index.ts +0 -7
  224. /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
  225. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
  226. /package/dist/types/src/{cli/commands → commands}/index.d.ts +0 -0
  227. /package/dist/types/src/{cli/commands → commands}/util.d.ts +0 -0
  228. /package/dist/types/src/{cli/storage.d.ts → storage.d.ts} +0 -0
  229. /package/src/{cli/commands → commands}/disable.ts +0 -0
  230. /package/src/{cli/commands → commands}/enable.ts +0 -0
  231. /package/src/{cli/commands → commands}/index.ts +0 -0
  232. /package/src/{cli/commands → commands}/list.ts +0 -0
  233. /package/src/{cli/commands → commands}/util.ts +0 -0
  234. /package/src/{cli/storage.ts → storage.ts} +0 -0
@@ -2,27 +2,335 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { useCallback } from 'react';
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import React, { type Dispatch, type SetStateAction, useCallback, useEffect, useMemo, useState } from 'react';
6
8
 
7
- import { type Plugin } from '@dxos/app-framework';
9
+ import { type Plugin, type PluginManager, type Registry, UrlLoader } from '@dxos/app-framework';
8
10
  import { usePluginManager } from '@dxos/app-framework/ui';
9
11
  import { runAndForwardErrors } from '@dxos/effect';
10
12
 
11
- import { PluginDetail } from '../../components';
13
+ import { PluginDetail } from '#components';
14
+
15
+ import { useRegistryPluginProvider, useRegistryPlugins, useRemotePluginIds } from '../../hooks';
12
16
 
13
17
  // TODO(burdon): Convert to ECHO type.
14
18
  export type PluginArticleProps = { subject: Plugin.Plugin };
15
19
 
16
20
  export const PluginArticle = ({ subject: plugin }: PluginArticleProps) => {
21
+ const pluginId = plugin.meta.id;
17
22
  const manager = usePluginManager();
18
- const enabled = manager.getEnabled().includes(plugin.meta.id);
23
+ const plugins = useAtomValue(manager.plugins);
24
+ const remotePluginIds = useRemotePluginIds();
25
+ const provider = useRegistryPluginProvider();
26
+
27
+ const { catalogEntry, moduleUrl, repo } = useCatalogEntry(pluginId);
28
+ const { installedVersionTag, syncInstalledVersion } = useInstalledVersionTag(pluginId, plugins);
29
+ const { pickerVersions, selectedVersionTag, setSelectedVersionTag } = useVersionPicker({
30
+ provider,
31
+ pluginId,
32
+ repo,
33
+ moduleUrl,
34
+ installedVersionTag,
35
+ });
36
+
37
+ const enabled = manager.getEnabled().includes(pluginId);
38
+ const failed = useAtomValue(manager.failed);
39
+ const failure = useMemo(() => failed.find((entry) => entry.id === pluginId), [failed, pluginId]);
40
+ const isInstalled = useMemo(() => plugins.some((candidate) => candidate.meta.id === pluginId), [plugins, pluginId]);
41
+ const isCore = manager.getCore().includes(pluginId);
42
+ const canUninstall = isInstalled && !isCore && remotePluginIds.has(pluginId);
43
+ const hasUpdate =
44
+ isInstalled && !!catalogEntry && !!installedVersionTag && installedVersionTag !== catalogEntry.version;
45
+
46
+ const actions = usePluginActions({
47
+ manager,
48
+ pluginId,
49
+ isInstalled,
50
+ moduleUrl,
51
+ catalogEntry,
52
+ pickerVersions,
53
+ selectedVersionTag,
54
+ syncInstalledVersion,
55
+ });
56
+
57
+ return (
58
+ <PluginDetail
59
+ plugin={plugin}
60
+ enabled={enabled}
61
+ onEnabledChange={actions.handleEnableChange}
62
+ onInstall={!isInstalled && moduleUrl ? actions.handleInstall : undefined}
63
+ installing={actions.installing}
64
+ onUpdate={hasUpdate ? actions.handleUpdate : undefined}
65
+ hasUpdate={hasUpdate}
66
+ updating={actions.updating}
67
+ onUninstall={canUninstall ? actions.handleUninstall : undefined}
68
+ versions={pickerVersions}
69
+ selectedVersionTag={selectedVersionTag}
70
+ onVersionChange={setSelectedVersionTag}
71
+ onInstallVersion={pickerVersions.length > 0 ? actions.handleInstallVersion : undefined}
72
+ installedVersionTag={installedVersionTag}
73
+ failure={failure}
74
+ />
75
+ );
76
+ };
77
+
78
+ //
79
+ // Hooks
80
+ //
81
+ // Each of the hooks below isolates a self-contained slice of the article's
82
+ // state machine. They're declared at module scope (rather than inline in
83
+ // `PluginArticle`) to keep the component readable as a thin wiring layer over
84
+ // `PluginDetail`.
85
+ //
86
+
87
+ /**
88
+ * Resolves the registry catalog entry for a plugin by id, plus the two fields
89
+ * (`moduleUrl`, `repo`) the rest of the article cares about.
90
+ */
91
+ const useCatalogEntry = (
92
+ pluginId: string,
93
+ ): {
94
+ catalogEntry: Registry.Plugin | undefined;
95
+ moduleUrl: string | undefined;
96
+ repo: string | undefined;
97
+ } => {
98
+ const { entries } = useRegistryPlugins();
99
+ const catalogEntry = useMemo(() => entries.find((entry) => entry.id === pluginId), [entries, pluginId]);
100
+ return { catalogEntry, moduleUrl: catalogEntry?.moduleUrl, repo: catalogEntry?.repo };
101
+ };
102
+
103
+ /**
104
+ * Tracks the per-plugin installed version (sourced from `UrlLoader` localStorage)
105
+ * as React state so post-install/update re-renders are deterministic — the value
106
+ * lives in component state rather than being read inline on every render.
107
+ *
108
+ * - Initialised from localStorage at mount.
109
+ * - Auto-resyncs when the plugin manager's plugin list changes (catches external
110
+ * installs / removes triggered by the list view).
111
+ * - `syncInstalledVersion()` is the explicit handle install/update operations
112
+ * call inside their `Effect.ensuring` so the post-mutation render sees both
113
+ * the new version and the cleared `installing`/`updating` flag together.
114
+ */
115
+ const useInstalledVersionTag = (
116
+ pluginId: string,
117
+ plugins: readonly Plugin.Plugin[],
118
+ ): {
119
+ installedVersionTag: string | undefined;
120
+ syncInstalledVersion: () => void;
121
+ } => {
122
+ const [installedVersionTag, setInstalledVersionTag] = useState<string | undefined>(() =>
123
+ UrlLoader.getInstalledVersion(pluginId),
124
+ );
125
+
126
+ const syncInstalledVersion = useCallback(() => {
127
+ setInstalledVersionTag(UrlLoader.getInstalledVersion(pluginId));
128
+ }, [pluginId]);
129
+
130
+ useEffect(() => {
131
+ syncInstalledVersion();
132
+ }, [plugins, syncInstalledVersion]);
133
+
134
+ return { installedVersionTag, syncInstalledVersion };
135
+ };
136
+
137
+ /**
138
+ * Owns the version picker's state machine: fetches the available versions list
139
+ * from the provider, prepends the installed version when the catalog stub omits
140
+ * it, and keeps the selection clamped to whatever's currently in the list (so
141
+ * an external update doesn't strand the trigger on a tag that's no longer
142
+ * available).
143
+ */
144
+ const useVersionPicker = ({
145
+ provider,
146
+ pluginId,
147
+ repo,
148
+ moduleUrl,
149
+ installedVersionTag,
150
+ }: {
151
+ provider: Registry.Manager;
152
+ pluginId: string;
153
+ repo: string | undefined;
154
+ moduleUrl: string | undefined;
155
+ installedVersionTag: string | undefined;
156
+ }): {
157
+ pickerVersions: readonly Registry.PluginVersion[];
158
+ selectedVersionTag: string | undefined;
159
+ setSelectedVersionTag: Dispatch<SetStateAction<string | undefined>>;
160
+ } => {
161
+ const [versions, setVersions] = useState<readonly Registry.PluginVersion[]>([]);
162
+ const [selectedVersionTag, setSelectedVersionTag] = useState<string | undefined>();
163
+
164
+ // Load version list once the catalog entry's repo is known.
165
+ useEffect(() => {
166
+ if (!repo) {
167
+ return;
168
+ }
169
+ void provider.listVersions(repo).pipe(
170
+ Effect.match({
171
+ onSuccess: (vs) => {
172
+ setVersions(vs);
173
+ // Default selection: the currently installed version, or the latest.
174
+ const installedVersion = UrlLoader.getInstalledVersion(pluginId);
175
+ setSelectedVersionTag(installedVersion ?? vs[0]?.tag);
176
+ },
177
+ onFailure: () => {
178
+ // Non-critical; version picker stays empty.
179
+ },
180
+ }),
181
+ runAndForwardErrors,
182
+ );
183
+ }, [provider, repo, pluginId]);
184
+
185
+ // Make sure the picker always lists the installed version, even if the catalog
186
+ // hasn't surfaced it (the current `listVersions` stub only returns latest).
187
+ const pickerVersions = useMemo<readonly Registry.PluginVersion[]>(() => {
188
+ if (!installedVersionTag) {
189
+ return versions;
190
+ }
191
+ if (versions.some((entry) => entry.tag === installedVersionTag)) {
192
+ return versions;
193
+ }
194
+ const installedEntry: Registry.PluginVersion = {
195
+ tag: installedVersionTag,
196
+ // Picker won't be re-installing this entry unless the user selects + clicks Install,
197
+ // and the catalog moduleUrl is the closest stand-in we have.
198
+ moduleUrl: moduleUrl ?? '',
199
+ };
200
+ return [installedEntry, ...versions];
201
+ }, [versions, installedVersionTag, moduleUrl]);
202
+
203
+ // Keep `selectedVersionTag` in sync when picker contents change (e.g. the user
204
+ // updated the plugin from the list view — installed version moved, picker
205
+ // shrunk, prior selection is no longer in the list).
206
+ useEffect(() => {
207
+ if (pickerVersions.length === 0) {
208
+ return;
209
+ }
210
+ if (selectedVersionTag && pickerVersions.some((entry) => entry.tag === selectedVersionTag)) {
211
+ return;
212
+ }
213
+ setSelectedVersionTag(installedVersionTag ?? pickerVersions[0]?.tag);
214
+ }, [pickerVersions, selectedVersionTag, installedVersionTag]);
215
+
216
+ return { pickerVersions, selectedVersionTag, setSelectedVersionTag };
217
+ };
218
+
219
+ /**
220
+ * The five user-facing actions the article exposes — enable/disable, uninstall,
221
+ * install (latest), update (to latest catalog version), and install-from-picker —
222
+ * plus the `installing`/`updating` flags they drive. Each handler ends with a
223
+ * `syncInstalledVersion()` call inside its `Effect.ensuring` so the cached
224
+ * installed version snaps to the freshly-written localStorage value in the same
225
+ * render that clears the in-flight flag.
226
+ */
227
+ const usePluginActions = ({
228
+ manager,
229
+ pluginId,
230
+ isInstalled,
231
+ moduleUrl,
232
+ catalogEntry,
233
+ pickerVersions,
234
+ selectedVersionTag,
235
+ syncInstalledVersion,
236
+ }: {
237
+ manager: PluginManager.PluginManager;
238
+ pluginId: string;
239
+ isInstalled: boolean;
240
+ moduleUrl: string | undefined;
241
+ catalogEntry: Registry.Plugin | undefined;
242
+ pickerVersions: readonly Registry.PluginVersion[];
243
+ selectedVersionTag: string | undefined;
244
+ syncInstalledVersion: () => void;
245
+ }) => {
246
+ const [installing, setInstalling] = useState(false);
247
+ const [updating, setUpdating] = useState(false);
248
+
19
249
  const handleEnableChange = useCallback(
20
250
  (enabled: boolean) =>
21
- enabled
22
- ? runAndForwardErrors(manager.enable(plugin.meta.id))
23
- : runAndForwardErrors(manager.disable(plugin.meta.id)),
24
- [manager, plugin.meta.id],
251
+ enabled ? runAndForwardErrors(manager.enable(pluginId)) : runAndForwardErrors(manager.disable(pluginId)),
252
+ [manager, pluginId],
25
253
  );
26
254
 
27
- return <PluginDetail plugin={plugin} enabled={enabled} onEnabledChange={handleEnableChange} />;
255
+ const handleUninstall = useCallback(() => {
256
+ void runAndForwardErrors(manager.remove(pluginId));
257
+ }, [manager, pluginId]);
258
+
259
+ const handleInstall = useCallback(() => {
260
+ if (!moduleUrl) {
261
+ return;
262
+ }
263
+ setInstalling(true);
264
+ void Effect.gen(function* () {
265
+ const added = yield* manager.add(moduleUrl);
266
+ yield* manager.enable(added.meta.id);
267
+ if (catalogEntry) {
268
+ UrlLoader.setInstalledVersion(added.meta.id, catalogEntry.version);
269
+ }
270
+ }).pipe(
271
+ Effect.ensuring(
272
+ Effect.sync(() => {
273
+ setInstalling(false);
274
+ syncInstalledVersion();
275
+ }),
276
+ ),
277
+ runAndForwardErrors,
278
+ );
279
+ }, [manager, moduleUrl, catalogEntry, syncInstalledVersion]);
280
+
281
+ const handleUpdate = useCallback(() => {
282
+ if (!moduleUrl || !catalogEntry) {
283
+ return;
284
+ }
285
+ setUpdating(true);
286
+ void Effect.gen(function* () {
287
+ yield* manager.remove(pluginId);
288
+ const added = yield* manager.add(moduleUrl);
289
+ yield* manager.enable(added.meta.id);
290
+ UrlLoader.setInstalledVersion(added.meta.id, catalogEntry.version);
291
+ }).pipe(
292
+ Effect.ensuring(
293
+ Effect.sync(() => {
294
+ setUpdating(false);
295
+ syncInstalledVersion();
296
+ }),
297
+ ),
298
+ runAndForwardErrors,
299
+ );
300
+ }, [manager, pluginId, moduleUrl, catalogEntry, syncInstalledVersion]);
301
+
302
+ const handleInstallVersion = useCallback(() => {
303
+ const version = pickerVersions.find((candidate) => candidate.tag === selectedVersionTag);
304
+ if (!version || !version.moduleUrl) {
305
+ return;
306
+ }
307
+ setInstalling(true);
308
+ void Effect.gen(function* () {
309
+ // Remove existing version before installing a different one.
310
+ if (isInstalled) {
311
+ yield* manager.remove(pluginId);
312
+ }
313
+ const added = yield* manager.add(version.moduleUrl);
314
+ yield* manager.enable(added.meta.id);
315
+ UrlLoader.setInstalledVersion(added.meta.id, version.tag);
316
+ }).pipe(
317
+ Effect.ensuring(
318
+ Effect.sync(() => {
319
+ setInstalling(false);
320
+ syncInstalledVersion();
321
+ }),
322
+ ),
323
+ runAndForwardErrors,
324
+ );
325
+ }, [manager, pluginId, isInstalled, selectedVersionTag, pickerVersions, syncInstalledVersion]);
326
+
327
+ return {
328
+ installing,
329
+ updating,
330
+ handleEnableChange,
331
+ handleUninstall,
332
+ handleInstall,
333
+ handleUpdate,
334
+ handleInstallVersion,
335
+ };
28
336
  };
@@ -2,6 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { PluginArticle } from './PluginArticle';
6
-
7
- export default PluginArticle;
5
+ export { PluginArticle as default } from './PluginArticle';
@@ -0,0 +1,192 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import React, { useCallback, useMemo, useState } from 'react';
8
+
9
+ import { type Registry, Plugin, UrlLoader } from '@dxos/app-framework';
10
+ import { useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
11
+ import { runAndForwardErrors } from '@dxos/effect';
12
+ import { ObservabilityOperation } from '@dxos/plugin-observability';
13
+ import { useTranslation } from '@dxos/react-ui';
14
+ import { composable } from '@dxos/ui-theme';
15
+
16
+ import { meta } from '#meta';
17
+
18
+ import { useAutoTags, useRegistryPlugins, useUpdateAvailableIds } from '../../hooks';
19
+ import { BaseRegistryArticle } from '../BaseRegistryArticle';
20
+
21
+ const sortEntries = (a: Registry.Plugin, b: Registry.Plugin) => (a.name ?? a.id).localeCompare(b.name ?? b.id);
22
+
23
+ const sortPlugins = (a: Plugin.Plugin, b: Plugin.Plugin) =>
24
+ (a.meta.name ?? a.meta.id).localeCompare(b.meta.name ?? b.meta.id);
25
+
26
+ /**
27
+ * Turns a registry catalog entry into a minimal Plugin object so we can reuse
28
+ * {@link BaseRegistryArticle} for rendering. The synthesized plugin has no
29
+ * modules — it exists only for display until the user installs it.
30
+ */
31
+ const toDisplayPlugin = (plugin: Registry.Plugin): Plugin.Plugin =>
32
+ ({
33
+ [Plugin.PluginTypeId]: Plugin.PluginTypeId,
34
+ meta: {
35
+ id: plugin.id,
36
+ name: plugin.name,
37
+ description: plugin.description,
38
+ homePage: plugin.homePage,
39
+ source: plugin.source,
40
+ screenshots: plugin.screenshots,
41
+ tags: plugin.tags,
42
+ icon: plugin.icon,
43
+ iconHue: plugin.iconHue,
44
+ },
45
+ modules: [],
46
+ }) as Plugin.Plugin;
47
+
48
+ export type PublicRegistryArticleProps = {
49
+ id: string;
50
+ };
51
+
52
+ export const PublicRegistryArticle = composable<HTMLDivElement, PublicRegistryArticleProps>(
53
+ ({ id, ...props }, forwardedRef) => {
54
+ const { t } = useTranslation(meta.id);
55
+ const manager = usePluginManager();
56
+ const { invoke } = useOperationInvoker();
57
+ const { entries, loading, error } = useRegistryPlugins();
58
+ const plugins = useAtomValue(manager.plugins);
59
+ const installedIds = useMemo(() => plugins.map((plugin) => plugin.meta.id), [plugins]);
60
+ const extraTagsById = useAutoTags(entries);
61
+
62
+ // Snapshot of installed plugin ids at mount time. Used to sort installed
63
+ // plugins to the top without having newly-installed rows jump up mid-session.
64
+ const [installedSnapshot] = useState<ReadonlySet<string>>(
65
+ () => new Set(manager.getPlugins().map((plugin) => plugin.meta.id)),
66
+ );
67
+
68
+ const [installingIds, setInstallingIds] = useState<readonly string[]>([]);
69
+ const [updatingIds, setUpdatingIds] = useState<readonly string[]>([]);
70
+ const updateAvailableIds = useUpdateAvailableIds(entries);
71
+
72
+ const sortedEntries = useMemo(() => [...entries].sort(sortEntries), [entries]);
73
+ const moduleUrlById = useMemo(() => {
74
+ const map: Record<string, string> = {};
75
+ for (const entry of sortedEntries) {
76
+ map[entry.id] = entry.moduleUrl;
77
+ }
78
+ return map;
79
+ }, [sortedEntries]);
80
+
81
+ // Maps plugin id → current registry version (i.e. plugin.version from the catalog).
82
+ const versionById = useMemo(() => {
83
+ const map: Record<string, string> = {};
84
+ for (const entry of sortedEntries) {
85
+ map[entry.id] = entry.version;
86
+ }
87
+ return map;
88
+ }, [sortedEntries]);
89
+
90
+ // Single list with installed-at-mount plugins sorted to the top. Sort order
91
+ // is based on the mount-time snapshot so rows don't jump as the user
92
+ // installs plugins during the session.
93
+ const items = useMemo(() => {
94
+ const catalogIds = new Set(sortedEntries.map((entry) => entry.id));
95
+ const remoteIds = new Set(UrlLoader.getRemoteEntries().map((entry) => entry.id));
96
+ const fromCatalog = sortedEntries.map(toDisplayPlugin);
97
+ const fromUrlOnly = plugins.filter((plugin) => remoteIds.has(plugin.meta.id) && !catalogIds.has(plugin.meta.id));
98
+ const installedFirst = [...fromCatalog, ...fromUrlOnly].sort((a, b) => {
99
+ const aInstalled = installedSnapshot.has(a.meta.id);
100
+ const bInstalled = installedSnapshot.has(b.meta.id);
101
+ if (aInstalled !== bInstalled) {
102
+ return aInstalled ? -1 : 1;
103
+ }
104
+ return sortPlugins(a, b);
105
+ });
106
+ return installedFirst;
107
+ }, [sortedEntries, installedSnapshot, plugins]);
108
+
109
+ const handleInstall = useCallback(
110
+ (pluginId: string) => {
111
+ const moduleUrl = moduleUrlById[pluginId];
112
+ const version = versionById[pluginId];
113
+ if (!moduleUrl) {
114
+ return;
115
+ }
116
+ setInstallingIds((prev) => (prev.includes(pluginId) ? prev : [...prev, pluginId]));
117
+ void Effect.gen(function* () {
118
+ const plugin = yield* manager.add(moduleUrl);
119
+ yield* manager.enable(plugin.meta.id);
120
+ // Persist the installed version for future update detection.
121
+ if (version) {
122
+ UrlLoader.setInstalledVersion(plugin.meta.id, version);
123
+ }
124
+ yield* invoke(ObservabilityOperation.SendEvent, {
125
+ name: 'plugins.install',
126
+ properties: { plugin: plugin.meta.id, source: 'registry' },
127
+ });
128
+ }).pipe(
129
+ Effect.ensuring(Effect.sync(() => setInstallingIds((prev) => prev.filter((pid) => pid !== pluginId)))),
130
+ runAndForwardErrors,
131
+ );
132
+ },
133
+ [invoke, manager, moduleUrlById, versionById],
134
+ );
135
+
136
+ const handleUpdate = useCallback(
137
+ (pluginId: string) => {
138
+ const moduleUrl = moduleUrlById[pluginId];
139
+ const version = versionById[pluginId];
140
+ if (!moduleUrl) {
141
+ return;
142
+ }
143
+ setUpdatingIds((prev) => (prev.includes(pluginId) ? prev : [...prev, pluginId]));
144
+ void Effect.gen(function* () {
145
+ // Unload the old version then re-install from the new URL.
146
+ yield* manager.remove(pluginId);
147
+ const plugin = yield* manager.add(moduleUrl);
148
+ yield* manager.enable(plugin.meta.id);
149
+ if (version) {
150
+ UrlLoader.setInstalledVersion(plugin.meta.id, version);
151
+ }
152
+ yield* invoke(ObservabilityOperation.SendEvent, {
153
+ name: 'plugins.update',
154
+ properties: { plugin: plugin.meta.id, source: 'registry' },
155
+ });
156
+ }).pipe(
157
+ Effect.ensuring(Effect.sync(() => setUpdatingIds((prev) => prev.filter((pid) => pid !== pluginId)))),
158
+ runAndForwardErrors,
159
+ );
160
+ },
161
+ [invoke, manager, moduleUrlById, versionById],
162
+ );
163
+
164
+ const empty = error ? (
165
+ <div className='p-4 text-description'>{t('registry.error.label', { message: error.message })}</div>
166
+ ) : loading ? (
167
+ <div className='p-4 text-description'>{t('registry.loading.label')}</div>
168
+ ) : (
169
+ <div className='p-4 text-description'>{t('registry.empty.label')}</div>
170
+ );
171
+
172
+ return (
173
+ <BaseRegistryArticle
174
+ {...props}
175
+ id={id}
176
+ source='registry'
177
+ plugins={items}
178
+ installed={installedIds}
179
+ installing={installingIds}
180
+ updating={updatingIds}
181
+ updateAvailableIds={updateAvailableIds}
182
+ extraTagsById={extraTagsById}
183
+ onInstall={handleInstall}
184
+ onUpdate={handleUpdate}
185
+ empty={empty}
186
+ ref={forwardedRef}
187
+ />
188
+ );
189
+ },
190
+ );
191
+
192
+ PublicRegistryArticle.displayName = 'PublicRegistryArticle';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export { PublicRegistryArticle as default, PublicRegistryArticle } from './PublicRegistryArticle';
@@ -0,0 +1,53 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import React, { useMemo } from 'react';
7
+
8
+ import { type Plugin, type PluginManager } from '@dxos/app-framework';
9
+ import { usePluginManager } from '@dxos/app-framework/ui';
10
+ import { composable } from '@dxos/ui-theme';
11
+
12
+ import { BaseRegistryArticle } from '../BaseRegistryArticle';
13
+
14
+ const sortByPluginMeta = (a: Plugin.Plugin, b: Plugin.Plugin) =>
15
+ (a.meta.name ?? a.meta.id).localeCompare(b.meta.name ?? b.meta.id);
16
+
17
+ export type RegistryArticleProps = {
18
+ id: string;
19
+ plugins: Plugin.Plugin[];
20
+ /**
21
+ * Map from plugin id → display-only tags (e.g. `registry`, `local`) computed by the caller.
22
+ */
23
+ extraTagsById?: Record<string, readonly string[]>;
24
+ };
25
+
26
+ export const RegistryArticle = composable<HTMLDivElement, RegistryArticleProps>(
27
+ ({ id, plugins: pluginsProp, extraTagsById, ...props }, forwardedRef) => {
28
+ const manager = usePluginManager();
29
+ const failed = useAtomValue(manager.failed);
30
+ const plugins = useMemo(() => [...pluginsProp].sort(sortByPluginMeta), [pluginsProp]);
31
+ const failuresById = useMemo(
32
+ () =>
33
+ failed.reduce<Record<string, PluginManager.PluginFailure>>((acc, failure) => {
34
+ acc[failure.id] = failure;
35
+ return acc;
36
+ }, {}),
37
+ [failed],
38
+ );
39
+
40
+ return (
41
+ <BaseRegistryArticle
42
+ {...props}
43
+ id={id}
44
+ plugins={plugins}
45
+ extraTagsById={extraTagsById}
46
+ failuresById={failuresById}
47
+ ref={forwardedRef}
48
+ />
49
+ );
50
+ },
51
+ );
52
+
53
+ RegistryArticle.displayName = 'RegistryArticle';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export { RegistryArticle as default, RegistryArticle } from './RegistryArticle';
@@ -0,0 +1,59 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import React, { useCallback } from 'react';
8
+
9
+ import { useSettingsState, usePluginManager } from '@dxos/app-framework/ui';
10
+ import { type AppCapabilities } from '@dxos/app-toolkit';
11
+ import { runAndForwardErrors } from '@dxos/effect';
12
+
13
+ import { RegistrySettings } from '../../components';
14
+ import { type RegistrySettings as RegistrySettingsType } from '../../types';
15
+
16
+ export type RegistrySettingsContainerProps = {
17
+ subject: AppCapabilities.Settings;
18
+ };
19
+
20
+ /**
21
+ * Wires the {@link RegistrySettings} presentational component to the plugin
22
+ * manager and the settings atom: subscribes to `manager.devPluginIds` for the
23
+ * "currently loaded" indicator and exposes enable/disable callbacks that drive
24
+ * the manager's add/enable/remove flow.
25
+ */
26
+ export const RegistrySettingsContainer = ({ subject }: RegistrySettingsContainerProps) => {
27
+ const manager = usePluginManager();
28
+ const { settings, updateSettings } = useSettingsState<RegistrySettingsType>(subject.atom);
29
+ const activeDevPluginIds = useAtomValue(manager.devPluginIds);
30
+
31
+ const onEnableDev = useCallback(
32
+ async (url: string) => {
33
+ await runAndForwardErrors(
34
+ Effect.gen(function* () {
35
+ const plugin = yield* manager.add(url);
36
+ yield* manager.enable(plugin.meta.id);
37
+ }),
38
+ );
39
+ },
40
+ [manager],
41
+ );
42
+
43
+ const onDisableDev = useCallback(
44
+ async (id: string) => {
45
+ await runAndForwardErrors(manager.remove(id));
46
+ },
47
+ [manager],
48
+ );
49
+
50
+ return (
51
+ <RegistrySettings
52
+ settings={settings}
53
+ onSettingsChange={updateSettings}
54
+ activeDevPluginIds={activeDevPluginIds}
55
+ onEnableDev={onEnableDev}
56
+ onDisableDev={onDisableDev}
57
+ />
58
+ );
59
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export { RegistrySettingsContainer as default } from './RegistrySettingsContainer';
@@ -4,5 +4,9 @@
4
4
 
5
5
  import { type ComponentType, lazy } from 'react';
6
6
 
7
+ export { LOAD_PLUGIN_DIALOG } from './LoadPluginDialog/LoadPluginDialog';
8
+ export const LoadPluginDialog: ComponentType<any> = lazy(() => import('./LoadPluginDialog'));
7
9
  export const PluginArticle: ComponentType<any> = lazy(() => import('./PluginArticle'));
8
- export const PluginRegistry: ComponentType<any> = lazy(() => import('./PluginRegistry'));
10
+ export const PublicRegistryArticle: ComponentType<any> = lazy(() => import('./PublicRegistryArticle'));
11
+ export const RegistryArticle: ComponentType<any> = lazy(() => import('./RegistryArticle'));
12
+ export const RegistrySettingsContainer: ComponentType<any> = lazy(() => import('./RegistrySettingsContainer'));