@dxos/plugin-registry 0.8.4-main.70d3990 → 0.8.4-main.74a063c4e0

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 (133) 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 -50
  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 +73 -0
  9. package/dist/lib/node-esm/index.mjs.map +7 -0
  10. package/dist/lib/node-esm/meta.json +1 -0
  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 +15 -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 +43 -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/{PluginItem.d.ts → PluginList/PluginItem.d.ts} +2 -2
  44. package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
  45. package/dist/types/src/components/{PluginList.d.ts → PluginList/PluginList.d.ts} +1 -1
  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/LoadPluginDialog/LoadPluginDialog.d.ts +4 -0
  54. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts.map +1 -0
  55. package/dist/types/src/containers/LoadPluginDialog/index.d.ts +2 -0
  56. package/dist/types/src/containers/LoadPluginDialog/index.d.ts.map +1 -0
  57. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts +7 -0
  58. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -0
  59. package/dist/types/src/containers/PluginArticle/index.d.ts +2 -0
  60. package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -0
  61. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts +14 -0
  62. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts.map +1 -0
  63. package/dist/types/src/containers/PluginRegistry/index.d.ts +2 -0
  64. package/dist/types/src/containers/PluginRegistry/index.d.ts.map +1 -0
  65. package/dist/types/src/containers/index.d.ts +6 -0
  66. package/dist/types/src/containers/index.d.ts.map +1 -0
  67. package/dist/types/src/meta.d.ts +7 -3
  68. package/dist/types/src/meta.d.ts.map +1 -1
  69. package/dist/types/src/operations/index.d.ts +3 -0
  70. package/dist/types/src/operations/index.d.ts.map +1 -0
  71. package/dist/types/src/operations/open-plugin-registry.d.ts +5 -0
  72. package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -0
  73. package/dist/types/src/translations.d.ts +19 -15
  74. package/dist/types/src/translations.d.ts.map +1 -1
  75. package/dist/types/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +58 -32
  77. package/src/RegistryPlugin.tsx +12 -25
  78. package/src/capabilities/app-graph-builder.ts +128 -135
  79. package/src/capabilities/index.ts +8 -4
  80. package/src/capabilities/operation-handler.ts +16 -0
  81. package/src/capabilities/react-surface.tsx +84 -75
  82. package/src/cli/commands/disable.ts +47 -0
  83. package/src/cli/commands/enable.ts +44 -0
  84. package/src/cli/commands/index.ts +14 -0
  85. package/src/cli/commands/list.ts +41 -0
  86. package/src/cli/commands/util.ts +24 -0
  87. package/src/cli/index.ts +6 -0
  88. package/src/cli/plugin.ts +17 -0
  89. package/src/cli/storage.ts +50 -0
  90. package/src/components/PluginDetail/PluginDetail.stories.tsx +43 -0
  91. package/src/components/PluginDetail/PluginDetail.tsx +84 -0
  92. package/src/components/PluginDetail/index.ts +5 -0
  93. package/src/components/{PluginItem.tsx → PluginList/PluginItem.tsx} +20 -16
  94. package/src/components/PluginList/PluginList.stories.tsx +87 -0
  95. package/src/components/{PluginList.tsx → PluginList/PluginList.tsx} +2 -2
  96. package/src/components/PluginList/index.ts +5 -0
  97. package/src/components/index.ts +0 -1
  98. package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +84 -0
  99. package/src/containers/LoadPluginDialog/index.ts +5 -0
  100. package/src/containers/PluginArticle/PluginArticle.tsx +28 -0
  101. package/src/containers/PluginArticle/index.ts +5 -0
  102. package/src/containers/PluginRegistry/PluginRegistry.tsx +94 -0
  103. package/src/containers/PluginRegistry/index.ts +5 -0
  104. package/src/containers/index.ts +10 -0
  105. package/src/meta.ts +14 -7
  106. package/src/operations/index.ts +7 -0
  107. package/src/operations/open-plugin-registry.ts +21 -0
  108. package/src/translations.ts +19 -15
  109. package/dist/lib/browser/app-graph-builder-6CNBP3A4.mjs +0 -162
  110. package/dist/lib/browser/app-graph-builder-6CNBP3A4.mjs.map +0 -7
  111. package/dist/lib/browser/chunk-XPEFEID2.mjs +0 -19
  112. package/dist/lib/browser/chunk-XPEFEID2.mjs.map +0 -7
  113. package/dist/lib/browser/intent-resolver-LKNUYBTN.mjs +0 -23
  114. package/dist/lib/browser/intent-resolver-LKNUYBTN.mjs.map +0 -7
  115. package/dist/lib/browser/react-surface-IGCXOVE2.mjs +0 -359
  116. package/dist/lib/browser/react-surface-IGCXOVE2.mjs.map +0 -7
  117. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  118. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  119. package/dist/types/src/components/PluginDetail.d.ts +0 -9
  120. package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
  121. package/dist/types/src/components/PluginDetail.stories.d.ts +0 -32
  122. package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
  123. package/dist/types/src/components/PluginItem.d.ts.map +0 -1
  124. package/dist/types/src/components/PluginList.d.ts.map +0 -1
  125. package/dist/types/src/components/PluginList.stories.d.ts +0 -34
  126. package/dist/types/src/components/PluginList.stories.d.ts.map +0 -1
  127. package/dist/types/src/components/RegistryContainer.d.ts +0 -7
  128. package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
  129. package/src/capabilities/intent-resolver.ts +0 -27
  130. package/src/components/PluginDetail.stories.tsx +0 -45
  131. package/src/components/PluginDetail.tsx +0 -82
  132. package/src/components/PluginList.stories.tsx +0 -80
  133. package/src/components/RegistryContainer.tsx +0 -76
