@dxos/app-framework 0.8.3 → 0.8.4-main.84f28bd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
- package/.swc/plugins/v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 +0 -0
- package/README.md +0 -8
- package/dist/lib/browser/{app-graph-builder-BI4VVKSW.mjs → app-graph-builder-BGGXLD6T.mjs} +4 -4
- package/dist/lib/browser/{chunk-EHM4UI3V.mjs → chunk-2636QSIK.mjs} +24 -24
- package/dist/lib/browser/{chunk-EHM4UI3V.mjs.map → chunk-2636QSIK.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-DIBVO47Z.mjs → chunk-DHZB7HG7.mjs} +25 -18
- package/dist/lib/browser/{chunk-DIBVO47Z.mjs.map → chunk-DHZB7HG7.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-WWEJRWFX.mjs → chunk-ORWHM7CO.mjs} +2 -2
- package/dist/lib/browser/index.mjs +10 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs → intent-dispatcher-TWKB22NI.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-3QMBXLIY.mjs → intent-resolver-O67UANYP.mjs} +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-5H7XPJGA.mjs → store-LFKDWHUQ.mjs} +3 -3
- package/dist/lib/browser/testing/index.mjs +3 -3
- package/dist/lib/browser/worker.mjs +1 -1
- package/dist/lib/node-esm/{app-graph-builder-NROP6RPQ.mjs → app-graph-builder-QHIJUYYW.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-FHNZZWP4.mjs → chunk-NJAFK626.mjs} +25 -18
- package/dist/lib/node-esm/{chunk-FHNZZWP4.mjs.map → chunk-NJAFK626.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs → chunk-UMZQERLE.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-2J6FVECI.mjs → chunk-VSKRV3NW.mjs} +24 -24
- package/dist/lib/node-esm/{chunk-2J6FVECI.mjs.map → chunk-VSKRV3NW.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +10 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs → intent-dispatcher-5PRM3KGH.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-VY4X5UHN.mjs → intent-resolver-K3D4BXQQ.mjs} +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-UKD2R2KA.mjs → store-53XDUBMD.mjs} +3 -3
- package/dist/lib/node-esm/testing/index.mjs +3 -3
- package/dist/lib/node-esm/worker.mjs +1 -1
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/translations.d.ts +7 -8
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +14 -0
- package/package.json +27 -27
- package/src/App.tsx +3 -3
- package/src/common/capabilities.ts +1 -0
- package/src/core/manager.test.ts +1 -2
- package/src/plugin-settings/SettingsPlugin.ts +1 -1
- package/src/plugin-settings/translations.ts +4 -2
- package/typedoc/classes/CollaborationActions.InsertContent.html +40 -40
- package/typedoc/classes/ErrorBoundary.html +6 -6
- package/typedoc/classes/IntentAction.ShowUndo.html +41 -41
- package/typedoc/classes/IntentAction.Track.html +41 -41
- package/typedoc/classes/LayoutAction.AddToast.html +40 -40
- package/typedoc/classes/LayoutAction.Close.html +40 -40
- package/typedoc/classes/LayoutAction.Expose.html +40 -40
- package/typedoc/classes/LayoutAction.Open.html +40 -40
- package/typedoc/classes/LayoutAction.RevertWorkspace.html +40 -40
- package/typedoc/classes/LayoutAction.ScrollIntoView.html +40 -40
- package/typedoc/classes/LayoutAction.Set.html +40 -40
- package/typedoc/classes/LayoutAction.SetLayoutMode.html +40 -40
- package/typedoc/classes/LayoutAction.SwitchWorkspace.html +40 -40
- package/typedoc/classes/LayoutAction.UpdateComplementary.html +40 -40
- package/typedoc/classes/LayoutAction.UpdateDialog.html +40 -40
- package/typedoc/classes/LayoutAction.UpdateLayout.html +41 -41
- package/typedoc/classes/LayoutAction.UpdatePopover.html +40 -40
- package/typedoc/classes/LayoutAction.UpdateSidebar.html +40 -40
- package/typedoc/classes/Plugin.html +3 -3
- package/typedoc/classes/PluginContext.html +10 -10
- package/typedoc/classes/PluginManager.html +16 -16
- package/typedoc/classes/PluginModule.html +8 -8
- package/typedoc/classes/SettingsAction.Open.html +40 -40
- package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +40 -40
- package/typedoc/functions/Events.createStateEvent.html +2 -2
- package/typedoc/functions/IntentPlugin.html +1 -1
- package/typedoc/functions/SettingsPlugin.html +1 -1
- package/typedoc/functions/allOf.html +2 -2
- package/typedoc/functions/chain.html +2 -2
- package/typedoc/functions/contributes.html +2 -2
- package/typedoc/functions/createDispatcher.html +2 -2
- package/typedoc/functions/createIntent.html +2 -2
- package/typedoc/functions/createResolver.html +2 -2
- package/typedoc/functions/createSurface.html +2 -2
- package/typedoc/functions/defineCapability.html +2 -2
- package/typedoc/functions/defineEvent.html +2 -2
- package/typedoc/functions/defineModule.html +2 -2
- package/typedoc/functions/definePlugin.html +2 -2
- package/typedoc/functions/eventKey.html +2 -2
- package/typedoc/functions/getEvents.html +2 -2
- package/typedoc/functions/isAllOf.html +2 -2
- package/typedoc/functions/isOneOf.html +2 -2
- package/typedoc/functions/isSurfaceAvailable.html +2 -2
- package/typedoc/functions/lazy.html +2 -2
- package/typedoc/functions/oneOf.html +2 -2
- package/typedoc/functions/useApp.html +2 -2
- package/typedoc/functions/useAppGraph.html +1 -1
- package/typedoc/functions/useCapabilities.html +2 -2
- package/typedoc/functions/useCapability.html +2 -2
- package/typedoc/functions/useIntentDispatcher.html +1 -1
- package/typedoc/functions/useIntentResolver.html +1 -1
- package/typedoc/functions/useLayout.html +1 -1
- package/typedoc/functions/usePluginManager.html +2 -2
- package/typedoc/hierarchy.html +1 -1
- package/typedoc/index.html +2 -6
- package/typedoc/interfaces/LayoutAction.Toast.html +2 -2
- package/typedoc/modules/Capabilities.html +1 -1
- package/typedoc/modules/CollaborationActions.html +1 -1
- package/typedoc/modules/Events.html +1 -1
- package/typedoc/modules/IntentAction.html +1 -1
- package/typedoc/modules/LayoutAction.html +2 -2
- package/typedoc/modules/SettingsAction.html +1 -1
- package/typedoc/modules.html +1 -1
- package/typedoc/types/ActivationEvent.html +3 -3
- package/typedoc/types/ActivationEvents.html +2 -2
- package/typedoc/types/AnyCapability.html +1 -1
- package/typedoc/types/AnyIntent.html +1 -1
- package/typedoc/types/AnyIntentChain.html +1 -1
- package/typedoc/types/AnyIntentEffectResult.html +1 -1
- package/typedoc/types/AnyIntentResolver.html +1 -1
- package/typedoc/types/AnyIntentResult.html +1 -1
- package/typedoc/types/Capabilities.FileUploader.html +1 -1
- package/typedoc/types/Capabilities.IntentResolver.html +1 -1
- package/typedoc/types/Capabilities.Layout.html +1 -1
- package/typedoc/types/Capabilities.Metadata.html +1 -1
- package/typedoc/types/Capabilities.ReactContext.html +1 -1
- package/typedoc/types/Capabilities.ReactRoot.html +1 -1
- package/typedoc/types/Capabilities.ReactSurface.html +1 -1
- package/typedoc/types/Capabilities.Settings.html +2 -2
- package/typedoc/types/Capability.html +5 -5
- package/typedoc/types/CreateAppOptions.html +2 -2
- package/typedoc/types/FileInfo.html +1 -1
- package/typedoc/types/Intent.html +6 -6
- package/typedoc/types/IntentChain.html +3 -3
- package/typedoc/types/IntentContext.html +2 -2
- package/typedoc/types/IntentData.html +1 -1
- package/typedoc/types/IntentDispatcher.html +2 -2
- package/typedoc/types/IntentDispatcherResult.html +2 -2
- package/typedoc/types/IntentEffectDefinition.html +2 -2
- package/typedoc/types/IntentEffectResult.html +6 -6
- package/typedoc/types/IntentParams.html +2 -2
- package/typedoc/types/IntentResolver.html +2 -2
- package/typedoc/types/IntentResultData.html +1 -1
- package/typedoc/types/IntentSchema.html +1 -1
- package/typedoc/types/IntentUndo.html +2 -2
- package/typedoc/types/InterfaceDef.html +3 -3
- package/typedoc/types/Label.html +1 -1
- package/typedoc/types/NodeSerializer.html +3 -3
- package/typedoc/types/PluginManagerOptions.html +2 -2
- package/typedoc/types/PluginMeta.html +9 -9
- package/typedoc/types/PromiseIntentDispatcher.html +2 -2
- package/typedoc/types/PromiseIntentUndo.html +2 -2
- package/typedoc/types/Resource.html +1 -1
- package/typedoc/types/ResourceKey.html +1 -1
- package/typedoc/types/ResourceLanguage.html +1 -1
- package/typedoc/types/SerializedNode.html +2 -2
- package/typedoc/types/SurfaceComponent.html +2 -2
- package/typedoc/types/SurfaceDefinition.html +2 -2
- package/typedoc/types/SurfaceProps.html +2 -2
- package/typedoc/variables/Capabilities.AnchorSort.html +1 -1
- package/typedoc/variables/Capabilities.AppGraph.html +1 -1
- package/typedoc/variables/Capabilities.AppGraphBuilder.html +1 -1
- package/typedoc/variables/Capabilities.AppGraphSerializer.html +1 -1
- package/typedoc/variables/Capabilities.ArtifactDefinition.html +1 -1
- package/typedoc/variables/Capabilities.FileUploader.html +1 -1
- package/typedoc/variables/Capabilities.IntentDispatcher.html +1 -1
- package/typedoc/variables/Capabilities.IntentResolver.html +1 -1
- package/typedoc/variables/Capabilities.Layout.html +1 -1
- package/typedoc/variables/Capabilities.Metadata.html +1 -1
- package/typedoc/variables/Capabilities.Null.html +1 -1
- package/typedoc/variables/Capabilities.PluginManager.html +1 -1
- package/typedoc/variables/Capabilities.ReactContext.html +1 -1
- package/typedoc/variables/Capabilities.ReactRoot.html +1 -1
- package/typedoc/variables/Capabilities.ReactSurface.html +1 -1
- package/typedoc/variables/Capabilities.RxRegistry.html +1 -1
- package/typedoc/variables/Capabilities.Settings.html +1 -1
- package/typedoc/variables/Capabilities.SettingsStore.html +1 -1
- package/typedoc/variables/Capabilities.Tools.html +1 -1
- package/typedoc/variables/Capabilities.Translations.html +1 -1
- package/typedoc/variables/Events.AppGraphReady.html +2 -2
- package/typedoc/variables/Events.DispatcherReady.html +2 -2
- package/typedoc/variables/Events.LayoutReady.html +1 -1
- package/typedoc/variables/Events.SettingsReady.html +2 -2
- package/typedoc/variables/Events.SetupAppGraph.html +2 -2
- package/typedoc/variables/Events.SetupArtifactDefinition.html +2 -2
- package/typedoc/variables/Events.SetupIntentResolver.html +2 -2
- package/typedoc/variables/Events.SetupMetadata.html +2 -2
- package/typedoc/variables/Events.SetupReactSurface.html +2 -2
- package/typedoc/variables/Events.SetupSettings.html +2 -2
- package/typedoc/variables/Events.SetupTranslations.html +2 -2
- package/typedoc/variables/Events.Startup.html +2 -2
- package/typedoc/variables/FileInfoSchema.html +1 -1
- package/typedoc/variables/INTENT_ACTION.html +1 -1
- package/typedoc/variables/INTENT_PLUGIN.html +1 -1
- package/typedoc/variables/LAYOUT_ACTION.html +1 -1
- package/typedoc/variables/LAYOUT_PLUGIN.html +1 -1
- package/typedoc/variables/Label.html +1 -1
- package/typedoc/variables/LayoutAction.Toast.html +1 -1
- package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +1 -1
- package/typedoc/variables/PluginManagerProvider.html +2 -2
- package/typedoc/variables/Resource.html +2 -2
- package/typedoc/variables/ResourceKey.html +1 -1
- package/typedoc/variables/ResourceLanguage.html +1 -1
- package/typedoc/variables/SETTINGS_ACTION.html +1 -1
- package/typedoc/variables/SETTINGS_ID.html +1 -1
- package/typedoc/variables/SETTINGS_KEY.html +1 -1
- package/typedoc/variables/SETTINGS_PLUGIN.html +1 -1
- package/typedoc/variables/Surface.html +2 -2
- package/typedoc/variables/defaultFileTypes.html +1 -1
- package/vitest.config.ts +5 -2
- package/README.yml +0 -5
- package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs +0 -146
- package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs.map +0 -7
- package/dist/lib/node/chunk-G774ASXO.cjs +0 -58
- package/dist/lib/node/chunk-G774ASXO.cjs.map +0 -7
- package/dist/lib/node/chunk-VSOSVDQ3.cjs +0 -1551
- package/dist/lib/node/chunk-VSOSVDQ3.cjs.map +0 -7
- package/dist/lib/node/chunk-YGAY3H34.cjs +0 -429
- package/dist/lib/node/chunk-YGAY3H34.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -193
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs +0 -32
- package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-IOJDYO34.cjs +0 -46
- package/dist/lib/node/intent-resolver-IOJDYO34.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/store-ESF5VR57.cjs +0 -45
- package/dist/lib/node/store-ESF5VR57.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -119
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node/worker.cjs +0 -101
- package/dist/lib/node/worker.cjs.map +0 -7
- package/project.json +0 -29
- /package/dist/lib/browser/{app-graph-builder-BI4VVKSW.mjs.map → app-graph-builder-BGGXLD6T.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-WWEJRWFX.mjs.map → chunk-ORWHM7CO.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs.map → intent-dispatcher-TWKB22NI.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-3QMBXLIY.mjs.map → intent-resolver-O67UANYP.mjs.map} +0 -0
- /package/dist/lib/browser/{store-5H7XPJGA.mjs.map → store-LFKDWHUQ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-NROP6RPQ.mjs.map → app-graph-builder-QHIJUYYW.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs.map → chunk-UMZQERLE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs.map → intent-dispatcher-5PRM3KGH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-VY4X5UHN.mjs.map → intent-resolver-K3D4BXQQ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{store-UKD2R2KA.mjs.map → store-53XDUBMD.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugin-intent/intent-dispatcher.ts", "../../../src/plugin-intent/actions.ts", "../../../src/plugin-intent/intent.ts", "../../../src/plugin-intent/errors.ts", "../../../src/core/capabilities.ts", "../../../src/core/events.ts", "../../../src/core/manager.ts", "../../../src/core/plugin.ts", "../../../src/common/capabilities.ts", "../../../src/common/collaboration.ts", "../../../src/common/events.ts", "../../../src/common/file.ts", "../../../src/common/layout.ts", "../../../src/plugin-intent/IntentPlugin.ts", "../../../src/common/surface.ts", "../../../src/common/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Effect, Option, pipe, Ref } from 'effect';\nimport { type Simplify } from 'effect/Types';\n\nimport { live } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { byPosition, type MaybePromise, type Position, type GuardedType } from '@dxos/util';\n\nimport { IntentAction } from './actions';\nimport { CycleDetectedError, NoResolversError } from './errors';\nimport {\n createIntent,\n type AnyIntent,\n type AnyIntentChain,\n type Intent,\n type IntentChain,\n type IntentData,\n type IntentParams,\n type IntentResultData,\n type IntentSchema,\n type Label,\n} from './intent';\nimport { Events, Capabilities } from '../common';\nimport { contributes, type PluginContext } from '../core';\n\nconst EXECUTION_LIMIT = 100;\nconst HISTORY_LIMIT = 100;\n\n/**\n * The return value of an intent effect.\n */\nexport type IntentEffectResult<Input, Output> = {\n /**\n * The output of the action that was performed.\n *\n * If the intent is apart of a chain of intents, the data will be passed to the next intent.\n */\n data?: Output;\n\n /**\n * If provided, the action will be undoable.\n */\n undoable?: {\n /**\n * Message to display to the user when indicating that the action can be undone.\n */\n message: Label;\n\n /**\n * Will be merged with the original intent data when firing the undo intent.\n */\n data?: Partial<Input>;\n };\n\n /**\n * An error that occurred while performing the action.\n *\n * If the intent is apart of a chain of intents and an error occurs, the chain will be aborted.\n *\n * Return caught error instead of throwing to trigger other intent to be triggered prior to returning the error.\n */\n error?: Error;\n\n /**\n * Other intent chains to be triggered.\n */\n intents?: AnyIntentChain[];\n};\n\nexport type AnyIntentEffectResult = IntentEffectResult<any, any>;\n\n/**\n * The result of an intent dispatcher.\n */\nexport type IntentDispatcherResult<Input, Output> = Pick<IntentEffectResult<Input, Output>, 'data' | 'error'>;\n\n/**\n * The implementation of an intent effect.\n */\nexport type IntentEffectDefinition<Input, Output> = (\n data: Input,\n undo: boolean,\n) =>\n | MaybePromise<IntentEffectResult<Input, Output> | void>\n | Effect.Effect<IntentEffectResult<Input, Output> | void, Error>;\n\n/**\n * Intent resolver to match intents to their effects.\n */\nexport type IntentResolver<Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>> = Readonly<{\n /**\n * The schema of the intent to be resolved.\n */\n intent: IntentSchema<Tag, Fields>;\n\n /**\n * Hint to determine the order the resolvers are processed if multiple resolvers are defined for the same intent.\n * Only one resolver will be used.\n */\n position?: Position;\n\n /**\n * Optional filter to determine if the resolver should be used.\n */\n filter?: (data: IntentData<Fields>) => data is Data;\n\n /**\n * The effect to be performed when the intent is resolved.\n */\n resolve: IntentEffectDefinition<GuardedType<IntentResolver<Tag, Fields, Data>['filter']>, IntentResultData<Fields>>;\n}>;\n\nexport type AnyIntentResolver = IntentResolver<any, any, any>;\n\n/**\n * Creates an intent resolver to match intents to their effects.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param effect Effect to be performed when the intent is resolved.\n * @param params.disposition Determines the priority of the resolver when multiple are resolved.\n * @param params.filter Optional filter to determine if the resolver should be used.\n */\nexport const createResolver = <Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>>(\n resolver: IntentResolver<Tag, Fields, Data>,\n) => resolver;\n\n/**\n * Invokes intents and returns the result.\n */\nexport type PromiseIntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n) => Promise<Simplify<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>>;\n\n/**\n * Creates an effect for intents.\n */\nexport type IntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n depth?: number,\n) => Effect.Effect<\n Simplify<Required<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>['data']>,\n Error\n>;\n\ntype IntentResult<Tag extends string, Fields extends IntentParams> = IntentEffectResult<\n IntentData<Fields>,\n IntentResultData<Fields>\n> & {\n _intent: Intent<Tag, Fields>;\n};\n\nexport type AnyIntentResult = IntentResult<any, any>;\n\n/**\n * Invokes the most recent undoable intent with undo flags.\n */\nexport type PromiseIntentUndo = () => Promise<IntentDispatcherResult<any, any>>;\n\n/**\n * Creates an effect which undoes the last intent.\n */\nexport type IntentUndo = () => Effect.Effect<any, Error>;\n\n/**\n * Check if a chain of results is undoable.\n */\nconst isUndoable = (historyEntry: AnyIntentResult[]): boolean =>\n historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);\n\nexport type IntentContext = {\n dispatch: IntentDispatcher;\n dispatchPromise: PromiseIntentDispatcher;\n undo: IntentUndo;\n undoPromise: PromiseIntentUndo;\n};\n\n/**\n * Sets of an intent dispatcher.\n *\n * @param getResolvers A function that returns an array of available intent resolvers.\n * @param params.historyLimit The maximum number of intent results to keep in history.\n * @param params.executionLimit The maximum recursion depth of intent chains.\n */\nexport const createDispatcher = (\n getResolvers: () => AnyIntentResolver[],\n { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {},\n): IntentContext => {\n const historyRef = Effect.runSync(Ref.make<AnyIntentResult[][]>([]));\n\n const handleIntent = (intent: AnyIntent) =>\n Effect.gen(function* () {\n const candidates = getResolvers()\n .filter((resolver) => resolver.intent._tag === intent.id)\n .filter((resolver) => !resolver.filter || resolver.filter(intent.data))\n .toSorted(byPosition);\n if (candidates.length === 0) {\n yield* Effect.fail(new NoResolversError(intent.id));\n }\n\n const effect = candidates[0].resolve(intent.data, intent.undo ?? false);\n const result = Effect.isEffect(effect) ? yield* effect : yield* Effect.promise(async () => effect);\n return { _intent: intent, ...result } as AnyIntentResult;\n });\n\n const dispatch: IntentDispatcher = (intentChain, depth = 0) => {\n return Effect.gen(function* () {\n if (depth > executionLimit) {\n yield* Effect.fail(new CycleDetectedError());\n }\n\n const resultsRef = yield* Ref.make<AnyIntentResult[]>([]);\n for (const intent of intentChain.all) {\n const { data: prev } = (yield* resultsRef.get)[0] ?? {};\n const result = yield* handleIntent({ ...intent, data: { ...intent.data, ...prev } });\n yield* Ref.update(resultsRef, (results) => [result, ...results]);\n if (result.intents) {\n for (const intent of result.intents) {\n // Returned intents are dispatched but not yielded into results, as such they cannot be undone.\n // TODO(wittjosiah): Use higher execution concurrency?\n yield* dispatch(intent, depth + 1);\n }\n }\n\n if (result.error) {\n // yield* dispatch(\n // createIntent(IntentAction.Track, {\n // intents: intentChain.all.map((i) => i.id),\n // error: result.error.message,\n // }),\n // );\n yield* Effect.fail(result.error);\n }\n }\n\n // Track the intent chain.\n // if (intentChain.all.some((intent) => intent.id !== IntentAction.Track._tag)) {\n // yield* dispatch(createIntent(IntentAction.Track, { intents: intentChain.all.map((i) => i.id) }));\n // }\n\n const results = yield* resultsRef.get;\n const result = results[0];\n yield* Ref.update(historyRef, (history) => {\n const next = [...history, results];\n if (next.length > historyLimit) {\n next.splice(0, next.length - historyLimit);\n }\n return next;\n });\n\n if (result.undoable && isUndoable(results)) {\n // TODO(wittjosiah): Is there a better way to handle showing undo for chains?\n yield* pipe(\n dispatch(createIntent(IntentAction.ShowUndo, { message: result.undoable.message })),\n Effect.catchSome((err) =>\n err instanceof NoResolversError ? Option.some(Effect.succeed(undefined)) : Option.none(),\n ),\n );\n }\n\n return result.data;\n });\n };\n\n const dispatchPromise: PromiseIntentDispatcher = (intentChain) => {\n return Effect.runPromise(dispatch(intentChain))\n .then((data) => ({ data }))\n .catch((error) => {\n log.catch(error);\n return { error };\n });\n };\n\n const undo: IntentUndo = () => {\n return Effect.gen(function* () {\n const history = yield* historyRef.get;\n const last = history.findLastIndex(isUndoable);\n const result = last !== -1 ? history[last] : undefined;\n if (result) {\n const all = result.map(({ _intent, undoable }): AnyIntent => {\n const data = _intent.data;\n const undoData = undoable?.data ?? {};\n return { ..._intent, data: { ...data, ...undoData }, undo: true } satisfies AnyIntent;\n });\n const intent = { first: all[0], last: all.at(-1)!, all } satisfies AnyIntentChain;\n yield* Ref.update(historyRef, (h) => h.filter((_, index) => index !== last));\n return yield* dispatch(intent);\n }\n });\n };\n\n const undoPromise: PromiseIntentUndo = () => {\n return Effect.runPromise(undo())\n .then((data) => ({ data }))\n .catch((error) => ({ error }));\n };\n\n return { dispatch, dispatchPromise, undo, undoPromise };\n};\n\nconst defaultEffect = () => Effect.fail(new Error('Intent runtime not ready'));\nconst defaultPromise = () => Effect.runPromise(defaultEffect());\n\nexport default (context: PluginContext) => {\n const state = live<IntentContext>({\n dispatch: defaultEffect,\n dispatchPromise: defaultPromise,\n undo: defaultEffect,\n undoPromise: defaultPromise,\n });\n\n // TODO(wittjosiah): Make getResolver callback async and allow resolvers to be requested on demand.\n const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher(() =>\n context.getCapabilities(Capabilities.IntentResolver).flat(),\n );\n\n const manager = context.getCapability(Capabilities.PluginManager);\n state.dispatch = (intentChain, depth) => {\n return Effect.gen(function* () {\n yield* manager._activate(Events.SetupIntentResolver);\n return yield* dispatch(intentChain, depth);\n });\n };\n state.dispatchPromise = async (intentChain) => {\n await manager.activate(Events.SetupIntentResolver);\n return await dispatchPromise(intentChain);\n };\n state.undo = undo;\n state.undoPromise = undoPromise;\n\n return contributes(Capabilities.IntentDispatcher, state);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Label } from './intent';\n\nexport const INTENT_PLUGIN = 'dxos.org/plugin/intent';\nexport const INTENT_ACTION = `${INTENT_PLUGIN}/action`;\n\nexport namespace IntentAction {\n /**\n * Log an intent.\n */\n export class Track extends Schema.TaggedClass<Track>()(`${INTENT_ACTION}/track`, {\n input: Schema.Struct({\n intents: Schema.Array(Schema.String),\n error: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n /**\n * Fired after an intent is dispatched if the intent is undoable.\n */\n export class ShowUndo extends Schema.TaggedClass<ShowUndo>()(`${INTENT_ACTION}/show-undo`, {\n input: Schema.Struct({\n message: Label,\n }),\n output: Schema.Void,\n }) {}\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nexport type IntentParams = {\n readonly input: Schema.Schema.All;\n readonly output: Schema.Schema.All;\n};\n\nexport type IntentData<Fields extends IntentParams> =\n Schema.Schema.Type<Schema.Struct<Fields>> extends { readonly input: any }\n ? Schema.Schema.Type<Schema.Struct<Fields>>['input']\n : any;\n\nexport type IntentResultData<Fields extends IntentParams> =\n Schema.Schema.Type<Schema.Struct<Fields>> extends { readonly output: any }\n ? Schema.Schema.Type<Schema.Struct<Fields>>['output']\n : any;\n\nexport type IntentSchema<Tag extends string, Fields extends IntentParams> = Schema.TaggedClass<any, Tag, Fields>;\n\n/**\n * An intent is an abstract description of an operation to be performed.\n * Intents allow actions to be performed across plugins.\n */\nexport type Intent<Tag extends string, Fields extends IntentParams> = {\n _schema: IntentSchema<Tag, Fields>;\n\n /**\n * The id of the intent.\n */\n id: Tag;\n\n /**\n * Any data needed to perform the desired action.\n */\n data: IntentData<Fields>;\n\n /**\n * Whether or not the intent is being undone.\n */\n undo?: boolean;\n};\n\nexport type AnyIntent = Intent<any, any>;\n\n/**\n * Chain of intents to be executed together.\n * The result of each intent is merged into the next intent's input data.\n */\nexport type IntentChain<\n FirstTag extends string,\n LastTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n> = {\n first: Intent<FirstTag, FirstFields>;\n last: Intent<LastTag, LastFields>;\n all: AnyIntent[];\n};\n\nexport type AnyIntentChain = IntentChain<any, any, any, any>;\n\n/**\n * Creates a typed intent.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param data Data fulfilling the input schema of the intent.\n * @param params.plugin Optional plugin ID to send the intent to.\n * @param params.undo Optional flag to indicate that the intent is being undone. Generally not set manually.\n */\nexport const createIntent = <Tag extends string, Fields extends IntentParams>(\n schema: IntentSchema<Tag, Fields>,\n data: IntentData<Fields> = {},\n params: Pick<AnyIntent, 'undo'> = {},\n): IntentChain<Tag, Tag, Fields, Fields> => {\n // The output of validateSync breaks proxy objects so this is just used for validation.\n // TODO(wittjosiah): Is there a better way to make theses types align?\n const _ = Schema.validateSync(schema.fields.input as Schema.Schema<any, any, unknown>)(data);\n const intent = {\n ...params,\n _schema: schema,\n id: schema._tag,\n data,\n } satisfies Intent<Tag, Fields>;\n\n return {\n first: intent,\n last: intent,\n all: [intent],\n };\n};\n\n// TODO(wittjosiah): Add a function for mapping the output of one intent to the input of another.\n\n/**\n * Chain two intents together.\n *\n * NOTE: Chaining of intents depends on the data inputs and outputs being structs.\n */\nexport const chain =\n <\n FirstTag extends string,\n NextTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n NextFields extends IntentParams,\n >(\n schema: IntentSchema<NextTag, NextFields>,\n data: Omit<IntentData<NextFields>, keyof IntentResultData<LastFields>> = {},\n params: Pick<AnyIntent, 'undo'> = {},\n ) =>\n (\n intent: IntentChain<FirstTag, any, FirstFields, LastFields>,\n ): IntentChain<FirstTag, NextTag, FirstFields, NextFields> => {\n const intents = 'all' in intent ? intent.all : [intent];\n const first = intents[0];\n const last = {\n ...params,\n _schema: schema,\n id: schema._tag,\n data,\n } satisfies Intent<NextTag, NextFields>;\n\n return {\n first,\n last,\n all: [...intents, last],\n };\n };\n\n//\n// Intents\n//\n\n// NOTE: Should maintain compatibility with `i18next` (and @dxos/react-ui).\n// TODO(wittjosiah): Making this immutable breaks type compatibility.\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(wittjosiah): Reconcile with @dxos/protocols. Factor out errors.\n\n/**\n * NOTE: Messages should be sentences (Start with a capital letter and end with a period).\n * Errors can optionally include a JSON context object.\n */\nexport class BaseError extends Error {\n constructor(\n readonly code: string,\n message?: string,\n readonly context?: Record<string, any>,\n ) {\n // TODO(dmaretskyi): Error.cause.\n super(message ?? code, { cause: context });\n this.name = code;\n // NOTE: Restores prototype chain (https://stackoverflow.com/a/48342359).\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class NoResolversError extends BaseError {\n constructor(action: string) {\n super('NO_RESOLVERS', 'No resolvers were found for the action', { action });\n }\n}\n\nexport class CycleDetectedError extends BaseError {\n constructor(context?: Record<string, any>) {\n super(\n 'CYCLE_DETECTED',\n 'Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.',\n context,\n );\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Registry, Rx } from '@effect-rx/rx-react';\nimport { Effect } from 'effect';\n\nimport { Trigger } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type ActivationEvent } from './events';\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const defineCapability = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * A unique string identifier with a Typescript type associated with it.\n * When a capability is contributed to the application an implementation of the interface is provided.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n deactivate?: () => MaybePromise<void> | Effect.Effect<void, Error>;\n};\n\nexport type AnyCapability = Capability<any>;\n\ntype PluginsContextOptions = {\n registry: Registry.Registry;\n activate: (event: ActivationEvent) => Effect.Effect<boolean, Error>;\n reset: (event: ActivationEvent) => Effect.Effect<boolean, Error>;\n};\n\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nclass CapabilityImpl<T> {\n constructor(\n readonly moduleId: string,\n readonly implementation: T,\n ) {}\n}\n\n/**\n * Helper to define the implementation of a capability.\n */\nexport const contributes = <T>(\n interfaceDef: Capability<T>['interface'],\n implementation: Capability<T>['implementation'],\n deactivate?: Capability<T>['deactivate'],\n): Capability<T> => {\n return { interface: interfaceDef, implementation, deactivate } satisfies Capability<T>;\n};\n\ntype LoadCapability<T, U> = () => Promise<{ default: (props: T) => MaybePromise<Capability<U>> }>;\ntype LoadCapabilities<T> = () => Promise<{ default: (props: T) => MaybePromise<AnyCapability[]> }>;\n// TODO(wittjosiah): Not having the array be `any` causes type errors when using the lazy capability.\ntype LazyCapability<T, U> = (props?: T) => Promise<() => Promise<Capability<U> | AnyCapability[]>>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n */\nexport const lazy =\n <T, U>(c: LoadCapability<T, U> | LoadCapabilities<T>): LazyCapability<T, U> =>\n async (props?: T) => {\n const { default: getCapability } = await c();\n return async () => getCapability(props as T);\n };\n\n/**\n * Facilitates the dependency injection between [plugin modules](#pluginmodule) by allowing them contribute and request capabilities from each other.\n * It tracks the capabilities that are contributed in an in-memory live object.\n * This allows the application to subscribe to this state and incorporate plugins which are added dynamically.\n */\nexport class PluginContext {\n private readonly _registry: Registry.Registry;\n\n private readonly _capabilityImpls = Rx.family<string, Rx.Writable<CapabilityImpl<unknown>[]>>(() => {\n return Rx.make<CapabilityImpl<unknown>[]>([]).pipe(Rx.keepAlive);\n });\n\n readonly _capabilities = Rx.family<string, Rx.Rx<unknown[]>>((id: string) => {\n return Rx.make((get) => {\n const current = get(this._capabilityImpls(id));\n return current.map((c) => c.implementation);\n });\n });\n\n readonly _capability = Rx.family<string, Rx.Rx<unknown>>((id: string) => {\n return Rx.make((get) => {\n const current = get(this._capabilities(id));\n invariant(current.length > 0, `No capability found for ${id}`);\n return current[0];\n });\n });\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n readonly activate: PluginsContextOptions['activate'];\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n readonly reset: PluginsContextOptions['reset'];\n\n constructor({ registry, activate, reset }: PluginsContextOptions) {\n this._registry = registry;\n this.activate = activate;\n this.reset = reset;\n }\n\n /**\n * @internal\n */\n contributeCapability<T>({\n module: moduleId,\n interface: interfaceDef,\n implementation,\n }: {\n module: string;\n interface: InterfaceDef<T>;\n implementation: T;\n }): void {\n const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));\n const capability = new CapabilityImpl(moduleId, implementation);\n if (current.includes(capability)) {\n return;\n }\n\n this._registry.set(this._capabilityImpls(interfaceDef.identifier), [...current, capability]);\n log('capability contributed', {\n id: interfaceDef.identifier,\n moduleId,\n count: current.length,\n });\n }\n\n /**\n * @internal\n */\n removeCapability<T>(interfaceDef: InterfaceDef<T>, implementation: T): void {\n const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));\n if (current.length === 0) {\n return;\n }\n\n const next = current.filter((c) => c.implementation !== implementation);\n if (next.length !== current.length) {\n this._registry.set(this._capabilityImpls(interfaceDef.identifier), next);\n log('capability removed', { id: interfaceDef.identifier, count: current.length });\n } else {\n log.warn('capability not removed', { id: interfaceDef.identifier });\n }\n }\n\n /**\n * Get the Rx reference to the available capabilities for a given interface.\n * Primarily useful for deriving other Rx values based on the capabilities or\n * for subscribing to changes in the capabilities.\n * @returns An Rx reference to the available capabilities.\n */\n capabilities<T>(interfaceDef: InterfaceDef<T>): Rx.Rx<T[]> {\n // NOTE: This the type-checking for capabilities is done at the time of contribution.\n return this._capabilities(interfaceDef.identifier) as Rx.Rx<T[]>;\n }\n\n /**\n * Get the Rx reference to the available capabilities for a given interface.\n * Primarily useful for deriving other Rx values based on the capability or\n * for subscribing to changes in the capability.\n * @returns An Rx reference to the available capability.\n * @throws If no capability is found.\n */\n capability<T>(interfaceDef: InterfaceDef<T>): Rx.Rx<T> {\n // NOTE: This the type-checking for capabilities is done at the time of contribution.\n return this._capability(interfaceDef.identifier) as Rx.Rx<T>;\n }\n\n /**\n * Get capabilities from the plugin context.\n * @returns An array of capabilities.\n */\n getCapabilities<T>(interfaceDef: InterfaceDef<T>): T[] {\n return this._registry.get(this.capabilities(interfaceDef));\n }\n\n /**\n * Requests a single capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\n getCapability<T>(interfaceDef: InterfaceDef<T>): T {\n return this._registry.get(this.capability(interfaceDef));\n }\n\n /**\n * Waits for a capability to be available.\n * @returns The capability.\n */\n async waitForCapability<T>(interfaceDef: InterfaceDef<T>): Promise<T> {\n const [capability] = this.getCapabilities(interfaceDef);\n if (capability) {\n return capability;\n }\n\n const trigger = new Trigger<T>();\n const cancel = this._registry.subscribe(this.capabilities(interfaceDef), (capabilities) => {\n if (capabilities.length > 0) {\n trigger.wake(capabilities[0]);\n }\n });\n const result = await trigger.wait();\n cancel();\n return result;\n }\n\n async activatePromise(event: ActivationEvent): Promise<boolean> {\n return this.activate(event).pipe(Effect.runPromise);\n }\n\n async resetPromise(event: ActivationEvent): Promise<boolean> {\n return this.reset(event).pipe(Effect.runPromise);\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * A unique string identifier representing an event.\n * This is expected to be a URI, where initial parts are often the id of the plugin whose package defines the event.\n *\n * @example dxos.org/plugin/example/event/ready\n */\nexport type ActivationEvent = {\n id: string;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type ActivationEvents =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event.\n */\nexport const defineEvent = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\n};\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) => (event.specifier ? `${event.id}:${event.specifier}` : event.id);\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: ActivationEvents): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: ActivationEvents): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: ActivationEvents) => ('type' in events ? events.events : [events]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Registry } from '@effect-rx/rx-react';\nimport { untracked } from '@preact/signals-core';\nimport { Array as A, Effect, Either, Match, pipe } from 'effect';\n\nimport { Event } from '@dxos/async';\nimport { live, type Live } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, PluginContext } from './capabilities';\nimport { type ActivationEvent, eventKey, getEvents, isAllOf } from './events';\nimport { type PluginModule, type Plugin } from './plugin';\n\n// TODO(wittjosiah): Factor out?\nconst isPromise = (value: unknown): value is Promise<unknown> => {\n return value !== null && typeof value === 'object' && 'then' in value;\n};\n\nexport type PluginManagerOptions = {\n pluginLoader: (id: string) => MaybePromise<Plugin>;\n plugins?: Plugin[];\n core?: string[];\n enabled?: string[];\n registry?: Registry.Registry;\n};\n\ntype PluginManagerState = {\n // Plugins\n plugins: Plugin[];\n core: string[];\n enabled: string[];\n\n // Modules\n modules: PluginModule[];\n active: string[];\n\n // Events\n eventsFired: string[];\n pendingReset: string[];\n};\n\nexport class PluginManager {\n readonly activation = new Event<{ event: string; state: 'activating' | 'activated' | 'error'; error?: any }>();\n readonly context: PluginContext;\n readonly registry: Registry.Registry;\n\n // TODO(wittjosiah): Replace with Rx.\n private readonly _state: Live<PluginManagerState>;\n private readonly _pluginLoader: PluginManagerOptions['pluginLoader'];\n private readonly _capabilities = new Map<string, AnyCapability[]>();\n\n constructor({\n pluginLoader,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n enabled = [],\n registry,\n }: PluginManagerOptions) {\n this.registry = registry ?? Registry.make();\n this.context = new PluginContext({\n registry: this.registry,\n activate: (event) => this._activate(event),\n reset: (id) => this._reset(id),\n });\n\n this._pluginLoader = pluginLoader;\n this._state = live({\n plugins,\n core,\n enabled,\n modules: [],\n active: [],\n pendingReset: [],\n eventsFired: [],\n });\n plugins.forEach((plugin) => this._addPlugin(plugin));\n core.forEach((id) => this.enable(id));\n enabled.forEach((id) => this.enable(id));\n }\n\n /**\n * Plugins that are currently registered.\n *\n * @reactive\n */\n get plugins(): Live<readonly Plugin[]> {\n return this._state.plugins;\n }\n\n /**\n * Ids of plugins that are core and cannot be removed.\n *\n * @reactive\n */\n get core(): Live<readonly string[]> {\n return this._state.core;\n }\n\n /**\n * Ids of plugins that are currently enabled.\n *\n * @reactive\n */\n get enabled(): Live<readonly string[]> {\n return this._state.enabled;\n }\n\n /**\n * Modules of plugins which are currently enabled.\n *\n * @reactive\n */\n get modules(): Live<readonly PluginModule[]> {\n return this._state.modules;\n }\n\n /**\n * Ids of modules which are currently active.\n *\n * @reactive\n */\n get active(): Live<readonly string[]> {\n return this._state.active;\n }\n\n /**\n * Ids of events which have been fired.\n *\n * @reactive\n */\n get eventsFired(): Live<readonly string[]> {\n return this._state.eventsFired;\n }\n\n /**\n * Ids of modules which are pending reset.\n *\n * @reactive\n */\n get pendingReset(): Live<readonly string[]> {\n return this._state.pendingReset;\n }\n\n /**\n * Adds a plugin to the manager via the plugin loader.\n * @param id The id of the plugin.\n */\n async add(id: string): Promise<boolean> {\n return untracked(async () => {\n log('add plugin', { id });\n const plugin = await this._pluginLoader(id);\n this._addPlugin(plugin);\n return this.enable(id);\n });\n }\n\n /**\n * Enables a plugin.\n * @param id The id of the plugin.\n */\n enable(id: string): Promise<boolean> {\n return untracked(async () => {\n log('enable plugin', { id });\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n if (!this._state.enabled.includes(id)) {\n this._state.enabled.push(id);\n }\n\n plugin.modules.forEach((module) => {\n this._addModule(module);\n this._setPendingResetByModule(module);\n });\n\n log('pending reset', { events: [...this.pendingReset] });\n await Effect.runPromise(\n Effect.all(\n this.pendingReset.map((event) => this._activate(event)),\n { concurrency: 'unbounded' },\n ),\n );\n\n return true;\n });\n }\n\n /**\n * Removes a plugin from the manager.\n * @param id The id of the plugin.\n */\n remove(id: string): boolean {\n return untracked(() => {\n log('remove plugin', { id });\n const result = this.disable(id);\n if (!result) {\n return false;\n }\n\n this._removePlugin(id);\n return true;\n });\n }\n\n /**\n * Disables a plugin.\n * @param id The id of the plugin.\n */\n disable(id: string): Promise<boolean> {\n return untracked(async () => {\n log('disable plugin', { id });\n if (this._state.core.includes(id)) {\n return false;\n }\n\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const enabledIndex = this._state.enabled.findIndex((enabled) => enabled === id);\n if (enabledIndex !== -1) {\n this._state.enabled.splice(enabledIndex, 1);\n await Effect.runPromise(this._deactivate(id));\n\n plugin.modules.forEach((module) => {\n this._removeModule(module.id);\n });\n }\n\n return true;\n });\n }\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n activate(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._activate(event)));\n }\n\n /**\n * Deactivates all of the modules for a plugin.\n * @param id The id of the plugin.\n * @returns Whether the deactivation was successful.\n */\n deactivate(id: string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._deactivate(id)));\n }\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n reset(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._reset(event)));\n }\n\n private _addPlugin(plugin: Plugin): void {\n untracked(() => {\n log('add plugin', { id: plugin.meta.id });\n if (!this._state.plugins.includes(plugin)) {\n this._state.plugins.push(plugin);\n }\n });\n }\n\n private _removePlugin(id: string): void {\n untracked(() => {\n log('remove plugin', { id });\n const pluginIndex = this._state.plugins.findIndex((plugin) => plugin.meta.id === id);\n if (pluginIndex !== -1) {\n this._state.plugins.splice(pluginIndex, 1);\n }\n });\n }\n\n private _addModule(module: PluginModule): void {\n untracked(() => {\n log('add module', { id: module.id });\n if (!this._state.modules.includes(module)) {\n this._state.modules.push(module);\n }\n });\n }\n\n private _removeModule(id: string): void {\n untracked(() => {\n log('remove module', { id });\n const moduleIndex = this._state.modules.findIndex((module) => module.id === id);\n if (moduleIndex !== -1) {\n this._state.modules.splice(moduleIndex, 1);\n }\n });\n }\n\n private _getPlugin(id: string): Plugin | undefined {\n return this._state.plugins.find((plugin) => plugin.meta.id === id);\n }\n\n private _getActiveModules(): PluginModule[] {\n return this._state.modules.filter((module) => this._state.active.includes(module.id));\n }\n\n private _getInactiveModules(): PluginModule[] {\n return this._state.modules.filter((module) => !this._state.active.includes(module.id));\n }\n\n private _getActiveModulesByEvent(key: string): PluginModule[] {\n return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _getInactiveModulesByEvent(key: string): PluginModule[] {\n return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _setPendingResetByModule(module: PluginModule): void {\n return untracked(() => {\n const activationEvents = getEvents(module.activatesOn)\n .map(eventKey)\n .filter((key) => this._state.eventsFired.includes(key));\n\n const pendingReset = Array.from(new Set(activationEvents)).filter(\n (event) => !this._state.pendingReset.includes(event),\n );\n if (pendingReset.length > 0) {\n log('pending reset', { events: pendingReset });\n this._state.pendingReset.push(...pendingReset);\n }\n });\n }\n\n /**\n * @internal\n */\n // TODO(wittjosiah): Improve error typing.\n _activate(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('activating', { key });\n const pendingIndex = this._state.pendingReset.findIndex((event) => event === key);\n if (pendingIndex !== -1) {\n this._state.pendingReset.splice(pendingIndex, 1);\n }\n\n const modules = this._getInactiveModulesByEvent(key).filter((module) => {\n const allOf = isAllOf(module.activatesOn);\n if (!allOf) {\n return true;\n }\n\n const events = module.activatesOn.events.filter((event) => eventKey(event) !== key);\n return events.every((event) => this._state.eventsFired.includes(eventKey(event)));\n });\n if (modules.length === 0) {\n log('no modules to activate', { key });\n if (!this._state.eventsFired.includes(key)) {\n this._state.eventsFired.push(key);\n }\n return false;\n }\n\n log('activating modules', { key, modules: modules.map((module) => module.id) });\n this.activation.emit({ event: key, state: 'activating' });\n\n // Concurrently triggers loading of lazy capabilities.\n const getCapabilities = yield* Effect.all(\n modules.map(({ activate }) =>\n Effect.tryPromise({\n try: async () => activate(this.context),\n catch: (error) => error as Error,\n }),\n ),\n { concurrency: 'unbounded' },\n );\n\n const result = yield* pipe(\n modules,\n A.zip(getCapabilities),\n A.map(([module, getCapabilities]) => this._activateModule(module, getCapabilities)),\n // TODO(wittjosiah): This currently can't be run in parallel.\n // Running this with concurrency causes races with `allOf` activation events.\n Effect.all,\n Effect.either,\n );\n\n if (Either.isLeft(result)) {\n this.activation.emit({ event: key, state: 'error', error: result.left });\n yield* Effect.fail(result.left);\n }\n\n if (!this._state.eventsFired.includes(key)) {\n this._state.eventsFired.push(key);\n }\n\n this.activation.emit({ event: key, state: 'activated' });\n log('activated', { key });\n\n return true;\n });\n }\n\n private _activateModule(\n module: PluginModule,\n getCapabilities: AnyCapability | AnyCapability[] | (() => Promise<AnyCapability | AnyCapability[]>),\n ): Effect.Effect<void, Error> {\n return Effect.gen(this, function* () {\n yield* Effect.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {\n concurrency: 'unbounded',\n });\n\n log('activating module...', { module: module.id });\n // TODO(wittjosiah): This is not handling errors thrown if this is synchronous.\n const maybeCapabilities = typeof getCapabilities === 'function' ? getCapabilities() : getCapabilities;\n const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(\n // TODO(wittjosiah): Activate with an effect?\n // Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n const capabilities = Match.value(resolvedCapabilities).pipe(\n Match.when(Array.isArray, (array) => array),\n Match.orElse((value) => [value]),\n );\n capabilities.forEach((capability) => {\n this.context.contributeCapability({ module: module.id, ...capability });\n });\n this._state.active.push(module.id);\n this._capabilities.set(module.id, capabilities);\n log('activated module', { module: module.id });\n\n yield* Effect.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {\n concurrency: 'unbounded',\n });\n });\n }\n\n private _deactivate(id: string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const modules = plugin.modules;\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n return results.every((result) => result);\n });\n }\n\n private _deactivateModule(module: PluginModule): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const id = module.id;\n log('deactivating', { id });\n\n const capabilities = this._capabilities.get(id);\n if (capabilities) {\n for (const capability of capabilities) {\n this.context.removeCapability(capability.interface, capability.implementation);\n const program = capability.deactivate?.();\n yield* Match.value(program).pipe(\n Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n }\n this._capabilities.delete(id);\n }\n\n const activeIndex = this._state.active.findIndex((event) => event === id);\n if (activeIndex !== -1) {\n this._state.active.splice(activeIndex, 1);\n }\n\n log('deactivated', { id });\n return true;\n });\n }\n\n private _reset(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('reset', { key });\n const modules = this._getActiveModulesByEvent(key);\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n\n if (results.every((result) => result)) {\n return yield* this._activate(key);\n } else {\n return false;\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, type PluginContext } from './capabilities';\nimport { type ActivationEvent, type ActivationEvents } from './events';\n\ninterface PluginModuleInterface {\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvents;\n\n /**\n * Events which the plugin depends on being activated.\n * Plugin is marked as needing reset a plugin activated by a dependent event is removed.\n * Events are automatically activated before activation of the plugin.\n */\n activatesBefore?: ActivationEvent[];\n\n /**\n * Events which this plugin triggers upon activation.\n */\n activatesAfter?: ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * @param context The plugin context.\n * @returns The capabilities of the module.\n */\n activate: (\n context: PluginContext,\n ) => MaybePromise<AnyCapability | AnyCapability[]> | Promise<() => Promise<AnyCapability | AnyCapability[]>>;\n}\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class PluginModule implements PluginModuleInterface {\n readonly id: PluginModuleInterface['id'];\n readonly activatesOn: PluginModuleInterface['activatesOn'];\n readonly activatesBefore?: PluginModuleInterface['activatesBefore'];\n readonly activatesAfter?: PluginModuleInterface['activatesAfter'];\n readonly activate: PluginModuleInterface['activate'];\n\n constructor(options: PluginModuleInterface) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.activatesBefore = options.activatesBefore;\n this.activatesAfter = options.activatesAfter;\n this.activate = options.activate;\n }\n}\n\n/**\n * Helper to define a module.\n */\nexport const defineModule = (options: PluginModuleInterface) => new PluginModule(options);\n\nexport type PluginMeta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class Plugin {\n constructor(\n readonly meta: PluginMeta,\n readonly modules: PluginModule[],\n ) {}\n}\n\n/**\n * Helper to define a plugin.\n */\nexport const definePlugin = (meta: PluginMeta, modules: PluginModule[]) => {\n return new Plugin(meta, modules);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Registry } from '@effect-rx/rx-react';\nimport { type Schema } from 'effect';\nimport { type FC, type PropsWithChildren } from 'react';\n\nimport { type ExecutableTool } from '@dxos/ai';\nimport { type GraphBuilder, type BuilderExtensions } from '@dxos/app-graph';\nimport { type ArtifactDefinition } from '@dxos/artifact';\nimport { type Space } from '@dxos/client-protocol';\nimport { type RootSettingsStore } from '@dxos/local-storage';\nimport { type AnchoredTo } from '@dxos/schema';\n\nimport { type FileInfo } from './file';\nimport { type NodeSerializer } from './graph';\nimport { type SurfaceDefinition } from './surface';\nimport { type Resource } from './translations';\nimport { type PluginManager, defineCapability } from '../core';\nimport { type AnyIntentResolver, type IntentContext } from '../plugin-intent';\n\nexport namespace Capabilities {\n export const PluginManager = defineCapability<PluginManager>('dxos.org/app-framework/capability/plugin-manager');\n\n export const Null = defineCapability<null>('dxos.org/app-framework/capability/null');\n\n export const RxRegistry = defineCapability<Registry.Registry>('dxos.org/app-framework/capability/rx-registry');\n\n export type ReactContext = Readonly<{ id: string; dependsOn?: string[]; context: FC<PropsWithChildren> }>;\n export const ReactContext = defineCapability<ReactContext>('dxos.org/app-framework/capability/react-context');\n\n export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n export const ReactRoot = defineCapability<ReactRoot>('dxos.org/app-framework/capability/react-root');\n\n export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];\n export const ReactSurface = defineCapability<ReactSurface>('dxos.org/app-framework/common/react-surface');\n\n export type IntentResolver = AnyIntentResolver | readonly AnyIntentResolver[];\n export const IntentResolver = defineCapability<IntentResolver>('dxos.org/app-framework/capability/intent-resolver');\n\n export const IntentDispatcher = defineCapability<IntentContext>(\n 'dxos.org/app-framework/capability/intent-dispatcher',\n );\n\n export type Layout = Readonly<{\n mode: string;\n dialogOpen: boolean;\n sidebarOpen: boolean;\n complementarySidebarOpen: boolean;\n /**\n * The id of the active workspace, where a workspace is a set of active items.\n */\n workspace: string;\n /**\n * Identifiers of items which are currently active in the application.\n */\n active: string[];\n /**\n * Identifiers of items which were previously active in the application.\n */\n inactive: string[];\n /**\n * Identifier of the item which should be scrolled into view.\n */\n scrollIntoView: string | undefined;\n }>;\n export const Layout = defineCapability<Layout>('dxos.org/app-framework/capability/layout');\n\n export const Translations = defineCapability<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');\n\n export const AppGraph = defineCapability<Readonly<Pick<GraphBuilder, 'graph' | 'explore'>>>(\n 'dxos.org/app-framework/capability/app-graph',\n );\n\n export const AppGraphBuilder = defineCapability<BuilderExtensions>(\n 'dxos.org/app-framework/capability/app-graph-builder',\n );\n\n export const AppGraphSerializer = defineCapability<NodeSerializer[]>(\n 'dxos.org/app-framework/capability/app-graph-serializer',\n );\n\n export const SettingsStore = defineCapability<RootSettingsStore>('dxos.org/app-framework/capability/settings-store');\n\n // TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.\n // export type Settings = Parameters<RootSettingsStore['createStore']>[0];\n // export type Settings<T extends SettingsValue = SettingsValue> = SettingsProps<T>;\n export type Settings = {\n prefix: string;\n schema: Schema.Schema.All;\n value?: Record<string, any>;\n };\n export const Settings = defineCapability<Settings>('dxos.org/app-framework/capability/settings');\n\n export type Metadata = Readonly<{ id: string; metadata: Record<string, any> }>;\n export const Metadata = defineCapability<Metadata>('dxos.org/app-framework/capability/metadata');\n\n export const Tools = defineCapability<ExecutableTool[]>('dxos.org/app-framework/capability/tools');\n export const ArtifactDefinition = defineCapability<ArtifactDefinition>(\n 'dxos.org/app-framework/capability/artifact-definition',\n );\n\n export type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;\n export const FileUploader = defineCapability<FileUploader>('dxos.org/app-framework/capability/file-uploader');\n\n type AnchorSort = {\n key: string;\n sort: (anchorA: AnchoredTo, anchorB: AnchoredTo) => number;\n };\n export const AnchorSort = defineCapability<AnchorSort>('dxos.org/app-framework/capability/anchor-sort');\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Expando, Ref } from '@dxos/echo-schema';\n\nexport namespace CollaborationActions {\n export class InsertContent extends Schema.TaggedClass<InsertContent>()('assistant/intent-content', {\n input: Schema.Struct({\n target: Expando,\n object: Ref(Expando),\n at: Schema.optional(Schema.String),\n label: Schema.String.pipe(Schema.optional),\n }).annotations({\n description: 'Enables plugins to inject content blocks or references into a related entity.',\n }),\n output: Schema.Void,\n }) {}\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities } from './capabilities';\nimport { defineEvent } from '../core';\n\nexport namespace Events {\n /**\n * Fired when the app is started.\n */\n export const Startup = defineEvent('dxos.org/app-framework/event/startup');\n\n //\n // Dependent Events\n //\n\n /**\n * Fired to load any newly available surfaces.\n */\n export const SetupReactSurface = defineEvent('dxos.org/app-framework/event/setup-react-surface');\n\n /**\n * Fired to load any newly available metadata.\n */\n export const SetupMetadata = defineEvent('dxos.org/app-framework/event/setup-metadata');\n\n /**\n * Fired before the intent dispatcher is activated.\n */\n export const SetupIntentResolver = defineEvent('dxos.org/app-framework/event/setup-intent-resolver');\n\n /**\n * Fired before the settings store is activated.\n */\n export const SetupSettings = defineEvent('dxos.org/app-framework/event/setup-settings');\n\n /**\n * Fired before the graph is created.\n */\n export const SetupAppGraph = defineEvent('dxos.org/app-framework/event/setup-graph');\n\n /**\n * Fired before the translations provider is created.\n */\n export const SetupTranslations = defineEvent('dxos.org/app-framework/event/setup-translations');\n\n /**\n * Fired to load any newly available artifacts definitions.\n */\n export const SetupArtifactDefinition = defineEvent('dxos.org/app-framework/event/setup-artifact-definition');\n\n //\n // Triggered Events\n //\n\n /**\n * Fired after the intent dispatcher is ready.\n */\n export const DispatcherReady = defineEvent('dxos.org/app-framework/event/dispatcher-ready');\n\n /**\n * Fired after the settings store is ready.\n */\n export const SettingsReady = defineEvent('dxos.org/app-framework/event/settings-ready');\n\n /**\n * Fired when the graph is ready.\n */\n export const AppGraphReady = defineEvent('dxos.org/app-framework/event/graph-ready');\n\n /**\n * Fired when plugin state is ready.\n */\n export const createStateEvent = (specifier: string) => defineEvent('dxos.org/app-framework/event/state', specifier);\n export const LayoutReady = createStateEvent(Capabilities.Layout.identifier);\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\n// TODO(burdon): See Accept attribute (uses MIME types).\n// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg', 'gif'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport const FileInfoSchema = Schema.Struct({\n name: Schema.String,\n type: Schema.String,\n url: Schema.optional(Schema.String),\n cid: Schema.optional(Schema.String), // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).\n});\n\nexport type FileInfo = Schema.Schema.Type<typeof FileInfoSchema>;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Label } from '../plugin-intent';\n\nexport const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';\nexport const LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export const UPDATE_LAYOUT = `${LAYOUT_ACTION}/update-layout`;\n\n /**\n * Generic layout action.\n */\n export class UpdateLayout extends Schema.TaggedClass<UpdateLayout>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.String.annotations({ description: 'The part of the layout to mutate.' }),\n subject: Schema.optional(Schema.Any.annotations({ description: 'The subject of the layout update.' })),\n options: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional options for the layout action.',\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n //\n // Common layout actions.\n //\n\n // NOTE: These are layout actions which are currently in common use.\n // They constrain the generic layout action types to provide additional type safety.\n // However, they all follow the same generic structure and intent id.\n // This allows for plugins to update the layout without depending on a specific layout plugin.\n // The expectation is that other norms other than these will emerge over time.\n\n export class SetLayoutMode extends Schema.TaggedClass<SetLayoutMode>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('mode').annotations({ description: 'Setting the layout mode.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'Item which is the subject of the new layout mode.' }),\n ),\n options: Schema.Union(\n Schema.Struct({ mode: Schema.String.annotations({ description: 'The new layout mode.' }) }),\n Schema.Struct({ revert: Schema.Boolean.annotations({ description: 'Revert to the previous layout mode.' }) }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdateSidebar extends Schema.TaggedClass<UpdateSidebar>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('sidebar').annotations({ description: 'Updating the sidebar.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the sidebar.' }),\n ),\n options: Schema.optional(\n Schema.Struct({\n state: Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the sidebar is closed, collapsed, or expanded.',\n }),\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdateComplementary extends Schema.TaggedClass<UpdateComplementary>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('complementary').annotations({ description: 'Updating the complementary sidebar.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the complementary area.' }),\n ),\n options: Schema.optional(\n Schema.Struct({\n state: Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the complementary sidebar is closed, collapsed, or expanded.',\n }),\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdateDialog extends Schema.TaggedClass<UpdateDialog>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('dialog').annotations({ description: 'Updating the dialog.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the dialog.' }),\n ),\n options: Schema.Struct({\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),\n type: Schema.optional(Schema.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),\n blockAlign: Schema.optional(\n Schema.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),\n ),\n overlayClasses: Schema.optional(\n Schema.String.annotations({ description: 'Additional classes for the dialog overlay.' }),\n ),\n overlayStyle: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional styles for the dialog overlay.',\n }),\n ),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the dialog.',\n }),\n ),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdatePopover extends Schema.TaggedClass<UpdatePopover>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('popover').annotations({ description: 'Updating the popover.' }),\n subject: Schema.optional(\n Schema.Any.annotations({\n description: 'URI of the component to display in the popover or data to pass to the popover.',\n }),\n ),\n options: Schema.Struct({\n side: Schema.optional(\n Schema.Literal('top', 'right', 'bottom', 'left').annotations({ description: 'The side of the anchor.' }),\n ),\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the popover is open or closed.' })),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the popover.',\n }),\n ),\n }).pipe(\n Schema.extend(\n Schema.Union(\n Schema.Struct({\n variant: Schema.Literal('virtual'),\n anchor: Schema.Any.annotations({ description: 'The DOM element to anchor the popover to.' }),\n }),\n Schema.Struct({\n variant: Schema.optional(Schema.Literal('react')),\n anchorId: Schema.String.annotations({\n description: 'An id that can be used to determine whether to render the anchor subcomponent.',\n }),\n }),\n ),\n ),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export const Toast = Schema.Struct({\n id: Schema.String.annotations({ description: 'The id of the toast.' }),\n title: Schema.optional(Label.annotations({ description: 'The title of the toast.' })),\n description: Schema.optional(Label.annotations({ description: 'The description of the toast.' })),\n icon: Schema.optional(Schema.String.annotations({ description: 'The icon of the toast.' })),\n duration: Schema.optional(Schema.Number.annotations({ description: 'The duration of the toast.' })),\n closeLabel: Schema.optional(Label.annotations({ description: 'The label of the close button.' })),\n actionLabel: Schema.optional(Label.annotations({ description: 'The label of the action button.' })),\n actionAlt: Schema.optional(Label.annotations({ description: 'The alt text of the action button.' })),\n onAction: Schema.optional(\n Schema.Any.annotations({ description: 'The action to perform when the action button is clicked.' }),\n ),\n });\n\n export interface Toast extends Omit<Schema.Schema.Type<typeof Toast>, 'onAction'> {\n onAction?: () => void;\n }\n\n export class AddToast extends Schema.TaggedClass<AddToast>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('toast').annotations({ description: 'Adding a toast.' }),\n subject: Toast.annotations({ description: 'The toast to add.' }),\n }),\n output: Schema.Void,\n }) {}\n\n export class SwitchWorkspace extends Schema.TaggedClass<SwitchWorkspace>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('workspace').annotations({ description: 'Switching the workspace.' }),\n subject: Schema.String.annotations({ description: 'The id of the workspace to switch to.' }),\n }),\n output: Schema.Void,\n }) {}\n\n export class RevertWorkspace extends Schema.TaggedClass<RevertWorkspace>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('workspace').annotations({ description: 'Switching the workspace.' }),\n options: Schema.Struct({\n revert: Schema.Literal(true).annotations({ description: 'Revert to the previous workspace.' }),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class Open extends Schema.TaggedClass<Open>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('main').annotations({ description: 'Opening an item in the main content area.' }),\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to open.' })),\n options: Schema.optional(\n Schema.Struct({\n state: Schema.optional(Schema.Literal(true).annotations({ description: 'The items are being added.' })),\n variant: Schema.optional(Schema.String.annotations({ description: 'The variant of the item to open.' })),\n key: Schema.optional(\n Schema.String.annotations({\n description: 'If provided, will replace item with a matching key (id prefix).',\n }),\n ),\n workspace: Schema.optional(Schema.String.annotations({ description: 'The workspace to open the items in.' })),\n scrollIntoView: Schema.optional(Schema.Boolean.annotations({ description: 'Scroll the items into view.' })),\n pivotId: Schema.optional(\n Schema.String.annotations({ description: 'The id of the item to place new items next to.' }),\n ),\n positioning: Schema.optional(\n Schema.Union(\n Schema.Literal('start').annotations({ description: 'The items are being added before the pivot item.' }),\n Schema.Literal('end').annotations({ description: 'The items are being added after the pivot item.' }),\n ),\n ),\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class Set extends Schema.TaggedClass<Set>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('main').annotations({ description: 'Setting items in the main content area.' }),\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to set.' })),\n options: Schema.Struct({\n override: Schema.Literal(true).annotations({\n description: 'Override the current items in the main content area.',\n }),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class Close extends Schema.TaggedClass<Close>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('main').annotations({ description: 'Closing items in the main content area.' }),\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to close.' })),\n options: Schema.Struct({\n state: Schema.Literal(false).annotations({ description: 'The items are being removed.' }),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class ScrollIntoView extends Schema.TaggedClass<ScrollIntoView>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('current').annotations({ description: 'Setting the current item' }),\n subject: Schema.optional(Schema.String.annotations({ description: 'The id of the item to set as current.' })),\n options: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional options for the scroll into view.',\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class Expose extends Schema.TaggedClass<Expose>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('navigation').annotations({ description: 'Exposing an item in the navigation area.' }),\n subject: Schema.String.annotations({ description: 'The id of the item to expose.' }),\n }),\n output: Schema.Void,\n }) {}\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { INTENT_PLUGIN } from './actions';\nimport { Events } from '../common';\nimport { defineModule, definePlugin, lazy } from '../core';\n\nexport const IntentPlugin = () =>\n definePlugin({ id: INTENT_PLUGIN, name: 'Intent' }, [\n defineModule({\n id: `${INTENT_PLUGIN}/module/dispatcher`,\n // TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.\n // This is fine for now because it's how it worked prior to capabilities api anyways.\n // In the future, the intent dispatcher should be able to be reset without resetting the entire app.\n activatesOn: Events.Startup,\n activatesAfter: [Events.DispatcherReady],\n activate: lazy(() => import('./intent-dispatcher')),\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type JSX, type ForwardedRef, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { type GuardedType, type MakeOptional, type Position } from '@dxos/util';\n\nimport { type ErrorBoundary } from '../react';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n}> &\n MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> & {\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n };\n\n// NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\ntype CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n};\n\ntype SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<\n CoreSurfaceProps<T> & { [key: string]: unknown }\n>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = (\n props: SurfaceComponentProps<T>,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | null;\n\n/**\n * Definition of when a SurfaceComponent should be rendered.\n */\nexport type SurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n id: string;\n role: string | string[];\n position?: Position;\n filter?: (data: Record<string, unknown>) => data is T;\n component: SurfaceComponent<GuardedType<SurfaceDefinition<T>['filter']>>;\n}>;\n\n/**\n * Creates a surface definition.\n */\nexport const createSurface = <T extends Record<string, any> = any>(\n definition: SurfaceDefinition<T>,\n): SurfaceDefinition<T> => definition;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nexport const ResourceKey = Schema.Union(Schema.String, Schema.Record({ key: Schema.String, value: Schema.Any }));\nexport type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;\n\nexport const ResourceLanguage = Schema.Record({ key: Schema.String, value: ResourceKey });\nexport type ResourceLanguage = Schema.Schema.Type<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = Schema.Record({ key: Schema.String, value: ResourceLanguage });\nexport type Resource = Schema.Schema.Type<typeof Resource>;\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,UAAAA,SAAQC,QAAQC,QAAAA,OAAMC,OAAAA,YAAW;AAG1C,SAASC,QAAAA,aAAY;AACrB,SAASC,OAAAA,YAAW;AACpB,SAASC,kBAAsE;;;ACL/E,SAASC,UAAAA,eAAc;;;ACAvB,SAASC,cAAc;AAoEhB,IAAMC,eAAe,CAC1BC,QACAC,OAA2B,CAAC,GAC5BC,SAAkC,CAAC,MAAC;AAIpC,QAAMC,IAAIC,OAAOC,aAAaL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/C,UAAU0C;IACVf,iBAAiBiB;IACjBjD,MAAM+C;IACND,aAAaG;EACf,CAAA;AAGA,QAAM,EAAE5C,UAAU2B,iBAAiBhC,MAAM8C,YAAW,IAAKrE,iBAAiB,MACxEyE,QAAQG,gBAAgBC,aAAaC,cAAc,EAAEC,KAAI,CAAA;AAG3D,QAAMC,UAAUP,QAAQQ,cAAcJ,aAAaK,aAAa;AAChER,QAAM9C,WAAW,CAACC,aAAaC,UAAAA;AAC7B,WAAOzB,QAAOM,IAAI,aAAA;AAChB,aAAOqE,QAAQG,UAAUC,OAAOC,mBAAmB;AACnD,aAAO,OAAOzD,SAASC,aAAaC,KAAAA;IACtC,CAAA;EACF;AACA4C,QAAMnB,kBAAkB,OAAO1B,gBAAAA;AAC7B,UAAMmD,QAAQM,SAASF,OAAOC,mBAAmB;AACjD,WAAO,MAAM9B,gBAAgB1B,WAAAA;EAC/B;AACA6C,QAAMnD,OAAOA;AACbmD,QAAML,cAAcA;AAEpB,SAAOkB,YAAYV,aAAaW,kBAAkBd,KAAAA;AACpD;",
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Effect, Option, pipe, Ref } from 'effect';\nimport { type Simplify } from 'effect/Types';\n\nimport { live } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { byPosition, type MaybePromise, type Position, type GuardedType } from '@dxos/util';\n\nimport { IntentAction } from './actions';\nimport { CycleDetectedError, NoResolversError } from './errors';\nimport {\n createIntent,\n type AnyIntent,\n type AnyIntentChain,\n type Intent,\n type IntentChain,\n type IntentData,\n type IntentParams,\n type IntentResultData,\n type IntentSchema,\n type Label,\n} from './intent';\nimport { Events, Capabilities } from '../common';\nimport { contributes, type PluginContext } from '../core';\n\nconst EXECUTION_LIMIT = 100;\nconst HISTORY_LIMIT = 100;\n\n/**\n * The return value of an intent effect.\n */\nexport type IntentEffectResult<Input, Output> = {\n /**\n * The output of the action that was performed.\n *\n * If the intent is apart of a chain of intents, the data will be passed to the next intent.\n */\n data?: Output;\n\n /**\n * If provided, the action will be undoable.\n */\n undoable?: {\n /**\n * Message to display to the user when indicating that the action can be undone.\n */\n message: Label;\n\n /**\n * Will be merged with the original intent data when firing the undo intent.\n */\n data?: Partial<Input>;\n };\n\n /**\n * An error that occurred while performing the action.\n *\n * If the intent is apart of a chain of intents and an error occurs, the chain will be aborted.\n *\n * Return caught error instead of throwing to trigger other intent to be triggered prior to returning the error.\n */\n error?: Error;\n\n /**\n * Other intent chains to be triggered.\n */\n intents?: AnyIntentChain[];\n};\n\nexport type AnyIntentEffectResult = IntentEffectResult<any, any>;\n\n/**\n * The result of an intent dispatcher.\n */\nexport type IntentDispatcherResult<Input, Output> = Pick<IntentEffectResult<Input, Output>, 'data' | 'error'>;\n\n/**\n * The implementation of an intent effect.\n */\nexport type IntentEffectDefinition<Input, Output> = (\n data: Input,\n undo: boolean,\n) =>\n | MaybePromise<IntentEffectResult<Input, Output> | void>\n | Effect.Effect<IntentEffectResult<Input, Output> | void, Error>;\n\n/**\n * Intent resolver to match intents to their effects.\n */\nexport type IntentResolver<Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>> = Readonly<{\n /**\n * The schema of the intent to be resolved.\n */\n intent: IntentSchema<Tag, Fields>;\n\n /**\n * Hint to determine the order the resolvers are processed if multiple resolvers are defined for the same intent.\n * Only one resolver will be used.\n */\n position?: Position;\n\n /**\n * Optional filter to determine if the resolver should be used.\n */\n filter?: (data: IntentData<Fields>) => data is Data;\n\n /**\n * The effect to be performed when the intent is resolved.\n */\n resolve: IntentEffectDefinition<GuardedType<IntentResolver<Tag, Fields, Data>['filter']>, IntentResultData<Fields>>;\n}>;\n\nexport type AnyIntentResolver = IntentResolver<any, any, any>;\n\n/**\n * Creates an intent resolver to match intents to their effects.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param effect Effect to be performed when the intent is resolved.\n * @param params.disposition Determines the priority of the resolver when multiple are resolved.\n * @param params.filter Optional filter to determine if the resolver should be used.\n */\nexport const createResolver = <Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>>(\n resolver: IntentResolver<Tag, Fields, Data>,\n) => resolver;\n\n/**\n * Invokes intents and returns the result.\n */\nexport type PromiseIntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n) => Promise<Simplify<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>>;\n\n/**\n * Creates an effect for intents.\n */\nexport type IntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n depth?: number,\n) => Effect.Effect<\n Simplify<Required<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>['data']>,\n Error\n>;\n\ntype IntentResult<Tag extends string, Fields extends IntentParams> = IntentEffectResult<\n IntentData<Fields>,\n IntentResultData<Fields>\n> & {\n _intent: Intent<Tag, Fields>;\n};\n\nexport type AnyIntentResult = IntentResult<any, any>;\n\n/**\n * Invokes the most recent undoable intent with undo flags.\n */\nexport type PromiseIntentUndo = () => Promise<IntentDispatcherResult<any, any>>;\n\n/**\n * Creates an effect which undoes the last intent.\n */\nexport type IntentUndo = () => Effect.Effect<any, Error>;\n\n/**\n * Check if a chain of results is undoable.\n */\nconst isUndoable = (historyEntry: AnyIntentResult[]): boolean =>\n historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);\n\nexport type IntentContext = {\n dispatch: IntentDispatcher;\n dispatchPromise: PromiseIntentDispatcher;\n undo: IntentUndo;\n undoPromise: PromiseIntentUndo;\n};\n\n/**\n * Sets of an intent dispatcher.\n *\n * @param getResolvers A function that returns an array of available intent resolvers.\n * @param params.historyLimit The maximum number of intent results to keep in history.\n * @param params.executionLimit The maximum recursion depth of intent chains.\n */\nexport const createDispatcher = (\n getResolvers: () => AnyIntentResolver[],\n { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {},\n): IntentContext => {\n const historyRef = Effect.runSync(Ref.make<AnyIntentResult[][]>([]));\n\n const handleIntent = (intent: AnyIntent) =>\n Effect.gen(function* () {\n const candidates = getResolvers()\n .filter((resolver) => resolver.intent._tag === intent.id)\n .filter((resolver) => !resolver.filter || resolver.filter(intent.data))\n .toSorted(byPosition);\n if (candidates.length === 0) {\n yield* Effect.fail(new NoResolversError(intent.id));\n }\n\n const effect = candidates[0].resolve(intent.data, intent.undo ?? false);\n const result = Effect.isEffect(effect) ? yield* effect : yield* Effect.promise(async () => effect);\n return { _intent: intent, ...result } as AnyIntentResult;\n });\n\n const dispatch: IntentDispatcher = (intentChain, depth = 0) => {\n return Effect.gen(function* () {\n if (depth > executionLimit) {\n yield* Effect.fail(new CycleDetectedError());\n }\n\n const resultsRef = yield* Ref.make<AnyIntentResult[]>([]);\n for (const intent of intentChain.all) {\n const { data: prev } = (yield* resultsRef.get)[0] ?? {};\n const result = yield* handleIntent({ ...intent, data: { ...intent.data, ...prev } });\n yield* Ref.update(resultsRef, (results) => [result, ...results]);\n if (result.intents) {\n for (const intent of result.intents) {\n // Returned intents are dispatched but not yielded into results, as such they cannot be undone.\n // TODO(wittjosiah): Use higher execution concurrency?\n yield* dispatch(intent, depth + 1);\n }\n }\n\n if (result.error) {\n // yield* dispatch(\n // createIntent(IntentAction.Track, {\n // intents: intentChain.all.map((i) => i.id),\n // error: result.error.message,\n // }),\n // );\n yield* Effect.fail(result.error);\n }\n }\n\n // Track the intent chain.\n // if (intentChain.all.some((intent) => intent.id !== IntentAction.Track._tag)) {\n // yield* dispatch(createIntent(IntentAction.Track, { intents: intentChain.all.map((i) => i.id) }));\n // }\n\n const results = yield* resultsRef.get;\n const result = results[0];\n yield* Ref.update(historyRef, (history) => {\n const next = [...history, results];\n if (next.length > historyLimit) {\n next.splice(0, next.length - historyLimit);\n }\n return next;\n });\n\n if (result.undoable && isUndoable(results)) {\n // TODO(wittjosiah): Is there a better way to handle showing undo for chains?\n yield* pipe(\n dispatch(createIntent(IntentAction.ShowUndo, { message: result.undoable.message })),\n Effect.catchSome((err) =>\n err instanceof NoResolversError ? Option.some(Effect.succeed(undefined)) : Option.none(),\n ),\n );\n }\n\n return result.data;\n });\n };\n\n const dispatchPromise: PromiseIntentDispatcher = (intentChain) => {\n return Effect.runPromise(dispatch(intentChain))\n .then((data) => ({ data }))\n .catch((error) => {\n log.catch(error);\n return { error };\n });\n };\n\n const undo: IntentUndo = () => {\n return Effect.gen(function* () {\n const history = yield* historyRef.get;\n const last = history.findLastIndex(isUndoable);\n const result = last !== -1 ? history[last] : undefined;\n if (result) {\n const all = result.map(({ _intent, undoable }): AnyIntent => {\n const data = _intent.data;\n const undoData = undoable?.data ?? {};\n return { ..._intent, data: { ...data, ...undoData }, undo: true } satisfies AnyIntent;\n });\n const intent = { first: all[0], last: all.at(-1)!, all } satisfies AnyIntentChain;\n yield* Ref.update(historyRef, (h) => h.filter((_, index) => index !== last));\n return yield* dispatch(intent);\n }\n });\n };\n\n const undoPromise: PromiseIntentUndo = () => {\n return Effect.runPromise(undo())\n .then((data) => ({ data }))\n .catch((error) => ({ error }));\n };\n\n return { dispatch, dispatchPromise, undo, undoPromise };\n};\n\nconst defaultEffect = () => Effect.fail(new Error('Intent runtime not ready'));\nconst defaultPromise = () => Effect.runPromise(defaultEffect());\n\nexport default (context: PluginContext) => {\n const state = live<IntentContext>({\n dispatch: defaultEffect,\n dispatchPromise: defaultPromise,\n undo: defaultEffect,\n undoPromise: defaultPromise,\n });\n\n // TODO(wittjosiah): Make getResolver callback async and allow resolvers to be requested on demand.\n const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher(() =>\n context.getCapabilities(Capabilities.IntentResolver).flat(),\n );\n\n const manager = context.getCapability(Capabilities.PluginManager);\n state.dispatch = (intentChain, depth) => {\n return Effect.gen(function* () {\n yield* manager._activate(Events.SetupIntentResolver);\n return yield* dispatch(intentChain, depth);\n });\n };\n state.dispatchPromise = async (intentChain) => {\n await manager.activate(Events.SetupIntentResolver);\n return await dispatchPromise(intentChain);\n };\n state.undo = undo;\n state.undoPromise = undoPromise;\n\n return contributes(Capabilities.IntentDispatcher, state);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Label } from './intent';\n\nexport const INTENT_PLUGIN = 'dxos.org/plugin/intent';\nexport const INTENT_ACTION = `${INTENT_PLUGIN}/action`;\n\nexport namespace IntentAction {\n /**\n * Log an intent.\n */\n export class Track extends Schema.TaggedClass<Track>()(`${INTENT_ACTION}/track`, {\n input: Schema.Struct({\n intents: Schema.Array(Schema.String),\n error: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n /**\n * Fired after an intent is dispatched if the intent is undoable.\n */\n export class ShowUndo extends Schema.TaggedClass<ShowUndo>()(`${INTENT_ACTION}/show-undo`, {\n input: Schema.Struct({\n message: Label,\n }),\n output: Schema.Void,\n }) {}\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nexport type IntentParams = {\n readonly input: Schema.Schema.All;\n readonly output: Schema.Schema.All;\n};\n\nexport type IntentData<Fields extends IntentParams> =\n Schema.Schema.Type<Schema.Struct<Fields>> extends { readonly input: any }\n ? Schema.Schema.Type<Schema.Struct<Fields>>['input']\n : any;\n\nexport type IntentResultData<Fields extends IntentParams> =\n Schema.Schema.Type<Schema.Struct<Fields>> extends { readonly output: any }\n ? Schema.Schema.Type<Schema.Struct<Fields>>['output']\n : any;\n\nexport type IntentSchema<Tag extends string, Fields extends IntentParams> = Schema.TaggedClass<any, Tag, Fields>;\n\n/**\n * An intent is an abstract description of an operation to be performed.\n * Intents allow actions to be performed across plugins.\n */\nexport type Intent<Tag extends string, Fields extends IntentParams> = {\n _schema: IntentSchema<Tag, Fields>;\n\n /**\n * The id of the intent.\n */\n id: Tag;\n\n /**\n * Any data needed to perform the desired action.\n */\n data: IntentData<Fields>;\n\n /**\n * Whether or not the intent is being undone.\n */\n undo?: boolean;\n};\n\nexport type AnyIntent = Intent<any, any>;\n\n/**\n * Chain of intents to be executed together.\n * The result of each intent is merged into the next intent's input data.\n */\nexport type IntentChain<\n FirstTag extends string,\n LastTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n> = {\n first: Intent<FirstTag, FirstFields>;\n last: Intent<LastTag, LastFields>;\n all: AnyIntent[];\n};\n\nexport type AnyIntentChain = IntentChain<any, any, any, any>;\n\n/**\n * Creates a typed intent.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param data Data fulfilling the input schema of the intent.\n * @param params.plugin Optional plugin ID to send the intent to.\n * @param params.undo Optional flag to indicate that the intent is being undone. Generally not set manually.\n */\nexport const createIntent = <Tag extends string, Fields extends IntentParams>(\n schema: IntentSchema<Tag, Fields>,\n data: IntentData<Fields> = {},\n params: Pick<AnyIntent, 'undo'> = {},\n): IntentChain<Tag, Tag, Fields, Fields> => {\n // The output of validateSync breaks proxy objects so this is just used for validation.\n // TODO(wittjosiah): Is there a better way to make theses types align?\n const _ = Schema.validateSync(schema.fields.input as Schema.Schema<any, any, unknown>)(data);\n const intent = {\n ...params,\n _schema: schema,\n id: schema._tag,\n data,\n } satisfies Intent<Tag, Fields>;\n\n return {\n first: intent,\n last: intent,\n all: [intent],\n };\n};\n\n// TODO(wittjosiah): Add a function for mapping the output of one intent to the input of another.\n\n/**\n * Chain two intents together.\n *\n * NOTE: Chaining of intents depends on the data inputs and outputs being structs.\n */\nexport const chain =\n <\n FirstTag extends string,\n NextTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n NextFields extends IntentParams,\n >(\n schema: IntentSchema<NextTag, NextFields>,\n data: Omit<IntentData<NextFields>, keyof IntentResultData<LastFields>> = {},\n params: Pick<AnyIntent, 'undo'> = {},\n ) =>\n (\n intent: IntentChain<FirstTag, any, FirstFields, LastFields>,\n ): IntentChain<FirstTag, NextTag, FirstFields, NextFields> => {\n const intents = 'all' in intent ? intent.all : [intent];\n const first = intents[0];\n const last = {\n ...params,\n _schema: schema,\n id: schema._tag,\n data,\n } satisfies Intent<NextTag, NextFields>;\n\n return {\n first,\n last,\n all: [...intents, last],\n };\n };\n\n//\n// Intents\n//\n\n// NOTE: Should maintain compatibility with `i18next` (and @dxos/react-ui).\n// TODO(wittjosiah): Making this immutable breaks type compatibility.\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(wittjosiah): Reconcile with @dxos/protocols. Factor out errors.\n\n/**\n * NOTE: Messages should be sentences (Start with a capital letter and end with a period).\n * Errors can optionally include a JSON context object.\n */\nexport class BaseError extends Error {\n constructor(\n readonly code: string,\n message?: string,\n readonly context?: Record<string, any>,\n ) {\n // TODO(dmaretskyi): Error.cause.\n super(message ?? code, { cause: context });\n this.name = code;\n // NOTE: Restores prototype chain (https://stackoverflow.com/a/48342359).\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class NoResolversError extends BaseError {\n constructor(action: string) {\n super('NO_RESOLVERS', 'No resolvers were found for the action', { action });\n }\n}\n\nexport class CycleDetectedError extends BaseError {\n constructor(context?: Record<string, any>) {\n super(\n 'CYCLE_DETECTED',\n 'Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.',\n context,\n );\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Registry, Rx } from '@effect-rx/rx-react';\nimport { Effect } from 'effect';\n\nimport { Trigger } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type ActivationEvent } from './events';\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const defineCapability = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * A unique string identifier with a Typescript type associated with it.\n * When a capability is contributed to the application an implementation of the interface is provided.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n deactivate?: () => MaybePromise<void> | Effect.Effect<void, Error>;\n};\n\nexport type AnyCapability = Capability<any>;\n\ntype PluginsContextOptions = {\n registry: Registry.Registry;\n activate: (event: ActivationEvent) => Effect.Effect<boolean, Error>;\n reset: (event: ActivationEvent) => Effect.Effect<boolean, Error>;\n};\n\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nclass CapabilityImpl<T> {\n constructor(\n readonly moduleId: string,\n readonly implementation: T,\n ) {}\n}\n\n/**\n * Helper to define the implementation of a capability.\n */\nexport const contributes = <T>(\n interfaceDef: Capability<T>['interface'],\n implementation: Capability<T>['implementation'],\n deactivate?: Capability<T>['deactivate'],\n): Capability<T> => {\n return { interface: interfaceDef, implementation, deactivate } satisfies Capability<T>;\n};\n\ntype LoadCapability<T, U> = () => Promise<{ default: (props: T) => MaybePromise<Capability<U>> }>;\ntype LoadCapabilities<T> = () => Promise<{ default: (props: T) => MaybePromise<AnyCapability[]> }>;\n// TODO(wittjosiah): Not having the array be `any` causes type errors when using the lazy capability.\ntype LazyCapability<T, U> = (props?: T) => Promise<() => Promise<Capability<U> | AnyCapability[]>>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n */\nexport const lazy =\n <T, U>(c: LoadCapability<T, U> | LoadCapabilities<T>): LazyCapability<T, U> =>\n async (props?: T) => {\n const { default: getCapability } = await c();\n return async () => getCapability(props as T);\n };\n\n/**\n * Facilitates the dependency injection between [plugin modules](#pluginmodule) by allowing them contribute and request capabilities from each other.\n * It tracks the capabilities that are contributed in an in-memory live object.\n * This allows the application to subscribe to this state and incorporate plugins which are added dynamically.\n */\nexport class PluginContext {\n private readonly _registry: Registry.Registry;\n\n private readonly _capabilityImpls = Rx.family<string, Rx.Writable<CapabilityImpl<unknown>[]>>(() => {\n return Rx.make<CapabilityImpl<unknown>[]>([]).pipe(Rx.keepAlive);\n });\n\n readonly _capabilities = Rx.family<string, Rx.Rx<unknown[]>>((id: string) => {\n return Rx.make((get) => {\n const current = get(this._capabilityImpls(id));\n return current.map((c) => c.implementation);\n });\n });\n\n readonly _capability = Rx.family<string, Rx.Rx<unknown>>((id: string) => {\n return Rx.make((get) => {\n const current = get(this._capabilities(id));\n invariant(current.length > 0, `No capability found for ${id}`);\n return current[0];\n });\n });\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n readonly activate: PluginsContextOptions['activate'];\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n readonly reset: PluginsContextOptions['reset'];\n\n constructor({ registry, activate, reset }: PluginsContextOptions) {\n this._registry = registry;\n this.activate = activate;\n this.reset = reset;\n }\n\n /**\n * @internal\n */\n contributeCapability<T>({\n module: moduleId,\n interface: interfaceDef,\n implementation,\n }: {\n module: string;\n interface: InterfaceDef<T>;\n implementation: T;\n }): void {\n const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));\n const capability = new CapabilityImpl(moduleId, implementation);\n if (current.includes(capability)) {\n return;\n }\n\n this._registry.set(this._capabilityImpls(interfaceDef.identifier), [...current, capability]);\n log('capability contributed', {\n id: interfaceDef.identifier,\n moduleId,\n count: current.length,\n });\n }\n\n /**\n * @internal\n */\n removeCapability<T>(interfaceDef: InterfaceDef<T>, implementation: T): void {\n const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));\n if (current.length === 0) {\n return;\n }\n\n const next = current.filter((c) => c.implementation !== implementation);\n if (next.length !== current.length) {\n this._registry.set(this._capabilityImpls(interfaceDef.identifier), next);\n log('capability removed', { id: interfaceDef.identifier, count: current.length });\n } else {\n log.warn('capability not removed', { id: interfaceDef.identifier });\n }\n }\n\n /**\n * Get the Rx reference to the available capabilities for a given interface.\n * Primarily useful for deriving other Rx values based on the capabilities or\n * for subscribing to changes in the capabilities.\n * @returns An Rx reference to the available capabilities.\n */\n capabilities<T>(interfaceDef: InterfaceDef<T>): Rx.Rx<T[]> {\n // NOTE: This the type-checking for capabilities is done at the time of contribution.\n return this._capabilities(interfaceDef.identifier) as Rx.Rx<T[]>;\n }\n\n /**\n * Get the Rx reference to the available capabilities for a given interface.\n * Primarily useful for deriving other Rx values based on the capability or\n * for subscribing to changes in the capability.\n * @returns An Rx reference to the available capability.\n * @throws If no capability is found.\n */\n capability<T>(interfaceDef: InterfaceDef<T>): Rx.Rx<T> {\n // NOTE: This the type-checking for capabilities is done at the time of contribution.\n return this._capability(interfaceDef.identifier) as Rx.Rx<T>;\n }\n\n /**\n * Get capabilities from the plugin context.\n * @returns An array of capabilities.\n */\n getCapabilities<T>(interfaceDef: InterfaceDef<T>): T[] {\n return this._registry.get(this.capabilities(interfaceDef));\n }\n\n /**\n * Requests a single capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\n getCapability<T>(interfaceDef: InterfaceDef<T>): T {\n return this._registry.get(this.capability(interfaceDef));\n }\n\n /**\n * Waits for a capability to be available.\n * @returns The capability.\n */\n async waitForCapability<T>(interfaceDef: InterfaceDef<T>): Promise<T> {\n const [capability] = this.getCapabilities(interfaceDef);\n if (capability) {\n return capability;\n }\n\n const trigger = new Trigger<T>();\n const cancel = this._registry.subscribe(this.capabilities(interfaceDef), (capabilities) => {\n if (capabilities.length > 0) {\n trigger.wake(capabilities[0]);\n }\n });\n const result = await trigger.wait();\n cancel();\n return result;\n }\n\n async activatePromise(event: ActivationEvent): Promise<boolean> {\n return this.activate(event).pipe(Effect.runPromise);\n }\n\n async resetPromise(event: ActivationEvent): Promise<boolean> {\n return this.reset(event).pipe(Effect.runPromise);\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * A unique string identifier representing an event.\n * This is expected to be a URI, where initial parts are often the id of the plugin whose package defines the event.\n *\n * @example dxos.org/plugin/example/event/ready\n */\nexport type ActivationEvent = {\n id: string;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type ActivationEvents =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event.\n */\nexport const defineEvent = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\n};\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) => (event.specifier ? `${event.id}:${event.specifier}` : event.id);\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: ActivationEvents): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: ActivationEvents): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: ActivationEvents) => ('type' in events ? events.events : [events]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Registry } from '@effect-rx/rx-react';\nimport { untracked } from '@preact/signals-core';\nimport { Array as A, Effect, Either, Match, pipe } from 'effect';\n\nimport { Event } from '@dxos/async';\nimport { live, type Live } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, PluginContext } from './capabilities';\nimport { type ActivationEvent, eventKey, getEvents, isAllOf } from './events';\nimport { type PluginModule, type Plugin } from './plugin';\n\n// TODO(wittjosiah): Factor out?\nconst isPromise = (value: unknown): value is Promise<unknown> => {\n return value !== null && typeof value === 'object' && 'then' in value;\n};\n\nexport type PluginManagerOptions = {\n pluginLoader: (id: string) => MaybePromise<Plugin>;\n plugins?: Plugin[];\n core?: string[];\n enabled?: string[];\n registry?: Registry.Registry;\n};\n\ntype PluginManagerState = {\n // Plugins\n plugins: Plugin[];\n core: string[];\n enabled: string[];\n\n // Modules\n modules: PluginModule[];\n active: string[];\n\n // Events\n eventsFired: string[];\n pendingReset: string[];\n};\n\nexport class PluginManager {\n readonly activation = new Event<{ event: string; state: 'activating' | 'activated' | 'error'; error?: any }>();\n readonly context: PluginContext;\n readonly registry: Registry.Registry;\n\n // TODO(wittjosiah): Replace with Rx.\n private readonly _state: Live<PluginManagerState>;\n private readonly _pluginLoader: PluginManagerOptions['pluginLoader'];\n private readonly _capabilities = new Map<string, AnyCapability[]>();\n\n constructor({\n pluginLoader,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n enabled = [],\n registry,\n }: PluginManagerOptions) {\n this.registry = registry ?? Registry.make();\n this.context = new PluginContext({\n registry: this.registry,\n activate: (event) => this._activate(event),\n reset: (id) => this._reset(id),\n });\n\n this._pluginLoader = pluginLoader;\n this._state = live({\n plugins,\n core,\n enabled,\n modules: [],\n active: [],\n pendingReset: [],\n eventsFired: [],\n });\n plugins.forEach((plugin) => this._addPlugin(plugin));\n core.forEach((id) => this.enable(id));\n enabled.forEach((id) => this.enable(id));\n }\n\n /**\n * Plugins that are currently registered.\n *\n * @reactive\n */\n get plugins(): Live<readonly Plugin[]> {\n return this._state.plugins;\n }\n\n /**\n * Ids of plugins that are core and cannot be removed.\n *\n * @reactive\n */\n get core(): Live<readonly string[]> {\n return this._state.core;\n }\n\n /**\n * Ids of plugins that are currently enabled.\n *\n * @reactive\n */\n get enabled(): Live<readonly string[]> {\n return this._state.enabled;\n }\n\n /**\n * Modules of plugins which are currently enabled.\n *\n * @reactive\n */\n get modules(): Live<readonly PluginModule[]> {\n return this._state.modules;\n }\n\n /**\n * Ids of modules which are currently active.\n *\n * @reactive\n */\n get active(): Live<readonly string[]> {\n return this._state.active;\n }\n\n /**\n * Ids of events which have been fired.\n *\n * @reactive\n */\n get eventsFired(): Live<readonly string[]> {\n return this._state.eventsFired;\n }\n\n /**\n * Ids of modules which are pending reset.\n *\n * @reactive\n */\n get pendingReset(): Live<readonly string[]> {\n return this._state.pendingReset;\n }\n\n /**\n * Adds a plugin to the manager via the plugin loader.\n * @param id The id of the plugin.\n */\n async add(id: string): Promise<boolean> {\n return untracked(async () => {\n log('add plugin', { id });\n const plugin = await this._pluginLoader(id);\n this._addPlugin(plugin);\n return this.enable(id);\n });\n }\n\n /**\n * Enables a plugin.\n * @param id The id of the plugin.\n */\n enable(id: string): Promise<boolean> {\n return untracked(async () => {\n log('enable plugin', { id });\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n if (!this._state.enabled.includes(id)) {\n this._state.enabled.push(id);\n }\n\n plugin.modules.forEach((module) => {\n this._addModule(module);\n this._setPendingResetByModule(module);\n });\n\n log('pending reset', { events: [...this.pendingReset] });\n await Effect.runPromise(\n Effect.all(\n this.pendingReset.map((event) => this._activate(event)),\n { concurrency: 'unbounded' },\n ),\n );\n\n return true;\n });\n }\n\n /**\n * Removes a plugin from the manager.\n * @param id The id of the plugin.\n */\n remove(id: string): boolean {\n return untracked(() => {\n log('remove plugin', { id });\n const result = this.disable(id);\n if (!result) {\n return false;\n }\n\n this._removePlugin(id);\n return true;\n });\n }\n\n /**\n * Disables a plugin.\n * @param id The id of the plugin.\n */\n disable(id: string): Promise<boolean> {\n return untracked(async () => {\n log('disable plugin', { id });\n if (this._state.core.includes(id)) {\n return false;\n }\n\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const enabledIndex = this._state.enabled.findIndex((enabled) => enabled === id);\n if (enabledIndex !== -1) {\n this._state.enabled.splice(enabledIndex, 1);\n await Effect.runPromise(this._deactivate(id));\n\n plugin.modules.forEach((module) => {\n this._removeModule(module.id);\n });\n }\n\n return true;\n });\n }\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n activate(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._activate(event)));\n }\n\n /**\n * Deactivates all of the modules for a plugin.\n * @param id The id of the plugin.\n * @returns Whether the deactivation was successful.\n */\n deactivate(id: string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._deactivate(id)));\n }\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n reset(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._reset(event)));\n }\n\n private _addPlugin(plugin: Plugin): void {\n untracked(() => {\n log('add plugin', { id: plugin.meta.id });\n if (!this._state.plugins.includes(plugin)) {\n this._state.plugins.push(plugin);\n }\n });\n }\n\n private _removePlugin(id: string): void {\n untracked(() => {\n log('remove plugin', { id });\n const pluginIndex = this._state.plugins.findIndex((plugin) => plugin.meta.id === id);\n if (pluginIndex !== -1) {\n this._state.plugins.splice(pluginIndex, 1);\n }\n });\n }\n\n private _addModule(module: PluginModule): void {\n untracked(() => {\n log('add module', { id: module.id });\n if (!this._state.modules.includes(module)) {\n this._state.modules.push(module);\n }\n });\n }\n\n private _removeModule(id: string): void {\n untracked(() => {\n log('remove module', { id });\n const moduleIndex = this._state.modules.findIndex((module) => module.id === id);\n if (moduleIndex !== -1) {\n this._state.modules.splice(moduleIndex, 1);\n }\n });\n }\n\n private _getPlugin(id: string): Plugin | undefined {\n return this._state.plugins.find((plugin) => plugin.meta.id === id);\n }\n\n private _getActiveModules(): PluginModule[] {\n return this._state.modules.filter((module) => this._state.active.includes(module.id));\n }\n\n private _getInactiveModules(): PluginModule[] {\n return this._state.modules.filter((module) => !this._state.active.includes(module.id));\n }\n\n private _getActiveModulesByEvent(key: string): PluginModule[] {\n return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _getInactiveModulesByEvent(key: string): PluginModule[] {\n return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _setPendingResetByModule(module: PluginModule): void {\n return untracked(() => {\n const activationEvents = getEvents(module.activatesOn)\n .map(eventKey)\n .filter((key) => this._state.eventsFired.includes(key));\n\n const pendingReset = Array.from(new Set(activationEvents)).filter(\n (event) => !this._state.pendingReset.includes(event),\n );\n if (pendingReset.length > 0) {\n log('pending reset', { events: pendingReset });\n this._state.pendingReset.push(...pendingReset);\n }\n });\n }\n\n /**\n * @internal\n */\n // TODO(wittjosiah): Improve error typing.\n _activate(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('activating', { key });\n const pendingIndex = this._state.pendingReset.findIndex((event) => event === key);\n if (pendingIndex !== -1) {\n this._state.pendingReset.splice(pendingIndex, 1);\n }\n\n const modules = this._getInactiveModulesByEvent(key).filter((module) => {\n const allOf = isAllOf(module.activatesOn);\n if (!allOf) {\n return true;\n }\n\n const events = module.activatesOn.events.filter((event) => eventKey(event) !== key);\n return events.every((event) => this._state.eventsFired.includes(eventKey(event)));\n });\n if (modules.length === 0) {\n log('no modules to activate', { key });\n if (!this._state.eventsFired.includes(key)) {\n this._state.eventsFired.push(key);\n }\n return false;\n }\n\n log('activating modules', { key, modules: modules.map((module) => module.id) });\n this.activation.emit({ event: key, state: 'activating' });\n\n // Concurrently triggers loading of lazy capabilities.\n const getCapabilities = yield* Effect.all(\n modules.map(({ activate }) =>\n Effect.tryPromise({\n try: async () => activate(this.context),\n catch: (error) => error as Error,\n }),\n ),\n { concurrency: 'unbounded' },\n );\n\n const result = yield* pipe(\n modules,\n A.zip(getCapabilities),\n A.map(([module, getCapabilities]) => this._activateModule(module, getCapabilities)),\n // TODO(wittjosiah): This currently can't be run in parallel.\n // Running this with concurrency causes races with `allOf` activation events.\n Effect.all,\n Effect.either,\n );\n\n if (Either.isLeft(result)) {\n this.activation.emit({ event: key, state: 'error', error: result.left });\n yield* Effect.fail(result.left);\n }\n\n if (!this._state.eventsFired.includes(key)) {\n this._state.eventsFired.push(key);\n }\n\n this.activation.emit({ event: key, state: 'activated' });\n log('activated', { key });\n\n return true;\n });\n }\n\n private _activateModule(\n module: PluginModule,\n getCapabilities: AnyCapability | AnyCapability[] | (() => Promise<AnyCapability | AnyCapability[]>),\n ): Effect.Effect<void, Error> {\n return Effect.gen(this, function* () {\n yield* Effect.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {\n concurrency: 'unbounded',\n });\n\n log('activating module...', { module: module.id });\n // TODO(wittjosiah): This is not handling errors thrown if this is synchronous.\n const maybeCapabilities = typeof getCapabilities === 'function' ? getCapabilities() : getCapabilities;\n const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(\n // TODO(wittjosiah): Activate with an effect?\n // Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n const capabilities = Match.value(resolvedCapabilities).pipe(\n Match.when(Array.isArray, (array) => array),\n Match.orElse((value) => [value]),\n );\n capabilities.forEach((capability) => {\n this.context.contributeCapability({ module: module.id, ...capability });\n });\n this._state.active.push(module.id);\n this._capabilities.set(module.id, capabilities);\n log('activated module', { module: module.id });\n\n yield* Effect.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {\n concurrency: 'unbounded',\n });\n });\n }\n\n private _deactivate(id: string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const modules = plugin.modules;\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n return results.every((result) => result);\n });\n }\n\n private _deactivateModule(module: PluginModule): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const id = module.id;\n log('deactivating', { id });\n\n const capabilities = this._capabilities.get(id);\n if (capabilities) {\n for (const capability of capabilities) {\n this.context.removeCapability(capability.interface, capability.implementation);\n const program = capability.deactivate?.();\n yield* Match.value(program).pipe(\n Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n }\n this._capabilities.delete(id);\n }\n\n const activeIndex = this._state.active.findIndex((event) => event === id);\n if (activeIndex !== -1) {\n this._state.active.splice(activeIndex, 1);\n }\n\n log('deactivated', { id });\n return true;\n });\n }\n\n private _reset(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('reset', { key });\n const modules = this._getActiveModulesByEvent(key);\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n\n if (results.every((result) => result)) {\n return yield* this._activate(key);\n } else {\n return false;\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, type PluginContext } from './capabilities';\nimport { type ActivationEvent, type ActivationEvents } from './events';\n\ninterface PluginModuleInterface {\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvents;\n\n /**\n * Events which the plugin depends on being activated.\n * Plugin is marked as needing reset a plugin activated by a dependent event is removed.\n * Events are automatically activated before activation of the plugin.\n */\n activatesBefore?: ActivationEvent[];\n\n /**\n * Events which this plugin triggers upon activation.\n */\n activatesAfter?: ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * @param context The plugin context.\n * @returns The capabilities of the module.\n */\n activate: (\n context: PluginContext,\n ) => MaybePromise<AnyCapability | AnyCapability[]> | Promise<() => Promise<AnyCapability | AnyCapability[]>>;\n}\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class PluginModule implements PluginModuleInterface {\n readonly id: PluginModuleInterface['id'];\n readonly activatesOn: PluginModuleInterface['activatesOn'];\n readonly activatesBefore?: PluginModuleInterface['activatesBefore'];\n readonly activatesAfter?: PluginModuleInterface['activatesAfter'];\n readonly activate: PluginModuleInterface['activate'];\n\n constructor(options: PluginModuleInterface) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.activatesBefore = options.activatesBefore;\n this.activatesAfter = options.activatesAfter;\n this.activate = options.activate;\n }\n}\n\n/**\n * Helper to define a module.\n */\nexport const defineModule = (options: PluginModuleInterface) => new PluginModule(options);\n\nexport type PluginMeta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class Plugin {\n constructor(\n readonly meta: PluginMeta,\n readonly modules: PluginModule[],\n ) {}\n}\n\n/**\n * Helper to define a plugin.\n */\nexport const definePlugin = (meta: PluginMeta, modules: PluginModule[]) => {\n return new Plugin(meta, modules);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Registry } from '@effect-rx/rx-react';\nimport { type Schema } from 'effect';\nimport { type FC, type PropsWithChildren } from 'react';\n\nimport { type ExecutableTool } from '@dxos/ai';\nimport { type GraphBuilder, type BuilderExtensions } from '@dxos/app-graph';\nimport { type ArtifactDefinition } from '@dxos/artifact';\nimport { type Space } from '@dxos/client-protocol';\nimport { type RootSettingsStore } from '@dxos/local-storage';\nimport { type AnchoredTo } from '@dxos/schema';\n\nimport { type FileInfo } from './file';\nimport { type NodeSerializer } from './graph';\nimport { type SurfaceDefinition } from './surface';\nimport { type Resource } from './translations';\nimport { type PluginManager, defineCapability } from '../core';\nimport { type AnyIntentResolver, type IntentContext } from '../plugin-intent';\n\nexport namespace Capabilities {\n export const PluginManager = defineCapability<PluginManager>('dxos.org/app-framework/capability/plugin-manager');\n\n export const Null = defineCapability<null>('dxos.org/app-framework/capability/null');\n\n export const RxRegistry = defineCapability<Registry.Registry>('dxos.org/app-framework/capability/rx-registry');\n\n export type ReactContext = Readonly<{ id: string; dependsOn?: string[]; context: FC<PropsWithChildren> }>;\n export const ReactContext = defineCapability<ReactContext>('dxos.org/app-framework/capability/react-context');\n\n export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n export const ReactRoot = defineCapability<ReactRoot>('dxos.org/app-framework/capability/react-root');\n\n export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];\n export const ReactSurface = defineCapability<ReactSurface>('dxos.org/app-framework/common/react-surface');\n\n export type IntentResolver = AnyIntentResolver | readonly AnyIntentResolver[];\n export const IntentResolver = defineCapability<IntentResolver>('dxos.org/app-framework/capability/intent-resolver');\n\n export const IntentDispatcher = defineCapability<IntentContext>(\n 'dxos.org/app-framework/capability/intent-dispatcher',\n );\n\n export type Layout = Readonly<{\n mode: string;\n dialogOpen: boolean;\n sidebarOpen: boolean;\n complementarySidebarOpen: boolean;\n /**\n * The id of the active workspace, where a workspace is a set of active items.\n */\n workspace: string;\n /**\n * Identifiers of items which are currently active in the application.\n */\n active: string[];\n /**\n * Identifiers of items which were previously active in the application.\n */\n inactive: string[];\n /**\n * Identifier of the item which should be scrolled into view.\n */\n scrollIntoView: string | undefined;\n }>;\n export const Layout = defineCapability<Layout>('dxos.org/app-framework/capability/layout');\n\n // TODO(burdon): Why array?\n export const Translations = defineCapability<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');\n\n export const AppGraph = defineCapability<Readonly<Pick<GraphBuilder, 'graph' | 'explore'>>>(\n 'dxos.org/app-framework/capability/app-graph',\n );\n\n export const AppGraphBuilder = defineCapability<BuilderExtensions>(\n 'dxos.org/app-framework/capability/app-graph-builder',\n );\n\n export const AppGraphSerializer = defineCapability<NodeSerializer[]>(\n 'dxos.org/app-framework/capability/app-graph-serializer',\n );\n\n export const SettingsStore = defineCapability<RootSettingsStore>('dxos.org/app-framework/capability/settings-store');\n\n // TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.\n // export type Settings = Parameters<RootSettingsStore['createStore']>[0];\n // export type Settings<T extends SettingsValue = SettingsValue> = SettingsProps<T>;\n export type Settings = {\n prefix: string;\n schema: Schema.Schema.All;\n value?: Record<string, any>;\n };\n export const Settings = defineCapability<Settings>('dxos.org/app-framework/capability/settings');\n\n export type Metadata = Readonly<{ id: string; metadata: Record<string, any> }>;\n export const Metadata = defineCapability<Metadata>('dxos.org/app-framework/capability/metadata');\n\n export const Tools = defineCapability<ExecutableTool[]>('dxos.org/app-framework/capability/tools');\n export const ArtifactDefinition = defineCapability<ArtifactDefinition>(\n 'dxos.org/app-framework/capability/artifact-definition',\n );\n\n export type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;\n export const FileUploader = defineCapability<FileUploader>('dxos.org/app-framework/capability/file-uploader');\n\n type AnchorSort = {\n key: string;\n sort: (anchorA: AnchoredTo, anchorB: AnchoredTo) => number;\n };\n export const AnchorSort = defineCapability<AnchorSort>('dxos.org/app-framework/capability/anchor-sort');\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Expando, Ref } from '@dxos/echo-schema';\n\nexport namespace CollaborationActions {\n export class InsertContent extends Schema.TaggedClass<InsertContent>()('assistant/intent-content', {\n input: Schema.Struct({\n target: Expando,\n object: Ref(Expando),\n at: Schema.optional(Schema.String),\n label: Schema.String.pipe(Schema.optional),\n }).annotations({\n description: 'Enables plugins to inject content blocks or references into a related entity.',\n }),\n output: Schema.Void,\n }) {}\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities } from './capabilities';\nimport { defineEvent } from '../core';\n\nexport namespace Events {\n /**\n * Fired when the app is started.\n */\n export const Startup = defineEvent('dxos.org/app-framework/event/startup');\n\n //\n // Dependent Events\n //\n\n /**\n * Fired to load any newly available surfaces.\n */\n export const SetupReactSurface = defineEvent('dxos.org/app-framework/event/setup-react-surface');\n\n /**\n * Fired to load any newly available metadata.\n */\n export const SetupMetadata = defineEvent('dxos.org/app-framework/event/setup-metadata');\n\n /**\n * Fired before the intent dispatcher is activated.\n */\n export const SetupIntentResolver = defineEvent('dxos.org/app-framework/event/setup-intent-resolver');\n\n /**\n * Fired before the settings store is activated.\n */\n export const SetupSettings = defineEvent('dxos.org/app-framework/event/setup-settings');\n\n /**\n * Fired before the graph is created.\n */\n export const SetupAppGraph = defineEvent('dxos.org/app-framework/event/setup-graph');\n\n /**\n * Fired before the translations provider is created.\n */\n export const SetupTranslations = defineEvent('dxos.org/app-framework/event/setup-translations');\n\n /**\n * Fired to load any newly available artifacts definitions.\n */\n export const SetupArtifactDefinition = defineEvent('dxos.org/app-framework/event/setup-artifact-definition');\n\n //\n // Triggered Events\n //\n\n /**\n * Fired after the intent dispatcher is ready.\n */\n export const DispatcherReady = defineEvent('dxos.org/app-framework/event/dispatcher-ready');\n\n /**\n * Fired after the settings store is ready.\n */\n export const SettingsReady = defineEvent('dxos.org/app-framework/event/settings-ready');\n\n /**\n * Fired when the graph is ready.\n */\n export const AppGraphReady = defineEvent('dxos.org/app-framework/event/graph-ready');\n\n /**\n * Fired when plugin state is ready.\n */\n export const createStateEvent = (specifier: string) => defineEvent('dxos.org/app-framework/event/state', specifier);\n export const LayoutReady = createStateEvent(Capabilities.Layout.identifier);\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\n// TODO(burdon): See Accept attribute (uses MIME types).\n// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg', 'gif'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport const FileInfoSchema = Schema.Struct({\n name: Schema.String,\n type: Schema.String,\n url: Schema.optional(Schema.String),\n cid: Schema.optional(Schema.String), // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).\n});\n\nexport type FileInfo = Schema.Schema.Type<typeof FileInfoSchema>;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Label } from '../plugin-intent';\n\nexport const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';\nexport const LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export const UPDATE_LAYOUT = `${LAYOUT_ACTION}/update-layout`;\n\n /**\n * Generic layout action.\n */\n export class UpdateLayout extends Schema.TaggedClass<UpdateLayout>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.String.annotations({ description: 'The part of the layout to mutate.' }),\n subject: Schema.optional(Schema.Any.annotations({ description: 'The subject of the layout update.' })),\n options: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional options for the layout action.',\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n //\n // Common layout actions.\n //\n\n // NOTE: These are layout actions which are currently in common use.\n // They constrain the generic layout action types to provide additional type safety.\n // However, they all follow the same generic structure and intent id.\n // This allows for plugins to update the layout without depending on a specific layout plugin.\n // The expectation is that other norms other than these will emerge over time.\n\n export class SetLayoutMode extends Schema.TaggedClass<SetLayoutMode>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('mode').annotations({ description: 'Setting the layout mode.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'Item which is the subject of the new layout mode.' }),\n ),\n options: Schema.Union(\n Schema.Struct({ mode: Schema.String.annotations({ description: 'The new layout mode.' }) }),\n Schema.Struct({ revert: Schema.Boolean.annotations({ description: 'Revert to the previous layout mode.' }) }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdateSidebar extends Schema.TaggedClass<UpdateSidebar>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('sidebar').annotations({ description: 'Updating the sidebar.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the sidebar.' }),\n ),\n options: Schema.optional(\n Schema.Struct({\n state: Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the sidebar is closed, collapsed, or expanded.',\n }),\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdateComplementary extends Schema.TaggedClass<UpdateComplementary>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('complementary').annotations({ description: 'Updating the complementary sidebar.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the complementary area.' }),\n ),\n options: Schema.optional(\n Schema.Struct({\n state: Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the complementary sidebar is closed, collapsed, or expanded.',\n }),\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdateDialog extends Schema.TaggedClass<UpdateDialog>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('dialog').annotations({ description: 'Updating the dialog.' }),\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the dialog.' }),\n ),\n options: Schema.Struct({\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),\n type: Schema.optional(Schema.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),\n blockAlign: Schema.optional(\n Schema.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),\n ),\n overlayClasses: Schema.optional(\n Schema.String.annotations({ description: 'Additional classes for the dialog overlay.' }),\n ),\n overlayStyle: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional styles for the dialog overlay.',\n }),\n ),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the dialog.',\n }),\n ),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class UpdatePopover extends Schema.TaggedClass<UpdatePopover>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('popover').annotations({ description: 'Updating the popover.' }),\n subject: Schema.optional(\n Schema.Any.annotations({\n description: 'URI of the component to display in the popover or data to pass to the popover.',\n }),\n ),\n options: Schema.Struct({\n side: Schema.optional(\n Schema.Literal('top', 'right', 'bottom', 'left').annotations({ description: 'The side of the anchor.' }),\n ),\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the popover is open or closed.' })),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the popover.',\n }),\n ),\n }).pipe(\n Schema.extend(\n Schema.Union(\n Schema.Struct({\n variant: Schema.Literal('virtual'),\n anchor: Schema.Any.annotations({ description: 'The DOM element to anchor the popover to.' }),\n }),\n Schema.Struct({\n variant: Schema.optional(Schema.Literal('react')),\n anchorId: Schema.String.annotations({\n description: 'An id that can be used to determine whether to render the anchor subcomponent.',\n }),\n }),\n ),\n ),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export const Toast = Schema.Struct({\n id: Schema.String.annotations({ description: 'The id of the toast.' }),\n title: Schema.optional(Label.annotations({ description: 'The title of the toast.' })),\n description: Schema.optional(Label.annotations({ description: 'The description of the toast.' })),\n icon: Schema.optional(Schema.String.annotations({ description: 'The icon of the toast.' })),\n duration: Schema.optional(Schema.Number.annotations({ description: 'The duration of the toast.' })),\n closeLabel: Schema.optional(Label.annotations({ description: 'The label of the close button.' })),\n actionLabel: Schema.optional(Label.annotations({ description: 'The label of the action button.' })),\n actionAlt: Schema.optional(Label.annotations({ description: 'The alt text of the action button.' })),\n onAction: Schema.optional(\n Schema.Any.annotations({ description: 'The action to perform when the action button is clicked.' }),\n ),\n });\n\n export interface Toast extends Omit<Schema.Schema.Type<typeof Toast>, 'onAction'> {\n onAction?: () => void;\n }\n\n export class AddToast extends Schema.TaggedClass<AddToast>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('toast').annotations({ description: 'Adding a toast.' }),\n subject: Toast.annotations({ description: 'The toast to add.' }),\n }),\n output: Schema.Void,\n }) {}\n\n export class SwitchWorkspace extends Schema.TaggedClass<SwitchWorkspace>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('workspace').annotations({ description: 'Switching the workspace.' }),\n subject: Schema.String.annotations({ description: 'The id of the workspace to switch to.' }),\n }),\n output: Schema.Void,\n }) {}\n\n export class RevertWorkspace extends Schema.TaggedClass<RevertWorkspace>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('workspace').annotations({ description: 'Switching the workspace.' }),\n options: Schema.Struct({\n revert: Schema.Literal(true).annotations({ description: 'Revert to the previous workspace.' }),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class Open extends Schema.TaggedClass<Open>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('main').annotations({ description: 'Opening an item in the main content area.' }),\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to open.' })),\n options: Schema.optional(\n Schema.Struct({\n state: Schema.optional(Schema.Literal(true).annotations({ description: 'The items are being added.' })),\n variant: Schema.optional(Schema.String.annotations({ description: 'The variant of the item to open.' })),\n key: Schema.optional(\n Schema.String.annotations({\n description: 'If provided, will replace item with a matching key (id prefix).',\n }),\n ),\n workspace: Schema.optional(Schema.String.annotations({ description: 'The workspace to open the items in.' })),\n scrollIntoView: Schema.optional(Schema.Boolean.annotations({ description: 'Scroll the items into view.' })),\n pivotId: Schema.optional(\n Schema.String.annotations({ description: 'The id of the item to place new items next to.' }),\n ),\n positioning: Schema.optional(\n Schema.Union(\n Schema.Literal('start').annotations({ description: 'The items are being added before the pivot item.' }),\n Schema.Literal('end').annotations({ description: 'The items are being added after the pivot item.' }),\n ),\n ),\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class Set extends Schema.TaggedClass<Set>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('main').annotations({ description: 'Setting items in the main content area.' }),\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to set.' })),\n options: Schema.Struct({\n override: Schema.Literal(true).annotations({\n description: 'Override the current items in the main content area.',\n }),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class Close extends Schema.TaggedClass<Close>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('main').annotations({ description: 'Closing items in the main content area.' }),\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to close.' })),\n options: Schema.Struct({\n state: Schema.Literal(false).annotations({ description: 'The items are being removed.' }),\n }),\n }),\n output: Schema.Void,\n }) {}\n\n export class ScrollIntoView extends Schema.TaggedClass<ScrollIntoView>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('current').annotations({ description: 'Setting the current item' }),\n subject: Schema.optional(Schema.String.annotations({ description: 'The id of the item to set as current.' })),\n options: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional options for the scroll into view.',\n }),\n ),\n }),\n output: Schema.Void,\n }) {}\n\n export class Expose extends Schema.TaggedClass<Expose>()(UPDATE_LAYOUT, {\n input: Schema.Struct({\n part: Schema.Literal('navigation').annotations({ description: 'Exposing an item in the navigation area.' }),\n subject: Schema.String.annotations({ description: 'The id of the item to expose.' }),\n }),\n output: Schema.Void,\n }) {}\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { INTENT_PLUGIN } from './actions';\nimport { Events } from '../common';\nimport { defineModule, definePlugin, lazy } from '../core';\n\nexport const IntentPlugin = () =>\n definePlugin({ id: INTENT_PLUGIN, name: 'Intent' }, [\n defineModule({\n id: `${INTENT_PLUGIN}/module/dispatcher`,\n // TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.\n // This is fine for now because it's how it worked prior to capabilities api anyways.\n // In the future, the intent dispatcher should be able to be reset without resetting the entire app.\n activatesOn: Events.Startup,\n activatesAfter: [Events.DispatcherReady],\n activate: lazy(() => import('./intent-dispatcher')),\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type JSX, type ForwardedRef, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { type GuardedType, type MakeOptional, type Position } from '@dxos/util';\n\nimport { type ErrorBoundary } from '../react';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n}> &\n MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> & {\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n };\n\n// NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\ntype CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n};\n\ntype SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<\n CoreSurfaceProps<T> & { [key: string]: unknown }\n>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = (\n props: SurfaceComponentProps<T>,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | null;\n\n/**\n * Definition of when a SurfaceComponent should be rendered.\n */\nexport type SurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n id: string;\n role: string | string[];\n position?: Position;\n filter?: (data: Record<string, unknown>) => data is T;\n component: SurfaceComponent<GuardedType<SurfaceDefinition<T>['filter']>>;\n}>;\n\n/**\n * Creates a surface definition.\n */\nexport const createSurface = <T extends Record<string, any> = any>(\n definition: SurfaceDefinition<T>,\n): SurfaceDefinition<T> => definition;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nexport const ResourceKey = Schema.Union(Schema.String, Schema.Record({ key: Schema.String, value: Schema.Any }));\nexport type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;\n\nexport const ResourceLanguage = Schema.Record({ key: Schema.String, value: ResourceKey });\nexport type ResourceLanguage = Schema.Schema.Type<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = Schema.Record({ key: Schema.String, value: ResourceLanguage });\nexport type Resource = Schema.Schema.Type<typeof Resource>;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,UAAAA,SAAQC,QAAQC,QAAAA,OAAMC,OAAAA,YAAW;AAG1C,SAASC,QAAAA,aAAY;AACrB,SAASC,OAAAA,YAAW;AACpB,SAASC,kBAAsE;;;ACL/E,SAASC,UAAAA,eAAc;;;ACAvB,SAASC,cAAc;AAoEhB,IAAMC,eAAe,CAC1BC,QACAC,OAA2B,CAAC,GAC5BC,SAAkC,CAAC,MAAC;AAIpC,QAAMC,IAAIC,OAAOC,aAAaL,OAAOM,O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0C;IACVf,iBAAiBiB;IACjBjD,MAAM+C;IACND,aAAaG;EACf,CAAA;AAGA,QAAM,EAAE5C,UAAU2B,iBAAiBhC,MAAM8C,YAAW,IAAKrE,iBAAiB,MACxEyE,QAAQG,gBAAgBC,aAAaC,cAAc,EAAEC,KAAI,CAAA;AAG3D,QAAMC,UAAUP,QAAQQ,cAAcJ,aAAaK,aAAa;AAChER,QAAM9C,WAAW,CAACC,aAAaC,UAAAA;AAC7B,WAAOzB,QAAOM,IAAI,aAAA;AAChB,aAAOqE,QAAQG,UAAUC,OAAOC,mBAAmB;AACnD,aAAO,OAAOzD,SAASC,aAAaC,KAAAA;IACtC,CAAA;EACF;AACA4C,QAAMnB,kBAAkB,OAAO1B,gBAAAA;AAC7B,UAAMmD,QAAQM,SAASF,OAAOC,mBAAmB;AACjD,WAAO,MAAM9B,gBAAgB1B,WAAAA;EAC/B;AACA6C,QAAMnD,OAAOA;AACbmD,QAAML,cAAcA;AAEpB,SAAOkB,YAAYV,aAAaW,kBAAkBd,KAAAA;AACpD;",
|
|
6
6
|
"names": ["Effect", "Option", "pipe", "Ref", "live", "log", "byPosition", "Schema", "Schema", "createIntent", "schema", "data", "params", "_", "Schema", "validateSync", "fields", "input", "intent", "_schema", "id", "_tag", "first", "last", "all", "chain", "intents", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "defaultValue", "INTENT_PLUGIN", "INTENT_ACTION", "IntentAction", "Track", "Schema", "TaggedClass", "input", "Struct", "intents", "Array", "String", "error", "optional", "output", "Void", "ShowUndo", "message", "Label", "BaseError", "Error", "code", "message", "context", "cause", "name", "Object", "setPrototypeOf", "prototype", "NoResolversError", "action", "CycleDetectedError", "Rx", "Effect", "Trigger", "invariant", "log", "InterfaceDefTypeId", "Symbol", "for", "defineCapability", "identifier", "CapabilityImpl", "moduleId", "implementation", "contributes", "interfaceDef", "deactivate", "interface", "lazy", "c", "props", "default", "getCapability", "PluginContext", "registry", "activate", "reset", "_capabilityImpls", "family", "make", "pipe", "keepAlive", "_capabilities", "id", "get", "current", "map", "_capability", "length", "_registry", "contributeCapability", "module", "capability", "includes", "set", "count", "removeCapability", "next", "filter", "warn", "capabilities", "getCapabilities", "waitForCapability", "trigger", "cancel", "subscribe", "wake", "result", "wait", "activatePromise", "event", "runPromise", "resetPromise", "defineEvent", "id", "specifier", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents", "Registry", "untracked", "Array", "A", "Effect", "Either", "Match", "pipe", "Event", "live", "log", "isPromise", "value", "PluginManager", "pluginLoader", "plugins", "core", "map", "meta", "id", "enabled", "registry", "activation", "Event", "_capabilities", "Map", "Registry", "make", "context", "PluginContext", "activate", "event", "_activate", "reset", "_reset", "_pluginLoader", "_state", "live", "modules", "active", "pendingReset", "eventsFired", "forEach", "plugin", "_addPlugin", "enable", "add", "untracked", "log", "_getPlugin", "includes", "push", "module", "_addModule", "_setPendingResetByModule", "events", "Effect", "runPromise", "all", "concurrency", "remove", "result", "disable", "_removePlugin", "enabledIndex", "findIndex", "splice", "_deactivate", "_removeModule", "deactivate", "pluginIndex", "moduleIndex", "find", "_getActiveModules", "filter", "_getInactiveModules", "_getActiveModulesByEvent", "key", "getEvents", "activatesOn", "eventKey", "_getInactiveModulesByEvent", "activationEvents", "Array", "from", "Set", "length", "gen", "pendingIndex", "allOf", "isAllOf", "every", "emit", "state", "getCapabilities", "tryPromise", "try", "catch", "error", "pipe", "A", "zip", "_activateModule", "either", "Either", "isLeft", "left", "fail", "activatesBefore", "maybeCapabilities", "resolvedCapabilities", "Match", "when", "promise", "orElse", "program", "succeed", "capabilities", "isArray", "array", "capability", "contributeCapability", "set", "activatesAfter", "results", "_deactivateModule", "get", "removeCapability", "interface", "implementation", "isEffect", "effect", "delete", "activeIndex", "PluginModule", "options", "id", "activatesOn", "activatesBefore", "activatesAfter", "activate", "defineModule", "Plugin", "meta", "modules", "definePlugin", "Capabilities", "PluginManager", "defineCapability", "Null", "RxRegistry", "ReactContext", "ReactRoot", "ReactSurface", "IntentResolver", "IntentDispatcher", "Layout", "Translations", "AppGraph", "AppGraphBuilder", "AppGraphSerializer", "SettingsStore", "Settings", "Metadata", "Tools", "ArtifactDefinition", "FileUploader", "AnchorSort", "Schema", "Expando", "Ref", "CollaborationActions", "InsertContent", "Schema", "TaggedClass", "input", "Struct", "target", "Expando", "object", "Ref", "at", "optional", "String", "label", "pipe", "annotations", "description", "output", "Void", "Events", "Startup", "defineEvent", "SetupReactSurface", "SetupMetadata", "SetupIntentResolver", "SetupSettings", "SetupAppGraph", "SetupTranslations", "SetupArtifactDefinition", "DispatcherReady", "SettingsReady", "AppGraphReady", "createStateEvent", "specifier", "LayoutReady", "Capabilities", "Layout", "identifier", "Schema", "defaultFileTypes", "images", "media", "text", "FileInfoSchema", "Schema", "Struct", "name", "String", "type", "url", "optional", "cid", "Schema", "IntentPlugin", "definePlugin", "id", "INTENT_PLUGIN", "name", "defineModule", "activatesOn", "Events", "Startup", "activatesAfter", "DispatcherReady", "activate", "lazy", "LAYOUT_PLUGIN", "LAYOUT_ACTION", "LayoutAction", "UPDATE_LAYOUT", "UpdateLayout", "Schema", "TaggedClass", "input", "Struct", "part", "String", "annotations", "description", "subject", "optional", "Any", "options", "Record", "key", "value", "output", "Void", "SetLayoutMode", "Literal", "Union", "mode", "revert", "Boolean", "UpdateSidebar", "state", "UpdateComplementary", "UpdateDialog", "type", "blockAlign", "overlayClasses", "overlayStyle", "props", "UpdatePopover", "side", "pipe", "extend", "variant", "anchor", "anchorId", "Toast", "id", "title", "Label", "icon", "duration", "Number", "closeLabel", "actionLabel", "actionAlt", "onAction", "AddToast", "SwitchWorkspace", "RevertWorkspace", "Open", "Array", "workspace", "scrollIntoView", "pivotId", "positioning", "Set", "override", "Close", "ScrollIntoView", "Expose", "createSurface", "definition", "Schema", "ResourceKey", "Schema", "Union", "String", "Record", "key", "value", "Any", "ResourceLanguage", "Resource", "EXECUTION_LIMIT", "HISTORY_LIMIT", "createResolver", "resolver", "isUndoable", "historyEntry", "length", "every", "undoable", "createDispatcher", "getResolvers", "executionLimit", "historyLimit", "historyRef", "Effect", "runSync", "Ref", "make", "handleIntent", "intent", "gen", "candidates", "filter", "_tag", "id", "data", "toSorted", "byPosition", "fail", "NoResolversError", "effect", "resolve", "undo", "result", "isEffect", "promise", "_intent", "dispatch", "intentChain", "depth", "CycleDetectedError", "resultsRef", "all", "prev", "get", "update", "results", "intents", "error", "history", "next", "splice", "pipe", "createIntent", "IntentAction", "ShowUndo", "message", "catchSome", "err", "Option", "some", "succeed", "undefined", "none", "dispatchPromise", "runPromise", "then", "catch", "log", "last", "findLastIndex", "map", "undoData", "first", "at", "h", "_", "index", "undoPromise", "defaultEffect", "Error", "defaultPromise", "context", "state", "live", "getCapabilities", "Capabilities", "IntentResolver", "flat", "manager", "getCapability", "PluginManager", "_activate", "Events", "SetupIntentResolver", "activate", "contributes", "IntentDispatcher"]
|
|
7
7
|
}
|