@dxos/app-framework 0.8.3 → 0.8.4-main.1f223c7
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/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/README.md +0 -8
- package/dist/lib/browser/{app-graph-builder-BI4VVKSW.mjs → app-graph-builder-AFFC6VB2.mjs} +5 -5
- package/dist/lib/browser/app-graph-builder-AFFC6VB2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WWEJRWFX.mjs → chunk-ORWHM7CO.mjs} +2 -2
- package/dist/lib/browser/{chunk-EHM4UI3V.mjs → chunk-OZY7HV2A.mjs} +396 -271
- package/dist/lib/browser/chunk-OZY7HV2A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DIBVO47Z.mjs → chunk-T6M7JB7M.mjs} +194 -129
- package/dist/lib/browser/chunk-T6M7JB7M.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +16 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs → intent-dispatcher-QG7UPGQX.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-3QMBXLIY.mjs → intent-resolver-4S4PSTM5.mjs} +4 -4
- package/dist/lib/browser/intent-resolver-4S4PSTM5.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-5H7XPJGA.mjs → store-6E33KLGK.mjs} +3 -3
- package/dist/lib/browser/{store-5H7XPJGA.mjs.map → store-6E33KLGK.mjs.map} +1 -1
- package/dist/lib/browser/testing/index.mjs +6 -8
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +7 -1
- package/dist/lib/node-esm/{app-graph-builder-NROP6RPQ.mjs → app-graph-builder-S4OAULX5.mjs} +5 -5
- package/dist/lib/node-esm/app-graph-builder-S4OAULX5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2J6FVECI.mjs → chunk-F63ZRXMK.mjs} +396 -271
- package/dist/lib/node-esm/chunk-F63ZRXMK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FHNZZWP4.mjs → chunk-HJFU7QOR.mjs} +194 -129
- package/dist/lib/node-esm/chunk-HJFU7QOR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs → chunk-UMZQERLE.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +16 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs → intent-dispatcher-NXBGPJOX.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-VY4X5UHN.mjs → intent-resolver-2ZKXI5ET.mjs} +4 -4
- package/dist/lib/node-esm/intent-resolver-2ZKXI5ET.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-UKD2R2KA.mjs → store-QQUTQHHT.mjs} +3 -3
- package/dist/lib/node-esm/{store-UKD2R2KA.mjs.map → store-QQUTQHHT.mjs.map} +1 -1
- package/dist/lib/node-esm/testing/index.mjs +6 -8
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +7 -1
- package/dist/types/src/common/capabilities.d.ts +78 -9
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +9 -8
- package/dist/types/src/common/collaboration.d.ts.map +1 -1
- package/dist/types/src/common/events.d.ts.map +1 -1
- package/dist/types/src/common/surface.d.ts +1 -1
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/components/App.d.ts +10 -0
- package/dist/types/src/components/App.d.ts.map +1 -0
- package/dist/types/src/components/App.stories.d.ts +15 -0
- package/dist/types/src/components/App.stories.d.ts.map +1 -0
- package/dist/types/src/components/DefaultFallback.d.ts +8 -0
- package/dist/types/src/components/DefaultFallback.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/{App.d.ts → components/useApp.d.ts} +7 -6
- package/dist/types/src/components/useApp.d.ts.map +1 -0
- package/dist/types/src/components/useLoading.d.ts +19 -0
- package/dist/types/src/components/useLoading.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.d.ts +4 -1
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts +6 -2
- package/dist/types/src/core/manager.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +1 -1
- package/dist/types/src/playground/generator/Main.d.ts +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/layout/Layout.d.ts +2 -2
- package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts +5 -3
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/index.d.ts +1 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +3 -3
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/store.d.ts +1 -1
- package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/translations.d.ts +7 -8
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
- package/dist/types/src/react/IntentContext.d.ts.map +1 -1
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +6 -4
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
- package/dist/types/src/react/common.d.ts.map +1 -1
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts +4 -2
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +14 -0
- package/package.json +32 -28
- package/src/common/capabilities.ts +98 -11
- package/src/common/collaboration.ts +5 -8
- package/src/common/events.ts +3 -1
- package/src/common/surface.ts +1 -1
- package/src/components/App.stories.tsx +35 -0
- package/src/components/App.tsx +59 -0
- package/src/components/DefaultFallback.tsx +26 -0
- package/src/components/index.ts +5 -0
- package/src/{App.tsx → components/useApp.tsx} +20 -130
- package/src/components/useLoading.tsx +70 -0
- package/src/core/capabilities.test.ts +1 -1
- package/src/core/capabilities.ts +11 -6
- package/src/core/manager.test.ts +5 -5
- package/src/core/manager.ts +132 -54
- package/src/helpers.test.ts +1 -1
- package/src/index.ts +1 -1
- package/src/playground/debug/Debug.tsx +1 -1
- package/src/playground/generator/Toolbar.tsx +2 -1
- package/src/playground/generator/generator.ts +2 -2
- package/src/playground/layout/plugin.ts +1 -1
- package/src/playground/logger/Toolbar.tsx +2 -1
- package/src/playground/logger/plugin.ts +3 -2
- package/src/playground/playground.stories.tsx +15 -10
- package/src/plugin-intent/IntentPlugin.ts +2 -1
- package/src/plugin-intent/index.ts +1 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +1 -1
- package/src/plugin-intent/intent-dispatcher.ts +10 -8
- package/src/plugin-settings/SettingsPlugin.ts +3 -2
- package/src/plugin-settings/app-graph-builder.ts +4 -3
- package/src/plugin-settings/intent-resolver.ts +3 -2
- package/src/plugin-settings/store.ts +1 -1
- package/src/plugin-settings/translations.ts +4 -2
- package/src/react/ErrorBoundary.tsx +24 -15
- package/src/react/IntentContext.tsx +3 -2
- package/src/react/Surface.stories.tsx +21 -13
- package/src/react/Surface.tsx +4 -3
- package/src/react/common.ts +2 -1
- package/src/react/useCapabilities.ts +2 -1
- package/src/testing/withPluginManager.stories.tsx +9 -5
- package/src/testing/withPluginManager.tsx +13 -13
- package/tsconfig.json +5 -9
- package/vitest.config.ts +5 -2
- package/.eslintrc.cjs +0 -9
- package/README.yml +0 -5
- package/dist/lib/browser/app-graph-builder-BI4VVKSW.mjs.map +0 -7
- package/dist/lib/browser/chunk-DIBVO47Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-EHM4UI3V.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3QMBXLIY.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs +0 -146
- package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs.map +0 -7
- package/dist/lib/node/chunk-G774ASXO.cjs +0 -58
- package/dist/lib/node/chunk-G774ASXO.cjs.map +0 -7
- package/dist/lib/node/chunk-VSOSVDQ3.cjs +0 -1551
- package/dist/lib/node/chunk-VSOSVDQ3.cjs.map +0 -7
- package/dist/lib/node/chunk-YGAY3H34.cjs +0 -429
- package/dist/lib/node/chunk-YGAY3H34.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -193
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs +0 -32
- package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-IOJDYO34.cjs +0 -46
- package/dist/lib/node/intent-resolver-IOJDYO34.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/store-ESF5VR57.cjs +0 -45
- package/dist/lib/node/store-ESF5VR57.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -119
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node/worker.cjs +0 -101
- package/dist/lib/node/worker.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NROP6RPQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2J6FVECI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FHNZZWP4.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VY4X5UHN.mjs.map +0 -7
- package/dist/types/src/App.d.ts.map +0 -1
- package/project.json +0 -29
- package/typedoc/.nojekyll +0 -1
- package/typedoc/assets/hierarchy.js +0 -1
- package/typedoc/assets/highlight.css +0 -106
- package/typedoc/assets/icons.js +0 -18
- package/typedoc/assets/icons.svg +0 -1
- package/typedoc/assets/main.js +0 -60
- package/typedoc/assets/navigation.js +0 -1
- package/typedoc/assets/search.js +0 -1
- package/typedoc/assets/style.css +0 -1640
- package/typedoc/classes/CollaborationActions.InsertContent.html +0 -421
- package/typedoc/classes/ErrorBoundary.html +0 -125
- package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
- package/typedoc/classes/IntentAction.Track.html +0 -266
- package/typedoc/classes/LayoutAction.AddToast.html +0 -265
- package/typedoc/classes/LayoutAction.Close.html +0 -382
- package/typedoc/classes/LayoutAction.Expose.html +0 -265
- package/typedoc/classes/LayoutAction.Open.html +0 -1123
- package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
- package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
- package/typedoc/classes/LayoutAction.Set.html +0 -460
- package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
- package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
- package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
- package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -1123
- package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
- package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
- package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
- package/typedoc/classes/Plugin.html +0 -6
- package/typedoc/classes/PluginContext.html +0 -38
- package/typedoc/classes/PluginManager.html +0 -43
- package/typedoc/classes/PluginModule.html +0 -18
- package/typedoc/classes/SettingsAction.Open.html +0 -226
- package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
- package/typedoc/functions/Events.createStateEvent.html +0 -2
- package/typedoc/functions/IntentPlugin.html +0 -1
- package/typedoc/functions/SettingsPlugin.html +0 -1
- package/typedoc/functions/allOf.html +0 -2
- package/typedoc/functions/chain.html +0 -3
- package/typedoc/functions/contributes.html +0 -2
- package/typedoc/functions/createDispatcher.html +0 -3
- package/typedoc/functions/createIntent.html +0 -6
- package/typedoc/functions/createResolver.html +0 -2
- package/typedoc/functions/createSurface.html +0 -2
- package/typedoc/functions/defineCapability.html +0 -2
- package/typedoc/functions/defineEvent.html +0 -2
- package/typedoc/functions/defineModule.html +0 -2
- package/typedoc/functions/definePlugin.html +0 -2
- package/typedoc/functions/eventKey.html +0 -2
- package/typedoc/functions/getEvents.html +0 -2
- package/typedoc/functions/isAllOf.html +0 -2
- package/typedoc/functions/isOneOf.html +0 -2
- package/typedoc/functions/isSurfaceAvailable.html +0 -2
- package/typedoc/functions/lazy.html +0 -2
- package/typedoc/functions/oneOf.html +0 -2
- package/typedoc/functions/useApp.html +0 -6
- package/typedoc/functions/useAppGraph.html +0 -1
- package/typedoc/functions/useCapabilities.html +0 -3
- package/typedoc/functions/useCapability.html +0 -4
- package/typedoc/functions/useIntentDispatcher.html +0 -1
- package/typedoc/functions/useIntentResolver.html +0 -1
- package/typedoc/functions/useLayout.html +0 -1
- package/typedoc/functions/usePluginManager.html +0 -2
- package/typedoc/hierarchy.html +0 -1
- package/typedoc/index.html +0 -16
- package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
- package/typedoc/media/LICENSE +0 -8
- package/typedoc/modules/Capabilities.html +0 -1
- package/typedoc/modules/CollaborationActions.html +0 -1
- package/typedoc/modules/Events.html +0 -1
- package/typedoc/modules/IntentAction.html +0 -1
- package/typedoc/modules/LayoutAction.html +0 -2
- package/typedoc/modules/SettingsAction.html +0 -1
- package/typedoc/modules.html +0 -1
- package/typedoc/types/ActivationEvent.html +0 -8
- package/typedoc/types/ActivationEvents.html +0 -2
- package/typedoc/types/AnyCapability.html +0 -1
- package/typedoc/types/AnyIntent.html +0 -1
- package/typedoc/types/AnyIntentChain.html +0 -1
- package/typedoc/types/AnyIntentEffectResult.html +0 -1
- package/typedoc/types/AnyIntentResolver.html +0 -1
- package/typedoc/types/AnyIntentResult.html +0 -1
- package/typedoc/types/Capabilities.FileUploader.html +0 -1
- package/typedoc/types/Capabilities.IntentResolver.html +0 -1
- package/typedoc/types/Capabilities.Layout.html +0 -1
- package/typedoc/types/Capabilities.Metadata.html +0 -1
- package/typedoc/types/Capabilities.ReactContext.html +0 -1
- package/typedoc/types/Capabilities.ReactRoot.html +0 -1
- package/typedoc/types/Capabilities.ReactSurface.html +0 -1
- package/typedoc/types/Capabilities.Settings.html +0 -4
- package/typedoc/types/Capability.html +0 -9
- package/typedoc/types/CreateAppOptions.html +0 -10
- package/typedoc/types/FileInfo.html +0 -1
- package/typedoc/types/Intent.html +0 -10
- package/typedoc/types/IntentChain.html +0 -6
- package/typedoc/types/IntentContext.html +0 -5
- package/typedoc/types/IntentData.html +0 -1
- package/typedoc/types/IntentDispatcher.html +0 -2
- package/typedoc/types/IntentDispatcherResult.html +0 -2
- package/typedoc/types/IntentEffectDefinition.html +0 -2
- package/typedoc/types/IntentEffectResult.html +0 -15
- package/typedoc/types/IntentParams.html +0 -3
- package/typedoc/types/IntentResolver.html +0 -2
- package/typedoc/types/IntentResultData.html +0 -1
- package/typedoc/types/IntentSchema.html +0 -1
- package/typedoc/types/IntentUndo.html +0 -2
- package/typedoc/types/InterfaceDef.html +0 -4
- package/typedoc/types/Label.html +0 -1
- package/typedoc/types/NodeSerializer.html +0 -8
- package/typedoc/types/PluginManagerOptions.html +0 -6
- package/typedoc/types/PluginMeta.html +0 -21
- package/typedoc/types/PromiseIntentDispatcher.html +0 -2
- package/typedoc/types/PromiseIntentUndo.html +0 -2
- package/typedoc/types/Resource.html +0 -1
- package/typedoc/types/ResourceKey.html +0 -1
- package/typedoc/types/ResourceLanguage.html +0 -1
- package/typedoc/types/SerializedNode.html +0 -4
- package/typedoc/types/SurfaceComponent.html +0 -2
- package/typedoc/types/SurfaceDefinition.html +0 -2
- package/typedoc/types/SurfaceProps.html +0 -4
- package/typedoc/variables/Capabilities.AnchorSort.html +0 -1
- package/typedoc/variables/Capabilities.AppGraph.html +0 -1
- package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
- package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
- package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
- package/typedoc/variables/Capabilities.FileUploader.html +0 -1
- package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
- package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
- package/typedoc/variables/Capabilities.Layout.html +0 -1
- package/typedoc/variables/Capabilities.Metadata.html +0 -1
- package/typedoc/variables/Capabilities.Null.html +0 -1
- package/typedoc/variables/Capabilities.PluginManager.html +0 -1
- package/typedoc/variables/Capabilities.ReactContext.html +0 -1
- package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
- package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
- package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
- package/typedoc/variables/Capabilities.Settings.html +0 -1
- package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
- package/typedoc/variables/Capabilities.Tools.html +0 -1
- package/typedoc/variables/Capabilities.Translations.html +0 -1
- package/typedoc/variables/Events.AppGraphReady.html +0 -2
- package/typedoc/variables/Events.DispatcherReady.html +0 -2
- package/typedoc/variables/Events.LayoutReady.html +0 -1
- package/typedoc/variables/Events.SettingsReady.html +0 -2
- package/typedoc/variables/Events.SetupAppGraph.html +0 -2
- package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
- package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
- package/typedoc/variables/Events.SetupMetadata.html +0 -2
- package/typedoc/variables/Events.SetupReactSurface.html +0 -2
- package/typedoc/variables/Events.SetupSettings.html +0 -2
- package/typedoc/variables/Events.SetupTranslations.html +0 -2
- package/typedoc/variables/Events.Startup.html +0 -2
- package/typedoc/variables/FileInfoSchema.html +0 -1
- package/typedoc/variables/INTENT_ACTION.html +0 -1
- package/typedoc/variables/INTENT_PLUGIN.html +0 -1
- package/typedoc/variables/LAYOUT_ACTION.html +0 -1
- package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
- package/typedoc/variables/Label.html +0 -1
- package/typedoc/variables/LayoutAction.Toast.html +0 -1
- package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
- package/typedoc/variables/PluginManagerProvider.html +0 -2
- package/typedoc/variables/Resource.html +0 -2
- package/typedoc/variables/ResourceKey.html +0 -1
- package/typedoc/variables/ResourceLanguage.html +0 -1
- package/typedoc/variables/SETTINGS_ACTION.html +0 -1
- package/typedoc/variables/SETTINGS_ID.html +0 -1
- package/typedoc/variables/SETTINGS_KEY.html +0 -1
- package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
- package/typedoc/variables/Surface.html +0 -2
- package/typedoc/variables/defaultFileTypes.html +0 -1
- /package/dist/lib/browser/{chunk-WWEJRWFX.mjs.map → chunk-ORWHM7CO.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs.map → intent-dispatcher-QG7UPGQX.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs.map → chunk-UMZQERLE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs.map → intent-dispatcher-NXBGPJOX.mjs.map} +0 -0
|
@@ -1,110 +1,29 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { Effect as Effect3, Option,
|
|
1
|
+
// src/plugin-intent/intent-dispatcher.ts
|
|
2
|
+
import { Effect as Effect3, Option, Ref as Ref2, pipe as pipe2 } from "effect";
|
|
3
3
|
import { live as live2 } from "@dxos/live-object";
|
|
4
4
|
import { log as log3 } from "@dxos/log";
|
|
5
5
|
import { byPosition } from "@dxos/util";
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
import { Schema as Schema2 } from "effect";
|
|
9
|
-
|
|
10
|
-
// packages/sdk/app-framework/src/plugin-intent/intent.ts
|
|
11
|
-
import { Schema } from "effect";
|
|
12
|
-
var createIntent = (schema, data = {}, params = {}) => {
|
|
13
|
-
const _ = Schema.validateSync(schema.fields.input)(data);
|
|
14
|
-
const intent = {
|
|
15
|
-
...params,
|
|
16
|
-
_schema: schema,
|
|
17
|
-
id: schema._tag,
|
|
18
|
-
data
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
first: intent,
|
|
22
|
-
last: intent,
|
|
23
|
-
all: [
|
|
24
|
-
intent
|
|
25
|
-
]
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
29
|
-
const intents = "all" in intent ? intent.all : [
|
|
30
|
-
intent
|
|
31
|
-
];
|
|
32
|
-
const first = intents[0];
|
|
33
|
-
const last = {
|
|
34
|
-
...params,
|
|
35
|
-
_schema: schema,
|
|
36
|
-
id: schema._tag,
|
|
37
|
-
data
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
first,
|
|
41
|
-
last,
|
|
42
|
-
all: [
|
|
43
|
-
...intents,
|
|
44
|
-
last
|
|
45
|
-
]
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.String, Schema.mutable(Schema.Struct({
|
|
49
|
-
ns: Schema.String,
|
|
50
|
-
count: Schema.optional(Schema.Number),
|
|
51
|
-
defaultValue: Schema.optional(Schema.String)
|
|
52
|
-
})))));
|
|
53
|
-
|
|
54
|
-
// packages/sdk/app-framework/src/plugin-intent/actions.ts
|
|
55
|
-
var INTENT_PLUGIN = "dxos.org/plugin/intent";
|
|
56
|
-
var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
57
|
-
(function(IntentAction2) {
|
|
58
|
-
class Track extends Schema2.TaggedClass()(`${INTENT_ACTION}/track`, {
|
|
59
|
-
input: Schema2.Struct({
|
|
60
|
-
intents: Schema2.Array(Schema2.String),
|
|
61
|
-
error: Schema2.optional(Schema2.String)
|
|
62
|
-
}),
|
|
63
|
-
output: Schema2.Void
|
|
64
|
-
}) {
|
|
65
|
-
}
|
|
66
|
-
IntentAction2.Track = Track;
|
|
67
|
-
class ShowUndo extends Schema2.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
|
|
68
|
-
input: Schema2.Struct({
|
|
69
|
-
message: Label
|
|
70
|
-
}),
|
|
71
|
-
output: Schema2.Void
|
|
72
|
-
}) {
|
|
73
|
-
}
|
|
74
|
-
IntentAction2.ShowUndo = ShowUndo;
|
|
75
|
-
})(IntentAction || (IntentAction = {}));
|
|
76
|
-
var IntentAction;
|
|
77
|
-
|
|
78
|
-
// packages/sdk/app-framework/src/plugin-intent/errors.ts
|
|
79
|
-
var BaseError = class extends Error {
|
|
80
|
-
constructor(code, message, context) {
|
|
81
|
-
super(message ?? code, {
|
|
82
|
-
cause: context
|
|
83
|
-
}), this.code = code, this.context = context;
|
|
84
|
-
this.name = code;
|
|
85
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
var NoResolversError = class extends BaseError {
|
|
89
|
-
constructor(action) {
|
|
90
|
-
super("NO_RESOLVERS", "No resolvers were found for the action", {
|
|
91
|
-
action
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var CycleDetectedError = class extends BaseError {
|
|
96
|
-
constructor(context) {
|
|
97
|
-
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// packages/sdk/app-framework/src/core/capabilities.ts
|
|
7
|
+
// src/core/capabilities.ts
|
|
102
8
|
import { Rx } from "@effect-rx/rx-react";
|
|
103
9
|
import { Effect } from "effect";
|
|
104
10
|
import { Trigger } from "@dxos/async";
|
|
105
11
|
import { invariant } from "@dxos/invariant";
|
|
106
12
|
import { log } from "@dxos/log";
|
|
107
|
-
|
|
13
|
+
function _define_property(obj, key, value) {
|
|
14
|
+
if (key in obj) {
|
|
15
|
+
Object.defineProperty(obj, key, {
|
|
16
|
+
value,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
obj[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
|
|
108
27
|
var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
|
|
109
28
|
var defineCapability = (identifier) => {
|
|
110
29
|
return {
|
|
@@ -113,6 +32,8 @@ var defineCapability = (identifier) => {
|
|
|
113
32
|
};
|
|
114
33
|
var CapabilityImpl = class {
|
|
115
34
|
constructor(moduleId, implementation) {
|
|
35
|
+
_define_property(this, "moduleId", void 0);
|
|
36
|
+
_define_property(this, "implementation", void 0);
|
|
116
37
|
this.moduleId = moduleId;
|
|
117
38
|
this.implementation = implementation;
|
|
118
39
|
}
|
|
@@ -129,35 +50,6 @@ var lazy = (c) => async (props) => {
|
|
|
129
50
|
return async () => getCapability(props);
|
|
130
51
|
};
|
|
131
52
|
var PluginContext = class {
|
|
132
|
-
constructor({ registry, activate, reset }) {
|
|
133
|
-
this._capabilityImpls = Rx.family(() => {
|
|
134
|
-
return Rx.make([]).pipe(Rx.keepAlive);
|
|
135
|
-
});
|
|
136
|
-
this._capabilities = Rx.family((id) => {
|
|
137
|
-
return Rx.make((get) => {
|
|
138
|
-
const current = get(this._capabilityImpls(id));
|
|
139
|
-
return current.map((c) => c.implementation);
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
this._capability = Rx.family((id) => {
|
|
143
|
-
return Rx.make((get) => {
|
|
144
|
-
const current = get(this._capabilities(id));
|
|
145
|
-
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
146
|
-
F: __dxlog_file,
|
|
147
|
-
L: 117,
|
|
148
|
-
S: this,
|
|
149
|
-
A: [
|
|
150
|
-
"current.length > 0",
|
|
151
|
-
"`No capability found for ${id}`"
|
|
152
|
-
]
|
|
153
|
-
});
|
|
154
|
-
return current[0];
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
this._registry = registry;
|
|
158
|
-
this.activate = activate;
|
|
159
|
-
this.reset = reset;
|
|
160
|
-
}
|
|
161
53
|
/**
|
|
162
54
|
* @internal
|
|
163
55
|
*/
|
|
@@ -177,7 +69,7 @@ var PluginContext = class {
|
|
|
177
69
|
count: current.length
|
|
178
70
|
}, {
|
|
179
71
|
F: __dxlog_file,
|
|
180
|
-
L:
|
|
72
|
+
L: 166,
|
|
181
73
|
S: this,
|
|
182
74
|
C: (f, a) => f(...a)
|
|
183
75
|
});
|
|
@@ -198,7 +90,7 @@ var PluginContext = class {
|
|
|
198
90
|
count: current.length
|
|
199
91
|
}, {
|
|
200
92
|
F: __dxlog_file,
|
|
201
|
-
L:
|
|
93
|
+
L: 185,
|
|
202
94
|
S: this,
|
|
203
95
|
C: (f, a) => f(...a)
|
|
204
96
|
});
|
|
@@ -207,7 +99,7 @@ var PluginContext = class {
|
|
|
207
99
|
id: interfaceDef.identifier
|
|
208
100
|
}, {
|
|
209
101
|
F: __dxlog_file,
|
|
210
|
-
L:
|
|
102
|
+
L: 187,
|
|
211
103
|
S: this,
|
|
212
104
|
C: (f, a) => f(...a)
|
|
213
105
|
});
|
|
@@ -272,9 +164,41 @@ var PluginContext = class {
|
|
|
272
164
|
async resetPromise(event) {
|
|
273
165
|
return this.reset(event).pipe(Effect.runPromise);
|
|
274
166
|
}
|
|
167
|
+
constructor({ registry, activate, reset }) {
|
|
168
|
+
_define_property(this, "_registry", void 0);
|
|
169
|
+
_define_property(this, "_capabilityImpls", Rx.family(() => {
|
|
170
|
+
return Rx.make([]).pipe(Rx.keepAlive);
|
|
171
|
+
}));
|
|
172
|
+
_define_property(this, "_capabilities", Rx.family((id) => {
|
|
173
|
+
return Rx.make((get) => {
|
|
174
|
+
const current = get(this._capabilityImpls(id));
|
|
175
|
+
return current.map((c) => c.implementation);
|
|
176
|
+
});
|
|
177
|
+
}));
|
|
178
|
+
_define_property(this, "_capability", Rx.family((id) => {
|
|
179
|
+
return Rx.make((get) => {
|
|
180
|
+
const current = get(this._capabilities(id));
|
|
181
|
+
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
182
|
+
F: __dxlog_file,
|
|
183
|
+
L: 122,
|
|
184
|
+
S: this,
|
|
185
|
+
A: [
|
|
186
|
+
"current.length > 0",
|
|
187
|
+
"`No capability found for ${id}`"
|
|
188
|
+
]
|
|
189
|
+
});
|
|
190
|
+
return current[0];
|
|
191
|
+
});
|
|
192
|
+
}));
|
|
193
|
+
_define_property(this, "activate", void 0);
|
|
194
|
+
_define_property(this, "reset", void 0);
|
|
195
|
+
this._registry = registry;
|
|
196
|
+
this.activate = activate;
|
|
197
|
+
this.reset = reset;
|
|
198
|
+
}
|
|
275
199
|
};
|
|
276
200
|
|
|
277
|
-
//
|
|
201
|
+
// src/core/events.ts
|
|
278
202
|
var defineEvent = (id, specifier) => {
|
|
279
203
|
return {
|
|
280
204
|
id,
|
|
@@ -296,41 +220,31 @@ var getEvents = (events) => "type" in events ? events.events : [
|
|
|
296
220
|
events
|
|
297
221
|
];
|
|
298
222
|
|
|
299
|
-
//
|
|
223
|
+
// src/core/manager.ts
|
|
300
224
|
import { Registry } from "@effect-rx/rx-react";
|
|
301
225
|
import { untracked } from "@preact/signals-core";
|
|
302
|
-
import { Array
|
|
226
|
+
import { Array, Duration, Effect as Effect2, Fiber, HashSet, Match, Ref, pipe } from "effect";
|
|
303
227
|
import { Event } from "@dxos/async";
|
|
304
228
|
import { live } from "@dxos/live-object";
|
|
305
229
|
import { log as log2 } from "@dxos/log";
|
|
306
|
-
|
|
230
|
+
function _define_property2(obj, key, value) {
|
|
231
|
+
if (key in obj) {
|
|
232
|
+
Object.defineProperty(obj, key, {
|
|
233
|
+
value,
|
|
234
|
+
enumerable: true,
|
|
235
|
+
configurable: true,
|
|
236
|
+
writable: true
|
|
237
|
+
});
|
|
238
|
+
} else {
|
|
239
|
+
obj[key] = value;
|
|
240
|
+
}
|
|
241
|
+
return obj;
|
|
242
|
+
}
|
|
243
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
|
|
307
244
|
var isPromise = (value) => {
|
|
308
245
|
return value !== null && typeof value === "object" && "then" in value;
|
|
309
246
|
};
|
|
310
247
|
var PluginManager = class {
|
|
311
|
-
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
|
|
312
|
-
this.activation = new Event();
|
|
313
|
-
this._capabilities = /* @__PURE__ */ new Map();
|
|
314
|
-
this.registry = registry ?? Registry.make();
|
|
315
|
-
this.context = new PluginContext({
|
|
316
|
-
registry: this.registry,
|
|
317
|
-
activate: (event) => this._activate(event),
|
|
318
|
-
reset: (id) => this._reset(id)
|
|
319
|
-
});
|
|
320
|
-
this._pluginLoader = pluginLoader;
|
|
321
|
-
this._state = live({
|
|
322
|
-
plugins,
|
|
323
|
-
core,
|
|
324
|
-
enabled,
|
|
325
|
-
modules: [],
|
|
326
|
-
active: [],
|
|
327
|
-
pendingReset: [],
|
|
328
|
-
eventsFired: []
|
|
329
|
-
});
|
|
330
|
-
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
331
|
-
core.forEach((id) => this.enable(id));
|
|
332
|
-
enabled.forEach((id) => this.enable(id));
|
|
333
|
-
}
|
|
334
248
|
/**
|
|
335
249
|
* Plugins that are currently registered.
|
|
336
250
|
*
|
|
@@ -397,7 +311,7 @@ var PluginManager = class {
|
|
|
397
311
|
id
|
|
398
312
|
}, {
|
|
399
313
|
F: __dxlog_file2,
|
|
400
|
-
L:
|
|
314
|
+
L: 157,
|
|
401
315
|
S: this,
|
|
402
316
|
C: (f, a) => f(...a)
|
|
403
317
|
});
|
|
@@ -416,7 +330,7 @@ var PluginManager = class {
|
|
|
416
330
|
id
|
|
417
331
|
}, {
|
|
418
332
|
F: __dxlog_file2,
|
|
419
|
-
L:
|
|
333
|
+
L: 170,
|
|
420
334
|
S: this,
|
|
421
335
|
C: (f, a) => f(...a)
|
|
422
336
|
});
|
|
@@ -437,7 +351,7 @@ var PluginManager = class {
|
|
|
437
351
|
]
|
|
438
352
|
}, {
|
|
439
353
|
F: __dxlog_file2,
|
|
440
|
-
L:
|
|
354
|
+
L: 185,
|
|
441
355
|
S: this,
|
|
442
356
|
C: (f, a) => f(...a)
|
|
443
357
|
});
|
|
@@ -457,7 +371,7 @@ var PluginManager = class {
|
|
|
457
371
|
id
|
|
458
372
|
}, {
|
|
459
373
|
F: __dxlog_file2,
|
|
460
|
-
L:
|
|
374
|
+
L: 203,
|
|
461
375
|
S: this,
|
|
462
376
|
C: (f, a) => f(...a)
|
|
463
377
|
});
|
|
@@ -479,7 +393,7 @@ var PluginManager = class {
|
|
|
479
393
|
id
|
|
480
394
|
}, {
|
|
481
395
|
F: __dxlog_file2,
|
|
482
|
-
L:
|
|
396
|
+
L: 220,
|
|
483
397
|
S: this,
|
|
484
398
|
C: (f, a) => f(...a)
|
|
485
399
|
});
|
|
@@ -531,7 +445,7 @@ var PluginManager = class {
|
|
|
531
445
|
id: plugin.meta.id
|
|
532
446
|
}, {
|
|
533
447
|
F: __dxlog_file2,
|
|
534
|
-
L:
|
|
448
|
+
L: 273,
|
|
535
449
|
S: this,
|
|
536
450
|
C: (f, a) => f(...a)
|
|
537
451
|
});
|
|
@@ -546,7 +460,7 @@ var PluginManager = class {
|
|
|
546
460
|
id
|
|
547
461
|
}, {
|
|
548
462
|
F: __dxlog_file2,
|
|
549
|
-
L:
|
|
463
|
+
L: 283,
|
|
550
464
|
S: this,
|
|
551
465
|
C: (f, a) => f(...a)
|
|
552
466
|
});
|
|
@@ -562,7 +476,7 @@ var PluginManager = class {
|
|
|
562
476
|
id: module.id
|
|
563
477
|
}, {
|
|
564
478
|
F: __dxlog_file2,
|
|
565
|
-
L:
|
|
479
|
+
L: 293,
|
|
566
480
|
S: this,
|
|
567
481
|
C: (f, a) => f(...a)
|
|
568
482
|
});
|
|
@@ -577,7 +491,7 @@ var PluginManager = class {
|
|
|
577
491
|
id
|
|
578
492
|
}, {
|
|
579
493
|
F: __dxlog_file2,
|
|
580
|
-
L:
|
|
494
|
+
L: 303,
|
|
581
495
|
S: this,
|
|
582
496
|
C: (f, a) => f(...a)
|
|
583
497
|
});
|
|
@@ -605,13 +519,13 @@ var PluginManager = class {
|
|
|
605
519
|
_setPendingResetByModule(module) {
|
|
606
520
|
return untracked(() => {
|
|
607
521
|
const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._state.eventsFired.includes(key));
|
|
608
|
-
const pendingReset = Array.
|
|
522
|
+
const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
|
|
609
523
|
if (pendingReset.length > 0) {
|
|
610
524
|
log2("pending reset", {
|
|
611
525
|
events: pendingReset
|
|
612
526
|
}, {
|
|
613
527
|
F: __dxlog_file2,
|
|
614
|
-
L:
|
|
528
|
+
L: 341,
|
|
615
529
|
S: this,
|
|
616
530
|
C: (f, a) => f(...a)
|
|
617
531
|
});
|
|
@@ -623,35 +537,40 @@ var PluginManager = class {
|
|
|
623
537
|
* @internal
|
|
624
538
|
*/
|
|
625
539
|
// TODO(wittjosiah): Improve error typing.
|
|
626
|
-
_activate(event) {
|
|
540
|
+
_activate(event, params) {
|
|
627
541
|
return Effect2.gen(this, function* () {
|
|
628
542
|
const key = typeof event === "string" ? event : eventKey(event);
|
|
629
543
|
log2("activating", {
|
|
630
|
-
key
|
|
544
|
+
key,
|
|
545
|
+
...params
|
|
631
546
|
}, {
|
|
632
547
|
F: __dxlog_file2,
|
|
633
|
-
L:
|
|
548
|
+
L: 357,
|
|
634
549
|
S: this,
|
|
635
550
|
C: (f, a) => f(...a)
|
|
636
551
|
});
|
|
552
|
+
yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
|
|
637
553
|
const pendingIndex = this._state.pendingReset.findIndex((event2) => event2 === key);
|
|
638
554
|
if (pendingIndex !== -1) {
|
|
639
555
|
this._state.pendingReset.splice(pendingIndex, 1);
|
|
640
556
|
}
|
|
557
|
+
const activatingEvents = yield* this._activatingEvents;
|
|
558
|
+
const activatingModules = yield* this._activatingModules;
|
|
641
559
|
const modules = this._getInactiveModulesByEvent(key).filter((module) => {
|
|
642
560
|
const allOf2 = isAllOf(module.activatesOn);
|
|
643
561
|
if (!allOf2) {
|
|
644
562
|
return true;
|
|
645
563
|
}
|
|
646
564
|
const events = module.activatesOn.events.filter((event2) => eventKey(event2) !== key);
|
|
647
|
-
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)));
|
|
565
|
+
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
|
|
648
566
|
});
|
|
567
|
+
yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
|
|
649
568
|
if (modules.length === 0) {
|
|
650
569
|
log2("no modules to activate", {
|
|
651
570
|
key
|
|
652
571
|
}, {
|
|
653
572
|
F: __dxlog_file2,
|
|
654
|
-
L:
|
|
573
|
+
L: 388,
|
|
655
574
|
S: this,
|
|
656
575
|
C: (f, a) => f(...a)
|
|
657
576
|
});
|
|
@@ -665,7 +584,7 @@ var PluginManager = class {
|
|
|
665
584
|
modules: modules.map((module) => module.id)
|
|
666
585
|
}, {
|
|
667
586
|
F: __dxlog_file2,
|
|
668
|
-
L:
|
|
587
|
+
L: 395,
|
|
669
588
|
S: this,
|
|
670
589
|
C: (f, a) => f(...a)
|
|
671
590
|
});
|
|
@@ -673,29 +592,36 @@ var PluginManager = class {
|
|
|
673
592
|
event: key,
|
|
674
593
|
state: "activating"
|
|
675
594
|
});
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
})), {
|
|
595
|
+
yield* pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
|
|
596
|
+
before: key
|
|
597
|
+
})), Effect2.allWith({
|
|
680
598
|
concurrency: "unbounded"
|
|
681
|
-
});
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
A.map(([module, getCapabilities2]) => this._activateModule(module, getCapabilities2)),
|
|
686
|
-
// TODO(wittjosiah): This currently can't be run in parallel.
|
|
687
|
-
// Running this with concurrency causes races with `allOf` activation events.
|
|
688
|
-
Effect2.all,
|
|
689
|
-
Effect2.either
|
|
690
|
-
);
|
|
691
|
-
if (Either.isLeft(result)) {
|
|
599
|
+
}));
|
|
600
|
+
const getCapabilities = yield* pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
601
|
+
concurrency: "unbounded"
|
|
602
|
+
}), Effect2.catchAll((error) => {
|
|
692
603
|
this.activation.emit({
|
|
693
604
|
event: key,
|
|
694
605
|
state: "error",
|
|
695
|
-
error
|
|
606
|
+
error
|
|
696
607
|
});
|
|
697
|
-
|
|
698
|
-
}
|
|
608
|
+
return Effect2.fail(error);
|
|
609
|
+
}));
|
|
610
|
+
yield* pipe(
|
|
611
|
+
modules,
|
|
612
|
+
Array.zip(getCapabilities),
|
|
613
|
+
Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
|
|
614
|
+
// TODO(wittjosiah): This currently can't be run in parallel.
|
|
615
|
+
// Running this with concurrency causes races with `allOf` activation events.
|
|
616
|
+
Effect2.all
|
|
617
|
+
);
|
|
618
|
+
yield* pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
|
|
619
|
+
after: key
|
|
620
|
+
})), Effect2.allWith({
|
|
621
|
+
concurrency: "unbounded"
|
|
622
|
+
}));
|
|
623
|
+
yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
|
|
624
|
+
yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
|
|
699
625
|
if (!this._state.eventsFired.includes(key)) {
|
|
700
626
|
this._state.eventsFired.push(key);
|
|
701
627
|
}
|
|
@@ -707,39 +633,15 @@ var PluginManager = class {
|
|
|
707
633
|
key
|
|
708
634
|
}, {
|
|
709
635
|
F: __dxlog_file2,
|
|
710
|
-
L:
|
|
636
|
+
L: 451,
|
|
711
637
|
S: this,
|
|
712
638
|
C: (f, a) => f(...a)
|
|
713
639
|
});
|
|
714
640
|
return true;
|
|
715
641
|
});
|
|
716
642
|
}
|
|
717
|
-
|
|
643
|
+
_contributeCapabilities(module, capabilities) {
|
|
718
644
|
return Effect2.gen(this, function* () {
|
|
719
|
-
yield* Effect2.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {
|
|
720
|
-
concurrency: "unbounded"
|
|
721
|
-
});
|
|
722
|
-
log2("activating module...", {
|
|
723
|
-
module: module.id
|
|
724
|
-
}, {
|
|
725
|
-
F: __dxlog_file2,
|
|
726
|
-
L: 421,
|
|
727
|
-
S: this,
|
|
728
|
-
C: (f, a) => f(...a)
|
|
729
|
-
});
|
|
730
|
-
const maybeCapabilities = typeof getCapabilities === "function" ? getCapabilities() : getCapabilities;
|
|
731
|
-
const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(
|
|
732
|
-
// TODO(wittjosiah): Activate with an effect?
|
|
733
|
-
// Match.when(Effect.isEffect, (effect) => effect),
|
|
734
|
-
Match.when(isPromise, (promise) => Effect2.tryPromise({
|
|
735
|
-
try: () => promise,
|
|
736
|
-
catch: (error) => error
|
|
737
|
-
})),
|
|
738
|
-
Match.orElse((program) => Effect2.succeed(program))
|
|
739
|
-
);
|
|
740
|
-
const capabilities = Match.value(resolvedCapabilities).pipe(Match.when(Array.isArray, (array) => array), Match.orElse((value) => [
|
|
741
|
-
value
|
|
742
|
-
]));
|
|
743
645
|
capabilities.forEach((capability) => {
|
|
744
646
|
this.context.contributeCapability({
|
|
745
647
|
module: module.id,
|
|
@@ -748,17 +650,6 @@ var PluginManager = class {
|
|
|
748
650
|
});
|
|
749
651
|
this._state.active.push(module.id);
|
|
750
652
|
this._capabilities.set(module.id, capabilities);
|
|
751
|
-
log2("activated module", {
|
|
752
|
-
module: module.id
|
|
753
|
-
}, {
|
|
754
|
-
F: __dxlog_file2,
|
|
755
|
-
L: 444,
|
|
756
|
-
S: this,
|
|
757
|
-
C: (f, a) => f(...a)
|
|
758
|
-
});
|
|
759
|
-
yield* Effect2.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {
|
|
760
|
-
concurrency: "unbounded"
|
|
761
|
-
});
|
|
762
653
|
});
|
|
763
654
|
}
|
|
764
655
|
_deactivate(id) {
|
|
@@ -781,10 +672,11 @@ var PluginManager = class {
|
|
|
781
672
|
id
|
|
782
673
|
}, {
|
|
783
674
|
F: __dxlog_file2,
|
|
784
|
-
L:
|
|
675
|
+
L: 533,
|
|
785
676
|
S: this,
|
|
786
677
|
C: (f, a) => f(...a)
|
|
787
678
|
});
|
|
679
|
+
this._moduleMemoMap.delete(id);
|
|
788
680
|
const capabilities = this._capabilities.get(id);
|
|
789
681
|
if (capabilities) {
|
|
790
682
|
for (const capability of capabilities) {
|
|
@@ -805,7 +697,7 @@ var PluginManager = class {
|
|
|
805
697
|
id
|
|
806
698
|
}, {
|
|
807
699
|
F: __dxlog_file2,
|
|
808
|
-
L:
|
|
700
|
+
L: 560,
|
|
809
701
|
S: this,
|
|
810
702
|
C: (f, a) => f(...a)
|
|
811
703
|
});
|
|
@@ -819,7 +711,7 @@ var PluginManager = class {
|
|
|
819
711
|
key
|
|
820
712
|
}, {
|
|
821
713
|
F: __dxlog_file2,
|
|
822
|
-
L:
|
|
714
|
+
L: 568,
|
|
823
715
|
S: this,
|
|
824
716
|
C: (f, a) => f(...a)
|
|
825
717
|
});
|
|
@@ -834,11 +726,125 @@ var PluginManager = class {
|
|
|
834
726
|
}
|
|
835
727
|
});
|
|
836
728
|
}
|
|
729
|
+
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
|
|
730
|
+
_define_property2(this, "activation", new Event());
|
|
731
|
+
_define_property2(this, "context", void 0);
|
|
732
|
+
_define_property2(this, "registry", void 0);
|
|
733
|
+
_define_property2(this, "_state", void 0);
|
|
734
|
+
_define_property2(this, "_pluginLoader", void 0);
|
|
735
|
+
_define_property2(this, "_capabilities", /* @__PURE__ */ new Map());
|
|
736
|
+
_define_property2(this, "_moduleMemoMap", /* @__PURE__ */ new Map());
|
|
737
|
+
_define_property2(this, "_activatingEvents", Effect2.runSync(Ref.make([])));
|
|
738
|
+
_define_property2(this, "_activatingModules", Effect2.runSync(Ref.make([])));
|
|
739
|
+
_define_property2(this, "_loadModule", (mod) => Effect2.tryPromise({
|
|
740
|
+
try: async () => {
|
|
741
|
+
const entry = this._moduleMemoMap.get(mod.id);
|
|
742
|
+
if (entry) {
|
|
743
|
+
return entry;
|
|
744
|
+
}
|
|
745
|
+
const promise = (async () => {
|
|
746
|
+
const start = performance.now();
|
|
747
|
+
let failed = false;
|
|
748
|
+
try {
|
|
749
|
+
log2("loading module", {
|
|
750
|
+
module: mod.id
|
|
751
|
+
}, {
|
|
752
|
+
F: __dxlog_file2,
|
|
753
|
+
L: 470,
|
|
754
|
+
S: this,
|
|
755
|
+
C: (f, a) => f(...a)
|
|
756
|
+
});
|
|
757
|
+
let activationResult = await mod.activate(this.context);
|
|
758
|
+
if (typeof activationResult === "function") {
|
|
759
|
+
activationResult = await activationResult();
|
|
760
|
+
}
|
|
761
|
+
return Array.isArray(activationResult) ? activationResult : [
|
|
762
|
+
activationResult
|
|
763
|
+
];
|
|
764
|
+
} catch (error) {
|
|
765
|
+
failed = true;
|
|
766
|
+
throw error;
|
|
767
|
+
} finally {
|
|
768
|
+
performance.measure("activate-module", {
|
|
769
|
+
start,
|
|
770
|
+
end: performance.now(),
|
|
771
|
+
detail: {
|
|
772
|
+
module: mod.id
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
log2("loaded module", {
|
|
776
|
+
module: mod.id,
|
|
777
|
+
elapsed: performance.now() - start,
|
|
778
|
+
failed
|
|
779
|
+
}, {
|
|
780
|
+
F: __dxlog_file2,
|
|
781
|
+
L: 488,
|
|
782
|
+
S: this,
|
|
783
|
+
C: (f, a) => f(...a)
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
})();
|
|
787
|
+
this._moduleMemoMap.set(mod.id, promise);
|
|
788
|
+
return promise;
|
|
789
|
+
},
|
|
790
|
+
catch: (error) => error
|
|
791
|
+
}).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
|
|
792
|
+
module: mod.id
|
|
793
|
+
}, {
|
|
794
|
+
F: __dxlog_file2,
|
|
795
|
+
L: 499,
|
|
796
|
+
S: this,
|
|
797
|
+
C: (f, a) => f(...a)
|
|
798
|
+
})))))));
|
|
799
|
+
this.registry = registry ?? Registry.make();
|
|
800
|
+
this.context = new PluginContext({
|
|
801
|
+
registry: this.registry,
|
|
802
|
+
activate: (event) => this._activate(event),
|
|
803
|
+
reset: (id) => this._reset(id)
|
|
804
|
+
});
|
|
805
|
+
this._pluginLoader = pluginLoader;
|
|
806
|
+
this._state = live({
|
|
807
|
+
plugins,
|
|
808
|
+
core,
|
|
809
|
+
enabled,
|
|
810
|
+
modules: [],
|
|
811
|
+
active: [],
|
|
812
|
+
eventsFired: [],
|
|
813
|
+
pendingReset: []
|
|
814
|
+
});
|
|
815
|
+
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
816
|
+
core.forEach((id) => this.enable(id));
|
|
817
|
+
enabled.forEach((id) => this.enable(id));
|
|
818
|
+
}
|
|
837
819
|
};
|
|
820
|
+
var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
821
|
+
const togetherFiber = yield* Effect2.fork(togetherEffect);
|
|
822
|
+
const result = yield* effect;
|
|
823
|
+
yield* Fiber.interrupt(togetherFiber);
|
|
824
|
+
return result;
|
|
825
|
+
});
|
|
838
826
|
|
|
839
|
-
//
|
|
827
|
+
// src/core/plugin.ts
|
|
828
|
+
function _define_property3(obj, key, value) {
|
|
829
|
+
if (key in obj) {
|
|
830
|
+
Object.defineProperty(obj, key, {
|
|
831
|
+
value,
|
|
832
|
+
enumerable: true,
|
|
833
|
+
configurable: true,
|
|
834
|
+
writable: true
|
|
835
|
+
});
|
|
836
|
+
} else {
|
|
837
|
+
obj[key] = value;
|
|
838
|
+
}
|
|
839
|
+
return obj;
|
|
840
|
+
}
|
|
840
841
|
var PluginModule = class {
|
|
841
842
|
constructor(options) {
|
|
843
|
+
_define_property3(this, "id", void 0);
|
|
844
|
+
_define_property3(this, "activatesOn", void 0);
|
|
845
|
+
_define_property3(this, "activatesBefore", void 0);
|
|
846
|
+
_define_property3(this, "activatesAfter", void 0);
|
|
847
|
+
_define_property3(this, "activate", void 0);
|
|
842
848
|
this.id = options.id;
|
|
843
849
|
this.activatesOn = options.activatesOn;
|
|
844
850
|
this.activatesBefore = options.activatesBefore;
|
|
@@ -849,6 +855,8 @@ var PluginModule = class {
|
|
|
849
855
|
var defineModule = (options) => new PluginModule(options);
|
|
850
856
|
var Plugin = class {
|
|
851
857
|
constructor(meta, modules) {
|
|
858
|
+
_define_property3(this, "meta", void 0);
|
|
859
|
+
_define_property3(this, "modules", void 0);
|
|
852
860
|
this.meta = meta;
|
|
853
861
|
this.modules = modules;
|
|
854
862
|
}
|
|
@@ -857,10 +865,10 @@ var definePlugin = (meta, modules) => {
|
|
|
857
865
|
return new Plugin(meta, modules);
|
|
858
866
|
};
|
|
859
867
|
|
|
860
|
-
//
|
|
868
|
+
// src/common/capabilities.ts
|
|
861
869
|
(function(Capabilities2) {
|
|
862
|
-
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
863
870
|
Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
|
|
871
|
+
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
864
872
|
Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
|
|
865
873
|
Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
|
|
866
874
|
Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
|
|
@@ -875,34 +883,33 @@ var definePlugin = (meta, modules) => {
|
|
|
875
883
|
Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
|
|
876
884
|
Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
|
|
877
885
|
Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
|
|
878
|
-
Capabilities2.
|
|
879
|
-
Capabilities2.
|
|
886
|
+
Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
|
|
887
|
+
Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
|
|
888
|
+
Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
889
|
+
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
880
890
|
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
881
891
|
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
882
892
|
})(Capabilities || (Capabilities = {}));
|
|
883
893
|
var Capabilities;
|
|
884
894
|
|
|
885
|
-
//
|
|
886
|
-
import { Schema
|
|
887
|
-
import {
|
|
895
|
+
// src/common/collaboration.ts
|
|
896
|
+
import { Schema } from "effect";
|
|
897
|
+
import { DataType } from "@dxos/schema";
|
|
888
898
|
(function(CollaborationActions2) {
|
|
889
|
-
class
|
|
890
|
-
input:
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
label: Schema3.String.pipe(Schema3.optional)
|
|
895
|
-
}).annotations({
|
|
896
|
-
description: "Enables plugins to inject content blocks or references into a related entity."
|
|
899
|
+
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
900
|
+
input: Schema.Struct({
|
|
901
|
+
subject: Schema.Any,
|
|
902
|
+
anchor: Schema.String,
|
|
903
|
+
proposal: DataType.MessageBlock.Proposal
|
|
897
904
|
}),
|
|
898
|
-
output:
|
|
905
|
+
output: Schema.Void
|
|
899
906
|
}) {
|
|
900
907
|
}
|
|
901
|
-
CollaborationActions2.
|
|
908
|
+
CollaborationActions2.AcceptProposal = AcceptProposal;
|
|
902
909
|
})(CollaborationActions || (CollaborationActions = {}));
|
|
903
910
|
var CollaborationActions;
|
|
904
911
|
|
|
905
|
-
//
|
|
912
|
+
// src/common/events.ts
|
|
906
913
|
(function(Events2) {
|
|
907
914
|
Events2.Startup = defineEvent("dxos.org/app-framework/event/startup");
|
|
908
915
|
Events2.SetupReactSurface = defineEvent("dxos.org/app-framework/event/setup-react-surface");
|
|
@@ -920,8 +927,8 @@ var CollaborationActions;
|
|
|
920
927
|
})(Events || (Events = {}));
|
|
921
928
|
var Events;
|
|
922
929
|
|
|
923
|
-
//
|
|
924
|
-
import { Schema as
|
|
930
|
+
// src/common/file.ts
|
|
931
|
+
import { Schema as Schema2 } from "effect";
|
|
925
932
|
var defaultFileTypes = {
|
|
926
933
|
images: [
|
|
927
934
|
"png",
|
|
@@ -941,17 +948,124 @@ var defaultFileTypes = {
|
|
|
941
948
|
"md"
|
|
942
949
|
]
|
|
943
950
|
};
|
|
944
|
-
var FileInfoSchema =
|
|
945
|
-
name:
|
|
946
|
-
type:
|
|
947
|
-
url:
|
|
948
|
-
cid:
|
|
951
|
+
var FileInfoSchema = Schema2.Struct({
|
|
952
|
+
name: Schema2.String,
|
|
953
|
+
type: Schema2.String,
|
|
954
|
+
url: Schema2.optional(Schema2.String),
|
|
955
|
+
cid: Schema2.optional(Schema2.String)
|
|
949
956
|
});
|
|
950
957
|
|
|
951
|
-
//
|
|
958
|
+
// src/common/layout.ts
|
|
952
959
|
import { Schema as Schema5 } from "effect";
|
|
953
960
|
|
|
954
|
-
//
|
|
961
|
+
// src/plugin-intent/actions.ts
|
|
962
|
+
import { Schema as Schema4 } from "effect";
|
|
963
|
+
|
|
964
|
+
// src/plugin-intent/intent.ts
|
|
965
|
+
import { Schema as Schema3 } from "effect";
|
|
966
|
+
var createIntent = (schema, data = {}, params = {}) => {
|
|
967
|
+
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
968
|
+
const intent = {
|
|
969
|
+
...params,
|
|
970
|
+
_schema: schema,
|
|
971
|
+
id: schema._tag,
|
|
972
|
+
data
|
|
973
|
+
};
|
|
974
|
+
return {
|
|
975
|
+
first: intent,
|
|
976
|
+
last: intent,
|
|
977
|
+
all: [
|
|
978
|
+
intent
|
|
979
|
+
]
|
|
980
|
+
};
|
|
981
|
+
};
|
|
982
|
+
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
983
|
+
const intents = "all" in intent ? intent.all : [
|
|
984
|
+
intent
|
|
985
|
+
];
|
|
986
|
+
const first = intents[0];
|
|
987
|
+
const last = {
|
|
988
|
+
...params,
|
|
989
|
+
_schema: schema,
|
|
990
|
+
id: schema._tag,
|
|
991
|
+
data
|
|
992
|
+
};
|
|
993
|
+
return {
|
|
994
|
+
first,
|
|
995
|
+
last,
|
|
996
|
+
all: [
|
|
997
|
+
...intents,
|
|
998
|
+
last
|
|
999
|
+
]
|
|
1000
|
+
};
|
|
1001
|
+
};
|
|
1002
|
+
var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
|
|
1003
|
+
ns: Schema3.String,
|
|
1004
|
+
count: Schema3.optional(Schema3.Number),
|
|
1005
|
+
defaultValue: Schema3.optional(Schema3.String)
|
|
1006
|
+
})))));
|
|
1007
|
+
|
|
1008
|
+
// src/plugin-intent/actions.ts
|
|
1009
|
+
var INTENT_PLUGIN = "dxos.org/plugin/intent";
|
|
1010
|
+
var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
1011
|
+
(function(IntentAction2) {
|
|
1012
|
+
class Track extends Schema4.TaggedClass()(`${INTENT_ACTION}/track`, {
|
|
1013
|
+
input: Schema4.Struct({
|
|
1014
|
+
intents: Schema4.Array(Schema4.String),
|
|
1015
|
+
error: Schema4.optional(Schema4.String)
|
|
1016
|
+
}),
|
|
1017
|
+
output: Schema4.Void
|
|
1018
|
+
}) {
|
|
1019
|
+
}
|
|
1020
|
+
IntentAction2.Track = Track;
|
|
1021
|
+
class ShowUndo extends Schema4.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
|
|
1022
|
+
input: Schema4.Struct({
|
|
1023
|
+
message: Label
|
|
1024
|
+
}),
|
|
1025
|
+
output: Schema4.Void
|
|
1026
|
+
}) {
|
|
1027
|
+
}
|
|
1028
|
+
IntentAction2.ShowUndo = ShowUndo;
|
|
1029
|
+
})(IntentAction || (IntentAction = {}));
|
|
1030
|
+
var IntentAction;
|
|
1031
|
+
|
|
1032
|
+
// src/plugin-intent/errors.ts
|
|
1033
|
+
function _define_property4(obj, key, value) {
|
|
1034
|
+
if (key in obj) {
|
|
1035
|
+
Object.defineProperty(obj, key, {
|
|
1036
|
+
value,
|
|
1037
|
+
enumerable: true,
|
|
1038
|
+
configurable: true,
|
|
1039
|
+
writable: true
|
|
1040
|
+
});
|
|
1041
|
+
} else {
|
|
1042
|
+
obj[key] = value;
|
|
1043
|
+
}
|
|
1044
|
+
return obj;
|
|
1045
|
+
}
|
|
1046
|
+
var BaseError = class extends Error {
|
|
1047
|
+
constructor(code, message, context) {
|
|
1048
|
+
super(message ?? code, {
|
|
1049
|
+
cause: context
|
|
1050
|
+
}), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
|
|
1051
|
+
this.name = code;
|
|
1052
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
var NoResolversError = class extends BaseError {
|
|
1056
|
+
constructor(action) {
|
|
1057
|
+
super("NO_RESOLVERS", "No resolvers were found for the action", {
|
|
1058
|
+
action
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
var CycleDetectedError = class extends BaseError {
|
|
1063
|
+
constructor(context) {
|
|
1064
|
+
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
// src/plugin-intent/IntentPlugin.ts
|
|
955
1069
|
var IntentPlugin = () => definePlugin({
|
|
956
1070
|
id: INTENT_PLUGIN,
|
|
957
1071
|
name: "Intent"
|
|
@@ -965,11 +1079,11 @@ var IntentPlugin = () => definePlugin({
|
|
|
965
1079
|
activatesAfter: [
|
|
966
1080
|
Events.DispatcherReady
|
|
967
1081
|
],
|
|
968
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1082
|
+
activate: lazy(() => import("./intent-dispatcher-QG7UPGQX.mjs"))
|
|
969
1083
|
})
|
|
970
1084
|
]);
|
|
971
1085
|
|
|
972
|
-
//
|
|
1086
|
+
// src/common/layout.ts
|
|
973
1087
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
974
1088
|
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
975
1089
|
(function(LayoutAction2) {
|
|
@@ -1306,10 +1420,10 @@ var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
|
1306
1420
|
})(LayoutAction || (LayoutAction = {}));
|
|
1307
1421
|
var LayoutAction;
|
|
1308
1422
|
|
|
1309
|
-
//
|
|
1423
|
+
// src/common/surface.ts
|
|
1310
1424
|
var createSurface = (definition) => definition;
|
|
1311
1425
|
|
|
1312
|
-
//
|
|
1426
|
+
// src/common/translations.ts
|
|
1313
1427
|
import { Schema as Schema6 } from "effect";
|
|
1314
1428
|
var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
|
|
1315
1429
|
key: Schema6.String,
|
|
@@ -1324,8 +1438,8 @@ var Resource = Schema6.Record({
|
|
|
1324
1438
|
value: ResourceLanguage
|
|
1325
1439
|
});
|
|
1326
1440
|
|
|
1327
|
-
//
|
|
1328
|
-
var __dxlog_file3 = "/
|
|
1441
|
+
// src/plugin-intent/intent-dispatcher.ts
|
|
1442
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts";
|
|
1329
1443
|
var EXECUTION_LIMIT = 100;
|
|
1330
1444
|
var HISTORY_LIMIT = 100;
|
|
1331
1445
|
var createResolver = (resolver) => resolver;
|
|
@@ -1335,7 +1449,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1335
1449
|
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1336
1450
|
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1337
1451
|
if (candidates.length === 0) {
|
|
1338
|
-
|
|
1452
|
+
log3.info("no resolvers found", {
|
|
1453
|
+
intent: intent.id
|
|
1454
|
+
}, {
|
|
1455
|
+
F: __dxlog_file3,
|
|
1456
|
+
L: 200,
|
|
1457
|
+
S: this,
|
|
1458
|
+
C: (f, a) => f(...a)
|
|
1459
|
+
});
|
|
1460
|
+
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1339
1461
|
}
|
|
1340
1462
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1341
1463
|
const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
|
|
@@ -1347,7 +1469,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1347
1469
|
const dispatch = (intentChain, depth = 0) => {
|
|
1348
1470
|
return Effect3.gen(function* () {
|
|
1349
1471
|
if (depth > executionLimit) {
|
|
1350
|
-
yield* Effect3.fail(new CycleDetectedError());
|
|
1472
|
+
return yield* Effect3.fail(new CycleDetectedError());
|
|
1351
1473
|
}
|
|
1352
1474
|
const resultsRef = yield* Ref2.make([]);
|
|
1353
1475
|
for (const intent of intentChain.all) {
|
|
@@ -1369,7 +1491,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1369
1491
|
}
|
|
1370
1492
|
}
|
|
1371
1493
|
if (result2.error) {
|
|
1372
|
-
yield* Effect3.fail(result2.error);
|
|
1494
|
+
return yield* Effect3.fail(result2.error);
|
|
1373
1495
|
}
|
|
1374
1496
|
}
|
|
1375
1497
|
const results = yield* resultsRef.get;
|
|
@@ -1398,7 +1520,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1398
1520
|
})).catch((error) => {
|
|
1399
1521
|
log3.catch(error, void 0, {
|
|
1400
1522
|
F: __dxlog_file3,
|
|
1401
|
-
L:
|
|
1523
|
+
L: 272,
|
|
1402
1524
|
S: void 0,
|
|
1403
1525
|
C: (f, a) => f(...a)
|
|
1404
1526
|
});
|
|
@@ -1503,6 +1625,9 @@ export {
|
|
|
1503
1625
|
INTENT_PLUGIN,
|
|
1504
1626
|
INTENT_ACTION,
|
|
1505
1627
|
IntentAction,
|
|
1628
|
+
BaseError,
|
|
1629
|
+
NoResolversError,
|
|
1630
|
+
CycleDetectedError,
|
|
1506
1631
|
createResolver,
|
|
1507
1632
|
createDispatcher,
|
|
1508
1633
|
intent_dispatcher_default,
|
|
@@ -1515,4 +1640,4 @@ export {
|
|
|
1515
1640
|
ResourceLanguage,
|
|
1516
1641
|
Resource
|
|
1517
1642
|
};
|
|
1518
|
-
//# sourceMappingURL=chunk-
|
|
1643
|
+
//# sourceMappingURL=chunk-OZY7HV2A.mjs.map
|