import { a as ConfigDiagnostic } from "./config-DS0HTIUU.mjs"; import { i as PoConfigProvenance } from "./index-CmNDXC15.mjs"; import { FileSystem } from "@agimon-ai/po-core/platform"; //#region src/services/presetConfig/core.d.ts type LayerPackageConfig = Record; /** One package selected by a layer, plus configuration owned by that package. */ interface LayerPackage { name: string; optional?: boolean; config?: LayerPackageConfig; } /** One configured package found while walking selected layers in order. */ interface ResolvedPackageConfiguration { layer: string; specifier: string; config: LayerPackageConfig; baseDirectory: string; filePath?: string; } interface LayerDefinition { /** * Po built-in names, or Pi-compatible local extension paths. * Bare names resolve from Po's own extension entries. Paths beginning * with `./` or `../`, plus absolute paths, resolve against the config that * declares the layer and may name a script file or extension directory. */ extensions?: string[]; /** * npm specifiers, or local package paths retained for compatibility. * Relative paths resolve against the repository root for `.po/presets.yaml` * and against the global `.po` directory for * `~/.po/presets.yaml`. */ packages?: Array; /** Legacy configuration accepted for compatibility, with no runtime effect. */ hookGroups?: string[]; } /** A layer plus the root its relative extension and package paths resolve against. */ interface ResolvedLayerDefinition extends LayerDefinition { baseDirectory: string; /** Absolute path of the presets file that declared this layer. */ filePath?: string; } interface PresetDefinition { /** Human-readable purpose used by pickers and agent-facing catalogs. */ description: string; /** Ordered layer names activated by this preset. */ layers: string[]; } interface PresetsConfig { /** Unconditional package bundle loaded before packages from selected named layers. */ default?: ResolvedLayerDefinition; layers: Record; /** The preset selected when neither a flag nor the environment names one. */ defaultPreset: string; /** Source that last declared the default, absent for the built-in fallback. */ defaultPresetSource?: PoConfigProvenance; /** Named presets, including their purpose and ordered layers. */ preset: Record; /** Declaring source for each surviving named preset. */ presetSources?: Record; } interface LayerResolvers { ownEntry: (name: string) => string; packageEntry: (name: string) => string; optionalPackageEntry: (name: string) => string | undefined; /** Resolves every standard package.json pi.extensions entry for a package root. */ packageEntries?: (name: string) => string[]; /** Optional counterpart to packageEntries. */ optionalPackageEntries?: (name: string) => string[] | undefined; /** Resolves one path-style layer entry against the config that declared it. */ localEntry: (specifier: string, baseDirectory: string) => string | undefined; /** Resolves every Pi extension entry contributed by a local file or directory. */ localEntries?: (specifier: string, baseDirectory: string) => string[] | undefined; } /** * The npm package name a layer package specifier stands for, or undefined when * it names none. Injected because answering it for a local path reads that * directory's package.json, which `moduleResolution` does on Node and a * precomputed composition answers on the edge. */ type PackageNameResolver = (specifier: string, baseDirectory: string) => string | undefined; /** * Whether a layer value names a path rather than a built-in or installed package. * * The same rule Node applies to import specifiers, so a bare name is always a * logical name and a path always looks like one. */ declare function isLocalPackageSpecifier(specifier: string): boolean; /** * Finds configuration owned by one package while preserving layer and package order. * Pass a resolver to match local package paths by name without changing their specifiers. */ declare function resolvePackageConfigurations(config: PresetsConfig, names: string[], packageName: string, resolvePackageName?: PackageNameResolver): ResolvedPackageConfiguration[]; /** Resolves one named preset into its configured layer components. */ declare function resolveLayers(config: PresetsConfig, preset: string): string[]; /** Resolves one layer's extension and package entries to absolute paths. */ declare function layerEntries(config: PresetsConfig, name: string, resolvers: LayerResolvers): string[]; //#endregion //#region src/services/presetConfig/sync.d.ts /** * Reads layers and presets from the global and repository configs. * * The repository is read last, so it replaces a global layer or preset of * the same name. Layers keep the root they were declared under so that a * global layer naming `./extensions/x` still points beside the global config * once it is loaded from inside some other repository. * * @deprecated Node-only sync shim; use readPresetsConfig. Removed in M2. */ declare function loadPresetsConfig(repoRoot: string, homeDirectory?: string, environment?: NodeJS.ProcessEnv): PresetsConfig; /** * Reads layers and presets, tolerating unknown keys. * * `po sync` uses this so a presets.yaml written against a different set of * layer packages cannot break a build. Every other caller keeps the strict * `loadPresetsConfig`, and `po doctor` still reports what was tolerated. * * @deprecated Node-only sync shim; use readPresetsConfigLenient. Removed in M2. */ declare function loadPresetsConfigLenient(repoRoot: string, homeDirectory?: string, environment?: NodeJS.ProcessEnv): { config: PresetsConfig; diagnostics: ConfigDiagnostic[]; }; //#endregion //#region src/services/presetConfig/index.d.ts type IoContext = Parameters[1]; interface ReadPresetsConfigOptions { /** Defaults to the host's home directory. */ readonly homeDirectory?: string; /** Admitted environment for locating Po home and distribution overrides. Defaults to empty. */ readonly environment?: NodeJS.ProcessEnv; /** * Names the package a layer specifier stands for. Pass one built from a * precomputed composition on the edge; by default local paths are answered * from their package.json over `fs`. */ readonly resolvePackageName?: PackageNameResolver; } /** Reads layers and presets over a FileSystem; the same answer as `loadPresetsConfig`. */ declare function readPresetsConfig(fs: FileSystem, repoRoot: string, context: IoContext, options?: ReadPresetsConfigOptions): Promise; /** As `readPresetsConfig`, tolerating unknown keys and reporting them. */ declare function readPresetsConfigLenient(fs: FileSystem, repoRoot: string, context: IoContext, options?: ReadPresetsConfigOptions): Promise<{ config: PresetsConfig; diagnostics: ConfigDiagnostic[]; }>; /** * Reads local package names over a FileSystem, then finds package-owned config. * Keeps the original specifiers, source directories, and default/selected-layer order. * Missing or invalid local manifests do not match a package name. */ declare function readPackageConfigurations(fs: FileSystem, config: PresetsConfig, names: string[], packageName: string, context: IoContext): Promise; //#endregion export { layerEntries as _, loadPresetsConfig as a, LayerPackage as c, PackageNameResolver as d, PresetDefinition as f, isLocalPackageSpecifier as g, ResolvedPackageConfiguration as h, readPresetsConfigLenient as i, LayerPackageConfig as l, ResolvedLayerDefinition as m, readPackageConfigurations as n, loadPresetsConfigLenient as o, PresetsConfig as p, readPresetsConfig as r, LayerDefinition as s, ReadPresetsConfigOptions as t, LayerResolvers as u, resolveLayers as v, resolvePackageConfigurations as y }; //# sourceMappingURL=index-BeSAaIoW.d.mts.map