@dxos/app-framework 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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-OIEZZC45.mjs} +32 -31
- package/dist/lib/browser/app-graph-builder-OIEZZC45.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-6XKO24JP.mjs} +254 -184
- package/dist/lib/browser/chunk-6XKO24JP.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/{chunk-2636QSIK.mjs → chunk-WPW5VVAX.mjs} +399 -266
- package/dist/lib/browser/chunk-WPW5VVAX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -56
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs → intent-dispatcher-LZ4AE66E.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-QVCKRX6G.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-QVCKRX6G.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react/index.mjs +34 -0
- package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-CNPHOYTJ.mjs} +5 -5
- package/dist/lib/browser/store-CNPHOYTJ.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +17 -21
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{app-graph-builder-QHIJUYYW.mjs → app-graph-builder-EBU4NVWD.mjs} +32 -31
- package/dist/lib/node-esm/app-graph-builder-EBU4NVWD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-3UPX5OIS.mjs} +254 -184
- package/dist/lib/node-esm/chunk-3UPX5OIS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-XJZGUJ3H.mjs} +399 -266
- package/dist/lib/node-esm/chunk-XJZGUJ3H.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 -56
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs → intent-dispatcher-MGOJ3CHD.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-URF3HN3G.mjs} +7 -7
- package/dist/lib/node-esm/intent-resolver-URF3HN3G.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react/index.mjs +35 -0
- package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-RK5B4XEL.mjs} +5 -5
- package/dist/lib/node-esm/store-RK5B4XEL.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +17 -21
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/common/capabilities.d.ts +111 -38
- 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 +19 -16
- 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/core/capabilities.d.ts +19 -16
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts +7 -3
- 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 +0 -2
- 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/Main.d.ts.map +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/App.d.ts +10 -0
- package/dist/types/src/react/App.d.ts.map +1 -0
- package/dist/types/src/react/App.stories.d.ts +14 -0
- package/dist/types/src/react/App.stories.d.ts.map +1 -0
- package/dist/types/src/react/DefaultFallback.d.ts +8 -0
- package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
- 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 +5 -5
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +8 -10
- 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/index.d.ts +2 -0
- package/dist/types/src/react/index.d.ts.map +1 -1
- package/dist/types/src/react/types.d.ts +14 -0
- package/dist/types/src/react/types.d.ts.map +1 -0
- package/dist/types/src/{App.d.ts → react/useApp.d.ts} +7 -6
- package/dist/types/src/react/useApp.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/react/useLoading.d.ts +19 -0
- package/dist/types/src/react/useLoading.d.ts.map +1 -0
- 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 +5 -1
- package/package.json +46 -38
- package/src/common/capabilities.ts +120 -19
- 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 +23 -21
- package/src/common/translations.ts +1 -1
- package/src/core/capabilities.test.ts +3 -3
- package/src/core/capabilities.ts +36 -27
- package/src/core/manager.test.ts +22 -21
- package/src/core/manager.ts +141 -56
- package/src/core/plugin.ts +13 -2
- package/src/helpers.test.ts +1 -1
- package/src/index.ts +0 -2
- package/src/playground/debug/Debug.tsx +1 -1
- package/src/playground/debug/plugin.ts +7 -8
- package/src/playground/generator/Main.tsx +0 -1
- 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 +21 -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 +25 -22
- package/src/plugin-settings/intent-resolver.ts +5 -4
- package/src/plugin-settings/meta.ts +10 -0
- package/src/plugin-settings/store.ts +3 -3
- package/src/plugin-settings/translations.ts +4 -4
- package/src/react/App.stories.tsx +33 -0
- package/src/react/App.tsx +59 -0
- package/src/react/DefaultFallback.tsx +26 -0
- package/src/react/ErrorBoundary.tsx +26 -15
- package/src/react/IntentContext.tsx +3 -2
- package/src/react/Surface.stories.tsx +81 -52
- package/src/react/Surface.tsx +70 -38
- package/src/react/common.ts +2 -1
- package/src/react/index.ts +4 -0
- package/src/react/types.ts +38 -0
- package/src/react/useApp.tsx +165 -0
- package/src/react/useCapabilities.ts +4 -3
- package/src/react/useLoading.tsx +70 -0
- package/src/testing/withPluginManager.stories.tsx +9 -5
- package/src/testing/withPluginManager.tsx +33 -32
- package/tsconfig.json +15 -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/browser/store-LFKDWHUQ.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -79
- 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/lib/node-esm/store-53XDUBMD.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -80
- package/dist/types/src/App.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/App.tsx +0 -276
- package/src/worker.ts +0 -11
- 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-LZ4AE66E.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → react/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-MGOJ3CHD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
|
@@ -1,106 +1,15 @@
|
|
|
1
1
|
// src/plugin-intent/intent-dispatcher.ts
|
|
2
|
-
import
|
|
2
|
+
import * as Effect3 from "effect/Effect";
|
|
3
|
+
import * as Function2 from "effect/Function";
|
|
4
|
+
import * as Option from "effect/Option";
|
|
5
|
+
import * as Ref2 from "effect/Ref";
|
|
3
6
|
import { live as live2 } from "@dxos/live-object";
|
|
4
7
|
import { log as log3 } from "@dxos/log";
|
|
5
8
|
import { byPosition } from "@dxos/util";
|
|
6
9
|
|
|
7
|
-
// src/plugin-intent/actions.ts
|
|
8
|
-
import { Schema as Schema2 } from "effect";
|
|
9
|
-
|
|
10
|
-
// src/plugin-intent/intent.ts
|
|
11
|
-
import { Schema } from "effect";
|
|
12
|
-
var createIntent = (schema, data = {}, params = {}) => {
|
|
13
|
-
const _ = Schema.validateSync(schema.fields.input)(data);
|
|
14
|
-
const intent = {
|
|
15
|
-
...params,
|
|
16
|
-
_schema: schema,
|
|
17
|
-
id: schema._tag,
|
|
18
|
-
data
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
first: intent,
|
|
22
|
-
last: intent,
|
|
23
|
-
all: [
|
|
24
|
-
intent
|
|
25
|
-
]
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
29
|
-
const intents = "all" in intent ? intent.all : [
|
|
30
|
-
intent
|
|
31
|
-
];
|
|
32
|
-
const first = intents[0];
|
|
33
|
-
const last = {
|
|
34
|
-
...params,
|
|
35
|
-
_schema: schema,
|
|
36
|
-
id: schema._tag,
|
|
37
|
-
data
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
first,
|
|
41
|
-
last,
|
|
42
|
-
all: [
|
|
43
|
-
...intents,
|
|
44
|
-
last
|
|
45
|
-
]
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.String, Schema.mutable(Schema.Struct({
|
|
49
|
-
ns: Schema.String,
|
|
50
|
-
count: Schema.optional(Schema.Number),
|
|
51
|
-
defaultValue: Schema.optional(Schema.String)
|
|
52
|
-
})))));
|
|
53
|
-
|
|
54
|
-
// src/plugin-intent/actions.ts
|
|
55
|
-
var INTENT_PLUGIN = "dxos.org/plugin/intent";
|
|
56
|
-
var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
57
|
-
(function(IntentAction2) {
|
|
58
|
-
class Track extends Schema2.TaggedClass()(`${INTENT_ACTION}/track`, {
|
|
59
|
-
input: Schema2.Struct({
|
|
60
|
-
intents: Schema2.Array(Schema2.String),
|
|
61
|
-
error: Schema2.optional(Schema2.String)
|
|
62
|
-
}),
|
|
63
|
-
output: Schema2.Void
|
|
64
|
-
}) {
|
|
65
|
-
}
|
|
66
|
-
IntentAction2.Track = Track;
|
|
67
|
-
class ShowUndo extends Schema2.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
|
|
68
|
-
input: Schema2.Struct({
|
|
69
|
-
message: Label
|
|
70
|
-
}),
|
|
71
|
-
output: Schema2.Void
|
|
72
|
-
}) {
|
|
73
|
-
}
|
|
74
|
-
IntentAction2.ShowUndo = ShowUndo;
|
|
75
|
-
})(IntentAction || (IntentAction = {}));
|
|
76
|
-
var IntentAction;
|
|
77
|
-
|
|
78
|
-
// src/plugin-intent/errors.ts
|
|
79
|
-
var BaseError = class extends Error {
|
|
80
|
-
constructor(code, message, context) {
|
|
81
|
-
super(message ?? code, {
|
|
82
|
-
cause: context
|
|
83
|
-
}), this.code = code, this.context = context;
|
|
84
|
-
this.name = code;
|
|
85
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
var NoResolversError = class extends BaseError {
|
|
89
|
-
constructor(action) {
|
|
90
|
-
super("NO_RESOLVERS", "No resolvers were found for the action", {
|
|
91
|
-
action
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var CycleDetectedError = class extends BaseError {
|
|
96
|
-
constructor(context) {
|
|
97
|
-
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
10
|
// src/core/capabilities.ts
|
|
102
|
-
import {
|
|
103
|
-
import
|
|
11
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
104
13
|
import { Trigger } from "@dxos/async";
|
|
105
14
|
import { invariant } from "@dxos/invariant";
|
|
106
15
|
import { log } from "@dxos/log";
|
|
@@ -112,6 +21,8 @@ var defineCapability = (identifier) => {
|
|
|
112
21
|
};
|
|
113
22
|
};
|
|
114
23
|
var CapabilityImpl = class {
|
|
24
|
+
moduleId;
|
|
25
|
+
implementation;
|
|
115
26
|
constructor(moduleId, implementation) {
|
|
116
27
|
this.moduleId = moduleId;
|
|
117
28
|
this.implementation = implementation;
|
|
@@ -129,31 +40,44 @@ var lazy = (c) => async (props) => {
|
|
|
129
40
|
return async () => getCapability(props);
|
|
130
41
|
};
|
|
131
42
|
var PluginContext = class {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
43
|
+
_registry;
|
|
44
|
+
_capabilityImpls = Atom.family(() => {
|
|
45
|
+
return Atom.make([]).pipe(Atom.keepAlive);
|
|
46
|
+
});
|
|
47
|
+
_capabilities = Atom.family((id) => {
|
|
48
|
+
return Atom.make((get) => {
|
|
49
|
+
const current = get(this._capabilityImpls(id));
|
|
50
|
+
return current.map((c) => c.implementation);
|
|
141
51
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return current[0];
|
|
52
|
+
});
|
|
53
|
+
_capability = Atom.family((id) => {
|
|
54
|
+
return Atom.make((get) => {
|
|
55
|
+
const current = get(this._capabilities(id));
|
|
56
|
+
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
57
|
+
F: __dxlog_file,
|
|
58
|
+
L: 126,
|
|
59
|
+
S: this,
|
|
60
|
+
A: [
|
|
61
|
+
"current.length > 0",
|
|
62
|
+
"`No capability found for ${id}`"
|
|
63
|
+
]
|
|
155
64
|
});
|
|
65
|
+
return current[0];
|
|
156
66
|
});
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Activates plugins based on the activation event.
|
|
70
|
+
* @param event The activation event.
|
|
71
|
+
* @returns Whether the activation was successful.
|
|
72
|
+
*/
|
|
73
|
+
activate;
|
|
74
|
+
/**
|
|
75
|
+
* Re-activates the modules that were activated by the event.
|
|
76
|
+
* @param event The activation event.
|
|
77
|
+
* @returns Whether the reset was successful.
|
|
78
|
+
*/
|
|
79
|
+
reset;
|
|
80
|
+
constructor({ registry, activate, reset }) {
|
|
157
81
|
this._registry = registry;
|
|
158
82
|
this.activate = activate;
|
|
159
83
|
this.reset = reset;
|
|
@@ -177,7 +101,7 @@ var PluginContext = class {
|
|
|
177
101
|
count: current.length
|
|
178
102
|
}, {
|
|
179
103
|
F: __dxlog_file,
|
|
180
|
-
L:
|
|
104
|
+
L: 170,
|
|
181
105
|
S: this,
|
|
182
106
|
C: (f, a) => f(...a)
|
|
183
107
|
});
|
|
@@ -198,7 +122,7 @@ var PluginContext = class {
|
|
|
198
122
|
count: current.length
|
|
199
123
|
}, {
|
|
200
124
|
F: __dxlog_file,
|
|
201
|
-
L:
|
|
125
|
+
L: 189,
|
|
202
126
|
S: this,
|
|
203
127
|
C: (f, a) => f(...a)
|
|
204
128
|
});
|
|
@@ -207,26 +131,26 @@ var PluginContext = class {
|
|
|
207
131
|
id: interfaceDef.identifier
|
|
208
132
|
}, {
|
|
209
133
|
F: __dxlog_file,
|
|
210
|
-
L:
|
|
134
|
+
L: 191,
|
|
211
135
|
S: this,
|
|
212
136
|
C: (f, a) => f(...a)
|
|
213
137
|
});
|
|
214
138
|
}
|
|
215
139
|
}
|
|
216
140
|
/**
|
|
217
|
-
* Get the
|
|
218
|
-
* Primarily useful for deriving other
|
|
141
|
+
* Get the Atom reference to the available capabilities for a given interface.
|
|
142
|
+
* Primarily useful for deriving other Atom values based on the capabilities or
|
|
219
143
|
* for subscribing to changes in the capabilities.
|
|
220
|
-
* @returns An
|
|
144
|
+
* @returns An atom reference to the available capabilities.
|
|
221
145
|
*/
|
|
222
146
|
capabilities(interfaceDef) {
|
|
223
147
|
return this._capabilities(interfaceDef.identifier);
|
|
224
148
|
}
|
|
225
149
|
/**
|
|
226
|
-
* Get the
|
|
227
|
-
* Primarily useful for deriving other
|
|
150
|
+
* Get the Atom reference to the available capabilities for a given interface.
|
|
151
|
+
* Primarily useful for deriving other Atom values based on the capability or
|
|
228
152
|
* for subscribing to changes in the capability.
|
|
229
|
-
* @returns An
|
|
153
|
+
* @returns An atom reference to the available capability.
|
|
230
154
|
* @throws If no capability is found.
|
|
231
155
|
*/
|
|
232
156
|
capability(interfaceDef) {
|
|
@@ -297,20 +221,35 @@ var getEvents = (events) => "type" in events ? events.events : [
|
|
|
297
221
|
];
|
|
298
222
|
|
|
299
223
|
// src/core/manager.ts
|
|
300
|
-
import { Registry } from "@effect-
|
|
224
|
+
import { Registry } from "@effect-atom/atom-react";
|
|
301
225
|
import { untracked } from "@preact/signals-core";
|
|
302
|
-
import
|
|
226
|
+
import * as Array from "effect/Array";
|
|
227
|
+
import * as Duration from "effect/Duration";
|
|
228
|
+
import * as Effect2 from "effect/Effect";
|
|
229
|
+
import * as Fiber from "effect/Fiber";
|
|
230
|
+
import * as Function from "effect/Function";
|
|
231
|
+
import * as HashSet from "effect/HashSet";
|
|
232
|
+
import * as Match from "effect/Match";
|
|
233
|
+
import * as Ref from "effect/Ref";
|
|
303
234
|
import { Event } from "@dxos/async";
|
|
304
235
|
import { live } from "@dxos/live-object";
|
|
305
236
|
import { log as log2 } from "@dxos/log";
|
|
306
237
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
|
|
307
|
-
var isPromise = (
|
|
308
|
-
return
|
|
238
|
+
var isPromise = (value2) => {
|
|
239
|
+
return value2 !== null && typeof value2 === "object" && "then" in value2;
|
|
309
240
|
};
|
|
310
241
|
var PluginManager = class {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
242
|
+
activation = new Event();
|
|
243
|
+
context;
|
|
244
|
+
registry;
|
|
245
|
+
// TODO(wittjosiah): Replace with Atom.
|
|
246
|
+
_state;
|
|
247
|
+
_pluginLoader;
|
|
248
|
+
_capabilities = /* @__PURE__ */ new Map();
|
|
249
|
+
_moduleMemoMap = /* @__PURE__ */ new Map();
|
|
250
|
+
_activatingEvents = Effect2.runSync(Ref.make([]));
|
|
251
|
+
_activatingModules = Effect2.runSync(Ref.make([]));
|
|
252
|
+
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
|
|
314
253
|
this.registry = registry ?? Registry.make();
|
|
315
254
|
this.context = new PluginContext({
|
|
316
255
|
registry: this.registry,
|
|
@@ -324,8 +263,8 @@ var PluginManager = class {
|
|
|
324
263
|
enabled,
|
|
325
264
|
modules: [],
|
|
326
265
|
active: [],
|
|
327
|
-
|
|
328
|
-
|
|
266
|
+
eventsFired: [],
|
|
267
|
+
pendingReset: []
|
|
329
268
|
});
|
|
330
269
|
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
331
270
|
core.forEach((id) => this.enable(id));
|
|
@@ -397,7 +336,7 @@ var PluginManager = class {
|
|
|
397
336
|
id
|
|
398
337
|
}, {
|
|
399
338
|
F: __dxlog_file2,
|
|
400
|
-
L:
|
|
339
|
+
L: 164,
|
|
401
340
|
S: this,
|
|
402
341
|
C: (f, a) => f(...a)
|
|
403
342
|
});
|
|
@@ -416,7 +355,7 @@ var PluginManager = class {
|
|
|
416
355
|
id
|
|
417
356
|
}, {
|
|
418
357
|
F: __dxlog_file2,
|
|
419
|
-
L:
|
|
358
|
+
L: 177,
|
|
420
359
|
S: this,
|
|
421
360
|
C: (f, a) => f(...a)
|
|
422
361
|
});
|
|
@@ -437,7 +376,7 @@ var PluginManager = class {
|
|
|
437
376
|
]
|
|
438
377
|
}, {
|
|
439
378
|
F: __dxlog_file2,
|
|
440
|
-
L:
|
|
379
|
+
L: 192,
|
|
441
380
|
S: this,
|
|
442
381
|
C: (f, a) => f(...a)
|
|
443
382
|
});
|
|
@@ -457,7 +396,7 @@ var PluginManager = class {
|
|
|
457
396
|
id
|
|
458
397
|
}, {
|
|
459
398
|
F: __dxlog_file2,
|
|
460
|
-
L:
|
|
399
|
+
L: 210,
|
|
461
400
|
S: this,
|
|
462
401
|
C: (f, a) => f(...a)
|
|
463
402
|
});
|
|
@@ -479,7 +418,7 @@ var PluginManager = class {
|
|
|
479
418
|
id
|
|
480
419
|
}, {
|
|
481
420
|
F: __dxlog_file2,
|
|
482
|
-
L:
|
|
421
|
+
L: 227,
|
|
483
422
|
S: this,
|
|
484
423
|
C: (f, a) => f(...a)
|
|
485
424
|
});
|
|
@@ -531,7 +470,7 @@ var PluginManager = class {
|
|
|
531
470
|
id: plugin.meta.id
|
|
532
471
|
}, {
|
|
533
472
|
F: __dxlog_file2,
|
|
534
|
-
L:
|
|
473
|
+
L: 280,
|
|
535
474
|
S: this,
|
|
536
475
|
C: (f, a) => f(...a)
|
|
537
476
|
});
|
|
@@ -546,7 +485,7 @@ var PluginManager = class {
|
|
|
546
485
|
id
|
|
547
486
|
}, {
|
|
548
487
|
F: __dxlog_file2,
|
|
549
|
-
L:
|
|
488
|
+
L: 290,
|
|
550
489
|
S: this,
|
|
551
490
|
C: (f, a) => f(...a)
|
|
552
491
|
});
|
|
@@ -562,7 +501,7 @@ var PluginManager = class {
|
|
|
562
501
|
id: module.id
|
|
563
502
|
}, {
|
|
564
503
|
F: __dxlog_file2,
|
|
565
|
-
L:
|
|
504
|
+
L: 300,
|
|
566
505
|
S: this,
|
|
567
506
|
C: (f, a) => f(...a)
|
|
568
507
|
});
|
|
@@ -577,7 +516,7 @@ var PluginManager = class {
|
|
|
577
516
|
id
|
|
578
517
|
}, {
|
|
579
518
|
F: __dxlog_file2,
|
|
580
|
-
L:
|
|
519
|
+
L: 310,
|
|
581
520
|
S: this,
|
|
582
521
|
C: (f, a) => f(...a)
|
|
583
522
|
});
|
|
@@ -605,13 +544,13 @@ var PluginManager = class {
|
|
|
605
544
|
_setPendingResetByModule(module) {
|
|
606
545
|
return untracked(() => {
|
|
607
546
|
const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._state.eventsFired.includes(key));
|
|
608
|
-
const pendingReset = Array.
|
|
547
|
+
const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
|
|
609
548
|
if (pendingReset.length > 0) {
|
|
610
549
|
log2("pending reset", {
|
|
611
550
|
events: pendingReset
|
|
612
551
|
}, {
|
|
613
552
|
F: __dxlog_file2,
|
|
614
|
-
L:
|
|
553
|
+
L: 348,
|
|
615
554
|
S: this,
|
|
616
555
|
C: (f, a) => f(...a)
|
|
617
556
|
});
|
|
@@ -623,35 +562,40 @@ var PluginManager = class {
|
|
|
623
562
|
* @internal
|
|
624
563
|
*/
|
|
625
564
|
// TODO(wittjosiah): Improve error typing.
|
|
626
|
-
_activate(event) {
|
|
565
|
+
_activate(event, params) {
|
|
627
566
|
return Effect2.gen(this, function* () {
|
|
628
567
|
const key = typeof event === "string" ? event : eventKey(event);
|
|
629
568
|
log2("activating", {
|
|
630
|
-
key
|
|
569
|
+
key,
|
|
570
|
+
...params
|
|
631
571
|
}, {
|
|
632
572
|
F: __dxlog_file2,
|
|
633
|
-
L:
|
|
573
|
+
L: 364,
|
|
634
574
|
S: this,
|
|
635
575
|
C: (f, a) => f(...a)
|
|
636
576
|
});
|
|
577
|
+
yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
|
|
637
578
|
const pendingIndex = this._state.pendingReset.findIndex((event2) => event2 === key);
|
|
638
579
|
if (pendingIndex !== -1) {
|
|
639
580
|
this._state.pendingReset.splice(pendingIndex, 1);
|
|
640
581
|
}
|
|
582
|
+
const activatingEvents = yield* this._activatingEvents;
|
|
583
|
+
const activatingModules = yield* this._activatingModules;
|
|
641
584
|
const modules = this._getInactiveModulesByEvent(key).filter((module) => {
|
|
642
585
|
const allOf2 = isAllOf(module.activatesOn);
|
|
643
586
|
if (!allOf2) {
|
|
644
587
|
return true;
|
|
645
588
|
}
|
|
646
589
|
const events = module.activatesOn.events.filter((event2) => eventKey(event2) !== key);
|
|
647
|
-
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)));
|
|
590
|
+
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
|
|
648
591
|
});
|
|
592
|
+
yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
|
|
649
593
|
if (modules.length === 0) {
|
|
650
594
|
log2("no modules to activate", {
|
|
651
595
|
key
|
|
652
596
|
}, {
|
|
653
597
|
F: __dxlog_file2,
|
|
654
|
-
L:
|
|
598
|
+
L: 395,
|
|
655
599
|
S: this,
|
|
656
600
|
C: (f, a) => f(...a)
|
|
657
601
|
});
|
|
@@ -665,7 +609,7 @@ var PluginManager = class {
|
|
|
665
609
|
modules: modules.map((module) => module.id)
|
|
666
610
|
}, {
|
|
667
611
|
F: __dxlog_file2,
|
|
668
|
-
L:
|
|
612
|
+
L: 402,
|
|
669
613
|
S: this,
|
|
670
614
|
C: (f, a) => f(...a)
|
|
671
615
|
});
|
|
@@ -673,29 +617,34 @@ var PluginManager = class {
|
|
|
673
617
|
event: key,
|
|
674
618
|
state: "activating"
|
|
675
619
|
});
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
})), {
|
|
620
|
+
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, {
|
|
621
|
+
before: key
|
|
622
|
+
})), Effect2.allWith({
|
|
680
623
|
concurrency: "unbounded"
|
|
681
|
-
});
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
A.map(([module, getCapabilities2]) => this._activateModule(module, getCapabilities2)),
|
|
686
|
-
// TODO(wittjosiah): This currently can't be run in parallel.
|
|
687
|
-
// Running this with concurrency causes races with `allOf` activation events.
|
|
688
|
-
Effect2.all,
|
|
689
|
-
Effect2.either
|
|
690
|
-
);
|
|
691
|
-
if (Either.isLeft(result)) {
|
|
624
|
+
}));
|
|
625
|
+
const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
626
|
+
concurrency: "unbounded"
|
|
627
|
+
}), Effect2.catchAll((error) => {
|
|
692
628
|
this.activation.emit({
|
|
693
629
|
event: key,
|
|
694
630
|
state: "error",
|
|
695
|
-
error
|
|
631
|
+
error
|
|
696
632
|
});
|
|
697
|
-
|
|
698
|
-
}
|
|
633
|
+
return Effect2.fail(error);
|
|
634
|
+
}));
|
|
635
|
+
yield* Function.pipe(
|
|
636
|
+
modules,
|
|
637
|
+
Array.zip(getCapabilities),
|
|
638
|
+
Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
|
|
639
|
+
Effect2.all
|
|
640
|
+
);
|
|
641
|
+
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, {
|
|
642
|
+
after: key
|
|
643
|
+
})), Effect2.allWith({
|
|
644
|
+
concurrency: "unbounded"
|
|
645
|
+
}));
|
|
646
|
+
yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
|
|
647
|
+
yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
|
|
699
648
|
if (!this._state.eventsFired.includes(key)) {
|
|
700
649
|
this._state.eventsFired.push(key);
|
|
701
650
|
}
|
|
@@ -707,39 +656,76 @@ var PluginManager = class {
|
|
|
707
656
|
key
|
|
708
657
|
}, {
|
|
709
658
|
F: __dxlog_file2,
|
|
710
|
-
L:
|
|
659
|
+
L: 458,
|
|
711
660
|
S: this,
|
|
712
661
|
C: (f, a) => f(...a)
|
|
713
662
|
});
|
|
714
663
|
return true;
|
|
715
664
|
});
|
|
716
665
|
}
|
|
717
|
-
|
|
666
|
+
// Memoized with _moduleMemoMap
|
|
667
|
+
_loadModule = (mod) => Effect2.tryPromise({
|
|
668
|
+
try: async () => {
|
|
669
|
+
const entry = this._moduleMemoMap.get(mod.id);
|
|
670
|
+
if (entry) {
|
|
671
|
+
return entry;
|
|
672
|
+
}
|
|
673
|
+
const promise2 = (async () => {
|
|
674
|
+
const start = performance.now();
|
|
675
|
+
let failed = false;
|
|
676
|
+
try {
|
|
677
|
+
log2("loading module", {
|
|
678
|
+
module: mod.id
|
|
679
|
+
}, {
|
|
680
|
+
F: __dxlog_file2,
|
|
681
|
+
L: 477,
|
|
682
|
+
S: this,
|
|
683
|
+
C: (f, a) => f(...a)
|
|
684
|
+
});
|
|
685
|
+
let activationResult = await mod.activate(this.context);
|
|
686
|
+
if (typeof activationResult === "function") {
|
|
687
|
+
activationResult = await activationResult();
|
|
688
|
+
}
|
|
689
|
+
return Array.isArray(activationResult) ? activationResult : [
|
|
690
|
+
activationResult
|
|
691
|
+
];
|
|
692
|
+
} catch (error) {
|
|
693
|
+
failed = true;
|
|
694
|
+
throw error;
|
|
695
|
+
} finally {
|
|
696
|
+
performance.measure("activate-module", {
|
|
697
|
+
start,
|
|
698
|
+
end: performance.now(),
|
|
699
|
+
detail: {
|
|
700
|
+
module: mod.id
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
log2("loaded module", {
|
|
704
|
+
module: mod.id,
|
|
705
|
+
elapsed: performance.now() - start,
|
|
706
|
+
failed
|
|
707
|
+
}, {
|
|
708
|
+
F: __dxlog_file2,
|
|
709
|
+
L: 495,
|
|
710
|
+
S: this,
|
|
711
|
+
C: (f, a) => f(...a)
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
})();
|
|
715
|
+
this._moduleMemoMap.set(mod.id, promise2);
|
|
716
|
+
return promise2;
|
|
717
|
+
},
|
|
718
|
+
catch: (error) => error
|
|
719
|
+
}).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`, {
|
|
720
|
+
module: mod.id
|
|
721
|
+
}, {
|
|
722
|
+
F: __dxlog_file2,
|
|
723
|
+
L: 506,
|
|
724
|
+
S: this,
|
|
725
|
+
C: (f, a) => f(...a)
|
|
726
|
+
}))))));
|
|
727
|
+
_contributeCapabilities(module, capabilities) {
|
|
718
728
|
return Effect2.gen(this, function* () {
|
|
719
|
-
yield* Effect2.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {
|
|
720
|
-
concurrency: "unbounded"
|
|
721
|
-
});
|
|
722
|
-
log2("activating module...", {
|
|
723
|
-
module: module.id
|
|
724
|
-
}, {
|
|
725
|
-
F: __dxlog_file2,
|
|
726
|
-
L: 421,
|
|
727
|
-
S: this,
|
|
728
|
-
C: (f, a) => f(...a)
|
|
729
|
-
});
|
|
730
|
-
const maybeCapabilities = typeof getCapabilities === "function" ? getCapabilities() : getCapabilities;
|
|
731
|
-
const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(
|
|
732
|
-
// TODO(wittjosiah): Activate with an effect?
|
|
733
|
-
// Match.when(Effect.isEffect, (effect) => effect),
|
|
734
|
-
Match.when(isPromise, (promise) => Effect2.tryPromise({
|
|
735
|
-
try: () => promise,
|
|
736
|
-
catch: (error) => error
|
|
737
|
-
})),
|
|
738
|
-
Match.orElse((program) => Effect2.succeed(program))
|
|
739
|
-
);
|
|
740
|
-
const capabilities = Match.value(resolvedCapabilities).pipe(Match.when(Array.isArray, (array) => array), Match.orElse((value) => [
|
|
741
|
-
value
|
|
742
|
-
]));
|
|
743
729
|
capabilities.forEach((capability) => {
|
|
744
730
|
this.context.contributeCapability({
|
|
745
731
|
module: module.id,
|
|
@@ -748,17 +734,6 @@ var PluginManager = class {
|
|
|
748
734
|
});
|
|
749
735
|
this._state.active.push(module.id);
|
|
750
736
|
this._capabilities.set(module.id, capabilities);
|
|
751
|
-
log2("activated module", {
|
|
752
|
-
module: module.id
|
|
753
|
-
}, {
|
|
754
|
-
F: __dxlog_file2,
|
|
755
|
-
L: 444,
|
|
756
|
-
S: this,
|
|
757
|
-
C: (f, a) => f(...a)
|
|
758
|
-
});
|
|
759
|
-
yield* Effect2.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {
|
|
760
|
-
concurrency: "unbounded"
|
|
761
|
-
});
|
|
762
737
|
});
|
|
763
738
|
}
|
|
764
739
|
_deactivate(id) {
|
|
@@ -781,17 +756,18 @@ var PluginManager = class {
|
|
|
781
756
|
id
|
|
782
757
|
}, {
|
|
783
758
|
F: __dxlog_file2,
|
|
784
|
-
L:
|
|
759
|
+
L: 540,
|
|
785
760
|
S: this,
|
|
786
761
|
C: (f, a) => f(...a)
|
|
787
762
|
});
|
|
763
|
+
this._moduleMemoMap.delete(id);
|
|
788
764
|
const capabilities = this._capabilities.get(id);
|
|
789
765
|
if (capabilities) {
|
|
790
766
|
for (const capability of capabilities) {
|
|
791
767
|
this.context.removeCapability(capability.interface, capability.implementation);
|
|
792
768
|
const program = capability.deactivate?.();
|
|
793
|
-
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (
|
|
794
|
-
try: () =>
|
|
769
|
+
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise2) => Effect2.tryPromise({
|
|
770
|
+
try: () => promise2,
|
|
795
771
|
catch: (error) => error
|
|
796
772
|
})), Match.orElse((program2) => Effect2.succeed(program2)));
|
|
797
773
|
}
|
|
@@ -805,7 +781,7 @@ var PluginManager = class {
|
|
|
805
781
|
id
|
|
806
782
|
}, {
|
|
807
783
|
F: __dxlog_file2,
|
|
808
|
-
L:
|
|
784
|
+
L: 567,
|
|
809
785
|
S: this,
|
|
810
786
|
C: (f, a) => f(...a)
|
|
811
787
|
});
|
|
@@ -819,7 +795,7 @@ var PluginManager = class {
|
|
|
819
795
|
key
|
|
820
796
|
}, {
|
|
821
797
|
F: __dxlog_file2,
|
|
822
|
-
L:
|
|
798
|
+
L: 575,
|
|
823
799
|
S: this,
|
|
824
800
|
C: (f, a) => f(...a)
|
|
825
801
|
});
|
|
@@ -835,9 +811,20 @@ var PluginManager = class {
|
|
|
835
811
|
});
|
|
836
812
|
}
|
|
837
813
|
};
|
|
814
|
+
var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
815
|
+
const togetherFiber = yield* Effect2.fork(togetherEffect);
|
|
816
|
+
const result = yield* effect;
|
|
817
|
+
yield* Fiber.interrupt(togetherFiber);
|
|
818
|
+
return result;
|
|
819
|
+
});
|
|
838
820
|
|
|
839
821
|
// src/core/plugin.ts
|
|
840
822
|
var PluginModule = class {
|
|
823
|
+
id;
|
|
824
|
+
activatesOn;
|
|
825
|
+
activatesBefore;
|
|
826
|
+
activatesAfter;
|
|
827
|
+
activate;
|
|
841
828
|
constructor(options) {
|
|
842
829
|
this.id = options.id;
|
|
843
830
|
this.activatesOn = options.activatesOn;
|
|
@@ -848,20 +835,27 @@ var PluginModule = class {
|
|
|
848
835
|
};
|
|
849
836
|
var defineModule = (options) => new PluginModule(options);
|
|
850
837
|
var Plugin = class {
|
|
851
|
-
|
|
852
|
-
|
|
838
|
+
meta;
|
|
839
|
+
modules;
|
|
840
|
+
constructor(meta2, modules) {
|
|
841
|
+
this.meta = meta2;
|
|
853
842
|
this.modules = modules;
|
|
854
843
|
}
|
|
855
844
|
};
|
|
856
|
-
var definePlugin = (
|
|
857
|
-
|
|
845
|
+
var definePlugin = (meta2, provider) => {
|
|
846
|
+
const factory = (args) => {
|
|
847
|
+
return new Plugin(meta2, provider(args));
|
|
848
|
+
};
|
|
849
|
+
return Object.assign(factory, {
|
|
850
|
+
meta: meta2
|
|
851
|
+
});
|
|
858
852
|
};
|
|
859
853
|
|
|
860
854
|
// src/common/capabilities.ts
|
|
861
855
|
(function(Capabilities2) {
|
|
862
|
-
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
863
856
|
Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
|
|
864
|
-
Capabilities2.
|
|
857
|
+
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
858
|
+
Capabilities2.AtomRegistry = defineCapability("dxos.org/app-framework/capability/atom-registry");
|
|
865
859
|
Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
|
|
866
860
|
Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
|
|
867
861
|
Capabilities2.ReactSurface = defineCapability("dxos.org/app-framework/common/react-surface");
|
|
@@ -875,30 +869,30 @@ var definePlugin = (meta, modules) => {
|
|
|
875
869
|
Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
|
|
876
870
|
Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
|
|
877
871
|
Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
|
|
878
|
-
Capabilities2.
|
|
879
|
-
Capabilities2.
|
|
872
|
+
Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
|
|
873
|
+
Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
874
|
+
Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
875
|
+
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
876
|
+
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
880
877
|
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
881
878
|
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
882
879
|
})(Capabilities || (Capabilities = {}));
|
|
883
880
|
var Capabilities;
|
|
884
881
|
|
|
885
882
|
// src/common/collaboration.ts
|
|
886
|
-
import
|
|
887
|
-
import {
|
|
883
|
+
import * as Schema from "effect/Schema";
|
|
884
|
+
import { ContentBlock } from "@dxos/types";
|
|
888
885
|
(function(CollaborationActions2) {
|
|
889
|
-
class
|
|
890
|
-
input:
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
label: Schema3.String.pipe(Schema3.optional)
|
|
895
|
-
}).annotations({
|
|
896
|
-
description: "Enables plugins to inject content blocks or references into a related entity."
|
|
886
|
+
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
887
|
+
input: Schema.Struct({
|
|
888
|
+
subject: Schema.Any,
|
|
889
|
+
anchor: Schema.String,
|
|
890
|
+
proposal: ContentBlock.Proposal
|
|
897
891
|
}),
|
|
898
|
-
output:
|
|
892
|
+
output: Schema.Void
|
|
899
893
|
}) {
|
|
900
894
|
}
|
|
901
|
-
CollaborationActions2.
|
|
895
|
+
CollaborationActions2.AcceptProposal = AcceptProposal;
|
|
902
896
|
})(CollaborationActions || (CollaborationActions = {}));
|
|
903
897
|
var CollaborationActions;
|
|
904
898
|
|
|
@@ -921,7 +915,7 @@ var CollaborationActions;
|
|
|
921
915
|
var Events;
|
|
922
916
|
|
|
923
917
|
// src/common/file.ts
|
|
924
|
-
import
|
|
918
|
+
import * as Schema2 from "effect/Schema";
|
|
925
919
|
var defaultFileTypes = {
|
|
926
920
|
images: [
|
|
927
921
|
"png",
|
|
@@ -941,23 +935,120 @@ var defaultFileTypes = {
|
|
|
941
935
|
"md"
|
|
942
936
|
]
|
|
943
937
|
};
|
|
944
|
-
var FileInfoSchema =
|
|
945
|
-
name:
|
|
946
|
-
type:
|
|
947
|
-
url:
|
|
948
|
-
cid:
|
|
938
|
+
var FileInfoSchema = Schema2.Struct({
|
|
939
|
+
name: Schema2.String,
|
|
940
|
+
type: Schema2.String,
|
|
941
|
+
url: Schema2.optional(Schema2.String),
|
|
942
|
+
cid: Schema2.optional(Schema2.String)
|
|
949
943
|
});
|
|
950
944
|
|
|
951
945
|
// src/common/layout.ts
|
|
952
|
-
import
|
|
946
|
+
import * as Schema5 from "effect/Schema";
|
|
953
947
|
|
|
954
|
-
// src/plugin-intent/
|
|
955
|
-
|
|
956
|
-
|
|
948
|
+
// src/plugin-intent/actions.ts
|
|
949
|
+
import * as Schema4 from "effect/Schema";
|
|
950
|
+
|
|
951
|
+
// src/plugin-intent/intent.ts
|
|
952
|
+
import * as Schema3 from "effect/Schema";
|
|
953
|
+
var createIntent = (schema, data = {}, params = {}) => {
|
|
954
|
+
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
955
|
+
const intent = {
|
|
956
|
+
...params,
|
|
957
|
+
_schema: schema,
|
|
958
|
+
id: schema._tag,
|
|
959
|
+
data
|
|
960
|
+
};
|
|
961
|
+
return {
|
|
962
|
+
first: intent,
|
|
963
|
+
last: intent,
|
|
964
|
+
all: [
|
|
965
|
+
intent
|
|
966
|
+
]
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
970
|
+
const intents = "all" in intent ? intent.all : [
|
|
971
|
+
intent
|
|
972
|
+
];
|
|
973
|
+
const first = intents[0];
|
|
974
|
+
const last = {
|
|
975
|
+
...params,
|
|
976
|
+
_schema: schema,
|
|
977
|
+
id: schema._tag,
|
|
978
|
+
data
|
|
979
|
+
};
|
|
980
|
+
return {
|
|
981
|
+
first,
|
|
982
|
+
last,
|
|
983
|
+
all: [
|
|
984
|
+
...intents,
|
|
985
|
+
last
|
|
986
|
+
]
|
|
987
|
+
};
|
|
988
|
+
};
|
|
989
|
+
var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
|
|
990
|
+
ns: Schema3.String,
|
|
991
|
+
count: Schema3.optional(Schema3.Number),
|
|
992
|
+
defaultValue: Schema3.optional(Schema3.String)
|
|
993
|
+
})))));
|
|
994
|
+
|
|
995
|
+
// src/plugin-intent/meta.ts
|
|
996
|
+
var meta = {
|
|
997
|
+
id: "dxos.org/plugin/intent",
|
|
957
998
|
name: "Intent"
|
|
958
|
-
}
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
// src/plugin-intent/actions.ts
|
|
1002
|
+
(function(IntentAction2) {
|
|
1003
|
+
class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
|
|
1004
|
+
input: Schema4.Struct({
|
|
1005
|
+
intents: Schema4.Array(Schema4.String),
|
|
1006
|
+
error: Schema4.optional(Schema4.String)
|
|
1007
|
+
}),
|
|
1008
|
+
output: Schema4.Void
|
|
1009
|
+
}) {
|
|
1010
|
+
}
|
|
1011
|
+
IntentAction2.Track = Track;
|
|
1012
|
+
class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
|
|
1013
|
+
input: Schema4.Struct({
|
|
1014
|
+
message: Label
|
|
1015
|
+
}),
|
|
1016
|
+
output: Schema4.Void
|
|
1017
|
+
}) {
|
|
1018
|
+
}
|
|
1019
|
+
IntentAction2.ShowUndo = ShowUndo;
|
|
1020
|
+
})(IntentAction || (IntentAction = {}));
|
|
1021
|
+
var IntentAction;
|
|
1022
|
+
|
|
1023
|
+
// src/plugin-intent/errors.ts
|
|
1024
|
+
var BaseError = class extends Error {
|
|
1025
|
+
code;
|
|
1026
|
+
context;
|
|
1027
|
+
constructor(code, message, context) {
|
|
1028
|
+
super(message ?? code, {
|
|
1029
|
+
cause: context
|
|
1030
|
+
}), this.code = code, this.context = context;
|
|
1031
|
+
this.name = code;
|
|
1032
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
var NoResolversError = class extends BaseError {
|
|
1036
|
+
constructor(action) {
|
|
1037
|
+
super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
|
|
1038
|
+
action
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
var CycleDetectedError = class extends BaseError {
|
|
1043
|
+
constructor(context) {
|
|
1044
|
+
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
// src/plugin-intent/IntentPlugin.ts
|
|
1049
|
+
var IntentPlugin = definePlugin(meta, () => [
|
|
959
1050
|
defineModule({
|
|
960
|
-
id: `${
|
|
1051
|
+
id: `${meta.id}/module/dispatcher`,
|
|
961
1052
|
// TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
|
|
962
1053
|
// This is fine for now because it's how it worked prior to capabilities api anyways.
|
|
963
1054
|
// In the future, the intent dispatcher should be able to be reset without resetting the entire app.
|
|
@@ -965,15 +1056,14 @@ var IntentPlugin = () => definePlugin({
|
|
|
965
1056
|
activatesAfter: [
|
|
966
1057
|
Events.DispatcherReady
|
|
967
1058
|
],
|
|
968
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1059
|
+
activate: lazy(() => import("./intent-dispatcher-LZ4AE66E.mjs"))
|
|
969
1060
|
})
|
|
970
1061
|
]);
|
|
971
1062
|
|
|
972
1063
|
// src/common/layout.ts
|
|
973
1064
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
974
|
-
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
975
1065
|
(function(LayoutAction2) {
|
|
976
|
-
LayoutAction2.UPDATE_LAYOUT = `${
|
|
1066
|
+
LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
|
|
977
1067
|
class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
978
1068
|
input: Schema5.Struct({
|
|
979
1069
|
part: Schema5.String.annotations({
|
|
@@ -1310,7 +1400,7 @@ var LayoutAction;
|
|
|
1310
1400
|
var createSurface = (definition) => definition;
|
|
1311
1401
|
|
|
1312
1402
|
// src/common/translations.ts
|
|
1313
|
-
import
|
|
1403
|
+
import * as Schema6 from "effect/Schema";
|
|
1314
1404
|
var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
|
|
1315
1405
|
key: Schema6.String,
|
|
1316
1406
|
value: Schema6.Any
|
|
@@ -1335,7 +1425,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1335
1425
|
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1336
1426
|
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1337
1427
|
if (candidates.length === 0) {
|
|
1338
|
-
yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1428
|
+
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1339
1429
|
}
|
|
1340
1430
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1341
1431
|
const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
|
|
@@ -1345,12 +1435,29 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1345
1435
|
};
|
|
1346
1436
|
});
|
|
1347
1437
|
const dispatch = (intentChain, depth = 0) => {
|
|
1438
|
+
log3("dispatch", {
|
|
1439
|
+
intentChain: intentChain.all.map((i) => i.id),
|
|
1440
|
+
depth
|
|
1441
|
+
}, {
|
|
1442
|
+
F: __dxlog_file3,
|
|
1443
|
+
L: 212,
|
|
1444
|
+
S: void 0,
|
|
1445
|
+
C: (f, a) => f(...a)
|
|
1446
|
+
});
|
|
1348
1447
|
return Effect3.gen(function* () {
|
|
1349
1448
|
if (depth > executionLimit) {
|
|
1350
|
-
yield* Effect3.fail(new CycleDetectedError());
|
|
1449
|
+
return yield* Effect3.fail(new CycleDetectedError());
|
|
1351
1450
|
}
|
|
1352
1451
|
const resultsRef = yield* Ref2.make([]);
|
|
1353
1452
|
for (const intent of intentChain.all) {
|
|
1453
|
+
log3("processing", {
|
|
1454
|
+
intent
|
|
1455
|
+
}, {
|
|
1456
|
+
F: __dxlog_file3,
|
|
1457
|
+
L: 220,
|
|
1458
|
+
S: this,
|
|
1459
|
+
C: (f, a) => f(...a)
|
|
1460
|
+
});
|
|
1354
1461
|
const { data: prev } = (yield* resultsRef.get)[0] ?? {};
|
|
1355
1462
|
const result2 = yield* handleIntent({
|
|
1356
1463
|
...intent,
|
|
@@ -1359,6 +1466,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1359
1466
|
...prev
|
|
1360
1467
|
}
|
|
1361
1468
|
});
|
|
1469
|
+
log3("ok", {
|
|
1470
|
+
intent: intent.id,
|
|
1471
|
+
result: result2
|
|
1472
|
+
}, {
|
|
1473
|
+
F: __dxlog_file3,
|
|
1474
|
+
L: 223,
|
|
1475
|
+
S: this,
|
|
1476
|
+
C: (f, a) => f(...a)
|
|
1477
|
+
});
|
|
1362
1478
|
yield* Ref2.update(resultsRef, (results2) => [
|
|
1363
1479
|
result2,
|
|
1364
1480
|
...results2
|
|
@@ -1369,7 +1485,16 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1369
1485
|
}
|
|
1370
1486
|
}
|
|
1371
1487
|
if (result2.error) {
|
|
1372
|
-
|
|
1488
|
+
log3.error("failed", {
|
|
1489
|
+
intent: intent.id,
|
|
1490
|
+
error: result2.error
|
|
1491
|
+
}, {
|
|
1492
|
+
F: __dxlog_file3,
|
|
1493
|
+
L: 240,
|
|
1494
|
+
S: this,
|
|
1495
|
+
C: (f, a) => f(...a)
|
|
1496
|
+
});
|
|
1497
|
+
return yield* Effect3.fail(result2.error);
|
|
1373
1498
|
}
|
|
1374
1499
|
}
|
|
1375
1500
|
const results = yield* resultsRef.get;
|
|
@@ -1385,10 +1510,19 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1385
1510
|
return next;
|
|
1386
1511
|
});
|
|
1387
1512
|
if (result.undoable && isUndoable(results)) {
|
|
1388
|
-
yield*
|
|
1513
|
+
yield* Function2.pipe(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1389
1514
|
message: result.undoable.message
|
|
1390
1515
|
})), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
|
|
1391
1516
|
}
|
|
1517
|
+
log3("done", {
|
|
1518
|
+
intent: intentChain.all.map((i) => i.id),
|
|
1519
|
+
result: result.data
|
|
1520
|
+
}, {
|
|
1521
|
+
F: __dxlog_file3,
|
|
1522
|
+
L: 270,
|
|
1523
|
+
S: this,
|
|
1524
|
+
C: (f, a) => f(...a)
|
|
1525
|
+
});
|
|
1392
1526
|
return result.data;
|
|
1393
1527
|
});
|
|
1394
1528
|
};
|
|
@@ -1398,7 +1532,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1398
1532
|
})).catch((error) => {
|
|
1399
1533
|
log3.catch(error, void 0, {
|
|
1400
1534
|
F: __dxlog_file3,
|
|
1401
|
-
L:
|
|
1535
|
+
L: 279,
|
|
1402
1536
|
S: void 0,
|
|
1403
1537
|
C: (f, a) => f(...a)
|
|
1404
1538
|
});
|
|
@@ -1413,7 +1547,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1413
1547
|
const last = history.findLastIndex(isUndoable);
|
|
1414
1548
|
const result = last !== -1 ? history[last] : void 0;
|
|
1415
1549
|
if (result) {
|
|
1416
|
-
const
|
|
1550
|
+
const all2 = result.map(({ _intent, undoable }) => {
|
|
1417
1551
|
const data = _intent.data;
|
|
1418
1552
|
const undoData = undoable?.data ?? {};
|
|
1419
1553
|
return {
|
|
@@ -1426,9 +1560,9 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1426
1560
|
};
|
|
1427
1561
|
});
|
|
1428
1562
|
const intent = {
|
|
1429
|
-
first:
|
|
1430
|
-
last:
|
|
1431
|
-
all
|
|
1563
|
+
first: all2[0],
|
|
1564
|
+
last: all2.at(-1),
|
|
1565
|
+
all: all2
|
|
1432
1566
|
};
|
|
1433
1567
|
yield* Ref2.update(historyRef, (h) => h.filter((_, index) => index !== last));
|
|
1434
1568
|
return yield* dispatch(intent);
|
|
@@ -1451,7 +1585,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1451
1585
|
};
|
|
1452
1586
|
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1453
1587
|
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1454
|
-
var intent_dispatcher_default = (context) => {
|
|
1588
|
+
var intent_dispatcher_default = ((context) => {
|
|
1455
1589
|
const state = live2({
|
|
1456
1590
|
dispatch: defaultEffect,
|
|
1457
1591
|
dispatchPromise: defaultPromise,
|
|
@@ -1473,7 +1607,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1473
1607
|
state.undo = undo;
|
|
1474
1608
|
state.undoPromise = undoPromise;
|
|
1475
1609
|
return contributes(Capabilities.IntentDispatcher, state);
|
|
1476
|
-
};
|
|
1610
|
+
});
|
|
1477
1611
|
|
|
1478
1612
|
export {
|
|
1479
1613
|
defineCapability,
|
|
@@ -1500,19 +1634,18 @@ export {
|
|
|
1500
1634
|
createIntent,
|
|
1501
1635
|
chain,
|
|
1502
1636
|
Label,
|
|
1503
|
-
INTENT_PLUGIN,
|
|
1504
|
-
INTENT_ACTION,
|
|
1505
1637
|
IntentAction,
|
|
1638
|
+
BaseError,
|
|
1639
|
+
NoResolversError,
|
|
1640
|
+
CycleDetectedError,
|
|
1506
1641
|
createResolver,
|
|
1507
1642
|
createDispatcher,
|
|
1508
1643
|
intent_dispatcher_default,
|
|
1509
1644
|
IntentPlugin,
|
|
1510
|
-
LAYOUT_PLUGIN,
|
|
1511
|
-
LAYOUT_ACTION,
|
|
1512
1645
|
LayoutAction,
|
|
1513
1646
|
createSurface,
|
|
1514
1647
|
ResourceKey,
|
|
1515
1648
|
ResourceLanguage,
|
|
1516
1649
|
Resource
|
|
1517
1650
|
};
|
|
1518
|
-
//# sourceMappingURL=chunk-
|
|
1651
|
+
//# sourceMappingURL=chunk-WPW5VVAX.mjs.map
|