@moldea.ai/core 7.1.0 → 9.0.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.
Files changed (96) hide show
  1. package/README.md +4 -4
  2. package/dist/agent-asset-validation/index.d.ts.map +1 -1
  3. package/dist/agent-assets/index.d.ts.map +1 -1
  4. package/dist/analysis-worker.js +11 -23
  5. package/dist/analysis-worker.js.map +1 -1
  6. package/dist/canonical-content-page/index.d.ts.map +1 -1
  7. package/dist/canonical-discovery/index.d.ts.map +1 -1
  8. package/dist/chunks/{core-CMuQrqRI.js → core-CFmT3SRC.js} +170 -231
  9. package/dist/chunks/core-CFmT3SRC.js.map +1 -0
  10. package/dist/chunks/{errors-BhiLG9F0.js → errors-Uvb-9X1u.js} +29 -75
  11. package/dist/chunks/errors-Uvb-9X1u.js.map +1 -0
  12. package/dist/chunks/{exceptions-CYf1pCKf.js → exceptions-AT654xUL.js} +10 -15
  13. package/dist/chunks/exceptions-AT654xUL.js.map +1 -0
  14. package/dist/chunks/{lifecycle-Bdi_ydtH.js → lifecycle-DuAHgnYH.js} +2 -2
  15. package/dist/chunks/{lifecycle-Bdi_ydtH.js.map → lifecycle-DuAHgnYH.js.map} +1 -1
  16. package/dist/chunks/{options-BVF3DQHm.js → options-C5360E_N.js} +23 -174
  17. package/dist/chunks/options-C5360E_N.js.map +1 -0
  18. package/dist/chunks/repository-rpc-B9YaeLba.js +143 -0
  19. package/dist/chunks/repository-rpc-B9YaeLba.js.map +1 -0
  20. package/dist/chunks/{scope-DoNl6LhC.js → scope-CNg6Gnpi.js} +214 -151
  21. package/dist/chunks/scope-CNg6Gnpi.js.map +1 -0
  22. package/dist/constants/index.d.ts +1 -1
  23. package/dist/constants/index.d.ts.map +1 -1
  24. package/dist/contracts/index.d.ts +2 -6
  25. package/dist/contracts/index.d.ts.map +1 -1
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/decision/index.d.ts.map +1 -1
  28. package/dist/decision-graph/index.d.ts.map +1 -1
  29. package/dist/decision-graph-validation/index.d.ts.map +1 -1
  30. package/dist/decision-validation/index.d.ts.map +1 -1
  31. package/dist/diagnostic-utilities/index.d.ts.map +1 -1
  32. package/dist/diagnostics/index.d.ts +2 -2
  33. package/dist/diagnostics/index.d.ts.map +1 -1
  34. package/dist/exceptions/index.d.ts +1 -1
  35. package/dist/exceptions/index.d.ts.map +1 -1
  36. package/dist/format-validation/index.d.ts +0 -4
  37. package/dist/format-validation/index.d.ts.map +1 -1
  38. package/dist/immutable/index.d.ts +0 -6
  39. package/dist/immutable/index.d.ts.map +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +3 -3
  43. package/dist/integration-validation/agents-inspection.d.ts +3 -3
  44. package/dist/integration-validation/agents-inspection.d.ts.map +1 -1
  45. package/dist/integration-validation/claude-inspection.d.ts +3 -2
  46. package/dist/integration-validation/claude-inspection.d.ts.map +1 -1
  47. package/dist/integration-validation/inspection.d.ts +4 -2
  48. package/dist/integration-validation/inspection.d.ts.map +1 -1
  49. package/dist/integration-validation/parser.d.ts +9 -3
  50. package/dist/integration-validation/parser.d.ts.map +1 -1
  51. package/dist/integration-validation/types.d.ts +3 -8
  52. package/dist/integration-validation/types.d.ts.map +1 -1
  53. package/dist/integration-validation/utilities.d.ts +0 -8
  54. package/dist/integration-validation/utilities.d.ts.map +1 -1
  55. package/dist/manifest/index.d.ts.map +1 -1
  56. package/dist/manifest-relationship-validation/index.d.ts.map +1 -1
  57. package/dist/manifest-validation/index.d.ts.map +1 -1
  58. package/dist/mirrors/index.d.ts.map +1 -1
  59. package/dist/node-inspection/client.d.ts.map +1 -1
  60. package/dist/node-inspection/protocol.d.ts.map +1 -1
  61. package/dist/node-inspection/repository-rpc.d.ts +7 -6
  62. package/dist/node-inspection/repository-rpc.d.ts.map +1 -1
  63. package/dist/node-inspection/types.d.ts +7 -12
  64. package/dist/node-inspection/types.d.ts.map +1 -1
  65. package/dist/node-runner.js +3 -3
  66. package/dist/node.js +19 -35
  67. package/dist/node.js.map +1 -1
  68. package/dist/options/index.d.ts.map +1 -1
  69. package/dist/project-assets/index.d.ts.map +1 -1
  70. package/dist/project-index/index.d.ts.map +1 -1
  71. package/dist/project-inspection/index.d.ts.map +1 -1
  72. package/dist/project-validation/index.d.ts +1 -1
  73. package/dist/project-validation/index.d.ts.map +1 -1
  74. package/dist/repository-inspection-session/index.d.ts +5 -8
  75. package/dist/repository-inspection-session/index.d.ts.map +1 -1
  76. package/dist/repository-reference-validation/index.d.ts.map +1 -1
  77. package/dist/repository-text/index.d.ts.map +1 -1
  78. package/dist/runtime-guidance/index.d.ts.map +1 -1
  79. package/dist/runtime-placeholder-validation/index.d.ts.map +1 -1
  80. package/dist/scope-matching/matching.d.ts.map +1 -1
  81. package/dist/scope-matching/scope.d.ts.map +1 -1
  82. package/dist/scope-matching/validations.d.ts +0 -2
  83. package/dist/scope-matching/validations.d.ts.map +1 -1
  84. package/dist/scope.js +2 -2
  85. package/dist/text/index.d.ts.map +1 -1
  86. package/dist/universal-project-inspection/index.d.ts.map +1 -1
  87. package/dist/warning-acceptance/acceptance.d.ts.map +1 -1
  88. package/dist/yaml/index.d.ts.map +1 -1
  89. package/package.json +4 -3
  90. package/dist/chunks/core-CMuQrqRI.js.map +0 -1
  91. package/dist/chunks/errors-BhiLG9F0.js.map +0 -1
  92. package/dist/chunks/exceptions-CYf1pCKf.js.map +0 -1
  93. package/dist/chunks/options-BVF3DQHm.js.map +0 -1
  94. package/dist/chunks/repository-rpc-CiKFu86B.js +0 -178
  95. package/dist/chunks/repository-rpc-CiKFu86B.js.map +0 -1
  96. package/dist/chunks/scope-DoNl6LhC.js.map +0 -1
