@dxos/plugin-registry 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5

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 (166) hide show
  1. package/dist/lib/browser/cli/index.mjs +219 -0
  2. package/dist/lib/browser/cli/index.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +52 -52
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/node-esm/cli/index.mjs +221 -0
  7. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  8. package/dist/lib/node-esm/index.mjs +53 -52
  9. package/dist/lib/node-esm/index.mjs.map +4 -4
  10. package/dist/lib/node-esm/meta.json +1 -1
  11. package/dist/types/src/RegistryPlugin.d.ts +2 -1
  12. package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  14. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  15. package/dist/types/src/capabilities/index.d.ts +5 -3
  16. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  17. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  18. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  19. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  20. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  21. package/dist/types/src/cli/commands/disable.d.ts +11 -0
  22. package/dist/types/src/cli/commands/disable.d.ts.map +1 -0
  23. package/dist/types/src/cli/commands/enable.d.ts +11 -0
  24. package/dist/types/src/cli/commands/enable.d.ts.map +1 -0
  25. package/dist/types/src/cli/commands/index.d.ts +3 -0
  26. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  27. package/dist/types/src/cli/commands/list.d.ts +7 -0
  28. package/dist/types/src/cli/commands/list.d.ts.map +1 -0
  29. package/dist/types/src/cli/commands/util.d.ts +11 -0
  30. package/dist/types/src/cli/commands/util.d.ts.map +1 -0
  31. package/dist/types/src/cli/index.d.ts +3 -0
  32. package/dist/types/src/cli/index.d.ts.map +1 -0
  33. package/dist/types/src/cli/plugin.d.ts +3 -0
  34. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  35. package/dist/types/src/cli/storage.d.ts +18 -0
  36. package/dist/types/src/cli/storage.d.ts.map +1 -0
  37. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +11 -0
  38. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
  39. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +39 -0
  40. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts.map +1 -0
  41. package/dist/types/src/components/PluginDetail/index.d.ts +2 -0
  42. package/dist/types/src/components/PluginDetail/index.d.ts.map +1 -0
  43. package/dist/types/src/components/PluginList/PluginItem.d.ts +18 -0
  44. package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
  45. package/dist/types/src/components/PluginList/PluginList.d.ts +13 -0
  46. package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -0
  47. package/dist/types/src/components/PluginList/PluginList.stories.d.ts +38 -0
  48. package/dist/types/src/components/PluginList/PluginList.stories.d.ts.map +1 -0
  49. package/dist/types/src/components/PluginList/index.d.ts +2 -0
  50. package/dist/types/src/components/PluginList/index.d.ts.map +1 -0
  51. package/dist/types/src/components/index.d.ts +0 -1
  52. package/dist/types/src/components/index.d.ts.map +1 -1
  53. package/dist/types/src/containers/CommunityRegistry/CommunityRegistry.d.ts +8 -0
  54. package/dist/types/src/containers/CommunityRegistry/CommunityRegistry.d.ts.map +1 -0
  55. package/dist/types/src/containers/CommunityRegistry/index.d.ts +2 -0
  56. package/dist/types/src/containers/CommunityRegistry/index.d.ts.map +1 -0
  57. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts +4 -0
  58. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts.map +1 -0
  59. package/dist/types/src/containers/LoadPluginDialog/index.d.ts +2 -0
  60. package/dist/types/src/containers/LoadPluginDialog/index.d.ts.map +1 -0
  61. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts +7 -0
  62. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -0
  63. package/dist/types/src/containers/PluginArticle/index.d.ts +2 -0
  64. package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -0
  65. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts +14 -0
  66. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts.map +1 -0
  67. package/dist/types/src/containers/PluginRegistry/index.d.ts +2 -0
  68. package/dist/types/src/containers/PluginRegistry/index.d.ts.map +1 -0
  69. package/dist/types/src/containers/index.d.ts +7 -0
  70. package/dist/types/src/containers/index.d.ts.map +1 -0
  71. package/dist/types/src/hooks/index.d.ts +3 -0
  72. package/dist/types/src/hooks/index.d.ts.map +1 -0
  73. package/dist/types/src/hooks/use-auto-tags.d.ts +20 -0
  74. package/dist/types/src/hooks/use-auto-tags.d.ts.map +1 -0
  75. package/dist/types/src/hooks/use-community-plugins.d.ts +15 -0
  76. package/dist/types/src/hooks/use-community-plugins.d.ts.map +1 -0
  77. package/dist/types/src/meta.d.ts +7 -4
  78. package/dist/types/src/meta.d.ts.map +1 -1
  79. package/dist/types/src/operations/index.d.ts +3 -0
  80. package/dist/types/src/operations/index.d.ts.map +1 -0
  81. package/dist/types/src/operations/open-plugin-registry.d.ts +5 -0
  82. package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -0
  83. package/dist/types/src/translations.d.ts +19 -15
  84. package/dist/types/src/translations.d.ts.map +1 -1
  85. package/dist/types/src/types.d.ts +3 -1
  86. package/dist/types/src/types.d.ts.map +1 -1
  87. package/dist/types/tsconfig.tsbuildinfo +1 -1
  88. package/package.json +64 -35
  89. package/src/RegistryPlugin.tsx +12 -26
  90. package/src/capabilities/app-graph-builder.ts +138 -136
  91. package/src/capabilities/index.ts +8 -4
  92. package/src/capabilities/operation-handler.ts +16 -0
  93. package/src/capabilities/react-surface.tsx +108 -78
  94. package/src/cli/commands/disable.ts +47 -0
  95. package/src/cli/commands/enable.ts +44 -0
  96. package/src/cli/commands/index.ts +14 -0
  97. package/src/cli/commands/list.ts +41 -0
  98. package/src/cli/commands/util.ts +24 -0
  99. package/src/cli/index.ts +6 -0
  100. package/src/cli/plugin.ts +17 -0
  101. package/src/cli/storage.ts +50 -0
  102. package/src/components/PluginDetail/PluginDetail.stories.tsx +43 -0
  103. package/src/components/PluginDetail/PluginDetail.tsx +84 -0
  104. package/src/components/PluginDetail/index.ts +5 -0
  105. package/src/components/PluginList/PluginItem.tsx +152 -0
  106. package/src/components/PluginList/PluginList.stories.tsx +87 -0
  107. package/src/components/PluginList/PluginList.tsx +29 -0
  108. package/src/components/PluginList/index.ts +5 -0
  109. package/src/components/index.ts +0 -1
  110. package/src/containers/CommunityRegistry/CommunityRegistry.tsx +147 -0
  111. package/src/containers/CommunityRegistry/index.ts +5 -0
  112. package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +85 -0
  113. package/src/containers/LoadPluginDialog/index.ts +5 -0
  114. package/src/containers/PluginArticle/PluginArticle.tsx +28 -0
  115. package/src/containers/PluginArticle/index.ts +5 -0
  116. package/src/containers/PluginRegistry/PluginRegistry.tsx +98 -0
  117. package/src/containers/PluginRegistry/index.ts +5 -0
  118. package/src/containers/index.ts +11 -0
  119. package/src/hooks/index.ts +6 -0
  120. package/src/hooks/use-auto-tags.ts +52 -0
  121. package/src/hooks/use-community-plugins.ts +77 -0
  122. package/src/meta.ts +19 -9
  123. package/src/operations/index.ts +7 -0
  124. package/src/operations/open-plugin-registry.ts +21 -0
  125. package/src/translations.ts +19 -15
  126. package/src/types.ts +14 -1
  127. package/dist/lib/browser/app-graph-builder-LKQBQDUA.mjs +0 -161
  128. package/dist/lib/browser/app-graph-builder-LKQBQDUA.mjs.map +0 -7
  129. package/dist/lib/browser/chunk-AEBASNOI.mjs +0 -16
  130. package/dist/lib/browser/chunk-AEBASNOI.mjs.map +0 -7
  131. package/dist/lib/browser/intent-resolver-W67CIJI3.mjs +0 -23
  132. package/dist/lib/browser/intent-resolver-W67CIJI3.mjs.map +0 -7
  133. package/dist/lib/browser/react-surface-SRFVJQKE.mjs +0 -335
  134. package/dist/lib/browser/react-surface-SRFVJQKE.mjs.map +0 -7
  135. package/dist/lib/node-esm/app-graph-builder-N44OGVQA.mjs +0 -162
  136. package/dist/lib/node-esm/app-graph-builder-N44OGVQA.mjs.map +0 -7
  137. package/dist/lib/node-esm/chunk-R3GXMWPJ.mjs +0 -18
  138. package/dist/lib/node-esm/chunk-R3GXMWPJ.mjs.map +0 -7
  139. package/dist/lib/node-esm/intent-resolver-M2CBVUVQ.mjs +0 -24
  140. package/dist/lib/node-esm/intent-resolver-M2CBVUVQ.mjs.map +0 -7
  141. package/dist/lib/node-esm/react-surface-5XAG2EYX.mjs +0 -336
  142. package/dist/lib/node-esm/react-surface-5XAG2EYX.mjs.map +0 -7
  143. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  144. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  145. package/dist/types/src/components/Icon.stories.d.ts +0 -6
  146. package/dist/types/src/components/Icon.stories.d.ts.map +0 -1
  147. package/dist/types/src/components/PluginDetail.d.ts +0 -9
  148. package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
  149. package/dist/types/src/components/PluginDetail.stories.d.ts +0 -8
  150. package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
  151. package/dist/types/src/components/PluginItem.d.ts +0 -13
  152. package/dist/types/src/components/PluginItem.d.ts.map +0 -1
  153. package/dist/types/src/components/PluginList.d.ts +0 -8
  154. package/dist/types/src/components/PluginList.d.ts.map +0 -1
  155. package/dist/types/src/components/PluginList.stories.d.ts +0 -11
  156. package/dist/types/src/components/PluginList.stories.d.ts.map +0 -1
  157. package/dist/types/src/components/RegistryContainer.d.ts +0 -7
  158. package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
  159. package/src/capabilities/intent-resolver.ts +0 -27
  160. package/src/components/Icon.stories.tsx +0 -107
  161. package/src/components/PluginDetail.stories.tsx +0 -45
  162. package/src/components/PluginDetail.tsx +0 -63
  163. package/src/components/PluginItem.tsx +0 -119
  164. package/src/components/PluginList.stories.tsx +0 -82
  165. package/src/components/PluginList.tsx +0 -26
  166. package/src/components/RegistryContainer.tsx +0 -84
