@dxos/app-framework 0.8.4-main.84f28bd → 0.8.4-main.ae835ea
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-PSA3RESL.mjs} +31 -30
- package/dist/lib/browser/app-graph-builder-PSA3RESL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2636QSIK.mjs → chunk-2VZ4RF4A.mjs} +347 -257
- package/dist/lib/browser/chunk-2VZ4RF4A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-CPVYIS24.mjs} +172 -134
- package/dist/lib/browser/chunk-CPVYIS24.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
- package/dist/lib/browser/chunk-SCPE4ZO2.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-BND6IF4U.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-27FJAJDE.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-27FJAJDE.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-F545UOIR.mjs} +4 -4
- package/dist/lib/browser/{store-LFKDWHUQ.mjs.map → store-F545UOIR.mjs.map} +2 -2
- package/dist/lib/browser/testing/index.mjs +17 -21
- 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-VJGZ6KH7.mjs} +31 -30
- package/dist/lib/node-esm/app-graph-builder-VJGZ6KH7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-3RRWO5TD.mjs} +347 -257
- package/dist/lib/node-esm/chunk-3RRWO5TD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-MN37WUJ2.mjs} +172 -134
- package/dist/lib/node-esm/chunk-MN37WUJ2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-ZX63QUGE.mjs} +11 -8
- package/dist/lib/node-esm/chunk-ZX63QUGE.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-254AZ6EE.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-NPMOPNFL.mjs} +7 -7
- package/dist/lib/node-esm/intent-resolver-NPMOPNFL.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-CINC4R4L.mjs} +4 -4
- package/dist/lib/node-esm/{store-53XDUBMD.mjs.map → store-CINC4R4L.mjs.map} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +17 -21
- 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 +89 -10
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +10 -9
- 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/file.d.ts +1 -1
- package/dist/types/src/common/file.d.ts.map +1 -1
- package/dist/types/src/common/layout.d.ts +1 -3
- 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/common/translations.d.ts +1 -1
- package/dist/types/src/common/translations.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 +7 -4
- 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 +8 -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/logger/schema.d.ts +1 -1
- package/dist/types/src/playground/logger/schema.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 +5 -7
- 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 +7 -7
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts +1 -1
- package/dist/types/src/plugin-intent/intent.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 +5 -7
- 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 +9 -8
- 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 +117 -13
- package/src/common/collaboration.ts +6 -9
- package/src/common/events.ts +3 -1
- package/src/common/file.ts +1 -1
- package/src/common/layout.ts +3 -4
- package/src/common/surface.ts +15 -18
- package/src/common/translations.ts +1 -1
- 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 +2 -2
- package/src/core/capabilities.ts +18 -9
- package/src/core/manager.test.ts +22 -21
- package/src/core/manager.ts +139 -54
- package/src/core/plugin.ts +13 -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 +4 -4
- 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/logger/schema.ts +1 -1
- package/src/playground/playground.stories.tsx +20 -16
- package/src/plugin-intent/IntentPlugin.ts +13 -13
- package/src/plugin-intent/actions.ts +4 -6
- package/src/plugin-intent/errors.ts +2 -1
- package/src/plugin-intent/index.ts +1 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
- package/src/plugin-intent/intent-dispatcher.ts +16 -12
- package/src/plugin-intent/intent.ts +1 -1
- package/src/plugin-intent/meta.ts +10 -0
- package/src/plugin-settings/SettingsPlugin.ts +27 -28
- package/src/plugin-settings/actions.ts +9 -13
- package/src/plugin-settings/app-graph-builder.ts +20 -17
- package/src/plugin-settings/intent-resolver.ts +5 -4
- 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 +26 -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 +33 -32
- package/tsconfig.json +6 -10
- 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-BND6IF4U.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-254AZ6EE.mjs.map} +0 -0
|
@@ -1,108 +1,17 @@
|
|
|
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
|
|
4
|
+
import * as Effect3 from "effect/Effect";
|
|
5
|
+
import * as Function2 from "effect/Function";
|
|
6
|
+
import * as Option from "effect/Option";
|
|
7
|
+
import * as Ref2 from "effect/Ref";
|
|
5
8
|
import { live as live2 } from "@dxos/live-object";
|
|
6
9
|
import { log as log3 } from "@dxos/log";
|
|
7
10
|
import { byPosition } from "@dxos/util";
|
|
8
11
|
|
|
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
12
|
// src/core/capabilities.ts
|
|
104
13
|
import { Rx } from "@effect-rx/rx-react";
|
|
105
|
-
import
|
|
14
|
+
import * as Effect from "effect/Effect";
|
|
106
15
|
import { Trigger } from "@dxos/async";
|
|
107
16
|
import { invariant } from "@dxos/invariant";
|
|
108
17
|
import { log } from "@dxos/log";
|
|
@@ -114,6 +23,8 @@ var defineCapability = (identifier) => {
|
|
|
114
23
|
};
|
|
115
24
|
};
|
|
116
25
|
var CapabilityImpl = class {
|
|
26
|
+
moduleId;
|
|
27
|
+
implementation;
|
|
117
28
|
constructor(moduleId, implementation) {
|
|
118
29
|
this.moduleId = moduleId;
|
|
119
30
|
this.implementation = implementation;
|
|
@@ -131,31 +42,44 @@ var lazy = (c) => async (props) => {
|
|
|
131
42
|
return async () => getCapability(props);
|
|
132
43
|
};
|
|
133
44
|
var PluginContext = class {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
});
|
|
45
|
+
_registry;
|
|
46
|
+
_capabilityImpls = Rx.family(() => {
|
|
47
|
+
return Rx.make([]).pipe(Rx.keepAlive);
|
|
48
|
+
});
|
|
49
|
+
_capabilities = Rx.family((id) => {
|
|
50
|
+
return Rx.make((get) => {
|
|
51
|
+
const current = get(this._capabilityImpls(id));
|
|
52
|
+
return current.map((c) => c.implementation);
|
|
143
53
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return current[0];
|
|
54
|
+
});
|
|
55
|
+
_capability = Rx.family((id) => {
|
|
56
|
+
return Rx.make((get) => {
|
|
57
|
+
const current = get(this._capabilities(id));
|
|
58
|
+
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
59
|
+
F: __dxlog_file,
|
|
60
|
+
L: 126,
|
|
61
|
+
S: this,
|
|
62
|
+
A: [
|
|
63
|
+
"current.length > 0",
|
|
64
|
+
"`No capability found for ${id}`"
|
|
65
|
+
]
|
|
157
66
|
});
|
|
67
|
+
return current[0];
|
|
158
68
|
});
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Activates plugins based on the activation event.
|
|
72
|
+
* @param event The activation event.
|
|
73
|
+
* @returns Whether the activation was successful.
|
|
74
|
+
*/
|
|
75
|
+
activate;
|
|
76
|
+
/**
|
|
77
|
+
* Re-activates the modules that were activated by the event.
|
|
78
|
+
* @param event The activation event.
|
|
79
|
+
* @returns Whether the reset was successful.
|
|
80
|
+
*/
|
|
81
|
+
reset;
|
|
82
|
+
constructor({ registry, activate, reset }) {
|
|
159
83
|
this._registry = registry;
|
|
160
84
|
this.activate = activate;
|
|
161
85
|
this.reset = reset;
|
|
@@ -179,7 +103,7 @@ var PluginContext = class {
|
|
|
179
103
|
count: current.length
|
|
180
104
|
}, {
|
|
181
105
|
F: __dxlog_file,
|
|
182
|
-
L:
|
|
106
|
+
L: 170,
|
|
183
107
|
S: this,
|
|
184
108
|
C: (f, a) => f(...a)
|
|
185
109
|
});
|
|
@@ -200,7 +124,7 @@ var PluginContext = class {
|
|
|
200
124
|
count: current.length
|
|
201
125
|
}, {
|
|
202
126
|
F: __dxlog_file,
|
|
203
|
-
L:
|
|
127
|
+
L: 189,
|
|
204
128
|
S: this,
|
|
205
129
|
C: (f, a) => f(...a)
|
|
206
130
|
});
|
|
@@ -209,7 +133,7 @@ var PluginContext = class {
|
|
|
209
133
|
id: interfaceDef.identifier
|
|
210
134
|
}, {
|
|
211
135
|
F: __dxlog_file,
|
|
212
|
-
L:
|
|
136
|
+
L: 191,
|
|
213
137
|
S: this,
|
|
214
138
|
C: (f, a) => f(...a)
|
|
215
139
|
});
|
|
@@ -301,18 +225,33 @@ 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
|
|
228
|
+
import * as Array from "effect/Array";
|
|
229
|
+
import * as Duration from "effect/Duration";
|
|
230
|
+
import * as Effect2 from "effect/Effect";
|
|
231
|
+
import * as Fiber from "effect/Fiber";
|
|
232
|
+
import * as Function from "effect/Function";
|
|
233
|
+
import * as HashSet from "effect/HashSet";
|
|
234
|
+
import * as Match from "effect/Match";
|
|
235
|
+
import * as Ref from "effect/Ref";
|
|
305
236
|
import { Event } from "@dxos/async";
|
|
306
237
|
import { live } from "@dxos/live-object";
|
|
307
238
|
import { log as log2 } from "@dxos/log";
|
|
308
239
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
|
|
309
|
-
var isPromise = (
|
|
310
|
-
return
|
|
240
|
+
var isPromise = (value2) => {
|
|
241
|
+
return value2 !== null && typeof value2 === "object" && "then" in value2;
|
|
311
242
|
};
|
|
312
243
|
var PluginManager = class {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
244
|
+
activation = new Event();
|
|
245
|
+
context;
|
|
246
|
+
registry;
|
|
247
|
+
// TODO(wittjosiah): Replace with Rx.
|
|
248
|
+
_state;
|
|
249
|
+
_pluginLoader;
|
|
250
|
+
_capabilities = /* @__PURE__ */ new Map();
|
|
251
|
+
_moduleMemoMap = /* @__PURE__ */ new Map();
|
|
252
|
+
_activatingEvents = Effect2.runSync(Ref.make([]));
|
|
253
|
+
_activatingModules = Effect2.runSync(Ref.make([]));
|
|
254
|
+
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
|
|
316
255
|
this.registry = registry ?? Registry.make();
|
|
317
256
|
this.context = new PluginContext({
|
|
318
257
|
registry: this.registry,
|
|
@@ -326,8 +265,8 @@ var PluginManager = class {
|
|
|
326
265
|
enabled,
|
|
327
266
|
modules: [],
|
|
328
267
|
active: [],
|
|
329
|
-
|
|
330
|
-
|
|
268
|
+
eventsFired: [],
|
|
269
|
+
pendingReset: []
|
|
331
270
|
});
|
|
332
271
|
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
333
272
|
core.forEach((id) => this.enable(id));
|
|
@@ -399,7 +338,7 @@ var PluginManager = class {
|
|
|
399
338
|
id
|
|
400
339
|
}, {
|
|
401
340
|
F: __dxlog_file2,
|
|
402
|
-
L:
|
|
341
|
+
L: 164,
|
|
403
342
|
S: this,
|
|
404
343
|
C: (f, a) => f(...a)
|
|
405
344
|
});
|
|
@@ -418,7 +357,7 @@ var PluginManager = class {
|
|
|
418
357
|
id
|
|
419
358
|
}, {
|
|
420
359
|
F: __dxlog_file2,
|
|
421
|
-
L:
|
|
360
|
+
L: 177,
|
|
422
361
|
S: this,
|
|
423
362
|
C: (f, a) => f(...a)
|
|
424
363
|
});
|
|
@@ -439,7 +378,7 @@ var PluginManager = class {
|
|
|
439
378
|
]
|
|
440
379
|
}, {
|
|
441
380
|
F: __dxlog_file2,
|
|
442
|
-
L:
|
|
381
|
+
L: 192,
|
|
443
382
|
S: this,
|
|
444
383
|
C: (f, a) => f(...a)
|
|
445
384
|
});
|
|
@@ -459,7 +398,7 @@ var PluginManager = class {
|
|
|
459
398
|
id
|
|
460
399
|
}, {
|
|
461
400
|
F: __dxlog_file2,
|
|
462
|
-
L:
|
|
401
|
+
L: 210,
|
|
463
402
|
S: this,
|
|
464
403
|
C: (f, a) => f(...a)
|
|
465
404
|
});
|
|
@@ -481,7 +420,7 @@ var PluginManager = class {
|
|
|
481
420
|
id
|
|
482
421
|
}, {
|
|
483
422
|
F: __dxlog_file2,
|
|
484
|
-
L:
|
|
423
|
+
L: 227,
|
|
485
424
|
S: this,
|
|
486
425
|
C: (f, a) => f(...a)
|
|
487
426
|
});
|
|
@@ -533,7 +472,7 @@ var PluginManager = class {
|
|
|
533
472
|
id: plugin.meta.id
|
|
534
473
|
}, {
|
|
535
474
|
F: __dxlog_file2,
|
|
536
|
-
L:
|
|
475
|
+
L: 280,
|
|
537
476
|
S: this,
|
|
538
477
|
C: (f, a) => f(...a)
|
|
539
478
|
});
|
|
@@ -548,7 +487,7 @@ var PluginManager = class {
|
|
|
548
487
|
id
|
|
549
488
|
}, {
|
|
550
489
|
F: __dxlog_file2,
|
|
551
|
-
L:
|
|
490
|
+
L: 290,
|
|
552
491
|
S: this,
|
|
553
492
|
C: (f, a) => f(...a)
|
|
554
493
|
});
|
|
@@ -564,7 +503,7 @@ var PluginManager = class {
|
|
|
564
503
|
id: module.id
|
|
565
504
|
}, {
|
|
566
505
|
F: __dxlog_file2,
|
|
567
|
-
L:
|
|
506
|
+
L: 300,
|
|
568
507
|
S: this,
|
|
569
508
|
C: (f, a) => f(...a)
|
|
570
509
|
});
|
|
@@ -579,7 +518,7 @@ var PluginManager = class {
|
|
|
579
518
|
id
|
|
580
519
|
}, {
|
|
581
520
|
F: __dxlog_file2,
|
|
582
|
-
L:
|
|
521
|
+
L: 310,
|
|
583
522
|
S: this,
|
|
584
523
|
C: (f, a) => f(...a)
|
|
585
524
|
});
|
|
@@ -607,13 +546,13 @@ var PluginManager = class {
|
|
|
607
546
|
_setPendingResetByModule(module) {
|
|
608
547
|
return untracked(() => {
|
|
609
548
|
const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._state.eventsFired.includes(key));
|
|
610
|
-
const pendingReset = Array.
|
|
549
|
+
const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
|
|
611
550
|
if (pendingReset.length > 0) {
|
|
612
551
|
log2("pending reset", {
|
|
613
552
|
events: pendingReset
|
|
614
553
|
}, {
|
|
615
554
|
F: __dxlog_file2,
|
|
616
|
-
L:
|
|
555
|
+
L: 348,
|
|
617
556
|
S: this,
|
|
618
557
|
C: (f, a) => f(...a)
|
|
619
558
|
});
|
|
@@ -625,35 +564,40 @@ var PluginManager = class {
|
|
|
625
564
|
* @internal
|
|
626
565
|
*/
|
|
627
566
|
// TODO(wittjosiah): Improve error typing.
|
|
628
|
-
_activate(event) {
|
|
567
|
+
_activate(event, params) {
|
|
629
568
|
return Effect2.gen(this, function* () {
|
|
630
569
|
const key = typeof event === "string" ? event : eventKey(event);
|
|
631
570
|
log2("activating", {
|
|
632
|
-
key
|
|
571
|
+
key,
|
|
572
|
+
...params
|
|
633
573
|
}, {
|
|
634
574
|
F: __dxlog_file2,
|
|
635
|
-
L:
|
|
575
|
+
L: 364,
|
|
636
576
|
S: this,
|
|
637
577
|
C: (f, a) => f(...a)
|
|
638
578
|
});
|
|
579
|
+
yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
|
|
639
580
|
const pendingIndex = this._state.pendingReset.findIndex((event2) => event2 === key);
|
|
640
581
|
if (pendingIndex !== -1) {
|
|
641
582
|
this._state.pendingReset.splice(pendingIndex, 1);
|
|
642
583
|
}
|
|
584
|
+
const activatingEvents = yield* this._activatingEvents;
|
|
585
|
+
const activatingModules = yield* this._activatingModules;
|
|
643
586
|
const modules = this._getInactiveModulesByEvent(key).filter((module) => {
|
|
644
587
|
const allOf2 = isAllOf(module.activatesOn);
|
|
645
588
|
if (!allOf2) {
|
|
646
589
|
return true;
|
|
647
590
|
}
|
|
648
591
|
const events = module.activatesOn.events.filter((event2) => eventKey(event2) !== key);
|
|
649
|
-
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)));
|
|
592
|
+
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
|
|
650
593
|
});
|
|
594
|
+
yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
|
|
651
595
|
if (modules.length === 0) {
|
|
652
596
|
log2("no modules to activate", {
|
|
653
597
|
key
|
|
654
598
|
}, {
|
|
655
599
|
F: __dxlog_file2,
|
|
656
|
-
L:
|
|
600
|
+
L: 395,
|
|
657
601
|
S: this,
|
|
658
602
|
C: (f, a) => f(...a)
|
|
659
603
|
});
|
|
@@ -667,7 +611,7 @@ var PluginManager = class {
|
|
|
667
611
|
modules: modules.map((module) => module.id)
|
|
668
612
|
}, {
|
|
669
613
|
F: __dxlog_file2,
|
|
670
|
-
L:
|
|
614
|
+
L: 402,
|
|
671
615
|
S: this,
|
|
672
616
|
C: (f, a) => f(...a)
|
|
673
617
|
});
|
|
@@ -675,29 +619,34 @@ var PluginManager = class {
|
|
|
675
619
|
event: key,
|
|
676
620
|
state: "activating"
|
|
677
621
|
});
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
})), {
|
|
622
|
+
yield* Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
|
|
623
|
+
before: key
|
|
624
|
+
})), Effect2.allWith({
|
|
682
625
|
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)) {
|
|
626
|
+
}));
|
|
627
|
+
const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
628
|
+
concurrency: "unbounded"
|
|
629
|
+
}), Effect2.catchAll((error) => {
|
|
694
630
|
this.activation.emit({
|
|
695
631
|
event: key,
|
|
696
632
|
state: "error",
|
|
697
|
-
error
|
|
633
|
+
error
|
|
698
634
|
});
|
|
699
|
-
|
|
700
|
-
}
|
|
635
|
+
return Effect2.fail(error);
|
|
636
|
+
}));
|
|
637
|
+
yield* Function.pipe(
|
|
638
|
+
modules,
|
|
639
|
+
Array.zip(getCapabilities),
|
|
640
|
+
Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
|
|
641
|
+
Effect2.all
|
|
642
|
+
);
|
|
643
|
+
yield* Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
|
|
644
|
+
after: key
|
|
645
|
+
})), Effect2.allWith({
|
|
646
|
+
concurrency: "unbounded"
|
|
647
|
+
}));
|
|
648
|
+
yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
|
|
649
|
+
yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
|
|
701
650
|
if (!this._state.eventsFired.includes(key)) {
|
|
702
651
|
this._state.eventsFired.push(key);
|
|
703
652
|
}
|
|
@@ -709,39 +658,76 @@ var PluginManager = class {
|
|
|
709
658
|
key
|
|
710
659
|
}, {
|
|
711
660
|
F: __dxlog_file2,
|
|
712
|
-
L:
|
|
661
|
+
L: 458,
|
|
713
662
|
S: this,
|
|
714
663
|
C: (f, a) => f(...a)
|
|
715
664
|
});
|
|
716
665
|
return true;
|
|
717
666
|
});
|
|
718
667
|
}
|
|
719
|
-
|
|
668
|
+
// Memoized with _moduleMemoMap
|
|
669
|
+
_loadModule = (mod) => Effect2.tryPromise({
|
|
670
|
+
try: async () => {
|
|
671
|
+
const entry = this._moduleMemoMap.get(mod.id);
|
|
672
|
+
if (entry) {
|
|
673
|
+
return entry;
|
|
674
|
+
}
|
|
675
|
+
const promise2 = (async () => {
|
|
676
|
+
const start = performance.now();
|
|
677
|
+
let failed = false;
|
|
678
|
+
try {
|
|
679
|
+
log2("loading module", {
|
|
680
|
+
module: mod.id
|
|
681
|
+
}, {
|
|
682
|
+
F: __dxlog_file2,
|
|
683
|
+
L: 477,
|
|
684
|
+
S: this,
|
|
685
|
+
C: (f, a) => f(...a)
|
|
686
|
+
});
|
|
687
|
+
let activationResult = await mod.activate(this.context);
|
|
688
|
+
if (typeof activationResult === "function") {
|
|
689
|
+
activationResult = await activationResult();
|
|
690
|
+
}
|
|
691
|
+
return Array.isArray(activationResult) ? activationResult : [
|
|
692
|
+
activationResult
|
|
693
|
+
];
|
|
694
|
+
} catch (error) {
|
|
695
|
+
failed = true;
|
|
696
|
+
throw error;
|
|
697
|
+
} finally {
|
|
698
|
+
performance.measure("activate-module", {
|
|
699
|
+
start,
|
|
700
|
+
end: performance.now(),
|
|
701
|
+
detail: {
|
|
702
|
+
module: mod.id
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
log2("loaded module", {
|
|
706
|
+
module: mod.id,
|
|
707
|
+
elapsed: performance.now() - start,
|
|
708
|
+
failed
|
|
709
|
+
}, {
|
|
710
|
+
F: __dxlog_file2,
|
|
711
|
+
L: 495,
|
|
712
|
+
S: this,
|
|
713
|
+
C: (f, a) => f(...a)
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
})();
|
|
717
|
+
this._moduleMemoMap.set(mod.id, promise2);
|
|
718
|
+
return promise2;
|
|
719
|
+
},
|
|
720
|
+
catch: (error) => error
|
|
721
|
+
}).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`, {
|
|
722
|
+
module: mod.id
|
|
723
|
+
}, {
|
|
724
|
+
F: __dxlog_file2,
|
|
725
|
+
L: 506,
|
|
726
|
+
S: this,
|
|
727
|
+
C: (f, a) => f(...a)
|
|
728
|
+
}))))));
|
|
729
|
+
_contributeCapabilities(module, capabilities) {
|
|
720
730
|
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
731
|
capabilities.forEach((capability) => {
|
|
746
732
|
this.context.contributeCapability({
|
|
747
733
|
module: module.id,
|
|
@@ -750,17 +736,6 @@ var PluginManager = class {
|
|
|
750
736
|
});
|
|
751
737
|
this._state.active.push(module.id);
|
|
752
738
|
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
739
|
});
|
|
765
740
|
}
|
|
766
741
|
_deactivate(id) {
|
|
@@ -783,17 +758,18 @@ var PluginManager = class {
|
|
|
783
758
|
id
|
|
784
759
|
}, {
|
|
785
760
|
F: __dxlog_file2,
|
|
786
|
-
L:
|
|
761
|
+
L: 540,
|
|
787
762
|
S: this,
|
|
788
763
|
C: (f, a) => f(...a)
|
|
789
764
|
});
|
|
765
|
+
this._moduleMemoMap.delete(id);
|
|
790
766
|
const capabilities = this._capabilities.get(id);
|
|
791
767
|
if (capabilities) {
|
|
792
768
|
for (const capability of capabilities) {
|
|
793
769
|
this.context.removeCapability(capability.interface, capability.implementation);
|
|
794
770
|
const program = capability.deactivate?.();
|
|
795
|
-
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (
|
|
796
|
-
try: () =>
|
|
771
|
+
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise2) => Effect2.tryPromise({
|
|
772
|
+
try: () => promise2,
|
|
797
773
|
catch: (error) => error
|
|
798
774
|
})), Match.orElse((program2) => Effect2.succeed(program2)));
|
|
799
775
|
}
|
|
@@ -807,7 +783,7 @@ var PluginManager = class {
|
|
|
807
783
|
id
|
|
808
784
|
}, {
|
|
809
785
|
F: __dxlog_file2,
|
|
810
|
-
L:
|
|
786
|
+
L: 567,
|
|
811
787
|
S: this,
|
|
812
788
|
C: (f, a) => f(...a)
|
|
813
789
|
});
|
|
@@ -821,7 +797,7 @@ var PluginManager = class {
|
|
|
821
797
|
key
|
|
822
798
|
}, {
|
|
823
799
|
F: __dxlog_file2,
|
|
824
|
-
L:
|
|
800
|
+
L: 575,
|
|
825
801
|
S: this,
|
|
826
802
|
C: (f, a) => f(...a)
|
|
827
803
|
});
|
|
@@ -837,9 +813,20 @@ var PluginManager = class {
|
|
|
837
813
|
});
|
|
838
814
|
}
|
|
839
815
|
};
|
|
816
|
+
var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
817
|
+
const togetherFiber = yield* Effect2.fork(togetherEffect);
|
|
818
|
+
const result = yield* effect;
|
|
819
|
+
yield* Fiber.interrupt(togetherFiber);
|
|
820
|
+
return result;
|
|
821
|
+
});
|
|
840
822
|
|
|
841
823
|
// src/core/plugin.ts
|
|
842
824
|
var PluginModule = class {
|
|
825
|
+
id;
|
|
826
|
+
activatesOn;
|
|
827
|
+
activatesBefore;
|
|
828
|
+
activatesAfter;
|
|
829
|
+
activate;
|
|
843
830
|
constructor(options) {
|
|
844
831
|
this.id = options.id;
|
|
845
832
|
this.activatesOn = options.activatesOn;
|
|
@@ -850,19 +837,26 @@ var PluginModule = class {
|
|
|
850
837
|
};
|
|
851
838
|
var defineModule = (options) => new PluginModule(options);
|
|
852
839
|
var Plugin = class {
|
|
853
|
-
|
|
854
|
-
|
|
840
|
+
meta;
|
|
841
|
+
modules;
|
|
842
|
+
constructor(meta2, modules) {
|
|
843
|
+
this.meta = meta2;
|
|
855
844
|
this.modules = modules;
|
|
856
845
|
}
|
|
857
846
|
};
|
|
858
|
-
var definePlugin = (
|
|
859
|
-
|
|
847
|
+
var definePlugin = (meta2, provider) => {
|
|
848
|
+
const factory = (args) => {
|
|
849
|
+
return new Plugin(meta2, provider(args));
|
|
850
|
+
};
|
|
851
|
+
return Object.assign(factory, {
|
|
852
|
+
meta: meta2
|
|
853
|
+
});
|
|
860
854
|
};
|
|
861
855
|
|
|
862
856
|
// src/common/capabilities.ts
|
|
863
857
|
(function(Capabilities2) {
|
|
864
|
-
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
865
858
|
Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
|
|
859
|
+
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
866
860
|
Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
|
|
867
861
|
Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
|
|
868
862
|
Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
|
|
@@ -877,30 +871,31 @@ var definePlugin = (meta, modules) => {
|
|
|
877
871
|
Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
|
|
878
872
|
Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
|
|
879
873
|
Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
|
|
880
|
-
Capabilities2.
|
|
881
|
-
Capabilities2.
|
|
874
|
+
Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
|
|
875
|
+
Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
|
|
876
|
+
Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
877
|
+
Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
878
|
+
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
879
|
+
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
882
880
|
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
883
881
|
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
884
882
|
})(Capabilities || (Capabilities = {}));
|
|
885
883
|
var Capabilities;
|
|
886
884
|
|
|
887
885
|
// src/common/collaboration.ts
|
|
888
|
-
import
|
|
889
|
-
import {
|
|
886
|
+
import * as Schema from "effect/Schema";
|
|
887
|
+
import { DataType } from "@dxos/schema";
|
|
890
888
|
(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."
|
|
889
|
+
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
890
|
+
input: Schema.Struct({
|
|
891
|
+
subject: Schema.Any,
|
|
892
|
+
anchor: Schema.String,
|
|
893
|
+
proposal: DataType.MessageBlock.Proposal
|
|
899
894
|
}),
|
|
900
|
-
output:
|
|
895
|
+
output: Schema.Void
|
|
901
896
|
}) {
|
|
902
897
|
}
|
|
903
|
-
CollaborationActions2.
|
|
898
|
+
CollaborationActions2.AcceptProposal = AcceptProposal;
|
|
904
899
|
})(CollaborationActions || (CollaborationActions = {}));
|
|
905
900
|
var CollaborationActions;
|
|
906
901
|
|
|
@@ -923,7 +918,7 @@ var CollaborationActions;
|
|
|
923
918
|
var Events;
|
|
924
919
|
|
|
925
920
|
// src/common/file.ts
|
|
926
|
-
import
|
|
921
|
+
import * as Schema2 from "effect/Schema";
|
|
927
922
|
var defaultFileTypes = {
|
|
928
923
|
images: [
|
|
929
924
|
"png",
|
|
@@ -943,23 +938,120 @@ var defaultFileTypes = {
|
|
|
943
938
|
"md"
|
|
944
939
|
]
|
|
945
940
|
};
|
|
946
|
-
var FileInfoSchema =
|
|
947
|
-
name:
|
|
948
|
-
type:
|
|
949
|
-
url:
|
|
950
|
-
cid:
|
|
941
|
+
var FileInfoSchema = Schema2.Struct({
|
|
942
|
+
name: Schema2.String,
|
|
943
|
+
type: Schema2.String,
|
|
944
|
+
url: Schema2.optional(Schema2.String),
|
|
945
|
+
cid: Schema2.optional(Schema2.String)
|
|
951
946
|
});
|
|
952
947
|
|
|
953
948
|
// src/common/layout.ts
|
|
954
|
-
import
|
|
949
|
+
import * as Schema5 from "effect/Schema";
|
|
955
950
|
|
|
956
|
-
// src/plugin-intent/
|
|
957
|
-
|
|
958
|
-
|
|
951
|
+
// src/plugin-intent/actions.ts
|
|
952
|
+
import * as Schema4 from "effect/Schema";
|
|
953
|
+
|
|
954
|
+
// src/plugin-intent/intent.ts
|
|
955
|
+
import * as Schema3 from "effect/Schema";
|
|
956
|
+
var createIntent = (schema, data = {}, params = {}) => {
|
|
957
|
+
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
958
|
+
const intent = {
|
|
959
|
+
...params,
|
|
960
|
+
_schema: schema,
|
|
961
|
+
id: schema._tag,
|
|
962
|
+
data
|
|
963
|
+
};
|
|
964
|
+
return {
|
|
965
|
+
first: intent,
|
|
966
|
+
last: intent,
|
|
967
|
+
all: [
|
|
968
|
+
intent
|
|
969
|
+
]
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
973
|
+
const intents = "all" in intent ? intent.all : [
|
|
974
|
+
intent
|
|
975
|
+
];
|
|
976
|
+
const first = intents[0];
|
|
977
|
+
const last = {
|
|
978
|
+
...params,
|
|
979
|
+
_schema: schema,
|
|
980
|
+
id: schema._tag,
|
|
981
|
+
data
|
|
982
|
+
};
|
|
983
|
+
return {
|
|
984
|
+
first,
|
|
985
|
+
last,
|
|
986
|
+
all: [
|
|
987
|
+
...intents,
|
|
988
|
+
last
|
|
989
|
+
]
|
|
990
|
+
};
|
|
991
|
+
};
|
|
992
|
+
var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
|
|
993
|
+
ns: Schema3.String,
|
|
994
|
+
count: Schema3.optional(Schema3.Number),
|
|
995
|
+
defaultValue: Schema3.optional(Schema3.String)
|
|
996
|
+
})))));
|
|
997
|
+
|
|
998
|
+
// src/plugin-intent/meta.ts
|
|
999
|
+
var meta = {
|
|
1000
|
+
id: "dxos.org/plugin/intent",
|
|
959
1001
|
name: "Intent"
|
|
960
|
-
}
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
// src/plugin-intent/actions.ts
|
|
1005
|
+
(function(IntentAction2) {
|
|
1006
|
+
class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
|
|
1007
|
+
input: Schema4.Struct({
|
|
1008
|
+
intents: Schema4.Array(Schema4.String),
|
|
1009
|
+
error: Schema4.optional(Schema4.String)
|
|
1010
|
+
}),
|
|
1011
|
+
output: Schema4.Void
|
|
1012
|
+
}) {
|
|
1013
|
+
}
|
|
1014
|
+
IntentAction2.Track = Track;
|
|
1015
|
+
class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
|
|
1016
|
+
input: Schema4.Struct({
|
|
1017
|
+
message: Label
|
|
1018
|
+
}),
|
|
1019
|
+
output: Schema4.Void
|
|
1020
|
+
}) {
|
|
1021
|
+
}
|
|
1022
|
+
IntentAction2.ShowUndo = ShowUndo;
|
|
1023
|
+
})(IntentAction || (IntentAction = {}));
|
|
1024
|
+
var IntentAction;
|
|
1025
|
+
|
|
1026
|
+
// src/plugin-intent/errors.ts
|
|
1027
|
+
var BaseError = class extends Error {
|
|
1028
|
+
code;
|
|
1029
|
+
context;
|
|
1030
|
+
constructor(code, message, context) {
|
|
1031
|
+
super(message ?? code, {
|
|
1032
|
+
cause: context
|
|
1033
|
+
}), this.code = code, this.context = context;
|
|
1034
|
+
this.name = code;
|
|
1035
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
var NoResolversError = class extends BaseError {
|
|
1039
|
+
constructor(action) {
|
|
1040
|
+
super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
|
|
1041
|
+
action
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
var CycleDetectedError = class extends BaseError {
|
|
1046
|
+
constructor(context) {
|
|
1047
|
+
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
// src/plugin-intent/IntentPlugin.ts
|
|
1052
|
+
var IntentPlugin = definePlugin(meta, () => [
|
|
961
1053
|
defineModule({
|
|
962
|
-
id: `${
|
|
1054
|
+
id: `${meta.id}/module/dispatcher`,
|
|
963
1055
|
// TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
|
|
964
1056
|
// This is fine for now because it's how it worked prior to capabilities api anyways.
|
|
965
1057
|
// In the future, the intent dispatcher should be able to be reset without resetting the entire app.
|
|
@@ -967,15 +1059,14 @@ var IntentPlugin = () => definePlugin({
|
|
|
967
1059
|
activatesAfter: [
|
|
968
1060
|
Events.DispatcherReady
|
|
969
1061
|
],
|
|
970
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1062
|
+
activate: lazy(() => import("./intent-dispatcher-254AZ6EE.mjs"))
|
|
971
1063
|
})
|
|
972
1064
|
]);
|
|
973
1065
|
|
|
974
1066
|
// src/common/layout.ts
|
|
975
1067
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
976
|
-
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
977
1068
|
(function(LayoutAction2) {
|
|
978
|
-
LayoutAction2.UPDATE_LAYOUT = `${
|
|
1069
|
+
LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
|
|
979
1070
|
class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
980
1071
|
input: Schema5.Struct({
|
|
981
1072
|
part: Schema5.String.annotations({
|
|
@@ -1312,7 +1403,7 @@ var LayoutAction;
|
|
|
1312
1403
|
var createSurface = (definition) => definition;
|
|
1313
1404
|
|
|
1314
1405
|
// src/common/translations.ts
|
|
1315
|
-
import
|
|
1406
|
+
import * as Schema6 from "effect/Schema";
|
|
1316
1407
|
var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
|
|
1317
1408
|
key: Schema6.String,
|
|
1318
1409
|
value: Schema6.Any
|
|
@@ -1337,7 +1428,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1337
1428
|
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1338
1429
|
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1339
1430
|
if (candidates.length === 0) {
|
|
1340
|
-
yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1431
|
+
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1341
1432
|
}
|
|
1342
1433
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1343
1434
|
const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
|
|
@@ -1349,7 +1440,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1349
1440
|
const dispatch = (intentChain, depth = 0) => {
|
|
1350
1441
|
return Effect3.gen(function* () {
|
|
1351
1442
|
if (depth > executionLimit) {
|
|
1352
|
-
yield* Effect3.fail(new CycleDetectedError());
|
|
1443
|
+
return yield* Effect3.fail(new CycleDetectedError());
|
|
1353
1444
|
}
|
|
1354
1445
|
const resultsRef = yield* Ref2.make([]);
|
|
1355
1446
|
for (const intent of intentChain.all) {
|
|
@@ -1371,7 +1462,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1371
1462
|
}
|
|
1372
1463
|
}
|
|
1373
1464
|
if (result2.error) {
|
|
1374
|
-
yield* Effect3.fail(result2.error);
|
|
1465
|
+
return yield* Effect3.fail(result2.error);
|
|
1375
1466
|
}
|
|
1376
1467
|
}
|
|
1377
1468
|
const results = yield* resultsRef.get;
|
|
@@ -1387,7 +1478,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1387
1478
|
return next;
|
|
1388
1479
|
});
|
|
1389
1480
|
if (result.undoable && isUndoable(results)) {
|
|
1390
|
-
yield*
|
|
1481
|
+
yield* Function2.pipe(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1391
1482
|
message: result.undoable.message
|
|
1392
1483
|
})), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
|
|
1393
1484
|
}
|
|
@@ -1400,7 +1491,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1400
1491
|
})).catch((error) => {
|
|
1401
1492
|
log3.catch(error, void 0, {
|
|
1402
1493
|
F: __dxlog_file3,
|
|
1403
|
-
L:
|
|
1494
|
+
L: 274,
|
|
1404
1495
|
S: void 0,
|
|
1405
1496
|
C: (f, a) => f(...a)
|
|
1406
1497
|
});
|
|
@@ -1415,7 +1506,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1415
1506
|
const last = history.findLastIndex(isUndoable);
|
|
1416
1507
|
const result = last !== -1 ? history[last] : void 0;
|
|
1417
1508
|
if (result) {
|
|
1418
|
-
const
|
|
1509
|
+
const all2 = result.map(({ _intent, undoable }) => {
|
|
1419
1510
|
const data = _intent.data;
|
|
1420
1511
|
const undoData = undoable?.data ?? {};
|
|
1421
1512
|
return {
|
|
@@ -1428,9 +1519,9 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1428
1519
|
};
|
|
1429
1520
|
});
|
|
1430
1521
|
const intent = {
|
|
1431
|
-
first:
|
|
1432
|
-
last:
|
|
1433
|
-
all
|
|
1522
|
+
first: all2[0],
|
|
1523
|
+
last: all2.at(-1),
|
|
1524
|
+
all: all2
|
|
1434
1525
|
};
|
|
1435
1526
|
yield* Ref2.update(historyRef, (h) => h.filter((_, index) => index !== last));
|
|
1436
1527
|
return yield* dispatch(intent);
|
|
@@ -1453,7 +1544,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1453
1544
|
};
|
|
1454
1545
|
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1455
1546
|
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1456
|
-
var intent_dispatcher_default = (context) => {
|
|
1547
|
+
var intent_dispatcher_default = ((context) => {
|
|
1457
1548
|
const state = live2({
|
|
1458
1549
|
dispatch: defaultEffect,
|
|
1459
1550
|
dispatchPromise: defaultPromise,
|
|
@@ -1475,7 +1566,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1475
1566
|
state.undo = undo;
|
|
1476
1567
|
state.undoPromise = undoPromise;
|
|
1477
1568
|
return contributes(Capabilities.IntentDispatcher, state);
|
|
1478
|
-
};
|
|
1569
|
+
});
|
|
1479
1570
|
|
|
1480
1571
|
export {
|
|
1481
1572
|
defineCapability,
|
|
@@ -1502,19 +1593,18 @@ export {
|
|
|
1502
1593
|
createIntent,
|
|
1503
1594
|
chain,
|
|
1504
1595
|
Label,
|
|
1505
|
-
INTENT_PLUGIN,
|
|
1506
|
-
INTENT_ACTION,
|
|
1507
1596
|
IntentAction,
|
|
1597
|
+
BaseError,
|
|
1598
|
+
NoResolversError,
|
|
1599
|
+
CycleDetectedError,
|
|
1508
1600
|
createResolver,
|
|
1509
1601
|
createDispatcher,
|
|
1510
1602
|
intent_dispatcher_default,
|
|
1511
1603
|
IntentPlugin,
|
|
1512
|
-
LAYOUT_PLUGIN,
|
|
1513
|
-
LAYOUT_ACTION,
|
|
1514
1604
|
LayoutAction,
|
|
1515
1605
|
createSurface,
|
|
1516
1606
|
ResourceKey,
|
|
1517
1607
|
ResourceLanguage,
|
|
1518
1608
|
Resource
|
|
1519
1609
|
};
|
|
1520
|
-
//# sourceMappingURL=chunk-
|
|
1610
|
+
//# sourceMappingURL=chunk-3RRWO5TD.mjs.map
|