@dxos/app-framework 0.10.0 → 0.11.0
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/.storybook/main.mts +1 -1
- package/.storybook/preview.mts +2 -2
- package/CHANGELOG.md +93 -0
- package/TASKS.md +11 -0
- package/dist/lib/chunk-SurfaceManager.mjs +960 -0
- package/dist/lib/chunk-SurfaceManager.mjs.map +1 -0
- package/dist/lib/chunk-capability.mjs +15 -0
- package/dist/lib/chunk-capability.mjs.map +1 -0
- package/dist/lib/{browser/chunk-FJ4765WW.mjs → chunk-context.mjs} +4 -5
- package/dist/lib/chunk-context.mjs.map +1 -0
- package/dist/lib/chunk-history-tracker.mjs +160 -0
- package/dist/lib/chunk-history-tracker.mjs.map +1 -0
- package/dist/lib/chunk-plugin-manager.mjs +1390 -0
- package/dist/lib/chunk-plugin-manager.mjs.map +1 -0
- package/dist/lib/chunk-plugin-manifest.mjs +125 -0
- package/dist/lib/chunk-plugin-manifest.mjs.map +1 -0
- package/dist/lib/chunk-process-manager-capability.mjs +126 -0
- package/dist/lib/chunk-process-manager-capability.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/chunk-url-loader.mjs +347 -0
- package/dist/lib/chunk-url-loader.mjs.map +1 -0
- package/dist/lib/cli.mjs +78 -0
- package/dist/lib/cli.mjs.map +1 -0
- package/dist/lib/common/activation-events.mjs +35 -0
- package/dist/lib/common/activation-events.mjs.map +1 -0
- package/dist/lib/common/capabilities.mjs +184 -0
- package/dist/lib/common/capabilities.mjs.map +1 -0
- package/dist/lib/config.mjs +2 -0
- package/dist/lib/core/activation-event.mjs +55 -0
- package/dist/lib/core/activation-event.mjs.map +1 -0
- package/dist/lib/core/capability.mjs +189 -0
- package/dist/lib/core/capability.mjs.map +1 -0
- package/dist/lib/core/plugin-manager.mjs +2 -0
- package/dist/lib/core/plugin.mjs +340 -0
- package/dist/lib/core/plugin.mjs.map +1 -0
- package/dist/lib/core/url-loader.mjs +2 -0
- package/dist/lib/index.mjs +134 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/testing/react.mjs +70 -0
- package/dist/lib/testing/react.mjs.map +1 -0
- package/dist/lib/testing.mjs +399 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/ui.mjs +636 -0
- package/dist/lib/ui.mjs.map +1 -0
- package/dist/lib/vite-plugin.mjs +986 -0
- package/dist/lib/vite-plugin.mjs.map +1 -0
- package/dist/plugin/node-esm/index.mjs +4 -3
- package/dist/plugin/node-esm/index.mjs.map +3 -3
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/types/src/common/Role.d.ts +31 -0
- package/dist/types/src/common/Role.d.ts.map +1 -0
- package/dist/types/src/common/Role.test.d.ts +2 -0
- package/dist/types/src/common/Role.test.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +11 -2
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +1 -0
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts +1 -1
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +38 -5
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +1 -1
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +14 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +1 -1
- package/dist/types/src/core/registry.d.ts.map +1 -1
- package/dist/types/src/plugin-process-manager/history/capability.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -1
- package/dist/types/src/testing/StorybookErrorFallback.d.ts +15 -0
- package/dist/types/src/testing/StorybookErrorFallback.d.ts.map +1 -0
- 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/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +4 -4
- 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 +6 -0
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/testing/withSurfaceDebug.d.ts +10 -0
- package/dist/types/src/testing/withSurfaceDebug.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/App.d.ts +0 -32
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/index.d.ts +1 -0
- package/dist/types/src/ui/components/App/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/loader.d.ts +35 -0
- package/dist/types/src/ui/components/App/loader.d.ts.map +1 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts +26 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts.map +1 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts +15 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/HomeSection/index.d.ts +2 -0
- package/dist/types/src/ui/components/HomeSection/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts +14 -0
- package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts.map +1 -0
- package/dist/types/src/ui/components/NamePopover/index.d.ts +2 -0
- package/dist/types/src/ui/components/NamePopover/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +21 -9
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts +4 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts +40 -0
- package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts +23 -0
- package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts +11 -0
- package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts +72 -0
- package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts +20 -25
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts +56 -52
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- package/dist/types/src/ui/components/index.d.ts +2 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +25 -18
- package/package.json +58 -73
- package/src/common/Role.test.ts +41 -0
- package/src/common/Role.ts +54 -0
- package/src/common/capabilities.ts +17 -2
- package/src/common/index.ts +1 -0
- package/src/core/capability-manager.test.ts +1 -1
- package/src/core/capability-manager.ts +1 -1
- package/src/core/capability.ts +45 -6
- package/src/core/plugin-manager.test.ts +38 -3
- package/src/core/plugin-manager.ts +18 -1
- package/src/core/plugin.ts +16 -1
- package/src/core/registry.ts +1 -1
- package/src/plugin-process-manager/process-manager-capability.ts +25 -2
- package/src/testing/StorybookErrorFallback.tsx +40 -0
- package/src/testing/harness.ts +1 -1
- package/src/testing/index.ts +2 -0
- package/src/testing/react.test.tsx +2 -1
- package/src/testing/react.tsx +14 -8
- package/src/testing/withPluginManager.stories.tsx +16 -1
- package/src/testing/withPluginManager.tsx +13 -2
- package/src/testing/withSurfaceDebug.tsx +22 -0
- package/src/ui/components/App/App.tsx +7 -35
- package/src/ui/components/App/index.ts +1 -0
- package/src/ui/components/App/loader.ts +39 -0
- package/src/ui/components/HomeSection/HomeSection.stories.tsx +43 -0
- package/src/ui/components/HomeSection/HomeSection.tsx +69 -0
- package/src/ui/components/HomeSection/index.ts +5 -0
- package/src/ui/components/NamePopover/NamePopover.tsx +70 -0
- package/src/ui/components/NamePopover/index.ts +5 -0
- package/src/ui/components/Surface/DESIGN.md +136 -0
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +70 -41
- package/src/ui/components/Surface/SurfaceComponent.test.tsx +403 -0
- package/src/ui/components/Surface/SurfaceComponent.tsx +209 -189
- package/src/ui/components/Surface/SurfaceDebug.tsx +435 -0
- package/src/ui/components/Surface/SurfaceManager.ts +95 -0
- package/src/ui/components/Surface/SurfaceManagerContext.ts +23 -0
- package/src/ui/components/Surface/SurfaceMetrics.ts +202 -0
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +12 -2
- package/src/ui/components/Surface/index.ts +24 -22
- package/src/ui/components/Surface/types.test.ts +47 -54
- package/src/ui/components/Surface/types.ts +66 -91
- package/src/ui/components/index.ts +2 -0
- package/src/ui/hooks/useApp.tsx +7 -3
- package/src/vite-plugin/boot-loader/loader-app/boot-loader.css +1 -1
- package/tsconfig.json +3 -0
- package/vite.config.ts +26 -0
- package/dist/lib/browser/capability-S44TE2H7.mjs +0 -35
- package/dist/lib/browser/capability-S44TE2H7.mjs.map +0 -7
- package/dist/lib/browser/chunk-3NQLTQCP.mjs +0 -47
- package/dist/lib/browser/chunk-3NQLTQCP.mjs.map +0 -7
- package/dist/lib/browser/chunk-53HJHMS5.mjs +0 -7
- package/dist/lib/browser/chunk-53HJHMS5.mjs.map +0 -7
- package/dist/lib/browser/chunk-FJ4765WW.mjs.map +0 -7
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/browser/chunk-KRJ4KK2W.mjs +0 -505
- package/dist/lib/browser/chunk-KRJ4KK2W.mjs.map +0 -7
- package/dist/lib/browser/chunk-LUH4Y5F2.mjs +0 -430
- package/dist/lib/browser/chunk-LUH4Y5F2.mjs.map +0 -7
- package/dist/lib/browser/chunk-NKVRSMFN.mjs +0 -95
- package/dist/lib/browser/chunk-NKVRSMFN.mjs.map +0 -7
- package/dist/lib/browser/chunk-OO53M5UK.mjs +0 -260
- package/dist/lib/browser/chunk-OO53M5UK.mjs.map +0 -7
- package/dist/lib/browser/chunk-OPTS3ZSN.mjs +0 -83
- package/dist/lib/browser/chunk-OPTS3ZSN.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2GLJTVV.mjs +0 -12
- package/dist/lib/browser/chunk-Q2GLJTVV.mjs.map +0 -7
- package/dist/lib/browser/chunk-SYXIYT6T.mjs +0 -143
- package/dist/lib/browser/chunk-SYXIYT6T.mjs.map +0 -7
- package/dist/lib/browser/chunk-U5MESPM5.mjs +0 -603
- package/dist/lib/browser/chunk-U5MESPM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-UGYCLOXE.mjs +0 -1471
- package/dist/lib/browser/chunk-UGYCLOXE.mjs.map +0 -7
- package/dist/lib/browser/chunk-VF37YTXJ.mjs +0 -28
- package/dist/lib/browser/chunk-VF37YTXJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-YUVQIOTB.mjs +0 -60
- package/dist/lib/browser/chunk-YUVQIOTB.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -74
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/common/activation-events.mjs +0 -20
- package/dist/lib/browser/common/activation-events.mjs.map +0 -7
- package/dist/lib/browser/common/capabilities.mjs +0 -56
- package/dist/lib/browser/common/capabilities.mjs.map +0 -7
- package/dist/lib/browser/config/index.mjs +0 -8
- package/dist/lib/browser/config/index.mjs.map +0 -7
- package/dist/lib/browser/core/activation-event.mjs +0 -20
- package/dist/lib/browser/core/activation-event.mjs.map +0 -7
- package/dist/lib/browser/core/capability.mjs +0 -32
- package/dist/lib/browser/core/capability.mjs.map +0 -7
- package/dist/lib/browser/core/plugin-manager.mjs +0 -19
- package/dist/lib/browser/core/plugin-manager.mjs.map +0 -7
- package/dist/lib/browser/core/plugin.mjs +0 -51
- package/dist/lib/browser/core/plugin.mjs.map +0 -7
- package/dist/lib/browser/core/url-loader.mjs +0 -24
- package/dist/lib/browser/core/url-loader.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -98
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs +0 -132
- package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -359
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/browser/testing/react.mjs +0 -78
- package/dist/lib/browser/testing/react.mjs.map +0 -7
- package/dist/lib/browser/ui/index.mjs +0 -60
- package/dist/lib/browser/ui/index.mjs.map +0 -7
- package/dist/lib/node-esm/capability-3YRF77LV.mjs +0 -36
- package/dist/lib/node-esm/capability-3YRF77LV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2UPUZXGU.mjs +0 -9
- package/dist/lib/node-esm/chunk-2UPUZXGU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +0 -10
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4SE7SX7N.mjs +0 -261
- package/dist/lib/node-esm/chunk-4SE7SX7N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BMW6P6QA.mjs +0 -48
- package/dist/lib/node-esm/chunk-BMW6P6QA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-COHOWGGJ.mjs +0 -144
- package/dist/lib/node-esm/chunk-COHOWGGJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DRT75WGD.mjs +0 -604
- package/dist/lib/node-esm/chunk-DRT75WGD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FKMVORZN.mjs +0 -431
- package/dist/lib/node-esm/chunk-FKMVORZN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FPW45EZH.mjs +0 -14
- package/dist/lib/node-esm/chunk-FPW45EZH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs +0 -84
- package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IL7O7IRX.mjs +0 -1472
- package/dist/lib/node-esm/chunk-IL7O7IRX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ND2HETHD.mjs +0 -506
- package/dist/lib/node-esm/chunk-ND2HETHD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TLKYZKPW.mjs +0 -29
- package/dist/lib/node-esm/chunk-TLKYZKPW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VCPGX7WN.mjs +0 -62
- package/dist/lib/node-esm/chunk-VCPGX7WN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XSZMX53L.mjs +0 -96
- package/dist/lib/node-esm/chunk-XSZMX53L.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -75
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/common/activation-events.mjs +0 -21
- package/dist/lib/node-esm/common/activation-events.mjs.map +0 -7
- package/dist/lib/node-esm/common/capabilities.mjs +0 -57
- package/dist/lib/node-esm/common/capabilities.mjs.map +0 -7
- package/dist/lib/node-esm/config/index.mjs +0 -9
- package/dist/lib/node-esm/config/index.mjs.map +0 -7
- package/dist/lib/node-esm/core/activation-event.mjs +0 -21
- package/dist/lib/node-esm/core/activation-event.mjs.map +0 -7
- package/dist/lib/node-esm/core/capability.mjs +0 -33
- package/dist/lib/node-esm/core/capability.mjs.map +0 -7
- package/dist/lib/node-esm/core/plugin-manager.mjs +0 -20
- package/dist/lib/node-esm/core/plugin-manager.mjs.map +0 -7
- package/dist/lib/node-esm/core/plugin.mjs +0 -52
- package/dist/lib/node-esm/core/plugin.mjs.map +0 -7
- package/dist/lib/node-esm/core/url-loader.mjs +0 -25
- package/dist/lib/node-esm/core/url-loader.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -99
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs +0 -133
- package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -360
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/testing/react.mjs +0 -79
- package/dist/lib/node-esm/testing/react.mjs.map +0 -7
- package/dist/lib/node-esm/ui/index.mjs +0 -61
- package/dist/lib/node-esm/ui/index.mjs.map +0 -7
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +0 -11
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +0 -1
- package/src/ui/components/Surface/SurfaceInfo.tsx +0 -106
- package/vitest.config.ts +0 -14
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import "./chunk-Q2GLJTVV.mjs";
|
|
2
|
-
import {
|
|
3
|
-
capabilities_exports
|
|
4
|
-
} from "./chunk-NKVRSMFN.mjs";
|
|
5
|
-
import {
|
|
6
|
-
activation_events_exports
|
|
7
|
-
} from "./chunk-VF37YTXJ.mjs";
|
|
8
|
-
import "./chunk-YUVQIOTB.mjs";
|
|
9
|
-
import "./chunk-LUH4Y5F2.mjs";
|
|
10
|
-
import "./chunk-UGYCLOXE.mjs";
|
|
11
|
-
import "./chunk-3NQLTQCP.mjs";
|
|
12
|
-
import {
|
|
13
|
-
plugin_exports
|
|
14
|
-
} from "./chunk-OO53M5UK.mjs";
|
|
15
|
-
import {
|
|
16
|
-
capability_exports
|
|
17
|
-
} from "./chunk-OPTS3ZSN.mjs";
|
|
18
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
19
|
-
|
|
20
|
-
// src/plugin-process-manager/process-manager-capability.ts
|
|
21
|
-
import { Registry } from "@effect-atom/atom";
|
|
22
|
-
import * as Effect2 from "effect/Effect";
|
|
23
|
-
import * as Layer2 from "effect/Layer";
|
|
24
|
-
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
25
|
-
import { LayerSpec, OperationHandlerSet, Process, ServiceResolver, Trace } from "@dxos/compute";
|
|
26
|
-
import { LayerStack, ProcessManager } from "@dxos/compute-runtime";
|
|
27
|
-
import { invariant } from "@dxos/invariant";
|
|
28
|
-
|
|
29
|
-
// src/plugin-process-manager/idb-key-value-store.ts
|
|
30
|
-
import * as PlatformError from "@effect/platform/Error";
|
|
31
|
-
import * as KeyValueStore from "@effect/platform/KeyValueStore";
|
|
32
|
-
import * as Effect from "effect/Effect";
|
|
33
|
-
import * as Layer from "effect/Layer";
|
|
34
|
-
import * as Option from "effect/Option";
|
|
35
|
-
import * as idb from "idb-keyval";
|
|
36
|
-
var DB_NAME = "dxos-process-manager";
|
|
37
|
-
var STORE_NAME = "keyval";
|
|
38
|
-
var idbError = (method, key, cause) => new PlatformError.SystemError({
|
|
39
|
-
reason: "Unknown",
|
|
40
|
-
module: "KeyValueStore",
|
|
41
|
-
method,
|
|
42
|
-
pathOrDescriptor: key,
|
|
43
|
-
description: String(cause)
|
|
44
|
-
});
|
|
45
|
-
var layerIdb = typeof globalThis.indexedDB !== "undefined" ? Layer.sync(KeyValueStore.KeyValueStore, () => {
|
|
46
|
-
const store = idb.createStore(DB_NAME, STORE_NAME);
|
|
47
|
-
return KeyValueStore.makeStringOnly({
|
|
48
|
-
get: (key) => Effect.tryPromise({
|
|
49
|
-
try: () => idb.get(key, store).then(Option.fromNullable),
|
|
50
|
-
catch: (err) => idbError("get", key, err)
|
|
51
|
-
}),
|
|
52
|
-
set: (key, value) => Effect.tryPromise({
|
|
53
|
-
try: () => idb.set(key, value, store),
|
|
54
|
-
catch: (err) => idbError("set", key, err)
|
|
55
|
-
}),
|
|
56
|
-
remove: (key) => Effect.tryPromise({
|
|
57
|
-
try: () => idb.del(key, store),
|
|
58
|
-
catch: (err) => idbError("remove", key, err)
|
|
59
|
-
}),
|
|
60
|
-
clear: Effect.tryPromise({
|
|
61
|
-
try: () => idb.clear(store),
|
|
62
|
-
catch: (err) => idbError("clear", "", err)
|
|
63
|
-
}),
|
|
64
|
-
size: Effect.tryPromise({
|
|
65
|
-
try: () => idb.keys(store).then((ks) => ks.length),
|
|
66
|
-
catch: (err) => idbError("size", "", err)
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
}) : KeyValueStore.layerMemory;
|
|
70
|
-
|
|
71
|
-
// src/plugin-process-manager/process-manager-capability.ts
|
|
72
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/plugin-process-manager/process-manager-capability.ts";
|
|
73
|
-
var process_manager_capability_default = capability_exports.makeModule(Effect2.fnUntraced(function* () {
|
|
74
|
-
const capabilityManager = yield* capability_exports.Service;
|
|
75
|
-
const pluginManager = yield* plugin_exports.Service;
|
|
76
|
-
const atomRegistry = yield* capability_exports.get(capabilities_exports.AtomRegistry);
|
|
77
|
-
yield* plugin_exports.activate(activation_events_exports.SetupProcessManager);
|
|
78
|
-
const layerSpecs = yield* capability_exports.getAll(capabilities_exports.LayerSpec);
|
|
79
|
-
const traceSinkFactories = yield* capability_exports.getAll(capabilities_exports.TraceSink);
|
|
80
|
-
let processManagerHolder;
|
|
81
|
-
const ambientLayerSpec = LayerSpec.make({
|
|
82
|
-
affinity: "application",
|
|
83
|
-
requires: [],
|
|
84
|
-
provides: [
|
|
85
|
-
capability_exports.Service,
|
|
86
|
-
plugin_exports.Service,
|
|
87
|
-
Registry.AtomRegistry,
|
|
88
|
-
ProcessManager.ProcessManagerService
|
|
89
|
-
]
|
|
90
|
-
}, () => Layer2.mergeAll(Layer2.succeed(capability_exports.Service, capabilityManager), Layer2.succeed(plugin_exports.Service, pluginManager), Layer2.succeed(Registry.AtomRegistry, atomRegistry), Layer2.effect(ProcessManager.ProcessManagerService, Effect2.sync(() => {
|
|
91
|
-
invariant(processManagerHolder, "ProcessManagerService accessed before the process-manager runtime was initialised", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 65, S: this, A: ["processManagerHolder", "'ProcessManagerService accessed before the process-manager runtime was initialised'"] });
|
|
92
|
-
return processManagerHolder;
|
|
93
|
-
}))));
|
|
94
|
-
const layerStack = new LayerStack.LayerStack({
|
|
95
|
-
layers: [
|
|
96
|
-
ambientLayerSpec,
|
|
97
|
-
...layerSpecs
|
|
98
|
-
]
|
|
99
|
-
});
|
|
100
|
-
const serviceResolver = layerStack.getServiceResolver();
|
|
101
|
-
const handlerSet = OperationHandlerSet.reactive(atomRegistry, capabilityManager.atom(capabilities_exports.OperationHandler));
|
|
102
|
-
const traceSinks = traceSinkFactories.map((factory) => factory({
|
|
103
|
-
resolver: serviceResolver
|
|
104
|
-
}));
|
|
105
|
-
const mergedTraceSink = Trace.mergeSinks(traceSinks);
|
|
106
|
-
const baseLayer = Layer2.mergeAll(Layer2.succeed(capability_exports.Service, capabilityManager), Layer2.succeed(plugin_exports.Service, pluginManager), Layer2.succeed(Registry.AtomRegistry, atomRegistry), Layer2.succeed(ServiceResolver.ServiceResolver, serviceResolver), OperationHandlerSet.provide(handlerSet), layerIdb, Layer2.succeed(Trace.TraceSink, mergedTraceSink));
|
|
107
|
-
const processManagerLayer = ProcessManager.layer({
|
|
108
|
-
runtimeName: Trace.CommonRuntimeName.local
|
|
109
|
-
}).pipe(Layer2.provide(baseLayer));
|
|
110
|
-
const operationInvokerLayer = ProcessManager.ProcessOperationInvoker.layer.pipe(Layer2.provide(Layer2.mergeAll(processManagerLayer, baseLayer)));
|
|
111
|
-
const runtimeLayer = Layer2.mergeAll(baseLayer, processManagerLayer, operationInvokerLayer);
|
|
112
|
-
const managedRuntime = ManagedRuntime.make(runtimeLayer);
|
|
113
|
-
const processManagerRuntime = {
|
|
114
|
-
runPromise: (effect2, options) => managedRuntime.runPromise(effect2, options),
|
|
115
|
-
runPromiseExit: (effect2, options) => managedRuntime.runPromiseExit(effect2, options),
|
|
116
|
-
runFork: (effect2, options) => managedRuntime.runFork(effect2, options),
|
|
117
|
-
runSync: (effect2) => managedRuntime.runSync(effect2)
|
|
118
|
-
};
|
|
119
|
-
const processMonitor = managedRuntime.runSync(Effect2.flatMap(Process.ProcessMonitorService, Effect2.succeed));
|
|
120
|
-
processManagerHolder = managedRuntime.runSync(Effect2.flatMap(ProcessManager.ProcessManagerService, Effect2.succeed));
|
|
121
|
-
const operationInvoker = managedRuntime.runSync(Effect2.flatMap(ProcessManager.ProcessOperationInvoker.Service, Effect2.succeed));
|
|
122
|
-
return [
|
|
123
|
-
capability_exports.contributes(capabilities_exports.ProcessManagerRuntime, processManagerRuntime),
|
|
124
|
-
capability_exports.contributes(capabilities_exports.ServiceResolver, serviceResolver),
|
|
125
|
-
capability_exports.contributes(capabilities_exports.ProcessMonitor, processMonitor),
|
|
126
|
-
capability_exports.contributes(capabilities_exports.OperationInvoker, operationInvoker)
|
|
127
|
-
];
|
|
128
|
-
}));
|
|
129
|
-
export {
|
|
130
|
-
process_manager_capability_default as default
|
|
131
|
-
};
|
|
132
|
-
//# sourceMappingURL=process-manager-capability-QK4BMKMN.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-process-manager/process-manager-capability.ts", "../../../src/plugin-process-manager/idb-key-value-store.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Registry } from '@effect-atom/atom';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { LayerSpec, OperationHandlerSet, Process, ServiceResolver, Trace } from '@dxos/compute';\nimport { LayerStack, ProcessManager } from '@dxos/compute-runtime';\nimport { invariant } from '@dxos/invariant';\n// Explicit import so the emitted `.d.ts` references the package via its public\n// alias instead of a relative `node_modules` path (TS2883).\nimport { OperationInvoker } from '@dxos/operation';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { Capability, Plugin } from '../core';\nimport { layerIdb } from './idb-key-value-store';\n\n//\n// Capability Module\n//\n// Hosts the {@link ProcessManager} runtime for the plugin system.\n//\n// Workflow:\n// 1. Activates {@link ActivationEvents.SetupProcessManager} so plugins can\n// contribute {@link Capabilities.LayerSpec} entries and\n// {@link Capabilities.OperationHandler} sets.\n// 2. Collects all contributed {@link LayerSpec.LayerSpec}s and builds a\n// {@link LayerStack} whose {@link ServiceResolver} drives process-scoped\n// service resolution.\n// 3. Wires a reactive {@link OperationHandlerSet} that tracks\n// {@link Capabilities.OperationHandler} contributions and invalidates its\n// cached merge when new handlers register.\n// 4. Composes the fixed runtime requirements (capability/plugin managers,\n// service resolver, operation invoker, process manager) into a single\n// {@link Layer} and builds a {@link ManagedRuntime} from it.\n// 5. Exposes a disposable-less wrapper as {@link Capabilities.ProcessManagerRuntime}\n// (the plugin system manages its lifecycle).\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const capabilityManager = yield* Capability.Service;\n const pluginManager = yield* Plugin.Service;\n const atomRegistry = yield* Capability.get(Capabilities.AtomRegistry);\n\n yield* Plugin.activate(ActivationEvents.SetupProcessManager);\n\n const layerSpecs = yield* Capability.getAll(Capabilities.LayerSpec);\n const traceSinkFactories = yield* Capability.getAll(Capabilities.TraceSink);\n\n // Forward reference to `ProcessManager.ProcessManagerService`. The runtime\n // that owns the manager depends transitively on `ServiceResolver` (which is\n // built from the `LayerStack` below), so we cannot materialise it before\n // the stack exists. Instead we publish the manager into this holder as\n // soon as the runtime is built, and the ambient layer reads it lazily via\n // `Layer.effect` — slice init only runs once a process actually triggers\n // service resolution, by which point the holder is populated.\n let processManagerHolder: ProcessManager.Manager | undefined;\n\n // Expose the foundational app-framework services through the LayerStack so\n // that operations declaring `services: [Capability.Service]` (and friends)\n // can resolve them via the ServiceResolver. Without this, only consumers\n // sitting on the same ManagedRuntime layer graph can see them — process\n // executions go through ServiceResolver.resolveAll and would fail.\n const ambientLayerSpec = LayerSpec.make(\n {\n affinity: 'application',\n requires: [],\n provides: [Capability.Service, Plugin.Service, Registry.AtomRegistry, ProcessManager.ProcessManagerService],\n },\n () =>\n Layer.mergeAll(\n Layer.succeed(Capability.Service, capabilityManager),\n Layer.succeed(Plugin.Service, pluginManager),\n Layer.succeed(Registry.AtomRegistry, atomRegistry),\n Layer.effect(\n ProcessManager.ProcessManagerService,\n Effect.sync(() => {\n invariant(\n processManagerHolder,\n 'ProcessManagerService accessed before the process-manager runtime was initialised',\n );\n return processManagerHolder;\n }),\n ),\n ),\n );\n\n const layerStack = new LayerStack.LayerStack({ layers: [ambientLayerSpec, ...layerSpecs] });\n const serviceResolver = layerStack.getServiceResolver();\n\n const handlerSet = OperationHandlerSet.reactive(\n atomRegistry,\n capabilityManager.atom(Capabilities.OperationHandler),\n );\n\n const traceSinks = traceSinkFactories.map((factory) => factory({ resolver: serviceResolver }));\n const mergedTraceSink = Trace.mergeSinks(traceSinks);\n\n // Base services required by ProcessManager and the operation invoker.\n // Sensible defaults are provided here; plugins that want alternative\n // implementations (e.g. persistent KV store, real tracing) can contribute\n // their own LayerSpec entries against the ServiceResolver.\n const baseLayer = Layer.mergeAll(\n Layer.succeed(Capability.Service, capabilityManager),\n Layer.succeed(Plugin.Service, pluginManager),\n Layer.succeed(Registry.AtomRegistry, atomRegistry),\n Layer.succeed(ServiceResolver.ServiceResolver, serviceResolver),\n OperationHandlerSet.provide(handlerSet),\n layerIdb,\n Layer.succeed(Trace.TraceSink, mergedTraceSink),\n );\n\n const processManagerLayer = ProcessManager.layer({ runtimeName: Trace.CommonRuntimeName.local }).pipe(\n Layer.provide(baseLayer),\n );\n const operationInvokerLayer = ProcessManager.ProcessOperationInvoker.layer.pipe(\n Layer.provide(Layer.mergeAll(processManagerLayer, baseLayer)),\n );\n\n const runtimeLayer = Layer.mergeAll(baseLayer, processManagerLayer, operationInvokerLayer);\n\n const managedRuntime = ManagedRuntime.make(runtimeLayer as Layer.Layer<any, any, never>);\n\n // TODO(dmaretskyi): Capability modules don't currently expose a teardown\n // hook (`makeModule` only allows `Service | Plugin.Service` in the effect's\n // requirements, ruling out `Effect.addFinalizer`). Once the plugin\n // framework grows a shutdown lifecycle, dispose `managedRuntime` and then\n // call `layerStack.destroy()` to tear down keep-alive slices.\n\n const processManagerRuntime: Capabilities.ProcessManagerRuntime = {\n runPromise: (effect, options) => managedRuntime.runPromise(effect as Effect.Effect<any, any, any>, options),\n runPromiseExit: (effect, options) =>\n managedRuntime.runPromiseExit(effect as Effect.Effect<any, any, any>, options),\n runFork: (effect, options) => managedRuntime.runFork(effect as Effect.Effect<any, any, any>, options),\n runSync: (effect) => managedRuntime.runSync(effect as Effect.Effect<any, any, any>),\n };\n\n // Eagerly extract the process monitor. Safe because it does not require a\n // fresh scope and is a stable reference for the lifetime of the runtime.\n const processMonitor = managedRuntime.runSync(\n Effect.flatMap(Process.ProcessMonitorService, Effect.succeed) as Effect.Effect<Process.Monitor, never, never>,\n );\n\n // Publish the manager into the ambient-layer holder so that\n // `ProcessManager.ProcessManagerService` becomes resolvable through the\n // LayerStack alongside the other framework-supplied services.\n processManagerHolder = managedRuntime.runSync(\n Effect.flatMap(ProcessManager.ProcessManagerService, Effect.succeed) as Effect.Effect<\n ProcessManager.Manager,\n never,\n never\n >,\n );\n\n // Eagerly extract the operation invoker built by ProcessOperationInvoker.layer.\n // Pulled via the ProcessOperationInvoker tag so the contributed value carries\n // the full OperationInvoker interface (`invocations`, `pendingFollowups`,\n // `awaitFollowups`, `_invokeCore`) that HistoryTracker requires.\n const operationInvoker: OperationInvoker.OperationInvoker = managedRuntime.runSync(\n Effect.flatMap(ProcessManager.ProcessOperationInvoker.Service, Effect.succeed) as unknown as Effect.Effect<\n OperationInvoker.OperationInvoker,\n never,\n never\n >,\n );\n\n return [\n Capability.contributes(Capabilities.ProcessManagerRuntime, processManagerRuntime),\n Capability.contributes(Capabilities.ServiceResolver, serviceResolver),\n Capability.contributes(Capabilities.ProcessMonitor, processMonitor),\n Capability.contributes(Capabilities.OperationInvoker, operationInvoker),\n ];\n }),\n);\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as PlatformError from '@effect/platform/Error';\nimport * as KeyValueStore from '@effect/platform/KeyValueStore';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as idb from 'idb-keyval';\n\nconst DB_NAME = 'dxos-process-manager';\nconst STORE_NAME = 'keyval';\n\nconst idbError = (method: string, key: string, cause: unknown) =>\n new PlatformError.SystemError({\n reason: 'Unknown',\n module: 'KeyValueStore',\n method,\n pathOrDescriptor: key,\n description: String(cause),\n });\n\n/**\n * KeyValueStore layer backed by IndexedDB via idb-keyval.\n * Uses a dedicated IDB database (dxos-process-manager) so process records\n * survive page reloads without consuming the 5 MB localStorage quota.\n * Falls back to an in-memory store in environments without IndexedDB (e.g. Node.js tests).\n */\nexport const layerIdb: Layer.Layer<KeyValueStore.KeyValueStore> =\n typeof globalThis.indexedDB !== 'undefined'\n ? Layer.sync(KeyValueStore.KeyValueStore, () => {\n const store = idb.createStore(DB_NAME, STORE_NAME);\n return KeyValueStore.makeStringOnly({\n get: (key) =>\n Effect.tryPromise({\n try: () => idb.get<string>(key, store).then(Option.fromNullable),\n catch: (err) => idbError('get', key, err),\n }),\n\n set: (key, value) =>\n Effect.tryPromise({\n try: () => idb.set(key, value, store),\n catch: (err) => idbError('set', key, err),\n }),\n\n remove: (key) =>\n Effect.tryPromise({\n try: () => idb.del(key, store),\n catch: (err) => idbError('remove', key, err),\n }),\n\n clear: Effect.tryPromise({\n try: () => idb.clear(store),\n catch: (err) => idbError('clear', '', err),\n }),\n\n size: Effect.tryPromise({\n try: () => idb.keys(store).then((ks) => ks.length),\n catch: (err) => idbError('size', '', err),\n }),\n });\n })\n : KeyValueStore.layerMemory;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,SAASA,gBAAgB;AACzB,YAAYC,aAAY;AACxB,YAAYC,YAAW;AACvB,YAAYC,oBAAoB;AAEhC,SAASC,WAAWC,qBAAqBC,SAASC,iBAAiBC,aAAa;AAChF,SAASC,YAAYC,sBAAsB;AAC3C,SAASC,iBAAiB;;;ACP1B,YAAYC,mBAAmB;AAC/B,YAAYC,mBAAmB;AAC/B,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,SAAS;AAErB,IAAMC,UAAU;AAChB,IAAMC,aAAa;AAEnB,IAAMC,WAAW,CAACC,QAAgBC,KAAaC,UAC7C,IAAkBC,0BAAY;EAC5BC,QAAQ;EACRC,QAAQ;EACRL;EACAM,kBAAkBL;EAClBM,aAAaC,OAAON,KAAAA;AACtB,CAAA;AAQK,IAAMO,WACX,OAAOC,WAAWC,cAAc,cACtBC,WAAmBpB,6BAAe,MAAA;AACtC,QAAMqB,QAAYC,gBAAYjB,SAASC,UAAAA;AACvC,SAAqBiB,6BAAe;IAClCC,KAAK,CAACf,QACGgB,kBAAW;MAChBC,KAAK,MAAUF,QAAYf,KAAKY,KAAAA,EAAOM,KAAYC,mBAAY;MAC/DC,OAAO,CAACC,QAAQvB,SAAS,OAAOE,KAAKqB,GAAAA;IACvC,CAAA;IAEFC,KAAK,CAACtB,KAAKuB,UACFP,kBAAW;MAChBC,KAAK,MAAUK,QAAItB,KAAKuB,OAAOX,KAAAA;MAC/BQ,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CAAA;AAWxE,yBAAA,eAAA,QAAA,gBAAA,eAAA,uBAA8E,eAAA,CAAA;QAY5EjC,mBAAWmC,eAAyBC,QAAAA,gBAAuBC,eAAAA,wBAAAA,SAAAA,eAAAA,CAAAA;SAC3DrC;IACAA,mBAAWmC,YAAYlC,qBAAaqC,uBAAgBC,qBAAAA;IACpDvC,mBAAWmC,YAAYlC,qBAAauC,iBAAgB,eAAEC;IACvD,mBAAA,YAAA,qBAAA,gBAAA,cAAA;IAEH,mBAAA,YAAA,qBAAA,kBAAA,gBAAA;;;",
|
|
6
|
-
"names": ["Registry", "Effect", "Layer", "ManagedRuntime", "LayerSpec", "OperationHandlerSet", "Process", "ServiceResolver", "Trace", "LayerStack", "ProcessManager", "invariant", "PlatformError", "KeyValueStore", "Effect", "Layer", "Option", "idb", "DB_NAME", "STORE_NAME", "idbError", "method", "key", "cause", "SystemError", "reason", "module", "pathOrDescriptor", "description", "String", "layerIdb", "globalThis", "indexedDB", "sync", "store", "createStore", "makeStringOnly", "get", "tryPromise", "try", "then", "fromNullable", "catch", "err", "set", "value", "remove", "del", "clear", "size", "keys", "ks", "length", "layerMemory", "pluginManager", "Service", "atomRegistry", "Capability", "Capabilities", "ActivationEvents", "layerSpecs", "getAll", "traceSinkFactories", "requires", "provides", "Plugin", "Registry", "AtomRegistry", "ProcessManager", "Layer", "processManagerHolder", "layerStack", "layers", "ambientLayerSpec", "traceSinks", "factory", "serviceResolver", "mergedTraceSink", "runtimeName", "CommonRuntimeName", "pipe", "baseLayer", "operationInvokerLayer", "runtimeLayer", "mergeAll", "managedRuntime", "ManagedRuntime", "runPromiseExit", "options", "runFork", "effect", "runSync", "contributes", "ProcessManagerRuntime", "processManagerRuntime", "ProcessMonitor", "processMonitor", "OperationInvoker", "operationInvoker"]
|
|
7
|
-
}
|
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useApp
|
|
3
|
-
} from "../chunk-KRJ4KK2W.mjs";
|
|
4
|
-
import "../chunk-U5MESPM5.mjs";
|
|
5
|
-
import "../chunk-FJ4765WW.mjs";
|
|
6
|
-
import "../chunk-Q2GLJTVV.mjs";
|
|
7
|
-
import {
|
|
8
|
-
capabilities_exports
|
|
9
|
-
} from "../chunk-NKVRSMFN.mjs";
|
|
10
|
-
import {
|
|
11
|
-
activation_events_exports
|
|
12
|
-
} from "../chunk-VF37YTXJ.mjs";
|
|
13
|
-
import "../chunk-YUVQIOTB.mjs";
|
|
14
|
-
import "../chunk-LUH4Y5F2.mjs";
|
|
15
|
-
import {
|
|
16
|
-
plugin_manager_exports
|
|
17
|
-
} from "../chunk-UGYCLOXE.mjs";
|
|
18
|
-
import {
|
|
19
|
-
activation_event_exports
|
|
20
|
-
} from "../chunk-3NQLTQCP.mjs";
|
|
21
|
-
import {
|
|
22
|
-
plugin_exports
|
|
23
|
-
} from "../chunk-OO53M5UK.mjs";
|
|
24
|
-
import {
|
|
25
|
-
capability_exports
|
|
26
|
-
} from "../chunk-OPTS3ZSN.mjs";
|
|
27
|
-
import "../chunk-J5LGTIGS.mjs";
|
|
28
|
-
|
|
29
|
-
// src/testing/harness.ts
|
|
30
|
-
import * as Duration from "effect/Duration";
|
|
31
|
-
import * as Effect from "effect/Effect";
|
|
32
|
-
import * as PubSub from "effect/PubSub";
|
|
33
|
-
import * as Queue from "effect/Queue";
|
|
34
|
-
import { EffectEx } from "@dxos/effect";
|
|
35
|
-
import { invariant } from "@dxos/invariant";
|
|
36
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/testing/harness.ts";
|
|
37
|
-
var DEFAULT_TIMEOUT_MS = 5e3;
|
|
38
|
-
var createTestApp = async (opts) => {
|
|
39
|
-
const { plugins, enabled = plugins.filter(({ meta }) => !meta.profile.tags?.includes("system")).map((plugin) => plugin.meta.profile.key), setupEvents = [], autoStart = true, registerFrameworkCapabilities = true } = opts;
|
|
40
|
-
const pluginLoader = (id) => Effect.sync(() => {
|
|
41
|
-
const plugin = plugins.find((plugin2) => plugin2.meta.profile.key === id);
|
|
42
|
-
invariant(plugin, `Plugin not found: ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 26, S: void 0, A: ["plugin", "`Plugin not found: ${id}`"] });
|
|
43
|
-
return {
|
|
44
|
-
plugin
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
const manager = plugin_manager_exports.make({
|
|
48
|
-
pluginLoader,
|
|
49
|
-
plugins,
|
|
50
|
-
enabled
|
|
51
|
-
});
|
|
52
|
-
if (registerFrameworkCapabilities) {
|
|
53
|
-
manager.capabilities.contribute({
|
|
54
|
-
interface: capabilities_exports.PluginManager,
|
|
55
|
-
implementation: manager,
|
|
56
|
-
module: "org.dxos.app-framework.plugin-manager"
|
|
57
|
-
});
|
|
58
|
-
manager.capabilities.contribute({
|
|
59
|
-
interface: capabilities_exports.AtomRegistry,
|
|
60
|
-
implementation: manager.registry,
|
|
61
|
-
module: "org.dxos.app-framework.atom-registry"
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (autoStart) {
|
|
65
|
-
try {
|
|
66
|
-
await EffectEx.runAndForwardErrors(Effect.all([
|
|
67
|
-
...setupEvents.map((event) => manager.activate(event)),
|
|
68
|
-
manager.activate(activation_events_exports.SetupReactSurface),
|
|
69
|
-
manager.activate(activation_events_exports.Startup)
|
|
70
|
-
]));
|
|
71
|
-
} catch (err) {
|
|
72
|
-
await EffectEx.runAndForwardErrors(manager.shutdown()).catch(() => void 0);
|
|
73
|
-
throw err;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return new TestHarnessImpl(manager);
|
|
77
|
-
};
|
|
78
|
-
var TestHarnessImpl = class {
|
|
79
|
-
manager;
|
|
80
|
-
constructor(manager) {
|
|
81
|
-
this.manager = manager;
|
|
82
|
-
}
|
|
83
|
-
get capabilities() {
|
|
84
|
-
return this.manager.capabilities;
|
|
85
|
-
}
|
|
86
|
-
get registry() {
|
|
87
|
-
return this.manager.registry;
|
|
88
|
-
}
|
|
89
|
-
fire(event) {
|
|
90
|
-
return EffectEx.runAndForwardErrors(this.manager.activate(event));
|
|
91
|
-
}
|
|
92
|
-
reset(event) {
|
|
93
|
-
return EffectEx.runAndForwardErrors(this.manager.reset(event));
|
|
94
|
-
}
|
|
95
|
-
get(iface) {
|
|
96
|
-
return this.manager.capabilities.get(iface);
|
|
97
|
-
}
|
|
98
|
-
getAll(iface) {
|
|
99
|
-
return this.manager.capabilities.getAll(iface);
|
|
100
|
-
}
|
|
101
|
-
waitForCapability(iface, opts) {
|
|
102
|
-
const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
103
|
-
return EffectEx.runAndForwardErrors(this.manager.capabilities.waitFor(iface).pipe(Effect.timeoutFail({
|
|
104
|
-
duration: Duration.millis(timeout),
|
|
105
|
-
onTimeout: () => timeoutError(iface.identifier)
|
|
106
|
-
})));
|
|
107
|
-
}
|
|
108
|
-
waitForEvent(event, opts) {
|
|
109
|
-
const key = typeof event === "string" ? event : activation_event_exports.eventKey(event);
|
|
110
|
-
const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
111
|
-
const program = Effect.gen(this, function* () {
|
|
112
|
-
const queue = yield* PubSub.subscribe(this.manager.activation);
|
|
113
|
-
if (this.manager.getEventsFired().includes(key)) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
while (true) {
|
|
117
|
-
const message = yield* Queue.take(queue);
|
|
118
|
-
if (message.event === key && message.state === "activated") {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}).pipe(Effect.scoped, Effect.timeoutFail({
|
|
123
|
-
duration: Duration.millis(timeout),
|
|
124
|
-
onTimeout: () => timeoutError(key)
|
|
125
|
-
}));
|
|
126
|
-
return EffectEx.runAndForwardErrors(program);
|
|
127
|
-
}
|
|
128
|
-
async invoke(op, ...args) {
|
|
129
|
-
const invoker = await this.waitForCapability(capabilities_exports.OperationInvoker);
|
|
130
|
-
const result = await invoker.invokePromise(op, ...args);
|
|
131
|
-
if (result.error) {
|
|
132
|
-
throw result.error;
|
|
133
|
-
}
|
|
134
|
-
return result.data;
|
|
135
|
-
}
|
|
136
|
-
async runPromise(effect2, options) {
|
|
137
|
-
const runtime = await this.waitForCapability(capabilities_exports.ProcessManagerRuntime, {
|
|
138
|
-
timeout: options?.timeout
|
|
139
|
-
});
|
|
140
|
-
return runtime.runPromise(effect2, options?.signal ? {
|
|
141
|
-
signal: options.signal
|
|
142
|
-
} : void 0);
|
|
143
|
-
}
|
|
144
|
-
enable(id) {
|
|
145
|
-
return EffectEx.runAndForwardErrors(this.manager.enable(id));
|
|
146
|
-
}
|
|
147
|
-
disable(id) {
|
|
148
|
-
return EffectEx.runAndForwardErrors(this.manager.disable(id));
|
|
149
|
-
}
|
|
150
|
-
async dispose() {
|
|
151
|
-
await EffectEx.runAndForwardErrors(this.manager.shutdown());
|
|
152
|
-
}
|
|
153
|
-
[Symbol.asyncDispose]() {
|
|
154
|
-
return this.dispose();
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
var timeoutError = (id) => new Error(`Timed out waiting for ${id}`);
|
|
158
|
-
|
|
159
|
-
// src/testing/operationCapture.ts
|
|
160
|
-
import * as Effect2 from "effect/Effect";
|
|
161
|
-
var makeOperationCapture = (mockedOperations, spyFn) => {
|
|
162
|
-
const calls = [];
|
|
163
|
-
const mockedKeys = new Set(mockedOperations.map((op) => String(op.meta.key)));
|
|
164
|
-
const record = (op, input) => {
|
|
165
|
-
calls.push({
|
|
166
|
-
operationKey: String(op.meta.key),
|
|
167
|
-
input: input ?? {}
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
const recordFn = spyFn ? spyFn(record) : record;
|
|
171
|
-
return {
|
|
172
|
-
wrap(manager) {
|
|
173
|
-
let real;
|
|
174
|
-
const delegate = () => {
|
|
175
|
-
if (!real) {
|
|
176
|
-
const all2 = manager.getAll(capabilities_exports.OperationInvoker);
|
|
177
|
-
real = all2.find((inv) => inv !== wrapped);
|
|
178
|
-
}
|
|
179
|
-
return real;
|
|
180
|
-
};
|
|
181
|
-
const wrapped = {
|
|
182
|
-
get invocations() {
|
|
183
|
-
return delegate().invocations;
|
|
184
|
-
},
|
|
185
|
-
get pendingFollowups() {
|
|
186
|
-
return delegate().pendingFollowups;
|
|
187
|
-
},
|
|
188
|
-
get awaitFollowups() {
|
|
189
|
-
return delegate().awaitFollowups;
|
|
190
|
-
},
|
|
191
|
-
invoke: (op, input, ...rest) => {
|
|
192
|
-
recordFn(op, input);
|
|
193
|
-
if (mockedKeys.has(String(op.meta.key))) {
|
|
194
|
-
return Effect2.succeed(void 0);
|
|
195
|
-
}
|
|
196
|
-
return delegate().invoke(op, input, ...rest);
|
|
197
|
-
},
|
|
198
|
-
invokePromise: async (op, input, ...rest) => {
|
|
199
|
-
recordFn(op, input);
|
|
200
|
-
if (mockedKeys.has(String(op.meta.key))) {
|
|
201
|
-
return {
|
|
202
|
-
data: void 0
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
return delegate().invokePromise(op, input, ...rest);
|
|
206
|
-
},
|
|
207
|
-
schedule: (op, input, ...rest) => {
|
|
208
|
-
recordFn(op, input);
|
|
209
|
-
if (mockedKeys.has(String(op.meta.key))) {
|
|
210
|
-
return Effect2.succeed(void 0);
|
|
211
|
-
}
|
|
212
|
-
return delegate().schedule(op, input, ...rest);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
return [
|
|
216
|
-
capability_exports.contributes(capabilities_exports.OperationInvoker, wrapped)
|
|
217
|
-
];
|
|
218
|
-
},
|
|
219
|
-
getCalls(op) {
|
|
220
|
-
const key = String(op.meta.key);
|
|
221
|
-
return calls.filter((c) => c.operationKey === key);
|
|
222
|
-
},
|
|
223
|
-
reset() {
|
|
224
|
-
calls.length = 0;
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// src/testing/service.ts
|
|
230
|
-
import * as Effect3 from "effect/Effect";
|
|
231
|
-
import * as Layer from "effect/Layer";
|
|
232
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
233
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/testing/service.ts";
|
|
234
|
-
var fromPlugins = (plugins) => Layer.effect(plugin_exports.Service, Effect3.gen(function* () {
|
|
235
|
-
const pluginLoader = (id) => Effect3.sync(() => {
|
|
236
|
-
const plugin = plugins.find((plugin2) => plugin2.meta.profile.key === id);
|
|
237
|
-
invariant2(plugin, `Plugin not found: ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 16, S: this, A: ["plugin", "`Plugin not found: ${id}`"] });
|
|
238
|
-
return {
|
|
239
|
-
plugin
|
|
240
|
-
};
|
|
241
|
-
});
|
|
242
|
-
const manager = plugin_manager_exports.make({
|
|
243
|
-
pluginLoader,
|
|
244
|
-
plugins,
|
|
245
|
-
enabled: plugins.map((plugin) => plugin.meta.profile.key)
|
|
246
|
-
});
|
|
247
|
-
manager.capabilities.contribute({
|
|
248
|
-
interface: capabilities_exports.PluginManager,
|
|
249
|
-
implementation: manager,
|
|
250
|
-
module: "org.dxos.app-framework.plugin-manager"
|
|
251
|
-
});
|
|
252
|
-
manager.capabilities.contribute({
|
|
253
|
-
interface: capabilities_exports.AtomRegistry,
|
|
254
|
-
implementation: manager.registry,
|
|
255
|
-
module: "org.dxos.app-framework.atom-registry"
|
|
256
|
-
});
|
|
257
|
-
yield* manager.activate(activation_events_exports.Startup);
|
|
258
|
-
return manager;
|
|
259
|
-
}));
|
|
260
|
-
|
|
261
|
-
// src/testing/withPluginManager.tsx
|
|
262
|
-
import * as Effect4 from "effect/Effect";
|
|
263
|
-
import React, { useEffect, useState } from "react";
|
|
264
|
-
import { raise } from "@dxos/debug";
|
|
265
|
-
import { EffectEx as EffectEx2 } from "@dxos/effect";
|
|
266
|
-
import { DXN } from "@dxos/keys";
|
|
267
|
-
import { useAsyncEffect } from "@dxos/react-hooks";
|
|
268
|
-
import { getProviderValue } from "@dxos/util";
|
|
269
|
-
var setupPluginManager = ({ capabilities, plugins = [], ...options } = {}) => {
|
|
270
|
-
const enabled = plugins.filter(({ meta }) => !meta.profile.tags?.includes("system")).map(({ meta }) => meta.profile.key);
|
|
271
|
-
const pluginManager = plugin_manager_exports.make({
|
|
272
|
-
pluginLoader: () => raise(new Error("Not implemented")),
|
|
273
|
-
plugins: [
|
|
274
|
-
StoryPlugin,
|
|
275
|
-
...plugins
|
|
276
|
-
],
|
|
277
|
-
enabled,
|
|
278
|
-
...options
|
|
279
|
-
});
|
|
280
|
-
if (capabilities) {
|
|
281
|
-
getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {
|
|
282
|
-
pluginManager.capabilities.contribute({
|
|
283
|
-
interface: capability.interface,
|
|
284
|
-
implementation: capability.implementation,
|
|
285
|
-
module: "story"
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
return pluginManager;
|
|
290
|
-
};
|
|
291
|
-
var withPluginManager = (init = {}) => {
|
|
292
|
-
return (Story, context) => {
|
|
293
|
-
const storyId = context.id;
|
|
294
|
-
const options = typeof init === "function" ? init(context) : init;
|
|
295
|
-
const [managerState, setManagerState] = useState();
|
|
296
|
-
useEffect(() => {
|
|
297
|
-
const pluginManager = setupPluginManager(options);
|
|
298
|
-
const capability = capability_exports.contributes(capabilities_exports.ReactRoot, {
|
|
299
|
-
id: storyId,
|
|
300
|
-
root: () => /* @__PURE__ */ React.createElement(Story, null)
|
|
301
|
-
});
|
|
302
|
-
pluginManager.capabilities.contribute({
|
|
303
|
-
...capability,
|
|
304
|
-
module: "org.dxos.app-framework.with-plugin-manager"
|
|
305
|
-
});
|
|
306
|
-
setManagerState({
|
|
307
|
-
pluginManager,
|
|
308
|
-
setupEvents: options.setupEvents,
|
|
309
|
-
fireEvents: options.fireEvents,
|
|
310
|
-
storyId
|
|
311
|
-
});
|
|
312
|
-
return () => {
|
|
313
|
-
pluginManager.capabilities.remove(capability.interface, capability.implementation);
|
|
314
|
-
void EffectEx2.runAndForwardErrors(pluginManager.shutdown());
|
|
315
|
-
};
|
|
316
|
-
}, [
|
|
317
|
-
storyId,
|
|
318
|
-
init
|
|
319
|
-
]);
|
|
320
|
-
if (!managerState || managerState.storyId !== storyId) {
|
|
321
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
322
|
-
}
|
|
323
|
-
return /* @__PURE__ */ React.createElement(WithPluginManagerApp, managerState);
|
|
324
|
-
};
|
|
325
|
-
};
|
|
326
|
-
var WithPluginManagerApp = ({ fireEvents, pluginManager, setupEvents, storyId }) => {
|
|
327
|
-
useAsyncEffect(async () => {
|
|
328
|
-
await Promise.all(fireEvents?.map((event) => pluginManager.activate(event)) ?? []);
|
|
329
|
-
}, [
|
|
330
|
-
fireEvents,
|
|
331
|
-
pluginManager,
|
|
332
|
-
storyId
|
|
333
|
-
]);
|
|
334
|
-
const App = useApp({
|
|
335
|
-
pluginManager,
|
|
336
|
-
setupEvents
|
|
337
|
-
});
|
|
338
|
-
return /* @__PURE__ */ React.createElement(App, null);
|
|
339
|
-
};
|
|
340
|
-
var storyMeta = plugin_exports.makeMeta({
|
|
341
|
-
key: DXN.make("org.dxos.appFramework.story"),
|
|
342
|
-
name: "Story",
|
|
343
|
-
tags: [
|
|
344
|
-
"system"
|
|
345
|
-
]
|
|
346
|
-
});
|
|
347
|
-
var StoryPlugin = plugin_exports.define(storyMeta).pipe(plugin_exports.addModule({
|
|
348
|
-
id: "Story",
|
|
349
|
-
activatesOn: activation_events_exports.Startup,
|
|
350
|
-
activate: () => Effect4.succeed([])
|
|
351
|
-
}), plugin_exports.make)();
|
|
352
|
-
export {
|
|
353
|
-
createTestApp,
|
|
354
|
-
fromPlugins,
|
|
355
|
-
makeOperationCapture,
|
|
356
|
-
setupPluginManager,
|
|
357
|
-
withPluginManager
|
|
358
|
-
};
|
|
359
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/harness.ts", "../../../../src/testing/operationCapture.ts", "../../../../src/testing/service.ts", "../../../../src/testing/withPluginManager.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Registry } from '@effect-atom/atom-react';\nimport * as Duration from 'effect/Duration';\nimport * as Effect from 'effect/Effect';\nimport * as PubSub from 'effect/PubSub';\nimport * as Queue from 'effect/Queue';\n\nimport { type Operation } from '@dxos/compute';\nimport { EffectEx } from '@dxos/effect';\nimport { invariant } from '@dxos/invariant';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { ActivationEvent, type Capability, type CapabilityManager, type Plugin, PluginManager } from '../core';\n\nexport type TestAppOptions = {\n /**\n * Plugins to register. Plugins whose `meta.profile.tags` includes `'system'` are treated as core\n * (force-enabled). For test convenience, plugins without a `'system'` tag are enabled by\n * default unless `enabled` is provided.\n */\n plugins: Plugin.Plugin[];\n /** Plugin ids that are enabled by default in addition to core. Defaults to all non-system plugin ids. */\n enabled?: string[];\n /** Additional activation events fired alongside SetupReactSurface. */\n setupEvents?: ActivationEvent.ActivationEvent[];\n /**\n * Whether to automatically fire SetupReactSurface + Startup during setup.\n * Defaults to true.\n */\n autoStart?: boolean;\n /**\n * Whether to register the PluginManager + AtomRegistry framework capabilities.\n * Defaults to true.\n */\n registerFrameworkCapabilities?: boolean;\n};\n\n/**\n * A running plugin manager plus helpers for driving it in tests.\n */\nexport interface TestHarness {\n readonly manager: PluginManager.PluginManager;\n readonly capabilities: CapabilityManager.CapabilityManager;\n readonly registry: Registry.Registry;\n\n /** Activate the given event. Equivalent to `manager.activate(event)`. */\n fire(event: ActivationEvent.ActivationEvent | string): Promise<boolean>;\n /** Re-activate all modules that were activated by the given event. */\n reset(event: ActivationEvent.ActivationEvent | string): Promise<boolean>;\n\n /** Returns the first contributed capability for the given interface. Throws if none are present. */\n get<T>(iface: Capability.InterfaceDef<T>): T;\n /** Returns all contributed capabilities for the given interface. */\n getAll<T>(iface: Capability.InterfaceDef<T>): T[];\n /** Waits until at least one capability is contributed for the given interface. */\n waitForCapability<T>(iface: Capability.InterfaceDef<T>, opts?: { timeout?: number }): Promise<T>;\n /** Waits until the given activation event has completed. */\n waitForEvent(event: ActivationEvent.ActivationEvent | string, opts?: { timeout?: number }): Promise<void>;\n\n /** Invokes an operation through the `Capabilities.OperationInvoker` capability. */\n invoke<I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I] : [input: I]): Promise<O>;\n\n /**\n * Waits for `Capabilities.ProcessManagerRuntime` and runs the given effect on it.\n * Convenience around `waitForCapability(ProcessManagerRuntime).runPromise(effect)`.\n */\n runPromise<A, E>(\n effect: Effect.Effect<A, E, Capabilities.ProcessManagerRuntimeServices>,\n options?: { readonly timeout?: number; readonly signal?: AbortSignal },\n ): Promise<A>;\n\n enable(id: string): Promise<boolean>;\n disable(id: string): Promise<boolean>;\n\n /** Shuts down the underlying plugin manager. */\n dispose(): Promise<void>;\n\n /** Async-disposable support so tests can use `await using harness = ...`. */\n [Symbol.asyncDispose](): Promise<void>;\n}\n\nconst DEFAULT_TIMEOUT_MS = 5_000;\n\n/**\n * Creates a TestHarness with the same bootstrap sequence that `useApp` performs,\n * minus the React provider tree.\n *\n * For Node-only tests, this is enough to fire activation events, read\n * capabilities, and invoke operations.\n *\n * For React tests, pass the returned harness to `render` or `renderSurface`\n * from `@dxos/app-framework/testing-react`.\n */\nexport const createTestApp = async (opts: TestAppOptions): Promise<TestHarness> => {\n const {\n plugins,\n enabled = plugins\n .filter(({ meta }) => !meta.profile.tags?.includes('system'))\n .map((plugin) => plugin.meta.profile.key),\n setupEvents = [],\n autoStart = true,\n registerFrameworkCapabilities = true,\n } = opts;\n\n const pluginLoader = (id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return { plugin };\n });\n\n const manager = PluginManager.make({ pluginLoader, plugins, enabled });\n\n if (registerFrameworkCapabilities) {\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'org.dxos.app-framework.plugin-manager',\n });\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'org.dxos.app-framework.atom-registry',\n });\n }\n\n if (autoStart) {\n try {\n await EffectEx.runAndForwardErrors(\n Effect.all([\n ...setupEvents.map((event) => manager.activate(event)),\n manager.activate(ActivationEvents.SetupReactSurface),\n manager.activate(ActivationEvents.Startup),\n ]),\n );\n } catch (err) {\n await EffectEx.runAndForwardErrors(manager.shutdown()).catch(() => undefined);\n throw err;\n }\n }\n\n return new TestHarnessImpl(manager);\n};\n\nclass TestHarnessImpl implements TestHarness {\n constructor(readonly manager: PluginManager.PluginManager) {}\n\n get capabilities(): CapabilityManager.CapabilityManager {\n return this.manager.capabilities;\n }\n\n get registry(): Registry.Registry {\n return this.manager.registry;\n }\n\n fire(event: ActivationEvent.ActivationEvent | string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.activate(event));\n }\n\n reset(event: ActivationEvent.ActivationEvent | string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.reset(event));\n }\n\n get<T>(iface: Capability.InterfaceDef<T>): T {\n return this.manager.capabilities.get(iface);\n }\n\n getAll<T>(iface: Capability.InterfaceDef<T>): T[] {\n return this.manager.capabilities.getAll(iface);\n }\n\n waitForCapability<T>(iface: Capability.InterfaceDef<T>, opts?: { timeout?: number }): Promise<T> {\n const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;\n return EffectEx.runAndForwardErrors(\n this.manager.capabilities.waitFor(iface).pipe(\n Effect.timeoutFail({\n duration: Duration.millis(timeout),\n onTimeout: () => timeoutError(iface.identifier),\n }),\n ),\n );\n }\n\n waitForEvent(event: ActivationEvent.ActivationEvent | string, opts?: { timeout?: number }): Promise<void> {\n const key = typeof event === 'string' ? event : ActivationEvent.eventKey(event);\n const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;\n\n const program = Effect.gen(this, function* () {\n const queue = yield* PubSub.subscribe(this.manager.activation);\n // Re-check after subscribing to avoid a race where the event fires\n // between the caller invoking this and the subscription being installed.\n if (this.manager.getEventsFired().includes(key)) {\n return;\n }\n while (true) {\n const message = yield* Queue.take(queue);\n if (message.event === key && message.state === 'activated') {\n return;\n }\n }\n }).pipe(\n Effect.scoped,\n Effect.timeoutFail({\n duration: Duration.millis(timeout),\n onTimeout: () => timeoutError(key),\n }),\n );\n\n return EffectEx.runAndForwardErrors(program);\n }\n\n async invoke<I, O>(op: Operation.Definition<I, O>, ...args: [input?: I]): Promise<O> {\n const invoker = await this.waitForCapability(Capabilities.OperationInvoker);\n const result = await invoker.invokePromise(op as any, ...(args as [any]));\n if (result.error) {\n throw result.error;\n }\n return result.data as O;\n }\n\n async runPromise<A, E>(\n effect: Effect.Effect<A, E, Capabilities.ProcessManagerRuntimeServices>,\n options?: { readonly timeout?: number; readonly signal?: AbortSignal },\n ): Promise<A> {\n const runtime = await this.waitForCapability(Capabilities.ProcessManagerRuntime, { timeout: options?.timeout });\n return runtime.runPromise(effect, options?.signal ? { signal: options.signal } : undefined);\n }\n\n enable(id: string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.enable(id));\n }\n\n disable(id: string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.disable(id));\n }\n\n async dispose(): Promise<void> {\n await EffectEx.runAndForwardErrors(this.manager.shutdown());\n }\n\n [Symbol.asyncDispose](): Promise<void> {\n return this.dispose();\n }\n}\n\nconst timeoutError = (id: string) => new Error(`Timed out waiting for ${id}`);\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { type Operation } from '@dxos/compute';\n\nimport { Capabilities } from '../common';\nimport { Capability } from '../core';\n\nexport type CapturedCall<I = unknown> = {\n /** The DXN key string of the invoked operation. */\n operationKey: string;\n /** The input passed to the operation. */\n input: I;\n};\n\ntype CapabilityManagerLike = {\n get: (cap: Capability.InterfaceDef<Capabilities.OperationInvoker>) => Capabilities.OperationInvoker;\n getAll: (cap: Capability.InterfaceDef<Capabilities.OperationInvoker>) => Capabilities.OperationInvoker[];\n};\n\nexport type OperationCapture = {\n /**\n * Wraps the real OperationInvoker from the given manager. Pass to\n * `withPluginManager({ capabilities: (m) => capture.wrap(m) })`.\n */\n wrap(manager: CapabilityManagerLike): Capability.Any[];\n /** Returns all recorded calls (mocked or real) for the given operation. */\n getCalls<I, O>(op: Operation.Definition<I, O>): CapturedCall<I>[];\n /** Clears all recorded calls (useful between play function steps). */\n reset(): void;\n};\n\n/**\n * Creates a capture that wraps the real `Capabilities.OperationInvoker`:\n *\n * - **Mocked operations** (declared in `mockedOperations`) are intercepted: the call is recorded\n * and returns `{ data: undefined }` without executing. Use this for side-effecting operations\n * you don't want to run in tests, such as `LayoutOperation.Open` (navigation).\n *\n * - **All other operations** are forwarded to the real invoker and still execute normally. The\n * call is still recorded so you can assert it was triggered even though it ran for real.\n *\n * Pass a `spyFn` wrapper (e.g. `fn` from `storybook/test`) to get Storybook Actions panel\n * integration and vi-style matchers on the recording.\n *\n * @example\n * ```ts\n * import { fn } from 'storybook/test';\n *\n * const capture = makeOperationCapture(\n * // These ops are mocked: captured but not executed.\n * [AssistantOperation.RunPromptInNewChat, LayoutOperation.Open],\n * fn,\n * );\n *\n * // Wire into withPluginManager:\n * capabilities: (manager) => capture.wrap(manager)\n *\n * // Assert in a play function:\n * const calls = capture.getCalls(AssistantOperation.RunPromptInNewChat);\n * expect(calls).toHaveLength(1);\n * expect(calls[0].input.prompt).toBe('Draft a new document');\n * ```\n *\n * @idiom org.dxos.app-framework.testing.operationCapture\n * applies: Storybook play-function tests for components that call plugin operations\n * instead-of: Loading every plugin whose operations the component triggers\n * uses: {@link makeOperationCapture}, {@link withPluginManager}\n */\nexport const makeOperationCapture = (\n mockedOperations: readonly Operation.Definition.Any[],\n spyFn?: (impl: (...args: any[]) => any) => any,\n): OperationCapture => {\n const calls: CapturedCall[] = [];\n\n const mockedKeys = new Set(mockedOperations.map((op) => String(op.meta.key)));\n\n const record = (op: Operation.Definition<any, any>, input?: unknown) => {\n calls.push({ operationKey: String(op.meta.key), input: input ?? {} });\n };\n\n const recordFn = spyFn ? spyFn(record) : record;\n\n return {\n wrap(manager) {\n // Use getAll to find the real invoker that was registered before our wrapper. manager.get\n // returns the last contribution (ours, once added), but getAll returns them all in order.\n // On first invocation (when activation is complete) we find the non-wrapper contribution.\n let real: Capabilities.OperationInvoker | undefined;\n const delegate = () => {\n if (!real) {\n const all = manager.getAll(Capabilities.OperationInvoker);\n real = all.find((inv) => inv !== wrapped);\n }\n return real;\n };\n\n const wrapped: Capabilities.OperationInvoker = {\n get invocations() {\n return delegate()!.invocations;\n },\n get pendingFollowups() {\n return delegate()!.pendingFollowups;\n },\n get awaitFollowups() {\n return delegate()!.awaitFollowups;\n },\n invoke: (op: Operation.Definition<any, any>, input?: unknown, ...rest: any[]) => {\n recordFn(op, input);\n if (mockedKeys.has(String(op.meta.key))) {\n return Effect.succeed(undefined as any);\n }\n return (delegate()!.invoke as any)(op, input, ...rest);\n },\n invokePromise: async (op: Operation.Definition<any, any>, input?: unknown, ...rest: any[]) => {\n recordFn(op, input);\n if (mockedKeys.has(String(op.meta.key))) {\n return { data: undefined };\n }\n return (delegate()!.invokePromise as any)(op, input, ...rest);\n },\n schedule: (op: Operation.Definition<any, any>, input?: unknown, ...rest: any[]) => {\n recordFn(op, input);\n if (mockedKeys.has(String(op.meta.key))) {\n return Effect.succeed(undefined);\n }\n return (delegate()!.schedule as any)(op, input, ...rest);\n },\n };\n\n return [Capability.contributes(Capabilities.OperationInvoker, wrapped)];\n },\n getCalls<I, O>(op: Operation.Definition<I, O>): CapturedCall<I>[] {\n const key = String(op.meta.key);\n return calls.filter((c) => c.operationKey === key) as CapturedCall<I>[];\n },\n reset() {\n calls.length = 0;\n },\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { Plugin, PluginManager } from '../core';\n\n/**\n * Creates a Plugin.Service layer from a list of plugins.\n * This is primarily used for testing.\n */\nexport const fromPlugins = (plugins: Plugin.Plugin[]) =>\n Layer.effect(\n Plugin.Service,\n Effect.gen(function* () {\n // TODO(wittjosiah): Try to dedupe logic between here, createCliApp and useApp.\n\n const pluginLoader = (id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return { plugin };\n });\n\n const manager = PluginManager.make({\n pluginLoader,\n plugins,\n enabled: plugins.map((plugin) => plugin.meta.profile.key),\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'org.dxos.app-framework.plugin-manager',\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'org.dxos.app-framework.atom-registry',\n });\n\n yield* manager.activate(ActivationEvents.Startup);\n\n return manager;\n }),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport * as Effect from 'effect/Effect';\nimport React, { useEffect, useState } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { EffectEx } from '@dxos/effect';\nimport { DXN } from '@dxos/keys';\nimport { useAsyncEffect } from '@dxos/react-hooks';\nimport { type MaybeProvider, getProviderValue } from '@dxos/util';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { type ActivationEvent, Capability, type CapabilityManager, Plugin, PluginManager } from '../core';\nimport { type UseAppOptions, useApp } from '../ui';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n ...options\n}: UseAppOptions & Pick<WithPluginManagerOptions, 'capabilities'> = {}) => {\n // Auto-enable every non-system plugin so stories don't have to spell out\n // enablement. System-tagged plugins are force-enabled by the manager.\n const enabled = plugins\n .filter(({ meta }) => !meta.profile.tags?.includes('system'))\n .map(({ meta }) => meta.profile.key);\n const pluginManager = PluginManager.make({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin, ...plugins],\n enabled,\n ...options,\n });\n\n if (capabilities) {\n getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {\n pluginManager.capabilities.contribute({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\ntype ManagedPluginManagerState = {\n fireEvents?: (ActivationEvent.ActivationEvent | string)[];\n pluginManager: PluginManager.PluginManager;\n setupEvents?: ActivationEvent.ActivationEvent[];\n storyId: string;\n};\n\nexport type WithPluginManagerOptions = UseAppOptions & {\n /** @deprecated */\n capabilities?: MaybeProvider<Capability.Any[], CapabilityManager.CapabilityManager>;\n /** @deprecated */\n fireEvents?: (ActivationEvent.ActivationEvent | string)[];\n};\n\nexport type WithPluginManagerInitializer<Args = void> =\n | WithPluginManagerOptions\n | ((context: StoryContext<Args>) => WithPluginManagerOptions);\n\n/**\n * Wraps a story with a plugin manager.\n * NOTE: This builds up and tears down the plugin manager on every render.\n */\nexport const withPluginManager = <Args,>(init: WithPluginManagerInitializer<Args> = {}): Decorator => {\n return (Story, context) => {\n const storyId = context.id;\n const options = typeof init === 'function' ? init(context as any) : init;\n const [managerState, setManagerState] = useState<ManagedPluginManagerState>();\n\n // Storybook replaces the full context object often, so key manager ownership by story id.\n useEffect(() => {\n const pluginManager = setupPluginManager(options);\n const capability = Capability.contributes(Capabilities.ReactRoot, {\n id: storyId,\n root: () => <Story />,\n });\n\n pluginManager.capabilities.contribute({\n ...capability,\n module: 'org.dxos.app-framework.with-plugin-manager',\n });\n\n setManagerState({\n pluginManager,\n setupEvents: options.setupEvents,\n fireEvents: options.fireEvents,\n storyId,\n });\n\n return () => {\n pluginManager.capabilities.remove(capability.interface, capability.implementation);\n void EffectEx.runAndForwardErrors(pluginManager.shutdown());\n };\n }, [storyId, init]);\n\n // Avoid mounting useApp with a stale manager from the previous story.\n if (!managerState || managerState.storyId !== storyId) {\n return <></>;\n }\n\n return <WithPluginManagerApp {...managerState} />;\n };\n};\n\nconst WithPluginManagerApp = ({ fireEvents, pluginManager, setupEvents, storyId }: ManagedPluginManagerState) => {\n // Fire deprecated events only after the effect-owned manager for this story exists.\n useAsyncEffect(async () => {\n await Promise.all(fireEvents?.map((event) => pluginManager.activate(event)) ?? []);\n }, [fireEvents, pluginManager, storyId]);\n\n const App = useApp({ pluginManager, setupEvents });\n return <App />;\n};\n\nconst storyMeta = Plugin.makeMeta({\n key: DXN.make('org.dxos.appFramework.story'),\n name: 'Story',\n tags: ['system'],\n});\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst StoryPlugin = Plugin.define(storyMeta).pipe(\n Plugin.addModule({\n id: 'Story',\n activatesOn: ActivationEvents.Startup,\n activate: () => Effect.succeed([]),\n }),\n Plugin.make,\n)();\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,YAAYA,cAAc;AAC1B,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AAGvB,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAwE1B,IAAA,eAAMC;;AAuBEC,IAAAA,gBACJC,OAAOC,SAAK;UACV,SAAMC,UAASC,QAAY,OAAED,CAAAA,EAAAA,KAAWA,MAAOE,CAAAA,KAAKC,QAAQC,MAAQC,SAAAA,QAAAA,CAAAA,EAAAA,IAAAA,CAAAA,WAAAA,OAAAA,KAAAA,QAAAA,GAAAA,GAAAA,cAAAA,CAAAA,GAAAA,YAAAA,MAAAA,gCAAAA,KAAAA,IAAAA;uBAC1DL,CAAAA,OAAS,YAAA,MAAA;AACnB,UAAA,SAAO,QAAA,KAAA,CAAAA,YAAAA,QAAA,KAAA,QAAA,Q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AAA,EAAWM,KAC3CL,eAAOM,UAAU;EACf/B,IAAI;EACJgC,aAAaC,0BAAiBC;EAC9Bb,UAAU,MAAac,gBAAQ,CAAA,CAAE;AACnC,CAAA,GACAV,eAAO1C,IAAI,EAAA;",
|
|
6
|
-
"names": ["Duration", "Effect", "PubSub", "Queue", "EffectEx", "invariant", "DEFAULT_TIMEOUT_MS", "pluginLoader", "Effect", "sync", "plugin", "plugins", "meta", "profile", "key", "id", "manager", "enabled", "registerFrameworkCapabilities", "PluginManager", "implementation", "module", "capabilities", "registry", "autoStart", "EffectEx", "activate", "SetupReactSurface", "ActivationEvents", "Startup", "err", "TestHarnessImpl", "fire", "reset", "iface", "getAll", "waitForCapability", "runAndForwardErrors", "duration", "Duration", "timeout", "onTimeout", "identifier", "waitForEvent", "opts", "program", "queue", "subscribe", "message", "timeoutError", "invoke", "args", "result", "invoker", "error", "data", "runPromise", "effect", "options", "runtime", "undefined", "enable", "disable", "dispose", "Symbol", "asyncDispose", "Effect", "makeOperationCapture", "mockedOperations", "spyFn", "calls", "mockedKeys", "Set", "map", "op", "String", "meta", "key", "record", "input", "push", "operationKey", "recordFn", "wrap", "manager", "real", "delegate", "all", "getAll", "Capabilities", "OperationInvoker", "find", "inv", "wrapped", "invocations", "pendingFollowups", "awaitFollowups", "invoke", "rest", "has", "succeed", "undefined", "invokePromise", "data", "schedule", "Capability", "contributes", "getCalls", "filter", "c", "reset", "length", "Effect", "Layer", "invariant", "__dxlog_file", "pluginLoader", "id", "plugin", "manager", "plugins", "enabled", "capabilities", "contribute", "implementation", "module", "registry", "Effect", "React", "useEffect", "useState", "raise", "EffectEx", "DXN", "useAsyncEffect", "getProviderValue", "setupPluginManager", "capabilities", "plugins", "options", "enabled", "filter", "meta", "profile", "tags", "includes", "map", "key", "pluginManager", "PluginManager", "make", "pluginLoader", "raise", "Error", "StoryPlugin", "getProviderValue", "forEach", "capability", "contribute", "interface", "implementation", "module", "withPluginManager", "init", "Story", "context", "storyId", "id", "managerState", "setManagerState", "useState", "useEffect", "Capability", "contributes", "Capabilities", "ReactRoot", "root", "setupEvents", "fireEvents", "remove", "EffectEx", "runAndForwardErrors", "shutdown", "WithPluginManagerApp", "useAsyncEffect", "Promise", "all", "event", "activate", "App", "useApp", "storyMeta", "Plugin", "makeMeta", "DXN", "name", "define", "pipe", "addModule", "activatesOn", "ActivationEvents", "Startup", "succeed"]
|
|
7
|
-
}
|