@moldea.ai/core 7.0.3 → 7.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- {"version":3,"file":"scope-DxhC1hq2.js","names":[],"sources":["../../src/text/index.ts","../../src/scope-matching/validations.ts","../../src/scope-matching/patterns.ts","../../src/scope-matching/matching.ts","../../src/manifest-validation/index.ts","../../src/source-location/index.ts","../../src/yaml/index.ts","../../src/manifest/index.ts","../../src/scope-matching/scope.ts"],"sourcesContent":["import { parseRepositoryPath, type IRepositoryPath } from '@moldea.ai/repository';\n\nimport type {\n IContentDigest,\n IContentDigestResult,\n ICoreResourceLimits,\n INormalizedText,\n ITextDocumentInput,\n ITextNormalizationResult,\n} from '../contracts/index.js';\nimport {\n createCoreDiagnosticCollector,\n type ICoreDiagnosticCollector,\n} from '../diagnostic-utilities/index.js';\nimport type { ICoreDiagnostic } from '../diagnostics/index.js';\nimport { CoreOperationException, type ICoreOperation } from '../exceptions/index.js';\nimport { freezeRecursively } from '../immutable/index.js';\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });\n\nconst isRecord = (value: unknown): value is Readonly<Record<string, unknown>> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n};\n\n/**\n * Measures valid scalar UTF-8 bytes and stops once the operation budget is exceeded.\n * @param value The decoded string to measure without lossy replacement.\n * @param maximumByteLength The threshold after which measurement may stop early.\n * @returns The measured bytes, a value above the threshold, or `null` for invalid Unicode.\n */\nconst measureScalarUtf8ByteLength = (value: string, maximumByteLength: number): number | null => {\n let byteLength = 0;\n\n for (let index = 0; index < value.length; index += 1) {\n const codeUnit = value.charCodeAt(index);\n\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n if (index + 1 >= value.length) {\n return null;\n }\n\n const nextCodeUnit = value.charCodeAt(index + 1);\n\n if (nextCodeUnit < 0xdc00 || nextCodeUnit > 0xdfff) {\n return null;\n }\n\n byteLength += 4;\n\n if (byteLength > maximumByteLength) {\n return byteLength;\n }\n\n index += 1;\n continue;\n }\n\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n return null;\n }\n\n byteLength += codeUnit <= 0x7f ? 1 : codeUnit <= 0x7ff ? 2 : 3;\n\n if (byteLength > maximumByteLength) {\n return byteLength;\n }\n }\n\n return byteLength;\n};\n\nconst countUnicodeScalars = (value: string): number => {\n let count = 0;\n\n for (let index = 0; index < value.length; count += 1) {\n const codePoint = value.codePointAt(index);\n\n if (codePoint === undefined) {\n break;\n }\n\n index += codePoint > 0xffff ? 2 : 1;\n }\n\n return count;\n};\n\n/**\n * Collects every normalized NUL location or rejects when the diagnostic budget is exhausted.\n * @param value The normalized scalar text to inspect.\n * @param path The logical document path attached to each diagnostic.\n * @param diagnostics The operation collector receiving every NUL diagnostic.\n * @throws\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nconst collectNulDiagnostics = (\n value: string,\n path: IRepositoryPath,\n diagnostics: ICoreDiagnosticCollector,\n): void => {\n let column = 1;\n let line = 1;\n let offset = 0;\n\n for (const scalar of value) {\n if (scalar === '\\0') {\n diagnostics.add({\n code: 'MOLDEA_TEXT_NUL_FORBIDDEN',\n path,\n range: {\n end: { column: column + 1, line, offset: offset + 1 },\n start: { column, line, offset },\n },\n });\n }\n\n if (scalar === '\\n') {\n column = 1;\n line += 1;\n } else {\n column += 1;\n }\n\n offset += 1;\n }\n};\n\nconst invalidArgument = (operation: ICoreOperation): never => {\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation,\n });\n};\n\nconst enforceFileLimit = (\n byteLength: number,\n limits: ICoreResourceLimits,\n operation: ICoreOperation,\n limit: 'maxFileBytes' | 'maxManifestBytes',\n): void => {\n if (byteLength <= limits[limit]) {\n return;\n }\n\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit,\n limitMaximum: limits[limit],\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: byteLength,\n operation,\n });\n};\n\nconst invalidResult = (diagnostics: readonly ICoreDiagnostic[]): ITextNormalizationResult => {\n return freezeRecursively({\n diagnostics: [...diagnostics],\n text: null,\n valid: false,\n });\n};\n\n/**\n * Validates one public text input, enforces its source-byte budget, and decodes strict UTF-8.\n * @param input The untrusted public text-document input.\n * @param limits The immutable Core resource limits.\n * @param operation The public operation requesting the input.\n * @param limit The source-byte limit applied by the operation.\n * @param diagnostics The operation collector receiving text diagnostics.\n * @returns Decoded text or a frozen structural failure result.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nconst readInput = (\n input: ITextDocumentInput,\n limits: ICoreResourceLimits,\n operation: ICoreOperation,\n limit: 'maxFileBytes' | 'maxManifestBytes',\n diagnostics: ICoreDiagnosticCollector,\n): { readonly path: IRepositoryPath; readonly value: string } | ITextNormalizationResult => {\n if (!isRecord(input)) {\n return invalidArgument(operation);\n }\n\n const pathCandidate = input['path'];\n const content = input['content'];\n\n if (\n typeof pathCandidate !== 'string' ||\n (typeof content !== 'string' && !(content instanceof Uint8Array))\n ) {\n return invalidArgument(operation);\n }\n\n const path = parseRepositoryPath(pathCandidate);\n\n if (typeof content === 'string') {\n const byteLength = measureScalarUtf8ByteLength(content, limits[limit]);\n\n if (byteLength === null) {\n diagnostics.add({ code: 'MOLDEA_TEXT_INVALID_UNICODE', path });\n return invalidResult(diagnostics.finalize());\n }\n\n enforceFileLimit(byteLength, limits, operation, limit);\n return { path, value: content };\n }\n\n enforceFileLimit(content.byteLength, limits, operation, limit);\n const bytes = new Uint8Array(content);\n\n try {\n return { path, value: decoder.decode(bytes) };\n } catch {\n diagnostics.add({ code: 'MOLDEA_TEXT_INVALID_UTF8', path });\n return invalidResult(diagnostics.finalize());\n }\n};\n\n/**\n * Validates and normalizes one text document under an operation-specific resource budget.\n * @param input The logical path and decoded string or exact source bytes.\n * @param limits The immutable Core resource limits.\n * @param operation The public Core operation requesting normalization.\n * @param limit The source-byte limit applied by the operation.\n * @returns A frozen normalized result or structural text diagnostics.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const normalizeTextDocument = (\n input: ITextDocumentInput,\n limits: ICoreResourceLimits,\n operation: ICoreOperation,\n limit: 'maxFileBytes' | 'maxManifestBytes' = 'maxFileBytes',\n): ITextNormalizationResult => {\n const diagnostics = createCoreDiagnosticCollector(limits, operation);\n const decoded = readInput(input, limits, operation, limit, diagnostics);\n\n if ('valid' in decoded) {\n return decoded;\n }\n\n const withoutLeadingBom = decoded.value.startsWith('\\ufeff')\n ? decoded.value.slice(1)\n : decoded.value;\n const value = withoutLeadingBom.replace(/\\r\\n?/gu, '\\n');\n collectNulDiagnostics(value, decoded.path, diagnostics);\n\n if (diagnostics.size > 0) {\n return invalidResult(diagnostics.finalize());\n }\n\n const text: INormalizedText = freezeRecursively({\n scalarLength: countUnicodeScalars(value),\n utf8ByteLength: encoder.encode(value).byteLength,\n value,\n });\n\n return freezeRecursively({\n diagnostics: [],\n text,\n valid: true,\n });\n};\n\nconst toLowercaseHex = (bytes: Uint8Array): string => {\n let value = '';\n\n for (const byte of bytes) {\n value += byte.toString(16).padStart(2, '0');\n }\n\n return value;\n};\n\n/**\n * Calculates the canonical digest for already-normalized text.\n * @param text The validated normalized text to encode and hash.\n * @returns A promise resolving to the canonical lowercase SHA-256 digest.\n */\nexport const calculateNormalizedTextDigest = async (\n text: INormalizedText,\n): Promise<IContentDigest> => {\n const bytes = encoder.encode(text.value);\n const hash = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', bytes));\n\n return `sha256:${toLowercaseHex(hash)}` as IContentDigest;\n};\n\n/**\n * Calculates the normalized SHA-256 digest for one text document.\n * @param input The logical path and decoded string or exact source bytes.\n * @param limits The immutable Core resource limits.\n * @returns A promise resolving to a frozen digest result or structural text diagnostics.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const calculateContentDigest = async (\n input: ITextDocumentInput,\n limits: ICoreResourceLimits,\n): Promise<IContentDigestResult> => {\n const normalized = normalizeTextDocument(input, limits, 'calculate-content-digest');\n\n if (!normalized.valid || normalized.text === null) {\n return freezeRecursively({\n diagnostics: normalized.diagnostics,\n digest: null,\n text: null,\n valid: false,\n });\n }\n\n const digest = await calculateNormalizedTextDigest(normalized.text);\n\n return freezeRecursively({\n diagnostics: [],\n digest,\n text: normalized.text,\n valid: true,\n });\n};\n","import { parseRepositoryPath, type IRepositoryPath } from '@moldea.ai/repository';\n\nimport { compareExactStrings } from '../format-validation/index.js';\n\nimport type { ICoreResourceLimits, ITextDocumentInput } from '../contracts/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\n\nimport type { IManifestScopeInput } from './types.js';\n\nconst isRecord = (value: unknown): value is Readonly<Record<string, unknown>> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n};\n\n/** Throws the stable invalid-argument failure for malformed scope input. */\nconst invalidArgument = (): never => {\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation: 'match-manifest-scope',\n });\n};\n\n/** Throws the stable resource failure for an exhausted scope-input budget. */\nconst resourceLimitExceeded = (\n limit: 'maxEntries' | 'maxTotalBytesRead',\n limitMaximum: number,\n observedUsage: number,\n): never => {\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit,\n limitMaximum,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage,\n operation: 'match-manifest-scope',\n });\n};\n\n/** Measures scalar UTF-8 bytes without allocating an encoded copy. */\nexport const measureUtf8ByteLength = (value: string): number => {\n let byteLength = 0;\n\n for (const scalar of value) {\n const codePoint = scalar.codePointAt(0) ?? 0;\n byteLength += codePoint <= 0x7f ? 1 : codePoint <= 0x7ff ? 2 : codePoint <= 0xffff ? 3 : 4;\n }\n\n return byteLength;\n};\n\nexport interface INormalizedManifestScopeInput {\n readonly manifest: ITextDocumentInput;\n readonly paths: readonly IRepositoryPath[];\n}\n\n/**\n * Validates and snapshots one public manifest-scope input.\n * @param input The untrusted manifest document and changed logical paths.\n * @param limits The immutable Core resource limits.\n * @returns The detached manifest input and sorted unique repository paths.\n * @throws\n * - INVALID_REPOSITORY_PATH: A changed repository path is invalid.\n * - INVALID_ARGUMENT: The scope operation received an invalid argument.\n * - RESOURCE_LIMIT_EXCEEDED: The changed-path count or byte budget was exceeded.\n */\nexport const normalizeManifestScopeInput = (\n input: IManifestScopeInput,\n limits: ICoreResourceLimits,\n): INormalizedManifestScopeInput => {\n if (!isRecord(input)) {\n return invalidArgument();\n }\n\n const manifest = input['manifest'];\n const pathCandidates = input['paths'];\n\n if (!isRecord(manifest) || !Array.isArray(pathCandidates)) {\n return invalidArgument();\n }\n\n if (pathCandidates.length > limits.maxEntries) {\n return resourceLimitExceeded('maxEntries', limits.maxEntries, pathCandidates.length);\n }\n\n const uniquePaths = new Set<IRepositoryPath>();\n let totalBytes = 0;\n\n for (const [index, candidate] of pathCandidates.entries()) {\n if (typeof candidate !== 'string') {\n return invalidArgument();\n }\n\n const path = parseRepositoryPath(candidate);\n totalBytes += measureUtf8ByteLength(path) + (index === 0 ? 0 : 1);\n\n if (totalBytes > limits.maxTotalBytesRead) {\n return resourceLimitExceeded('maxTotalBytesRead', limits.maxTotalBytesRead, totalBytes);\n }\n\n uniquePaths.add(path);\n }\n\n return {\n manifest,\n paths: [...uniquePaths].sort(compareExactStrings),\n };\n};\n","import type { IRepositoryPath } from '@moldea.ai/repository';\n\n/** Tests a single-segment wildcard without regular-expression interpretation. */\nconst matchesSegment = (pattern: string, value: string): boolean => {\n let patternIndex = 0;\n let valueIndex = 0;\n let starIndex = -1;\n let starValueIndex = -1;\n\n while (valueIndex < value.length) {\n if (pattern[patternIndex] === value[valueIndex]) {\n patternIndex += 1;\n valueIndex += 1;\n continue;\n }\n\n if (pattern[patternIndex] === '*') {\n starIndex = patternIndex;\n starValueIndex = valueIndex;\n patternIndex += 1;\n continue;\n }\n\n if (starIndex === -1) {\n return false;\n }\n\n patternIndex = starIndex + 1;\n starValueIndex += 1;\n valueIndex = starValueIndex;\n }\n\n while (pattern[patternIndex] === '*') {\n patternIndex += 1;\n }\n\n return patternIndex === pattern.length;\n};\n\n/** Matches validated simple-glob segments with zero-or-more-segment globstars. */\nexport const matchesRepositoryGlob = (\n patternSegments: readonly string[],\n path: IRepositoryPath,\n): boolean => {\n const pathSegments = path.slice(1).split('/');\n let reachable = new Uint8Array(pathSegments.length + 1);\n reachable[0] = 1;\n\n for (const patternSegment of patternSegments) {\n const next = new Uint8Array(pathSegments.length + 1);\n\n if (patternSegment === '**') {\n let canReach = false;\n\n for (let index = 0; index < reachable.length; index += 1) {\n canReach ||= reachable[index] === 1;\n next[index] = canReach ? 1 : 0;\n }\n } else {\n for (let index = 0; index < pathSegments.length; index += 1) {\n if (reachable[index] === 1 && matchesSegment(patternSegment, pathSegments[index] ?? '')) {\n next[index + 1] = 1;\n }\n }\n }\n\n reachable = next;\n }\n\n return reachable[pathSegments.length] === 1;\n};\n","import type { IRepositoryPath } from '@moldea.ai/repository';\n\nimport type { IContentDigest, ICoreResourceLimits } from '../contracts/index.js';\nimport { escapeJsonPointerSegment } from '../diagnostic-utilities/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\nimport { compareExactStrings, countUnicodeScalars } from '../format-validation/index.js';\nimport type {\n IAgentManifestEntry,\n IMoldeaManifestV1,\n IRepositoryReference,\n ISkillManifestEntry,\n IToolManifestEntry,\n IUnresolvedRequirementManifestEntry,\n} from '../format/index.js';\nimport { freezeRecursively } from '../immutable/index.js';\nimport { calculateNormalizedTextDigest } from '../text/index.js';\n\nimport type {\n IManifestScopeCounts,\n IManifestScopeDeclaration,\n IManifestScopeMatch,\n IManifestScopeOwner,\n IManifestScopeRelationshipField,\n} from './types.js';\nimport { measureUtf8ByteLength } from './validations.js';\nimport { matchesRepositoryGlob } from './patterns.js';\n\ninterface IManifestScopeRelationshipDeclaration {\n readonly owner: IManifestScopeOwner;\n readonly field: IManifestScopeRelationshipField;\n readonly pointer: string;\n readonly declaration: IManifestScopeDeclaration;\n}\n\ninterface ICompiledGlobDeclaration {\n readonly declaration: IManifestScopeRelationshipDeclaration;\n readonly segments: readonly string[];\n}\n\ninterface ICompiledManifestScope {\n readonly declarations: readonly IManifestScopeRelationshipDeclaration[];\n readonly exact: ReadonlyMap<IRepositoryPath, readonly IManifestScopeRelationshipDeclaration[]>;\n readonly globalGlobs: readonly ICompiledGlobDeclaration[];\n readonly globsByFirstSegment: ReadonlyMap<string, readonly ICompiledGlobDeclaration[]>;\n}\n\ntype IManifestCapability =\n | { readonly kind: 'skill'; readonly value: ISkillManifestEntry }\n | { readonly kind: 'tool'; readonly value: IToolManifestEntry };\n\nconst childPointer = (pointer: string, segment: string): string => {\n return `${pointer}/${escapeJsonPointerSegment(segment)}`;\n};\n\nconst createOwner = (\n kind: IManifestScopeOwner['kind'],\n id: string,\n agentId: string | null = null,\n): IManifestScopeOwner => ({ agentId, id, kind });\n\nconst compareOwners = (left: IManifestScopeOwner, right: IManifestScopeOwner): number => {\n return (\n compareExactStrings(left.kind, right.kind) ||\n compareExactStrings(left.agentId ?? '', right.agentId ?? '') ||\n compareExactStrings(left.id, right.id)\n );\n};\n\nconst getDeclarationValue = (declaration: IManifestScopeDeclaration): string => {\n return declaration.kind === 'exact' ? declaration.path : declaration.pattern;\n};\n\nconst compareDeclarations = (\n left: IManifestScopeRelationshipDeclaration,\n right: IManifestScopeRelationshipDeclaration,\n): number => {\n return (\n compareOwners(left.owner, right.owner) ||\n compareExactStrings(left.field, right.field) ||\n compareExactStrings(\n getDeclarationValue(left.declaration),\n getDeclarationValue(right.declaration),\n ) ||\n compareExactStrings(left.pointer, right.pointer)\n );\n};\n\n/** Adds one exact repository relationship to the normalized declaration collection. */\nconst addExactDeclaration = (\n declarations: IManifestScopeRelationshipDeclaration[],\n owner: IManifestScopeOwner,\n field: IManifestScopeRelationshipField,\n pointer: string,\n reference: IRepositoryReference | IRepositoryPath,\n): void => {\n declarations.push({\n declaration:\n typeof reference === 'string'\n ? { kind: 'exact', path: reference, symbol: null }\n : { kind: 'exact', path: reference.path, symbol: reference.symbol ?? null },\n field,\n owner,\n pointer,\n });\n};\n\n/** Adds repository references with their authored declaration pointers. */\nconst addReferenceDeclarations = (\n declarations: IManifestScopeRelationshipDeclaration[],\n references: readonly IRepositoryReference[] | undefined,\n owner: IManifestScopeOwner,\n field: IManifestScopeRelationshipField,\n pointer: string,\n): void => {\n for (const [index, reference] of (references ?? []).entries()) {\n addExactDeclaration(\n declarations,\n owner,\n field,\n childPointer(pointer, String(index)),\n reference,\n );\n }\n};\n\n/** Adds exact and simple-glob impact relationships in authored array order. */\nconst addAffectedByDeclarations = (\n declarations: IManifestScopeRelationshipDeclaration[],\n affectedBy: readonly string[] | undefined,\n owner: IManifestScopeOwner,\n pointer: string,\n): void => {\n for (const [index, pattern] of (affectedBy ?? []).entries()) {\n declarations.push({\n declaration: pattern.includes('*')\n ? { kind: 'glob', pattern }\n : { kind: 'exact', path: pattern as IRepositoryPath, symbol: null },\n field: 'affectedBy',\n owner,\n pointer: childPointer(pointer, String(index)),\n });\n }\n};\n\n/** Adds project-level or agent-level unresolved requirement references. */\nconst addUnresolvedDeclarations = (\n declarations: IManifestScopeRelationshipDeclaration[],\n requirements: Readonly<Record<string, IUnresolvedRequirementManifestEntry>> | undefined,\n pointer: string,\n agentId: string | null,\n): void => {\n for (const requirementId of Object.keys(requirements ?? {}).sort(compareExactStrings)) {\n const requirement = requirements?.[requirementId];\n\n if (requirement === undefined) {\n continue;\n }\n\n const owner = createOwner('unresolved', requirementId, agentId);\n addReferenceDeclarations(\n declarations,\n requirement.related,\n owner,\n 'related',\n childPointer(childPointer(pointer, requirementId), 'related'),\n );\n }\n};\n\n/** Adds exact and impact declarations owned by one tool or skill capability. */\nconst addCapabilityDeclarations = (\n declarations: IManifestScopeRelationshipDeclaration[],\n capabilityId: string,\n capability: IManifestCapability,\n agentId: string,\n pointer: string,\n): void => {\n const owner = createOwner(capability.kind, capabilityId, agentId);\n addExactDeclaration(\n declarations,\n owner,\n 'implementation',\n childPointer(pointer, 'implementation'),\n capability.value.implementation,\n );\n\n if (capability.value.registration !== undefined) {\n addExactDeclaration(\n declarations,\n owner,\n 'registration',\n childPointer(pointer, 'registration'),\n capability.value.registration,\n );\n }\n\n if (capability.kind === 'tool') {\n for (const field of ['inputSchema', 'outputSchema'] as const) {\n const reference = capability.value[field];\n\n if (reference !== undefined) {\n addExactDeclaration(declarations, owner, field, childPointer(pointer, field), reference);\n }\n }\n }\n\n addAffectedByDeclarations(\n declarations,\n capability.value.affectedBy,\n owner,\n childPointer(pointer, 'affectedBy'),\n );\n};\n\n/** Adds all exact and impact relationships owned by one registered agent. */\nconst addAgentDeclarations = (\n declarations: IManifestScopeRelationshipDeclaration[],\n agentId: string,\n agent: IAgentManifestEntry,\n): void => {\n const pointer = childPointer('/agents', agentId);\n const owner = createOwner('agent', agentId, agentId);\n const bindingsPointer = childPointer(pointer, 'bindings');\n\n for (const field of [\n 'runtimeAgent',\n 'inputSchema',\n 'outputSchema',\n 'instructionLoader',\n ] as const) {\n const reference = agent.bindings?.[field];\n\n if (reference !== undefined) {\n addExactDeclaration(\n declarations,\n owner,\n field,\n childPointer(bindingsPointer, field),\n reference,\n );\n }\n }\n\n for (const variableId of Object.keys(agent.bindings?.variableProviders ?? {}).sort(\n compareExactStrings,\n )) {\n const reference = agent.bindings?.variableProviders?.[variableId];\n\n if (reference !== undefined) {\n addExactDeclaration(\n declarations,\n owner,\n 'variableProvider',\n childPointer(childPointer(bindingsPointer, 'variableProviders'), variableId),\n reference,\n );\n }\n }\n\n addAffectedByDeclarations(\n declarations,\n agent.affectedBy,\n owner,\n childPointer(pointer, 'affectedBy'),\n );\n\n for (const capabilityId of Object.keys(agent.tools ?? {}).sort(compareExactStrings)) {\n const tool = agent.tools?.[capabilityId];\n\n if (tool !== undefined) {\n addCapabilityDeclarations(\n declarations,\n capabilityId,\n { kind: 'tool', value: tool },\n agentId,\n childPointer(childPointer(pointer, 'tools'), capabilityId),\n );\n }\n }\n\n for (const capabilityId of Object.keys(agent.skills ?? {}).sort(compareExactStrings)) {\n const skill = agent.skills?.[capabilityId];\n\n if (skill !== undefined) {\n addCapabilityDeclarations(\n declarations,\n capabilityId,\n { kind: 'skill', value: skill },\n agentId,\n childPointer(childPointer(pointer, 'skills'), capabilityId),\n );\n }\n }\n\n for (const [index, mirror] of (agent.mirrors ?? []).entries()) {\n addExactDeclaration(\n declarations,\n owner,\n 'mirrors',\n childPointer(childPointer(pointer, 'mirrors'), String(index)),\n mirror,\n );\n }\n\n addUnresolvedDeclarations(\n declarations,\n agent.unresolved,\n childPointer(pointer, 'unresolved'),\n agentId,\n );\n};\n\n/** Collects every version 1 declaration that can establish changed-path relevance. */\nexport const collectManifestScopeDeclarations = (\n manifest: IMoldeaManifestV1,\n): readonly IManifestScopeRelationshipDeclaration[] => {\n const declarations: IManifestScopeRelationshipDeclaration[] = [];\n\n for (const kind of ['context', 'decision'] as const) {\n const relationships = kind === 'context' ? manifest.context : manifest.decisions;\n\n for (const ownerId of Object.keys(relationships ?? {}).sort(compareExactStrings)) {\n const relationship = relationships?.[ownerId];\n\n if (relationship === undefined) {\n continue;\n }\n\n const owner = createOwner(kind, ownerId);\n const pointer = childPointer(kind === 'context' ? '/context' : '/decisions', ownerId);\n addReferenceDeclarations(\n declarations,\n relationship.bindings,\n owner,\n 'bindings',\n childPointer(pointer, 'bindings'),\n );\n addAffectedByDeclarations(\n declarations,\n relationship.affectedBy,\n owner,\n childPointer(pointer, 'affectedBy'),\n );\n }\n }\n\n addUnresolvedDeclarations(declarations, manifest.unresolved, '/unresolved', null);\n\n for (const agentId of Object.keys(manifest.agents ?? {}).sort(compareExactStrings)) {\n const agent = manifest.agents?.[agentId];\n\n if (agent !== undefined) {\n addAgentDeclarations(declarations, agentId, agent);\n }\n }\n\n return declarations.sort(compareDeclarations);\n};\n\n/** Builds exact and first-segment glob indexes once for one parsed manifest. */\nconst compileManifestScope = (\n manifest: IMoldeaManifestV1,\n limits: ICoreResourceLimits,\n): ICompiledManifestScope => {\n const declarations = collectManifestScopeDeclarations(manifest);\n\n if (declarations.length > limits.maxEntries) {\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxEntries',\n limitMaximum: limits.maxEntries,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: declarations.length,\n operation: 'match-manifest-scope',\n });\n }\n\n const exact = new Map<IRepositoryPath, IManifestScopeRelationshipDeclaration[]>();\n const globalGlobs: ICompiledGlobDeclaration[] = [];\n const globsByFirstSegment = new Map<string, ICompiledGlobDeclaration[]>();\n\n for (const declaration of declarations) {\n if (declaration.declaration.kind === 'exact') {\n const existing = exact.get(declaration.declaration.path) ?? [];\n existing.push(declaration);\n exact.set(declaration.declaration.path, existing);\n continue;\n }\n\n const segments = declaration.declaration.pattern.slice(1).split('/');\n const compiled = { declaration, segments };\n const firstSegment = segments[0] ?? '';\n\n if (firstSegment === '**' || firstSegment.includes('*')) {\n globalGlobs.push(compiled);\n } else {\n const existing = globsByFirstSegment.get(firstSegment) ?? [];\n existing.push(compiled);\n globsByFirstSegment.set(firstSegment, existing);\n }\n }\n\n return { declarations, exact, globalGlobs, globsByFirstSegment };\n};\n\nconst compareMatches = (left: IManifestScopeMatch, right: IManifestScopeMatch): number => {\n return (\n compareOwners(left.owner, right.owner) ||\n compareExactStrings(left.field, right.field) ||\n compareExactStrings(\n getDeclarationValue(left.declaration),\n getDeclarationValue(right.declaration),\n ) ||\n compareExactStrings(left.inputPath, right.inputPath) ||\n compareExactStrings(left.pointer, right.pointer)\n );\n};\n\nconst createMatch = (\n inputPath: IRepositoryPath,\n relationship: IManifestScopeRelationshipDeclaration,\n): IManifestScopeMatch => ({\n declaration: relationship.declaration,\n field: relationship.field,\n inputPath,\n owner: relationship.owner,\n pointer: relationship.pointer,\n});\n\n/** Adds one match without ever allocating beyond the operation entry budget. */\nconst addMatch = (\n matches: IManifestScopeMatch[],\n inputPath: IRepositoryPath,\n relationship: IManifestScopeRelationshipDeclaration,\n limits: ICoreResourceLimits,\n): void => {\n if (matches.length >= limits.maxEntries) {\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxEntries',\n limitMaximum: limits.maxEntries,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: matches.length + 1,\n operation: 'match-manifest-scope',\n });\n }\n\n matches.push(createMatch(inputPath, relationship));\n};\n\n/** Appends matches from one precompiled glob bucket without copying the bucket. */\nconst addGlobMatches = (\n matches: IManifestScopeMatch[],\n inputPath: IRepositoryPath,\n declarations: readonly ICompiledGlobDeclaration[],\n limits: ICoreResourceLimits,\n): void => {\n for (const compiled of declarations) {\n if (matchesRepositoryGlob(compiled.segments, inputPath)) {\n addMatch(matches, inputPath, compiled.declaration, limits);\n }\n }\n};\n\n/** Creates the canonical digest of the sorted unique changed-path set. */\nexport const calculateManifestScopeInputDigest = async (\n paths: readonly IRepositoryPath[],\n): Promise<IContentDigest> => {\n const value = paths.join('\\0');\n\n return calculateNormalizedTextDigest({\n scalarLength: countUnicodeScalars(value),\n utf8ByteLength: measureUtf8ByteLength(value),\n value,\n });\n};\n\n/**\n * Matches normalized changed paths against one valid version 1 manifest.\n * @param manifest The parsed and validated manifest value.\n * @param paths Sorted unique repository-logical changed paths.\n * @param limits The immutable Core operation limits.\n * @returns Frozen content-free matches and stable aggregate counts.\n * @throws\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const matchParsedManifestScope = (\n manifest: IMoldeaManifestV1,\n paths: readonly IRepositoryPath[],\n limits: ICoreResourceLimits,\n): { readonly counts: IManifestScopeCounts; readonly matches: readonly IManifestScopeMatch[] } => {\n const compiled = compileManifestScope(manifest, limits);\n const matches: IManifestScopeMatch[] = [];\n const matchedOwners = new Set<string>();\n const matchedPaths = new Set<IRepositoryPath>();\n\n for (const path of paths) {\n const firstSegment = path.slice(1).split('/', 1)[0] ?? '';\n const exactDeclarations = compiled.exact.get(path) ?? [];\n\n for (const relationship of exactDeclarations) {\n addMatch(matches, path, relationship, limits);\n }\n\n addGlobMatches(matches, path, compiled.globalGlobs, limits);\n addGlobMatches(matches, path, compiled.globsByFirstSegment.get(firstSegment) ?? [], limits);\n }\n\n matches.sort(compareMatches);\n\n for (const match of matches) {\n matchedOwners.add(`${match.owner.kind}\\0${match.owner.agentId ?? ''}\\0${match.owner.id}`);\n matchedPaths.add(match.inputPath);\n }\n\n return freezeRecursively({\n counts: {\n declarations: compiled.declarations.length,\n inputPaths: paths.length,\n matchedOwners: matchedOwners.size,\n matchedPaths: matchedPaths.size,\n matches: matches.length,\n },\n matches,\n });\n};\n","import type { IRepositoryPath } from '@moldea.ai/repository';\n\nimport type { ICoreResourceLimits } from '../contracts/index.js';\nimport { CoreOperationException, type ICoreOperation } from '../exceptions/index.js';\nimport { ACCEPTABLE_WARNING_CODES, RECOGNIZED_RUNTIME_IDS } from '../constants/index.js';\nimport {\n escapeJsonPointerSegment,\n type ICoreDiagnosticCollector,\n} from '../diagnostic-utilities/index.js';\nimport type { IDiagnosticEntity, ISourceRange } from '../diagnostics/index.js';\nimport {\n compareExactStrings,\n countUnicodeScalars,\n hasNonWhitespace,\n hasUnsupportedGlobMetacharacter,\n isCanonicalMoldeaPath,\n isCapabilityDescription,\n isContextPath,\n isDecisionPath,\n isMirrorPath,\n isNonEmptySingleLine,\n isRepositorySymbol,\n isReservedId,\n isRuntimeGuidancePath,\n isSimpleGlob,\n isStableId,\n isVariableId,\n parseManifestPath,\n} from '../format-validation/index.js';\nimport type {\n IAcceptedWarningManifestEntry,\n IAgentBindingsManifestEntry,\n IAgentManifestEntry,\n IRuntimeManifestEntry,\n IMoldeaManifestV1,\n IRelationshipManifestEntry,\n IRepositoryFormatVersion,\n IRepositoryReference,\n IRuntimeVariableManifestEntry,\n ISkillManifestEntry,\n IToolManifestEntry,\n IUnresolvedRequirementEffect,\n IUnresolvedRequirementManifestEntry,\n} from '../format/index.js';\nimport { createNullPrototypeRecord } from '../immutable/index.js';\nimport type { IYamlNode, IYamlScalarNode } from '../yaml/index.js';\n\ninterface IManifestValidationContext {\n readonly diagnostics: ICoreDiagnosticCollector;\n readonly mirrorPaths: Set<string>;\n readonly path: IRepositoryPath;\n readonly limits: ICoreResourceLimits;\n readonly operation: ICoreOperation;\n}\n\ninterface IMappingEntry {\n readonly key: IYamlScalarNode;\n readonly value: IYamlNode;\n}\n\nconst childPointer = (pointer: string, key: string): string => {\n return `${pointer}/${escapeJsonPointerSegment(key)}`;\n};\n\nconst addInvalidValue = (\n context: IManifestValidationContext,\n pointer: string,\n range: ISourceRange | null,\n reason: string,\n entity: IDiagnosticEntity | null = null,\n): void => {\n context.diagnostics.add({\n code: 'MOLDEA_MANIFEST_VALUE_INVALID',\n details: { reason },\n entity,\n path: context.path,\n pointer,\n range,\n });\n};\n\nconst readMapping = (\n node: IYamlNode,\n pointer: string,\n allowedProperties: ReadonlySet<string> | null,\n context: IManifestValidationContext,\n entity: IDiagnosticEntity | null = null,\n): ReadonlyMap<string, IMappingEntry> | null => {\n if (node.kind !== 'mapping') {\n addInvalidValue(context, pointer, node.range, 'mapping-required', entity);\n return null;\n }\n\n const entries = new Map<string, IMappingEntry>();\n\n for (const entry of node.entries) {\n if (entry.key.kind !== 'scalar' || typeof entry.key.value !== 'string') {\n addInvalidValue(context, pointer, entry.key.range, 'string-key-required', entity);\n continue;\n }\n\n const key = entry.key.value;\n\n if (allowedProperties !== null && !allowedProperties.has(key)) {\n context.diagnostics.add({\n code: 'MOLDEA_MANIFEST_PROPERTY_UNKNOWN',\n entity,\n path: context.path,\n pointer: childPointer(pointer, key),\n range: entry.key.range,\n });\n continue;\n }\n\n entries.set(key, { key: entry.key, value: entry.value });\n }\n\n return entries;\n};\n\nconst readString = (\n entry: IMappingEntry | undefined,\n pointer: string,\n context: IManifestValidationContext,\n options: {\n readonly entity?: IDiagnosticEntity;\n readonly required?: boolean;\n readonly singleLine?: boolean;\n } = {},\n): string | null => {\n if (entry === undefined) {\n if (options.required === true) {\n addInvalidValue(context, pointer, null, 'required', options.entity ?? null);\n }\n\n return null;\n }\n\n if (entry.value.kind !== 'scalar' || typeof entry.value.value !== 'string') {\n addInvalidValue(context, pointer, entry.value.range, 'string-required', options.entity ?? null);\n return null;\n }\n\n const value = entry.value.value;\n\n if (!hasNonWhitespace(value) || (options.singleLine === true && !isNonEmptySingleLine(value))) {\n addInvalidValue(context, pointer, entry.value.range, 'string-invalid', options.entity ?? null);\n return null;\n }\n\n return value;\n};\n\nconst validateStableId = (\n value: string,\n range: ISourceRange,\n pointer: string,\n context: IManifestValidationContext,\n entity: IDiagnosticEntity | null = null,\n): boolean => {\n if (!isStableId(value)) {\n context.diagnostics.add({\n code: 'MOLDEA_ID_INVALID',\n entity,\n path: context.path,\n pointer,\n range,\n });\n return false;\n }\n\n if (isReservedId(value)) {\n context.diagnostics.add({\n code: 'MOLDEA_ID_RESERVED',\n entity,\n path: context.path,\n pointer,\n range,\n });\n return false;\n }\n\n return true;\n};\n\nconst readReference = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n entity: IDiagnosticEntity | null = null,\n): IRepositoryReference | null => {\n const entries = readMapping(node, pointer, new Set(['path', 'symbol']), context, entity);\n\n if (entries === null) {\n return null;\n }\n\n const pathEntry = entries.get('path');\n\n if (pathEntry?.value.kind !== 'scalar' || typeof pathEntry.value.value !== 'string') {\n context.diagnostics.add({\n code: 'MOLDEA_PATH_INVALID',\n details: { reason: pathEntry === undefined ? 'missing' : 'type' },\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'path'),\n range: pathEntry?.value.range ?? null,\n });\n return null;\n }\n\n const path = parseManifestPath(pathEntry.value.value);\n\n if (path === null) {\n context.diagnostics.add({\n code: 'MOLDEA_PATH_INVALID',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'path'),\n range: pathEntry.value.range,\n });\n return null;\n }\n\n const symbolEntry = entries.get('symbol');\n\n if (symbolEntry === undefined) {\n return { path };\n }\n\n if (\n symbolEntry.value.kind !== 'scalar' ||\n typeof symbolEntry.value.value !== 'string' ||\n !isRepositorySymbol(symbolEntry.value.value)\n ) {\n context.diagnostics.add({\n code: 'MOLDEA_SYMBOL_INVALID',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'symbol'),\n range: symbolEntry.value.range,\n });\n return null;\n }\n\n if (isCanonicalMoldeaPath(path)) {\n context.diagnostics.add({\n code: 'MOLDEA_SYMBOL_FORBIDDEN',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'symbol'),\n range: symbolEntry.value.range,\n });\n return null;\n }\n\n return { path, symbol: symbolEntry.value.value };\n};\n\nconst readReferenceList = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n entity: IDiagnosticEntity | null = null,\n): readonly IRepositoryReference[] => {\n if (node.kind !== 'sequence' || node.items.length === 0) {\n addInvalidValue(context, pointer, node.range, 'non-empty-sequence-required', entity);\n return [];\n }\n\n const references: IRepositoryReference[] = [];\n const seen = new Set<string>();\n\n node.items.forEach((item, index) => {\n const reference = readReference(item, childPointer(pointer, String(index)), context, entity);\n\n if (reference === null) {\n return;\n }\n\n const key = `${reference.path}\\0${reference.symbol ?? ''}`;\n\n if (seen.has(key)) {\n context.diagnostics.add({\n code: 'MOLDEA_PATH_DUPLICATE',\n entity,\n path: context.path,\n pointer: childPointer(pointer, String(index)),\n range: item.range,\n });\n return;\n }\n\n seen.add(key);\n references.push(reference);\n });\n\n return references;\n};\n\nconst readAffectedBy = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n entity: IDiagnosticEntity | null = null,\n): readonly string[] => {\n if (node.kind !== 'sequence' || node.items.length === 0) {\n addInvalidValue(context, pointer, node.range, 'non-empty-sequence-required', entity);\n return [];\n }\n\n const values: string[] = [];\n const seen = new Set<string>();\n\n node.items.forEach((item, index) => {\n const itemPointer = childPointer(pointer, String(index));\n\n if (item.kind !== 'scalar' || typeof item.value !== 'string') {\n addInvalidValue(context, itemPointer, item.range, 'string-required', entity);\n return;\n }\n\n const isGlob = item.value.includes('*') || hasUnsupportedGlobMetacharacter(item.value);\n const isValid = isGlob ? isSimpleGlob(item.value) : parseManifestPath(item.value) !== null;\n\n if (!isValid) {\n context.diagnostics.add({\n code: isGlob ? 'MOLDEA_GLOB_INVALID' : 'MOLDEA_PATH_INVALID',\n entity,\n path: context.path,\n pointer: itemPointer,\n range: item.range,\n });\n return;\n }\n\n if (seen.has(item.value)) {\n context.diagnostics.add({\n code: isGlob ? 'MOLDEA_PATTERN_DUPLICATE' : 'MOLDEA_PATH_DUPLICATE',\n entity,\n path: context.path,\n pointer: itemPointer,\n range: item.range,\n });\n return;\n }\n\n seen.add(item.value);\n values.push(item.value);\n });\n\n return values;\n};\n\nconst readRelationship = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n): IRelationshipManifestEntry | null => {\n const entries = readMapping(node, pointer, new Set(['affectedBy', 'bindings']), context);\n\n if (entries === null) {\n return null;\n }\n\n const bindingsEntry = entries.get('bindings');\n const affectedByEntry = entries.get('affectedBy');\n\n if (bindingsEntry === undefined && affectedByEntry === undefined) {\n context.diagnostics.add({\n code: 'MOLDEA_CONTEXT_RELATIONSHIP_EMPTY',\n path: context.path,\n pointer,\n range: node.range,\n });\n }\n\n return {\n ...(bindingsEntry === undefined\n ? {}\n : {\n bindings: readReferenceList(\n bindingsEntry.value,\n childPointer(pointer, 'bindings'),\n context,\n ),\n }),\n ...(affectedByEntry === undefined\n ? {}\n : {\n affectedBy: readAffectedBy(\n affectedByEntry.value,\n childPointer(pointer, 'affectedBy'),\n context,\n ),\n }),\n };\n};\n\nconst readRelationshipRecord = (\n node: IYamlNode,\n pointer: string,\n kind: 'context' | 'decision',\n context: IManifestValidationContext,\n): Readonly<Record<string, IRelationshipManifestEntry>> | null => {\n const entries = readMapping(node, pointer, null, context);\n\n if (entries === null) {\n return null;\n }\n\n const normalized: Array<readonly [string, IRelationshipManifestEntry]> = [];\n\n for (const [key, entry] of [...entries].sort(([left], [right]) =>\n compareExactStrings(left, right),\n )) {\n const path = parseManifestPath(key);\n const validPath =\n path !== null && (kind === 'context' ? isContextPath(path, true) : isDecisionPath(path));\n\n if (!validPath) {\n context.diagnostics.add({\n code:\n kind === 'context' ? 'MOLDEA_CONTEXT_PATH_INVALID' : 'MOLDEA_DECISION_FILENAME_INVALID',\n path: context.path,\n pointer: childPointer(pointer, key),\n range: entry.key.range,\n });\n continue;\n }\n\n const relationship = readRelationship(entry.value, childPointer(pointer, key), context);\n\n if (relationship !== null) {\n normalized.push([key, relationship]);\n }\n }\n\n return createNullPrototypeRecord(normalized);\n};\n\nconst readPathList = (\n node: IYamlNode,\n pointer: string,\n kind: 'context' | 'decision' | 'mirror',\n context: IManifestValidationContext,\n entity: IDiagnosticEntity,\n): readonly IRepositoryPath[] => {\n if (node.kind !== 'sequence') {\n addInvalidValue(context, pointer, node.range, 'sequence-required', entity);\n return [];\n }\n\n const paths: IRepositoryPath[] = [];\n const seen = new Set<string>();\n\n node.items.forEach((item, index) => {\n const itemPointer = childPointer(pointer, String(index));\n\n if (item.kind !== 'scalar' || typeof item.value !== 'string') {\n addInvalidValue(context, itemPointer, item.range, 'string-required', entity);\n return;\n }\n\n const path = parseManifestPath(item.value);\n const valid =\n path !== null &&\n (kind === 'context'\n ? isContextPath(path, false)\n : kind === 'decision'\n ? isDecisionPath(path)\n : isMirrorPath(path));\n\n if (!valid || path === null) {\n const code =\n kind === 'context'\n ? 'MOLDEA_CONTEXT_PATH_INVALID'\n : kind === 'decision'\n ? 'MOLDEA_DECISION_FILENAME_INVALID'\n : path !== null && !isMirrorPath(path)\n ? 'MOLDEA_MIRROR_PATH_INSIDE_MOLDEA'\n : 'MOLDEA_MIRROR_PATH_INVALID';\n context.diagnostics.add({\n code,\n entity,\n path: context.path,\n pointer: itemPointer,\n range: item.range,\n });\n return;\n }\n\n if (seen.has(path)) {\n context.diagnostics.add({\n code: kind === 'mirror' ? 'MOLDEA_MIRROR_PATH_DUPLICATE' : 'MOLDEA_PATH_DUPLICATE',\n entity,\n path: context.path,\n pointer: itemPointer,\n range: item.range,\n });\n return;\n }\n\n if (kind === 'mirror' && context.mirrorPaths.has(path)) {\n context.diagnostics.add({\n code: 'MOLDEA_MIRROR_PATH_DUPLICATE',\n entity,\n path: context.path,\n pointer: itemPointer,\n range: item.range,\n });\n return;\n }\n\n seen.add(path);\n if (kind === 'mirror') {\n context.mirrorPaths.add(path);\n }\n paths.push(path);\n });\n\n return paths.sort(compareExactStrings);\n};\n\nconst readRuntime = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId: string,\n): IRuntimeManifestEntry | null => {\n const entity = { agentId };\n const entries = readMapping(node, pointer, new Set(['guidance', 'id']), context, entity);\n\n if (entries === null) {\n return null;\n }\n\n const idEntry = entries.get('id');\n\n if (idEntry?.value.kind !== 'scalar' || typeof idEntry.value.value !== 'string') {\n context.diagnostics.add({\n code: 'MOLDEA_RUNTIME_ID_INVALID',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'id'),\n range: idEntry?.value.range ?? null,\n });\n return null;\n }\n\n const id = idEntry.value.value;\n\n if (\n !isStableId(id) ||\n isReservedId(id) ||\n !(RECOGNIZED_RUNTIME_IDS as readonly string[]).includes(id)\n ) {\n context.diagnostics.add({\n code: 'MOLDEA_RUNTIME_ID_INVALID',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'id'),\n range: idEntry.value.range,\n });\n }\n\n const guidanceEntry = entries.get('guidance');\n let guidance: IRepositoryPath | null = null;\n\n if (guidanceEntry !== undefined) {\n if (guidanceEntry.value.kind === 'scalar' && typeof guidanceEntry.value.value === 'string') {\n const candidate = parseManifestPath(guidanceEntry.value.value);\n\n if (candidate !== null && isRuntimeGuidancePath(candidate)) {\n guidance = candidate;\n } else {\n context.diagnostics.add({\n code: 'MOLDEA_PATH_INVALID',\n details: { reason: 'runtime-guidance' },\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'guidance'),\n range: guidanceEntry.value.range,\n });\n }\n } else {\n context.diagnostics.add({\n code: 'MOLDEA_PATH_INVALID',\n details: { reason: 'runtime-guidance' },\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'guidance'),\n range: guidanceEntry.value.range,\n });\n }\n }\n\n return { id, ...(guidance === null ? {} : { guidance }) };\n};\n\nconst readVariables = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId: string,\n): Readonly<Record<string, IRuntimeVariableManifestEntry>> | null => {\n const entries = readMapping(node, pointer, null, context, { agentId });\n\n if (entries === null) {\n return null;\n }\n\n const normalized: Array<readonly [string, IRuntimeVariableManifestEntry]> = [];\n\n for (const [variableId, entry] of [...entries].sort(([left], [right]) =>\n compareExactStrings(left, right),\n )) {\n const entity = { agentId, variableId };\n\n if (!isVariableId(variableId)) {\n context.diagnostics.add({\n code: 'MOLDEA_VARIABLE_ID_INVALID',\n entity,\n path: context.path,\n pointer: childPointer(pointer, variableId),\n range: entry.key.range,\n });\n }\n\n const variablePointer = childPointer(pointer, variableId);\n const variableEntries = readMapping(\n entry.value,\n variablePointer,\n new Set(['description']),\n context,\n entity,\n );\n\n if (variableEntries === null) {\n continue;\n }\n\n const description = readString(\n variableEntries.get('description'),\n childPointer(variablePointer, 'description'),\n context,\n { entity, required: true },\n );\n\n if (description !== null) {\n normalized.push([variableId, { description }]);\n }\n }\n\n return createNullPrototypeRecord(normalized);\n};\n\nconst readBindings = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId: string,\n declaredVariables: ReadonlySet<string>,\n): IAgentBindingsManifestEntry | null => {\n const entity = { agentId };\n const entries = readMapping(\n node,\n pointer,\n new Set([\n 'inputSchema',\n 'instructionLoader',\n 'outputSchema',\n 'runtimeAgent',\n 'variableProviders',\n ]),\n context,\n entity,\n );\n\n if (entries === null) {\n return null;\n }\n\n const referenceProperty = (\n key: 'inputSchema' | 'instructionLoader' | 'outputSchema' | 'runtimeAgent',\n ) => {\n const entry = entries.get(key);\n return entry === undefined\n ? null\n : readReference(entry.value, childPointer(pointer, key), context, entity);\n };\n const inputSchema = referenceProperty('inputSchema');\n const instructionLoader = referenceProperty('instructionLoader');\n const outputSchema = referenceProperty('outputSchema');\n const runtimeAgent = referenceProperty('runtimeAgent');\n const providersEntry = entries.get('variableProviders');\n let variableProviders: Readonly<Record<string, IRepositoryReference>> | null = null;\n\n if (providersEntry !== undefined) {\n const providers = readMapping(\n providersEntry.value,\n childPointer(pointer, 'variableProviders'),\n null,\n context,\n entity,\n );\n\n if (providers !== null) {\n const normalized: Array<readonly [string, IRepositoryReference]> = [];\n\n for (const [variableId, providerEntry] of [...providers].sort(([left], [right]) =>\n compareExactStrings(left, right),\n )) {\n const variableEntity = { agentId, variableId };\n const providerPointer = childPointer(\n childPointer(pointer, 'variableProviders'),\n variableId,\n );\n\n if (!isVariableId(variableId)) {\n context.diagnostics.add({\n code: 'MOLDEA_VARIABLE_ID_INVALID',\n entity: variableEntity,\n path: context.path,\n pointer: providerPointer,\n range: providerEntry.key.range,\n });\n } else if (!declaredVariables.has(variableId)) {\n context.diagnostics.add({\n code: 'MOLDEA_VARIABLE_PROVIDER_UNDECLARED',\n entity: variableEntity,\n path: context.path,\n pointer: providerPointer,\n range: providerEntry.key.range,\n });\n }\n\n const reference = readReference(\n providerEntry.value,\n providerPointer,\n context,\n variableEntity,\n );\n\n if (reference !== null) {\n normalized.push([variableId, reference]);\n }\n }\n\n variableProviders = createNullPrototypeRecord(normalized);\n }\n }\n\n return {\n ...(runtimeAgent === null ? {} : { runtimeAgent }),\n ...(inputSchema === null ? {} : { inputSchema }),\n ...(outputSchema === null ? {} : { outputSchema }),\n ...(instructionLoader === null ? {} : { instructionLoader }),\n ...(variableProviders === null ? {} : { variableProviders }),\n };\n};\n\nconst readCapability = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId: string,\n capabilityId: string,\n kind: 'tool' | 'skill',\n): IToolManifestEntry | ISkillManifestEntry | null => {\n const entity = { agentId, capabilityId, capabilityKind: kind } as const;\n const allowed =\n kind === 'tool'\n ? new Set([\n 'affectedBy',\n 'description',\n 'implementation',\n 'inputSchema',\n 'name',\n 'outputSchema',\n 'registration',\n ])\n : new Set(['affectedBy', 'description', 'implementation', 'name', 'registration']);\n const entries = readMapping(node, pointer, allowed, context, entity);\n\n if (entries === null) {\n return null;\n }\n\n const name = readString(entries.get('name'), childPointer(pointer, 'name'), context, {\n entity,\n required: true,\n singleLine: true,\n });\n const descriptionEntry = entries.get('description');\n let description: string | null = null;\n\n if (descriptionEntry === undefined) {\n context.diagnostics.add({\n code: 'MOLDEA_CAPABILITY_DESCRIPTION_MISSING',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'description'),\n });\n } else if (\n descriptionEntry.value.kind !== 'scalar' ||\n typeof descriptionEntry.value.value !== 'string' ||\n !isCapabilityDescription(descriptionEntry.value.value)\n ) {\n context.diagnostics.add({\n code: 'MOLDEA_CAPABILITY_DESCRIPTION_INVALID',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'description'),\n range: descriptionEntry.value.range,\n });\n } else {\n description = descriptionEntry.value.value;\n }\n\n const implementationEntry = entries.get('implementation');\n let implementation: IRepositoryReference | null = null;\n\n if (implementationEntry === undefined) {\n context.diagnostics.add({\n code:\n kind === 'tool'\n ? 'MOLDEA_TOOL_IMPLEMENTATION_MISSING'\n : 'MOLDEA_SKILL_IMPLEMENTATION_MISSING',\n entity,\n path: context.path,\n pointer: childPointer(pointer, 'implementation'),\n });\n } else {\n implementation = readReference(\n implementationEntry.value,\n childPointer(pointer, 'implementation'),\n context,\n entity,\n );\n }\n\n const optionalReference = (key: 'inputSchema' | 'outputSchema' | 'registration') => {\n const entry = entries.get(key);\n return entry === undefined\n ? null\n : readReference(entry.value, childPointer(pointer, key), context, entity);\n };\n const registration = optionalReference('registration');\n const inputSchema = kind === 'tool' ? optionalReference('inputSchema') : null;\n const outputSchema = kind === 'tool' ? optionalReference('outputSchema') : null;\n const affectedByEntry = entries.get('affectedBy');\n const affectedBy =\n affectedByEntry === undefined\n ? null\n : readAffectedBy(affectedByEntry.value, childPointer(pointer, 'affectedBy'), context, entity);\n\n if (name === null || description === null || implementation === null) {\n return null;\n }\n\n return {\n name,\n description,\n implementation,\n ...(registration === null ? {} : { registration }),\n ...(inputSchema === null ? {} : { inputSchema }),\n ...(outputSchema === null ? {} : { outputSchema }),\n ...(affectedBy === null ? {} : { affectedBy }),\n };\n};\n\nconst readCapabilities = <Value extends IToolManifestEntry | ISkillManifestEntry>(\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId: string,\n kind: 'tool' | 'skill',\n): Readonly<Record<string, Value>> | null => {\n const entries = readMapping(node, pointer, null, context, { agentId });\n\n if (entries === null) {\n return null;\n }\n\n const normalized: Array<readonly [string, Value]> = [];\n\n for (const [capabilityId, entry] of [...entries].sort(([left], [right]) =>\n compareExactStrings(left, right),\n )) {\n const entity = { agentId, capabilityId, capabilityKind: kind } as const;\n const capabilityPointer = childPointer(pointer, capabilityId);\n validateStableId(capabilityId, entry.key.range, capabilityPointer, context, entity);\n const capability = readCapability(\n entry.value,\n capabilityPointer,\n context,\n agentId,\n capabilityId,\n kind,\n );\n\n if (capability !== null) {\n normalized.push([capabilityId, capability as Value]);\n }\n }\n\n return createNullPrototypeRecord(normalized);\n};\n\nconst readUnresolved = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId?: string,\n): Readonly<Record<string, IUnresolvedRequirementManifestEntry>> | null => {\n const entries = readMapping(\n node,\n pointer,\n null,\n context,\n agentId === undefined ? null : { agentId },\n );\n\n if (entries === null) {\n return null;\n }\n\n const normalized: Array<readonly [string, IUnresolvedRequirementManifestEntry]> = [];\n\n for (const [requirementId, entry] of [...entries].sort(([left], [right]) =>\n compareExactStrings(left, right),\n )) {\n const entity = agentId === undefined ? null : { agentId };\n const requirementPointer = childPointer(pointer, requirementId);\n validateStableId(requirementId, entry.key.range, requirementPointer, context, entity);\n const requirementEntries = readMapping(\n entry.value,\n requirementPointer,\n new Set(['category', 'description', 'effect', 'reference', 'related', 'resolution']),\n context,\n entity,\n );\n\n if (requirementEntries === null) {\n continue;\n }\n\n const category = readString(\n requirementEntries.get('category'),\n childPointer(requirementPointer, 'category'),\n context,\n { ...(entity === null ? {} : { entity }), required: true },\n );\n\n if (category !== null && !isStableId(category)) {\n context.diagnostics.add({\n code: 'MOLDEA_ID_INVALID',\n entity,\n path: context.path,\n pointer: childPointer(requirementPointer, 'category'),\n range: requirementEntries.get('category')?.value.range ?? null,\n });\n }\n\n const effectEntry = requirementEntries.get('effect');\n let effect: IUnresolvedRequirementEffect | null = null;\n\n if (\n effectEntry?.value.kind === 'scalar' &&\n (effectEntry.value.value === 'blocking' ||\n effectEntry.value.value === 'warning' ||\n effectEntry.value.value === 'informational')\n ) {\n effect = effectEntry.value.value;\n } else {\n addInvalidValue(\n context,\n childPointer(requirementPointer, 'effect'),\n effectEntry?.value.range ?? null,\n effectEntry === undefined ? 'required' : 'enum',\n entity,\n );\n }\n\n const description = readString(\n requirementEntries.get('description'),\n childPointer(requirementPointer, 'description'),\n context,\n { ...(entity === null ? {} : { entity }), required: true },\n );\n const resolution = readString(\n requirementEntries.get('resolution'),\n childPointer(requirementPointer, 'resolution'),\n context,\n { ...(entity === null ? {} : { entity }), required: true },\n );\n const relatedEntry = requirementEntries.get('related');\n const related =\n relatedEntry === undefined\n ? null\n : readReferenceList(\n relatedEntry.value,\n childPointer(requirementPointer, 'related'),\n context,\n entity,\n );\n const reference = readString(\n requirementEntries.get('reference'),\n childPointer(requirementPointer, 'reference'),\n context,\n { ...(entity === null ? {} : { entity }), singleLine: true },\n );\n\n if (category !== null && effect !== null && description !== null && resolution !== null) {\n normalized.push([\n requirementId,\n {\n category,\n effect,\n description,\n resolution,\n ...(related === null ? {} : { related }),\n ...(reference === null ? {} : { reference }),\n },\n ]);\n }\n }\n\n return createNullPrototypeRecord(normalized);\n};\n\nconst findMappingProperty = (node: IYamlNode, property: string): IYamlNode | null => {\n if (node.kind !== 'mapping') {\n return null;\n }\n\n for (const entry of node.entries) {\n if (entry.key.kind === 'scalar' && entry.key.value === property) {\n return entry.value;\n }\n }\n\n return null;\n};\n\n/**\n * Detects a supported repository-format version without treating the remaining manifest as valid.\n * @param node The trustworthy strict-YAML manifest root.\n * @returns The supported parsed version when its declaration is independently unambiguous.\n */\nexport const detectSupportedManifestVersion = (\n node: IYamlNode,\n): IRepositoryFormatVersion | null => {\n if (node.kind !== 'mapping') {\n return null;\n }\n\n const versionNode = findMappingProperty(node, 'version');\n\n return versionNode?.kind === 'scalar' && versionNode.value === 1n ? 1 : null;\n};\n\nconst validateAgentOwnedIdUniqueness = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId: string,\n): void => {\n const seen = new Set<string>();\n\n for (const property of ['tools', 'skills', 'unresolved']) {\n const record = findMappingProperty(node, property);\n\n if (record?.kind !== 'mapping') {\n continue;\n }\n\n for (const entry of record.entries) {\n if (entry.key.kind !== 'scalar' || typeof entry.key.value !== 'string') {\n continue;\n }\n\n if (seen.has(entry.key.value)) {\n context.diagnostics.add({\n code: 'MOLDEA_ID_DUPLICATE',\n entity: { agentId },\n path: context.path,\n pointer: childPointer(childPointer(pointer, property), entry.key.value),\n range: entry.key.range,\n });\n }\n\n seen.add(entry.key.value);\n }\n }\n};\n\nconst readAgent = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n agentId: string,\n): IAgentManifestEntry | null => {\n const entity = { agentId };\n const entries = readMapping(\n node,\n pointer,\n new Set([\n 'affectedBy',\n 'bindings',\n 'context',\n 'decisions',\n 'runtime',\n 'mirrors',\n 'skills',\n 'tools',\n 'unresolved',\n 'variables',\n ]),\n context,\n entity,\n );\n\n if (entries === null) {\n return null;\n }\n\n validateAgentOwnedIdUniqueness(node, pointer, context, agentId);\n const runtimeEntry = entries.get('runtime');\n let runtime: IRuntimeManifestEntry | null = null;\n\n if (runtimeEntry === undefined) {\n addInvalidValue(context, childPointer(pointer, 'runtime'), null, 'required', entity);\n } else {\n runtime = readRuntime(runtimeEntry.value, childPointer(pointer, 'runtime'), context, agentId);\n }\n\n const variablesEntry = entries.get('variables');\n const variables =\n variablesEntry === undefined\n ? null\n : readVariables(variablesEntry.value, childPointer(pointer, 'variables'), context, agentId);\n const declaredVariables = new Set(Object.keys(variables ?? {}));\n const bindingsEntry = entries.get('bindings');\n const bindings =\n bindingsEntry === undefined\n ? null\n : readBindings(\n bindingsEntry.value,\n childPointer(pointer, 'bindings'),\n context,\n agentId,\n declaredVariables,\n );\n const contextEntry = entries.get('context');\n const contextPaths =\n contextEntry === undefined\n ? null\n : readPathList(\n contextEntry.value,\n childPointer(pointer, 'context'),\n 'context',\n context,\n entity,\n );\n const decisionsEntry = entries.get('decisions');\n const decisions =\n decisionsEntry === undefined\n ? null\n : readPathList(\n decisionsEntry.value,\n childPointer(pointer, 'decisions'),\n 'decision',\n context,\n entity,\n );\n const toolsEntry = entries.get('tools');\n const tools =\n toolsEntry === undefined\n ? null\n : readCapabilities<IToolManifestEntry>(\n toolsEntry.value,\n childPointer(pointer, 'tools'),\n context,\n agentId,\n 'tool',\n );\n const skillsEntry = entries.get('skills');\n const skills =\n skillsEntry === undefined\n ? null\n : readCapabilities<ISkillManifestEntry>(\n skillsEntry.value,\n childPointer(pointer, 'skills'),\n context,\n agentId,\n 'skill',\n );\n const affectedByEntry = entries.get('affectedBy');\n const affectedBy =\n affectedByEntry === undefined\n ? null\n : readAffectedBy(affectedByEntry.value, childPointer(pointer, 'affectedBy'), context, entity);\n const mirrorsEntry = entries.get('mirrors');\n const mirrors =\n mirrorsEntry === undefined\n ? null\n : readPathList(\n mirrorsEntry.value,\n childPointer(pointer, 'mirrors'),\n 'mirror',\n context,\n entity,\n );\n const unresolvedEntry = entries.get('unresolved');\n const unresolved =\n unresolvedEntry === undefined\n ? null\n : readUnresolved(\n unresolvedEntry.value,\n childPointer(pointer, 'unresolved'),\n context,\n agentId,\n );\n\n if (runtime === null) {\n return null;\n }\n\n return {\n runtime,\n ...(contextPaths === null ? {} : { context: contextPaths }),\n ...(decisions === null ? {} : { decisions }),\n ...(variables === null ? {} : { variables }),\n ...(bindings === null ? {} : { bindings }),\n ...(tools === null ? {} : { tools }),\n ...(skills === null ? {} : { skills }),\n ...(affectedBy === null ? {} : { affectedBy }),\n ...(mirrors === null ? {} : { mirrors }),\n ...(unresolved === null ? {} : { unresolved }),\n };\n};\n\nconst readAgents = (\n node: IYamlNode,\n pointer: string,\n context: IManifestValidationContext,\n): Readonly<Record<string, IAgentManifestEntry>> | null => {\n const entries = readMapping(node, pointer, null, context);\n\n if (entries === null) {\n return null;\n }\n\n const normalized: Array<readonly [string, IAgentManifestEntry]> = [];\n\n for (const [agentId, entry] of [...entries].sort(([left], [right]) =>\n compareExactStrings(left, right),\n )) {\n const agentPointer = childPointer(pointer, agentId);\n validateStableId(agentId, entry.key.range, agentPointer, context, { agentId });\n const agent = readAgent(entry.value, agentPointer, context, agentId);\n\n if (agent !== null) {\n normalized.push([agentId, agent]);\n }\n }\n\n return createNullPrototypeRecord(normalized);\n};\n\n/**\n * Validates the closed warning-acceptance contract with field-specific diagnostics.\n * @returns Valid acceptance entries; diagnostics invalidate the complete manifest on any bad entry.\n * @throws\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nconst readAcceptedWarnings = (\n node: IYamlNode,\n context: IManifestValidationContext,\n): IAcceptedWarningManifestEntry[] | null => {\n const report = (\n entry: number | null,\n field: string,\n range: ISourceRange,\n reason: string,\n ): void => {\n context.diagnostics.add({\n code: 'MOLDEA_MANIFEST_VALUE_INVALID',\n path: context.path,\n pointer:\n entry === null\n ? '/acceptedWarnings'\n : `/acceptedWarnings/${entry}/${escapeJsonPointerSegment(field)}`,\n range,\n details: { entry, field, reason },\n });\n };\n if (node.kind !== 'sequence') {\n report(null, 'acceptedWarnings', node.range, 'sequence-required');\n return null;\n }\n if (node.items.length > context.limits.maxAcceptedWarnings)\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n operation: context.operation,\n limit: 'maxAcceptedWarnings',\n limitMaximum: context.limits.maxAcceptedWarnings,\n observedUsage: node.items.length,\n nextAction: 'reduce-input-or-increase-limit',\n });\n const accepted: IAcceptedWarningManifestEntry[] = [];\n const identities = new Set<string>();\n for (const [index, item] of node.items.entries()) {\n if (item.kind !== 'mapping') {\n report(index, 'entry', item.range, 'mapping-required');\n continue;\n }\n const fields = new Map<string, IYamlNode>();\n let isValid = true;\n for (const entry of item.entries) {\n if (\n entry.key.kind !== 'scalar' ||\n typeof entry.key.value !== 'string' ||\n !['code', 'subject', 'qualifier', 'reason'].includes(entry.key.value)\n ) {\n report(\n index,\n entry.key.kind === 'scalar' && typeof entry.key.value === 'string'\n ? entry.key.value\n : 'key',\n entry.key.range,\n 'unknown-field',\n );\n isValid = false;\n } else fields.set(entry.key.value, entry.value);\n }\n const scalar = (field: string): string | null => {\n const value = fields.get(field);\n if (\n value?.kind !== 'scalar' ||\n typeof value.value !== 'string' ||\n !hasNonWhitespace(value.value)\n ) {\n report(\n index,\n field,\n value?.range ?? item.range,\n value === undefined ? 'required' : 'non-empty-string-required',\n );\n isValid = false;\n return null;\n }\n return value.value;\n };\n const code = scalar('code');\n const subjectText = scalar('subject');\n const reason = scalar('reason');\n const subject = subjectText === null ? null : parseManifestPath(subjectText);\n const qualifierNode = fields.get('qualifier');\n let qualifier: string | null = null;\n if (\n qualifierNode !== undefined &&\n !(qualifierNode.kind === 'scalar' && qualifierNode.value === null)\n ) {\n qualifier = scalar('qualifier');\n if (qualifier !== null && !isNonEmptySingleLine(qualifier)) {\n report(index, 'qualifier', qualifierNode.range, 'single-line-required');\n isValid = false;\n }\n }\n const acceptedCode = ACCEPTABLE_WARNING_CODES.find((candidate) => candidate === code);\n if (code !== null && acceptedCode === undefined) {\n report(index, 'code', fields.get('code')!.range, 'code-not-acceptable');\n isValid = false;\n }\n if (subjectText !== null && subject === null) {\n report(index, 'subject', fields.get('subject')!.range, 'repository-path-required');\n isValid = false;\n }\n if (reason !== null && countUnicodeScalars(reason) > 256) {\n report(index, 'reason', fields.get('reason')!.range, 'maximum-256-characters');\n isValid = false;\n }\n if (!isValid || acceptedCode === undefined || subject === null || reason === null) continue;\n const identity = JSON.stringify([acceptedCode, subject, qualifier]);\n if (identities.has(identity)) {\n report(index, 'code', fields.get('code')!.range, 'duplicate-identity');\n continue;\n }\n identities.add(identity);\n accepted.push({\n code: acceptedCode,\n subject,\n ...(qualifierNode === undefined ? {} : { qualifier }),\n reason,\n });\n }\n return accepted;\n};\n\n/**\n * Validates and normalizes a strict YAML document as a version 1 moldea manifest.\n * @param node The parser-neutral YAML root node.\n * @param path The canonical or caller-supplied logical manifest path.\n * @param diagnostics The operation diagnostic collector.\n * @param limits The immutable operation limits, including the acceptance-list bound.\n * @param operation The public operation receiving resource failures.\n * @returns The normalized manifest when its supported version can be interpreted.\n * @throws\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const validateManifest = (\n node: IYamlNode,\n path: IRepositoryPath,\n diagnostics: ICoreDiagnosticCollector,\n limits: ICoreResourceLimits,\n operation: ICoreOperation,\n): IMoldeaManifestV1 | null => {\n const context: IManifestValidationContext = {\n diagnostics,\n operation,\n limits,\n mirrorPaths: new Set(),\n path,\n };\n\n if (node.kind !== 'mapping') {\n diagnostics.add({ code: 'MOLDEA_MANIFEST_ROOT_INVALID', path, range: node.range });\n return null;\n }\n\n const versionNode = findMappingProperty(node, 'version');\n\n if (versionNode === null) {\n diagnostics.add({ code: 'MOLDEA_MANIFEST_VERSION_MISSING', path, pointer: '/version' });\n return null;\n }\n\n const isIntegerSyntax = versionNode.kind === 'scalar' && typeof versionNode.value === 'bigint';\n\n if (!isIntegerSyntax || versionNode.kind !== 'scalar' || versionNode.value <= 0n) {\n diagnostics.add({\n code: 'MOLDEA_MANIFEST_VERSION_INVALID',\n path,\n pointer: '/version',\n range: versionNode.range,\n });\n return null;\n }\n\n if (versionNode.value !== 1n) {\n diagnostics.add({\n code: 'MOLDEA_MANIFEST_VERSION_UNSUPPORTED',\n path,\n pointer: '/version',\n range: versionNode.range,\n });\n return null;\n }\n\n const entries = readMapping(\n node,\n '',\n new Set(['acceptedWarnings', 'agents', 'context', 'decisions', 'unresolved', 'version']),\n context,\n );\n\n if (entries === null) {\n return null;\n }\n\n const acceptedWarningsEntry = entries.get('acceptedWarnings');\n const acceptedWarnings =\n acceptedWarningsEntry === undefined\n ? null\n : readAcceptedWarnings(acceptedWarningsEntry.value, context);\n const contextEntry = entries.get('context');\n const contextRelationships =\n contextEntry === undefined\n ? null\n : readRelationshipRecord(contextEntry.value, '/context', 'context', context);\n const decisionsEntry = entries.get('decisions');\n const decisionRelationships =\n decisionsEntry === undefined\n ? null\n : readRelationshipRecord(decisionsEntry.value, '/decisions', 'decision', context);\n const unresolvedEntry = entries.get('unresolved');\n const unresolved =\n unresolvedEntry === undefined\n ? null\n : readUnresolved(unresolvedEntry.value, '/unresolved', context);\n const agentsEntry = entries.get('agents');\n const agents =\n agentsEntry === undefined ? null : readAgents(agentsEntry.value, '/agents', context);\n\n return {\n version: 1,\n ...(acceptedWarnings === null ? {} : { acceptedWarnings }),\n ...(contextRelationships === null ? {} : { context: contextRelationships }),\n ...(decisionRelationships === null ? {} : { decisions: decisionRelationships }),\n ...(unresolved === null ? {} : { unresolved }),\n ...(agents === null ? {} : { agents }),\n };\n};\n","import type { ISourcePosition, ISourceRange } from '../diagnostics/index.js';\n\n// scalar-aware normalized source lookup used by parsers and diagnostics\nexport interface ISourceLocator {\n locateRange(startOffset: number, endOffset: number): ISourceRange;\n}\n\nconst findLineIndex = (lineStarts: readonly number[], offset: number): number => {\n let lower = 0;\n let upper = lineStarts.length - 1;\n\n while (lower < upper) {\n const middle = Math.ceil((lower + upper) / 2);\n\n if ((lineStarts[middle] ?? 0) <= offset) {\n lower = middle;\n } else {\n upper = middle - 1;\n }\n }\n\n return lower;\n};\n\n/**\n * Creates an efficient UTF-16-offset to Unicode-scalar source locator.\n * @param value The already-normalized valid Unicode scalar text.\n * @returns A locator producing one-based lines and columns with zero-based scalar offsets.\n */\nexport const createSourceLocator = (value: string): ISourceLocator => {\n const scalarOffsets = new Uint32Array(value.length + 1);\n const lineStarts = [0];\n let scalarOffset = 0;\n\n for (let codeUnitOffset = 0; codeUnitOffset < value.length;) {\n const codePoint = value.codePointAt(codeUnitOffset);\n const width = codePoint !== undefined && codePoint > 0xffff ? 2 : 1;\n\n scalarOffsets[codeUnitOffset] = scalarOffset;\n\n for (let interiorOffset = 1; interiorOffset < width; interiorOffset += 1) {\n scalarOffsets[codeUnitOffset + interiorOffset] = scalarOffset;\n }\n\n codeUnitOffset += width;\n scalarOffset += 1;\n scalarOffsets[codeUnitOffset] = scalarOffset;\n\n if (codePoint === 0x0a) {\n lineStarts.push(codeUnitOffset);\n }\n }\n\n const locatePosition = (candidateOffset: number): ISourcePosition => {\n const codeUnitOffset = Math.max(0, Math.min(value.length, candidateOffset));\n const lineIndex = findLineIndex(lineStarts, codeUnitOffset);\n const lineStart = lineStarts[lineIndex] ?? 0;\n const positionScalarOffset = scalarOffsets[codeUnitOffset] ?? 0;\n const lineStartScalarOffset = scalarOffsets[lineStart] ?? 0;\n\n return {\n column: positionScalarOffset - lineStartScalarOffset + 1,\n line: lineIndex + 1,\n offset: positionScalarOffset,\n };\n };\n\n return Object.freeze({\n locateRange: (startOffset: number, endOffset: number): ISourceRange => ({\n end: locatePosition(endOffset),\n start: locatePosition(startOffset),\n }),\n });\n};\n","import { Parser, isAlias, isMap, isScalar, isSeq, parseAllDocuments, type ParsedNode } from 'yaml';\n\nimport type { IRepositoryPath } from '@moldea.ai/repository';\n\nimport type { ICoreDiagnosticCollector } from '../diagnostic-utilities/index.js';\nimport type { ISourceRange } from '../diagnostics/index.js';\nimport type { ISourceLocator } from '../source-location/index.js';\n\n// parser-neutral YAML nodes retained only inside Core\nexport type IYamlNode = IYamlMappingNode | IYamlSequenceNode | IYamlScalarNode;\n\nexport interface IYamlMappingEntry {\n readonly key: IYamlNode;\n readonly value: IYamlNode;\n}\n\nexport interface IYamlMappingNode {\n readonly kind: 'mapping';\n readonly entries: readonly IYamlMappingEntry[];\n readonly range: ISourceRange;\n}\n\nexport interface IYamlSequenceNode {\n readonly kind: 'sequence';\n readonly items: readonly IYamlNode[];\n readonly range: ISourceRange;\n}\n\nexport interface IYamlScalarNode {\n readonly kind: 'scalar';\n readonly range: ISourceRange;\n readonly source: string;\n readonly style: string | null;\n readonly value: string | number | bigint | boolean | null;\n}\n\nexport interface IStrictYamlParseResult {\n readonly valid: boolean;\n readonly value: IYamlNode | null;\n}\n\nconst CORE_TAGS = new Set([\n 'tag:yaml.org,2002:bool',\n 'tag:yaml.org,2002:float',\n 'tag:yaml.org,2002:int',\n 'tag:yaml.org,2002:map',\n 'tag:yaml.org,2002:null',\n 'tag:yaml.org,2002:seq',\n 'tag:yaml.org,2002:str',\n]);\n\nconst toRange = (\n range: readonly [number, number, number] | null | undefined,\n locator: ISourceLocator,\n): ISourceRange => {\n return locator.locateRange(range?.[0] ?? 0, range?.[1] ?? range?.[0] ?? 0);\n};\n\nconst addUnsupportedFeature = (\n diagnostics: ICoreDiagnosticCollector,\n path: IRepositoryPath,\n range: ISourceRange,\n reason: string,\n): void => {\n diagnostics.add({\n code: 'MOLDEA_YAML_FEATURE_UNSUPPORTED',\n details: { reason },\n path,\n range,\n });\n};\n\nconst isUnicodeScalarString = (value: string): boolean => {\n for (let index = 0; index < value.length; index += 1) {\n const codeUnit = value.charCodeAt(index);\n\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n const nextCodeUnit = value.charCodeAt(index + 1);\n\n if (!(nextCodeUnit >= 0xdc00 && nextCodeUnit <= 0xdfff)) {\n return false;\n }\n\n index += 1;\n } else if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n return false;\n }\n }\n\n return true;\n};\n\nconst isCoreTagCompatible = (node: ParsedNode): boolean => {\n switch (node.tag) {\n case 'tag:yaml.org,2002:bool':\n return isScalar(node) && typeof node.value === 'boolean';\n case 'tag:yaml.org,2002:float':\n return isScalar(node) && typeof node.value === 'number';\n case 'tag:yaml.org,2002:int':\n return isScalar(node) && typeof node.value === 'bigint';\n case 'tag:yaml.org,2002:map':\n return isMap(node);\n case 'tag:yaml.org,2002:null':\n return isScalar(node) && node.value === null;\n case 'tag:yaml.org,2002:seq':\n return isSeq(node);\n case 'tag:yaml.org,2002:str':\n return isScalar(node) && typeof node.value === 'string';\n default:\n return false;\n }\n};\n\nconst convertNode = (\n node: ParsedNode,\n path: IRepositoryPath,\n locator: ISourceLocator,\n diagnostics: ICoreDiagnosticCollector,\n): IYamlNode | null => {\n const range = toRange(node.range, locator);\n\n if (isAlias(node)) {\n addUnsupportedFeature(diagnostics, path, range, 'alias');\n return null;\n }\n\n if ('anchor' in node && typeof node.anchor === 'string') {\n addUnsupportedFeature(diagnostics, path, range, 'anchor');\n }\n\n if (node.tag !== undefined) {\n if (!CORE_TAGS.has(node.tag)) {\n addUnsupportedFeature(diagnostics, path, range, 'custom-tag');\n return null;\n }\n\n if (!isCoreTagCompatible(node)) {\n diagnostics.add({\n code: 'MOLDEA_YAML_MALFORMED',\n details: { reason: 'tag-value' },\n path,\n range,\n });\n return null;\n }\n }\n\n if (isScalar(node)) {\n const value = node.value;\n\n if (\n value !== null &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'bigint' &&\n typeof value !== 'boolean'\n ) {\n diagnostics.add({\n code: 'MOLDEA_YAML_MALFORMED',\n details: { reason: 'scalar-type' },\n path,\n range,\n });\n return null;\n }\n\n if (typeof value === 'string' && !isUnicodeScalarString(value)) {\n diagnostics.add({\n code: 'MOLDEA_YAML_MALFORMED',\n details: { reason: 'invalid-unicode' },\n path,\n range,\n });\n return null;\n }\n\n return {\n kind: 'scalar',\n range,\n source: node.source,\n style: node.type ?? null,\n value,\n };\n }\n\n if (isSeq(node)) {\n const items: IYamlNode[] = [];\n\n for (const item of node.items) {\n if (item === null) {\n items.push({ kind: 'scalar', range, source: '', style: null, value: null });\n continue;\n }\n\n const converted = convertNode(item, path, locator, diagnostics);\n\n if (converted !== null) {\n items.push(converted);\n }\n }\n\n return { items, kind: 'sequence', range };\n }\n\n if (isMap(node)) {\n const entries: IYamlMappingEntry[] = [];\n\n for (const pair of node.items) {\n const key = convertNode(pair.key, path, locator, diagnostics);\n const value =\n pair.value === null\n ? ({\n kind: 'scalar',\n range: key?.range ?? range,\n source: '',\n style: null,\n value: null,\n } satisfies IYamlScalarNode)\n : convertNode(pair.value, path, locator, diagnostics);\n\n if (key?.kind === 'scalar' && key.value === '<<' && key.style === 'PLAIN') {\n addUnsupportedFeature(diagnostics, path, key.range, 'merge-key');\n }\n\n if (key !== null && value !== null) {\n entries.push({ key, value });\n }\n }\n\n return { entries, kind: 'mapping', range };\n }\n\n diagnostics.add({\n code: 'MOLDEA_YAML_MALFORMED',\n details: { reason: 'node-type' },\n path,\n range,\n });\n return null;\n};\n\nconst addParserDiagnostic = (\n code: string,\n start: number,\n end: number,\n path: IRepositoryPath,\n locator: ISourceLocator,\n diagnostics: ICoreDiagnosticCollector,\n): void => {\n if (code === 'BAD_DIRECTIVE') {\n return;\n }\n\n if (code === 'DUPLICATE_KEY') {\n diagnostics.add({\n code: 'MOLDEA_YAML_DUPLICATE_KEY',\n path,\n range: locator.locateRange(start, end),\n });\n return;\n }\n\n if (code === 'TAG_RESOLVE_FAILED') {\n return;\n }\n\n diagnostics.add({\n code: 'MOLDEA_YAML_MALFORMED',\n details: { reason: code === 'RESOURCE_EXHAUSTION' ? 'resource-exhaustion' : 'syntax' },\n path,\n range: locator.locateRange(start, end),\n });\n};\n\n/**\n * Parses one normalized YAML 1.2 Core Schema document into parser-neutral nodes.\n * @param value The normalized manifest text.\n * @param path The logical source path used by diagnostics.\n * @param locator The scalar-aware source locator for the normalized text.\n * @param diagnostics The operation diagnostic collector.\n * @returns The private parsed tree only when the YAML substrate is trustworthy.\n */\nexport const parseStrictYaml = (\n value: string,\n path: IRepositoryPath,\n locator: ISourceLocator,\n diagnostics: ICoreDiagnosticCollector,\n): IStrictYamlParseResult => {\n const initialDiagnosticCount = diagnostics.size;\n\n for (const token of new Parser().parse(value)) {\n if (token.type === 'directive') {\n addUnsupportedFeature(\n diagnostics,\n path,\n locator.locateRange(token.offset, token.offset + token.source.length),\n 'directive',\n );\n }\n }\n\n const documents = parseAllDocuments(value, {\n intAsBigInt: true,\n keepSourceTokens: true,\n logLevel: 'silent',\n merge: false,\n prettyErrors: false,\n resolveKnownTags: false,\n schema: 'core',\n strict: true,\n uniqueKeys: true,\n version: '1.2',\n });\n\n if (documents.length > 1) {\n const secondDocument = documents[1];\n const range = secondDocument?.range;\n\n diagnostics.add({\n code: 'MOLDEA_YAML_MULTIPLE_DOCUMENTS',\n path,\n range: locator.locateRange(range?.[0] ?? 0, range?.[0] ?? 0),\n });\n }\n\n for (const document of documents) {\n for (const error of [...document.errors, ...document.warnings]) {\n addParserDiagnostic(error.code, error.pos[0], error.pos[1], path, locator, diagnostics);\n }\n }\n\n if (documents.length > 1 || diagnostics.size > initialDiagnosticCount) {\n return { valid: false, value: null };\n }\n\n const document = documents[0];\n\n if (document === undefined || document.contents === null) {\n return {\n valid: true,\n value: {\n kind: 'scalar',\n range: locator.locateRange(0, 0),\n source: '',\n style: null,\n value: null,\n },\n };\n }\n\n const parsedValue = convertNode(document.contents, path, locator, diagnostics);\n\n return {\n valid: parsedValue !== null && diagnostics.size === initialDiagnosticCount,\n value: diagnostics.size === initialDiagnosticCount ? parsedValue : null,\n };\n};\n","import { parseRepositoryPath } from '@moldea.ai/repository';\n\nimport { createCoreOperationOptionsSnapshot, type ICoreOptionsSnapshot } from '../options/index.js';\nimport type {\n IIndexedTextAsset,\n IManifestParseResult,\n ITextDocumentInput,\n} from '../contracts/index.js';\nimport { createCoreDiagnosticCollector } from '../diagnostic-utilities/index.js';\nimport type { ICoreOperation } from '../exceptions/index.js';\nimport { isCanonicalManifestPath } from '../format-validation/index.js';\nimport { freezeRecursively } from '../immutable/index.js';\nimport { detectSupportedManifestVersion, validateManifest } from '../manifest-validation/index.js';\nimport { createSourceLocator } from '../source-location/index.js';\nimport { calculateNormalizedTextDigest, normalizeTextDocument } from '../text/index.js';\nimport { parseStrictYaml } from '../yaml/index.js';\n\n// richer manifest parse state retained only by repository inspection\nexport interface IManifestDocumentInspectionResult extends IManifestParseResult {\n readonly formatVersion: 1 | null;\n}\n\n/**\n * Inspects one complete manifest while retaining an independently trustworthy supported version.\n * @param input The canonical logical path and exact manifest text or bytes.\n * @param options The immutable Core limit snapshot.\n * @param operation The owning public or repository-level operation for typed failures.\n * @returns Frozen inspection state with all-or-nothing manifest assets and values.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const inspectManifestDocument = async (\n input: ITextDocumentInput,\n options: ICoreOptionsSnapshot,\n operation: Extract<\n ICoreOperation,\n 'parse-manifest' | 'match-manifest-scope' | 'validate-project'\n > = 'parse-manifest',\n): Promise<IManifestDocumentInspectionResult> => {\n options = createCoreOperationOptionsSnapshot(options);\n const normalized = normalizeTextDocument(input, options.limits, operation, 'maxManifestBytes');\n const path = parseRepositoryPath(input.path);\n const diagnostics = createCoreDiagnosticCollector(options.limits, operation);\n\n if (!isCanonicalManifestPath(path)) {\n diagnostics.add({ code: 'MOLDEA_MANIFEST_PATH_INVALID', path });\n }\n\n for (const diagnostic of normalized.diagnostics) {\n diagnostics.merge(diagnostic);\n }\n\n if (!normalized.valid || normalized.text === null) {\n return freezeRecursively({\n asset: null,\n diagnostics: diagnostics.finalize(),\n formatVersion: null,\n manifest: null,\n valid: false,\n });\n }\n\n const locator = createSourceLocator(normalized.text.value);\n const parsed = parseStrictYaml(normalized.text.value, path, locator, diagnostics);\n const formatVersion = parsed.value === null ? null : detectSupportedManifestVersion(parsed.value);\n const manifest =\n parsed.valid && parsed.value !== null\n ? validateManifest(parsed.value, path, diagnostics, options.limits, operation)\n : null;\n\n if (manifest === null || diagnostics.size > 0) {\n return freezeRecursively({\n asset: null,\n diagnostics: diagnostics.finalize(),\n formatVersion,\n manifest: null,\n valid: false,\n });\n }\n\n const digest = await calculateNormalizedTextDigest(normalized.text);\n const asset: IIndexedTextAsset = {\n content: normalized.text.value,\n digest,\n path,\n scalarLength: normalized.text.scalarLength,\n utf8ByteLength: normalized.text.utf8ByteLength,\n };\n\n return freezeRecursively({\n asset,\n diagnostics: diagnostics.finalize(),\n formatVersion,\n manifest,\n valid: true,\n });\n};\n\n/**\n * Parses and validates one complete version 1 manifest document.\n * @param input The canonical logical path and exact manifest text or bytes.\n * @param options The immutable Core limit snapshot.\n * @returns A frozen all-or-nothing manifest parse result.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const parseManifestDocument = async (\n input: ITextDocumentInput,\n options: ICoreOptionsSnapshot,\n operation: Extract<ICoreOperation, 'parse-manifest' | 'match-manifest-scope'> = 'parse-manifest',\n): Promise<IManifestParseResult> => {\n const inspection = await inspectManifestDocument(input, options, operation);\n\n return freezeRecursively({\n asset: inspection.asset,\n diagnostics: inspection.diagnostics,\n manifest: inspection.manifest,\n valid: inspection.valid,\n });\n};\n","import type { ICoreOptionsSnapshot } from '../options/index.js';\nimport { freezeRecursively } from '../immutable/index.js';\nimport { parseManifestDocument } from '../manifest/index.js';\n\nimport { calculateManifestScopeInputDigest, matchParsedManifestScope } from './matching.js';\nimport type { IManifestScopeInput, IManifestScopeResult } from './types.js';\nimport { normalizeManifestScopeInput } from './validations.js';\n\n/**\n * Parses a manifest and matches its repository relationships against changed logical paths.\n * @param input The canonical manifest document and untrusted changed-path collection.\n * @param options The immutable Core operation options.\n * @returns A promise resolving to frozen content-free scope metadata and matches.\n * @throws\n * - INVALID_REPOSITORY_PATH: The manifest path or a changed repository path is invalid.\n * - INVALID_ARGUMENT: The scope operation received an invalid argument.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const matchManifestScope = async (\n input: IManifestScopeInput,\n options: ICoreOptionsSnapshot,\n): Promise<IManifestScopeResult> => {\n const normalized = normalizeManifestScopeInput(input, options.limits);\n const inputDigest = await calculateManifestScopeInputDigest(normalized.paths);\n const parsed = await parseManifestDocument(normalized.manifest, options, 'match-manifest-scope');\n\n if (!parsed.valid || parsed.asset === null || parsed.manifest === null) {\n return freezeRecursively({\n counts: {\n declarations: 0,\n inputPaths: normalized.paths.length,\n matchedOwners: 0,\n matchedPaths: 0,\n matches: 0,\n },\n diagnostics: parsed.diagnostics,\n inputDigest,\n manifestDigest: null,\n matches: [],\n relevant: false,\n valid: false,\n });\n }\n\n const matched = matchParsedManifestScope(parsed.manifest, normalized.paths, options.limits);\n\n return freezeRecursively({\n counts: matched.counts,\n diagnostics: [],\n inputDigest,\n manifestDigest: parsed.asset.digest,\n matches: matched.matches,\n relevant: matched.matches.length > 0,\n valid: true,\n });\n};\n"],"mappings":";;;;;AAkBA,IAAM,UAAU,IAAI,YAAY;AAChC,IAAM,UAAU,IAAI,YAAY,SAAS;CAAE,OAAO;CAAM,WAAW;AAAK,CAAC;AAEzE,IAAM,cAAY,UAA+D;CAC/E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;AAQA,IAAM,+BAA+B,OAAe,sBAA6C;CAC/F,IAAI,aAAa;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