@dxos/app-framework 0.8.3-staging.0fa589b → 0.8.4-main.1da679c
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-NJPA2G5W.mjs} +7 -7
- package/dist/lib/browser/app-graph-builder-NJPA2G5W.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DIBVO47Z.mjs → chunk-5PEC66SO.mjs} +194 -129
- package/dist/lib/browser/chunk-5PEC66SO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WWEJRWFX.mjs → chunk-ORWHM7CO.mjs} +2 -2
- package/dist/lib/browser/{chunk-EHM4UI3V.mjs → chunk-RAYLWQ5Q.mjs} +400 -273
- package/dist/lib/browser/chunk-RAYLWQ5Q.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-MDRGYJIB.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-3QMBXLIY.mjs → intent-resolver-M6FKP6GN.mjs} +6 -6
- package/dist/lib/browser/intent-resolver-M6FKP6GN.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-5H7XPJGA.mjs → store-3APFOQKK.mjs} +5 -5
- package/dist/lib/browser/{store-5H7XPJGA.mjs.map → store-3APFOQKK.mjs.map} +2 -2
- 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-QSVQIJL5.mjs} +7 -7
- package/dist/lib/node-esm/app-graph-builder-QSVQIJL5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2J6FVECI.mjs → chunk-NL3BJGAH.mjs} +400 -273
- package/dist/lib/node-esm/chunk-NL3BJGAH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FHNZZWP4.mjs → chunk-TIGGOZBR.mjs} +194 -129
- package/dist/lib/node-esm/chunk-TIGGOZBR.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-YFOVJIJP.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-VY4X5UHN.mjs → intent-resolver-KERU62QF.mjs} +6 -6
- package/dist/lib/node-esm/intent-resolver-KERU62QF.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-UKD2R2KA.mjs → store-EZER6ON2.mjs} +5 -5
- package/dist/lib/node-esm/{store-UKD2R2KA.mjs.map → store-EZER6ON2.mjs.map} +2 -2
- 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 +85 -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 +111 -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-MDRGYJIB.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-YFOVJIJP.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,35 @@ 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.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
892
|
+
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
893
|
+
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
882
894
|
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
883
895
|
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
884
896
|
})(Capabilities || (Capabilities = {}));
|
|
885
897
|
var Capabilities;
|
|
886
898
|
|
|
887
|
-
//
|
|
888
|
-
import { Schema
|
|
889
|
-
import {
|
|
899
|
+
// src/common/collaboration.ts
|
|
900
|
+
import { Schema } from "effect";
|
|
901
|
+
import { DataType } from "@dxos/schema";
|
|
890
902
|
(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."
|
|
903
|
+
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
904
|
+
input: Schema.Struct({
|
|
905
|
+
subject: Schema.Any,
|
|
906
|
+
anchor: Schema.String,
|
|
907
|
+
proposal: DataType.MessageBlock.Proposal
|
|
899
908
|
}),
|
|
900
|
-
output:
|
|
909
|
+
output: Schema.Void
|
|
901
910
|
}) {
|
|
902
911
|
}
|
|
903
|
-
CollaborationActions2.
|
|
912
|
+
CollaborationActions2.AcceptProposal = AcceptProposal;
|
|
904
913
|
})(CollaborationActions || (CollaborationActions = {}));
|
|
905
914
|
var CollaborationActions;
|
|
906
915
|
|
|
907
|
-
//
|
|
916
|
+
// src/common/events.ts
|
|
908
917
|
(function(Events2) {
|
|
909
918
|
Events2.Startup = defineEvent("dxos.org/app-framework/event/startup");
|
|
910
919
|
Events2.SetupReactSurface = defineEvent("dxos.org/app-framework/event/setup-react-surface");
|
|
@@ -922,8 +931,8 @@ var CollaborationActions;
|
|
|
922
931
|
})(Events || (Events = {}));
|
|
923
932
|
var Events;
|
|
924
933
|
|
|
925
|
-
//
|
|
926
|
-
import { Schema as
|
|
934
|
+
// src/common/file.ts
|
|
935
|
+
import { Schema as Schema2 } from "effect";
|
|
927
936
|
var defaultFileTypes = {
|
|
928
937
|
images: [
|
|
929
938
|
"png",
|
|
@@ -943,17 +952,124 @@ var defaultFileTypes = {
|
|
|
943
952
|
"md"
|
|
944
953
|
]
|
|
945
954
|
};
|
|
946
|
-
var FileInfoSchema =
|
|
947
|
-
name:
|
|
948
|
-
type:
|
|
949
|
-
url:
|
|
950
|
-
cid:
|
|
955
|
+
var FileInfoSchema = Schema2.Struct({
|
|
956
|
+
name: Schema2.String,
|
|
957
|
+
type: Schema2.String,
|
|
958
|
+
url: Schema2.optional(Schema2.String),
|
|
959
|
+
cid: Schema2.optional(Schema2.String)
|
|
951
960
|
});
|
|
952
961
|
|
|
953
|
-
//
|
|
962
|
+
// src/common/layout.ts
|
|
954
963
|
import { Schema as Schema5 } from "effect";
|
|
955
964
|
|
|
956
|
-
//
|
|
965
|
+
// src/plugin-intent/actions.ts
|
|
966
|
+
import { Schema as Schema4 } from "effect";
|
|
967
|
+
|
|
968
|
+
// src/plugin-intent/intent.ts
|
|
969
|
+
import { Schema as Schema3 } from "effect";
|
|
970
|
+
var createIntent = (schema, data = {}, params = {}) => {
|
|
971
|
+
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
972
|
+
const intent = {
|
|
973
|
+
...params,
|
|
974
|
+
_schema: schema,
|
|
975
|
+
id: schema._tag,
|
|
976
|
+
data
|
|
977
|
+
};
|
|
978
|
+
return {
|
|
979
|
+
first: intent,
|
|
980
|
+
last: intent,
|
|
981
|
+
all: [
|
|
982
|
+
intent
|
|
983
|
+
]
|
|
984
|
+
};
|
|
985
|
+
};
|
|
986
|
+
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
987
|
+
const intents = "all" in intent ? intent.all : [
|
|
988
|
+
intent
|
|
989
|
+
];
|
|
990
|
+
const first = intents[0];
|
|
991
|
+
const last = {
|
|
992
|
+
...params,
|
|
993
|
+
_schema: schema,
|
|
994
|
+
id: schema._tag,
|
|
995
|
+
data
|
|
996
|
+
};
|
|
997
|
+
return {
|
|
998
|
+
first,
|
|
999
|
+
last,
|
|
1000
|
+
all: [
|
|
1001
|
+
...intents,
|
|
1002
|
+
last
|
|
1003
|
+
]
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
|
|
1007
|
+
ns: Schema3.String,
|
|
1008
|
+
count: Schema3.optional(Schema3.Number),
|
|
1009
|
+
defaultValue: Schema3.optional(Schema3.String)
|
|
1010
|
+
})))));
|
|
1011
|
+
|
|
1012
|
+
// src/plugin-intent/actions.ts
|
|
1013
|
+
var INTENT_PLUGIN = "dxos.org/plugin/intent";
|
|
1014
|
+
var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
1015
|
+
(function(IntentAction2) {
|
|
1016
|
+
class Track extends Schema4.TaggedClass()(`${INTENT_ACTION}/track`, {
|
|
1017
|
+
input: Schema4.Struct({
|
|
1018
|
+
intents: Schema4.Array(Schema4.String),
|
|
1019
|
+
error: Schema4.optional(Schema4.String)
|
|
1020
|
+
}),
|
|
1021
|
+
output: Schema4.Void
|
|
1022
|
+
}) {
|
|
1023
|
+
}
|
|
1024
|
+
IntentAction2.Track = Track;
|
|
1025
|
+
class ShowUndo extends Schema4.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
|
|
1026
|
+
input: Schema4.Struct({
|
|
1027
|
+
message: Label
|
|
1028
|
+
}),
|
|
1029
|
+
output: Schema4.Void
|
|
1030
|
+
}) {
|
|
1031
|
+
}
|
|
1032
|
+
IntentAction2.ShowUndo = ShowUndo;
|
|
1033
|
+
})(IntentAction || (IntentAction = {}));
|
|
1034
|
+
var IntentAction;
|
|
1035
|
+
|
|
1036
|
+
// src/plugin-intent/errors.ts
|
|
1037
|
+
function _define_property4(obj, key, value) {
|
|
1038
|
+
if (key in obj) {
|
|
1039
|
+
Object.defineProperty(obj, key, {
|
|
1040
|
+
value,
|
|
1041
|
+
enumerable: true,
|
|
1042
|
+
configurable: true,
|
|
1043
|
+
writable: true
|
|
1044
|
+
});
|
|
1045
|
+
} else {
|
|
1046
|
+
obj[key] = value;
|
|
1047
|
+
}
|
|
1048
|
+
return obj;
|
|
1049
|
+
}
|
|
1050
|
+
var BaseError = class extends Error {
|
|
1051
|
+
constructor(code, message, context) {
|
|
1052
|
+
super(message ?? code, {
|
|
1053
|
+
cause: context
|
|
1054
|
+
}), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
|
|
1055
|
+
this.name = code;
|
|
1056
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
var NoResolversError = class extends BaseError {
|
|
1060
|
+
constructor(action) {
|
|
1061
|
+
super("NO_RESOLVERS", "No resolvers were found for the action", {
|
|
1062
|
+
action
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
var CycleDetectedError = class extends BaseError {
|
|
1067
|
+
constructor(context) {
|
|
1068
|
+
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
// src/plugin-intent/IntentPlugin.ts
|
|
957
1073
|
var IntentPlugin = () => definePlugin({
|
|
958
1074
|
id: INTENT_PLUGIN,
|
|
959
1075
|
name: "Intent"
|
|
@@ -967,11 +1083,11 @@ var IntentPlugin = () => definePlugin({
|
|
|
967
1083
|
activatesAfter: [
|
|
968
1084
|
Events.DispatcherReady
|
|
969
1085
|
],
|
|
970
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1086
|
+
activate: lazy(() => import("./intent-dispatcher-YFOVJIJP.mjs"))
|
|
971
1087
|
})
|
|
972
1088
|
]);
|
|
973
1089
|
|
|
974
|
-
//
|
|
1090
|
+
// src/common/layout.ts
|
|
975
1091
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
976
1092
|
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
977
1093
|
(function(LayoutAction2) {
|
|
@@ -1308,10 +1424,10 @@ var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
|
1308
1424
|
})(LayoutAction || (LayoutAction = {}));
|
|
1309
1425
|
var LayoutAction;
|
|
1310
1426
|
|
|
1311
|
-
//
|
|
1427
|
+
// src/common/surface.ts
|
|
1312
1428
|
var createSurface = (definition) => definition;
|
|
1313
1429
|
|
|
1314
|
-
//
|
|
1430
|
+
// src/common/translations.ts
|
|
1315
1431
|
import { Schema as Schema6 } from "effect";
|
|
1316
1432
|
var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
|
|
1317
1433
|
key: Schema6.String,
|
|
@@ -1326,8 +1442,8 @@ var Resource = Schema6.Record({
|
|
|
1326
1442
|
value: ResourceLanguage
|
|
1327
1443
|
});
|
|
1328
1444
|
|
|
1329
|
-
//
|
|
1330
|
-
var __dxlog_file3 = "/
|
|
1445
|
+
// src/plugin-intent/intent-dispatcher.ts
|
|
1446
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts";
|
|
1331
1447
|
var EXECUTION_LIMIT = 100;
|
|
1332
1448
|
var HISTORY_LIMIT = 100;
|
|
1333
1449
|
var createResolver = (resolver) => resolver;
|
|
@@ -1337,7 +1453,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1337
1453
|
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1338
1454
|
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1339
1455
|
if (candidates.length === 0) {
|
|
1340
|
-
|
|
1456
|
+
log3.info("no resolvers found", {
|
|
1457
|
+
intent: intent.id
|
|
1458
|
+
}, {
|
|
1459
|
+
F: __dxlog_file3,
|
|
1460
|
+
L: 200,
|
|
1461
|
+
S: this,
|
|
1462
|
+
C: (f, a) => f(...a)
|
|
1463
|
+
});
|
|
1464
|
+
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1341
1465
|
}
|
|
1342
1466
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1343
1467
|
const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
|
|
@@ -1349,7 +1473,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1349
1473
|
const dispatch = (intentChain, depth = 0) => {
|
|
1350
1474
|
return Effect3.gen(function* () {
|
|
1351
1475
|
if (depth > executionLimit) {
|
|
1352
|
-
yield* Effect3.fail(new CycleDetectedError());
|
|
1476
|
+
return yield* Effect3.fail(new CycleDetectedError());
|
|
1353
1477
|
}
|
|
1354
1478
|
const resultsRef = yield* Ref2.make([]);
|
|
1355
1479
|
for (const intent of intentChain.all) {
|
|
@@ -1371,7 +1495,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1371
1495
|
}
|
|
1372
1496
|
}
|
|
1373
1497
|
if (result2.error) {
|
|
1374
|
-
yield* Effect3.fail(result2.error);
|
|
1498
|
+
return yield* Effect3.fail(result2.error);
|
|
1375
1499
|
}
|
|
1376
1500
|
}
|
|
1377
1501
|
const results = yield* resultsRef.get;
|
|
@@ -1400,7 +1524,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1400
1524
|
})).catch((error) => {
|
|
1401
1525
|
log3.catch(error, void 0, {
|
|
1402
1526
|
F: __dxlog_file3,
|
|
1403
|
-
L:
|
|
1527
|
+
L: 272,
|
|
1404
1528
|
S: void 0,
|
|
1405
1529
|
C: (f, a) => f(...a)
|
|
1406
1530
|
});
|
|
@@ -1453,7 +1577,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1453
1577
|
};
|
|
1454
1578
|
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1455
1579
|
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1456
|
-
var intent_dispatcher_default = (context) => {
|
|
1580
|
+
var intent_dispatcher_default = ((context) => {
|
|
1457
1581
|
const state = live2({
|
|
1458
1582
|
dispatch: defaultEffect,
|
|
1459
1583
|
dispatchPromise: defaultPromise,
|
|
@@ -1475,7 +1599,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1475
1599
|
state.undo = undo;
|
|
1476
1600
|
state.undoPromise = undoPromise;
|
|
1477
1601
|
return contributes(Capabilities.IntentDispatcher, state);
|
|
1478
|
-
};
|
|
1602
|
+
});
|
|
1479
1603
|
|
|
1480
1604
|
export {
|
|
1481
1605
|
defineCapability,
|
|
@@ -1505,6 +1629,9 @@ export {
|
|
|
1505
1629
|
INTENT_PLUGIN,
|
|
1506
1630
|
INTENT_ACTION,
|
|
1507
1631
|
IntentAction,
|
|
1632
|
+
BaseError,
|
|
1633
|
+
NoResolversError,
|
|
1634
|
+
CycleDetectedError,
|
|
1508
1635
|
createResolver,
|
|
1509
1636
|
createDispatcher,
|
|
1510
1637
|
intent_dispatcher_default,
|
|
@@ -1517,4 +1644,4 @@ export {
|
|
|
1517
1644
|
ResourceLanguage,
|
|
1518
1645
|
Resource
|
|
1519
1646
|
};
|
|
1520
|
-
//# sourceMappingURL=chunk-
|
|
1647
|
+
//# sourceMappingURL=chunk-NL3BJGAH.mjs.map
|