@dxos/plugin-registry 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef

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 (171) hide show
  1. package/dist/lib/browser/cli/index.mjs +32 -0
  2. package/dist/lib/browser/cli/index.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +23 -61
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/translations.mjs +35 -0
  7. package/dist/lib/browser/translations.mjs.map +7 -0
  8. package/dist/lib/node-esm/cli/index.mjs +34 -0
  9. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +33 -0
  11. package/dist/lib/node-esm/index.mjs.map +7 -0
  12. package/dist/lib/node-esm/meta.json +1 -0
  13. package/dist/lib/node-esm/translations.mjs +37 -0
  14. package/dist/lib/node-esm/translations.mjs.map +7 -0
  15. package/dist/types/src/RegistryPlugin.d.ts +3 -1
  16. package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
  17. package/dist/types/src/RegistryPlugin.node.d.ts +4 -0
  18. package/dist/types/src/RegistryPlugin.node.d.ts.map +1 -0
  19. package/dist/types/src/RegistryPlugin.test.d.ts +2 -0
  20. package/dist/types/src/RegistryPlugin.test.d.ts.map +1 -0
  21. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  22. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/index.d.ts +6 -3
  24. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  25. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  26. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  28. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  29. package/dist/types/src/capabilities/state.d.ts +7 -0
  30. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  31. package/dist/types/src/cli/index.d.ts +2 -0
  32. package/dist/types/src/cli/index.d.ts.map +1 -0
  33. package/dist/types/src/commands/disable.d.ts +11 -0
  34. package/dist/types/src/commands/disable.d.ts.map +1 -0
  35. package/dist/types/src/commands/enable.d.ts +11 -0
  36. package/dist/types/src/commands/enable.d.ts.map +1 -0
  37. package/dist/types/src/commands/index.d.ts +3 -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 +11 -0
  42. package/dist/types/src/commands/util.d.ts.map +1 -0
  43. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +22 -0
  44. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
  45. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +42 -0
  46. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts.map +1 -0
  47. package/dist/types/src/components/PluginDetail/index.d.ts +2 -0
  48. package/dist/types/src/components/PluginDetail/index.d.ts.map +1 -0
  49. package/dist/types/src/components/PluginList/PluginItem.d.ts +26 -0
  50. package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
  51. package/dist/types/src/components/PluginList/PluginList.d.ts +13 -0
  52. package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -0
  53. package/dist/types/src/components/PluginList/PluginList.stories.d.ts +41 -0
  54. package/dist/types/src/components/PluginList/PluginList.stories.d.ts.map +1 -0
  55. package/dist/types/src/components/PluginList/index.d.ts +2 -0
  56. package/dist/types/src/components/PluginList/index.d.ts.map +1 -0
  57. package/dist/types/src/components/index.d.ts +0 -1
  58. package/dist/types/src/components/index.d.ts.map +1 -1
  59. package/dist/types/src/containers/CommunityRegistry/CommunityRegistry.d.ts +8 -0
  60. package/dist/types/src/containers/CommunityRegistry/CommunityRegistry.d.ts.map +1 -0
  61. package/dist/types/src/containers/CommunityRegistry/index.d.ts +2 -0
  62. package/dist/types/src/containers/CommunityRegistry/index.d.ts.map +1 -0
  63. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts +4 -0
  64. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts.map +1 -0
  65. package/dist/types/src/containers/LoadPluginDialog/index.d.ts +2 -0
  66. package/dist/types/src/containers/LoadPluginDialog/index.d.ts.map +1 -0
  67. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts +7 -0
  68. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -0
  69. package/dist/types/src/containers/PluginArticle/index.d.ts +2 -0
  70. package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -0
  71. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts +14 -0
  72. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts.map +1 -0
  73. package/dist/types/src/containers/PluginRegistry/index.d.ts +2 -0
  74. package/dist/types/src/containers/PluginRegistry/index.d.ts.map +1 -0
  75. package/dist/types/src/containers/index.d.ts +7 -0
  76. package/dist/types/src/containers/index.d.ts.map +1 -0
  77. package/dist/types/src/hooks/index.d.ts +3 -0
  78. package/dist/types/src/hooks/index.d.ts.map +1 -0
  79. package/dist/types/src/hooks/use-auto-tags.d.ts +20 -0
  80. package/dist/types/src/hooks/use-auto-tags.d.ts.map +1 -0
  81. package/dist/types/src/hooks/use-community-plugins.d.ts +16 -0
  82. package/dist/types/src/hooks/use-community-plugins.d.ts.map +1 -0
  83. package/dist/types/src/index.d.ts +2 -1
  84. package/dist/types/src/index.d.ts.map +1 -1
  85. package/dist/types/src/meta.d.ts +7 -3
  86. package/dist/types/src/meta.d.ts.map +1 -1
  87. package/dist/types/src/operations/index.d.ts +3 -0
  88. package/dist/types/src/operations/index.d.ts.map +1 -0
  89. package/dist/types/src/operations/open-plugin-registry.d.ts +5 -0
  90. package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -0
  91. package/dist/types/src/storage.d.ts +18 -0
  92. package/dist/types/src/storage.d.ts.map +1 -0
  93. package/dist/types/src/translations.d.ts +22 -16
  94. package/dist/types/src/translations.d.ts.map +1 -1
  95. package/dist/types/src/types.d.ts +14 -1
  96. package/dist/types/src/types.d.ts.map +1 -1
  97. package/dist/types/tsconfig.tsbuildinfo +1 -1
  98. package/package.json +77 -37
  99. package/src/RegistryPlugin.node.ts +19 -0
  100. package/src/RegistryPlugin.test.ts +24 -0
  101. package/src/RegistryPlugin.tsx +18 -25
  102. package/src/capabilities/app-graph-builder.ts +173 -135
  103. package/src/capabilities/index.ts +9 -4
  104. package/src/capabilities/operation-handler.ts +16 -0
  105. package/src/capabilities/react-surface.tsx +108 -73
  106. package/src/capabilities/state.ts +38 -0
  107. package/src/cli/index.ts +5 -0
  108. package/src/commands/disable.ts +47 -0
  109. package/src/commands/enable.ts +44 -0
  110. package/src/commands/index.ts +14 -0
  111. package/src/commands/list.ts +41 -0
  112. package/src/commands/util.ts +24 -0
  113. package/src/components/PluginDetail/PluginDetail.stories.tsx +44 -0
  114. package/src/components/PluginDetail/PluginDetail.tsx +106 -0
  115. package/src/components/PluginDetail/index.ts +5 -0
  116. package/src/components/PluginList/PluginItem.tsx +187 -0
  117. package/src/components/PluginList/PluginList.stories.tsx +87 -0
  118. package/src/components/PluginList/PluginList.tsx +29 -0
  119. package/src/components/PluginList/index.ts +5 -0
  120. package/src/components/index.ts +0 -1
  121. package/src/containers/CommunityRegistry/CommunityRegistry.tsx +181 -0
  122. package/src/containers/CommunityRegistry/index.ts +5 -0
  123. package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +86 -0
  124. package/src/containers/LoadPluginDialog/index.ts +5 -0
  125. package/src/containers/PluginArticle/PluginArticle.tsx +73 -0
  126. package/src/containers/PluginArticle/index.ts +5 -0
  127. package/src/containers/PluginRegistry/PluginRegistry.tsx +98 -0
  128. package/src/containers/PluginRegistry/index.ts +5 -0
  129. package/src/containers/index.ts +11 -0
  130. package/src/hooks/index.ts +6 -0
  131. package/src/hooks/use-auto-tags.ts +52 -0
  132. package/src/hooks/use-community-plugins.ts +35 -0
  133. package/src/index.ts +5 -1
  134. package/src/meta.ts +19 -7
  135. package/src/operations/index.ts +7 -0
  136. package/src/operations/open-plugin-registry.ts +21 -0
  137. package/src/storage.ts +50 -0
  138. package/src/translations.ts +22 -15
  139. package/src/types.ts +30 -1
  140. package/dist/lib/browser/app-graph-builder-YN3N2KW4.mjs +0 -161
  141. package/dist/lib/browser/app-graph-builder-YN3N2KW4.mjs.map +0 -7
  142. package/dist/lib/browser/chunk-MWZPWWWF.mjs +0 -14
  143. package/dist/lib/browser/chunk-MWZPWWWF.mjs.map +0 -7
  144. package/dist/lib/browser/intent-resolver-RUD6WFGT.mjs +0 -23
  145. package/dist/lib/browser/intent-resolver-RUD6WFGT.mjs.map +0 -7
  146. package/dist/lib/browser/react-surface-3CDFJHV3.mjs +0 -335
  147. package/dist/lib/browser/react-surface-3CDFJHV3.mjs.map +0 -7
  148. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  149. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  150. package/dist/types/src/components/Icon.stories.d.ts +0 -14
  151. package/dist/types/src/components/Icon.stories.d.ts.map +0 -1
  152. package/dist/types/src/components/PluginDetail.d.ts +0 -9
  153. package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
  154. package/dist/types/src/components/PluginDetail.stories.d.ts +0 -33
  155. package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
  156. package/dist/types/src/components/PluginItem.d.ts +0 -13
  157. package/dist/types/src/components/PluginItem.d.ts.map +0 -1
  158. package/dist/types/src/components/PluginList.d.ts +0 -8
  159. package/dist/types/src/components/PluginList.d.ts.map +0 -1
  160. package/dist/types/src/components/PluginList.stories.d.ts +0 -37
  161. package/dist/types/src/components/PluginList.stories.d.ts.map +0 -1
  162. package/dist/types/src/components/RegistryContainer.d.ts +0 -7
  163. package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
  164. package/src/capabilities/intent-resolver.ts +0 -27
  165. package/src/components/Icon.stories.tsx +0 -110
  166. package/src/components/PluginDetail.stories.tsx +0 -45
  167. package/src/components/PluginDetail.tsx +0 -65
  168. package/src/components/PluginItem.tsx +0 -119
  169. package/src/components/PluginList.stories.tsx +0 -83
  170. package/src/components/PluginList.tsx +0 -26
  171. package/src/components/RegistryContainer.tsx +0 -84