@@ -0,0 +1,87 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React, { useState } from 'react';
7
+
8
+ import { type Plugin, Plugin as PluginNS } from '@dxos/app-framework';
9
+ import { random } from '@dxos/random';
10
+ import { ScrollArea } from '@dxos/react-ui';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
+ import { getHashHue } from '@dxos/ui-theme';
13
+
14
+ import { RegistryTagType } from '#types';
15
+
16
+ import { translations } from '../../translations';
17
+ import { PluginList } from './PluginList';
18
+
19
+ random.seed(1);
20
+
21
+ const icons = [
22
+ 'ph--bug--regular',
23
+ 'ph--compass--regular',
24
+ 'ph--kanban--regular',
25
+ 'ph--table--regular',
26
+ 'ph--gear--regular',
27
+ 'ph--github-logo--regular',
28
+ ];
29
+
30
+ const DefaultStory = () => {
31
+ const [plugins] = useState<Plugin.Plugin[]>(
32
+ random.helpers.multiple(
33
+ () =>
34
+ PluginNS.define({
35
+ id: `org.dxos.plugin.plugin-${random.string.uuid()}`,
36
+ name: `${random.commerce.productName()}`,
37
+ description: random.lorem.sentences(Math.ceil(Math.random() * 3)),
38
+ tags: random.helpers.uniqueArray(RegistryTagType.literals as any, Math.floor(Math.random() * 3)),
39
+ icon: random.helpers.arrayElement(icons),
40
+ iconHue: getHashHue(random.string.uuid()),
41
+ homePage: random.datatype.boolean({ probability: 0.5 }) ? random.internet.url() : undefined,
42
+ source: random.internet.url(),
43
+ }).pipe(PluginNS.make)(),
44
+ { count: 32 },
45
+ ),
46
+ );
47
+ const [enabled, setEnabled] = useState<string[]>([]);
48
+
49
+ const handleChange = (id: string, enabled: boolean) => {
50
+ setEnabled((plugins) => (enabled ? [...plugins, id] : plugins.filter((plugin) => plugin === id)));
51
+ };
52
+
53
+ return (
54
+ <ScrollArea.Root orientation='vertical'>
55
+ <ScrollArea.Viewport>
56
+ <PluginList plugins={plugins} enabled={enabled} onChange={handleChange} hasSettings={() => true} />
57
+ </ScrollArea.Viewport>
58
+ </ScrollArea.Root>
59
+ );
60
+ };
61
+
62
+ const meta = {
63
+ title: 'plugins/plugin-registry/components/PluginList',
64
+ component: PluginList,
65
+ render: DefaultStory,
66
+ parameters: {
67
+ translations,
68
+ },
69
+ } satisfies Meta<typeof PluginList>;
70
+
71
+ export default meta;
72
+
73
+ type Story = StoryObj<typeof meta>;
74
+
75
+ export const Default: Story = {
76
+ decorators: [withTheme(), withLayout({ layout: 'column', classNames: 'bg-deck-surface' })],
77
+ parameters: {
78
+ layout: 'fullscreen',
79
+ },
80
+ };
81
+
82
+ export const FullScreen: Story = {
83
+ decorators: [withTheme(), withLayout({ scroll: true })],
84
+ parameters: {
85
+ layout: 'fullscreen',
86
+ },
87
+ };
@@ -10,12 +10,12 @@ import { List } from '@dxos/react-ui';
10
10
  import { PluginItem, type PluginItemProps } from './PluginItem';
