@moldea.ai/core 9.1.0 → 9.2.0

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":"options-C5360E_N.js","names":[],"sources":["../../src/constants/index.ts","../../src/immutable/index.ts","../../src/diagnostic-utilities/index.ts","../../src/options/index.ts"],"sourcesContent":["import type { ICoreResourceLimits } from '../contracts/index.js';\nimport type { IRepositoryFormatVersion } from '../format/index.js';\n\n// warning codes whose findings may be explicitly accepted in the manifest\nexport const ACCEPTABLE_WARNING_CODES = Object.freeze([\n 'MOLDEA_IMPACT_PATTERN_UNMATCHED',\n 'MOLDEA_INTEGRATION_BLOCK_MISSING',\n 'MOLDEA_INTEGRATION_SKILL_MISSING',\n 'MOLDEA_INTEGRATION_BLOCK_STALE',\n 'MOLDEA_INTEGRATION_LINK_UNRESOLVED',\n 'MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING',\n] as const);\n\n// runtime labels selecting guidance without asserting SDK compatibility\nexport const RECOGNIZED_RUNTIME_IDS = Object.freeze([\n 'amazon-bedrock',\n 'anthropic',\n 'cerebras',\n 'claude-agent-sdk',\n 'cloudflare-agents',\n 'cohere',\n 'convex-agent',\n 'cursor-sdk',\n 'custom',\n 'deep-agents',\n 'eve',\n 'genkit',\n 'github-copilot-sdk',\n 'google-adk',\n 'google-genai',\n 'groq',\n 'hugging-face',\n 'ibm-watsonx-ai',\n 'langchain',\n 'langgraph',\n 'livekit-agents',\n 'mastra',\n 'microsoft-foundry',\n 'mistral',\n 'node-llama-cpp',\n 'ollama',\n 'openai',\n 'openai-agents-sdk',\n 'openai-codex',\n 'opencode-sdk',\n 'openrouter',\n 'pi-agent',\n 'strands-agents',\n 'tanstack-ai',\n 'vercel-ai-sdk',\n 'voltagent',\n] as const);\n\n// repository-format major versions interpreted by this Core release\nexport const SUPPORTED_REPOSITORY_FORMAT_VERSIONS: readonly IRepositoryFormatVersion[] =\n Object.freeze([1]);\n\n// default safety budgets applied independently to each Core operation\nexport const DEFAULT_CORE_RESOURCE_LIMITS: ICoreResourceLimits = Object.freeze({\n maxDiagnostics: 10_000,\n maxEntries: 100_000,\n maxCoverage: 10_000,\n maxAcceptedWarnings: 256,\n maxFileBytes: 8_388_608,\n maxManifestBytes: 2_097_152,\n maxRetainedBytes: 536_870_912,\n maxTotalBytesRead: 134_217_728,\n});\n","/**\n * Creates a record that cannot collide with prototype-chain properties.\n * @param entries The own string-keyed entries to assign.\n * @returns A mutable null-prototype record for later normalization and freezing.\n */\nexport const createNullPrototypeRecord = <Value>(\n entries: Iterable<readonly [string, Value]>,\n): Record<string, Value> => {\n const record = Object.create(null) as Record<string, Value>;\n\n for (const [key, value] of entries) {\n record[key] = value;\n }\n\n return record;\n};\n","import { compareCodePoints, deepFreeze } from 'jg-utilities';\n\nimport type { IRepositoryPath } from '@moldea.ai/repository';\n\nimport { ACCEPTABLE_WARNING_CODES } from '../constants/index.js';\nimport type { ICoreResourceLimits } from '../contracts/index.js';\nimport type {\n ICoreDiagnostic,\n ICoreDiagnosticCode,\n IDiagnostic,\n IDiagnosticDetails,\n IDiagnosticEntity,\n ISourceRange,\n} from '../diagnostics/index.js';\nimport { CoreOperationException, type ICoreOperation } from '../exceptions/index.js';\nimport { createNullPrototypeRecord } from '../immutable/index.js';\n\nconst CORE_DIAGNOSTIC_MESSAGES: Record<ICoreDiagnosticCode, string> = {\n MOLDEA_AGENT_DESCRIPTION_INVALID: 'The agent description is invalid.',\n MOLDEA_AGENT_DESCRIPTION_MISSING: 'The agent description is missing.',\n MOLDEA_AGENT_DIRECTORY_MISSING: 'The registered agent directory is missing.',\n MOLDEA_AGENT_DIRECTORY_UNREGISTERED: 'The agent directory is not registered.',\n MOLDEA_AGENT_HANDOFF_DESCRIPTION_INVALID: 'The agent handoff description is invalid.',\n MOLDEA_AGENT_IDENTITY_INVALID: 'The agent instruction identity is invalid.',\n MOLDEA_AGENT_INSTRUCTION_EMPTY: 'The agent instruction is empty.',\n MOLDEA_AGENT_INSTRUCTION_MISSING: 'The agent instruction is missing.',\n MOLDEA_CANONICAL_ASSET_SYMLINK: 'The canonical asset is a symlink.',\n MOLDEA_CANONICAL_PATH_UNRECOGNIZED: 'The canonical path is unrecognized.',\n MOLDEA_CAPABILITY_DESCRIPTION_INVALID: 'The capability description is invalid.',\n MOLDEA_CAPABILITY_DESCRIPTION_MISSING: 'The capability description is missing.',\n MOLDEA_CONTEXT_FILE_EMPTY: 'The focused context file is empty.',\n MOLDEA_CONTEXT_PATH_INVALID: 'The context relationship path is invalid.',\n MOLDEA_CONTEXT_RELATIONSHIP_EMPTY: 'The declared relationship has no bindings or impact paths.',\n MOLDEA_DECISION_BODY_EMPTY: 'The decision Markdown body is empty.',\n MOLDEA_DECISION_CREATED_AT_INVALID: 'The decision createdAt value is invalid.',\n MOLDEA_DECISION_FILENAME_INVALID: 'The decision path or filename is invalid.',\n MOLDEA_DECISION_FRONTMATTER_INVALID: 'The decision frontmatter is invalid.',\n MOLDEA_DECISION_FRONTMATTER_MISSING: 'The decision frontmatter or its delimiters are missing.',\n MOLDEA_DECISION_ID_DUPLICATE: 'The decision ID is duplicated.',\n MOLDEA_DECISION_PROPERTY_UNKNOWN: 'The decision frontmatter contains an unknown property.',\n MOLDEA_DECISION_REFERENCE_MISSING: 'The referenced decision does not exist.',\n MOLDEA_DECISION_RELATIONSHIP_INACTIVE: 'The referenced decision is not accepted.',\n MOLDEA_DECISION_SELF_SUPERSESSION: 'The decision supersedes itself.',\n MOLDEA_DECISION_STATUS_INVALID: 'The decision status is invalid.',\n MOLDEA_DECISION_SUPERSEDED_ORPHAN:\n 'The superseded decision has no active supersession relationship.',\n MOLDEA_DECISION_SUPERSESSION_CYCLE: 'The decision supersession graph contains a cycle.',\n MOLDEA_DECISION_SUPERSESSION_STATUS_INVALID:\n 'The decision supersession relationship has inconsistent statuses.',\n MOLDEA_DECISION_TIMESTAMP_MISMATCH:\n 'The decision filename timestamp and createdAt value do not match.',\n MOLDEA_ENTRY_TYPE_INVALID: 'The repository entry type is invalid.',\n MOLDEA_RUNTIME_ID_INVALID: 'The runtime ID is invalid.',\n MOLDEA_GLOB_INVALID: 'The impact pattern is invalid.',\n MOLDEA_ID_DUPLICATE: 'An ID is duplicated within its required scope.',\n MOLDEA_ID_INVALID: 'The ID is invalid.',\n MOLDEA_ID_RESERVED: 'The ID uses a reserved filesystem name.',\n MOLDEA_IMPACT_PATH_MISSING: 'The exact impact path does not exist.',\n MOLDEA_IMPACT_PATH_NOT_FILE: 'The exact impact path is not a regular file.',\n MOLDEA_MANIFEST_MISSING: 'The project manifest is missing.',\n MOLDEA_MANIFEST_PATH_INVALID: 'The manifest path is not the canonical manifest path.',\n MOLDEA_MANIFEST_PROPERTY_UNKNOWN: 'The manifest contains an unknown property.',\n MOLDEA_MANIFEST_ROOT_INVALID: 'The manifest root is not a mapping.',\n MOLDEA_MANIFEST_VALUE_INVALID: 'The manifest value is invalid.',\n MOLDEA_MANIFEST_VERSION_INVALID: 'The manifest version is not a valid integer major version.',\n MOLDEA_MANIFEST_VERSION_MISSING: 'The manifest version is missing.',\n MOLDEA_MANIFEST_VERSION_UNSUPPORTED: 'The manifest version is unsupported.',\n MOLDEA_MIRROR_PATH_DUPLICATE: 'The mirror path is assigned more than once.',\n MOLDEA_MIRROR_PATH_INSIDE_MOLDEA: 'The mirror path is inside /moldea.',\n MOLDEA_MIRROR_PATH_INVALID: 'The mirror path is invalid.',\n MOLDEA_MIRROR_MISSING: 'The declared mirror does not exist.',\n MOLDEA_MIRROR_NOT_FILE: 'The declared mirror is not a regular file.',\n MOLDEA_MIRROR_STALE: 'The declared mirror differs from its canonical instruction.',\n MOLDEA_MIRROR_SYMLINK: 'The declared mirror is a symlink.',\n MOLDEA_PATH_DUPLICATE: 'The path is duplicated.',\n MOLDEA_PATH_INVALID: 'The manifest logical path is invalid.',\n MOLDEA_PATTERN_DUPLICATE: 'The impact pattern is duplicated.',\n MOLDEA_PROJECT_FILE_EMPTY: 'The project file is empty.',\n MOLDEA_PROJECT_FILE_MISSING: 'The project file is missing.',\n MOLDEA_INTEGRATION_BLOCK_MISSING: 'The AGENTS.md moldea block is missing.',\n MOLDEA_INTEGRATION_SKILL_MISSING:\n 'The skill installation referenced by the AGENTS.md moldea block was not found.',\n MOLDEA_INTEGRATION_BLOCK_STALE: 'The AGENTS.md moldea block differs from its skill installation.',\n MOLDEA_INTEGRATION_LINK_UNRESOLVED:\n \"This instruction file's link doesn't lead to a file in the repository.\",\n MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING: 'Claude Code instructions do not load AGENTS.md.',\n MOLDEA_IMPACT_PATTERN_UNMATCHED: 'The impact pattern matches no files.',\n MOLDEA_ACCEPTANCE_UNMATCHED: 'The warning acceptance matches no reported warning.',\n MOLDEA_REFERENCE_EXPORT_MISSING: 'The referenced export is missing.',\n MOLDEA_REFERENCE_MISSING: 'The referenced repository path does not exist.',\n MOLDEA_REFERENCE_NOT_FILE: 'The referenced repository path is not a regular file.',\n MOLDEA_REFERENCE_SYMLINK: 'The referenced repository path is a symlink.',\n MOLDEA_RUNTIME_GUIDANCE_EMPTY: 'The runtime guidance is empty.',\n MOLDEA_RUNTIME_GUIDANCE_MISSING: 'The referenced runtime guidance does not exist.',\n MOLDEA_SKILL_IMPLEMENTATION_MISSING: 'The registered skill implementation is missing.',\n MOLDEA_SYMBOL_FORBIDDEN: 'A canonical moldea reference must not include a symbol.',\n MOLDEA_SYMBOL_INVALID: 'The repository-reference symbol is invalid.',\n MOLDEA_TEXT_EMPTY: 'The required text document is empty.',\n MOLDEA_TEXT_INVALID_UNICODE:\n 'The text document contains an invalid Unicode scalar representation.',\n MOLDEA_TEXT_INVALID_UTF8: 'The text document is not valid UTF-8.',\n MOLDEA_TEXT_NUL_FORBIDDEN: 'The text document contains a forbidden NUL character.',\n MOLDEA_TOOL_IMPLEMENTATION_MISSING: 'The registered tool implementation is missing.',\n MOLDEA_VARIABLE_ID_INVALID: 'The runtime-variable ID is invalid.',\n MOLDEA_VARIABLE_PLACEHOLDER_MALFORMED:\n 'The agent instruction contains a malformed runtime-variable placeholder.',\n MOLDEA_VARIABLE_PROVIDER_UNDECLARED:\n 'A variable-provider binding exists for an undeclared variable.',\n MOLDEA_VARIABLE_UNDECLARED: 'The agent instruction references an undeclared runtime variable.',\n MOLDEA_VARIABLE_UNUSED: 'The declared runtime variable is unused by the agent instruction.',\n MOLDEA_YAML_DUPLICATE_KEY: 'The YAML document contains a duplicate mapping key.',\n MOLDEA_YAML_FEATURE_UNSUPPORTED: 'The YAML document uses an unsupported feature.',\n MOLDEA_YAML_MALFORMED: 'The YAML document is malformed.',\n MOLDEA_YAML_MULTIPLE_DOCUMENTS: 'The YAML stream contains more than one document.',\n};\n\nconst ENTITY_KEYS = [\n 'agentId',\n 'capabilityKind',\n 'capabilityId',\n 'decisionId',\n 'variableId',\n 'contextPath',\n 'integrationPath',\n] as const satisfies readonly (keyof IDiagnosticEntity)[];\n\n// private normalized diagnostic construction contracts\nexport interface ICoreDiagnosticInput {\n readonly code: ICoreDiagnosticCode;\n readonly details?: Readonly<Record<string, string | number | boolean | null>>;\n readonly entity?: IDiagnosticEntity | null;\n readonly path: IRepositoryPath | null;\n readonly pointer?: string | null;\n readonly range?: ISourceRange | null;\n readonly subject?: IRepositoryPath;\n readonly qualifier?: string | null;\n}\n\nexport interface ICoreDiagnosticCollector {\n add(input: ICoreDiagnosticInput): void;\n merge(input: ICoreDiagnosticInput): void;\n finalize(): readonly ICoreDiagnostic[];\n readonly size: number;\n}\n\ninterface ICoreDiagnosticBudget {\n count: number;\n}\n\nconst CORE_DIAGNOSTIC_BUDGET = Symbol('core-diagnostic-budget');\n\ntype ICoreOperationResourceLimits = ICoreResourceLimits & {\n readonly [CORE_DIAGNOSTIC_BUDGET]?: ICoreDiagnosticBudget;\n};\n\n/** Creates a detached limits view with one diagnostic budget for a complete Core operation. */\nexport const createCoreOperationResourceLimits = (\n limits: ICoreResourceLimits,\n): ICoreResourceLimits => {\n const operationLimits = limits as ICoreOperationResourceLimits;\n\n if (operationLimits[CORE_DIAGNOSTIC_BUDGET] !== undefined) {\n return limits;\n }\n\n return Object.freeze({\n ...limits,\n [CORE_DIAGNOSTIC_BUDGET]: { count: 0 },\n });\n};\n\n/** Registers raw diagnostics against the shared operation budget before normalization. */\nexport const registerCoreDiagnosticCandidates = (\n limits: ICoreResourceLimits,\n amount: number,\n operation: ICoreOperation,\n fallbackCount = 0,\n): number => {\n const budget = (limits as ICoreOperationResourceLimits)[CORE_DIAGNOSTIC_BUDGET];\n const currentCount = budget?.count ?? fallbackCount;\n\n if (amount > limits.maxDiagnostics - currentCount) {\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxDiagnostics',\n limitMaximum: limits.maxDiagnostics,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: currentCount + amount,\n operation,\n });\n }\n\n if (budget !== undefined) {\n budget.count += amount;\n }\n\n return fallbackCount + amount;\n};\n\nconst compareNullableStrings = (left: string | null, right: string | null): number => {\n if (left === null) {\n return right === null ? 0 : -1;\n }\n\n return right === null ? 1 : compareCodePoints(left, right);\n};\n\n/**\n * Normalizes trusted JSON-scalar diagnostic metadata.\n * @param details The optional detached metadata record.\n * @returns A frozen null-prototype record with canonical key order.\n */\nexport const normalizeDiagnosticDetails = (\n details: Readonly<Record<string, string | number | boolean | null>> | undefined,\n): IDiagnosticDetails => {\n const entries = Object.entries(details ?? {})\n .sort(([left], [right]) => compareCodePoints(left, right))\n .map(\n ([key, value]) =>\n [key, typeof value === 'number' && Object.is(value, -0) ? 0 : value] as const,\n );\n\n return deepFreeze(createNullPrototypeRecord(entries));\n};\n\n/**\n * Normalizes a trusted diagnostic entity into canonical key order.\n * @param entity The optional diagnostic entity.\n * @returns The frozen normalized entity or `null`.\n */\nexport const normalizeDiagnosticEntity = (\n entity: IDiagnosticEntity | null | undefined,\n): IDiagnosticEntity | null => {\n if (entity === undefined || entity === null) {\n return null;\n }\n\n const entries = ENTITY_KEYS.flatMap((key) => {\n const value = entity[key];\n return value === undefined ? [] : ([[key, value]] as const);\n });\n\n return deepFreeze(createNullPrototypeRecord(entries) as IDiagnosticEntity);\n};\n\n/** Serializes unordered diagnostic details with explicit exact-code-point key ordering. */\nexport const serializeDiagnosticDetails = (details: IDiagnosticDetails): string => {\n const entries = Object.entries(details).sort(([left], [right]) => compareCodePoints(left, right));\n\n return JSON.stringify(entries);\n};\n\nconst serializeDiagnostic = (diagnostic: IDiagnostic): string => {\n const entity =\n diagnostic.entity === null\n ? null\n : ENTITY_KEYS.map((key) => [key, diagnostic.entity?.[key] ?? null]);\n const range =\n diagnostic.range === null\n ? null\n : [\n diagnostic.range.start.line,\n diagnostic.range.start.column,\n diagnostic.range.start.offset,\n diagnostic.range.end.line,\n diagnostic.range.end.column,\n diagnostic.range.end.offset,\n ];\n\n return JSON.stringify([\n diagnostic.code,\n diagnostic.severity,\n diagnostic.severity === 'warning'\n ? [\n diagnostic.subject,\n diagnostic.qualifier,\n diagnostic.accepted ?? false,\n diagnostic.reason ?? null,\n ]\n : null,\n serializeDiagnosticDetails(diagnostic.details),\n entity,\n diagnostic.message,\n diagnostic.path,\n diagnostic.pointer,\n range,\n diagnostic.source,\n ]);\n};\n\nconst compareRanges = (left: ISourceRange | null, right: ISourceRange | null): number => {\n if (left === null) {\n return right === null ? 0 : -1;\n }\n\n if (right === null) {\n return 1;\n }\n\n return (\n left.start.line - right.start.line ||\n left.start.column - right.start.column ||\n left.start.offset - right.start.offset ||\n left.end.line - right.end.line ||\n left.end.column - right.end.column ||\n left.end.offset - right.end.offset\n );\n};\n\nconst readEntityValue = (\n entity: IDiagnosticEntity | null,\n key: keyof IDiagnosticEntity,\n): string => {\n return entity?.[key] ?? '';\n};\n\nconst compareDiagnostics = (left: IDiagnostic, right: IDiagnostic): number => {\n return (\n compareNullableStrings(left.path, right.path) ||\n compareRanges(left.range, right.range) ||\n compareNullableStrings(left.pointer, right.pointer) ||\n compareCodePoints(left.source, right.source) ||\n compareCodePoints(left.code, right.code) ||\n compareCodePoints(left.severity, right.severity) ||\n compareCodePoints(\n left.severity === 'warning'\n ? JSON.stringify([\n left.subject,\n left.qualifier,\n left.accepted ?? false,\n left.reason ?? null,\n ])\n : '',\n right.severity === 'warning'\n ? JSON.stringify([\n right.subject,\n right.qualifier,\n right.accepted ?? false,\n right.reason ?? null,\n ])\n : '',\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'agentId'),\n readEntityValue(right.entity, 'agentId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'capabilityKind'),\n readEntityValue(right.entity, 'capabilityKind'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'capabilityId'),\n readEntityValue(right.entity, 'capabilityId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'decisionId'),\n readEntityValue(right.entity, 'decisionId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'variableId'),\n readEntityValue(right.entity, 'variableId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'contextPath'),\n readEntityValue(right.entity, 'contextPath'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'integrationPath'),\n readEntityValue(right.entity, 'integrationPath'),\n ) ||\n compareCodePoints(\n serializeDiagnosticDetails(left.details),\n serializeDiagnosticDetails(right.details),\n ) ||\n compareCodePoints(left.message, right.message)\n );\n};\n\n/** Classifies every catalog code by its documented validation responsibility. */\nconst getDiagnosticGroup = (code: ICoreDiagnosticCode): ICoreDiagnostic['group'] => {\n if (code.startsWith('MOLDEA_INTEGRATION_')) return 'integration';\n if (code.startsWith('MOLDEA_MIRROR_')) return 'mirrors';\n if (/^MOLDEA_(REFERENCE|IMPACT|SYMBOL|CONTEXT|DECISION|RUNTIME_GUIDANCE)_/.test(code))\n return 'references';\n if (code === 'MOLDEA_VARIABLE_ID_INVALID') return 'manifest';\n if (/^MOLDEA_(AGENT|VARIABLE|CAPABILITY|TOOL|SKILL|RUNTIME)_/.test(code)) return 'agents';\n if (/^MOLDEA_(MANIFEST_MISSING|PROJECT_FILE|ENTRY_TYPE|CANONICAL|TEXT)_/.test(code))\n return 'discovery';\n return 'manifest';\n};\n\n/**\n * Creates one normalized, immutable Core diagnostic.\n * @param input The trusted Core-owned diagnostic fields to normalize.\n * @returns A deeply immutable public diagnostic value.\n */\nexport const createCoreDiagnostic = (input: ICoreDiagnosticInput): ICoreDiagnostic => {\n const message = CORE_DIAGNOSTIC_MESSAGES[input.code];\n\n if (message === undefined) {\n throw new TypeError('The requested Core diagnostic is not implemented.');\n }\n\n const base = {\n code: input.code,\n details: normalizeDiagnosticDetails(input.details),\n entity: normalizeDiagnosticEntity(input.entity),\n message,\n path: input.path,\n pointer: input.pointer ?? null,\n range: input.range ?? null,\n group: getDiagnosticGroup(input.code),\n source: 'core' as const,\n };\n if (\n input.code === 'MOLDEA_IMPACT_PATTERN_UNMATCHED' ||\n input.code === 'MOLDEA_ACCEPTANCE_UNMATCHED' ||\n input.code === 'MOLDEA_INTEGRATION_BLOCK_MISSING' ||\n input.code === 'MOLDEA_INTEGRATION_SKILL_MISSING' ||\n input.code === 'MOLDEA_INTEGRATION_BLOCK_STALE' ||\n input.code === 'MOLDEA_INTEGRATION_LINK_UNRESOLVED' ||\n input.code === 'MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING'\n ) {\n if (input.subject === undefined) throw new TypeError('A warning subject is required.');\n return deepFreeze({\n ...base,\n code: input.code,\n severity: 'warning' as const,\n subject: input.subject,\n qualifier: input.qualifier ?? null,\n acceptable: ACCEPTABLE_WARNING_CODES.some((code) => code === input.code),\n });\n }\n return deepFreeze({ ...base, code: input.code, severity: 'error' as const });\n};\n\n/**\n * Deduplicates and sorts already-normalized Core diagnostics.\n * @param candidates The immutable diagnostics to combine.\n * @returns A frozen deterministic diagnostic collection.\n */\nexport const normalizeDiagnostics = (\n candidates: readonly IDiagnostic[],\n): readonly IDiagnostic[] => {\n const diagnostics = new Map<string, IDiagnostic>();\n\n for (const diagnostic of candidates) {\n const key = serializeDiagnostic(diagnostic);\n\n if (diagnostics.has(key)) {\n continue;\n }\n\n diagnostics.set(key, diagnostic);\n }\n\n return deepFreeze([...diagnostics.values()].sort(compareDiagnostics));\n};\n\n/** Counts the complete normalized diagnostic result by severity once. */\nexport const countDiagnosticsBySeverity = (\n diagnostics: readonly IDiagnostic[],\n): {\n readonly errorCount: number;\n readonly warningCount: number;\n readonly acceptedWarningCount: number;\n readonly diagnosticCount: number;\n} => {\n let errorCount = 0;\n let warningCount = 0;\n let acceptedWarningCount = 0;\n\n for (const diagnostic of diagnostics) {\n if (diagnostic.severity === 'error') {\n errorCount += 1;\n } else if (diagnostic.accepted === true) {\n acceptedWarningCount += 1;\n } else {\n warningCount += 1;\n }\n }\n\n return { errorCount, warningCount, acceptedWarningCount, diagnosticCount: diagnostics.length };\n};\n\n/**\n * Creates a deterministic, deduplicating diagnostic collector for one operation.\n * @param limits The Core resource limits governing diagnostic output.\n * @param operation The operation reported by resource failures.\n * @returns A collector that freezes and sorts its final diagnostic array.\n */\nexport const createCoreDiagnosticCollector = (\n limits: ICoreResourceLimits,\n operation: ICoreOperation,\n): ICoreDiagnosticCollector => {\n const diagnostics = new Map<string, ICoreDiagnostic>();\n let proposalCount = 0;\n let fallbackRawCount = 0;\n\n const retain = (input: ICoreDiagnosticInput): void => {\n const diagnostic = createCoreDiagnostic(input);\n const key = serializeDiagnostic(diagnostic);\n\n proposalCount += 1;\n\n if (!diagnostics.has(key)) {\n diagnostics.set(key, diagnostic);\n }\n };\n\n return {\n add: (input): void => {\n fallbackRawCount = registerCoreDiagnosticCandidates(limits, 1, operation, fallbackRawCount);\n retain(input);\n },\n merge: retain,\n finalize: (): readonly ICoreDiagnostic[] => normalizeDiagnostics([...diagnostics.values()]),\n get size(): number {\n return proposalCount;\n },\n };\n};\n\n/**\n * Escapes one JSON Pointer reference token.\n * @param value The decoded mapping key or array index token.\n * @returns The RFC 6901 escaped token.\n */\nexport const escapeJsonPointerSegment = (value: string): string => {\n return value.replaceAll('~', '~0').replaceAll('/', '~1');\n};\n","import { deepFreeze, isObjectValid } from 'jg-utilities';\n\nimport { DEFAULT_CORE_RESOURCE_LIMITS } from '../constants/index.js';\nimport type { ICoreOptions, ICoreResourceLimits } from '../contracts/index.js';\nimport { createCoreOperationResourceLimits } from '../diagnostic-utilities/index.js';\nimport { CoreConfigurationException } from '../exceptions/index.js';\n\n// complete immutable Core configuration\nexport interface ICoreOptionsSnapshot {\n readonly limits: ICoreResourceLimits;\n}\n\n/** Creates an operation-local options view with one shared raw-diagnostic budget. */\nexport const createCoreOperationOptionsSnapshot = (\n options: ICoreOptionsSnapshot,\n): ICoreOptionsSnapshot => {\n return Object.freeze({\n limits: createCoreOperationResourceLimits(options.limits),\n });\n};\n\nconst RESOURCE_LIMIT_KEYS = [\n 'maxEntries',\n 'maxTotalBytesRead',\n 'maxFileBytes',\n 'maxManifestBytes',\n 'maxRetainedBytes',\n 'maxDiagnostics',\n 'maxCoverage',\n 'maxAcceptedWarnings',\n] as const satisfies readonly (keyof ICoreResourceLimits)[];\n\n/**\n * Validates, copies, fills, and freezes all configured resource limits.\n * @param candidate The untrusted optional limit overrides.\n * @returns The complete frozen resource limits.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n */\nconst normalizeLimits = (candidate: unknown): ICoreResourceLimits => {\n if (candidate === undefined) {\n return DEFAULT_CORE_RESOURCE_LIMITS;\n }\n\n if (!isObjectValid(candidate, true)) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n const knownKeys = new Set<string>(RESOURCE_LIMIT_KEYS);\n\n if (Object.keys(candidate).some((key) => !knownKeys.has(key))) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n const normalized: ICoreResourceLimits = {\n ...DEFAULT_CORE_RESOURCE_LIMITS,\n };\n\n for (const key of RESOURCE_LIMIT_KEYS) {\n const value: unknown = candidate[key];\n\n if (value === undefined) {\n continue;\n }\n\n if (!Number.isSafeInteger(value) || (value as number) <= 0) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n (normalized as Record<keyof ICoreResourceLimits, number>)[key] = value as number;\n }\n\n return deepFreeze(normalized);\n};\n\n/**\n * Validates and snapshots caller-owned Core resource limits.\n * @returns A deeply frozen configuration snapshot.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n */\nexport const normalizeCoreOptions = (options: ICoreOptions | undefined): ICoreOptionsSnapshot => {\n if (\n options !== undefined &&\n (!isObjectValid(options, true) || Reflect.ownKeys(options).some((key) => key !== 'limits'))\n ) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n return deepFreeze({ limits: normalizeLimits(options?.['limits']) });\n};\n"],"mappings":";;;AAIA,IAAa,2BAA2B,OAAO,OAAO;CACpD;CACA;CACA;CACA;CACA;CACA;AACF,CAAU;AAGV,IAAa,yBAAyB,OAAO,OAAO;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAU;AAGV,IAAa,uCACX,OAAO,OAAO,CAAC,CAAC,CAAC;AAGnB,IAAa,+BAAoD,OAAO,OAAO;CAC7E,gBAAgB;CAChB,YAAY;CACZ,aAAa;CACb,qBAAqB;CACrB,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;AACrB,CAAC;;;;;;;;AC9DD,IAAa,6BACX,YAC0B;CAC1B,MAAM,SAAS,OAAO,OAAO,IAAI;CAEjC,KAAK,MAAM,CAAC,KAAK,UAAU,SACzB,OAAO,OAAO;CAGhB,OAAO;AACT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IAAI,cAAc,KAAA,GAChB,OAAO;CAGT,IAAI,CAAC,cAAc,WAAW,IAAI,GAChC,MAAM,IAAI,2BAA2B;EACnC,MAAM;EACN,WAAW;CACb,CAAC;CAGH,MAAM,YAAY,IAAI,IAAY,mBAAmB;CAErD,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,MAAM,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,GAC1D,MAAM,IAAI,2BAA2B;EACnC,MAAM;EACN,WAAW;CACb,CAAC;CAGH,MAAM,aAAkC,EACtC,GAAG,6BACL;CAEA,KAAK,MAAM,OAAO,qBAAqB;EACrC,MAAM,QAAiB,UAAU;EAEjC,IAAI,UAAU,KAAA,GACZ;EAGF,IAAI,CAAC,OAAO,cAAc,KAAK,KAAM,SAAoB,GACvD,MAAM,IAAI,2BAA2B;GACnC,MAAM;GACN,WAAW;EACb,CAAC;EAGH,WAA0D,OAAO;CACnE;CAEA,OAAO,WAAW,UAAU;AAC9B;;;;;;;AAQA,IAAa,wBAAwB,YAA4D;CAC/F,IACE,YAAY,KAAA,MACX,CAAC,cAAc,SAAS,IAAI,KAAK,QAAQ,QAAQ,OAAO,CAAC,CAAC,MAAM,QAAQ,QAAQ,QAAQ,IAEzF,MAAM,IAAI,2BAA2B;EACnC,MAAM;EACN,WAAW;CACb,CAAC;CAEH,OAAO,WAAW,EAAE,QAAQ,gBAAgB,UAAU,SAAS,EAAE,CAAC;AACpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"scope-CNg6Gnpi.js","names":[],"sources":["../../src/format-validation/index.ts","../../src/text/index.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/validations.ts","../../src/scope-matching/scope.ts"],"sourcesContent":["import { isRepositoryPath, parseRepositoryPath, type IRepositoryPath } from '@moldea.ai/repository';\n\nconst STABLE_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\nconst VARIABLE_ID_PATTERN = /^[A-Z][A-Z0-9_]*$/u;\nconst WINDOWS_RESERVED_ID_PATTERN = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/u;\nconst LINE_BREAK_CHARACTERS = ['\\n', '\\r', '\\u0085', '\\u2028', '\\u2029'] as const;\nconst UNSUPPORTED_GLOB_PATTERN = /[!?[\\]{}]/u;\n\nconst hasLineBreak = (value: string): boolean => {\n return LINE_BREAK_CHARACTERS.some((lineBreak) => value.includes(lineBreak));\n};\n\n/** Determines whether a code point belongs to the Repository Format version 1 whitespace set. */\nexport const isRepositoryFormatWhitespace = (codePoint: number): boolean => {\n return (\n (codePoint >= 0x0009 && codePoint <= 0x000d) ||\n codePoint === 0x0020 ||\n codePoint === 0x0085 ||\n codePoint === 0x00a0 ||\n codePoint === 0x1680 ||\n (codePoint >= 0x2000 && codePoint <= 0x200a) ||\n codePoint === 0x2028 ||\n codePoint === 0x2029 ||\n codePoint === 0x202f ||\n codePoint === 0x205f ||\n codePoint === 0x3000\n );\n};\n\n/** Counts Unicode scalar values in valid JavaScript text. */\nexport const countUnicodeScalars = (value: string): number => {\n const scalars = value[Symbol.iterator]();\n let count = 0;\n\n while (scalars.next().done !== true) {\n count += 1;\n }\n\n return count;\n};\n\n/** Determines whether a value contains at least one non-whitespace scalar. */\nexport const hasNonWhitespace = (value: string): boolean => {\n for (const scalar of value) {\n if (!isRepositoryFormatWhitespace(scalar.codePointAt(0) ?? 0)) {\n return true;\n }\n }\n\n return false;\n};\n\n/** Determines whether a value begins or ends with version 1 whitespace. */\nexport const hasSurroundingWhitespace = (value: string): boolean => {\n const firstCodePoint = value.codePointAt(0);\n const lastCodePoint = value.codePointAt(value.length - 1);\n\n return (\n (firstCodePoint !== undefined && isRepositoryFormatWhitespace(firstCodePoint)) ||\n (lastCodePoint !== undefined && isRepositoryFormatWhitespace(lastCodePoint))\n );\n};\n\n/** Removes only Repository Format version 1 whitespace from both edges. */\nexport const trimRepositoryFormatWhitespace = (value: string): string => {\n let start = 0;\n let end = value.length;\n\n while (start < end) {\n const codePoint = value.codePointAt(start);\n\n if (codePoint === undefined || !isRepositoryFormatWhitespace(codePoint)) {\n break;\n }\n\n start += codePoint > 0xffff ? 2 : 1;\n }\n\n while (end > start) {\n const codePoint = value.codePointAt(end - 1);\n\n if (codePoint === undefined || !isRepositoryFormatWhitespace(codePoint)) {\n break;\n }\n\n end -= 1;\n }\n\n return value.slice(start, end);\n};\n\n/** Determines whether a string is non-empty and contains no line break. */\nexport const isNonEmptySingleLine = (value: string): boolean => {\n return value.length > 0 && !hasLineBreak(value);\n};\n\n/** Determines whether a value satisfies stable moldea ID syntax. */\nexport const isStableId = (value: string): boolean => {\n return value.length <= 64 && STABLE_ID_PATTERN.test(value);\n};\n\n/** Determines whether an otherwise valid stable ID is filesystem-reserved. */\nexport const isReservedId = (value: string): boolean => WINDOWS_RESERVED_ID_PATTERN.test(value);\n\n/** Determines whether a value satisfies runtime-variable ID syntax. */\nexport const isVariableId = (value: string): boolean => {\n return value.length <= 64 && VARIABLE_ID_PATTERN.test(value);\n};\n\n/** Determines whether a parsed capability description satisfies version 1 limits. */\nexport const isCapabilityDescription = (value: string): boolean => {\n const scalarLength = countUnicodeScalars(value);\n\n return (\n scalarLength >= 1 &&\n scalarLength <= 1_000 &&\n !hasSurroundingWhitespace(value) &&\n !hasLineBreak(value) &&\n !value.includes('\\0') &&\n !value.includes('{{') &&\n !value.includes('}}')\n );\n};\n\n/** Parses a non-root repository-format logical path without throwing. */\nexport const parseManifestPath = (value: string): IRepositoryPath | null => {\n return value !== '/' && isRepositoryPath(value) ? parseRepositoryPath(value) : null;\n};\n\n/** Determines whether a path is the canonical manifest path. */\nexport const isCanonicalManifestPath = (path: IRepositoryPath): boolean => {\n return path === '/moldea/moldea.yaml';\n};\n\n/** Extracts the stable millisecond ID from one canonical immediate decision path. */\nexport const parseDecisionIdFromPath = (path: IRepositoryPath): string | null => {\n const match = /^\\/moldea\\/decisions\\/(\\d{13})-([a-z0-9]+(?:-[a-z0-9]+)*)\\.md$/u.exec(path);\n const id = match?.[1];\n const slug = match?.[2];\n\n return id !== undefined && slug !== undefined && isStableId(slug) ? id : null;\n};\n\n/** Determines whether a path is an allowed focused-context relationship key. */\nexport const isContextPath = (path: IRepositoryPath, allowProject: boolean): boolean => {\n if (allowProject && path === '/moldea/project.md') {\n return true;\n }\n\n return path.startsWith('/moldea/context/') && path.endsWith('.md');\n};\n\n/** Determines whether a path has the canonical immediate decision filename shape. */\nexport const isDecisionPath = (path: IRepositoryPath): boolean => {\n return parseDecisionIdFromPath(path) !== null;\n};\n\n/** Determines whether a path is canonical runtime guidance. */\nexport const isRuntimeGuidancePath = (path: IRepositoryPath): boolean => {\n return path.startsWith('/moldea/runtimes/') && path.endsWith('.md');\n};\n\n/** Determines whether a mirror path is outside canonical moldea content. */\nexport const isMirrorPath = (path: IRepositoryPath): boolean => {\n return path !== '/moldea' && !path.startsWith('/moldea/');\n};\n\n/** Determines whether an impact path contains prohibited glob metacharacters. */\nexport const hasUnsupportedGlobMetacharacter = (value: string): boolean => {\n return UNSUPPORTED_GLOB_PATTERN.test(value);\n};\n\n/** Determines whether a string satisfies the version 1 simple-glob grammar. */\nexport const isSimpleGlob = (value: string): boolean => {\n if (hasUnsupportedGlobMetacharacter(value) || value.includes('***')) {\n return false;\n }\n\n const segments = value.slice(1).split('/');\n\n if (segments.some((segment) => segment.includes('**') && segment !== '**')) {\n return false;\n }\n\n return value.includes('*') && isRepositoryPath(value.replaceAll('*', 'x'));\n};\n\n/** Determines whether a repository-reference symbol has the common safe shape. */\nexport const isRepositorySymbol = (value: string): boolean => {\n return isNonEmptySingleLine(value) && !value.includes('\\0');\n};\n\n/** Determines whether a canonical moldea reference incorrectly carries a symbol. */\nexport const isCanonicalMoldeaPath = (path: IRepositoryPath): boolean => {\n return path === '/moldea' || path.startsWith('/moldea/');\n};\n","import { countUtf8Bytes, deepFreeze, isObjectValid } from 'jg-utilities';\n\nimport { 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 { countUnicodeScalars } from '../format-validation/index.js';\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });\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 deepFreeze({\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 (!isObjectValid(input, true)) {\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 enforceFileLimit(countUtf8Bytes(content, limits[limit]), limits, operation, limit);\n\n if (!content.isWellFormed()) {\n diagnostics.add({ code: 'MOLDEA_TEXT_INVALID_UNICODE', path });\n return invalidResult(diagnostics.finalize());\n }\n\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 = deepFreeze({\n scalarLength: countUnicodeScalars(value),\n utf8ByteLength: countUtf8Bytes(value),\n value,\n });\n\n return deepFreeze({\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 deepFreeze({\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 deepFreeze({\n diagnostics: [],\n digest,\n text: normalized.text,\n valid: true,\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 { compareCodePoints, countUtf8Bytes, deepFreeze } from 'jg-utilities';\n\nimport 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 { 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 { calculateNormalizedTextDigest } from '../text/index.js';\n\nimport type {\n IManifestScopeCounts,\n IManifestScopeDeclaration,\n IManifestScopeMatch,\n IManifestScopeOwner,\n IManifestScopeRelationshipField,\n} from './types.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 compareCodePoints(left.kind, right.kind) ||\n compareCodePoints(left.agentId ?? '', right.agentId ?? '') ||\n compareCodePoints(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 compareCodePoints(left.field, right.field) ||\n compareCodePoints(\n getDeclarationValue(left.declaration),\n getDeclarationValue(right.declaration),\n ) ||\n compareCodePoints(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(compareCodePoints)) {\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 compareCodePoints,\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(compareCodePoints)) {\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(compareCodePoints)) {\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(compareCodePoints)) {\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(compareCodePoints)) {\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 compareCodePoints(left.field, right.field) ||\n compareCodePoints(\n getDeclarationValue(left.declaration),\n getDeclarationValue(right.declaration),\n ) ||\n compareCodePoints(left.inputPath, right.inputPath) ||\n compareCodePoints(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: countUtf8Bytes(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 deepFreeze({\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 { compareCodePoints } from 'jg-utilities';\n\nimport 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 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 compareCodePoints(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;\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 compareCodePoints(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 compareCodePoints(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 compareCodePoints(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 compareCodePoints(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 compareCodePoints(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 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' && !value.isWellFormed()) {\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 { deepFreeze } from 'jg-utilities';\n\nimport { 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 { 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 deepFreeze({\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 deepFreeze({\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 deepFreeze({\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 deepFreeze({\n asset: inspection.asset,\n diagnostics: inspection.diagnostics,\n manifest: inspection.manifest,\n valid: inspection.valid,\n });\n};\n","import { compareCodePoints, countUtf8Bytes, isObjectValid } from 'jg-utilities';\n\nimport { parseRepositoryPath, type IRepositoryPath } from '@moldea.ai/repository';\n\nimport type { ICoreResourceLimits, ITextDocumentInput } from '../contracts/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\n\nimport type { IManifestScopeInput } from './types.js';\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\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 (!isObjectValid(input, true)) {\n return invalidArgument();\n }\n\n const manifest = input['manifest'];\n const pathCandidates = input['paths'];\n\n if (!isObjectValid(manifest, true) || !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 += countUtf8Bytes(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(compareCodePoints),\n };\n};\n","import { deepFreeze } from 'jg-utilities';\n\nimport type { ICoreOptionsSnapshot } from '../options/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 deepFreeze({\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 deepFreeze({\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":";;;;;;AAEA,IAAM,oBAAoB;AAC1B,IAAM,sBAAsB;AAC5B,IAAM,8BAA8B;AACpC,IAAM,wBAAwB;CAAC;CAAM;CAAM;CAAU;CAAU;AAAQ;AACvE,IAAM,2BAA2B;AAEjC,IAAM,gBAAgB,UAA2B;CAC/C,OAAO,sBAAsB,MAAM,cAAc,MAAM,SAAS,SAAS,CAAC;AAC5E;;AAGA,IAAa,gCAAgC,cAA+B;CAC1E,OACG,aAAa,KAAU,aAAa,MACrC,cAAc,MACd,cAAc,OACd,cAAc,OACd,cAAc,QACb,aAAa,QAAU,aAAa,QACrC,cAAc,QACd,cAAc,QACd,cAAc,QACd,cAAc,QACd,cAAc;AAElB;;AAGA,IAAa,uBAAuB,UAA0B;CAC5D,MAAM,UAAU,MAAM,OAAO,SAAS,CAAC;CACvC,IAAI,QAAQ;CAEZ,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,MAC7B,SAAS;CAGX,OAAO;AACT;;AAGA,IAAa,oBAAoB,UAA2B;CAC1D,KAAK,MAAM,UAAU,OACnB,IAAI,CAAC,6BAA6B,OAAO,YAAY,CAAC,KAAK,CAAC,GAC1D,OAAO;CAIX,OAAO;AACT;;AAGA,IAAa,4BAA4B,UAA2B;CAClE,MAAM,iBAAiB,MAAM,YAAY,CAAC;CAC1C,MAAM,gBAAgB,MAAM,YAAY,MAAM,SAAS,CAAC;CAExD,OACG,mBAAmB,KAAA,KAAa,6BAA6B,cAAc,KAC3E,kBAA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