@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,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
|
-
import {
|
|
105
|
-
import
|
|
13
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
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 = Atom.family(() => {
|
|
47
|
+
return Atom.make([]).pipe(Atom.keepAlive);
|
|
48
|
+
});
|
|
49
|
+
_capabilities = Atom.family((id) => {
|
|
50
|
+
return Atom.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 = Atom.family((id) => {
|
|
56
|
+
return Atom.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,26 +133,26 @@ 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
|
});
|
|
216
140
|
}
|
|
217
141
|
}
|
|
218
142
|
/**
|
|
219
|
-
* Get the
|
|
220
|
-
* Primarily useful for deriving other
|
|
143
|
+
* Get the Atom reference to the available capabilities for a given interface.
|
|
144
|
+
* Primarily useful for deriving other Atom values based on the capabilities or
|
|
221
145
|
* for subscribing to changes in the capabilities.
|
|
222
|
-
* @returns An
|
|
146
|
+
* @returns An atom reference to the available capabilities.
|
|
223
147
|
*/
|
|
224
148
|
capabilities(interfaceDef) {
|
|
225
149
|
return this._capabilities(interfaceDef.identifier);
|
|
226
150
|
}
|
|
227
151
|
/**
|
|
228
|
-
* Get the
|
|
229
|
-
* Primarily useful for deriving other
|
|
152
|
+
* Get the Atom reference to the available capabilities for a given interface.
|
|
153
|
+
* Primarily useful for deriving other Atom values based on the capability or
|
|
230
154
|
* for subscribing to changes in the capability.
|
|
231
|
-
* @returns An
|
|
155
|
+
* @returns An atom reference to the available capability.
|
|
232
156
|
* @throws If no capability is found.
|
|
233
157
|
*/
|
|
234
158
|
capability(interfaceDef) {
|
|
@@ -299,20 +223,35 @@ var getEvents = (events) => "type" in events ? events.events : [
|
|
|
299
223
|
];
|
|
300
224
|
|
|
301
225
|
// src/core/manager.ts
|
|
302
|
-
import { Registry } from "@effect-
|
|
226
|
+
import { Registry } from "@effect-atom/atom-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 Atom.
|
|
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,20 +837,27 @@ 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");
|
|
866
|
-
Capabilities2.
|
|
859
|
+
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
860
|
+
Capabilities2.AtomRegistry = defineCapability("dxos.org/app-framework/capability/atom-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");
|
|
869
863
|
Capabilities2.ReactSurface = defineCapability("dxos.org/app-framework/common/react-surface");
|
|
@@ -877,30 +871,30 @@ 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.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
876
|
+
Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
877
|
+
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
878
|
+
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
882
879
|
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
883
880
|
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
884
881
|
})(Capabilities || (Capabilities = {}));
|
|
885
882
|
var Capabilities;
|
|
886
883
|
|
|
887
884
|
// src/common/collaboration.ts
|
|
888
|
-
import
|
|
889
|
-
import {
|
|
885
|
+
import * as Schema from "effect/Schema";
|
|
886
|
+
import { ContentBlock } from "@dxos/types";
|
|
890
887
|
(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."
|
|
888
|
+
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
889
|
+
input: Schema.Struct({
|
|
890
|
+
subject: Schema.Any,
|
|
891
|
+
anchor: Schema.String,
|
|
892
|
+
proposal: ContentBlock.Proposal
|
|
899
893
|
}),
|
|
900
|
-
output:
|
|
894
|
+
output: Schema.Void
|
|
901
895
|
}) {
|
|
902
896
|
}
|
|
903
|
-
CollaborationActions2.
|
|
897
|
+
CollaborationActions2.AcceptProposal = AcceptProposal;
|
|
904
898
|
})(CollaborationActions || (CollaborationActions = {}));
|
|
905
899
|
var CollaborationActions;
|
|
906
900
|
|
|
@@ -923,7 +917,7 @@ var CollaborationActions;
|
|
|
923
917
|
var Events;
|
|
924
918
|
|
|
925
919
|
// src/common/file.ts
|
|
926
|
-
import
|
|
920
|
+
import * as Schema2 from "effect/Schema";
|
|
927
921
|
var defaultFileTypes = {
|
|
928
922
|
images: [
|
|
929
923
|
"png",
|
|
@@ -943,23 +937,120 @@ var defaultFileTypes = {
|
|
|
943
937
|
"md"
|
|
944
938
|
]
|
|
945
939
|
};
|
|
946
|
-
var FileInfoSchema =
|
|
947
|
-
name:
|
|
948
|
-
type:
|
|
949
|
-
url:
|
|
950
|
-
cid:
|
|
940
|
+
var FileInfoSchema = Schema2.Struct({
|
|
941
|
+
name: Schema2.String,
|
|
942
|
+
type: Schema2.String,
|
|
943
|
+
url: Schema2.optional(Schema2.String),
|
|
944
|
+
cid: Schema2.optional(Schema2.String)
|
|
951
945
|
});
|
|
952
946
|
|
|
953
947
|
// src/common/layout.ts
|
|
954
|
-
import
|
|
948
|
+
import * as Schema5 from "effect/Schema";
|
|
955
949
|
|
|
956
|
-
// src/plugin-intent/
|
|
957
|
-
|
|
958
|
-
|
|
950
|
+
// src/plugin-intent/actions.ts
|
|
951
|
+
import * as Schema4 from "effect/Schema";
|
|
952
|
+
|
|
953
|
+
// src/plugin-intent/intent.ts
|
|
954
|
+
import * as Schema3 from "effect/Schema";
|
|
955
|
+
var createIntent = (schema, data = {}, params = {}) => {
|
|
956
|
+
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
957
|
+
const intent = {
|
|
958
|
+
...params,
|
|
959
|
+
_schema: schema,
|
|
960
|
+
id: schema._tag,
|
|
961
|
+
data
|
|
962
|
+
};
|
|
963
|
+
return {
|
|
964
|
+
first: intent,
|
|
965
|
+
last: intent,
|
|
966
|
+
all: [
|
|
967
|
+
intent
|
|
968
|
+
]
|
|
969
|
+
};
|
|
970
|
+
};
|
|
971
|
+
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
972
|
+
const intents = "all" in intent ? intent.all : [
|
|
973
|
+
intent
|
|
974
|
+
];
|
|
975
|
+
const first = intents[0];
|
|
976
|
+
const last = {
|
|
977
|
+
...params,
|
|
978
|
+
_schema: schema,
|
|
979
|
+
id: schema._tag,
|
|
980
|
+
data
|
|
981
|
+
};
|
|
982
|
+
return {
|
|
983
|
+
first,
|
|
984
|
+
last,
|
|
985
|
+
all: [
|
|
986
|
+
...intents,
|
|
987
|
+
last
|
|
988
|
+
]
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
|
|
992
|
+
ns: Schema3.String,
|
|
993
|
+
count: Schema3.optional(Schema3.Number),
|
|
994
|
+
defaultValue: Schema3.optional(Schema3.String)
|
|
995
|
+
})))));
|
|
996
|
+
|
|
997
|
+
// src/plugin-intent/meta.ts
|
|
998
|
+
var meta = {
|
|
999
|
+
id: "dxos.org/plugin/intent",
|
|
959
1000
|
name: "Intent"
|
|
960
|
-
}
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
// src/plugin-intent/actions.ts
|
|
1004
|
+
(function(IntentAction2) {
|
|
1005
|
+
class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
|
|
1006
|
+
input: Schema4.Struct({
|
|
1007
|
+
intents: Schema4.Array(Schema4.String),
|
|
1008
|
+
error: Schema4.optional(Schema4.String)
|
|
1009
|
+
}),
|
|
1010
|
+
output: Schema4.Void
|
|
1011
|
+
}) {
|
|
1012
|
+
}
|
|
1013
|
+
IntentAction2.Track = Track;
|
|
1014
|
+
class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
|
|
1015
|
+
input: Schema4.Struct({
|
|
1016
|
+
message: Label
|
|
1017
|
+
}),
|
|
1018
|
+
output: Schema4.Void
|
|
1019
|
+
}) {
|
|
1020
|
+
}
|
|
1021
|
+
IntentAction2.ShowUndo = ShowUndo;
|
|
1022
|
+
})(IntentAction || (IntentAction = {}));
|
|
1023
|
+
var IntentAction;
|
|
1024
|
+
|
|
1025
|
+
// src/plugin-intent/errors.ts
|
|
1026
|
+
var BaseError = class extends Error {
|
|
1027
|
+
code;
|
|
1028
|
+
context;
|
|
1029
|
+
constructor(code, message, context) {
|
|
1030
|
+
super(message ?? code, {
|
|
1031
|
+
cause: context
|
|
1032
|
+
}), this.code = code, this.context = context;
|
|
1033
|
+
this.name = code;
|
|
1034
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
var NoResolversError = class extends BaseError {
|
|
1038
|
+
constructor(action) {
|
|
1039
|
+
super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
|
|
1040
|
+
action
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
var CycleDetectedError = class extends BaseError {
|
|
1045
|
+
constructor(context) {
|
|
1046
|
+
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
// src/plugin-intent/IntentPlugin.ts
|
|
1051
|
+
var IntentPlugin = definePlugin(meta, () => [
|
|
961
1052
|
defineModule({
|
|
962
|
-
id: `${
|
|
1053
|
+
id: `${meta.id}/module/dispatcher`,
|
|
963
1054
|
// TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
|
|
964
1055
|
// This is fine for now because it's how it worked prior to capabilities api anyways.
|
|
965
1056
|
// In the future, the intent dispatcher should be able to be reset without resetting the entire app.
|
|
@@ -967,15 +1058,14 @@ var IntentPlugin = () => definePlugin({
|
|
|
967
1058
|
activatesAfter: [
|
|
968
1059
|
Events.DispatcherReady
|
|
969
1060
|
],
|
|
970
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1061
|
+
activate: lazy(() => import("./intent-dispatcher-MGOJ3CHD.mjs"))
|
|
971
1062
|
})
|
|
972
1063
|
]);
|
|
973
1064
|
|
|
974
1065
|
// src/common/layout.ts
|
|
975
1066
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
976
|
-
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
977
1067
|
(function(LayoutAction2) {
|
|
978
|
-
LayoutAction2.UPDATE_LAYOUT = `${
|
|
1068
|
+
LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
|
|
979
1069
|
class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
980
1070
|
input: Schema5.Struct({
|
|
981
1071
|
part: Schema5.String.annotations({
|
|
@@ -1312,7 +1402,7 @@ var LayoutAction;
|
|
|
1312
1402
|
var createSurface = (definition) => definition;
|
|
1313
1403
|
|
|
1314
1404
|
// src/common/translations.ts
|
|
1315
|
-
import
|
|
1405
|
+
import * as Schema6 from "effect/Schema";
|
|
1316
1406
|
var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
|
|
1317
1407
|
key: Schema6.String,
|
|
1318
1408
|
value: Schema6.Any
|
|
@@ -1337,7 +1427,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1337
1427
|
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1338
1428
|
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1339
1429
|
if (candidates.length === 0) {
|
|
1340
|
-
yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1430
|
+
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1341
1431
|
}
|
|
1342
1432
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1343
1433
|
const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
|
|
@@ -1347,12 +1437,29 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1347
1437
|
};
|
|
1348
1438
|
});
|
|
1349
1439
|
const dispatch = (intentChain, depth = 0) => {
|
|
1440
|
+
log3("dispatch", {
|
|
1441
|
+
intentChain: intentChain.all.map((i) => i.id),
|
|
1442
|
+
depth
|
|
1443
|
+
}, {
|
|
1444
|
+
F: __dxlog_file3,
|
|
1445
|
+
L: 212,
|
|
1446
|
+
S: void 0,
|
|
1447
|
+
C: (f, a) => f(...a)
|
|
1448
|
+
});
|
|
1350
1449
|
return Effect3.gen(function* () {
|
|
1351
1450
|
if (depth > executionLimit) {
|
|
1352
|
-
yield* Effect3.fail(new CycleDetectedError());
|
|
1451
|
+
return yield* Effect3.fail(new CycleDetectedError());
|
|
1353
1452
|
}
|
|
1354
1453
|
const resultsRef = yield* Ref2.make([]);
|
|
1355
1454
|
for (const intent of intentChain.all) {
|
|
1455
|
+
log3("processing", {
|
|
1456
|
+
intent
|
|
1457
|
+
}, {
|
|
1458
|
+
F: __dxlog_file3,
|
|
1459
|
+
L: 220,
|
|
1460
|
+
S: this,
|
|
1461
|
+
C: (f, a) => f(...a)
|
|
1462
|
+
});
|
|
1356
1463
|
const { data: prev } = (yield* resultsRef.get)[0] ?? {};
|
|
1357
1464
|
const result2 = yield* handleIntent({
|
|
1358
1465
|
...intent,
|
|
@@ -1361,6 +1468,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1361
1468
|
...prev
|
|
1362
1469
|
}
|
|
1363
1470
|
});
|
|
1471
|
+
log3("ok", {
|
|
1472
|
+
intent: intent.id,
|
|
1473
|
+
result: result2
|
|
1474
|
+
}, {
|
|
1475
|
+
F: __dxlog_file3,
|
|
1476
|
+
L: 223,
|
|
1477
|
+
S: this,
|
|
1478
|
+
C: (f, a) => f(...a)
|
|
1479
|
+
});
|
|
1364
1480
|
yield* Ref2.update(resultsRef, (results2) => [
|
|
1365
1481
|
result2,
|
|
1366
1482
|
...results2
|
|
@@ -1371,7 +1487,16 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1371
1487
|
}
|
|
1372
1488
|
}
|
|
1373
1489
|
if (result2.error) {
|
|
1374
|
-
|
|
1490
|
+
log3.error("failed", {
|
|
1491
|
+
intent: intent.id,
|
|
1492
|
+
error: result2.error
|
|
1493
|
+
}, {
|
|
1494
|
+
F: __dxlog_file3,
|
|
1495
|
+
L: 240,
|
|
1496
|
+
S: this,
|
|
1497
|
+
C: (f, a) => f(...a)
|
|
1498
|
+
});
|
|
1499
|
+
return yield* Effect3.fail(result2.error);
|
|
1375
1500
|
}
|
|
1376
1501
|
}
|
|
1377
1502
|
const results = yield* resultsRef.get;
|
|
@@ -1387,10 +1512,19 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1387
1512
|
return next;
|
|
1388
1513
|
});
|
|
1389
1514
|
if (result.undoable && isUndoable(results)) {
|
|
1390
|
-
yield*
|
|
1515
|
+
yield* Function2.pipe(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1391
1516
|
message: result.undoable.message
|
|
1392
1517
|
})), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
|
|
1393
1518
|
}
|
|
1519
|
+
log3("done", {
|
|
1520
|
+
intent: intentChain.all.map((i) => i.id),
|
|
1521
|
+
result: result.data
|
|
1522
|
+
}, {
|
|
1523
|
+
F: __dxlog_file3,
|
|
1524
|
+
L: 270,
|
|
1525
|
+
S: this,
|
|
1526
|
+
C: (f, a) => f(...a)
|
|
1527
|
+
});
|
|
1394
1528
|
return result.data;
|
|
1395
1529
|
});
|
|
1396
1530
|
};
|
|
@@ -1400,7 +1534,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1400
1534
|
})).catch((error) => {
|
|
1401
1535
|
log3.catch(error, void 0, {
|
|
1402
1536
|
F: __dxlog_file3,
|
|
1403
|
-
L:
|
|
1537
|
+
L: 279,
|
|
1404
1538
|
S: void 0,
|
|
1405
1539
|
C: (f, a) => f(...a)
|
|
1406
1540
|
});
|
|
@@ -1415,7 +1549,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1415
1549
|
const last = history.findLastIndex(isUndoable);
|
|
1416
1550
|
const result = last !== -1 ? history[last] : void 0;
|
|
1417
1551
|
if (result) {
|
|
1418
|
-
const
|
|
1552
|
+
const all2 = result.map(({ _intent, undoable }) => {
|
|
1419
1553
|
const data = _intent.data;
|
|
1420
1554
|
const undoData = undoable?.data ?? {};
|
|
1421
1555
|
return {
|
|
@@ -1428,9 +1562,9 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1428
1562
|
};
|
|
1429
1563
|
});
|
|
1430
1564
|
const intent = {
|
|
1431
|
-
first:
|
|
1432
|
-
last:
|
|
1433
|
-
all
|
|
1565
|
+
first: all2[0],
|
|
1566
|
+
last: all2.at(-1),
|
|
1567
|
+
all: all2
|
|
1434
1568
|
};
|
|
1435
1569
|
yield* Ref2.update(historyRef, (h) => h.filter((_, index) => index !== last));
|
|
1436
1570
|
return yield* dispatch(intent);
|
|
@@ -1453,7 +1587,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1453
1587
|
};
|
|
1454
1588
|
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1455
1589
|
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1456
|
-
var intent_dispatcher_default = (context) => {
|
|
1590
|
+
var intent_dispatcher_default = ((context) => {
|
|
1457
1591
|
const state = live2({
|
|
1458
1592
|
dispatch: defaultEffect,
|
|
1459
1593
|
dispatchPromise: defaultPromise,
|
|
@@ -1475,7 +1609,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1475
1609
|
state.undo = undo;
|
|
1476
1610
|
state.undoPromise = undoPromise;
|
|
1477
1611
|
return contributes(Capabilities.IntentDispatcher, state);
|
|
1478
|
-
};
|
|
1612
|
+
});
|
|
1479
1613
|
|
|
1480
1614
|
export {
|
|
1481
1615
|
defineCapability,
|
|
@@ -1502,19 +1636,18 @@ export {
|
|
|
1502
1636
|
createIntent,
|
|
1503
1637
|
chain,
|
|
1504
1638
|
Label,
|
|
1505
|
-
INTENT_PLUGIN,
|
|
1506
|
-
INTENT_ACTION,
|
|
1507
1639
|
IntentAction,
|
|
1640
|
+
BaseError,
|
|
1641
|
+
NoResolversError,
|
|
1642
|
+
CycleDetectedError,
|
|
1508
1643
|
createResolver,
|
|
1509
1644
|
createDispatcher,
|
|
1510
1645
|
intent_dispatcher_default,
|
|
1511
1646
|
IntentPlugin,
|
|
1512
|
-
LAYOUT_PLUGIN,
|
|
1513
|
-
LAYOUT_ACTION,
|
|
1514
1647
|
LayoutAction,
|
|
1515
1648
|
createSurface,
|
|
1516
1649
|
ResourceKey,
|
|
1517
1650
|
ResourceLanguage,
|
|
1518
1651
|
Resource
|
|
1519
1652
|
};
|
|
1520
|
-
//# sourceMappingURL=chunk-
|
|
1653
|
+
//# sourceMappingURL=chunk-XJZGUJ3H.mjs.map
|