@dxos/app-framework 0.8.4-main.c85a9c8dae → 0.8.4-main.d05539e30a
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/{capability-7RLVE42K.mjs → capability-K5XIVCQU.mjs} +12 -11
- package/dist/lib/browser/capability-K5XIVCQU.mjs.map +7 -0
- package/dist/lib/browser/chunk-5AHASNDW.mjs +95 -0
- package/dist/lib/browser/chunk-5AHASNDW.mjs.map +7 -0
- package/dist/lib/browser/chunk-5GY3YOEL.mjs +28 -0
- package/dist/lib/browser/chunk-5GY3YOEL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-66IXTIVK.mjs} +3 -2
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZRWBPIZG.mjs → chunk-BRK6GYNB.mjs} +14 -42
- package/dist/lib/browser/chunk-BRK6GYNB.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
- package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-FJ4765WW.mjs.map} +3 -3
- package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
- package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YNFPIQGB.mjs → chunk-IW44C7UL.mjs} +9 -2
- package/dist/lib/browser/chunk-IW44C7UL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5RJNZV7K.mjs → chunk-KFDF7KR3.mjs} +11 -13
- package/dist/lib/browser/{chunk-5RJNZV7K.mjs.map → chunk-KFDF7KR3.mjs.map} +3 -3
- package/dist/lib/browser/chunk-KLHQNYJ2.mjs +422 -0
- package/dist/lib/browser/chunk-KLHQNYJ2.mjs.map +7 -0
- package/dist/lib/browser/chunk-QLML5QFJ.mjs +581 -0
- package/dist/lib/browser/chunk-QLML5QFJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FNKT2QQ2.mjs → chunk-SLX73WRZ.mjs} +90 -17
- package/dist/lib/browser/chunk-SLX73WRZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-UVTGHZQF.mjs +513 -0
- package/dist/lib/browser/chunk-UVTGHZQF.mjs.map +7 -0
- package/dist/lib/browser/chunk-VJ5PFAWC.mjs +1446 -0
- package/dist/lib/browser/chunk-VJ5PFAWC.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +17 -32
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/common/activation-events.mjs +11 -14
- package/dist/lib/browser/common/capabilities.mjs +19 -8
- package/dist/lib/browser/core/activation-event.mjs +1 -1
- package/dist/lib/browser/core/capability.mjs +5 -1
- package/dist/lib/browser/core/plugin-manager.mjs +8 -4
- package/dist/lib/browser/core/plugin.mjs +16 -4
- package/dist/lib/browser/core/url-loader.mjs +24 -0
- package/dist/lib/browser/index.mjs +47 -49
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs +89 -0
- package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +199 -56
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/testing/react.mjs +78 -0
- package/dist/lib/browser/testing/react.mjs.map +7 -0
- package/dist/lib/browser/ui/index.mjs +24 -15
- package/dist/lib/node-esm/{capability-EVZK4REM.mjs → capability-RLKFFLTB.mjs} +12 -11
- package/dist/lib/node-esm/capability-RLKFFLTB.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-37Z53PXZ.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-37Z53PXZ.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-42UNAKYO.mjs +423 -0
- package/dist/lib/node-esm/chunk-42UNAKYO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CJCQS2YL.mjs → chunk-6S45OMUP.mjs} +90 -17
- package/dist/lib/node-esm/chunk-6S45OMUP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2A4PRBIX.mjs → chunk-BYHYYJZH.mjs} +14 -42
- package/dist/lib/node-esm/chunk-BYHYYJZH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-CTKEZHKF.mjs} +9 -2
- package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JNT72ZCN.mjs +514 -0
- package/dist/lib/node-esm/chunk-JNT72ZCN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KFZEB6BV.mjs +29 -0
- package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LJNUFNDO.mjs +582 -0
- package/dist/lib/node-esm/chunk-LJNUFNDO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs → chunk-OUEMWPIW.mjs} +11 -13
- package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs.map → chunk-OUEMWPIW.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-PW2VYGOS.mjs +96 -0
- package/dist/lib/node-esm/chunk-PW2VYGOS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SFYCO3PT.mjs +1447 -0
- package/dist/lib/node-esm/chunk-SFYCO3PT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-XOCUANHO.mjs} +3 -2
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +17 -32
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/common/activation-events.mjs +11 -14
- package/dist/lib/node-esm/common/capabilities.mjs +19 -8
- package/dist/lib/node-esm/core/activation-event.mjs +1 -1
- package/dist/lib/node-esm/core/capability.mjs +5 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
- package/dist/lib/node-esm/core/plugin.mjs +16 -4
- package/dist/lib/node-esm/core/url-loader.mjs +25 -0
- package/dist/lib/node-esm/index.mjs +47 -49
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs +90 -0
- package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +199 -56
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/testing/react.mjs +79 -0
- package/dist/lib/node-esm/testing/react.mjs.map +7 -0
- package/dist/lib/node-esm/ui/index.mjs +24 -15
- package/dist/plugin/node-esm/index.mjs +893 -0
- package/dist/plugin/node-esm/index.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/types/src/cli/cli.d.ts +1 -3
- package/dist/types/src/cli/cli.d.ts.map +1 -1
- package/dist/types/src/common/activation-events.d.ts +10 -13
- package/dist/types/src/common/activation-events.d.ts.map +1 -1
- package/dist/types/src/common/annotations.d.ts +1 -0
- package/dist/types/src/common/annotations.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +113 -12
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +8 -22
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +5 -5
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts +5 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +13 -2
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +6 -0
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
- package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.d.ts +238 -7
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manifest.d.ts +101 -0
- package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +182 -7
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +107 -0
- package/dist/types/src/core/registry.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.d.ts +127 -0
- package/dist/types/src/core/url-loader.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.test.d.ts +2 -0
- package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts +3 -0
- package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/errors.d.ts +32 -0
- package/dist/types/src/plugin-process-manager/history/errors.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/history-tracker.test.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/index.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/types.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/types.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/undo-mapping.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/undo-registry.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/undo-registry.test.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/index.d.ts +3 -0
- package/dist/types/src/plugin-process-manager/index.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +8 -0
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/testing.d.ts +59 -0
- package/dist/types/src/plugin-process-manager/testing.d.ts.map +1 -0
- package/dist/types/src/testing/harness.d.ts +79 -0
- package/dist/types/src/testing/harness.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +27 -0
- package/dist/types/src/testing/react.d.ts.map +1 -0
- package/dist/types/src/testing/react.test.d.ts +2 -0
- package/dist/types/src/testing/react.test.d.ts.map +1 -0
- package/dist/types/src/testing/service.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.d.ts +3 -2
- package/dist/types/src/ui/components/App/App.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/Placeholder/Placeholder.d.ts +64 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
- 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/SurfaceInfo.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +1 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/index.d.ts +1 -1
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +47 -11
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts +24 -0
- package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +5 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +13 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +15 -0
- package/package.json +53 -54
- package/src/cli/cli.ts +4 -9
- package/src/common/activation-events.ts +12 -17
- package/src/common/annotations.ts +3 -0
- package/src/common/capabilities.ts +160 -29
- package/src/common/operations.ts +7 -10
- package/src/context.ts +1 -1
- package/src/core/activation-event.ts +5 -2
- package/src/core/capability-manager.test.ts +1 -1
- package/src/core/capability-manager.ts +22 -1
- package/src/core/capability.ts +20 -2
- package/src/core/edge-registry-plugin-provider.ts +92 -0
- package/src/core/index.ts +6 -0
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +1085 -31
- package/src/core/plugin-manager.ts +1170 -198
- package/src/core/plugin-manifest.test.ts +75 -0
- package/src/core/plugin-manifest.ts +134 -0
- package/src/core/plugin.ts +194 -12
- package/src/core/registry.ts +163 -0
- package/src/core/url-loader.test.ts +221 -0
- package/src/core/url-loader.ts +388 -0
- package/src/index.ts +1 -2
- package/src/plugin-process-manager/ProcessManagerPlugin.ts +24 -0
- package/src/{plugin-operation → plugin-process-manager}/history/capability.ts +1 -2
- package/src/plugin-process-manager/history/errors.ts +7 -0
- package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.ts +37 -43
- package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.ts +1 -2
- package/src/{plugin-operation → plugin-process-manager}/history/types.ts +1 -1
- package/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.ts +1 -1
- package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.ts +3 -4
- package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.ts +1 -1
- package/src/{plugin-operation → plugin-process-manager}/index.ts +1 -1
- package/src/plugin-process-manager/meta.ts +14 -0
- package/src/plugin-process-manager/process-manager-capability.ts +178 -0
- package/src/{plugin-operation → plugin-process-manager}/testing.ts +26 -45
- package/src/testing/harness.ts +247 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +4 -4
- package/src/testing/withPluginManager.stories.tsx +1 -2
- package/src/testing/withPluginManager.tsx +45 -20
- package/src/ui/components/App/App.stories.tsx +7 -13
- package/src/ui/components/App/App.tsx +29 -5
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/{plugin-runtime → ui/components/Placeholder}/index.ts +1 -1
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +8 -7
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +16 -15
- package/src/ui/components/Surface/SurfaceComponent.tsx +111 -55
- package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
- package/src/ui/components/Surface/index.ts +35 -1
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +164 -12
- package/src/ui/components/index.ts +1 -0
- package/src/ui/hooks/index.ts +1 -1
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +229 -24
- package/src/ui/hooks/useLoading.tsx +14 -6
- package/src/ui/hooks/useProcessManagerRuntime.ts +68 -0
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +270 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +320 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +325 -0
- package/src/vite-plugin/boot-loader/index.ts +5 -0
- package/src/vite-plugin/boot-loader/loader.ts +123 -0
- package/src/vite-plugin/composer/index.ts +306 -0
- package/src/vite-plugin/import-map/index.ts +527 -0
- package/src/vite-plugin/index.ts +10 -0
- package/src/vite-plugin/manifest.test.ts +46 -0
- package/src/vite-plugin/manifest.ts +57 -0
- package/src/vite-plugin/packages.ts +187 -0
- package/tsconfig.json +25 -1
- package/tsconfig.node.json +1 -1
- package/vitest.config.ts +1 -1
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/capability-2GL5JAGJ.mjs +0 -37
- package/dist/lib/browser/capability-2GL5JAGJ.mjs.map +0 -7
- package/dist/lib/browser/capability-7RLVE42K.mjs.map +0 -7
- package/dist/lib/browser/chunk-4CTRO67U.mjs +0 -703
- package/dist/lib/browser/chunk-4CTRO67U.mjs.map +0 -7
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
- package/dist/lib/browser/chunk-FNKT2QQ2.mjs.map +0 -7
- package/dist/lib/browser/chunk-HE27PNNQ.mjs +0 -824
- package/dist/lib/browser/chunk-HE27PNNQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-NPUEVX42.mjs +0 -34
- package/dist/lib/browser/chunk-NPUEVX42.mjs.map +0 -7
- package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
- package/dist/lib/browser/chunk-REORGDJT.mjs +0 -80
- package/dist/lib/browser/chunk-REORGDJT.mjs.map +0 -7
- package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
- package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZRWBPIZG.mjs.map +0 -7
- package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs +0 -36
- package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs.map +0 -7
- package/dist/lib/node-esm/capability-CHIMU6LX.mjs +0 -38
- package/dist/lib/node-esm/capability-CHIMU6LX.mjs.map +0 -7
- package/dist/lib/node-esm/capability-EVZK4REM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2A4PRBIX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7CPNAEGV.mjs +0 -704
- package/dist/lib/node-esm/chunk-7CPNAEGV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CJCQS2YL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DTCHT2X2.mjs +0 -825
- package/dist/lib/node-esm/chunk-DTCHT2X2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JAZVHID3.mjs +0 -35
- package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFW652GS.mjs +0 -81
- package/dist/lib/node-esm/chunk-UFW652GS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
- package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs +0 -37
- package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs.map +0 -7
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts +0 -3
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +0 -5
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/index.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/types.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/index.d.ts +0 -3
- package/dist/types/src/plugin-operation/index.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +0 -6
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/testing.d.ts +0 -109
- package/dist/types/src/plugin-operation/testing.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +0 -3
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +0 -6
- package/dist/types/src/plugin-runtime/capability.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/index.d.ts +0 -2
- package/dist/types/src/plugin-runtime/index.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/meta.d.ts +0 -3
- package/dist/types/src/plugin-runtime/meta.d.ts.map +0 -1
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
- package/src/plugin-operation/OperationPlugin.ts +0 -25
- package/src/plugin-operation/history/errors.ts +0 -11
- package/src/plugin-operation/invoker-capability.ts +0 -40
- package/src/plugin-operation/meta.ts +0 -11
- package/src/plugin-runtime/RuntimePlugin.ts +0 -20
- package/src/plugin-runtime/capability.ts +0 -53
- package/src/plugin-runtime/meta.ts +0 -11
- package/src/ui/hooks/useOperationResolver.ts +0 -40
- /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/capability.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/index.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/meta.d.ts +0 -0
- /package/src/{plugin-operation → plugin-process-manager}/history/index.ts +0 -0
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
import { it } from '@effect/vitest';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Fiber from 'effect/Fiber';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
8
10
|
import * as TestClock from 'effect/TestClock';
|
|
9
11
|
import { describe, expect } from 'vitest';
|
|
10
12
|
|
|
11
|
-
import {
|
|
13
|
+
import { Operation } from '@dxos/compute';
|
|
14
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
15
|
+
|
|
16
|
+
const testRuntime = ManagedRuntime.make(Layer.empty) as unknown as ManagedRuntime.ManagedRuntime<any, any>;
|
|
12
17
|
|
|
13
18
|
import { UndoOperation } from '../../common';
|
|
14
19
|
import {
|
|
@@ -21,7 +26,6 @@ import {
|
|
|
21
26
|
toStringHandler,
|
|
22
27
|
waitUntil,
|
|
23
28
|
} from '../testing';
|
|
24
|
-
|
|
25
29
|
import * as HistoryTracker from './history-tracker';
|
|
26
30
|
import * as UndoMapping from './undo-mapping';
|
|
27
31
|
import * as UndoRegistry from './undo-registry';
|
|
@@ -35,7 +39,7 @@ describe('HistoryTracker', () => {
|
|
|
35
39
|
deriveContext: (_input, output) => ({ value: output.value }),
|
|
36
40
|
});
|
|
37
41
|
|
|
38
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
42
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
39
43
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
40
44
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
41
45
|
|
|
@@ -55,7 +59,7 @@ describe('HistoryTracker', () => {
|
|
|
55
59
|
|
|
56
60
|
it.effect('does not track operations without undo mapping', () =>
|
|
57
61
|
Effect.gen(function* () {
|
|
58
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([toStringHandler]));
|
|
62
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([toStringHandler]), testRuntime);
|
|
59
63
|
const undoRegistry = UndoRegistry.make(() => []);
|
|
60
64
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
61
65
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -81,15 +85,12 @@ describe('HistoryTracker', () => {
|
|
|
81
85
|
});
|
|
82
86
|
|
|
83
87
|
let halveWasCalled = false;
|
|
84
|
-
const trackingHalveHandler =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
halveWasCalled = true;
|
|
88
|
-
return Effect.succeed({ value: data.value / 2 });
|
|
89
|
-
},
|
|
88
|
+
const trackingHalveHandler = Operation.withHandler(HalveCompute, (data) => {
|
|
89
|
+
halveWasCalled = true;
|
|
90
|
+
return Effect.succeed({ value: data.value / 2 });
|
|
90
91
|
});
|
|
91
92
|
|
|
92
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]));
|
|
93
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]), testRuntime);
|
|
93
94
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
94
95
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
95
96
|
|
|
@@ -117,7 +118,7 @@ describe('HistoryTracker', () => {
|
|
|
117
118
|
deriveContext: (_input, output) => ({ value: output.value }),
|
|
118
119
|
});
|
|
119
120
|
|
|
120
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
121
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
121
122
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
122
123
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
123
124
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -152,15 +153,12 @@ describe('HistoryTracker', () => {
|
|
|
152
153
|
});
|
|
153
154
|
|
|
154
155
|
const halveInputs: number[] = [];
|
|
155
|
-
const trackingHalveHandler =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
halveInputs.push(data.value);
|
|
159
|
-
return Effect.succeed({ value: data.value / 2 });
|
|
160
|
-
},
|
|
156
|
+
const trackingHalveHandler = Operation.withHandler(HalveCompute, (data) => {
|
|
157
|
+
halveInputs.push(data.value);
|
|
158
|
+
return Effect.succeed({ value: data.value / 2 });
|
|
161
159
|
});
|
|
162
160
|
|
|
163
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]));
|
|
161
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]), testRuntime);
|
|
164
162
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
165
163
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
166
164
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -194,7 +192,7 @@ describe('HistoryTracker', () => {
|
|
|
194
192
|
|
|
195
193
|
it.effect('undo on empty history returns error', () =>
|
|
196
194
|
Effect.gen(function* () {
|
|
197
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([]));
|
|
195
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([]), testRuntime);
|
|
198
196
|
const undoRegistry = UndoRegistry.make(() => []);
|
|
199
197
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
200
198
|
|
|
@@ -208,7 +206,7 @@ describe('HistoryTracker', () => {
|
|
|
208
206
|
|
|
209
207
|
it.effect('fires ShowUndo operation when undoable operation is tracked', () =>
|
|
210
208
|
Effect.gen(function* () {
|
|
211
|
-
const testMessage: [string, { ns: string }] = ['test
|
|
209
|
+
const testMessage: [string, { ns: string }] = ['test-undo.message', { ns: 'test' }];
|
|
212
210
|
const undoMapping = UndoMapping.make({
|
|
213
211
|
operation: Compute,
|
|
214
212
|
inverse: HalveCompute,
|
|
@@ -218,17 +216,15 @@ describe('HistoryTracker', () => {
|
|
|
218
216
|
|
|
219
217
|
let showUndoWasCalled = false;
|
|
220
218
|
let showUndoMessage: unknown = undefined;
|
|
221
|
-
const showUndoHandler =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
showUndoMessage = input.message;
|
|
226
|
-
return Effect.succeed(undefined);
|
|
227
|
-
},
|
|
219
|
+
const showUndoHandler = Operation.withHandler(UndoOperation.ShowUndo, (input) => {
|
|
220
|
+
showUndoWasCalled = true;
|
|
221
|
+
showUndoMessage = input.message;
|
|
222
|
+
return Effect.succeed(undefined);
|
|
228
223
|
});
|
|
229
224
|
|
|
230
|
-
const invoker = OperationInvoker.make(
|
|
231
|
-
Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
225
|
+
const invoker = OperationInvoker.make(
|
|
226
|
+
() => Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
227
|
+
testRuntime,
|
|
232
228
|
);
|
|
233
229
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
234
230
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
@@ -254,7 +250,7 @@ describe('HistoryTracker', () => {
|
|
|
254
250
|
Effect.gen(function* () {
|
|
255
251
|
// Dynamic message that depends on input/output.
|
|
256
252
|
const dynamicMessage = (input: { value: number }, output: { value: number }): [string, { ns: string }] => [
|
|
257
|
-
`computed
|
|
253
|
+
`computed-${input.value}-to-${output.value}`,
|
|
258
254
|
{ ns: 'test' },
|
|
259
255
|
];
|
|
260
256
|
const undoMapping = UndoMapping.make({
|
|
@@ -266,17 +262,15 @@ describe('HistoryTracker', () => {
|
|
|
266
262
|
|
|
267
263
|
let showUndoWasCalled = false;
|
|
268
264
|
let showUndoMessage: unknown = undefined;
|
|
269
|
-
const showUndoHandler =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
showUndoMessage = input.message;
|
|
274
|
-
return Effect.succeed(undefined);
|
|
275
|
-
},
|
|
265
|
+
const showUndoHandler = Operation.withHandler(UndoOperation.ShowUndo, (input) => {
|
|
266
|
+
showUndoWasCalled = true;
|
|
267
|
+
showUndoMessage = input.message;
|
|
268
|
+
return Effect.succeed(undefined);
|
|
276
269
|
});
|
|
277
270
|
|
|
278
|
-
const invoker = OperationInvoker.make(
|
|
279
|
-
Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
271
|
+
const invoker = OperationInvoker.make(
|
|
272
|
+
() => Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
273
|
+
testRuntime,
|
|
280
274
|
);
|
|
281
275
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
282
276
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
@@ -295,7 +289,7 @@ describe('HistoryTracker', () => {
|
|
|
295
289
|
yield* waitUntil(() => showUndoWasCalled);
|
|
296
290
|
expect(showUndoWasCalled).toBe(true);
|
|
297
291
|
// Compute 2 * 2 = 4, so message should be 'computed 2 to 4'.
|
|
298
|
-
expect(showUndoMessage).toEqual(['computed
|
|
292
|
+
expect(showUndoMessage).toEqual(['computed-2-to-4', { ns: 'test' }]);
|
|
299
293
|
}),
|
|
300
294
|
);
|
|
301
295
|
|
|
@@ -314,7 +308,7 @@ describe('HistoryTracker', () => {
|
|
|
314
308
|
},
|
|
315
309
|
});
|
|
316
310
|
|
|
317
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
311
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
318
312
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
319
313
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
320
314
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -352,7 +346,7 @@ describe('HistoryTracker', () => {
|
|
|
352
346
|
},
|
|
353
347
|
});
|
|
354
348
|
|
|
355
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
349
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
356
350
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
357
351
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
358
352
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -7,10 +7,9 @@ import * as Stream from 'effect/Stream';
|
|
|
7
7
|
|
|
8
8
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import {
|
|
10
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
11
11
|
|
|
12
12
|
import { UndoOperation } from '../../common';
|
|
13
|
-
|
|
14
13
|
import { EmptyHistoryError } from './errors';
|
|
15
14
|
import type { HistoryEntry } from './types';
|
|
16
15
|
import { resolveMessage } from './undo-mapping';
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { describe, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Compute, HalveCompute } from '../testing';
|
|
8
|
-
|
|
9
8
|
import * as UndoMapping from './undo-mapping';
|
|
10
9
|
import * as UndoRegistry from './undo-registry';
|
|
11
10
|
|
|
@@ -52,18 +51,18 @@ describe('resolveMessage', () => {
|
|
|
52
51
|
});
|
|
53
52
|
|
|
54
53
|
test('returns static label as-is', ({ expect }) => {
|
|
55
|
-
const staticMessage: [string, { ns: string }] = ['test
|
|
54
|
+
const staticMessage: [string, { ns: string }] = ['test.message', { ns: 'test' }];
|
|
56
55
|
const result = UndoMapping.resolveMessage(staticMessage, { value: 1 }, { value: 2 });
|
|
57
56
|
expect(result).toEqual(staticMessage);
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
test('calls function message with input and output', ({ expect }) => {
|
|
61
60
|
const messageFunc = (input: { value: number }, output: { value: number }): [string, { ns: string }] => [
|
|
62
|
-
`input
|
|
61
|
+
`input-${input.value}-output-${output.value}`,
|
|
63
62
|
{ ns: 'test' },
|
|
64
63
|
];
|
|
65
64
|
const result = UndoMapping.resolveMessage(messageFunc, { value: 5 }, { value: 10 });
|
|
66
|
-
expect(result).toEqual(['input
|
|
65
|
+
expect(result).toEqual(['input-5-output-10', { ns: 'test' }]);
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
test('returns string label as-is', ({ expect }) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Plugin } from '../core';
|
|
6
|
+
|
|
7
|
+
export const meta: Plugin.Meta = {
|
|
8
|
+
id: 'org.dxos.plugin.process-manager',
|
|
9
|
+
name: 'Process Manager Plugin',
|
|
10
|
+
author: 'DXOS',
|
|
11
|
+
description:
|
|
12
|
+
'Hosts the process-manager runtime that composes contributed layer specs into a service resolver, exposes the operation invoker built on top of it, and registers undo/history tracking.',
|
|
13
|
+
tags: ['system'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Registry } from '@effect-atom/atom';
|
|
6
|
+
import * as KeyValueStore from '@effect/platform/KeyValueStore';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
10
|
+
|
|
11
|
+
import { LayerSpec, OperationHandlerSet, Process, ServiceResolver, Trace } from '@dxos/compute';
|
|
12
|
+
import { LayerStack, ProcessManager } from '@dxos/compute-runtime';
|
|
13
|
+
import { invariant } from '@dxos/invariant';
|
|
14
|
+
// Explicit import so the emitted `.d.ts` references the package via its public
|
|
15
|
+
// alias instead of a relative `node_modules` path (TS2883).
|
|
16
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
17
|
+
|
|
18
|
+
import { ActivationEvents, Capabilities } from '../common';
|
|
19
|
+
import { Capability, Plugin } from '../core';
|
|
20
|
+
|
|
21
|
+
//
|
|
22
|
+
// Capability Module
|
|
23
|
+
//
|
|
24
|
+
// Hosts the {@link ProcessManager} runtime for the plugin system.
|
|
25
|
+
//
|
|
26
|
+
// Workflow:
|
|
27
|
+
// 1. Activates {@link ActivationEvents.SetupProcessManager} so plugins can
|
|
28
|
+
// contribute {@link Capabilities.LayerSpec} entries and
|
|
29
|
+
// {@link Capabilities.OperationHandler} sets.
|
|
30
|
+
// 2. Collects all contributed {@link LayerSpec.LayerSpec}s and builds a
|
|
31
|
+
// {@link LayerStack} whose {@link ServiceResolver} drives process-scoped
|
|
32
|
+
// service resolution.
|
|
33
|
+
// 3. Wires a reactive {@link OperationHandlerSet} that tracks
|
|
34
|
+
// {@link Capabilities.OperationHandler} contributions and invalidates its
|
|
35
|
+
// cached merge when new handlers register.
|
|
36
|
+
// 4. Composes the fixed runtime requirements (capability/plugin managers,
|
|
37
|
+
// service resolver, operation invoker, process manager) into a single
|
|
38
|
+
// {@link Layer} and builds a {@link ManagedRuntime} from it.
|
|
39
|
+
// 5. Exposes a disposable-less wrapper as {@link Capabilities.ProcessManagerRuntime}
|
|
40
|
+
// (the plugin system manages its lifecycle).
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
export default Capability.makeModule(
|
|
44
|
+
Effect.fnUntraced(function* () {
|
|
45
|
+
const capabilityManager = yield* Capability.Service;
|
|
46
|
+
const pluginManager = yield* Plugin.Service;
|
|
47
|
+
const atomRegistry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
48
|
+
|
|
49
|
+
yield* Plugin.activate(ActivationEvents.SetupProcessManager);
|
|
50
|
+
|
|
51
|
+
const layerSpecs = yield* Capability.getAll(Capabilities.LayerSpec);
|
|
52
|
+
const traceSinkFactories = yield* Capability.getAll(Capabilities.TraceSink);
|
|
53
|
+
|
|
54
|
+
// Forward reference to `ProcessManager.ProcessManagerService`. The runtime
|
|
55
|
+
// that owns the manager depends transitively on `ServiceResolver` (which is
|
|
56
|
+
// built from the `LayerStack` below), so we cannot materialise it before
|
|
57
|
+
// the stack exists. Instead we publish the manager into this holder as
|
|
58
|
+
// soon as the runtime is built, and the ambient layer reads it lazily via
|
|
59
|
+
// `Layer.effect` — slice init only runs once a process actually triggers
|
|
60
|
+
// service resolution, by which point the holder is populated.
|
|
61
|
+
let processManagerHolder: ProcessManager.Manager | undefined;
|
|
62
|
+
|
|
63
|
+
// Expose the foundational app-framework services through the LayerStack so
|
|
64
|
+
// that operations declaring `services: [Capability.Service]` (and friends)
|
|
65
|
+
// can resolve them via the ServiceResolver. Without this, only consumers
|
|
66
|
+
// sitting on the same ManagedRuntime layer graph can see them — process
|
|
67
|
+
// executions go through ServiceResolver.resolveAll and would fail.
|
|
68
|
+
const ambientLayerSpec = LayerSpec.make(
|
|
69
|
+
{
|
|
70
|
+
affinity: 'application',
|
|
71
|
+
requires: [],
|
|
72
|
+
provides: [Capability.Service, Plugin.Service, Registry.AtomRegistry, ProcessManager.ProcessManagerService],
|
|
73
|
+
},
|
|
74
|
+
() =>
|
|
75
|
+
Layer.mergeAll(
|
|
76
|
+
Layer.succeed(Capability.Service, capabilityManager),
|
|
77
|
+
Layer.succeed(Plugin.Service, pluginManager),
|
|
78
|
+
Layer.succeed(Registry.AtomRegistry, atomRegistry),
|
|
79
|
+
Layer.effect(
|
|
80
|
+
ProcessManager.ProcessManagerService,
|
|
81
|
+
Effect.sync(() => {
|
|
82
|
+
invariant(
|
|
83
|
+
processManagerHolder,
|
|
84
|
+
'ProcessManagerService accessed before the process-manager runtime was initialised',
|
|
85
|
+
);
|
|
86
|
+
return processManagerHolder;
|
|
87
|
+
}),
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const layerStack = new LayerStack.LayerStack({ layers: [ambientLayerSpec, ...layerSpecs] });
|
|
93
|
+
const serviceResolver = layerStack.getServiceResolver();
|
|
94
|
+
|
|
95
|
+
const handlerSet = OperationHandlerSet.reactive(
|
|
96
|
+
atomRegistry,
|
|
97
|
+
capabilityManager.atom(Capabilities.OperationHandler),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const traceSinks = traceSinkFactories.map((factory) => factory({ resolver: serviceResolver }));
|
|
101
|
+
const mergedTraceSink = Trace.mergeSinks(traceSinks);
|
|
102
|
+
|
|
103
|
+
// Base services required by ProcessManager and the operation invoker.
|
|
104
|
+
// Sensible defaults are provided here; plugins that want alternative
|
|
105
|
+
// implementations (e.g. persistent KV store, real tracing) can contribute
|
|
106
|
+
// their own LayerSpec entries against the ServiceResolver.
|
|
107
|
+
const baseLayer = Layer.mergeAll(
|
|
108
|
+
Layer.succeed(Capability.Service, capabilityManager),
|
|
109
|
+
Layer.succeed(Plugin.Service, pluginManager),
|
|
110
|
+
Layer.succeed(Registry.AtomRegistry, atomRegistry),
|
|
111
|
+
Layer.succeed(ServiceResolver.ServiceResolver, serviceResolver),
|
|
112
|
+
OperationHandlerSet.provide(handlerSet),
|
|
113
|
+
KeyValueStore.layerMemory,
|
|
114
|
+
Layer.succeed(Trace.TraceSink, mergedTraceSink),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const processManagerLayer = ProcessManager.layer({ runtimeName: Trace.CommonRuntimeName.local }).pipe(
|
|
118
|
+
Layer.provide(baseLayer),
|
|
119
|
+
);
|
|
120
|
+
const operationInvokerLayer = ProcessManager.ProcessOperationInvoker.layer.pipe(
|
|
121
|
+
Layer.provide(Layer.mergeAll(processManagerLayer, baseLayer)),
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const runtimeLayer = Layer.mergeAll(baseLayer, processManagerLayer, operationInvokerLayer);
|
|
125
|
+
|
|
126
|
+
const managedRuntime = ManagedRuntime.make(runtimeLayer as Layer.Layer<any, any, never>);
|
|
127
|
+
|
|
128
|
+
// TODO(dmaretskyi): Capability modules don't currently expose a teardown
|
|
129
|
+
// hook (`makeModule` only allows `Service | Plugin.Service` in the effect's
|
|
130
|
+
// requirements, ruling out `Effect.addFinalizer`). Once the plugin
|
|
131
|
+
// framework grows a shutdown lifecycle, dispose `managedRuntime` and then
|
|
132
|
+
// call `layerStack.destroy()` to tear down keep-alive slices.
|
|
133
|
+
|
|
134
|
+
const processManagerRuntime: Capabilities.ProcessManagerRuntime = {
|
|
135
|
+
runPromise: (effect, options) => managedRuntime.runPromise(effect as Effect.Effect<any, any, any>, options),
|
|
136
|
+
runPromiseExit: (effect, options) =>
|
|
137
|
+
managedRuntime.runPromiseExit(effect as Effect.Effect<any, any, any>, options),
|
|
138
|
+
runFork: (effect, options) => managedRuntime.runFork(effect as Effect.Effect<any, any, any>, options),
|
|
139
|
+
runSync: (effect) => managedRuntime.runSync(effect as Effect.Effect<any, any, any>),
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Eagerly extract the process monitor. Safe because it does not require a
|
|
143
|
+
// fresh scope and is a stable reference for the lifetime of the runtime.
|
|
144
|
+
const processMonitor = managedRuntime.runSync(
|
|
145
|
+
Effect.flatMap(Process.ProcessMonitorService, Effect.succeed) as Effect.Effect<Process.Monitor, never, never>,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
// Publish the manager into the ambient-layer holder so that
|
|
149
|
+
// `ProcessManager.ProcessManagerService` becomes resolvable through the
|
|
150
|
+
// LayerStack alongside the other framework-supplied services.
|
|
151
|
+
processManagerHolder = managedRuntime.runSync(
|
|
152
|
+
Effect.flatMap(ProcessManager.ProcessManagerService, Effect.succeed) as Effect.Effect<
|
|
153
|
+
ProcessManager.Manager,
|
|
154
|
+
never,
|
|
155
|
+
never
|
|
156
|
+
>,
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
// Eagerly extract the operation invoker built by ProcessOperationInvoker.layer.
|
|
160
|
+
// Pulled via the ProcessOperationInvoker tag so the contributed value carries
|
|
161
|
+
// the full OperationInvoker interface (`invocations`, `pendingFollowups`,
|
|
162
|
+
// `awaitFollowups`, `_invokeCore`) that HistoryTracker requires.
|
|
163
|
+
const operationInvoker: OperationInvoker.OperationInvoker = managedRuntime.runSync(
|
|
164
|
+
Effect.flatMap(ProcessManager.ProcessOperationInvoker.Service, Effect.succeed) as unknown as Effect.Effect<
|
|
165
|
+
OperationInvoker.OperationInvoker,
|
|
166
|
+
never,
|
|
167
|
+
never
|
|
168
|
+
>,
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
return [
|
|
172
|
+
Capability.contributes(Capabilities.ProcessManagerRuntime, processManagerRuntime),
|
|
173
|
+
Capability.contributes(Capabilities.ServiceResolver, serviceResolver),
|
|
174
|
+
Capability.contributes(Capabilities.ProcessMonitor, processMonitor),
|
|
175
|
+
Capability.contributes(Capabilities.OperationInvoker, operationInvoker),
|
|
176
|
+
];
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
@@ -9,49 +9,40 @@ import * as Ref from 'effect/Ref';
|
|
|
9
9
|
import * as Schema from 'effect/Schema';
|
|
10
10
|
import * as Stream from 'effect/Stream';
|
|
11
11
|
|
|
12
|
-
import { Operation
|
|
12
|
+
import { Operation } from '@dxos/compute';
|
|
13
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
13
14
|
|
|
14
15
|
//
|
|
15
16
|
// Test Operations
|
|
16
17
|
//
|
|
17
18
|
|
|
18
19
|
export const Compute = Operation.make({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
output: Schema.Struct({ value: Schema.Number }),
|
|
22
|
-
},
|
|
20
|
+
input: Schema.Struct({ value: Schema.Number }),
|
|
21
|
+
output: Schema.Struct({ value: Schema.Number }),
|
|
23
22
|
meta: { key: 'test.compute' },
|
|
24
23
|
});
|
|
25
24
|
|
|
26
25
|
export const HalveCompute = Operation.make({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
output: Schema.Struct({ value: Schema.Number }),
|
|
30
|
-
},
|
|
26
|
+
input: Schema.Struct({ value: Schema.Number }),
|
|
27
|
+
output: Schema.Struct({ value: Schema.Number }),
|
|
31
28
|
meta: { key: 'test.halve-compute' },
|
|
32
29
|
});
|
|
33
30
|
|
|
34
31
|
export const ToString = Operation.make({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
output: Schema.Struct({ string: Schema.String }),
|
|
38
|
-
},
|
|
32
|
+
input: Schema.Struct({ value: Schema.Number }),
|
|
33
|
+
output: Schema.Struct({ string: Schema.String }),
|
|
39
34
|
meta: { key: 'test.to-string' },
|
|
40
35
|
});
|
|
41
36
|
|
|
42
37
|
export const Add = Operation.make({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
output: Schema.Number,
|
|
46
|
-
},
|
|
38
|
+
input: Schema.Tuple(Schema.Number, Schema.Number),
|
|
39
|
+
output: Schema.Number,
|
|
47
40
|
meta: { key: 'test.add' },
|
|
48
41
|
});
|
|
49
42
|
|
|
50
43
|
export const SideEffect = Operation.make({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
output: Schema.Void,
|
|
54
|
-
},
|
|
44
|
+
input: Schema.Void,
|
|
45
|
+
output: Schema.Void,
|
|
55
46
|
meta: { key: 'test.side-effect' },
|
|
56
47
|
});
|
|
57
48
|
|
|
@@ -59,34 +50,24 @@ export const SideEffect = Operation.make({
|
|
|
59
50
|
// Test Handlers
|
|
60
51
|
//
|
|
61
52
|
|
|
62
|
-
export const computeHandler =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
-
});
|
|
53
|
+
export const computeHandler = Operation.withHandler(Compute, (data) =>
|
|
54
|
+
Effect.gen(function* () {
|
|
55
|
+
yield* Effect.sleep(data.value * 10);
|
|
56
|
+
return { value: data.value * 2 };
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
70
59
|
|
|
71
|
-
export const halveComputeHandler =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
60
|
+
export const halveComputeHandler = Operation.withHandler(HalveCompute, (data) =>
|
|
61
|
+
Effect.succeed({ value: data.value / 2 }),
|
|
62
|
+
);
|
|
75
63
|
|
|
76
|
-
export const toStringHandler =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
64
|
+
export const toStringHandler = Operation.withHandler(ToString, (data) =>
|
|
65
|
+
Effect.succeed({ string: data.value.toString() }),
|
|
66
|
+
);
|
|
80
67
|
|
|
81
|
-
export const addHandler =
|
|
82
|
-
operation: Add,
|
|
83
|
-
handler: (data) => Effect.succeed(data[0] + data[1]),
|
|
84
|
-
});
|
|
68
|
+
export const addHandler = Operation.withHandler(Add, (data) => Effect.succeed(data[0] + data[1]));
|
|
85
69
|
|
|
86
|
-
export const sideEffectHandler =
|
|
87
|
-
operation: SideEffect,
|
|
88
|
-
handler: () => Effect.succeed(undefined),
|
|
89
|
-
});
|
|
70
|
+
export const sideEffectHandler = Operation.withHandler(SideEffect, () => Effect.succeed(undefined));
|
|
90
71
|
|
|
91
72
|
//
|
|
92
73
|
// Test Utilities
|