@@ -1,7 +1,9 @@
1
- import { E as parseDecisionIdFromPath, O as trimRepositoryFormatWhitespace, S as isRuntimeGuidancePath, T as isVariableId, a as escapeJsonPointerSegment, c as freezeRecursively, d as hasNonWhitespace, g as isContextPath, i as createCoreDiagnosticCollector, l as compareExactStrings, n as normalizeCoreOptions, o as normalizeDiagnostics, r as countDiagnosticsBySeverity, s as createNullPrototypeRecord, t as createCoreOperationOptionsSnapshot, u as countUnicodeScalars } from "./options-BVF3DQHm.js";
2
- import { n as CoreOperationException } from "./exceptions-CYf1pCKf.js";
3
- import { a as createSourceLocator, c as calculateContentDigest, i as parseStrictYaml, l as calculateNormalizedTextDigest, n as inspectManifestDocument, o as collectManifestScopeDeclarations, r as parseManifestDocument, s as matchesRepositoryGlob, t as matchManifestScope, u as normalizeTextDocument } from "./scope-DoNl6LhC.js";
4
- import { REPOSITORY_ROOT, RepositorySourceException, compareRepositoryPaths, createRepositoryIdentity, isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
1
+ import { a as escapeJsonPointerSegment, i as createCoreDiagnosticCollector, n as normalizeCoreOptions, o as normalizeDiagnostics, r as countDiagnosticsBySeverity, s as createNullPrototypeRecord, t as createCoreOperationOptionsSnapshot } from "./options-C5360E_N.js";
2
+ import { n as CoreOperationException } from "./exceptions-AT654xUL.js";
3
+ import { _ as trimRepositoryFormatWhitespace, a as createSourceLocator, c as calculateContentDigest, d as countUnicodeScalars, f as hasNonWhitespace, g as parseDecisionIdFromPath, h as isVariableId, i as parseStrictYaml, l as calculateNormalizedTextDigest, m as isRuntimeGuidancePath, n as inspectManifestDocument, o as collectManifestScopeDeclarations, p as isContextPath, r as parseManifestDocument, s as matchesRepositoryGlob, t as matchManifestScope, u as normalizeTextDocument } from "./scope-CNg6Gnpi.js";
4
+ import { ERRORS, compareCodePoints, deepFreeze, findMarkedRegion, isObjectValid } from "jg-utilities";
5
+ import { hasErrorCode } from "jg-exception";
6
+ import { REPOSITORY_LINK_TEXT_MAX_BYTES, REPOSITORY_ROOT, RepositorySourceException, compareRepositoryPaths, createRepositoryIdentity, isRepositoryPath, parseRepositoryPath, resolveRepositoryLink } from "@moldea.ai/repository";
5
7
  //#region \0rolldown/runtime.js
6
8
  var __defProp = Object.defineProperty;
7
9
  var __exportAll = (all, no_symbols) => {
@@ -112,7 +114,7 @@ var readCanonicalContentPage = async (input, options) => {
112
114
  operation: "read-canonical-content-page"
113
115
  });
114
116
  if (input.offset > entry.byteLength) return invalidArgument$2();
115
- if (input.offset === entry.byteLength) return freezeRecursively({
117
+ if (input.offset === entry.byteLength) return deepFreeze({
116
118
  byteEnd: input.offset,
117
119
  byteStart: input.offset,
118
120
  content: "",
@@ -129,7 +131,7 @@ var readCanonicalContentPage = async (input, options) => {
129
131
  const [content, consumedBytes] = decodeSafePrefix(bytes, Math.min(input.maxBytes, bytes.byteLength));
130
132
  const byteEnd = input.offset + consumedBytes;
131
133
  const isComplete = byteEnd === entry.byteLength;
132
- return freezeRecursively({
134
+ return deepFreeze({
133
135
  byteEnd,
134
136
  byteStart: input.offset,
135
137
  content,
@@ -262,7 +264,7 @@ var readSupersedes = (node, context) => {
262
264
  range: item.range
263
265
  });
264
266
  });
265
- return supersedes.sort(compareExactStrings);
267
+ return supersedes.sort(compareCodePoints);
266
268
  };
267
269
  /**
268
270
  * Locates exact decision frontmatter delimiters and preserves the complete Markdown body.
@@ -361,7 +363,7 @@ var parseDecisionDocument = async (input, options, operation = "parse-decision")
361
363
  path
362
364
  });
363
365
  for (const diagnostic of normalized.diagnostics) diagnostics.merge(diagnostic);
364
- if (!normalized.valid || normalized.text === null) return freezeRecursively({
366
+ if (!normalized.valid || normalized.text === null) return deepFreeze({
365
367
  decision: null,
366
368
  diagnostics: diagnostics.finalize(),
367
369
  valid: false
@@ -379,7 +381,7 @@ var parseDecisionDocument = async (input, options, operation = "parse-decision")
379
381
  const parsed = parseStrictYaml(sections.yaml, path, locator, diagnostics);
380
382
  if (parsed.valid && parsed.value !== null) metadata = validateDecisionFrontmatter(parsed.value, context);
381
383
  }
382
- if (decisionId === null || sections === null || metadata === null || diagnostics.size > 0) return freezeRecursively({
384
+ if (decisionId === null || sections === null || metadata === null || diagnostics.size > 0) return deepFreeze({
383
385
  decision: null,
384
386
  diagnostics: diagnostics.finalize(),
385
387
  valid: false
@@ -392,7 +394,7 @@ var parseDecisionDocument = async (input, options, operation = "parse-decision")
392
394
  scalarLength: normalized.text.scalarLength,
393
395
  utf8ByteLength: normalized.text.utf8ByteLength
394
396
  };
395
- return freezeRecursively({
397
+ return deepFreeze({
396
398
  decision: {
397
399
  asset,
398
400
  body: sections.body,
@@ -534,41 +536,6 @@ var copyReaderEntry$1 = (candidate, operation, fallbackPath, expectedPath) => {
534
536
  type: typeCandidate
535
537
  };
536
538
  };
537
- var REFUSED_LINK_STATES = [
538
- "broken",
539
- "denied",
540
- "loop",
541
- "unsafe"
542
- ];
543
- var LINK_TARGET_TYPES = [
544
- "directory",
545
- "file",
546
- "other"
547
- ];
548
- /** Copies one untrusted link resolution, rejecting any shape outside the closed contract. */
549
- var copyLinkResolution = (candidate, path) => {
550
- if (typeof candidate !== "object" || candidate === null) return invalidSourceData$3("get-entry", path);
551
- const record = candidate;
552
- const keys = Object.keys(record).sort().join();
553
- const refusedState = REFUSED_LINK_STATES.find((state) => state === record["state"]);
554
- if (Reflect.ownKeys(record).length !== Object.keys(record).length) return invalidSourceData$3("get-entry", path);
555
- if (record["state"] === "not-link" || refusedState !== void 0) return keys === "state" ? { state: refusedState ?? "not-link" } : invalidSourceData$3("get-entry", path);
556
- const targetIdentity = record["targetIdentity"];
557
- const targetType = LINK_TARGET_TYPES.find((type) => type === record["targetType"]);
558
- if (typeof targetIdentity !== "string" || targetIdentity.length === 0 || targetType === void 0) return invalidSourceData$3("get-entry", path);
559
- if (record["state"] === "outside" && keys === "state,targetIdentity,targetType") return {
560
- state: "outside",
561
- targetIdentity,
562
- targetType
563
- };
564
- const targetPath = record["targetPath"];
565
- return record["state"] === "inside" && keys === "state,targetIdentity,targetPath,targetType" && typeof targetPath === "string" && isRepositoryPath(targetPath) ? {
566
- state: "inside",
567
- targetIdentity,
568
- targetPath: parseRepositoryPath(targetPath),
569
- targetType
570
- } : invalidSourceData$3("get-entry", path);
571
- };
572
539
  var isStrictDescendant = (path, prefix) => {
573
540
  if (path === prefix) return false;
574
541
  const descendantPrefix = prefix === REPOSITORY_ROOT ? REPOSITORY_ROOT : `${prefix}/`;
@@ -593,7 +560,7 @@ var createSourceOptions = (sessionSignal, operationSignal) => {
593
560
  * @param repository The source-neutral reader bound to one coherent snapshot.
594
561
  * @param limits The immutable resource limits for the inspection.
595
562
  * @param signal Optional cancellation shared by every inspection operation.
596
- * @param instructions Optional instruction source read only through the instruction view.
563
+ * @param instructions Optional reader of the four instruction paths, used only by the instruction view.
597
564
  * @returns A session that pages source metadata and range-reads bounded canonical files.
598
565
  * @throws
599
566
  * - ABORTED: The Core operation was aborted.
@@ -780,36 +747,33 @@ var createRepositoryInspectionSession = (repository, limits, signal, instruction
780
747
  }
781
748
  };
782
749
  };
783
- const instructionReader = instructions?.reader ?? repository;
784
- const instructionPages = instructions === void 0 ? repositoryPages : {
785
- readPage: (path, options) => instructions.reader.readFilePage(path, options),
786
- snapshotId: instructions.reader.snapshot.id
787
- };
788
- const linkResolver = instructions?.linkResolver;
789
- const linkPages = linkResolver === void 0 ? void 0 : {
790
- readPage: (path, options) => linkResolver.readLinkTargetPage(path, options),
791
- snapshotId: linkResolver.snapshot.id
750
+ const readerFor = (path) => instructions !== void 0 && INSTRUCTION_PATHS.has(path) ? instructions : repository;
751
+ const pagesFor = (path) => {
752
+ const source = readerFor(path);
753
+ return source === repository ? repositoryPages : {
754
+ readPage: (pagePath, options) => source.readFilePage(pagePath, options),
755
+ snapshotId: source.snapshot.id
756
+ };
792
757
  };
793
- const requireInstructionPath = (path) => {
758
+ /** Reads one link's stored text from the routed source, rejecting text past the shared limit. */
759
+ const readLinkText = async (path, options) => {
794
760
  const parsedPath = parseRepositoryPath(path);
795
- if (!INSTRUCTION_PATHS.has(parsedPath)) throw new TypeError("The instruction view reads only coding-agent instruction paths.");
796
- return parsedPath;
761
+ throwIfSignalAborted(options?.signal);
762
+ registerPath(parsedPath);
763
+ const text = await awaitWithCancellation(readerFor(parsedPath).readLinkText(parsedPath, createSourceOptions(signal, options?.signal)), options?.signal);
764
+ throwIfSignalAborted(options?.signal);
765
+ if (text !== null && (typeof text !== "string" || encoder$1.encode(text).byteLength > REPOSITORY_LINK_TEXT_MAX_BYTES)) return invalidSourceData$3("read-link-text", parsedPath);
766
+ return text;
797
767
  };
798
768
  const instructionView = Object.freeze({
799
- getEntry: (path) => getEntryFrom(instructionReader, requireInstructionPath(path)),
800
- readLinkedSourceFile: (path) => {
801
- if (linkPages === void 0) throw new TypeError("The instruction view has no link resolver to read through.");
802
- return readRetainedSource(requireInstructionPath(path), linkPages);
769
+ getEntry: (path, options) => {
770
+ const parsedPath = parseRepositoryPath(path);
771
+ return getEntryFrom(readerFor(parsedPath), parsedPath, options);
803
772
  },
804
- readSourceFile: (path) => readRetainedSource(requireInstructionPath(path), instructionPages),
805
- resolveLink: async (path) => {
806
- const parsedPath = requireInstructionPath(path);
807
- if (linkResolver === void 0) return null;
808
- throwIfSignalAborted();
809
- registerPath(parsedPath);
810
- const candidate = await awaitWithCancellation(linkResolver.resolveLink(parsedPath, createSourceOptions(signal, void 0)));
811
- throwIfSignalAborted();
812
- return copyLinkResolution(candidate, parsedPath);
773
+ readLinkText,
774
+ readSourceFile: (path) => {
775
+ const parsedPath = parseRepositoryPath(path);
776
+ return readRetainedSource(parsedPath, pagesFor(parsedPath));
813
777
  }
814
778
  });
815
779
  const reader = Object.freeze({
@@ -887,7 +851,7 @@ var validateAgentDescription = (asset, agentId, kind, limits) => {
887
851
  path: asset.path
888
852
  });
889
853
  const finalizedDiagnostics = diagnostics.finalize();
890
- return freezeRecursively({
854
+ return deepFreeze({
891
855
  description: finalizedDiagnostics.length === 0 ? {
892
856
  asset,
893
857
  scalarLength,
@@ -914,7 +878,7 @@ var validateAgentInstruction = (asset, agentId, limits) => {
914
878
  entity: { agentId },
915
879
  path: asset.path
916
880
  });
917
- return freezeRecursively({
881
+ return deepFreeze({
918
882
  diagnostics: diagnostics.finalize(),
919
883
  instruction: null,
920
884
  valid: false
@@ -932,7 +896,7 @@ var validateAgentInstruction = (asset, agentId, limits) => {
932
896
  path: asset.path
933
897
  });
934
898
  const finalizedDiagnostics = diagnostics.finalize();
935
- return freezeRecursively({
899
+ return deepFreeze({
936
900
  diagnostics: finalizedDiagnostics,
937
901
  instruction: asset,
938
902
  valid: finalizedDiagnostics.length === 0
@@ -972,7 +936,7 @@ var readRepositoryTextAsset = async (repository, path, limits, signal) => {
972
936
  content,
973
937
  path
974
938
  }, limits, "validate-project");
975
- if (!normalized.valid || normalized.text === null) return freezeRecursively({
939
+ if (!normalized.valid || normalized.text === null) return deepFreeze({
976
940
  asset: null,
977
941
  diagnostics: normalized.diagnostics,
978
942
  valid: false
@@ -984,7 +948,7 @@ var readRepositoryTextAsset = async (repository, path, limits, signal) => {
984
948
  scalarLength: normalized.text.scalarLength,
985
949
  utf8ByteLength: normalized.text.utf8ByteLength
986
950
  };
987
- return freezeRecursively({
951
+ return deepFreeze({
988
952
  asset,
989
953
  diagnostics: [],
990
954
  valid: true
@@ -1118,7 +1082,7 @@ var validateRuntimePlaceholders = (manifestPath, agentId, instruction, declaredV
1118
1082
  cursor = instruction.content.length;
1119
1083
  }
1120
1084
  }
1121
- for (const variableId of [...occurrences.keys()].sort(compareExactStrings)) {
1085
+ for (const variableId of [...occurrences.keys()].sort(compareCodePoints)) {
1122
1086
  if (declaredVariables[variableId] !== void 0) continue;
1123
1087
  const occurrence = occurrences.get(variableId);
1124
1088
  if (occurrence === void 0) continue;
@@ -1133,7 +1097,7 @@ var validateRuntimePlaceholders = (manifestPath, agentId, instruction, declaredV
1133
1097
  range: occurrence.firstRange
1134
1098
  });
1135
1099
  }
1136
- for (const variableId of Object.keys(declaredVariables).sort(compareExactStrings)) {
1100
+ for (const variableId of Object.keys(declaredVariables).sort(compareCodePoints)) {
1137
1101
  if (occurrences.has(variableId)) continue;
1138
1102
  collector.add({
1139
1103
  code: "MOLDEA_VARIABLE_UNUSED",
@@ -1213,7 +1177,7 @@ var inspectAgentAssets = async (repository, manifest, discovery, options, signal
1213
1177
  entity: { agentId: discovered.id },
1214
1178
  path: discovered.path
1215
1179
  });
1216
- for (const agentId of [...registeredIds].sort(compareExactStrings)) {
1180
+ for (const agentId of [...registeredIds].sort(compareCodePoints)) {
1217
1181
  const declaration = registeredAgents[agentId];
1218
1182
  if (declaration === void 0) continue;
1219
1183
  const discovered = discoveredById.get(agentId);
@@ -1262,7 +1226,7 @@ var inspectAgentAssets = async (repository, manifest, discovery, options, signal
1262
1226
  });
1263
1227
  }
1264
1228
  const diagnostics = collector.finalize();
1265
- return freezeRecursively({
1229
+ return deepFreeze({
1266
1230
  agents,
1267
1231
  diagnostics,
1268
1232
  valid: diagnostics.length === 0
@@ -1441,10 +1405,10 @@ var retainCanonicalFile = (inventory, path, fileKind, agentId) => {
1441
1405
  };
1442
1406
  var finalizeInventory = (working) => {
1443
1407
  const sortPaths = (paths) => {
1444
- return [...paths].sort(compareExactStrings);
1408
+ return [...paths].sort(compareCodePoints);
1445
1409
  };
1446
- const agents = [...working.agents.values()].sort((left, right) => compareExactStrings(left.id, right.id)).map((agent) => freezeRecursively({ ...agent }));
1447
- return freezeRecursively({
1410
+ const agents = [...working.agents.values()].sort((left, right) => compareCodePoints(left.id, right.id)).map((agent) => deepFreeze({ ...agent }));
1411
+ return deepFreeze({
1448
1412
  agents,
1449
1413
  context: sortPaths(working.context),
1450
1414
  decisions: sortPaths(working.decisions),
@@ -1455,7 +1419,7 @@ var finalizeInventory = (working) => {
1455
1419
  };
1456
1420
  var finalizeResult = (working, diagnostics) => {
1457
1421
  const finalizedDiagnostics = diagnostics.finalize();
1458
- return freezeRecursively({
1422
+ return deepFreeze({
1459
1423
  diagnostics: finalizedDiagnostics,
1460
1424
  inventory: finalizeInventory(working),
1461
1425
  valid: finalizedDiagnostics.length === 0
@@ -1579,7 +1543,7 @@ var discoverCanonicalAssets = async (repository, limits, signal, foundations) =>
1579
1543
  //#endregion
1580
1544
  //#region src/decision-graph-validation/index.ts
1581
1545
  var sortCandidates = (candidates) => {
1582
- return [...candidates].sort((left, right) => compareExactStrings(left.path, right.path));
1546
+ return [...candidates].sort((left, right) => compareCodePoints(left.path, right.path));
1583
1547
  };
1584
1548
  var buildGraphIndex = (candidates) => {
1585
1549
  const mutableGroups = /* @__PURE__ */ new Map();
@@ -1591,7 +1555,7 @@ var buildGraphIndex = (candidates) => {
1591
1555
  }
1592
1556
  const candidateGroups = /* @__PURE__ */ new Map();
1593
1557
  const nodes = /* @__PURE__ */ new Map();
1594
- for (const id of [...mutableGroups.keys()].sort(compareExactStrings)) {
1558
+ for (const id of [...mutableGroups.keys()].sort(compareCodePoints)) {
1595
1559
  const group = mutableGroups.get(id) ?? [];
1596
1560
  candidateGroups.set(id, group);
1597
1561
  if (group.length === 1 && group[0]?.decision !== null) {
@@ -1704,7 +1668,7 @@ var buildReverseEdges = (index) => {
1704
1668
  const reverseEdges = /* @__PURE__ */ new Map();
1705
1669
  for (const id of index.nodes.keys()) reverseEdges.set(id, []);
1706
1670
  for (const [sourceId, targets] of index.edges) for (const targetId of targets) reverseEdges.get(targetId)?.push(sourceId);
1707
- for (const sources of reverseEdges.values()) sources.sort(compareExactStrings);
1671
+ for (const sources of reverseEdges.values()) sources.sort(compareCodePoints);
1708
1672
  return reverseEdges;
1709
1673
  };
1710
1674
  var findStronglyConnectedComponents = (index) => {
@@ -1725,9 +1689,9 @@ var findStronglyConnectedComponents = (index) => {
1725
1689
  stack.push(sourceId);
1726
1690
  }
1727
1691
  }
1728
- components.push(component.sort(compareExactStrings));
1692
+ components.push(component.sort(compareCodePoints));
1729
1693
  }
1730
- return components.sort((left, right) => compareExactStrings(left[0] ?? "", right[0] ?? ""));
1694
+ return components.sort((left, right) => compareCodePoints(left[0] ?? "", right[0] ?? ""));
1731
1695
  };
1732
1696
  var collectCycleDiagnostics = (index, diagnostics) => {
1733
1697
  for (const component of findStronglyConnectedComponents(index)) {
@@ -1778,7 +1742,7 @@ var invalidSourceData = (path) => {
1778
1742
  };
1779
1743
  var sortDecisions = (decisions) => {
1780
1744
  return [...decisions].sort((left, right) => {
1781
- return compareExactStrings(left.id, right.id) || compareExactStrings(left.path, right.path);
1745
+ return compareCodePoints(left.id, right.id) || compareCodePoints(left.path, right.path);
1782
1746
  });
1783
1747
  };
1784
1748
  /**
@@ -1806,7 +1770,7 @@ var readDecisionGraph = async (repository, paths, options, signal) => {
1806
1770
  const candidates = [];
1807
1771
  const decisions = [];
1808
1772
  const readOptions = signal === void 0 ? void 0 : { signal };
1809
- for (const path of [...paths].sort(compareExactStrings)) {
1773
+ for (const path of [...paths].sort(compareCodePoints)) {
1810
1774
  const content = await repository.readCompleteFile(path, readOptions);
1811
1775
  if (!(content instanceof Uint8Array)) return invalidSourceData(path);
1812
1776
  const parsed = await parseDecisionDocument({
@@ -1823,7 +1787,7 @@ var readDecisionGraph = async (repository, paths, options, signal) => {
1823
1787
  }
1824
1788
  for (const diagnostic of validateDecisionGraph(candidates, options.limits)) diagnostics.merge(diagnostic);
1825
1789
  const finalizedDiagnostics = diagnostics.finalize();
1826
- return freezeRecursively({
1790
+ return deepFreeze({
1827
1791
  decisions: sortDecisions(decisions),
1828
1792
  diagnostics: finalizedDiagnostics,
1829
1793
  valid: finalizedDiagnostics.length === 0
@@ -1901,9 +1865,9 @@ var validateManifestRelationships = (manifestPath, manifest, discovery, decision
1901
1865
  validAgentContextPaths,
1902
1866
  validTopLevelContextPaths
1903
1867
  };
1904
- for (const referencedPathValue of Object.keys(manifest.context ?? {}).sort(compareExactStrings)) validateContextRelationship(parseRepositoryPath(referencedPathValue), `/context/${escapeJsonPointerSegment(referencedPathValue)}`, validationContext.validTopLevelContextPaths, validationContext);
1905
- for (const referencedPathValue of Object.keys(manifest.decisions ?? {}).sort(compareExactStrings)) validateDecisionRelationship(parseRepositoryPath(referencedPathValue), `/decisions/${escapeJsonPointerSegment(referencedPathValue)}`, validationContext);
1906
- for (const agentId of Object.keys(manifest.agents ?? {}).sort(compareExactStrings)) {
1868
+ for (const referencedPathValue of Object.keys(manifest.context ?? {}).sort(compareCodePoints)) validateContextRelationship(parseRepositoryPath(referencedPathValue), `/context/${escapeJsonPointerSegment(referencedPathValue)}`, validationContext.validTopLevelContextPaths, validationContext);
1869
+ for (const referencedPathValue of Object.keys(manifest.decisions ?? {}).sort(compareCodePoints)) validateDecisionRelationship(parseRepositoryPath(referencedPathValue), `/decisions/${escapeJsonPointerSegment(referencedPathValue)}`, validationContext);
1870
+ for (const agentId of Object.keys(manifest.agents ?? {}).sort(compareCodePoints)) {
1907
1871
  const agent = manifest.agents?.[agentId];
1908
1872
  if (agent === void 0) continue;
1909
1873
  const escapedAgentId = escapeJsonPointerSegment(agentId);
@@ -1914,26 +1878,23 @@ var validateManifestRelationships = (manifestPath, manifest, discovery, decision
1914
1878
  };
1915
1879
  //#endregion
1916
1880
  //#region src/integration-validation/parser.ts
1917
- var START = "<!-- moldea:start -->";
1918
- var END = "<!-- moldea:end -->";
1919
- /** Finds one ordered marker pair on complete lines, matching the skill writer's region semantics. */
1881
+ var MARKERS = {
1882
+ start: "<!-- moldea:start -->",
1883
+ end: "<!-- moldea:end -->"
1884
+ };
1885
+ /**
1886
+ * Finds the managed block's region with the skill writer's region semantics: one start and one end
1887
+ * marker, each on its own line, the start first.
1888
+ * @param text The instruction document.
1889
+ * @returns The region, or why the document has none.
1890
+ */
1920
1891
  var parseManagedIntegrationRegion = (text) => {
1921
- const start = text.indexOf(START);
1922
- const end = text.indexOf(END);
1923
- if (start < 0 || end < start || text.indexOf(START, start + 21) >= 0 || text.indexOf(END, end + 19) >= 0) return null;
1924
- const startsLine = (offset) => offset === 0 || offset === 1 && text[0] === "" || text[offset - 1] === "\n";
1925
- if (!startsLine(start) || !startsLine(end)) return null;
1926
- const afterStart = start + 21;
1927
- const lineEnding = text.startsWith("\r\n", afterStart) ? "\r\n" : text[afterStart] === "\n" ? "\n" : null;
1928
- if (lineEnding === null) return null;
1929
- const afterEnd = end + 19;
1930
- const endLength = text.startsWith("\r\n", afterEnd) ? 2 : text[afterEnd] === "\n" ? 1 : 0;
1931
- if (endLength === 0 && afterEnd !== text.length) return null;
1932
- return {
1933
- start,
1934
- end: afterEnd + endLength,
1935
- lineEnding
1936
- };
1892
+ try {
1893
+ return findMarkedRegion(text, MARKERS) ?? "block-missing";
1894
+ } catch (error) {
1895
+ if (hasErrorCode(error, ERRORS.INVALID_MARKED_REGION)) return "block-invalid";
1896
+ throw error;
1897
+ }
1937
1898
  };
1938
1899
  /**
1939
1900
  * Extracts the relative installation path from the fixed relevance-gate command without executing it.
@@ -1941,9 +1902,9 @@ var parseManagedIntegrationRegion = (text) => {
1941
1902
  */
1942
1903
  var parseIntegrationBlock = (text) => {
1943
1904
  const region = parseManagedIntegrationRegion(text);
1944
- if (region === null) return {
1905
+ if (typeof region === "string") return {
1945
1906
  kind: "missing",
1946
- reason: text.includes(START) || text.includes(END) ? "block-invalid" : "block-missing"
1907
+ reason: region
1947
1908
  };
1948
1909
  const matches = text.slice(region.start, region.end).matchAll(/^node "<repo-root>\/([^"\r\n]+)\/scripts\/relevance-gate\.mjs"(?:[ \t\r]|$)/gm);
1949
1910
  const first = matches.next().value;
@@ -2028,19 +1989,14 @@ var readRetainedText = async (ledger, load) => {
2028
1989
  };
2029
1990
  /** Distinguishes missing and non-regular files without an extra entry lookup or following symlinks. */
2030
1991
  var getAbsentKind = (error) => error instanceof RepositorySourceException ? error.code === "ENTRY_NOT_FOUND" ? "missing" : error.code === "ENTRY_NOT_FILE" ? "non-regular" : null : null;
2031
- /**
2032
- * Explains why a linked instruction file cannot be read, or returns null for a readable link.
2033
- * @param resolution The resolver's classification, or null when no resolver is available.
2034
- * @returns The content-free link state, or null when the final target is a regular file.
2035
- */
2036
- var getUnreadableLinkState = (resolution) => {
2037
- if (resolution === null) return "unavailable";
2038
- if (resolution.state === "inside" || resolution.state === "outside") return resolution.targetType === "file" ? null : resolution.targetType;
2039
- return resolution.state;
2040
- };
2041
1992
  //#endregion
2042
1993
  //#region src/integration-validation/agents-inspection.ts
2043
1994
  var AGENTS_PATH$1 = parseRepositoryPath("/AGENTS.md");
1995
+ /** Reports an AGENTS.md link that doesn't lead to a file, with its reason as the qualifier. */
1996
+ var reportUnresolvedLink = (report, reason) => report("MOLDEA_INTEGRATION_LINK_UNRESOLVED", {
1997
+ entryKind: "symlink",
1998
+ reason
1999
+ }, reason);
2044
2000
  /**
2045
2001
  * Checks one readable AGENTS.md text against its referenced skill installation.
2046
2002
  * @returns A promise that settles after at most one integration warning was recorded.
@@ -2062,10 +2018,7 @@ var checkAgentsDocument = async (context, report, load, entryDetails) => {
2062
2018
  } catch (error) {
2063
2019
  const absentKind = getAbsentKind(error);
2064
2020
  if (absentKind === null) throw error;
2065
- return entryDetails["entryKind"] === "symlink" ? report("MOLDEA_INTEGRATION_UNVERIFIED", {
2066
- entryKind: "symlink",
2067
- linkState: "not-file"
2068
- }) : report("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: absentKind });
2021
+ return entryDetails["entryKind"] === "symlink" ? reportUnresolvedLink(report, absentKind === "missing" ? "missing" : "not-file") : report("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: absentKind });
2069
2022
  }
2070
2023
  try {
2071
2024
  if (document.text === null) return report("MOLDEA_INTEGRATION_BLOCK_MISSING", {
@@ -2128,9 +2081,9 @@ var checkAgentsDocument = async (context, report, load, entryDetails) => {
2128
2081
  }
2129
2082
  };
2130
2083
  /**
2131
- * Checks root AGENTS.md against its referenced skill installation. A symlinked AGENTS.md whose
2132
- * final target is a readable regular file, inside or outside the repository, is checked on the
2133
- * target text; any other link is reported as unverifiable without reading it.
2084
+ * Checks root AGENTS.md against its referenced skill installation. A symlinked AGENTS.md that
2085
+ * leads to a regular file in the repository is checked on that file's text; any other link is
2086
+ * reported with its reason, without reading anything outside the repository.
2134
2087
  * @param context The instruction view, repository reader, ledger, and warning recorder.
2135
2088
  * @returns What AGENTS.md is, including its link resolution, for the Claude Code check.
2136
2089
  * @throws
@@ -2145,7 +2098,7 @@ var checkAgentsDocument = async (context, report, load, entryDetails) => {
2145
2098
  */
2146
2099
  var inspectAgentsIntegration = async (context) => {
2147
2100
  const { instructions } = context;
2148
- const report = (code, details) => context.report(code, AGENTS_PATH$1, details);
2101
+ const report = (code, details, qualifier) => context.report(code, AGENTS_PATH$1, details, qualifier);
2149
2102
  const entry = await instructions.getEntry(AGENTS_PATH$1);
2150
2103
  if (entry === null) {
2151
2104
  report("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: "missing" });
@@ -2159,16 +2112,11 @@ var inspectAgentsIntegration = async (context) => {
2159
2112
  await checkAgentsDocument(context, report, () => instructions.readSourceFile(AGENTS_PATH$1), { entryKind: "file" });
2160
2113
  return { kind: "file" };
2161
2114
  }
2162
- const resolution = await instructions.resolveLink(AGENTS_PATH$1);
2163
- const linkState = getUnreadableLinkState(resolution);
2164
- if (linkState !== null || resolution === null) report("MOLDEA_INTEGRATION_UNVERIFIED", {
2165
- entryKind: "symlink",
2166
- linkState: linkState ?? "unavailable"
2167
- });
2168
- else await checkAgentsDocument(context, report, () => instructions.readLinkedSourceFile(AGENTS_PATH$1), {
2169
- entryKind: "symlink",
2170
- linkTarget: resolution.state
2171
- });
2115
+ const resolution = await resolveRepositoryLink(instructions, AGENTS_PATH$1);
2116
+ if (resolution.state === "file") {
2117
+ const { targetPath } = resolution;
2118
+ await checkAgentsDocument(context, report, () => instructions.readSourceFile(targetPath), { entryKind: "symlink" });
2119
+ } else reportUnresolvedLink(report, resolution.state);
2172
2120
  return {
2173
2121
  kind: "link",
2174
2122
  resolution
@@ -2180,13 +2128,16 @@ var AGENTS_PATH = parseRepositoryPath("/AGENTS.md");
2180
2128
  var CLAUDE_PATH = parseRepositoryPath("/CLAUDE.md");
2181
2129
  var NESTED_CLAUDE_PATH = parseRepositoryPath("/.claude/CLAUDE.md");
2182
2130
  var LOCAL_CLAUDE_PATH = parseRepositoryPath("/CLAUDE.local.md");
2183
- /** Recognizes a link between a Claude file and AGENTS.md without reading either file. */
2131
+ /** Returns the regular file AGENTS.md leads to, or null when it leads to none. */
2132
+ var getAgentsTargetPath = (agents) => {
2133
+ if (agents.kind === "file") return AGENTS_PATH;
2134
+ return agents.kind === "link" && agents.resolution.state === "file" ? agents.resolution.targetPath : null;
2135
+ };
2136
+ /** Recognizes a link between a Claude file and AGENTS.md by final target path, without reading. */
2184
2137
  var isLinkedToAgents = (path, resolution, agents) => {
2185
- const agentsResolution = agents.kind === "link" ? agents.resolution : null;
2186
- if (agentsResolution?.state === "inside" && agentsResolution.targetPath === path) return true;
2187
- if (resolution === null || resolution.state !== "inside" && resolution.state !== "outside") return false;
2188
- if (agents.kind === "file") return resolution.state === "inside" && resolution.targetPath === AGENTS_PATH;
2189
- return (agentsResolution?.state === "inside" || agentsResolution?.state === "outside") && agentsResolution.targetIdentity === resolution.targetIdentity;
2138
+ const agentsTargetPath = getAgentsTargetPath(agents);
2139
+ if (agents.kind === "link" && agentsTargetPath === path) return true;
2140
+ return resolution?.state === "file" && resolution.targetPath === agentsTargetPath;
2190
2141
  };
2191
2142
  /**
2192
2143
  * Determines whether one Claude Code file loads AGENTS.md through an import line, a link to the
@@ -2214,24 +2165,26 @@ var assessClaudeFile = async (context, path, agents) => {
2214
2165
  };
2215
2166
  let load = () => instructions.readSourceFile(path);
2216
2167
  if (entry.type === "symlink") {
2217
- const resolution = await instructions.resolveLink(path);
2168
+ const resolution = await resolveRepositoryLink(instructions, path);
2218
2169
  if (isLinkedToAgents(path, resolution, agents)) return { kind: "loads" };
2219
- const linkState = getUnreadableLinkState(resolution);
2220
- if (linkState !== null) return {
2221
- kind: "unverified",
2222
- linkState
2170
+ if (resolution.state !== "file") return {
2171
+ kind: "unresolved",
2172
+ reason: resolution.state
2223
2173
  };
2224
- load = () => instructions.readLinkedSourceFile(path);
2174
+ const { targetPath } = resolution;
2175
+ load = () => instructions.readSourceFile(targetPath);
2225
2176
  }
2226
2177
  let document;
2227
2178
  try {
2228
2179
  document = await readRetainedText(ledger, load);
2229
2180
  } catch (error) {
2230
- if (getAbsentKind(error) === null) throw error;
2231
- return entry.type === "symlink" ? {
2232
- kind: "unverified",
2233
- linkState: "not-file"
2234
- } : { kind: "absent" };
2181
+ const absentKind = getAbsentKind(error);
2182
+ if (absentKind === null) throw error;
2183
+ if (entry.type !== "symlink") return { kind: "absent" };
2184
+ return {
2185
+ kind: "unresolved",
2186
+ reason: absentKind === "missing" ? "missing" : "not-file"
2187
+ };
2235
2188
  }
2236
2189
  try {
2237
2190
  return document.text !== null && hasAgentsImport(document.text, path === NESTED_CLAUDE_PATH) ? { kind: "loads" } : {
@@ -2245,8 +2198,9 @@ var assessClaudeFile = async (context, path, agents) => {
2245
2198
  /**
2246
2199
  * Checks whether Claude Code loads AGENTS.md. When `/CLAUDE.md` or `/.claude/CLAUDE.md` exists,
2247
2200
  * only those shared files count; `/CLAUDE.local.md` counts only when neither exists. At most one
2248
- * Claude warning is recorded: unverifiable for the first unverifiable counted file when none
2249
- * loads AGENTS.md, otherwise a missing import for the governing file.
2201
+ * Claude warning is recorded: an unresolved link for the first counted file whose link doesn't
2202
+ * lead to a file in the repository when none loads AGENTS.md, otherwise a missing import for the
2203
+ * governing file.
2250
2204
  * @param context The instruction view, ledger, and warning recorder.
2251
2205
  * @param agents What root AGENTS.md is, as the AGENTS.md check observed it.
2252
2206
  * @returns A promise that settles after at most one Claude warning was recorded.
@@ -2278,12 +2232,13 @@ var inspectClaudeIntegration = async (context, agents) => {
2278
2232
  path: LOCAL_CLAUDE_PATH
2279
2233
  });
2280
2234
  }
2281
- const unverifiable = counted.find(({ assessment }) => assessment.kind === "unverified");
2282
- if (unverifiable?.assessment.kind === "unverified") {
2283
- context.report("MOLDEA_INTEGRATION_UNVERIFIED", unverifiable.path, {
2235
+ const unresolved = counted.find(({ assessment }) => assessment.kind === "unresolved");
2236
+ if (unresolved?.assessment.kind === "unresolved") {
2237
+ const { reason } = unresolved.assessment;
2238
+ context.report("MOLDEA_INTEGRATION_LINK_UNRESOLVED", unresolved.path, {
2284
2239
  entryKind: "symlink",
2285
- linkState: unverifiable.assessment.linkState
2286
- });
2240
+ reason
2241
+ }, reason);
2287
2242
  return;
2288
2243
  }
2289
2244
  const governing = counted[0];
@@ -2294,9 +2249,11 @@ var inspectClaudeIntegration = async (context, agents) => {
2294
2249
  /**
2295
2250
  * Checks the coding-agent integration: root AGENTS.md and the Claude Code instruction files
2296
2251
  * through the instruction view, and the referenced skill installation through the repository
2297
- * reader, with at most six entry lookups, four link resolutions, and five bounded reads.
2252
+ * reader. It reads at most four instruction files, follows at most 32 links for each with one
2253
+ * lookup and one link-text read per link, and makes at most five bounded reads, all inside the
2254
+ * repository.
2298
2255
  * @param reader The repository inspection reader for skill files and the managed asset.
2299
- * @param instructions The instruction view for the coding-agent instruction paths.
2256
+ * @param instructions The instruction view that routes the four instruction paths and links.
2300
2257
  * @param limits The immutable resource limits for the inspection.
2301
2258
  * @param signal Optional cancellation for repository lookups.
2302
2259
  * @returns Completed content-free integration warnings, never an execution or runtime-wiring claim.
@@ -2316,12 +2273,12 @@ var inspectCodingAgentIntegration = async (reader, instructions, limits, signal)
2316
2273
  instructions,
2317
2274
  ledger: getRetainedMemory(reader),
2318
2275
  reader,
2319
- report: (code, subject, details) => {
2276
+ report: (code, subject, details, qualifier) => {
2320
2277
  collector.add({
2321
2278
  code,
2322
2279
  path: subject,
2323
2280
  subject,
2324
- qualifier: null,
2281
+ qualifier: qualifier ?? null,
2325
2282
  entity: { integrationPath: subject },
2326
2283
  details
2327
2284
  });
@@ -2457,7 +2414,7 @@ var applyWarningAcceptances = (diagnostics, entries, completed, limits) => {
2457
2414
  const acceptance = acceptances.get(key);
2458
2415
  if (acceptance === void 0) return diagnostic;
2459
2416
  matched.add(key);
2460
- return freezeRecursively({
2417
+ return deepFreeze({
2461
2418
  ...diagnostic,
2462
2419
  accepted: true,
2463
2420
  reason: acceptance.entry.reason
@@ -2554,7 +2511,7 @@ var inspectMirrors = async (repository, manifestPath, agents, options, signal) =
2554
2511
  const collector = createCoreDiagnosticCollector(options.limits, "validate-project");
2555
2512
  const agentMirrors = [];
2556
2513
  const operationOptions = signal === void 0 ? void 0 : { signal };
2557
- for (const agent of [...agents].sort((left, right) => compareExactStrings(left.id, right.id))) {
2514
+ for (const agent of [...agents].sort((left, right) => compareCodePoints(left.id, right.id))) {
2558
2515
  const mirrors = [];
2559
2516
  if (agent.instruction !== null) {
2560
2517
  const declaredMirrors = agent.declaration.mirrors ?? [];
@@ -2569,7 +2526,7 @@ var inspectMirrors = async (repository, manifestPath, agents, options, signal) =
2569
2526
  });
2570
2527
  }
2571
2528
  const diagnostics = collector.finalize();
2572
- return freezeRecursively({
2529
+ return deepFreeze({
2573
2530
  agentMirrors,
2574
2531
  diagnostics,
2575
2532
  valid: diagnostics.length === 0
@@ -2613,7 +2570,7 @@ var readProjectFile = async (repository, path, options, signal) => {
2613
2570
  }
2614
2571
  }
2615
2572
  const diagnostics = collector.finalize();
2616
- return freezeRecursively({
2573
+ return deepFreeze({
2617
2574
  diagnostics,
2618
2575
  project,
2619
2576
  valid: diagnostics.length === 0
@@ -2644,7 +2601,7 @@ var readProjectAssets = async (repository, manifest, discovery, options, signal,
2644
2601
  const context = [];
2645
2602
  const inspectedProject = projectFile ?? await readProjectFile(repository, discovery.inventory.project, options, signal);
2646
2603
  addDiagnostics$2(collector, inspectedProject.diagnostics);
2647
- for (const path of [...discovery.inventory.context].sort(compareExactStrings)) {
2604
+ for (const path of [...discovery.inventory.context].sort(compareCodePoints)) {
2648
2605
  const result = await readRepositoryTextAsset(repository, path, options.limits, signal);
2649
2606
  addDiagnostics$2(collector, result.diagnostics);
2650
2607
  if (result.asset === null) continue;
@@ -2661,7 +2618,7 @@ var readProjectAssets = async (repository, manifest, discovery, options, signal,
2661
2618
  });
2662
2619
  }
2663
2620
  const diagnostics = collector.finalize();
2664
- return freezeRecursively({
2621
+ return deepFreeze({
2665
2622
  context,
2666
2623
  diagnostics,
2667
2624
  project: inspectedProject.project,
@@ -2671,7 +2628,7 @@ var readProjectAssets = async (repository, manifest, discovery, options, signal,
2671
2628
  //#endregion
2672
2629
  //#region src/project-index/index.ts
2673
2630
  var createIndexedDecisions = (decisions, manifest) => {
2674
- return [...decisions].sort((left, right) => compareExactStrings(left.id, right.id) || compareExactStrings(left.path, right.path)).map((decision) => ({
2631
+ return [...decisions].sort((left, right) => compareCodePoints(left.id, right.id) || compareCodePoints(left.path, right.path)).map((decision) => ({
2675
2632
  decision,
2676
2633
  relationships: manifest.value.decisions?.[decision.path] ?? null
2677
2634
  }));
@@ -2680,18 +2637,18 @@ var createIndexedAgents = (agents, agentMirrors) => {
2680
2637
  const mirrorsByAgent = new Map(agentMirrors.map((entry) => [entry.id, entry.mirrors]));
2681
2638
  const indexedAgents = [];
2682
2639
  if (mirrorsByAgent.size !== agents.length) return null;
2683
- for (const agent of [...agents].sort((left, right) => compareExactStrings(left.id, right.id))) {
2640
+ for (const agent of [...agents].sort((left, right) => compareCodePoints(left.id, right.id))) {
2684
2641
  const mirrors = mirrorsByAgent.get(agent.id);
2685
2642
  if (agent.description === null || agent.instruction === null || mirrors === void 0) return null;
2686
2643
  indexedAgents.push({
2687
- context: [...agent.declaration.context ?? []].sort(compareExactStrings),
2688
- decisions: [...agent.declaration.decisions ?? []].sort(compareExactStrings),
2644
+ context: [...agent.declaration.context ?? []].sort(compareCodePoints),
2645
+ decisions: [...agent.declaration.decisions ?? []].sort(compareCodePoints),
2689
2646
  declaration: agent.declaration,
2690
2647
  description: agent.description,
2691
2648
  handoffDescription: agent.handoffDescription,
2692
2649
  id: agent.id,
2693
2650
  instruction: agent.instruction,
2694
- mirrors: [...mirrors].sort((left, right) => compareExactStrings(left.path, right.path))
2651
+ mirrors: [...mirrors].sort((left, right) => compareCodePoints(left.path, right.path))
2695
2652
  });
2696
2653
  }
2697
2654
  return indexedAgents;
@@ -2705,14 +2662,14 @@ var createProjectIndex = (input) => {
2705
2662
  const agents = createIndexedAgents(input.agents, input.agentMirrors);
2706
2663
  if (agents === null) return null;
2707
2664
  const unresolved = input.manifest.value.unresolved ?? createNullPrototypeRecord([]);
2708
- return freezeRecursively({
2665
+ return deepFreeze({
2709
2666
  agents,
2710
- context: [...input.context].sort((left, right) => compareExactStrings(left.asset.path, right.asset.path)),
2667
+ context: [...input.context].sort((left, right) => compareCodePoints(left.asset.path, right.asset.path)),
2711
2668
  decisions: createIndexedDecisions(input.decisions, input.manifest),
2712
2669
  formatVersion: 1,
2713
2670
  manifest: input.manifest,
2714
2671
  project: input.project,
2715
- runtimes: [...input.runtimes].sort((left, right) => compareExactStrings(left.asset.path, right.asset.path)),
2672
+ runtimes: [...input.runtimes].sort((left, right) => compareCodePoints(left.asset.path, right.asset.path)),
2716
2673
  unresolved
2717
2674
  });
2718
2675
  };
@@ -2807,7 +2764,7 @@ var addRelationshipCandidates = (candidates, relationship, pointer, entity) => {
2807
2764
  };
2808
2765
  /** Adds related repository references from sorted unresolved requirements. */
2809
2766
  var addUnresolvedCandidates = (candidates, requirements, pointer, entity) => {
2810
- for (const requirementId of Object.keys(requirements ?? {}).sort(compareExactStrings)) {
2767
+ for (const requirementId of Object.keys(requirements ?? {}).sort(compareCodePoints)) {
2811
2768
  const requirement = requirements?.[requirementId];
2812
2769
  if (requirement === void 0) continue;
2813
2770
  addReferenceCandidates(candidates, requirement.related, childPointer(childPointer(pointer, requirementId), "related"), entity);
@@ -2866,7 +2823,7 @@ var addAgentCandidates = (candidates, agentId, agent) => {
2866
2823
  ...reference.symbol === void 0 ? {} : { symbol: reference.symbol }
2867
2824
  });
2868
2825
  }
2869
- for (const variableId of Object.keys(bindings?.variableProviders ?? {}).sort(compareExactStrings)) {
2826
+ for (const variableId of Object.keys(bindings?.variableProviders ?? {}).sort(compareCodePoints)) {
2870
2827
  const reference = bindings?.variableProviders?.[variableId];
2871
2828
  if (reference !== void 0) candidates.push({
2872
2829
  entity: {
@@ -2882,12 +2839,12 @@ var addAgentCandidates = (candidates, agentId, agent) => {
2882
2839
  }
2883
2840
  addImpactCandidates(candidates, agent.affectedBy, childPointer(pointer, "affectedBy"), entity);
2884
2841
  const toolsPointer = childPointer(pointer, "tools");
2885
- for (const capabilityId of Object.keys(agent.tools ?? {}).sort(compareExactStrings)) {
2842
+ for (const capabilityId of Object.keys(agent.tools ?? {}).sort(compareCodePoints)) {
2886
2843
  const capability = agent.tools?.[capabilityId];
2887
2844
  if (capability !== void 0) addCapabilityCandidates(candidates, capability, "tool", capabilityId, agentId, toolsPointer, [["inputSchema", capability.inputSchema], ["outputSchema", capability.outputSchema]]);
2888
2845
  }
2889
2846
  const skillsPointer = childPointer(pointer, "skills");
2890
- for (const capabilityId of Object.keys(agent.skills ?? {}).sort(compareExactStrings)) {
2847
+ for (const capabilityId of Object.keys(agent.skills ?? {}).sort(compareCodePoints)) {
2891
2848
  const capability = agent.skills?.[capabilityId];
2892
2849
  if (capability !== void 0) addCapabilityCandidates(candidates, capability, "skill", capabilityId, agentId, skillsPointer);
2893
2850
  }
@@ -2898,7 +2855,7 @@ var collectCandidates = (manifest) => {
2898
2855
  const candidates = [];
2899
2856
  for (const property of ["context", "decisions"]) {
2900
2857
  const relationships = manifest[property];
2901
- for (const referencedPath of Object.keys(relationships ?? {}).sort(compareExactStrings)) {
2858
+ for (const referencedPath of Object.keys(relationships ?? {}).sort(compareCodePoints)) {
2902
2859
  const relationship = relationships?.[referencedPath];
2903
2860
  if (relationship === void 0) continue;
2904
2861
  const pointer = childPointer(`/${property}`, referencedPath);
@@ -2907,11 +2864,11 @@ var collectCandidates = (manifest) => {
2907
2864
  }
2908
2865
  }
2909
2866
  addUnresolvedCandidates(candidates, manifest.unresolved, "/unresolved", null);
2910
- for (const agentId of Object.keys(manifest.agents ?? {}).sort(compareExactStrings)) {
2867
+ for (const agentId of Object.keys(manifest.agents ?? {}).sort(compareCodePoints)) {
2911
2868
  const agent = manifest.agents?.[agentId];
2912
2869
  if (agent !== void 0) addAgentCandidates(candidates, agentId, agent);
2913
2870
  }
2914
- return candidates.sort((left, right) => compareExactStrings(left.pointer, right.pointer));
2871
+ return candidates.sort((left, right) => compareCodePoints(left.pointer, right.pointer));
2915
2872
  };
2916
2873
  /** Tests whether discovery already owns a diagnostic for a path or one of its ancestors. */
2917
2874
  var isBlockedPath$1 = (path, blockedPaths) => {
@@ -3096,7 +3053,7 @@ var readRuntimeGuidance = async (repository, manifestPath, manifest, discovery,
3096
3053
  const runtimes = [];
3097
3054
  const discoveredPaths = new Set(discovery.inventory.runtimeGuidance);
3098
3055
  const blockedPaths = new Set(discovery.diagnostics.flatMap((diagnostic) => diagnostic.path === null ? [] : [diagnostic.path]));
3099
- for (const path of [...discoveredPaths].sort(compareExactStrings)) {
3056
+ for (const path of [...discoveredPaths].sort(compareCodePoints)) {
3100
3057
  const result = await readRepositoryTextAsset(repository, path, options.limits, signal);
3101
3058
  addDiagnostics$1(collector, result.diagnostics);
3102
3059
  if (result.asset === null) continue;
@@ -3109,7 +3066,7 @@ var readRuntimeGuidance = async (repository, manifestPath, manifest, discovery,
3109
3066
  }
3110
3067
  runtimes.push({ asset: result.asset });
3111
3068
  }
3112
- for (const agentId of Object.keys(manifest?.agents ?? {}).sort(compareExactStrings)) {
3069
+ for (const agentId of Object.keys(manifest?.agents ?? {}).sort(compareCodePoints)) {
3113
3070
  const guidance = manifest?.agents?.[agentId]?.runtime.guidance;
3114
3071
  if (guidance === void 0 || discoveredPaths.has(guidance) || isBlockedPath(guidance, blockedPaths)) continue;
3115
3072
  collector.add({
@@ -3121,7 +3078,7 @@ var readRuntimeGuidance = async (repository, manifestPath, manifest, discovery,
3121
3078
  });
3122
3079
  }
3123
3080
  const diagnostics = collector.finalize();
3124
- return freezeRecursively({
3081
+ return deepFreeze({
3125
3082
  diagnostics,
3126
3083
  runtimes,
3127
3084
  valid: diagnostics.length === 0
@@ -3222,7 +3179,7 @@ var inspectUniversalProject = async (context, options) => {
3222
3179
  "MOLDEA_INTEGRATION_BLOCK_MISSING",
3223
3180
  "MOLDEA_INTEGRATION_SKILL_MISSING",
3224
3181
  "MOLDEA_INTEGRATION_BLOCK_STALE",
3225
- "MOLDEA_INTEGRATION_UNVERIFIED",
3182
+ "MOLDEA_INTEGRATION_LINK_UNRESOLVED",
3226
3183
  "MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING"
3227
3184
  ], ...patterns.completed ? ["MOLDEA_IMPACT_PATTERN_UNMATCHED"] : []]), options.limits);
3228
3185
  const project = !diagnostics.some((diagnostic) => diagnostic.severity === "error") && indexedManifest !== null && projectAssets.project !== null ? createProjectIndex({
@@ -3234,7 +3191,7 @@ var inspectUniversalProject = async (context, options) => {
3234
3191
  project: projectAssets.project,
3235
3192
  runtimes: runtimeGuidance.runtimes
3236
3193
  }) : null;
3237
- return freezeRecursively({
3194
+ return deepFreeze({
3238
3195
  diagnostics,
3239
3196
  coverage,
3240
3197
  formatVersion,
@@ -3243,9 +3200,6 @@ var inspectUniversalProject = async (context, options) => {
3243
3200
  };
3244
3201
  //#endregion
3245
3202
  //#region src/project-validation/index.ts
3246
- var isRecord = (candidate) => {
3247
- return typeof candidate === "object" && candidate !== null && !Array.isArray(candidate);
3248
- };
3249
3203
  var invalidArgument$1 = () => {
3250
3204
  throw new CoreOperationException({
3251
3205
  code: "INVALID_ARGUMENT",
@@ -3253,35 +3207,20 @@ var invalidArgument$1 = () => {
3253
3207
  });
3254
3208
  };
3255
3209
  var isRepositoryReader = (candidate) => {
3256
- return isRecord(candidate) && isRecord(candidate["snapshot"]) && typeof candidate["snapshot"]["id"] === "string" && typeof candidate["snapshot"]["sourceKind"] === "string" && typeof candidate["compare"] === "function" && typeof candidate["getEntry"] === "function" && typeof candidate["listEntriesPage"] === "function" && typeof candidate["readFilePage"] === "function";
3257
- };
3258
- var isLinkResolver = (candidate) => {
3259
- return isRecord(candidate) && isRecord(candidate["snapshot"]) && typeof candidate["snapshot"]["id"] === "string" && typeof candidate["snapshot"]["sourceKind"] === "string" && typeof candidate["resolveLink"] === "function" && typeof candidate["readLinkTargetPage"] === "function";
3260
- };
3261
- var validateInstructions = (candidate) => {
3262
- if (!isRecord(candidate) || Reflect.ownKeys(candidate).some((key) => key !== "reader" && key !== "linkResolver")) return invalidArgument$1();
3263
- const reader = candidate["reader"];
3264
- const linkResolver = candidate["linkResolver"];
3265
- if (!isRepositoryReader(reader)) return invalidArgument$1();
3266
- if (linkResolver === void 0) return { reader };
3267
- if (!isLinkResolver(linkResolver) || linkResolver.snapshot.id !== reader.snapshot.id) return invalidArgument$1();
3268
- return {
3269
- linkResolver,
3270
- reader
3271
- };
3210
+ return isObjectValid(candidate, true) && isObjectValid(candidate["snapshot"], true) && typeof candidate["snapshot"]["id"] === "string" && typeof candidate["snapshot"]["sourceKind"] === "string" && typeof candidate["compare"] === "function" && typeof candidate["getEntry"] === "function" && typeof candidate["listEntriesPage"] === "function" && typeof candidate["readFilePage"] === "function" && typeof candidate["readLinkText"] === "function";
3272
3211
  };
3273
3212
  var isAbortSignal = (candidate) => {
3274
- return isRecord(candidate) && typeof candidate["aborted"] === "boolean" && typeof candidate["addEventListener"] === "function" && typeof candidate["removeEventListener"] === "function";
3213
+ return isObjectValid(candidate, true) && typeof candidate["aborted"] === "boolean" && typeof candidate["addEventListener"] === "function" && typeof candidate["removeEventListener"] === "function";
3275
3214
  };
3276
3215
  var validateInput = (candidate) => {
3277
3216
  try {
3278
- if (!isRecord(candidate)) return invalidArgument$1();
3217
+ if (!isObjectValid(candidate, true)) return invalidArgument$1();
3279
3218
  const repository = candidate["repository"];
3280
3219
  const instructions = candidate["instructions"];
3281
3220
  const signal = candidate["signal"];
3282
- if (Reflect.ownKeys(candidate).some((key) => key !== "repository" && key !== "instructions" && key !== "signal") || !isRepositoryReader(repository) || signal !== void 0 && !isAbortSignal(signal)) return invalidArgument$1();
3221
+ if (Reflect.ownKeys(candidate).some((key) => key !== "repository" && key !== "instructions" && key !== "signal") || !isRepositoryReader(repository) || instructions !== void 0 && !isRepositoryReader(instructions) || signal !== void 0 && !isAbortSignal(signal)) return invalidArgument$1();
3283
3222
  return {
3284
- ...instructions === void 0 ? {} : { instructions: validateInstructions(instructions) },
3223
+ ...instructions === void 0 ? {} : { instructions },
3285
3224
  repository,
3286
3225
  ...signal === void 0 ? {} : { signal }
3287
3226
  };
@@ -3292,7 +3231,7 @@ var validateInput = (candidate) => {
3292
3231
  };
3293
3232
  /**
3294
3233
  * Inspects one coherent repository snapshot through universal file and export validation.
3295
- * @param input The untrusted source-neutral reader, optional instruction source, and signal.
3234
+ * @param input The untrusted source-neutral reader, optional instruction reader, and signal.
3296
3235
  * @param options The immutable Core configuration snapshot.
3297
3236
  * @returns A promise resolving to the frozen all-or-nothing project inspection result.
3298
3237
  * @throws
@@ -3321,7 +3260,7 @@ var validateProjectState = async (input, options) => {
3321
3260
  }, operationOptions);
3322
3261
  session.throwIfAborted();
3323
3262
  const counts = countDiagnosticsBySeverity(universal.diagnostics);
3324
- return freezeRecursively({
3263
+ return deepFreeze({
3325
3264
  project: universal.project,
3326
3265
  resourceUsage: session.getResourceUsage(),
3327
3266
  result: {
@@ -3465,7 +3404,7 @@ var decodeCursor = (cursor, inspectionDigest, view) => {
3465
3404
  if (lastKey.length === 0 || match[4] !== createCursorChecksum(inspectionDigest, lastKey, view)) return invalidArgument();
3466
3405
  return lastKey;
3467
3406
  };
3468
- var createViews = (items) => freezeRecursively({
3407
+ var createViews = (items) => deepFreeze({
3469
3408
  all: items,
3470
3409
  diagnostics: items.filter(({ item }) => item.kind === "diagnostic"),
3471
3410
  coverage: items.filter(({ item }) => item.kind === "coverage"),
@@ -3564,7 +3503,7 @@ var createPreparedProjectInspection = (input) => {
3564
3503
  const { counts, coverageCounts, formatVersion, items, maxEntries, preparedBytes, resourceUsage: validationUsage, source, summary, valid } = input;
3565
3504
  const views = createViews(items);
3566
3505
  const inspectionDigest = createInspectionDigest(counts, coverageCounts, formatVersion, items, summary, valid);
3567
- const resourceUsage = freezeRecursively({
3506
+ const resourceUsage = deepFreeze({
3568
3507
  canonicalBytes: validationUsage.canonicalBytes,
3569
3508
  peakRetainedBytes: Math.max(validationUsage.peakRetainedBytes, validationUsage.retainedBytes + preparedBytes),
3570
3509
  preparedBytes,
@@ -3582,7 +3521,7 @@ var createPreparedProjectInspection = (input) => {
3582
3521
  };
3583
3522
  });
3584
3523
  const nextCursor = records.at(-1)?.nextCursor ?? null;
3585
- return freezeRecursively({
3524
+ return deepFreeze({
3586
3525
  counts,
3587
3526
  coverageCounts,
3588
3527
  formatVersion,
@@ -3599,7 +3538,7 @@ var createPreparedProjectInspection = (input) => {
3599
3538
  view: pageInput.view
3600
3539
  });
3601
3540
  };
3602
- return freezeRecursively({
3541
+ return deepFreeze({
3603
3542
  counts,
3604
3543
  coverageCounts,
3605
3544
  formatVersion,
@@ -3647,8 +3586,8 @@ var createProjectInspection = async (input, options) => {
3647
3586
  warnings: state.result.warningCount,
3648
3587
  acceptedWarnings: state.result.acceptedWarningCount
3649
3588
  }, options.limits.maxRetainedBytes);
3650
- const counts = freezeRecursively(estimate.counts);
3651
- const items = freezeRecursively(createKeyedItems(iterateProjectInspectionItems(state)));
3589
+ const counts = deepFreeze(estimate.counts);
3590
+ const items = deepFreeze(createKeyedItems(iterateProjectInspectionItems(state)));
3652
3591
  return createPreparedProjectInspection({
3653
3592
  counts,
3654
3593
  coverageCounts: state.result.coverageCounts,
@@ -3674,7 +3613,7 @@ var core_exports = /* @__PURE__ */ __exportAll({ createCore: () => createCore })
3674
3613
  */
3675
3614
  var createCore = (options) => {
3676
3615
  const snapshot = normalizeCoreOptions(options);
3677
- return freezeRecursively({
3616
+ return deepFreeze({
3678
3617
  calculateContentDigest: (input) => {
3679
3618
  const operation = createCoreOperationOptionsSnapshot(snapshot);
3680
3619
  return calculateContentDigest(input, operation.limits);
@@ -3694,4 +3633,4 @@ var createCore = (options) => {
3694
3633
  //#endregion
3695
3634
  export { createCore as n, parseIntegrationBlock as r, core_exports as t };
3696
3635
 
3697
- //# sourceMappingURL=core-CMuQrqRI.js.map
3636
+ //# sourceMappingURL=core-CFmT3SRC.js.map