/** * Code Implementation Asset Storage * ================================ * * Manages versioned code implementation assets: manifests, entry files, * and metadata pointers for Implementation(type=code) records. * * DESIGN CONSTRAINTS (per D-09 through D-12): * - Manifest is loading metadata, NOT the source of truth for lifecycle state (D-11) * - The Principle Tree ledger remains canonical for lifecycle and relationships (D-11) * - Asset root follows the PD stateDir convention: * {stateDir}/principles/implementations/{implId}/ * - All writes use withLock for atomicity (matching ledger pattern) * - This module does NOT implement replay execution, evaluation report generation, * or promotion logic (D-12) */ /** * Manifest shape for a code implementation's filesystem assets. * Subordinate to the ledger per D-11: does NOT store lifecycleState. */ export interface CodeImplementationManifest { /** Asset version (distinct from Implementation.version in the ledger) */ version: string; /** Relative filename of the entry point (e.g., 'entry.js') */ entryFile: string; /** ISO timestamp of initial creation */ createdAt: string; /** ISO timestamp of last manifest update */ updatedAt: string; /** Fingerprints of samples this implementation was tested against */ replaySampleRefs: string[]; /** Relative path to most recent eval report, or null */ lastEvalReportRef: string | null; /** Provenance carried with the generated candidate assets */ lineage?: CodeImplementationLineageMetadata; } export interface CodeImplementationLineageMetadata { principleId: string; ruleId: string; sourceSnapshotRef: string; sourcePainIds: string[]; sourceGateBlockIds: string[]; sourceSessionId: string; artificerArtifactId: string; } /** * Get the absolute path for an implementation's asset root. * Convention: {stateDir}/principles/implementations/{implId}/ */ export declare function getImplementationAssetRoot(stateDir: string, implId: string): string; /** * Write manifest atomically using withLock. */ export declare function writeManifest(stateDir: string, implId: string, manifest: CodeImplementationManifest): void; export declare function writeEntrySource(stateDir: string, implId: string, sourceCode: string, entryFile?: string): void; export declare function deleteImplementationAssetDir(stateDir: string, implId: string): void; /** * Create the full asset directory structure for a new implementation. * * Creates: * {implId}/ - asset root * {implId}/entry.js - placeholder entry point (only if not already present) * {implId}/manifest.json - asset manifest with version and timestamps * {implId}/replays/ - empty directory for future replay reports * * Idempotent: calling again with the same implId will NOT overwrite an existing entry.js. */ export declare function createImplementationAssetDir(stateDir: string, implId: string, version: string, options?: { entrySource?: string; lineage?: CodeImplementationLineageMetadata; }): CodeImplementationManifest;