@dxos/app-framework 0.9.0 → 0.9.1-staging.ee54ba693a
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.
- package/dist/lib/browser/{capability-BOPAKKWG.mjs → capability-S44TE2H7.mjs} +9 -9
- package/dist/lib/browser/{chunk-66IXTIVK.mjs → chunk-3NQLTQCP.mjs} +6 -7
- package/dist/lib/browser/chunk-3NQLTQCP.mjs.map +7 -0
- package/dist/lib/browser/chunk-53HJHMS5.mjs +7 -0
- package/dist/lib/browser/chunk-53HJHMS5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-Y66ELD4U.mjs → chunk-KRJ4KK2W.mjs} +36 -7
- package/dist/lib/browser/chunk-KRJ4KK2W.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KZUDO43J.mjs → chunk-LUH4Y5F2.mjs} +31 -23
- package/dist/lib/browser/chunk-LUH4Y5F2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CO3XLNUX.mjs → chunk-NKVRSMFN.mjs} +18 -18
- package/dist/lib/browser/chunk-NKVRSMFN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DC3WRPBV.mjs → chunk-OO53M5UK.mjs} +45 -12
- package/dist/lib/browser/chunk-OO53M5UK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IW44C7UL.mjs → chunk-OPTS3ZSN.mjs} +1 -1
- package/dist/lib/browser/chunk-OPTS3ZSN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HFLKXMT7.mjs → chunk-U5MESPM5.mjs} +61 -45
- package/dist/lib/browser/chunk-U5MESPM5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XHS5KDNX.mjs → chunk-UGYCLOXE.mjs} +25 -25
- package/dist/lib/browser/chunk-UGYCLOXE.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5GY3YOEL.mjs → chunk-VF37YTXJ.mjs} +5 -5
- package/dist/lib/browser/chunk-VF37YTXJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FO3IYSLV.mjs → chunk-YUVQIOTB.mjs} +29 -37
- package/dist/lib/browser/chunk-YUVQIOTB.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +9 -9
- package/dist/lib/browser/cli/index.mjs.map +2 -2
- package/dist/lib/browser/common/activation-events.mjs +7 -7
- package/dist/lib/browser/common/capabilities.mjs +7 -7
- package/dist/lib/browser/config/index.mjs +8 -0
- package/dist/lib/browser/config/index.mjs.map +7 -0
- package/dist/lib/browser/core/activation-event.mjs +1 -1
- package/dist/lib/browser/core/capability.mjs +1 -1
- package/dist/lib/browser/core/plugin-manager.mjs +4 -4
- package/dist/lib/browser/core/plugin.mjs +12 -2
- package/dist/lib/browser/core/url-loader.mjs +3 -3
- package/dist/lib/browser/index.mjs +14 -10
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{process-manager-capability-GXNUO7AR.mjs → process-manager-capability-QK4BMKMN.mjs} +9 -9
- package/dist/lib/browser/testing/index.mjs +15 -15
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/testing/react.mjs +11 -11
- package/dist/lib/browser/testing/react.mjs.map +3 -3
- package/dist/lib/browser/ui/index.mjs +18 -10
- package/dist/lib/node-esm/{capability-KZWRTX7R.mjs → capability-3YRF77LV.mjs} +9 -9
- package/dist/lib/node-esm/chunk-2UPUZXGU.mjs +9 -0
- package/dist/lib/node-esm/chunk-2UPUZXGU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XIGPWXCQ.mjs → chunk-4SE7SX7N.mjs} +45 -12
- package/dist/lib/node-esm/chunk-4SE7SX7N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XOCUANHO.mjs → chunk-BMW6P6QA.mjs} +6 -7
- package/dist/lib/node-esm/chunk-BMW6P6QA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-A5CHGAZE.mjs → chunk-DRT75WGD.mjs} +61 -45
- package/dist/lib/node-esm/chunk-DRT75WGD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XGBUKRCK.mjs → chunk-FKMVORZN.mjs} +31 -23
- package/dist/lib/node-esm/chunk-FKMVORZN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CTKEZHKF.mjs → chunk-GLH4LGHZ.mjs} +1 -1
- package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SX5NVETP.mjs → chunk-IL7O7IRX.mjs} +25 -25
- package/dist/lib/node-esm/chunk-IL7O7IRX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FSVGKTF6.mjs → chunk-ND2HETHD.mjs} +36 -7
- package/dist/lib/node-esm/chunk-ND2HETHD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KFZEB6BV.mjs → chunk-TLKYZKPW.mjs} +5 -5
- package/dist/lib/node-esm/chunk-TLKYZKPW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WK7OIQKI.mjs → chunk-VCPGX7WN.mjs} +29 -37
- package/dist/lib/node-esm/chunk-VCPGX7WN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NULBHQYS.mjs → chunk-XSZMX53L.mjs} +18 -18
- package/dist/lib/node-esm/chunk-XSZMX53L.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +9 -9
- package/dist/lib/node-esm/cli/index.mjs.map +2 -2
- package/dist/lib/node-esm/common/activation-events.mjs +7 -7
- package/dist/lib/node-esm/common/capabilities.mjs +7 -7
- package/dist/lib/node-esm/config/index.mjs +9 -0
- package/dist/lib/node-esm/config/index.mjs.map +7 -0
- package/dist/lib/node-esm/core/activation-event.mjs +1 -1
- package/dist/lib/node-esm/core/capability.mjs +1 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
- package/dist/lib/node-esm/core/plugin.mjs +12 -2
- package/dist/lib/node-esm/core/url-loader.mjs +3 -3
- package/dist/lib/node-esm/index.mjs +14 -10
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{process-manager-capability-TX5TA6YN.mjs → process-manager-capability-5S7WZ2JR.mjs} +9 -9
- package/dist/lib/node-esm/testing/index.mjs +15 -15
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/testing/react.mjs +11 -11
- package/dist/lib/node-esm/testing/react.mjs.map +3 -3
- package/dist/lib/node-esm/ui/index.mjs +18 -10
- package/dist/plugin/node-esm/index.mjs +414 -81
- package/dist/plugin/node-esm/index.mjs.map +4 -4
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/types/src/cli/cli.d.ts +1 -1
- package/dist/types/src/common/activation-events.d.ts.map +1 -1
- package/dist/types/src/common/capabilities.d.ts +2 -2
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/config/index.d.ts +2 -0
- package/dist/types/src/config/index.d.ts.map +1 -0
- package/dist/types/src/core/activation-event.d.ts +9 -6
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +9 -3
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts +6 -11
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manifest.d.ts +25 -7
- package/dist/types/src/core/plugin-manifest.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +89 -91
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +17 -57
- package/dist/types/src/core/registry.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +2 -2
- package/dist/types/src/core/url-loader.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-process-manager/history/capability.d.ts +1 -3
- package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-process-manager/meta.d.ts +32 -2
- package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -1
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +1 -4
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -1
- package/dist/types/src/testing/harness.d.ts +1 -1
- package/dist/types/src/testing/harness.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +6 -5
- package/dist/types/src/testing/react.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts +6 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +6 -10
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/context.d.ts +6 -2
- package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts +11 -4
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts +52 -72
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +1 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts +17 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/composer/index.d.ts +11 -4
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/index.d.ts +1 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/load.d.ts +16 -0
- package/dist/types/src/vite-plugin/load.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.d.ts +16 -4
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/docs/registry-spec.md +331 -0
- package/moon.yml +1 -0
- package/package.json +50 -39
- package/src/cli/cli.ts +2 -2
- package/src/common/activation-events.ts +3 -3
- package/src/common/capabilities.ts +18 -18
- package/src/config/index.ts +5 -0
- package/src/core/activation-event.ts +15 -8
- package/src/core/capability.ts +18 -6
- package/src/core/edge-registry-plugin-provider.ts +41 -42
- package/src/core/plugin-manager.test.ts +133 -137
- package/src/core/plugin-manager.ts +25 -19
- package/src/core/plugin-manifest.test.ts +5 -5
- package/src/core/plugin-manifest.ts +13 -10
- package/src/core/plugin.ts +58 -114
- package/src/core/registry.ts +20 -60
- package/src/core/url-loader.test.ts +2 -2
- package/src/core/url-loader.ts +23 -19
- package/src/index.ts +1 -0
- package/src/testing/harness.ts +5 -3
- package/src/testing/react.test.tsx +4 -2
- package/src/testing/react.tsx +10 -9
- package/src/testing/service.ts +2 -2
- package/src/testing/withPluginManager.stories.tsx +4 -2
- package/src/testing/withPluginManager.tsx +3 -1
- package/src/ui/components/App/App.stories.tsx +2 -2
- package/src/ui/components/PluginManager/PluginManagerProvider.ts +7 -0
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +22 -22
- package/src/ui/components/Surface/SurfaceComponent.tsx +90 -79
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +1 -1
- package/src/ui/components/Surface/context.ts +6 -4
- package/src/ui/components/Surface/index.ts +14 -3
- package/src/ui/components/Surface/types.test.ts +43 -51
- package/src/ui/components/Surface/types.ts +99 -64
- package/src/ui/hooks/useApp.test.tsx +1 -1
- package/src/ui/hooks/useApp.tsx +2 -2
- package/src/ui/hooks/useCapabilities.ts +49 -2
- package/src/vite-plugin/boot-loader/BootLoader.solid-stories.tsx +11 -11
- package/src/vite-plugin/boot-loader/loader.ts +3 -3
- package/src/vite-plugin/composer/index.ts +134 -61
- package/src/vite-plugin/import-map/index.ts +23 -7
- package/src/vite-plugin/index.ts +1 -0
- package/src/vite-plugin/load.ts +57 -0
- package/src/vite-plugin/manifest.test.ts +3 -3
- package/src/vite-plugin/manifest.ts +21 -10
- package/src/vite-plugin/packages.ts +0 -2
- package/tsconfig.json +5 -2
- package/dist/lib/browser/chunk-5GY3YOEL.mjs.map +0 -7
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +0 -7
- package/dist/lib/browser/chunk-CO3XLNUX.mjs.map +0 -7
- package/dist/lib/browser/chunk-DC3WRPBV.mjs.map +0 -7
- package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +0 -7
- package/dist/lib/browser/chunk-HFLKXMT7.mjs.map +0 -7
- package/dist/lib/browser/chunk-IW44C7UL.mjs.map +0 -7
- package/dist/lib/browser/chunk-KZUDO43J.mjs.map +0 -7
- package/dist/lib/browser/chunk-XHS5KDNX.mjs.map +0 -7
- package/dist/lib/browser/chunk-Y66ELD4U.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-A5CHGAZE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FSVGKTF6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NULBHQYS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SX5NVETP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XGBUKRCK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XIGPWXCQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +0 -7
- /package/dist/lib/browser/{capability-BOPAKKWG.mjs.map → capability-S44TE2H7.mjs.map} +0 -0
- /package/dist/lib/browser/{process-manager-capability-GXNUO7AR.mjs.map → process-manager-capability-QK4BMKMN.mjs.map} +0 -0
- /package/dist/lib/node-esm/{capability-KZWRTX7R.mjs.map → capability-3YRF77LV.mjs.map} +0 -0
- /package/dist/lib/node-esm/{process-manager-capability-TX5TA6YN.mjs.map → process-manager-capability-5S7WZ2JR.mjs.map} +0 -0
|
@@ -13,9 +13,9 @@ import type * as Runtime$ from 'effect/Runtime';
|
|
|
13
13
|
import type { FC, PropsWithChildren } from 'react';
|
|
14
14
|
|
|
15
15
|
import type {
|
|
16
|
+
OperationHandlerSet,
|
|
16
17
|
LayerSpec as LayerSpec$,
|
|
17
18
|
Operation as Operation$,
|
|
18
|
-
OperationHandlerSet,
|
|
19
19
|
Process as Process$,
|
|
20
20
|
ServiceResolver as ServiceResolver$,
|
|
21
21
|
Trace as Trace$,
|
|
@@ -41,13 +41,13 @@ export const Null = Capability$.make<null>('org.dxos.app-framework.capability.nu
|
|
|
41
41
|
* @category Capability
|
|
42
42
|
*/
|
|
43
43
|
export const PluginManager = Capability$.make<PluginManager$.PluginManager>(
|
|
44
|
-
'org.dxos.app-framework.capability.
|
|
44
|
+
'org.dxos.app-framework.capability.pluginManager',
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* @category Capability
|
|
49
49
|
*/
|
|
50
|
-
export const AtomRegistry = Capability$.make<Registry.Registry>('org.dxos.app-framework.capability.
|
|
50
|
+
export const AtomRegistry = Capability$.make<Registry.Registry>('org.dxos.app-framework.capability.atomRegistry');
|
|
51
51
|
|
|
52
52
|
export type ReactContext = Readonly<{
|
|
53
53
|
id: string;
|
|
@@ -58,14 +58,14 @@ export type ReactContext = Readonly<{
|
|
|
58
58
|
/**
|
|
59
59
|
* @category Capability
|
|
60
60
|
*/
|
|
61
|
-
export const ReactContext = Capability$.make<ReactContext>('org.dxos.app-framework.capability.
|
|
61
|
+
export const ReactContext = Capability$.make<ReactContext>('org.dxos.app-framework.capability.reactContext');
|
|
62
62
|
|
|
63
63
|
export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* @category Capability
|
|
67
67
|
*/
|
|
68
|
-
export const ReactRoot = Capability$.make<ReactRoot>('org.dxos.app-framework.capability.
|
|
68
|
+
export const ReactRoot = Capability$.make<ReactRoot>('org.dxos.app-framework.capability.reactRoot');
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Surface definitions that can be either React components or Web Components.
|
|
@@ -75,7 +75,7 @@ export type ReactSurface = Surface.Definition | readonly Surface.Definition[];
|
|
|
75
75
|
/**
|
|
76
76
|
* @category Capability
|
|
77
77
|
*/
|
|
78
|
-
export const ReactSurface = Capability$.make<ReactSurface>('org.dxos.app-framework.
|
|
78
|
+
export const ReactSurface = Capability$.make<ReactSurface>('org.dxos.app-framework.capability.reactSurface');
|
|
79
79
|
|
|
80
80
|
export type AnyCommand = Command$.Command<any, any, any, any>;
|
|
81
81
|
|
|
@@ -98,7 +98,7 @@ export const Layer = Capability$.make<Layer$.Layer<any, any, any>>('org.dxos.app
|
|
|
98
98
|
*
|
|
99
99
|
* @category Capability
|
|
100
100
|
*/
|
|
101
|
-
export const LayerSpec = Capability$.make<LayerSpec$.LayerSpec>('org.dxos.app-framework.capability.
|
|
101
|
+
export const LayerSpec = Capability$.make<LayerSpec$.LayerSpec>('org.dxos.app-framework.capability.layerSpec');
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Context passed to {@link TraceSinkFactory} implementations when the
|
|
@@ -133,7 +133,7 @@ export type TraceSinkFactory = (ctx: TraceSinkFactoryContext) => Trace$.Sink;
|
|
|
133
133
|
*
|
|
134
134
|
* @category Capability
|
|
135
135
|
*/
|
|
136
|
-
export const TraceSink = Capability$.make<TraceSinkFactory>('org.dxos.app-framework.capability.
|
|
136
|
+
export const TraceSink = Capability$.make<TraceSinkFactory>('org.dxos.app-framework.capability.traceSink');
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Service resolver backing the shared {@link ProcessManagerRuntime}.
|
|
@@ -147,7 +147,7 @@ export const TraceSink = Capability$.make<TraceSinkFactory>('org.dxos.app-framew
|
|
|
147
147
|
* const resolver = yield* Capability.get(Capabilities.ServiceResolver);
|
|
148
148
|
* yield* effect.pipe(
|
|
149
149
|
* Effect.provide(
|
|
150
|
-
* ServiceResolver.provide({ space }, Database.Service
|
|
150
|
+
* ServiceResolver.provide({ space }, Database.Service).pipe(
|
|
151
151
|
* Layer.provide(Layer.succeed(ServiceResolver.ServiceResolver, resolver)),
|
|
152
152
|
* ),
|
|
153
153
|
* ),
|
|
@@ -157,7 +157,7 @@ export const TraceSink = Capability$.make<TraceSinkFactory>('org.dxos.app-framew
|
|
|
157
157
|
* @category Capability
|
|
158
158
|
*/
|
|
159
159
|
export const ServiceResolver = Capability$.make<ServiceResolver$.ServiceResolver>(
|
|
160
|
-
'org.dxos.app-framework.capability.
|
|
160
|
+
'org.dxos.app-framework.capability.serviceResolver',
|
|
161
161
|
);
|
|
162
162
|
|
|
163
163
|
/**
|
|
@@ -167,7 +167,7 @@ export const ServiceResolver = Capability$.make<ServiceResolver$.ServiceResolver
|
|
|
167
167
|
*
|
|
168
168
|
* @category Capability
|
|
169
169
|
*/
|
|
170
|
-
export const ProcessMonitor = Capability$.make<Process$.Monitor>('org.dxos.app-framework.capability.
|
|
170
|
+
export const ProcessMonitor = Capability$.make<Process$.Monitor>('org.dxos.app-framework.capability.processMonitor');
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
* Services that are always available when running effects through a {@link ProcessManagerRuntime}.
|
|
@@ -207,7 +207,7 @@ export interface ProcessManagerRuntime {
|
|
|
207
207
|
* @category Capability
|
|
208
208
|
*/
|
|
209
209
|
export const ProcessManagerRuntime = Capability$.make<ProcessManagerRuntime>(
|
|
210
|
-
'org.dxos.app-framework.capability.
|
|
210
|
+
'org.dxos.app-framework.capability.processManagerRuntime',
|
|
211
211
|
);
|
|
212
212
|
|
|
213
213
|
export type ManagedRuntime = ManagedRuntime$.ManagedRuntime<any, any>;
|
|
@@ -215,14 +215,14 @@ export type ManagedRuntime = ManagedRuntime$.ManagedRuntime<any, any>;
|
|
|
215
215
|
/**
|
|
216
216
|
* @category Capability
|
|
217
217
|
*/
|
|
218
|
-
export const ManagedRuntime = Capability$.make<ManagedRuntime>('org.dxos.app-framework.capability.
|
|
218
|
+
export const ManagedRuntime = Capability$.make<ManagedRuntime>('org.dxos.app-framework.capability.managedRuntime');
|
|
219
219
|
|
|
220
220
|
//
|
|
221
221
|
// Operation System Capabilities
|
|
222
222
|
//
|
|
223
223
|
|
|
224
224
|
export const OperationHandler = Capability$.make<OperationHandlerSet.OperationHandlerSet>(
|
|
225
|
-
'org.dxos.app-framework.capability.
|
|
225
|
+
'org.dxos.app-framework.capability.operationHandler',
|
|
226
226
|
);
|
|
227
227
|
|
|
228
228
|
export type UndoMapping = UndoMapping$.UndoMapping;
|
|
@@ -231,7 +231,7 @@ export type UndoMapping = UndoMapping$.UndoMapping;
|
|
|
231
231
|
* Undo mapping registration - contributed by plugins.
|
|
232
232
|
* @category Capability
|
|
233
233
|
*/
|
|
234
|
-
export const UndoMapping = Capability$.make<UndoMapping[]>('org.dxos.app-framework.capability.
|
|
234
|
+
export const UndoMapping = Capability$.make<UndoMapping[]>('org.dxos.app-framework.capability.undoMapping');
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
237
|
* Operation invoker backed by the process manager. Spawns a process per
|
|
@@ -244,7 +244,7 @@ export type OperationInvoker = OperationInvoker$.OperationInvoker;
|
|
|
244
244
|
* @category Capability
|
|
245
245
|
*/
|
|
246
246
|
export const OperationInvoker = Capability$.make<OperationInvoker>(
|
|
247
|
-
'org.dxos.app-framework.capability.
|
|
247
|
+
'org.dxos.app-framework.capability.operationInvoker',
|
|
248
248
|
);
|
|
249
249
|
|
|
250
250
|
export type UndoRegistry = UndoRegistry$.UndoRegistry;
|
|
@@ -253,7 +253,7 @@ export type UndoRegistry = UndoRegistry$.UndoRegistry;
|
|
|
253
253
|
* Undo registry - provided by ProcessManagerPlugin.
|
|
254
254
|
* @category Capability
|
|
255
255
|
*/
|
|
256
|
-
export const UndoRegistry = Capability$.make<UndoRegistry>('org.dxos.app-framework.capability.
|
|
256
|
+
export const UndoRegistry = Capability$.make<UndoRegistry>('org.dxos.app-framework.capability.undoRegistry');
|
|
257
257
|
|
|
258
258
|
export type HistoryTracker = HistoryTracker$.HistoryTracker;
|
|
259
259
|
|
|
@@ -261,7 +261,7 @@ export type HistoryTracker = HistoryTracker$.HistoryTracker;
|
|
|
261
261
|
* History tracker - provided by ProcessManagerPlugin.
|
|
262
262
|
* @category Capability
|
|
263
263
|
*/
|
|
264
|
-
export const HistoryTracker = Capability$.make<HistoryTracker>('org.dxos.app-framework.capability.
|
|
264
|
+
export const HistoryTracker = Capability$.make<HistoryTracker>('org.dxos.app-framework.capability.historyTracker');
|
|
265
265
|
|
|
266
266
|
//
|
|
267
267
|
// Atom Capability Helpers
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { DXN } from '@dxos/keys';
|
|
5
6
|
import { compositeKey } from '@dxos/util';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* A unique
|
|
9
|
-
* This is expected to be a URI, where initial parts are often the id of the plugin whose package defines the event.
|
|
9
|
+
* A unique DXN identifier representing an event.
|
|
10
10
|
*
|
|
11
|
-
* @example org.dxos.plugin.example.event.ready
|
|
11
|
+
* @example dxn:org.dxos.plugin.example.event.ready
|
|
12
12
|
*/
|
|
13
13
|
export type ActivationEvent = {
|
|
14
|
-
id:
|
|
14
|
+
id: DXN.DXN;
|
|
15
15
|
specifier?: string;
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -24,11 +24,18 @@ export type Events =
|
|
|
24
24
|
| { type: 'all-of'; events: ActivationEvent[] };
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Helper to define an activation event.
|
|
27
|
+
* Helper to define an activation event from an NSID.
|
|
28
|
+
* Static NSID strings are validated at compile time via {@link DXN.Name}.
|
|
28
29
|
*/
|
|
29
|
-
export const make
|
|
30
|
-
|
|
31
|
-
}
|
|
30
|
+
export const make: {
|
|
31
|
+
<T extends string>(
|
|
32
|
+
nsid: [DXN.Name<T>] extends [never] ? `Invalid NSID "${T}": final segment must be camelCase (no hyphens)` : T,
|
|
33
|
+
specifier?: string,
|
|
34
|
+
): ActivationEvent;
|
|
35
|
+
} = (nsid: string, specifier?: string): ActivationEvent => ({
|
|
36
|
+
id: DXN.make(nsid),
|
|
37
|
+
specifier,
|
|
38
|
+
});
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* Helper to create an activation event key.
|
package/src/core/capability.ts
CHANGED
|
@@ -7,6 +7,8 @@ import * as Context from 'effect/Context';
|
|
|
7
7
|
import * as Effect from 'effect/Effect';
|
|
8
8
|
import * as Layer from 'effect/Layer';
|
|
9
9
|
|
|
10
|
+
import type { DXN } from '@dxos/keys';
|
|
11
|
+
|
|
10
12
|
import type * as CapabilityManager from './capability-manager';
|
|
11
13
|
import type * as Plugin from './plugin';
|
|
12
14
|
|
|
@@ -100,8 +102,13 @@ export namespace InterfaceDef {
|
|
|
100
102
|
|
|
101
103
|
/**
|
|
102
104
|
* Helper to define the interface of a capability.
|
|
105
|
+
* Static NSID strings are validated at compile time via {@link DXN.Name}.
|
|
103
106
|
*/
|
|
104
|
-
export const make
|
|
107
|
+
export const make: {
|
|
108
|
+
<T, S extends string = string>(
|
|
109
|
+
identifier: [DXN.Name<S>] extends [never] ? `Invalid NSID "${S}": final segment must be camelCase (no hyphens)` : S,
|
|
110
|
+
): InterfaceDef<T>;
|
|
111
|
+
} = <T>(identifier: string): InterfaceDef<T> => {
|
|
105
112
|
return { identifier } as InterfaceDef<T>;
|
|
106
113
|
};
|
|
107
114
|
|
|
@@ -136,13 +143,14 @@ export type ModuleReturn = void | Any | Any[] | readonly Any[] | [Any, ...Any[]]
|
|
|
136
143
|
|
|
137
144
|
/**
|
|
138
145
|
* Helper to define the implementation of a capability.
|
|
146
|
+
* Returns the opaque base type so callers cannot discriminate on capability kind,
|
|
147
|
+
* keeping d.ts emit portable across packages.
|
|
139
148
|
*/
|
|
140
|
-
// TODO(dmaretskyi): Make the return type non-generic so capabilities are non-discernable.
|
|
141
149
|
export const contributes = <I extends InterfaceDef<any>>(
|
|
142
150
|
interfaceDef: I,
|
|
143
151
|
implementation: Capability<InterfaceDef.Implementation<I>>['implementation'],
|
|
144
152
|
deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],
|
|
145
|
-
):
|
|
153
|
+
): Any => {
|
|
146
154
|
return {
|
|
147
155
|
interface: interfaceDef,
|
|
148
156
|
implementation,
|
|
@@ -179,8 +187,8 @@ export type LazyCapability<Props = void, Capabilities extends ModuleReturn = Mod
|
|
|
179
187
|
export const lazy = <T = void, R extends ModuleReturn = ModuleReturn>(
|
|
180
188
|
name: string,
|
|
181
189
|
c: LoadCapability<T, R> | LoadCapabilities<T, R>,
|
|
182
|
-
): LazyCapability<T
|
|
183
|
-
const lazyFn
|
|
190
|
+
): LazyCapability<T> => {
|
|
191
|
+
const lazyFn = (props: T) =>
|
|
184
192
|
Effect.gen(function* () {
|
|
185
193
|
const { default: getCapability } = yield* Effect.promise(() => c());
|
|
186
194
|
const result = yield* getCapability(props);
|
|
@@ -188,7 +196,11 @@ export const lazy = <T = void, R extends ModuleReturn = ModuleReturn>(
|
|
|
188
196
|
return normalized as NormalizeReturn<R>;
|
|
189
197
|
});
|
|
190
198
|
|
|
191
|
-
|
|
199
|
+
// Props (T) are preserved so callers pass correctly-typed options, but the contributed
|
|
200
|
+
// Capabilities type is widened to the opaque base. The concrete capability type often traces to a
|
|
201
|
+
// module-internal source path that TypeScript cannot name in declaration files (TS2883); the base
|
|
202
|
+
// type is portable. The contributed type is checked at Capability.contributes regardless.
|
|
203
|
+
return Object.assign(lazyFn, { [ModuleTag]: name }) as LazyCapability<T>;
|
|
192
204
|
};
|
|
193
205
|
|
|
194
206
|
/**
|
|
@@ -6,31 +6,33 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Context } from '@dxos/context';
|
|
8
8
|
import { type EdgeHttpClient } from '@dxos/edge-client';
|
|
9
|
-
import { type
|
|
9
|
+
import { type PluginView } from '@dxos/protocols';
|
|
10
10
|
|
|
11
|
+
import type * as Plugin from './plugin';
|
|
11
12
|
import * as Registry from './registry';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* Maps a wire-format `
|
|
15
|
-
* `
|
|
15
|
+
* Maps a wire-format `PluginView` (from `@dxos/protocols`) to a runtime `Plugin.Meta`: the nested
|
|
16
|
+
* `profile` (the view's profile plus the resolved provenance `author`) and the latest `release`.
|
|
16
17
|
*
|
|
17
|
-
* This is the
|
|
18
|
-
*
|
|
18
|
+
* This is the one translation seam between the nested wire view and the resolved runtime manifest.
|
|
19
|
+
* `profile.key` is the composer plugin id — a valid NSID — so `DXN.make(profile.key, release.version)`
|
|
20
|
+
* reconstructs the canonical plugin DXN.
|
|
19
21
|
*/
|
|
20
|
-
const toRegistryPlugin = (entry:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
22
|
+
const toRegistryPlugin = (entry: PluginView): Plugin.Meta | null => {
|
|
23
|
+
if (!entry.releases?.length) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const latestRelease = entry.releases.find((release) => release.version === entry.latestVersion) ?? entry.releases[0];
|
|
27
|
+
return {
|
|
28
|
+
profile: {
|
|
29
|
+
...entry.profile,
|
|
30
|
+
// Provenance: the verified publisher is the author (handle preferred, DID fallback).
|
|
31
|
+
author: entry.handle ?? entry.did,
|
|
32
|
+
},
|
|
33
|
+
release: latestRelease,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* Implements `Registry.PluginProvider` against the Edge `/registry` HTTP endpoints.
|
|
@@ -41,51 +43,48 @@ const toRegistryPlugin = (entry: PluginEntry): Registry.Plugin => ({
|
|
|
41
43
|
* cycle. The class needs only the public `EdgeHttpClient` type, so a one-way
|
|
42
44
|
* type-import is enough.
|
|
43
45
|
*
|
|
44
|
-
* `listVersions` is
|
|
45
|
-
*
|
|
46
|
-
* The wire contract for the real endpoint already exists — see
|
|
47
|
-
* `GetPluginVersionsResponseBodySchema` in `@dxos/protocols/edge/registry` and
|
|
48
|
-
* {@link EdgeHttpClient.getRegistryPluginVersions} — so once Edge ships
|
|
49
|
-
* `GET /registry/plugins/:repo/versions`, swap this stub for a call to
|
|
50
|
-
* `this._client.getRegistryPluginVersions(...)` and map each entry through a
|
|
51
|
-
* `toRegistryPluginVersion` helper (mirror of {@link toRegistryPlugin}).
|
|
46
|
+
* `listVersions` is served directly from the `releases` array inlined on each
|
|
47
|
+
* entry — no separate endpoint is needed.
|
|
52
48
|
*/
|
|
53
49
|
export class EdgeRegistryPluginProvider implements Registry.PluginProvider {
|
|
54
50
|
// Cached on first load so getPlugin/listVersions can resolve without re-fetching.
|
|
55
|
-
#cachedPlugins: readonly
|
|
51
|
+
#cachedPlugins: readonly Plugin.Meta[] = [];
|
|
52
|
+
#cachedEntries: readonly PluginView[] = [];
|
|
56
53
|
|
|
57
54
|
constructor(private readonly _client: EdgeHttpClient) {}
|
|
58
55
|
|
|
59
|
-
listPlugins(): Effect.Effect<readonly
|
|
56
|
+
listPlugins(): Effect.Effect<readonly Plugin.Meta[], Error> {
|
|
60
57
|
return Effect.tryPromise({
|
|
61
58
|
try: () => this._client.getRegistryPlugins(Context.default()),
|
|
62
59
|
catch: (error) => (error instanceof Error ? error : new Error(String(error))),
|
|
63
60
|
}).pipe(
|
|
64
61
|
Effect.map((body) => {
|
|
65
|
-
|
|
62
|
+
this.#cachedEntries = body.plugins;
|
|
63
|
+
const plugins = body.plugins.map(toRegistryPlugin).filter((entry): entry is Plugin.Meta => entry !== null);
|
|
66
64
|
this.#cachedPlugins = plugins;
|
|
67
65
|
return plugins;
|
|
68
66
|
}),
|
|
69
67
|
);
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
listVersions(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return Effect.fail(new Error(`Plugin not found in catalog: ${repo}`));
|
|
70
|
+
listVersions(id: string): Effect.Effect<readonly Plugin.Release[], Error> {
|
|
71
|
+
const entry = this.#cachedEntries.find((candidate) => candidate.profile.key === id);
|
|
72
|
+
if (!entry) {
|
|
73
|
+
return Effect.fail(new Error(`Plugin not found in catalog: ${id}`));
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
return Effect.succeed(
|
|
75
|
+
// Releases are already `PluginRelease`-shaped on the wire view; serve them directly.
|
|
76
|
+
return Effect.succeed(entry.releases);
|
|
80
77
|
}
|
|
81
78
|
|
|
82
|
-
getPlugin(
|
|
83
|
-
const plugin = this.#cachedPlugins.find((
|
|
79
|
+
getPlugin(id: string, version?: string): Effect.Effect<Plugin.Meta, Error> {
|
|
80
|
+
const plugin = this.#cachedPlugins.find((candidate) => candidate.profile.key === id);
|
|
84
81
|
if (!plugin) {
|
|
85
|
-
return Effect.fail(new Error(`Plugin not found in catalog: ${
|
|
82
|
+
return Effect.fail(new Error(`Plugin not found in catalog: ${id}`));
|
|
86
83
|
}
|
|
87
|
-
if (version && version !== plugin.version) {
|
|
88
|
-
return Effect.fail(
|
|
84
|
+
if (version && version !== plugin.release?.version) {
|
|
85
|
+
return Effect.fail(
|
|
86
|
+
new Error(`Version ${version} not available for ${id}; only ${plugin.release?.version} is cached`),
|
|
87
|
+
);
|
|
89
88
|
}
|
|
90
89
|
return Effect.succeed(plugin);
|
|
91
90
|
}
|