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