@@ -2,89 +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, contributes, createSurface, Plugin, usePluginManager } from '@dxos/app-framework';
8
- import { StackItem } from '@dxos/react-ui-stack';
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';
9
11
 
10
- import { PluginDetail, RegistryContainer } from '../components';
11
- import { REGISTRY_KEY, REGISTRY_PLUGIN } from '../meta';
12
+ import { CommunityRegistry, LOAD_PLUGIN_DIALOG, LoadPluginDialog, PluginArticle, PluginRegistry } from '#containers';
13
+ import { registryCategoryId } from '#meta';
12
14
 
13
- export default () =>
14
- contributes(Capabilities.ReactSurface, [
15
- createSurface({
16
- id: `${REGISTRY_PLUGIN}/all`,
17
- role: 'article',
18
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+all`,
19
- component: () => {
20
- const manager = usePluginManager();
21
- const filtered = useMemo(() => manager.plugins.filter(({ meta }) => !manager.core.includes(meta.id)), []);
15
+ import { useAutoTags, useCommunityPlugins, useRemotePluginIds } from '../hooks';
22
16
 
23
- return <RegistryContainer id={`${REGISTRY_KEY}+all`} plugins={filtered} />;
24
- },
25
- }),
26
- createSurface({
27
- id: `${REGISTRY_PLUGIN}/installed`,
28
- role: 'article',
29
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+installed`,
30
- component: () => {
31
- const manager = usePluginManager();
32
- const filtered = useMemo(
33
- () =>
34
- manager.plugins
35
- .filter(({ meta }) => !manager.core.includes(meta.id))
36
- .filter(({ meta }) => manager.enabled.includes(meta.id)),
37
- [],
38
- );
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
+ );
39
36
 
40
- return <RegistryContainer id={`${REGISTRY_KEY}+installed`} plugins={filtered} />;
41
- },
42
- }),
43
- createSurface({
44
- id: `${REGISTRY_PLUGIN}/recommended`,
45
- role: 'article',
46
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+recommended`,
47
- component: () => {
48
- const manager = usePluginManager();
49
- const filtered = useMemo(
50
- () =>
51
- manager.plugins
52
- .filter(({ meta }) => !manager.core.includes(meta.id))
53
- .filter(({ meta }) => !meta.tags?.includes('labs')),
54
- [],
55
- );
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
+ );
56
57
 
57
- return <RegistryContainer id={`${REGISTRY_KEY}+recommended`} plugins={filtered} />;
58
- },
59
- }),
60
- createSurface({
61
- id: `${REGISTRY_PLUGIN}/labs`,
62
- role: 'article',
63
- filter: (data): data is any => data.subject === `${REGISTRY_KEY}+labs`,
64
- component: () => {
65
- const manager = usePluginManager();
66
- 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
+ );
67
80
 
68
- return <RegistryContainer id={`${REGISTRY_KEY}+labs`} plugins={filtered} />;
69
- },
70
- }),
71
- createSurface({
72
- id: `${REGISTRY_PLUGIN}/plugin-details`,
73
- role: 'article',
74
- filter: (data): data is { subject: Plugin } => data.subject instanceof Plugin,
75
- component: ({ data: { subject } }) => {
76
- const manager = usePluginManager();
77
- const enabled = manager.enabled.includes(subject.meta.id);
78
- const handleEnable = useCallback(
79
- () => (enabled ? manager.disable(subject.meta.id) : manager.enable(subject.meta.id)),
80
- [manager, subject.meta.id, enabled],
81
- );
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
+ );
82
97
 
83
- return (
84
- <StackItem.Content role='article'>
85
- <PluginDetail plugin={subject} enabled={enabled} onEnable={handleEnable} />
86
- </StackItem.Content>
87
- );
88
- },
89
- }),
90
- ]);
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,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,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './plugin';
6
+ export * from './storage';
@@ -0,0 +1,17 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
7
+
8
+ import { meta } from '#meta';
9
+
10
+ import { plugin } from './commands';
11
+
12
+ export const RegistryPlugin = Plugin.define(meta).pipe(
13
+ AppPlugin.addCommandModule({
14
+ commands: [plugin],
15
+ }),
16
+ Plugin.make,
17
+ );
@@ -0,0 +1,50 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as FileSystem from '@effect/platform/FileSystem';
6
+ import * as Path from '@effect/platform/Path';
7
+ import * as Effect from 'effect/Effect';
8
+ import * as Schema from 'effect/Schema';
9
+ import * as Yaml from 'yaml';
10
+
11
+ import { DX_CONFIG } from '@dxos/client-protocol';
12
+
13
+ // TODO(wittjosiah): Factor out to app-framework?
14
+
15
+ const PluginsSchema = Schema.Array(Schema.String);
16
+
17
+ /** CLI-only: path to plugins/<profile>.yml (sibling to profile/). */
18
+ const getPluginsConfigPath = (profile: string) => `${DX_CONFIG}/plugins/${profile}.yml`;
19
+
20
+ /**
21
+ * Load enabled plugins from plugins/<profile>.yml (sibling to profile/).
22
+ * Returns the list of enabled plugin IDs, or an empty array if the file doesn't exist.
23
+ */
24
+ export const loadEnabledPlugins = Effect.fn(function* ({ profile }: { profile: string }) {
25
+ const fs = yield* FileSystem.FileSystem;
26
+ const pluginsPath = getPluginsConfigPath(profile);
27
+
28
+ const content = yield* fs
29
+ .readFileString(pluginsPath)
30
+ .pipe(Effect.catchTag('SystemError', () => Effect.succeed('[]')));
31
+
32
+ const raw = Yaml.parse(content);
33
+ const parsed = yield* Schema.decodeUnknown(PluginsSchema)(raw ?? []).pipe(
34
+ Effect.catchAll(() => Effect.succeed([] as string[])),
35
+ );
36
+
37
+ return parsed;
38
+ });
39
+
40
+ /**
41
+ * Save enabled plugins to plugins/<profile>.yml.
42
+ */
43
+ export const saveEnabledPlugins = Effect.fn(function* ({ profile, enabled }: { profile: string; enabled: string[] }) {
44
+ const fs = yield* FileSystem.FileSystem;
45
+ const path = yield* Path.Path;
46
+ const pluginsPath = getPluginsConfigPath(profile);
47
+ yield* fs.makeDirectory(path.dirname(pluginsPath), { recursive: true });
48
+ const encoded = Yaml.stringify(enabled);
49
+ yield* fs.writeFileString(pluginsPath, encoded);
50
+ });
@@ -0,0 +1,43 @@
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
+ import { PluginDetail } from './PluginDetail';
13
+
14
+ const meta = {
15
+ title: 'plugins/plugin-registry/components/PluginDetail',
16
+ component: PluginDetail,
17
+ decorators: [withTheme(), withLayout({ layout: 'column' })],
18
+ parameters: {
19
+ layout: 'fullscreen',
20
+ translations,
21
+ },
22
+ } satisfies Meta<typeof PluginDetail>;
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ export const Default: Story = {
29
+ args: {
30
+ plugin: Plugin.define({
31
+ id: 'example.com/plugin/test-plugin',
32
+ name: 'Test Plugin',
33
+ description: random.lorem.paragraphs(2),
34
+ icon: 'ph--bug--regular',
35
+ iconHue: 'sky',
36
+ homePage: 'https://example.com',
37
+ source: 'https://github.com/example/test-plugin',
38
+ screenshots: [
39
+ 'https://media.gcflearnfree.org/content/55e073de7dd48174331f51b3_01_17_2014/getting_started_interactive2.png',
40
+ ],
41
+ }).pipe(Plugin.make)(),
42
+ },
43
+ };
@@ -0,0 +1,84 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type Plugin } from '@dxos/app-framework';
8
+ import { 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
+
19
+ export const PluginDetail = composable<HTMLDivElement, PluginDetailProps>(
20
+ ({ plugin, enabled, onEnabledChange, ...props }, forwardedRef) => {
21
+ const { t } = useTranslation(meta.id);
22
+ const {
23
+ id,
24
+ name,
25
+ description,
26
+ homePage,
27
+ source,
28
+ screenshots,
29
+ icon = 'ph--circle--regular',
30
+ iconHue = 'neutral',
31
+ } = plugin.meta;
32
+ const styles = getStyles(iconHue);
33
+
34
+ return (
35
+ <ScrollArea.Root {...composableProps(props)} orientation='vertical' ref={forwardedRef}>
36
+ <ScrollArea.Viewport>
37
+ <div role='none' className='dx-document grid grid-cols-[min-content_1fr] gap-4 p-4'>
38
+ <div role='none'>
39
+ <Icon classNames={mx('p-1 rounded-md', styles.fill, styles.surfaceText)} icon={icon} size={14} />
40
+ </div>
41
+ <div role='none' className='flex flex-col gap-6'>
42
+ <div role='none' className='grid grid-cols-[1fr_min-content] gap-x-3 w-full pt-1'>
43
+ <h2 className='text-xl'>{name}</h2>
44
+ <Input.Root>
45
+ <Input.Switch classNames='self-center' checked={enabled} onCheckedChange={onEnabledChange} />
46
+ </Input.Root>
47
+ <p className='pt-0.5 text-sm text-description'>{id}</p>
48
+ </div>
49
+ <div role='none'>
50
+ <p className='text-description'>{description}</p>
51
+ </div>
52
+ {screenshots && screenshots.length > 0 && (
53
+ <div role='none' className='flex flex-col gap-2'>
54
+ <h2>Preview</h2>
55
+ <img src={screenshots[0]} alt={name} className='aspect-video object-fit' />
56
+ </div>
57
+ )}
58
+ <div role='none' className='flex flex-col gap-2'>
59
+ <h2>Resources</h2>
60
+ <div className='flex gap-2'>
61
+ {homePage && (
62
+ <Link href={homePage} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
63
+ {t('home-page.label')}
64
+ <Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mx-1' />
65
+ </Link>
66
+ )}
67
+
68
+ {source && (
69
+ <Link href={source} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
70
+ {t('source.label')}
71
+ <Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mx-1' />
72
+ </Link>
73
+ )}
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </ScrollArea.Viewport>
79
+ </ScrollArea.Root>
80
+ );
81
+ },
82
+ );
83
+
84
+ PluginDetail.displayName = 'PluginDetail';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './PluginDetail';