import * as Context from 'effect/Context';
import * as Effect from 'effect/Effect';
import * as Pipeable from 'effect/Pipeable';
import type * as ActivationEvent from './activation-event';
import * as Capability from './capability';
import type * as PluginManager from './plugin-manager';
declare const Service_base: Context.TagClass<Service, "@dxos/app-framework/PluginManager", PluginManager.PluginManager>;
/**
 * Effect Context.Tag for accessing PluginManager via the Effect layer system.
 * This allows lifecycle operations to access the plugin manager without having it passed as an argument.
 */
export declare class Service extends Service_base {
}
/**
 * Activates plugins based on the activation event.
 * Accesses the PluginManager via the Effect layer system.
 * @param event The activation event.
 * @returns Whether the activation was successful.
 */
export declare const activate: (event: ActivationEvent.ActivationEvent) => Effect.Effect<boolean, Error, Service>;
/**
 * Re-activates the modules that were activated by the event.
 * Accesses the PluginManager via the Effect layer system.
 * @param event The activation event.
 * @returns Whether the reset was successful.
 */
export declare const reset: (event: ActivationEvent.ActivationEvent) => Effect.Effect<boolean, Error, Service>;
/**
 * Identifier denoting a PluginModule.
 */
export declare const PluginModuleTypeId: unique symbol;
export type PluginModuleTypeId = typeof PluginModuleTypeId;
/**
 * Type guard to check if a value is a PluginModule.
 */
export declare const isPluginModule: (value: unknown) => value is PluginModule;
/**
 * A unit of containment of modular functionality that can be provided to an application.
 * Activation of a module is async allowing for code to split and loaded lazily.
 */
export interface PluginModule {
    readonly [PluginModuleTypeId]: PluginModuleTypeId;
    /**
     * Unique id of the module.
     */
    id: string;
    /**
     * Events for which the module will be activated.
     */
    activatesOn: ActivationEvent.Events;
    /**
     * Events which the plugin depends on being activated.
     * Plugin is marked as needing reset a plugin activated by a dependent event is removed.
     * Events are automatically activated before activation of the plugin.
     */
    activatesBefore?: ActivationEvent.ActivationEvent[];
    /**
     * Events which this plugin triggers upon activation.
     */
    activatesAfter?: ActivationEvent.ActivationEvent[];
    /**
     * Called when the module is activated.
     * CapabilityManager is accessed via the Effect layer system (Capability.Service).
     * PluginManager is accessed via Plugin.Service.
     * @param props Optional props passed to the module.
     * @returns The capabilities of the module.
     */
    activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;
}
export type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & {
    id?: string;
};
export type Meta = {
    /**
     * Globally unique ID.
     *
     * Expected to be in the form of a valid URL.
     *
     * @example dxos.org/plugin/example
     */
    id: string;
    /**
     * Human-readable name.
     */
    name: string;
    /**
     * Short description of plugin functionality.
     */
    description?: string;
    /**
     * URL of home page.
     */
    homePage?: string;
    /**
     * URL of source code.
     */
    source?: string;
    /**
     * URL of screenshot.
     */
    screenshots?: string[];
    /**
     * Tags to help categorize the plugin.
     */
    tags?: string[];
    /**
     * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.
     */
    icon?: string;
    /**
     * Icon hue (ChromaticPalette).
     */
    iconHue?: string;
};
/**
 * Identifier denoting a Plugin.
 */
export declare const PluginTypeId: unique symbol;
export type PluginTypeId = typeof PluginTypeId;
/**
 * Type guard to check if a value is a Plugin.
 */
export declare const isPlugin: (value: unknown) => value is Plugin;
/**
 * A collection of modules that are be enabled/disabled as a unit.
 * Plugins provide things such as components, state, actions, etc. to the application.
 */
export interface Plugin {
    readonly [PluginTypeId]: PluginTypeId;
    readonly meta: Readonly<Meta>;
    readonly modules: ReadonlyArray<PluginModule>;
}
/**
 * Builder interface for creating plugins incrementally.
 */
export interface PluginBuilder<T = void> extends Pipeable.Pipeable {
    readonly meta: Meta;
    readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;
    addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;
}
/**
 * Creates a new PluginBuilder to start building a plugin.
 */
export declare const define: <T = void>(meta: Meta) => PluginBuilder<T>;
/**
 * Adds a module to a plugin builder.
 * Supports both pipeline and direct call styles.
 * Modules can be either PluginModuleOptions or functions that receive options.
 */
export declare function addModule<T>(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): (builder: PluginBuilder<T>) => PluginBuilder<T>;
export declare function addModule<T>(builder: PluginBuilder<T>, moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;
export type PluginFactory<T = void> = ((options: T) => Plugin) & {
    meta: Meta;
};
/**
 * Creates a Plugin from a builder.
 * Supports both pipeline and direct call styles.
 * Always returns a factory function (options: T) => Plugin.
 * When T is void, the function takes no arguments: () => Plugin.
 */
export declare function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;
export {};
//# sourceMappingURL=plugin.d.ts.map