@@ -2,84 +2,119 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { useCallback, useMemo } from 'react';
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { useMemo } from 'react';
6
7
 
7
- import { Capabilities, Plugin, contributes, createSurface, usePluginManager } from '@dxos/app-framework';
8
+ import { Capabilities, Capability, Plugin } from '@dxos/app-framework';
9
+ import { Surface, usePluginManager } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
8
11
 
9
- import { PluginDetail, RegistryContainer } from '../components';
10
- import { REGISTRY_KEY, meta } from '../meta';
12
+ import { CommunityRegistry, LOAD_PLUGIN_DIALOG, LoadPluginDialog, PluginArticle, PluginRegistry } from '#containers';
13
+ import { registryCategoryId } from '#meta';
11
14
 
12
- export default () =>
13
- contributes(Capabilities.ReactSurface, [
14
- createSurface({
15
- id: `${meta.id}/all`,
16
- role: 'article',
17
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+all`,
18
- component: () => {
19
- const manager = usePluginManager();
20
- const filtered = useMemo(() => manager.plugins.filter(({ meta }) => !manager.core.includes(meta.id)), []);
15
+ import { useAutoTags, useCommunityPlugins, useRemotePluginIds } from '../hooks';
21
16
 
22
- return <RegistryContainer id={`${REGISTRY_KEY}+all`} plugins={filtered} />;
23
- },
24
- }),
25
- createSurface({
26
- id: `${meta.id}/installed`,
27
- role: 'article',
28
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+installed`,
29
- component: () => {
30
- const manager = usePluginManager();
31
- const filtered = useMemo(
32
- () =>
33
- manager.plugins
34
- .filter(({ meta }) => !manager.core.includes(meta.id))
35
- .filter(({ meta }) => manager.enabled.includes(meta.id)),
36
- [],
37
- );
17
+ export default Capability.makeModule(() =>
18
+ Effect.succeed(
19
+ Capability.contributes(Capabilities.ReactSurface, [
20
+ Surface.create({
21
+ id: 'official',
22
+ filter: AppSurface.literal(AppSurface.Article, registryCategoryId('official')),
23
+ component: () => {
24
+ const manager = usePluginManager();
25
+ const remoteIds = useRemotePluginIds();
26
+ const { entries } = useCommunityPlugins();
27
+ const extraTagsById = useAutoTags(entries);
28
+ const filtered = useMemo(
29
+ () =>
30
+ manager
31
+ .getPlugins()
32
+ .filter(({ meta }) => !manager.getCore().includes(meta.id))
33
+ .filter(({ meta }) => !remoteIds.has(meta.id)),
34
+ [manager, remoteIds],
35
+ );
38
36
 
39
- return <RegistryContainer id={`${REGISTRY_KEY}+installed`} plugins={filtered} />;
40
- },
41
- }),
42
- createSurface({
43
- id: `${meta.id}/recommended`,
44
- role: 'article',
45
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+recommended`,
46
- component: () => {
47
- const manager = usePluginManager();
48
- const filtered = useMemo(
49
- () =>
50
- manager.plugins
51
- .filter(({ meta }) => !manager.core.includes(meta.id))
52
- .filter(({ meta }) => !meta.tags?.includes('labs')),
53
- [],
54
- );
37
+ return (
38
+ <PluginRegistry id={registryCategoryId('official')} plugins={filtered} extraTagsById={extraTagsById} />
39
+ );
40
+ },
41
+ }),
42
+ Surface.create({
43
+ id: 'installed',
44
+ filter: AppSurface.literal(AppSurface.Article, registryCategoryId('installed')),
45
+ component: () => {
46
+ const manager = usePluginManager();
47
+ const { entries } = useCommunityPlugins();
48
+ const extraTagsById = useAutoTags(entries);
49
+ const filtered = useMemo(
50
+ () =>
51
+ manager
52
+ .getPlugins()
53
+ .filter(({ meta }) => !manager.getCore().includes(meta.id))
54
+ .filter(({ meta }) => manager.getEnabled().includes(meta.id)),
55
+ [manager],
56
+ );
55
57
 
56
- return <RegistryContainer id={`${REGISTRY_KEY}+recommended`} plugins={filtered} />;
57
- },
58
- }),
59
- createSurface({
60
- id: `${meta.id}/labs`,
61
- role: 'article',
62
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+labs`,
63
- component: () => {
64
- const manager = usePluginManager();
65
- const filtered = useMemo(() => manager.plugins.filter(({ meta }) => meta.tags?.includes('labs')), []);
58
+ return (
59
+ <PluginRegistry id={registryCategoryId('installed')} plugins={filtered} extraTagsById={extraTagsById} />
60
+ );
61
+ },
62
+ }),
63
+ Surface.create({
64
+ id: 'recommended',
65
+ filter: AppSurface.literal(AppSurface.Article, registryCategoryId('recommended')),
66
+ component: () => {
67
+ const manager = usePluginManager();
68
+ const remoteIds = useRemotePluginIds();
69
+ const { entries } = useCommunityPlugins();
70
+ const extraTagsById = useAutoTags(entries);
71
+ const filtered = useMemo(
72
+ () =>
73
+ manager
74
+ .getPlugins()
75
+ .filter(({ meta }) => !manager.getCore().includes(meta.id))
76
+ .filter(({ meta }) => !remoteIds.has(meta.id))
77
+ .filter(({ meta }) => !meta.tags?.includes('labs')),
78
+ [manager, remoteIds],
79
+ );
66
80
 
67
- return <RegistryContainer id={`${REGISTRY_KEY}+labs`} plugins={filtered} />;
68
- },
69
- }),
70
- createSurface({
71
- id: `${meta.id}/plugin-details`,
72
- role: 'article',
73
- filter: (data): data is { subject: Plugin } => data.subject instanceof Plugin,
74
- component: ({ data: { subject } }) => {
75
- const manager = usePluginManager();
76
- const enabled = manager.enabled.includes(subject.meta.id);
77
- const handleEnable = useCallback(
78
- () => (enabled ? manager.disable(subject.meta.id) : manager.enable(subject.meta.id)),
79
- [manager, subject.meta.id, enabled],
80
- );
81
+ return (
82
+ <PluginRegistry id={registryCategoryId('recommended')} plugins={filtered} extraTagsById={extraTagsById} />
83
+ );
84
+ },
85
+ }),
86
+ Surface.create({
87
+ id: 'labs',
88
+ filter: AppSurface.literal(AppSurface.Article, registryCategoryId('labs')),
89
+ component: () => {
90
+ const manager = usePluginManager();
91
+ const { entries } = useCommunityPlugins();
92
+ const extraTagsById = useAutoTags(entries);
93
+ const filtered = useMemo(
94
+ () => manager.getPlugins().filter(({ meta }) => meta.tags?.includes('labs')),
95
+ [manager],
96
+ );
81
97
 
82
- return <PluginDetail plugin={subject} enabled={enabled} onEnable={handleEnable} />;
83
- },
84
- }),
85
- ]);
98
+ return <PluginRegistry id={registryCategoryId('labs')} plugins={filtered} extraTagsById={extraTagsById} />;
99
+ },
100
+ }),
101
+ Surface.create({
102
+ id: 'community',
103
+ filter: AppSurface.literal(AppSurface.Article, registryCategoryId('community')),
104
+ component: () => <CommunityRegistry id={registryCategoryId('community')} />,
105
+ }),
106
+ Surface.create({
107
+ id: 'plugin-details',
108
+ filter: AppSurface.subject(AppSurface.Article, Plugin.isPlugin),
109
+ component: ({ data: { subject } }) => {
110
+ return <PluginArticle subject={subject} />;
111
+ },
112
+ }),
113
+ Surface.create({
114
+ id: LOAD_PLUGIN_DIALOG,
115
+ filter: AppSurface.component(AppSurface.Dialog, LOAD_PLUGIN_DIALOG),
116
+ component: () => <LoadPluginDialog />,
117
+ }),
118
+ ]),
119
+ ),
120
+ );
@@ -0,0 +1,38 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { Atom } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { log } from '@dxos/log';
10
+ import { ClientCapabilities } from '@dxos/plugin-client/types';
11
+
12
+ import { RegistryCapabilities, type CommunityPluginsState } from '#types';
13
+
14
+ import { loadCommunityPlugins } from '../hooks';
15
+
16
+ export default Capability.makeModule(
17
+ Effect.fnUntraced(function* () {
18
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
19
+ const client = yield* Capability.get(ClientCapabilities.Client);
20
+
21
+ const communityPluginsAtom = Atom.make<CommunityPluginsState>({ entries: [], loading: true, error: null }).pipe(
22
+ Atom.keepAlive,
23
+ );
24
+
25
+ yield* loadCommunityPlugins(client.edge.http).pipe(
26
+ Effect.match({
27
+ onSuccess: (entries) => registry.set(communityPluginsAtom, { entries, loading: false, error: null }),
28
+ onFailure: (error) => {
29
+ log.catch(error);
30
+ registry.set(communityPluginsAtom, { entries: [], loading: false, error });
31
+ },
32
+ }),
33
+ Effect.forkDaemon,
34
+ );
35
+
36
+ return Capability.contributes(RegistryCapabilities.State, communityPluginsAtom);
37
+ }),
38
+ );
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from '../storage';
@@ -0,0 +1,47 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Args from '@effect/cli/Args';
6
+ import * as Command from '@effect/cli/Command';
7
+ import * as Console from 'effect/Console';
8
+ import * as Effect from 'effect/Effect';
9
+
10
+ import { Plugin } from '@dxos/app-framework';
11
+ import { CommandConfig } from '@dxos/cli-util';
12
+ import { invariant } from '@dxos/invariant';
13
+
14
+ import { saveEnabledPlugins } from '../storage';
15
+
16
+ export const handler = Effect.fn(function* ({ id }: { id: string }) {
17
+ const { json, profile } = yield* CommandConfig;
18
+ const manager = yield* Plugin.Service;
19
+
20
+ const plugins = manager.getPlugins();
21
+ const plugin = plugins.find((p: Plugin.Plugin) => p.meta.id === id);
22
+ invariant(plugin, `Plugin not found: ${id}`);
23
+
24
+ const core = manager.getCore();
25
+ invariant(!core.includes(id), `Cannot disable core plugin: ${id}`);
26
+
27
+ const disabled = yield* manager.disable(id);
28
+ invariant(disabled, `Failed to disable plugin: ${id}`);
29
+
30
+ // Save enabled plugins to storage
31
+ const enabledPlugins = manager.getEnabled();
32
+ yield* saveEnabledPlugins({ profile, enabled: [...enabledPlugins] });
33
+
34
+ if (json) {
35
+ yield* Console.log(JSON.stringify({ id, enabled: false }, null, 2));
36
+ } else {
37
+ yield* Console.log(`Plugin "${plugin.meta.name ?? id}" disabled.`);
38
+ }
39
+ });
40
+
41
+ export const disable = Command.make(
42
+ 'disable',
43
+ {
44
+ id: Args.text({ name: 'id' }).pipe(Args.withDescription('The ID of the plugin to disable.')),
45
+ },
46
+ handler,
47
+ ).pipe(Command.withDescription('Disable a plugin.'));
@@ -0,0 +1,44 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Args from '@effect/cli/Args';
6
+ import * as Command from '@effect/cli/Command';
7
+ import * as Console from 'effect/Console';
8
+ import * as Effect from 'effect/Effect';
9
+
10
+ import { Plugin } from '@dxos/app-framework';
11
+ import { CommandConfig } from '@dxos/cli-util';
12
+ import { invariant } from '@dxos/invariant';
13
+
14
+ import { saveEnabledPlugins } from '../storage';
15
+
16
+ export const handler = Effect.fn(function* ({ id }: { id: string }) {
17
+ const { json, profile } = yield* CommandConfig;
18
+ const manager = yield* Plugin.Service;
19
+
20
+ const plugins = manager.getPlugins();
21
+ const plugin = plugins.find((p: Plugin.Plugin) => p.meta.id === id);
22
+ invariant(plugin, `Plugin not found: ${id}`);
23
+
24
+ const enabled = yield* manager.enable(id);
25
+ invariant(enabled, `Failed to enable plugin: ${id}`);
26
+
27
+ // Save enabled plugins to storage
28
+ const enabledPlugins = manager.getEnabled();
29
+ yield* saveEnabledPlugins({ profile, enabled: [...enabledPlugins] });
30
+
31
+ if (json) {
32
+ yield* Console.log(JSON.stringify({ id, enabled: true }, null, 2));
33
+ } else {
34
+ yield* Console.log(`Plugin "${plugin.meta.name ?? id}" enabled.`);
35
+ }
36
+ });
37
+
38
+ export const enable = Command.make(
39
+ 'enable',
40
+ {
41
+ id: Args.text({ name: 'id' }).pipe(Args.withDescription('The ID of the plugin to enable.')),
42
+ },
43
+ handler,
44
+ ).pipe(Command.withDescription('Enable a plugin.'));
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Command from '@effect/cli/Command';
6
+
7
+ import { disable } from './disable';
8
+ import { enable } from './enable';
9
+ import { list } from './list';
10
+
11
+ export const plugin: Command.Command<any, any, any, any> = Command.make('plugin').pipe(
12
+ Command.withDescription('Manage plugins.'),
13
+ Command.withSubcommands([enable, disable, list]),
14
+ );
@@ -0,0 +1,41 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Command from '@effect/cli/Command';
6
+ import * as Console from 'effect/Console';
7
+ import * as Effect from 'effect/Effect';
8
+
9
+ import { Plugin } from '@dxos/app-framework';
10
+ import { CommandConfig, printList } from '@dxos/cli-util';
11
+
12
+ import { type FormattedPlugin, printPlugin } from './util';
13
+
14
+ export const handler = Effect.fn(function* () {
15
+ const { json } = yield* CommandConfig;
16
+ const manager = yield* Plugin.Service;
17
+
18
+ const plugins = manager.getPlugins();
19
+ const enabled = manager.getEnabled();
20
+ const core = manager.getCore();
21
+
22
+ const formattedPlugins: FormattedPlugin[] = plugins.map((plugin: Plugin.Plugin) => {
23
+ const isEnabled = enabled.includes(plugin.meta.id);
24
+ const isCore = core.includes(plugin.meta.id);
25
+ return {
26
+ id: plugin.meta.id,
27
+ name: plugin.meta.name ?? plugin.meta.id,
28
+ enabled: isEnabled,
29
+ core: isCore,
30
+ };
31
+ });
32
+
33
+ if (json) {
34
+ yield* Console.log(JSON.stringify(formattedPlugins, null, 2));
35
+ } else {
36
+ const formatted = formattedPlugins.map(printPlugin);
37
+ yield* Console.log(printList(formatted));
38
+ }
39
+ });
40
+
41
+ export const list = Command.make('list', {}, handler).pipe(Command.withDescription('List all available plugins.'));
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { FormBuilder } from '@dxos/cli-util';
6
+
7
+ export type FormattedPlugin = {
8
+ id: string;
9
+ name: string;
10
+ enabled: boolean;
11
+ core: boolean;
12
+ };
13
+
14
+ /**
15
+ * Pretty prints a plugin with ANSI colors.
16
+ */
17
+ export const printPlugin = (plugin: FormattedPlugin) => {
18
+ const status = plugin.core ? 'core' : plugin.enabled ? 'enabled' : 'disabled';
19
+ return FormBuilder.make({ title: plugin.name }).pipe(
20
+ FormBuilder.set('id', plugin.id),
21
+ FormBuilder.set('status', status),
22
+ FormBuilder.build,
23
+ );
24
+ };
@@ -0,0 +1,44 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+
7
+ import { Plugin } from '@dxos/app-framework';
8
+ import { random } from '@dxos/random';
9
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
+
11
+ import { translations } from '#translations';
12
+
13
+ import { PluginDetail } from './PluginDetail';
14
+
15
+ const meta = {
16
+ title: 'plugins/plugin-registry/components/PluginDetail',
17
+ component: PluginDetail,
18
+ decorators: [withTheme(), withLayout({ layout: 'column' })],
19
+ parameters: {
20
+ layout: 'fullscreen',
21
+ translations,
22
+ },
23
+ } satisfies Meta<typeof PluginDetail>;
24
+
25
+ export default meta;
26
+
27
+ type Story = StoryObj<typeof meta>;
28
+
29
+ export const Default: Story = {
30
+ args: {
31
+ plugin: Plugin.define({
32
+ id: 'example.com/plugin/test-plugin',
33
+ name: 'Test Plugin',
34
+ description: random.lorem.paragraphs(2),
35
+ icon: 'ph--bug--regular',
36
+ iconHue: 'sky',
37
+ homePage: 'https://example.com',
38
+ source: 'https://github.com/example/test-plugin',
39
+ screenshots: [
40
+ 'https://media.gcflearnfree.org/content/55e073de7dd48174331f51b3_01_17_2014/getting_started_interactive2.png',
41
+ ],
42
+ }).pipe(Plugin.make)(),
43
+ },
44
+ };
@@ -0,0 +1,106 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type Plugin } from '@dxos/app-framework';
8
+ import { Button, Icon, Input, Link, ScrollArea, useTranslation } from '@dxos/react-ui';
9
+ import { composable, composableProps, getStyles, mx } from '@dxos/ui-theme';
10
+
11
+ import { meta } from '#meta';
12
+
13
+ export type PluginDetailProps = {
14
+ plugin: Plugin.Plugin;
15
+ enabled?: boolean;
16
+ onEnabledChange?: (enabled: boolean) => void;
17
+ /**
18
+ * When provided, an Uninstall button is rendered. Leave undefined for core
19
+ * or non-removable plugins.
20
+ */
21
+ onUninstall?: () => void;
22
+ /**
23
+ * When provided, the plugin is not installed and an Install button is shown
24
+ * in place of the enable Switch.
25
+ */
26
+ onInstall?: () => void;
27
+ installing?: boolean;
28
+ };
29
+
30
+ export const PluginDetail = composable<HTMLDivElement, PluginDetailProps>(
31
+ ({ plugin, enabled, onEnabledChange, onUninstall, onInstall, installing, ...props }, forwardedRef) => {
32
+ const { t } = useTranslation(meta.id);
33
+ const {
34
+ id,
35
+ name,
36
+ description,
37
+ homePage,
38
+ source,
39
+ screenshots,
40
+ icon = 'ph--circle--regular',
41
+ iconHue = 'neutral',
42
+ } = plugin.meta;
43
+ const styles = getStyles(iconHue);
44
+
45
+ return (
46
+ <ScrollArea.Root {...composableProps(props)} orientation='vertical' ref={forwardedRef}>
47
+ <ScrollArea.Viewport>
48
+ <div role='none' className='dx-document grid grid-cols-[min-content_1fr] gap-4 p-4'>
49
+ <div role='none'>
50
+ <Icon classNames={mx('p-1 rounded-md', styles.fill, styles.surfaceText)} icon={icon} size={14} />
51
+ </div>
52
+ <div role='none' className='flex flex-col gap-6'>
53
+ <div role='none' className='grid grid-cols-[1fr_min-content] gap-x-3 w-full pt-1'>
54
+ <h2 className='text-xl'>{name}</h2>
55
+ {onInstall ? (
56
+ <Button density='fine' variant='primary' disabled={installing} onClick={onInstall}>
57
+ {installing ? t('installing.label') : t('install.label')}
58
+ </Button>
59
+ ) : (
60
+ <Input.Root>
61
+ <Input.Switch classNames='self-center' checked={enabled} onCheckedChange={onEnabledChange} />
62
+ </Input.Root>
63
+ )}
64
+ <p className='pt-0.5 text-sm text-description'>{id}</p>
65
+ </div>
66
+ <div role='none'>
67
+ <p className='text-description'>{description}</p>
68
+ </div>
69
+ {screenshots && screenshots.length > 0 && (
70
+ <div role='none' className='flex flex-col gap-2'>
71
+ <h2>Preview</h2>
72
+ <img src={screenshots[0]} alt={name} className='aspect-video object-fit' />
73
+ </div>
74
+ )}
75
+ <div role='none' className='flex flex-col gap-2'>
76
+ <h2>Resources</h2>
77
+ <div className='flex gap-2'>
78
+ {homePage && (
79
+ <Link href={homePage} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
80
+ {t('home-page.label')}
81
+ <Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mx-1' />
82
+ </Link>
83
+ )}
84
+
85
+ {source && (
86
+ <Link href={source} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
87
+ {t('source.label')}
88
+ <Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mx-1' />
89
+ </Link>
90
+ )}
91
+ </div>
92
+ </div>
93
+ {onUninstall && (
94
+ <div role='none'>
95
+ <Button onClick={onUninstall}>{t('uninstall.label')}</Button>
96
+ </div>
97
+ )}
98
+ </div>
99
+ </div>
100
+ </ScrollArea.Viewport>
101
+ </ScrollArea.Root>
102
+ );
103
+ },
104
+ );
105
+
106
+ PluginDetail.displayName = 'PluginDetail';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './PluginDetail';