import { DisposeStack, Scope, type Dispose, type FeatureId, type GenerationHandoff, type GenerationAdmissionGate, type GenerationHandoffRegistry, type PluginId, type PluginNodeSnapshot, type SetupCapabilityRegistration, type TokenId } from '@zhin.js/plugin-runtime'; import { type RuntimeEnvironment } from './environment.js'; import { type EnvironmentLayers } from './environment-store.js'; import type { ModuleRuntime } from './module-runtime.js'; import type { PluginGraphNode } from './project-graph.js'; import type { IsolatedPluginRuntimePort } from './isolation.js'; import { type PrimaryConfig } from './primary-config.js'; import type { RuntimeConfigDocument } from '@zhin.js/plugin-runtime'; export type PluginConfigResolver = (node: PluginGraphNode) => unknown; export interface RootResourceContext { /** Exact shadow generation being assembled; never inferred from a latest snapshot. */ readonly generation: number; readonly signal: AbortSignal; readonly resources: Scope; readonly lifecycle: DisposeStack; readonly handoff: GenerationHandoffRegistry; /** Candidate-wide gate atomically switched by SnapshotStore at commit. */ readonly admission: GenerationAdmissionGate; readonly config: PrimaryConfig; /** * Adds a root-owned capability to this shadow generation. The definition is * validated and projected with convention/setup capabilities; it is never * visible before the generation commits. */ addFeature(feature: FeatureId | string, localName: string, definition: TDefinition): void; } export type RootResourceInstaller = (context: RootResourceContext) => void | Promise; export interface PluginAssemblySeed { readonly scopes: ReadonlyMap; readonly tree: ReadonlyMap; readonly config: ReadonlyMap; readonly resources: ReadonlyMap>; } /** Assembles Plugin setup into mutable shadow maps without publishing them. */ export declare class PluginScopeAssembler { #private; private readonly modules; private readonly configResolver; private readonly environment; private readonly primaryConfigDocument; private readonly generation; private readonly installResources?; private readonly isolation?; readonly scopes: Map; readonly tree: Map; readonly config: Map; readonly resources: Map>; constructor(modules: ModuleRuntime, configResolver: PluginConfigResolver, environment: RuntimeEnvironment, primaryConfigDocument: RuntimeConfigDocument, generation: number, installResources?: RootResourceInstaller | undefined, environmentLayers?: EnvironmentLayers, seed?: PluginAssemblySeed, isolation?: IsolatedPluginRuntimePort | undefined); removeSubtrees(roots: readonly PluginId[]): void; installSetupFeatureAliases(aliases: ReadonlyMap): void; setupTree(node: PluginGraphNode, signal: AbortSignal): Promise; synchronizeTree(node: PluginGraphNode): void; createdScopeDisposers(): readonly (readonly [PluginId, Dispose])[]; generationHandoff(): GenerationHandoff | undefined; setupCapabilities(): readonly Readonly[]; /** Root resources are process-owned; every Plugin Scope receives an owner-bound facade. */ private installOwnerScopedHosts; }