@dxos/app-framework 0.8.4-main.84f28bd → 0.8.4-main.a4bbb77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.mts +11 -0
- package/.storybook/preview.mts +8 -0
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
- package/dist/lib/browser/{app-graph-builder-BGGXLD6T.mjs → app-graph-builder-XH4OYQLC.mjs} +25 -25
- package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2636QSIK.mjs → chunk-6V54SRFL.mjs} +390 -270
- package/dist/lib/browser/chunk-6V54SRFL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-RGKMLI6U.mjs} +10 -7
- package/dist/lib/browser/chunk-RGKMLI6U.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-ZZVFNUHZ.mjs} +189 -135
- package/dist/lib/browser/chunk-ZZVFNUHZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -28
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs → intent-dispatcher-VFMJVO2M.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-ICAPD4JL.mjs} +5 -5
- package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-7ZGMHOGB.mjs} +4 -4
- package/dist/lib/browser/{store-LFKDWHUQ.mjs.map → store-7ZGMHOGB.mjs.map} +2 -2
- package/dist/lib/browser/testing/index.mjs +14 -19
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +7 -9
- package/dist/lib/node-esm/{app-graph-builder-QHIJUYYW.mjs → app-graph-builder-C7H22SOL.mjs} +25 -25
- package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-AXSZKZFD.mjs} +189 -135
- package/dist/lib/node-esm/chunk-AXSZKZFD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-LKPMRTRR.mjs} +10 -7
- package/dist/lib/node-esm/chunk-LKPMRTRR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-SOVTUUAY.mjs} +390 -270
- package/dist/lib/node-esm/chunk-SOVTUUAY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +20 -28
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs → intent-dispatcher-SAPOKSLZ.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-CRNJ6BMD.mjs} +5 -5
- package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-H4F4RMYD.mjs} +4 -4
- package/dist/lib/node-esm/{store-53XDUBMD.mjs.map → store-H4F4RMYD.mjs.map} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +14 -19
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +7 -9
- 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/layout.d.ts +0 -2
- package/dist/types/src/common/layout.d.ts.map +1 -1
- package/dist/types/src/common/surface.d.ts +7 -13
- 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 +14 -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/core/plugin.d.ts +4 -1
- package/dist/types/src/core/plugin.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/debug/plugin.d.ts +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts.map +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 +1 -1
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/layout/Layout.d.ts +2 -2
- package/dist/types/src/playground/layout/plugin.d.ts +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts +5 -4
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/actions.d.ts +4 -6
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/errors.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-intent/meta.d.ts +3 -0
- package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts +4 -6
- package/dist/types/src/plugin-settings/actions.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/meta.d.ts +3 -0
- package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
- 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 +2 -1
- 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 +2 -2
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +6 -5
- 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 +6 -6
- 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 +4 -0
- package/package.json +34 -29
- package/src/common/capabilities.ts +113 -12
- package/src/common/collaboration.ts +5 -8
- package/src/common/events.ts +3 -1
- package/src/common/layout.ts +2 -3
- package/src/common/surface.ts +15 -18
- package/src/components/App.stories.tsx +33 -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} +24 -136
- 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 +21 -20
- package/src/core/manager.ts +132 -54
- package/src/core/plugin.ts +8 -2
- package/src/helpers.test.ts +1 -1
- package/src/index.ts +1 -1
- package/src/playground/debug/Debug.tsx +1 -1
- package/src/playground/debug/plugin.ts +7 -8
- package/src/playground/generator/Toolbar.tsx +2 -1
- package/src/playground/generator/generator.ts +3 -3
- package/src/playground/generator/plugin.ts +12 -13
- package/src/playground/layout/plugin.ts +10 -9
- package/src/playground/logger/Toolbar.tsx +2 -1
- package/src/playground/logger/plugin.ts +30 -25
- package/src/playground/playground.stories.tsx +20 -16
- package/src/plugin-intent/IntentPlugin.ts +13 -13
- package/src/plugin-intent/actions.ts +3 -5
- package/src/plugin-intent/errors.ts +1 -0
- 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 +9 -8
- package/src/plugin-intent/meta.ts +10 -0
- package/src/plugin-settings/SettingsPlugin.ts +27 -28
- package/src/plugin-settings/actions.ts +8 -12
- package/src/plugin-settings/app-graph-builder.ts +14 -12
- package/src/plugin-settings/intent-resolver.ts +3 -2
- package/src/plugin-settings/meta.ts +10 -0
- package/src/plugin-settings/store.ts +1 -1
- package/src/plugin-settings/translations.ts +3 -3
- package/src/react/ErrorBoundary.tsx +24 -15
- package/src/react/IntentContext.tsx +3 -2
- package/src/react/Surface.stories.tsx +23 -18
- package/src/react/Surface.tsx +14 -5
- 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 +25 -29
- package/tsconfig.json +5 -9
- package/vitest.config.ts +8 -6
- package/.eslintrc.cjs +0 -9
- package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
- package/dist/lib/browser/app-graph-builder-BGGXLD6T.mjs.map +0 -7
- package/dist/lib/browser/chunk-2636QSIK.mjs.map +0 -7
- package/dist/lib/browser/chunk-DHZB7HG7.mjs.map +0 -7
- package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-O67UANYP.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-QHIJUYYW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NJAFK626.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VSKRV3NW.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-K3D4BXQQ.mjs.map +0 -7
- package/dist/types/src/App.d.ts.map +0 -1
- 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 -12
- 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/{intent-dispatcher-TWKB22NI.mjs.map → intent-dispatcher-VFMJVO2M.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-SAPOKSLZ.mjs.map} +0 -0
|
@@ -1,111 +1,30 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/plugin-intent/intent-dispatcher.ts
|
|
4
|
-
import { Effect as Effect3, Option,
|
|
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
|
-
// src/plugin-intent/actions.ts
|
|
10
|
-
import { Schema as Schema2 } from "effect";
|
|
11
|
-
|
|
12
|
-
// 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
|
-
// 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
|
-
// 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
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";
|
|
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
|
+
}
|
|
109
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) => {
|
|
@@ -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,6 +166,38 @@ 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
|
|
@@ -301,38 +225,28 @@ var getEvents = (events) => "type" in events ? events.events : [
|
|
|
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";
|
|
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
|
+
}
|
|
308
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: meta2 }) => meta2.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;
|
|
@@ -850,19 +856,26 @@ var PluginModule = class {
|
|
|
850
856
|
};
|
|
851
857
|
var defineModule = (options) => new PluginModule(options);
|
|
852
858
|
var Plugin = class {
|
|
853
|
-
constructor(
|
|
854
|
-
this
|
|
859
|
+
constructor(meta2, modules) {
|
|
860
|
+
_define_property3(this, "meta", void 0);
|
|
861
|
+
_define_property3(this, "modules", void 0);
|
|
862
|
+
this.meta = meta2;
|
|
855
863
|
this.modules = modules;
|
|
856
864
|
}
|
|
857
865
|
};
|
|
858
|
-
var definePlugin = (
|
|
859
|
-
|
|
866
|
+
var definePlugin = (meta2, provider) => {
|
|
867
|
+
const factory = (args) => {
|
|
868
|
+
return new Plugin(meta2, provider(args));
|
|
869
|
+
};
|
|
870
|
+
return Object.assign(factory, {
|
|
871
|
+
meta: meta2
|
|
872
|
+
});
|
|
860
873
|
};
|
|
861
874
|
|
|
862
875
|
// src/common/capabilities.ts
|
|
863
876
|
(function(Capabilities2) {
|
|
864
|
-
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
865
877
|
Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
|
|
878
|
+
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
866
879
|
Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
|
|
867
880
|
Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
|
|
868
881
|
Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
|
|
@@ -877,30 +890,31 @@ var definePlugin = (meta, modules) => {
|
|
|
877
890
|
Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
|
|
878
891
|
Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
|
|
879
892
|
Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
|
|
880
|
-
Capabilities2.
|
|
881
|
-
Capabilities2.
|
|
893
|
+
Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
|
|
894
|
+
Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
|
|
895
|
+
Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
896
|
+
Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
897
|
+
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
898
|
+
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
882
899
|
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
883
900
|
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
884
901
|
})(Capabilities || (Capabilities = {}));
|
|
885
902
|
var Capabilities;
|
|
886
903
|
|
|
887
904
|
// src/common/collaboration.ts
|
|
888
|
-
import { Schema
|
|
889
|
-
import {
|
|
905
|
+
import { Schema } from "effect";
|
|
906
|
+
import { DataType } from "@dxos/schema";
|
|
890
907
|
(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."
|
|
908
|
+
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
909
|
+
input: Schema.Struct({
|
|
910
|
+
subject: Schema.Any,
|
|
911
|
+
anchor: Schema.String,
|
|
912
|
+
proposal: DataType.MessageBlock.Proposal
|
|
899
913
|
}),
|
|
900
|
-
output:
|
|
914
|
+
output: Schema.Void
|
|
901
915
|
}) {
|
|
902
916
|
}
|
|
903
|
-
CollaborationActions2.
|
|
917
|
+
CollaborationActions2.AcceptProposal = AcceptProposal;
|
|
904
918
|
})(CollaborationActions || (CollaborationActions = {}));
|
|
905
919
|
var CollaborationActions;
|
|
906
920
|
|
|
@@ -923,7 +937,7 @@ var CollaborationActions;
|
|
|
923
937
|
var Events;
|
|
924
938
|
|
|
925
939
|
// src/common/file.ts
|
|
926
|
-
import { Schema as
|
|
940
|
+
import { Schema as Schema2 } from "effect";
|
|
927
941
|
var defaultFileTypes = {
|
|
928
942
|
images: [
|
|
929
943
|
"png",
|
|
@@ -943,23 +957,131 @@ var defaultFileTypes = {
|
|
|
943
957
|
"md"
|
|
944
958
|
]
|
|
945
959
|
};
|
|
946
|
-
var FileInfoSchema =
|
|
947
|
-
name:
|
|
948
|
-
type:
|
|
949
|
-
url:
|
|
950
|
-
cid:
|
|
960
|
+
var FileInfoSchema = Schema2.Struct({
|
|
961
|
+
name: Schema2.String,
|
|
962
|
+
type: Schema2.String,
|
|
963
|
+
url: Schema2.optional(Schema2.String),
|
|
964
|
+
cid: Schema2.optional(Schema2.String)
|
|
951
965
|
});
|
|
952
966
|
|
|
953
967
|
// src/common/layout.ts
|
|
954
968
|
import { Schema as Schema5 } from "effect";
|
|
955
969
|
|
|
956
|
-
// src/plugin-intent/
|
|
957
|
-
|
|
958
|
-
|
|
970
|
+
// src/plugin-intent/actions.ts
|
|
971
|
+
import { Schema as Schema4 } from "effect";
|
|
972
|
+
|
|
973
|
+
// src/plugin-intent/intent.ts
|
|
974
|
+
import { Schema as Schema3 } from "effect";
|
|
975
|
+
var createIntent = (schema, data = {}, params = {}) => {
|
|
976
|
+
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
977
|
+
const intent = {
|
|
978
|
+
...params,
|
|
979
|
+
_schema: schema,
|
|
980
|
+
id: schema._tag,
|
|
981
|
+
data
|
|
982
|
+
};
|
|
983
|
+
return {
|
|
984
|
+
first: intent,
|
|
985
|
+
last: intent,
|
|
986
|
+
all: [
|
|
987
|
+
intent
|
|
988
|
+
]
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
992
|
+
const intents = "all" in intent ? intent.all : [
|
|
993
|
+
intent
|
|
994
|
+
];
|
|
995
|
+
const first = intents[0];
|
|
996
|
+
const last = {
|
|
997
|
+
...params,
|
|
998
|
+
_schema: schema,
|
|
999
|
+
id: schema._tag,
|
|
1000
|
+
data
|
|
1001
|
+
};
|
|
1002
|
+
return {
|
|
1003
|
+
first,
|
|
1004
|
+
last,
|
|
1005
|
+
all: [
|
|
1006
|
+
...intents,
|
|
1007
|
+
last
|
|
1008
|
+
]
|
|
1009
|
+
};
|
|
1010
|
+
};
|
|
1011
|
+
var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
|
|
1012
|
+
ns: Schema3.String,
|
|
1013
|
+
count: Schema3.optional(Schema3.Number),
|
|
1014
|
+
defaultValue: Schema3.optional(Schema3.String)
|
|
1015
|
+
})))));
|
|
1016
|
+
|
|
1017
|
+
// src/plugin-intent/meta.ts
|
|
1018
|
+
var meta = {
|
|
1019
|
+
id: "dxos.org/plugin/intent",
|
|
959
1020
|
name: "Intent"
|
|
960
|
-
}
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
// src/plugin-intent/actions.ts
|
|
1024
|
+
(function(IntentAction2) {
|
|
1025
|
+
class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
|
|
1026
|
+
input: Schema4.Struct({
|
|
1027
|
+
intents: Schema4.Array(Schema4.String),
|
|
1028
|
+
error: Schema4.optional(Schema4.String)
|
|
1029
|
+
}),
|
|
1030
|
+
output: Schema4.Void
|
|
1031
|
+
}) {
|
|
1032
|
+
}
|
|
1033
|
+
IntentAction2.Track = Track;
|
|
1034
|
+
class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
|
|
1035
|
+
input: Schema4.Struct({
|
|
1036
|
+
message: Label
|
|
1037
|
+
}),
|
|
1038
|
+
output: Schema4.Void
|
|
1039
|
+
}) {
|
|
1040
|
+
}
|
|
1041
|
+
IntentAction2.ShowUndo = ShowUndo;
|
|
1042
|
+
})(IntentAction || (IntentAction = {}));
|
|
1043
|
+
var IntentAction;
|
|
1044
|
+
|
|
1045
|
+
// src/plugin-intent/errors.ts
|
|
1046
|
+
function _define_property4(obj, key, value) {
|
|
1047
|
+
if (key in obj) {
|
|
1048
|
+
Object.defineProperty(obj, key, {
|
|
1049
|
+
value,
|
|
1050
|
+
enumerable: true,
|
|
1051
|
+
configurable: true,
|
|
1052
|
+
writable: true
|
|
1053
|
+
});
|
|
1054
|
+
} else {
|
|
1055
|
+
obj[key] = value;
|
|
1056
|
+
}
|
|
1057
|
+
return obj;
|
|
1058
|
+
}
|
|
1059
|
+
var BaseError = class extends Error {
|
|
1060
|
+
constructor(code, message, context) {
|
|
1061
|
+
super(message ?? code, {
|
|
1062
|
+
cause: context
|
|
1063
|
+
}), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
|
|
1064
|
+
this.name = code;
|
|
1065
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
var NoResolversError = class extends BaseError {
|
|
1069
|
+
constructor(action) {
|
|
1070
|
+
super("NO_RESOLVERS", "No resolvers were found for the action", {
|
|
1071
|
+
action
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
var CycleDetectedError = class extends BaseError {
|
|
1076
|
+
constructor(context) {
|
|
1077
|
+
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
// src/plugin-intent/IntentPlugin.ts
|
|
1082
|
+
var IntentPlugin = definePlugin(meta, () => [
|
|
961
1083
|
defineModule({
|
|
962
|
-
id: `${
|
|
1084
|
+
id: `${meta.id}/module/dispatcher`,
|
|
963
1085
|
// TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
|
|
964
1086
|
// This is fine for now because it's how it worked prior to capabilities api anyways.
|
|
965
1087
|
// In the future, the intent dispatcher should be able to be reset without resetting the entire app.
|
|
@@ -967,15 +1089,14 @@ var IntentPlugin = () => definePlugin({
|
|
|
967
1089
|
activatesAfter: [
|
|
968
1090
|
Events.DispatcherReady
|
|
969
1091
|
],
|
|
970
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1092
|
+
activate: lazy(() => import("./intent-dispatcher-SAPOKSLZ.mjs"))
|
|
971
1093
|
})
|
|
972
1094
|
]);
|
|
973
1095
|
|
|
974
1096
|
// src/common/layout.ts
|
|
975
1097
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
976
|
-
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
977
1098
|
(function(LayoutAction2) {
|
|
978
|
-
LayoutAction2.UPDATE_LAYOUT = `${
|
|
1099
|
+
LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
|
|
979
1100
|
class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
980
1101
|
input: Schema5.Struct({
|
|
981
1102
|
part: Schema5.String.annotations({
|
|
@@ -1337,7 +1458,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1337
1458
|
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1338
1459
|
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1339
1460
|
if (candidates.length === 0) {
|
|
1340
|
-
yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1461
|
+
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1341
1462
|
}
|
|
1342
1463
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1343
1464
|
const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
|
|
@@ -1349,7 +1470,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1349
1470
|
const dispatch = (intentChain, depth = 0) => {
|
|
1350
1471
|
return Effect3.gen(function* () {
|
|
1351
1472
|
if (depth > executionLimit) {
|
|
1352
|
-
yield* Effect3.fail(new CycleDetectedError());
|
|
1473
|
+
return yield* Effect3.fail(new CycleDetectedError());
|
|
1353
1474
|
}
|
|
1354
1475
|
const resultsRef = yield* Ref2.make([]);
|
|
1355
1476
|
for (const intent of intentChain.all) {
|
|
@@ -1371,7 +1492,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1371
1492
|
}
|
|
1372
1493
|
}
|
|
1373
1494
|
if (result2.error) {
|
|
1374
|
-
yield* Effect3.fail(result2.error);
|
|
1495
|
+
return yield* Effect3.fail(result2.error);
|
|
1375
1496
|
}
|
|
1376
1497
|
}
|
|
1377
1498
|
const results = yield* resultsRef.get;
|
|
@@ -1400,7 +1521,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1400
1521
|
})).catch((error) => {
|
|
1401
1522
|
log3.catch(error, void 0, {
|
|
1402
1523
|
F: __dxlog_file3,
|
|
1403
|
-
L:
|
|
1524
|
+
L: 271,
|
|
1404
1525
|
S: void 0,
|
|
1405
1526
|
C: (f, a) => f(...a)
|
|
1406
1527
|
});
|
|
@@ -1453,7 +1574,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1453
1574
|
};
|
|
1454
1575
|
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1455
1576
|
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1456
|
-
var intent_dispatcher_default = (context) => {
|
|
1577
|
+
var intent_dispatcher_default = ((context) => {
|
|
1457
1578
|
const state = live2({
|
|
1458
1579
|
dispatch: defaultEffect,
|
|
1459
1580
|
dispatchPromise: defaultPromise,
|
|
@@ -1475,7 +1596,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1475
1596
|
state.undo = undo;
|
|
1476
1597
|
state.undoPromise = undoPromise;
|
|
1477
1598
|
return contributes(Capabilities.IntentDispatcher, state);
|
|
1478
|
-
};
|
|
1599
|
+
});
|
|
1479
1600
|
|
|
1480
1601
|
export {
|
|
1481
1602
|
defineCapability,
|
|
@@ -1502,19 +1623,18 @@ export {
|
|
|
1502
1623
|
createIntent,
|
|
1503
1624
|
chain,
|
|
1504
1625
|
Label,
|
|
1505
|
-
INTENT_PLUGIN,
|
|
1506
|
-
INTENT_ACTION,
|
|
1507
1626
|
IntentAction,
|
|
1627
|
+
BaseError,
|
|
1628
|
+
NoResolversError,
|
|
1629
|
+
CycleDetectedError,
|
|
1508
1630
|
createResolver,
|
|
1509
1631
|
createDispatcher,
|
|
1510
1632
|
intent_dispatcher_default,
|
|
1511
1633
|
IntentPlugin,
|
|
1512
|
-
LAYOUT_PLUGIN,
|
|
1513
|
-
LAYOUT_ACTION,
|
|
1514
1634
|
LayoutAction,
|
|
1515
1635
|
createSurface,
|
|
1516
1636
|
ResourceKey,
|
|
1517
1637
|
ResourceLanguage,
|
|
1518
1638
|
Resource
|
|
1519
1639
|
};
|
|
1520
|
-
//# sourceMappingURL=chunk-
|
|
1640
|
+
//# sourceMappingURL=chunk-SOVTUUAY.mjs.map
|