11
11
 
12
12
  export type PluginListProps = Omit<PluginItemProps, 'plugin'> & {
13
- plugins?: readonly Plugin[];
13
+ plugins?: readonly Plugin.Plugin[];
14
14
  };
15
15
 
16
16
  export const PluginList = ({ plugins = [], ...props }: PluginListProps) => {
17
17
  return (
18
- <List classNames='grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] gap-4 p-4'>
18
+ <List classNames='grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] auto-rows-[max-content] gap-4 p-4'>
19
19
  {plugins.map((plugin) => (
20
20
  <PluginItem key={plugin.meta.id} plugin={plugin} {...props} />
21
21
  ))}
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './PluginList';
@@ -4,4 +4,3 @@
4
4
 
5
5
  export * from './PluginDetail';
6
6
  export * from './PluginList';
7
- export * from './RegistryContainer';
@@ -0,0 +1,84 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { useCallback, useRef, useState } from 'react';
7
+
8
+ import { usePluginManager } from '@dxos/app-framework/ui';
9
+ import { runAndForwardErrors } from '@dxos/effect';
10
+ import { Button, Dialog, Input, useTranslation } from '@dxos/react-ui';
11
+
12
+ import { meta } from '../../meta';
13
+
14
+ export const LOAD_PLUGIN_DIALOG = `${meta.id}.LoadPluginDialog`;
15
+
16
+ export const LoadPluginDialog = () => {
17
+ const manager = usePluginManager();
18
+ const { t } = useTranslation(meta.id);
19
+ const [url, setUrl] = useState('');
20
+ const [loading, setLoading] = useState(false);
21
+ const [error, setError] = useState<string | null>(null);
22
+ const closeRef = useRef<HTMLButtonElement | null>(null);
23
+
24
+ const handleLoad = useCallback(() => {
25
+ if (!url.trim()) {
26
+ return;
27
+ }
28
+
29
+ setLoading(true);
30
+ setError(null);
31
+
32
+ void Effect.gen(function* () {
33
+ yield* manager.add(url.trim());
34
+ closeRef.current?.click();
35
+ }).pipe(
36
+ Effect.catchAll((err) =>
37
+ Effect.sync(() => {
38
+ setError(String(err));
39
+ }),
40
+ ),
41
+ Effect.tap(() => Effect.sync(() => setLoading(false))),
42
+ runAndForwardErrors,
43
+ );
44
+ }, [url, manager]);
45
+
46
+ return (
47
+ <Dialog.Content>
48
+ <Dialog.Header>
49
+ <Dialog.Title>{t('load-by-url-dialog.title')}</Dialog.Title>
50
+ <Dialog.Close asChild>
51
+ <Dialog.CloseIconButton ref={closeRef} />
52
+ </Dialog.Close>
53
+ </Dialog.Header>
54
+ <Dialog.Body>
55
+ <div className='flex flex-col gap-4'>
56
+ <Input.Root validationValence={error ? 'error' : undefined}>
57
+ <Input.Label>{t('plugin-url.label')}</Input.Label>
58
+ <Input.TextInput
59
+ placeholder='https://example.com/plugin.mjs'
60
+ value={url}
61
+ onChange={(event) => {
62
+ setUrl(event.target.value);
63
+ setError(null);
64
+ }}
65
+ onKeyDown={(event) => {
66
+ if (event.key === 'Enter') {
67
+ handleLoad();
68
+ }
69
+ }}
70
+ disabled={loading}
71
+ autoFocus
72
+ />
73
+ {error && <Input.DescriptionAndValidation>{error}</Input.DescriptionAndValidation>}
74
+ </Input.Root>
75
+ <div className='flex justify-end'>
76
+ <Button variant='primary' disabled={!url.trim() || loading} onClick={handleLoad}>
77
+ {loading ? t('loading.label') : t('load-plugin.label')}
78
+ </Button>
79
+ </div>
80
+ </div>
81
+ </Dialog.Body>
82
+ </Dialog.Content>
83
+ );
84
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { LoadPluginDialog as default } from './LoadPluginDialog';
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { useCallback } from 'react';
6
+
7
+ import { type Plugin } from '@dxos/app-framework';
8
+ import { usePluginManager } from '@dxos/app-framework/ui';
9
+ import { runAndForwardErrors } from '@dxos/effect';
10
+
11
+ import { PluginDetail } from '#components';
12
+
13
+ // TODO(burdon): Convert to ECHO type.
14
+ export type PluginArticleProps = { subject: Plugin.Plugin };
15
+
16
+ export const PluginArticle = ({ subject: plugin }: PluginArticleProps) => {
17
+ const manager = usePluginManager();
18
+ const enabled = manager.getEnabled().includes(plugin.meta.id);
19
+ const handleEnableChange = useCallback(
20
+ (enabled: boolean) =>
21
+ enabled
22
+ ? runAndForwardErrors(manager.enable(plugin.meta.id))
23
+ : runAndForwardErrors(manager.disable(plugin.meta.id)),
24
+ [manager, plugin.meta.id],
25
+ );
26
+
27
+ return <PluginDetail plugin={plugin} enabled={enabled} onEnabledChange={handleEnableChange} />;
28
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { PluginArticle as default } from './PluginArticle';
@@ -0,0 +1,94 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import React, { useCallback, useMemo } from 'react';
8
+
9
+ import { type Plugin } from '@dxos/app-framework';
10
+ import { useCapabilities, useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
11
+ import { AppCapabilities, LayoutOperation, SettingsOperation } from '@dxos/app-toolkit';
12
+ import { runAndForwardErrors } from '@dxos/effect';
13
+ import { ObservabilityOperation } from '@dxos/plugin-observability/operations';
14
+ import { ScrollArea } from '@dxos/react-ui';
15
+ import { composable, composableProps } from '@dxos/ui-theme';
16
+
17
+ import { PluginList } from '#components';
18
+ import { getPluginPath } from '#meta';
19
+
20
+ const sortByPluginMeta = ({ meta: { name: a = '' } }: Plugin.Plugin, { meta: { name: b = '' } }: Plugin.Plugin) =>
21
+ a.localeCompare(b);
22
+
23
+ export type PluginRegistryProps = {
24
+ id: string;
25
+ plugins: Plugin.Plugin[];
26
+ };
27
+
28
+ export const PluginRegistry = composable<HTMLDivElement, PluginRegistryProps>(
29
+ ({ id, plugins: pluginsProp, ...props }, forwardedRef) => {
30
+ const manager = usePluginManager();
31
+ const { invoke, invokePromise } = useOperationInvoker();
32
+ const plugins = useMemo(() => pluginsProp.sort(sortByPluginMeta), [pluginsProp]);
33
+ const enabled = useAtomValue(manager.enabled);
34
+ const allSettings = useCapabilities(AppCapabilities.Settings);
35
+
36
+ // TODO(wittjosiah): Factor out to an intent?
37
+ const handleChange = useCallback(
38
+ (id: string, enabled: boolean) =>
39
+ Effect.gen(function* () {
40
+ if (enabled) {
41
+ yield* manager.enable(id);
42
+ } else {
43
+ yield* manager.disable(id);
44
+ }
45
+
46
+ yield* invoke(ObservabilityOperation.SendEvent, {
47
+ name: 'plugins.toggle',
48
+ properties: {
49
+ plugin: id,
50
+ enabled,
51
+ },
52
+ });
53
+ }).pipe(runAndForwardErrors),
54
+ [invoke, manager],
55
+ );
56
+
57
+ const handleClick = useCallback(
58
+ (pluginId: string) =>
59
+ invokePromise(LayoutOperation.Open, {
60
+ subject: [getPluginPath(pluginId)],
61
+ pivotId: id,
62
+ positioning: 'end',
63
+ }),
64
+ [invokePromise, id],
65
+ );
66
+
67
+ const hasSettings = useCallback(
68
+ (pluginId: string) => allSettings.some((s) => s.prefix === pluginId),
69
+ [allSettings],
70
+ );
71
+
72
+ const handleSettings = useCallback(
73
+ (pluginId: string) => invokePromise(SettingsOperation.Open, { plugin: pluginId }),
74
+ [invokePromise],
75
+ );
76
+
77
+ return (
78
+ <ScrollArea.Root {...composableProps(props)} orientation='vertical' ref={forwardedRef}>
79
+ <ScrollArea.Viewport>
80
+ <PluginList
81
+ plugins={plugins}
82
+ enabled={enabled}
83
+ onClick={handleClick}
84
+ onChange={handleChange}
85
+ hasSettings={hasSettings}
86
+ onSettings={handleSettings}
87
+ />
88
+ </ScrollArea.Viewport>
89
+ </ScrollArea.Root>
90
+ );
91
+ },
92
+ );
93
+
94
+ PluginRegistry.displayName = 'PluginRegistry';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export { PluginRegistry as default } from './PluginRegistry';
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export { LOAD_PLUGIN_DIALOG } from './LoadPluginDialog/LoadPluginDialog';
8
+ export const LoadPluginDialog: ComponentType<any> = lazy(() => import('./LoadPluginDialog'));
9
+ export const PluginArticle: ComponentType<any> = lazy(() => import('./PluginArticle'));
10
+ export const PluginRegistry: ComponentType<any> = lazy(() => import('./PluginRegistry'));
package/src/meta.ts CHANGED
@@ -2,17 +2,24 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { pinnedWorkspaceId } from '@dxos/app-toolkit';
6
7
  import { trim } from '@dxos/util';
7
8
 
8
- // TODO(wittjosiah): Deck does not currently support `/` in ids.
9
- // TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
10
- // Ideally this should be worked into the data model in a generic way.
11
- export const REGISTRY_ID = '!dxos:plugin-registry';
9
+ export const REGISTRY_ID = pinnedWorkspaceId('dxos:plugin-registry');
12
10
  export const REGISTRY_KEY = 'plugin-registry';
13
11
 
14
- export const meta: PluginMeta = {
15
- id: 'dxos.org/plugin/registry',
12
+ // TODO(wittjosiah): Should this be a special separator or use the standard path separator?
13
+ const CATEGORY_SEPARATOR = '>';
14
+
15
+ /** Build a registry category node ID. */
16
+ export const registryCategoryId = (category: string): string => `${REGISTRY_KEY}${CATEGORY_SEPARATOR}${category}`;
17
+
18
+ /** Qualified graph path to a specific plugin node. */
19
+ export const getPluginPath = (pluginId: string): string => `root/${REGISTRY_ID}/${pluginId}`;
20
+
21
+ export const meta: Plugin.Meta = {
22
+ id: 'org.dxos.plugin.registry',
16
23
  name: 'Plugins',
17
24
  description: trim`
18
25
  Plugin management system for discovering, installing, and configuring workspace extensions.
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { OperationHandlerSet } from '@dxos/operation';
6
+
7
+ export const RegistryOperationHandlerSet = OperationHandlerSet.lazy(() => import('./open-plugin-registry'));
@@ -0,0 +1,21 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { LayoutOperation, SettingsOperation, getSpacePath } from '@dxos/app-toolkit';
8
+ import { Operation } from '@dxos/operation';
9
+
10
+ import { REGISTRY_ID } from '#meta';
11
+
12
+ const handler: Operation.WithHandler<typeof SettingsOperation.OpenPluginRegistry> =
13
+ SettingsOperation.OpenPluginRegistry.pipe(
14
+ Operation.withHandler(
15
+ Effect.fnUntraced(function* () {
16
+ yield* Operation.invoke(LayoutOperation.SwitchWorkspace, { subject: getSpacePath(REGISTRY_ID) });
17
+ }),
18
+ ),
19
+ );
20
+
21
+ export default handler;
@@ -4,26 +4,30 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { meta } from './meta';
7
+ import { meta } from '#meta';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [meta.id]: {
13
- 'plugin name': 'Registry',
14
- 'details label': 'Details',
15
- 'home page label': 'Website',
16
- 'source label': 'Source',
17
- 'plugin registry label': 'Plugin Registry',
18
- 'all plugins label': 'All',
19
- 'installed plugins label': 'Enabled',
20
- 'recommended plugins label': 'Recommended',
21
- 'labs plugins label': 'Labs',
22
- 'community plugins label': 'Community',
23
- 'load by url label': 'Load by URL (soon)',
24
- 'coming soon label': 'Coming soon!',
25
- 'open plugin registry label': 'Open plugin registry',
26
- 'settings label': 'Settings',
13
+ 'plugin.name': 'Registry',
14
+ 'details.label': 'Details',
15
+ 'home-page.label': 'Website',
16
+ 'source.label': 'Source',
17
+ 'plugin-registry.label': 'Plugin Registry',
18
+ 'all-plugins.label': 'All',
19
+ 'installed-plugins.label': 'Enabled',
20
+ 'recommended-plugins.label': 'Recommended',
21
+ 'labs-plugins.label': 'Labs',
22
+ 'community-plugins.label': 'Community',
23
+ 'load-by-url.label': 'Load from URL',
24
+ 'load-by-url-dialog.title': 'Load Plugin from URL',
25
+ 'plugin-url.label': 'Plugin URL',
26
+ 'load-plugin.label': 'Load Plugin',
27
+ 'loading.label': 'Loading...',
28
+ 'coming-soon.label': 'Coming soon!',
29
+ 'open-plugin-registry.label': 'Open plugin registry',
30
+ 'settings.label': 'Settings',
27
31
  },
28
32
  },
29
33
  },
@@ -1,162 +0,0 @@
1
- import {
2
- REGISTRY_ID,
3
- REGISTRY_KEY,
4
- meta
5
- } from "./chunk-XPEFEID2.mjs";
6
-
7
- // src/capabilities/app-graph-builder.ts
8
- import { Atom } from "@effect-atom/atom-react";
9
- import * as Function from "effect/Function";
10
- import * as Option from "effect/Option";
11
- import { Capabilities, SettingsAction, contributes, createIntent } from "@dxos/app-framework";
12
- import { createExtension } from "@dxos/plugin-graph";
13
- var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphBuilder, [
14
- createExtension({
15
- id: meta.id,
16
- actions: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === "root" ? Option.some(node2) : Option.none()), Option.map((node2) => [
17
- {
18
- id: meta.id,
19
- data: async () => {
20
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
21
- await dispatch(createIntent(SettingsAction.OpenPluginRegistry));
22
- },
23
- properties: {
24
- label: [
25
- "open plugin registry label",
26
- {
27
- ns: meta.id
28
- }
29
- ],
30
- icon: "ph--squares-four--regular",
31
- disposition: "menu"
32
- }
33
- }
34
- ]), Option.getOrElse(() => [])))
35
- }),
36
- createExtension({
37
- id: meta.id,
38
- connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === "root" ? Option.some(node2) : Option.none()), Option.map((node2) => [
39
- {
40
- id: REGISTRY_ID,
41
- type: meta.id,
42
- properties: {
43
- label: [
44
- "plugin registry label",
45
- {
46
- ns: meta.id
47
- }
48
- ],
49
- icon: "ph--squares-four--regular",
50
- disposition: "pin-end",
51
- testId: "treeView.pluginRegistry"
52
- },
53
- nodes: [
54
- {
55
- id: `${REGISTRY_KEY}+all`,
56
- type: "category",
57
- data: `${REGISTRY_KEY}+all`,
58
- properties: {
59
- label: [
60
- "all plugins label",
61
- {
62
- ns: meta.id
63
- }
64
- ],
65
- icon: "ph--squares-four--regular",
66
- key: REGISTRY_KEY,
67
- testId: "pluginRegistry.all"
68
- }
69
- },
70
- {
71
- id: `${REGISTRY_KEY}+installed`,
72
- type: "category",
73
- data: `${REGISTRY_KEY}+installed`,
74
- properties: {
75
- label: [
76
- "installed plugins label",
77
- {
78
- ns: meta.id
79
- }
80
- ],
81
- icon: "ph--check--regular",
82
- key: REGISTRY_KEY,
83
- testId: "pluginRegistry.installed"
84
- }
85
- },
86
- {
87
- id: `${REGISTRY_KEY}+recommended`,
88
- type: "category",
89
- data: `${REGISTRY_KEY}+recommended`,
90
- properties: {
91
- label: [
92
- "recommended plugins label",
93
- {
94
- ns: meta.id
95
- }
96
- ],
97
- icon: "ph--star--regular",
98
- key: REGISTRY_KEY,
99
- testId: "pluginRegistry.recommended"
100
- }
101
- },
102
- {
103
- id: `${REGISTRY_KEY}+labs`,
104
- type: "category",
105
- data: `${REGISTRY_KEY}+labs`,
106
- properties: {
107
- label: [
108
- "labs plugins label",
109
- {
110
- ns: meta.id
111
- }
112
- ],
113
- icon: "ph--flask--regular",
114
- key: REGISTRY_KEY,
115
- testId: "pluginRegistry.labs"
116
- }
117
- }
118
- ]
119
- }
120
- ]), Option.getOrElse(() => [])))
121
- }),
122
- createExtension({
123
- id: `${meta.id}/actions`,
124
- actions: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === REGISTRY_ID ? Option.some(node2) : Option.none()), Option.map(() => [
125
- {
126
- id: `${meta.id}/load-by-url`,
127
- data: async () => {
128
- },
129
- properties: {
130
- label: [
131
- "load by url label",
132
- {
133
- ns: meta.id
134
- }
135
- ],
136
- icon: "ph--cloud-arrow-down--regular",
137
- disabled: true
138
- }
139
- }
140
- ]), Option.getOrElse(() => [])))
141
- }),
142
- createExtension({
143
- id: `${meta.id}/plugins`,
144
- connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === REGISTRY_ID ? Option.some(node2) : Option.none()), Option.map(() => {
145
- const manager = context.getCapability(Capabilities.PluginManager);
146
- return manager.plugins.map((plugin) => ({
147
- id: plugin.meta.id.replaceAll("/", ":"),
148
- type: "dxos.org/plugin",
149
- data: plugin,
150
- properties: {
151
- label: plugin.meta.name ?? plugin.meta.id,
152
- icon: plugin.meta.icon ?? "ph--circle--regular",
153
- disposition: "hidden"
154
- }
155
- }));
156
- }), Option.getOrElse(() => [])))
157
- })
158
- ]));
159
- export {
160
- app_graph_builder_default as default
161
- };
162
- //# sourceMappingURL=app-graph-builder-6CNBP3A4.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/app-graph-builder.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, type PluginContext, SettingsAction, contributes, createIntent } from '@dxos/app-framework';\nimport { createExtension } from '@dxos/plugin-graph';\n\nimport { REGISTRY_ID, REGISTRY_KEY, meta } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: meta.id,\n actions: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === 'root' ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: meta.id,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(SettingsAction.OpenPluginRegistry));\n },\n properties: {\n label: ['open plugin registry label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n disposition: 'menu',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: meta.id,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === 'root' ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: REGISTRY_ID,\n type: meta.id,\n properties: {\n label: ['plugin registry label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n disposition: 'pin-end',\n testId: 'treeView.pluginRegistry',\n },\n nodes: [\n {\n id: `${REGISTRY_KEY}+all`,\n type: 'category',\n data: `${REGISTRY_KEY}+all`,\n properties: {\n label: ['all plugins label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.all',\n },\n },\n {\n id: `${REGISTRY_KEY}+installed`,\n type: 'category',\n data: `${REGISTRY_KEY}+installed`,\n properties: {\n label: ['installed plugins label', { ns: meta.id }],\n icon: 'ph--check--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.installed',\n },\n },\n {\n id: `${REGISTRY_KEY}+recommended`,\n type: 'category',\n data: `${REGISTRY_KEY}+recommended`,\n properties: {\n label: ['recommended plugins label', { ns: meta.id }],\n icon: 'ph--star--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.recommended',\n },\n },\n {\n id: `${REGISTRY_KEY}+labs`,\n type: 'category',\n data: `${REGISTRY_KEY}+labs`,\n properties: {\n label: ['labs plugins label', { ns: meta.id }],\n icon: 'ph--flask--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.labs',\n },\n },\n ],\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/actions`,\n actions: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === REGISTRY_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: `${meta.id}/load-by-url`,\n data: async () => {},\n properties: {\n label: ['load by url label', { ns: meta.id }],\n icon: 'ph--cloud-arrow-down--regular',\n disabled: true,\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/plugins`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === REGISTRY_ID ? Option.some(node) : Option.none())),\n Option.map(() => {\n const manager = context.getCapability(Capabilities.PluginManager);\n return manager.plugins.map((plugin) => ({\n id: plugin.meta.id.replaceAll('/', ':'),\n type: 'dxos.org/plugin',\n data: plugin,\n properties: {\n label: plugin.meta.name ?? plugin.meta.id,\n icon: plugin.meta.icon ?? 'ph--circle--regular',\n disposition: 'hidden',\n },\n }));\n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M,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;EACA1B,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACd0B,WAAW,CAACvB,SACVC,KAAKC,KAAK,CAACC,QACAC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUA,MAAKH,OAAO2B,cAAqBlB,YAAKN,KAAAA,IAAeO,YAAI,CAAA,GAC5EC,WAAI,MAAA;AACT,YAAMuB,UAAUvC,QAAQoB,cAAclB,aAAasC,aAAa;AAChE,aAAOD,QAAQE,QAAQzB,IAAI,CAAC0B,YAAY;QACtCrC,IAAIqC,OAAOpC,KAAKD,GAAGsC,WAAW,KAAK,GAAA;QACnCV,MAAM;QACNhB,MAAMyB;QACNjB,YAAY;UACVC,OAAOgB,OAAOpC,KAAKsC,QAAQF,OAAOpC,KAAKD;UACvCuB,MAAMc,OAAOpC,KAAKsB,QAAQ;UAC1BC,aAAa;QACf;MACF,EAAA;IACF,CAAA,GACOC,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;CACD;",
6
- "names": ["Atom", "Function", "Option", "Capabilities", "SettingsAction", "contributes", "createIntent", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "actions", "node", "Atom", "make", "get", "pipe", "flatMap", "some", "none", "map", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "createIntent", "SettingsAction", "OpenPluginRegistry", "properties", "label", "ns", "icon", "disposition", "getOrElse", "connector", "REGISTRY_ID", "type", "testId", "nodes", "REGISTRY_KEY", "key", "disabled", "manager", "PluginManager", "plugins", "plugin", "replaceAll", "name"]
7
- }