import { type KindNameCollision } from './kind-registry.js'; import { ProvenanceTable } from './source-provenance.js'; import { type NativeProjectResolution } from './native-project.js'; import type { BuilderRegistries } from './builder.js'; export interface OntologyRelationshipInfo { name: string; sourceKind?: string; targetKind?: string; } export interface OntologyPackageInfo { name: string; version: string; type: 'ontology' | 'profile' | 'extension' | 'methodology'; description: string; extends?: string; layers: OntologyLayerInfo[]; kindCount: number; relationshipCount: number; relationshipTypes: OntologyRelationshipInfo[]; selected: boolean; /** Optional modules declared by this package (OWL-style — loadable on demand). */ optionalModules?: string[]; /** True when this package is listed in another package's optionalModules. */ isOptionalModule?: boolean; rootDir?: string; /** * The `ExplorerClassification` usages this package declares, verbatim. * * `layers` already has these APPLIED — its ids are explorerDomains and its * kinds carry explorerGroups. That is enough for a kind the ontology * declares, and not enough for anything else: the native SysML constructs * the builder synthesizes (ActionUsage, ItemDefinition, ForkNode, * JoinNode) have no kind entry, and the only thing that places them is * their NAMESPACE, which is what these are keyed by. A consumer without * them has to hardcode the taxonomy, which is how a `behavior` layer the * ontology never declared reached the Model Explorer. */ explorerPlacements?: ExplorerPlacement[]; /** The `LayerRendering` usages this package declares — labels and colours. */ layerPalette?: LayerPalette[]; } export interface OntologyLayerInfo { id: string; label: string; color: string; kindCount: number; kinds: OntologyKindInfo[]; } export interface OntologyKindInfo { name: string; label: string; construct: string; layer: string; instanceCount: number; viewpoints: string[]; description?: string; derivesFrom?: string; derivedBy?: string[]; relationships?: Array<{ type: string; targetKind: string; direction: 'outgoing' | 'incoming'; }>; /** Namespace sub-group: the first directory under the layer (e.g. "context", "risk", "iso14971"). */ group?: string; /** Compliance standard (e.g. "iso14971"), set for kinds under compliance// */ standard?: string; /** Abstract ontology bases organize the type system but are not Explorer folders. */ isAbstract?: boolean; } /** * Build layer info by scanning the sysml/ directory tree. * Apollo-11 convention: sysml//.sysml * * Files under / are collected recursively, so both flat * (`/file.sysml`) and nested (`//file.sysml`) * layouts load. The first directory under sysmlDir is the layer id. */ export declare function buildLayers(sysmlDir: string): OntologyLayerInfo[]; /** One `ExplorerClassification` usage, read from ontology SysML. */ export interface ExplorerPlacement { sourceNamespace: string; explorerDomain: string; explorerGroup: string; } /** One `LayerRendering` usage, read from ontology SysML. */ export interface LayerPalette { layerId: string; layerLabel: string; layerColor: string; } /** * Describe every package a project could resolve, marking the ones it does. * * "Available" comes from locators — distribution manifests, node_modules, * workspace package directories. "Selected" comes from the native import * closure and nothing else: a package a manifest points at but no import * reaches is listed here as available and unselected, which is exactly what it * is. Before the flip, selection was read out of `ontologies:`, `modules:`, * `methodology:`, and the `extends` chain. */ export declare function getPackageMetadata(projectRoot: string, selectedRootDirs?: ReadonlySet): OntologyPackageInfo[]; /** * Result of loading ontology registries, including diagnostic info. */ export interface OntologyLoadResult { /** Populated registries for the builder */ registries: BuilderRegistries; /** Number of ontology SysML files parsed */ fileCount: number; /** Ontology package directories that were found and parsed */ ontologyDirs: string[]; /** Errors encountered during parsing */ errors: string[]; /** Parsed ontology documents (for rule registry and other consumers) */ parsedDocuments: import('./parser-utils.js').ParsedDocument[]; /** * Short names claimed by more than one definition. * * Reported separately from `errors` because these are ontology defects, not * load failures: the model still builds, but which definition a short * reference resolves to depends on file order. Session 2 resolves the * ontology's own collisions; session 3 makes an ambiguous reference fail. */ kindNameCollisions: KindNameCollision[]; /** Resolved dependency roots and the provenance they imply. */ provenance?: ProvenanceTable; /** The native resolution this load was driven by. */ resolution?: NativeProjectResolution; } /** * Resolve the SysML root directory for an ontology package. * Honors `sysmlDir:` override in the package's manifest; falls back to `/sysml`. */ export declare function resolvePackageSysmlDir(pkgDir: string): string; /** * Resolve a @memoarchitect/package-name to its config file path. * Prefers memo.package.yaml (new format), falls back to memo.config.yaml (legacy). * Searches: workspace packages (monorepo), then node_modules. */ export declare function resolvePackageConfig(packageName: string, fromDir: string): string | undefined; /** * Load the reusable registries a project actually resolves. * * Selection is the native import closure. This used to walk the `extends` * chain, the `methodology:` field, the `ontologies:` list, and the `modules:` * opt-ins; all four are gone, and a package now contributes kinds because the * project imports it, not because a settings file named it. * * Everything in the closure is parsed, including project-owned source, because * a project may declare its own definitions and those are project content the * builder must see. Provenance keeps the two apart. */ export declare function loadOntologyRegistries(projectRoot: string): Promise; //# sourceMappingURL=ontology-loader.d.ts.map