@moldea.ai/core 8.0.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.
- package/README.md +2 -2
- package/dist/agent-asset-validation/index.d.ts.map +1 -1
- package/dist/agent-assets/index.d.ts.map +1 -1
- package/dist/analysis-worker.js +5 -5
- package/dist/canonical-content-page/index.d.ts.map +1 -1
- package/dist/canonical-discovery/index.d.ts.map +1 -1
- package/dist/chunks/{core-BCMf-ig9.js → core-CFmT3SRC.js} +90 -94
- package/dist/chunks/core-CFmT3SRC.js.map +1 -0
- package/dist/chunks/{errors-CvWn6gr2.js → errors-Uvb-9X1u.js} +27 -67
- package/dist/chunks/errors-Uvb-9X1u.js.map +1 -0
- package/dist/chunks/{exceptions-CYf1pCKf.js → exceptions-AT654xUL.js} +10 -15
- package/dist/chunks/exceptions-AT654xUL.js.map +1 -0
- package/dist/chunks/{lifecycle-DwuevNoO.js → lifecycle-DuAHgnYH.js} +2 -2
- package/dist/chunks/{lifecycle-DwuevNoO.js.map → lifecycle-DuAHgnYH.js.map} +1 -1
- package/dist/chunks/{options-l3kVfA-K.js → options-C5360E_N.js} +20 -171
- package/dist/chunks/options-C5360E_N.js.map +1 -0
- package/dist/chunks/{repository-rpc-DgYwMaGv.js → repository-rpc-B9YaeLba.js} +31 -25
- package/dist/chunks/repository-rpc-B9YaeLba.js.map +1 -0
- package/dist/chunks/{scope-D9BYchNI.js → scope-CNg6Gnpi.js} +214 -151
- package/dist/chunks/scope-CNg6Gnpi.js.map +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/decision/index.d.ts.map +1 -1
- package/dist/decision-graph/index.d.ts.map +1 -1
- package/dist/decision-graph-validation/index.d.ts.map +1 -1
- package/dist/decision-validation/index.d.ts.map +1 -1
- package/dist/diagnostic-utilities/index.d.ts.map +1 -1
- package/dist/exceptions/index.d.ts +1 -1
- package/dist/exceptions/index.d.ts.map +1 -1
- package/dist/format-validation/index.d.ts +0 -4
- package/dist/format-validation/index.d.ts.map +1 -1
- package/dist/immutable/index.d.ts +0 -6
- package/dist/immutable/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/integration-validation/agents-inspection.d.ts.map +1 -1
- package/dist/integration-validation/parser.d.ts +9 -3
- package/dist/integration-validation/parser.d.ts.map +1 -1
- package/dist/integration-validation/types.d.ts +0 -5
- package/dist/integration-validation/types.d.ts.map +1 -1
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest-relationship-validation/index.d.ts.map +1 -1
- package/dist/manifest-validation/index.d.ts.map +1 -1
- package/dist/mirrors/index.d.ts.map +1 -1
- package/dist/node-inspection/client.d.ts.map +1 -1
- package/dist/node-inspection/protocol.d.ts.map +1 -1
- package/dist/node-inspection/repository-rpc.d.ts.map +1 -1
- package/dist/node-runner.js +3 -3
- package/dist/node.js +13 -22
- package/dist/node.js.map +1 -1
- package/dist/options/index.d.ts.map +1 -1
- package/dist/project-assets/index.d.ts.map +1 -1
- package/dist/project-index/index.d.ts.map +1 -1
- package/dist/project-inspection/index.d.ts.map +1 -1
- package/dist/project-validation/index.d.ts.map +1 -1
- package/dist/repository-reference-validation/index.d.ts.map +1 -1
- package/dist/repository-text/index.d.ts.map +1 -1
- package/dist/runtime-guidance/index.d.ts.map +1 -1
- package/dist/runtime-placeholder-validation/index.d.ts.map +1 -1
- package/dist/scope-matching/matching.d.ts.map +1 -1
- package/dist/scope-matching/scope.d.ts.map +1 -1
- package/dist/scope-matching/validations.d.ts +0 -2
- package/dist/scope-matching/validations.d.ts.map +1 -1
- package/dist/scope.js +2 -2
- package/dist/text/index.d.ts.map +1 -1
- package/dist/universal-project-inspection/index.d.ts.map +1 -1
- package/dist/warning-acceptance/acceptance.d.ts.map +1 -1
- package/dist/yaml/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/chunks/core-BCMf-ig9.js.map +0 -1
- package/dist/chunks/errors-CvWn6gr2.js.map +0 -1
- package/dist/chunks/exceptions-CYf1pCKf.js.map +0 -1
- package/dist/chunks/options-l3kVfA-K.js.map +0 -1
- package/dist/chunks/repository-rpc-DgYwMaGv.js.map +0 -1
- package/dist/chunks/scope-D9BYchNI.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as CoreOperationException } from "./exceptions-
|
|
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-
|
|
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";
|
|
4
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;
|
|
@@ -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
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
397
|
+
return deepFreeze({
|
|
396
398
|
decision: {
|
|
397
399
|
asset,
|
|
398
400
|
body: sections.body,
|
|
@@ -849,7 +851,7 @@ var validateAgentDescription = (asset, agentId, kind, limits) => {
|
|
|
849
851
|
path: asset.path
|
|
850
852
|
});
|
|
851
853
|
const finalizedDiagnostics = diagnostics.finalize();
|
|
852
|
-
return
|
|
854
|
+
return deepFreeze({
|
|
853
855
|
description: finalizedDiagnostics.length === 0 ? {
|
|
854
856
|
asset,
|
|
855
857
|
scalarLength,
|
|
@@ -876,7 +878,7 @@ var validateAgentInstruction = (asset, agentId, limits) => {
|
|
|
876
878
|
entity: { agentId },
|
|
877
879
|
path: asset.path
|
|
878
880
|
});
|
|
879
|
-
return
|
|
881
|
+
return deepFreeze({
|
|
880
882
|
diagnostics: diagnostics.finalize(),
|
|
881
883
|
instruction: null,
|
|
882
884
|
valid: false
|
|
@@ -894,7 +896,7 @@ var validateAgentInstruction = (asset, agentId, limits) => {
|
|
|
894
896
|
path: asset.path
|
|
895
897
|
});
|
|
896
898
|
const finalizedDiagnostics = diagnostics.finalize();
|
|
897
|
-
return
|
|
899
|
+
return deepFreeze({
|
|
898
900
|
diagnostics: finalizedDiagnostics,
|
|
899
901
|
instruction: asset,
|
|
900
902
|
valid: finalizedDiagnostics.length === 0
|
|
@@ -934,7 +936,7 @@ var readRepositoryTextAsset = async (repository, path, limits, signal) => {
|
|
|
934
936
|
content,
|
|
935
937
|
path
|
|
936
938
|
}, limits, "validate-project");
|
|
937
|
-
if (!normalized.valid || normalized.text === null) return
|
|
939
|
+
if (!normalized.valid || normalized.text === null) return deepFreeze({
|
|
938
940
|
asset: null,
|
|
939
941
|
diagnostics: normalized.diagnostics,
|
|
940
942
|
valid: false
|
|
@@ -946,7 +948,7 @@ var readRepositoryTextAsset = async (repository, path, limits, signal) => {
|
|
|
946
948
|
scalarLength: normalized.text.scalarLength,
|
|
947
949
|
utf8ByteLength: normalized.text.utf8ByteLength
|
|
948
950
|
};
|
|
949
|
-
return
|
|
951
|
+
return deepFreeze({
|
|
950
952
|
asset,
|
|
951
953
|
diagnostics: [],
|
|
952
954
|
valid: true
|
|
@@ -1080,7 +1082,7 @@ var validateRuntimePlaceholders = (manifestPath, agentId, instruction, declaredV
|
|
|
1080
1082
|
cursor = instruction.content.length;
|
|
1081
1083
|
}
|
|
1082
1084
|
}
|
|
1083
|
-
for (const variableId of [...occurrences.keys()].sort(
|
|
1085
|
+
for (const variableId of [...occurrences.keys()].sort(compareCodePoints)) {
|
|
1084
1086
|
if (declaredVariables[variableId] !== void 0) continue;
|
|
1085
1087
|
const occurrence = occurrences.get(variableId);
|
|
1086
1088
|
if (occurrence === void 0) continue;
|
|
@@ -1095,7 +1097,7 @@ var validateRuntimePlaceholders = (manifestPath, agentId, instruction, declaredV
|
|
|
1095
1097
|
range: occurrence.firstRange
|
|
1096
1098
|
});
|
|
1097
1099
|
}
|
|
1098
|
-
for (const variableId of Object.keys(declaredVariables).sort(
|
|
1100
|
+
for (const variableId of Object.keys(declaredVariables).sort(compareCodePoints)) {
|
|
1099
1101
|
if (occurrences.has(variableId)) continue;
|
|
1100
1102
|
collector.add({
|
|
1101
1103
|
code: "MOLDEA_VARIABLE_UNUSED",
|
|
@@ -1175,7 +1177,7 @@ var inspectAgentAssets = async (repository, manifest, discovery, options, signal
|
|
|
1175
1177
|
entity: { agentId: discovered.id },
|
|
1176
1178
|
path: discovered.path
|
|
1177
1179
|
});
|
|
1178
|
-
for (const agentId of [...registeredIds].sort(
|
|
1180
|
+
for (const agentId of [...registeredIds].sort(compareCodePoints)) {
|
|
1179
1181
|
const declaration = registeredAgents[agentId];
|
|
1180
1182
|
if (declaration === void 0) continue;
|
|
1181
1183
|
const discovered = discoveredById.get(agentId);
|
|
@@ -1224,7 +1226,7 @@ var inspectAgentAssets = async (repository, manifest, discovery, options, signal
|
|
|
1224
1226
|
});
|
|
1225
1227
|
}
|
|
1226
1228
|
const diagnostics = collector.finalize();
|
|
1227
|
-
return
|
|
1229
|
+
return deepFreeze({
|
|
1228
1230
|
agents,
|
|
1229
1231
|
diagnostics,
|
|
1230
1232
|
valid: diagnostics.length === 0
|
|
@@ -1403,10 +1405,10 @@ var retainCanonicalFile = (inventory, path, fileKind, agentId) => {
|
|
|
1403
1405
|
};
|
|
1404
1406
|
var finalizeInventory = (working) => {
|
|
1405
1407
|
const sortPaths = (paths) => {
|
|
1406
|
-
return [...paths].sort(
|
|
1408
|
+
return [...paths].sort(compareCodePoints);
|
|
1407
1409
|
};
|
|
1408
|
-
const agents = [...working.agents.values()].sort((left, right) =>
|
|
1409
|
-
return
|
|
1410
|
+
const agents = [...working.agents.values()].sort((left, right) => compareCodePoints(left.id, right.id)).map((agent) => deepFreeze({ ...agent }));
|
|
1411
|
+
return deepFreeze({
|
|
1410
1412
|
agents,
|
|
1411
1413
|
context: sortPaths(working.context),
|
|
1412
1414
|
decisions: sortPaths(working.decisions),
|
|
@@ -1417,7 +1419,7 @@ var finalizeInventory = (working) => {
|
|
|
1417
1419
|
};
|
|
1418
1420
|
var finalizeResult = (working, diagnostics) => {
|
|
1419
1421
|
const finalizedDiagnostics = diagnostics.finalize();
|
|
1420
|
-
return
|
|
1422
|
+
return deepFreeze({
|
|
1421
1423
|
diagnostics: finalizedDiagnostics,
|
|
1422
1424
|
inventory: finalizeInventory(working),
|
|
1423
1425
|
valid: finalizedDiagnostics.length === 0
|
|
@@ -1541,7 +1543,7 @@ var discoverCanonicalAssets = async (repository, limits, signal, foundations) =>
|
|
|
1541
1543
|
//#endregion
|
|
1542
1544
|
//#region src/decision-graph-validation/index.ts
|
|
1543
1545
|
var sortCandidates = (candidates) => {
|
|
1544
|
-
return [...candidates].sort((left, right) =>
|
|
1546
|
+
return [...candidates].sort((left, right) => compareCodePoints(left.path, right.path));
|
|
1545
1547
|
};
|
|
1546
1548
|
var buildGraphIndex = (candidates) => {
|
|
1547
1549
|
const mutableGroups = /* @__PURE__ */ new Map();
|
|
@@ -1553,7 +1555,7 @@ var buildGraphIndex = (candidates) => {
|
|
|
1553
1555
|
}
|
|
1554
1556
|
const candidateGroups = /* @__PURE__ */ new Map();
|
|
1555
1557
|
const nodes = /* @__PURE__ */ new Map();
|
|
1556
|
-
for (const id of [...mutableGroups.keys()].sort(
|
|
1558
|
+
for (const id of [...mutableGroups.keys()].sort(compareCodePoints)) {
|
|
1557
1559
|
const group = mutableGroups.get(id) ?? [];
|
|
1558
1560
|
candidateGroups.set(id, group);
|
|
1559
1561
|
if (group.length === 1 && group[0]?.decision !== null) {
|
|
@@ -1666,7 +1668,7 @@ var buildReverseEdges = (index) => {
|
|
|
1666
1668
|
const reverseEdges = /* @__PURE__ */ new Map();
|
|
1667
1669
|
for (const id of index.nodes.keys()) reverseEdges.set(id, []);
|
|
1668
1670
|
for (const [sourceId, targets] of index.edges) for (const targetId of targets) reverseEdges.get(targetId)?.push(sourceId);
|
|
1669
|
-
for (const sources of reverseEdges.values()) sources.sort(
|
|
1671
|
+
for (const sources of reverseEdges.values()) sources.sort(compareCodePoints);
|
|
1670
1672
|
return reverseEdges;
|
|
1671
1673
|
};
|
|
1672
1674
|
var findStronglyConnectedComponents = (index) => {
|
|
@@ -1687,9 +1689,9 @@ var findStronglyConnectedComponents = (index) => {
|
|
|
1687
1689
|
stack.push(sourceId);
|
|
1688
1690
|
}
|
|
1689
1691
|
}
|
|
1690
|
-
components.push(component.sort(
|
|
1692
|
+
components.push(component.sort(compareCodePoints));
|
|
1691
1693
|
}
|
|
1692
|
-
return components.sort((left, right) =>
|
|
1694
|
+
return components.sort((left, right) => compareCodePoints(left[0] ?? "", right[0] ?? ""));
|
|
1693
1695
|
};
|
|
1694
1696
|
var collectCycleDiagnostics = (index, diagnostics) => {
|
|
1695
1697
|
for (const component of findStronglyConnectedComponents(index)) {
|
|
@@ -1740,7 +1742,7 @@ var invalidSourceData = (path) => {
|
|
|
1740
1742
|
};
|
|
1741
1743
|
var sortDecisions = (decisions) => {
|
|
1742
1744
|
return [...decisions].sort((left, right) => {
|
|
1743
|
-
return
|
|
1745
|
+
return compareCodePoints(left.id, right.id) || compareCodePoints(left.path, right.path);
|
|
1744
1746
|
});
|
|
1745
1747
|
};
|
|
1746
1748
|
/**
|
|
@@ -1768,7 +1770,7 @@ var readDecisionGraph = async (repository, paths, options, signal) => {
|
|
|
1768
1770
|
const candidates = [];
|
|
1769
1771
|
const decisions = [];
|
|
1770
1772
|
const readOptions = signal === void 0 ? void 0 : { signal };
|
|
1771
|
-
for (const path of [...paths].sort(
|
|
1773
|
+
for (const path of [...paths].sort(compareCodePoints)) {
|
|
1772
1774
|
const content = await repository.readCompleteFile(path, readOptions);
|
|
1773
1775
|
if (!(content instanceof Uint8Array)) return invalidSourceData(path);
|
|
1774
1776
|
const parsed = await parseDecisionDocument({
|
|
@@ -1785,7 +1787,7 @@ var readDecisionGraph = async (repository, paths, options, signal) => {
|
|
|
1785
1787
|
}
|
|
1786
1788
|
for (const diagnostic of validateDecisionGraph(candidates, options.limits)) diagnostics.merge(diagnostic);
|
|
1787
1789
|
const finalizedDiagnostics = diagnostics.finalize();
|
|
1788
|
-
return
|
|
1790
|
+
return deepFreeze({
|
|
1789
1791
|
decisions: sortDecisions(decisions),
|
|
1790
1792
|
diagnostics: finalizedDiagnostics,
|
|
1791
1793
|
valid: finalizedDiagnostics.length === 0
|
|
@@ -1863,9 +1865,9 @@ var validateManifestRelationships = (manifestPath, manifest, discovery, decision
|
|
|
1863
1865
|
validAgentContextPaths,
|
|
1864
1866
|
validTopLevelContextPaths
|
|
1865
1867
|
};
|
|
1866
|
-
for (const referencedPathValue of Object.keys(manifest.context ?? {}).sort(
|
|
1867
|
-
for (const referencedPathValue of Object.keys(manifest.decisions ?? {}).sort(
|
|
1868
|
-
for (const agentId of Object.keys(manifest.agents ?? {}).sort(
|
|
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)) {
|
|
1869
1871
|
const agent = manifest.agents?.[agentId];
|
|
1870
1872
|
if (agent === void 0) continue;
|
|
1871
1873
|
const escapedAgentId = escapeJsonPointerSegment(agentId);
|
|
@@ -1876,26 +1878,23 @@ var validateManifestRelationships = (manifestPath, manifest, discovery, decision
|
|
|
1876
1878
|
};
|
|
1877
1879
|
//#endregion
|
|
1878
1880
|
//#region src/integration-validation/parser.ts
|
|
1879
|
-
var
|
|
1880
|
-
|
|
1881
|
-
|
|
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
|
+
*/
|
|
1882
1891
|
var parseManagedIntegrationRegion = (text) => {
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
const lineEnding = text.startsWith("\r\n", afterStart) ? "\r\n" : text[afterStart] === "\n" ? "\n" : null;
|
|
1890
|
-
if (lineEnding === null) return null;
|
|
1891
|
-
const afterEnd = end + 19;
|
|
1892
|
-
const endLength = text.startsWith("\r\n", afterEnd) ? 2 : text[afterEnd] === "\n" ? 1 : 0;
|
|
1893
|
-
if (endLength === 0 && afterEnd !== text.length) return null;
|
|
1894
|
-
return {
|
|
1895
|
-
start,
|
|
1896
|
-
end: afterEnd + endLength,
|
|
1897
|
-
lineEnding
|
|
1898
|
-
};
|
|
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
|
+
}
|
|
1899
1898
|
};
|
|
1900
1899
|
/**
|
|
1901
1900
|
* Extracts the relative installation path from the fixed relevance-gate command without executing it.
|
|
@@ -1903,9 +1902,9 @@ var parseManagedIntegrationRegion = (text) => {
|
|
|
1903
1902
|
*/
|
|
1904
1903
|
var parseIntegrationBlock = (text) => {
|
|
1905
1904
|
const region = parseManagedIntegrationRegion(text);
|
|
1906
|
-
if (region ===
|
|
1905
|
+
if (typeof region === "string") return {
|
|
1907
1906
|
kind: "missing",
|
|
1908
|
-
reason:
|
|
1907
|
+
reason: region
|
|
1909
1908
|
};
|
|
1910
1909
|
const matches = text.slice(region.start, region.end).matchAll(/^node "<repo-root>\/([^"\r\n]+)\/scripts\/relevance-gate\.mjs"(?:[ \t\r]|$)/gm);
|
|
1911
1910
|
const first = matches.next().value;
|
|
@@ -2415,7 +2414,7 @@ var applyWarningAcceptances = (diagnostics, entries, completed, limits) => {
|
|
|
2415
2414
|
const acceptance = acceptances.get(key);
|
|
2416
2415
|
if (acceptance === void 0) return diagnostic;
|
|
2417
2416
|
matched.add(key);
|
|
2418
|
-
return
|
|
2417
|
+
return deepFreeze({
|
|
2419
2418
|
...diagnostic,
|
|
2420
2419
|
accepted: true,
|
|
2421
2420
|
reason: acceptance.entry.reason
|
|
@@ -2512,7 +2511,7 @@ var inspectMirrors = async (repository, manifestPath, agents, options, signal) =
|
|
|
2512
2511
|
const collector = createCoreDiagnosticCollector(options.limits, "validate-project");
|
|
2513
2512
|
const agentMirrors = [];
|
|
2514
2513
|
const operationOptions = signal === void 0 ? void 0 : { signal };
|
|
2515
|
-
for (const agent of [...agents].sort((left, right) =>
|
|
2514
|
+
for (const agent of [...agents].sort((left, right) => compareCodePoints(left.id, right.id))) {
|
|
2516
2515
|
const mirrors = [];
|
|
2517
2516
|
if (agent.instruction !== null) {
|
|
2518
2517
|
const declaredMirrors = agent.declaration.mirrors ?? [];
|
|
@@ -2527,7 +2526,7 @@ var inspectMirrors = async (repository, manifestPath, agents, options, signal) =
|
|
|
2527
2526
|
});
|
|
2528
2527
|
}
|
|
2529
2528
|
const diagnostics = collector.finalize();
|
|
2530
|
-
return
|
|
2529
|
+
return deepFreeze({
|
|
2531
2530
|
agentMirrors,
|
|
2532
2531
|
diagnostics,
|
|
2533
2532
|
valid: diagnostics.length === 0
|
|
@@ -2571,7 +2570,7 @@ var readProjectFile = async (repository, path, options, signal) => {
|
|
|
2571
2570
|
}
|
|
2572
2571
|
}
|
|
2573
2572
|
const diagnostics = collector.finalize();
|
|
2574
|
-
return
|
|
2573
|
+
return deepFreeze({
|
|
2575
2574
|
diagnostics,
|
|
2576
2575
|
project,
|
|
2577
2576
|
valid: diagnostics.length === 0
|
|
@@ -2602,7 +2601,7 @@ var readProjectAssets = async (repository, manifest, discovery, options, signal,
|
|
|
2602
2601
|
const context = [];
|
|
2603
2602
|
const inspectedProject = projectFile ?? await readProjectFile(repository, discovery.inventory.project, options, signal);
|
|
2604
2603
|
addDiagnostics$2(collector, inspectedProject.diagnostics);
|
|
2605
|
-
for (const path of [...discovery.inventory.context].sort(
|
|
2604
|
+
for (const path of [...discovery.inventory.context].sort(compareCodePoints)) {
|
|
2606
2605
|
const result = await readRepositoryTextAsset(repository, path, options.limits, signal);
|
|
2607
2606
|
addDiagnostics$2(collector, result.diagnostics);
|
|
2608
2607
|
if (result.asset === null) continue;
|
|
@@ -2619,7 +2618,7 @@ var readProjectAssets = async (repository, manifest, discovery, options, signal,
|
|
|
2619
2618
|
});
|
|
2620
2619
|
}
|
|
2621
2620
|
const diagnostics = collector.finalize();
|
|
2622
|
-
return
|
|
2621
|
+
return deepFreeze({
|
|
2623
2622
|
context,
|
|
2624
2623
|
diagnostics,
|
|
2625
2624
|
project: inspectedProject.project,
|
|
@@ -2629,7 +2628,7 @@ var readProjectAssets = async (repository, manifest, discovery, options, signal,
|
|
|
2629
2628
|
//#endregion
|
|
2630
2629
|
//#region src/project-index/index.ts
|
|
2631
2630
|
var createIndexedDecisions = (decisions, manifest) => {
|
|
2632
|
-
return [...decisions].sort((left, right) =>
|
|
2631
|
+
return [...decisions].sort((left, right) => compareCodePoints(left.id, right.id) || compareCodePoints(left.path, right.path)).map((decision) => ({
|
|
2633
2632
|
decision,
|
|
2634
2633
|
relationships: manifest.value.decisions?.[decision.path] ?? null
|
|
2635
2634
|
}));
|
|
@@ -2638,18 +2637,18 @@ var createIndexedAgents = (agents, agentMirrors) => {
|
|
|
2638
2637
|
const mirrorsByAgent = new Map(agentMirrors.map((entry) => [entry.id, entry.mirrors]));
|
|
2639
2638
|
const indexedAgents = [];
|
|
2640
2639
|
if (mirrorsByAgent.size !== agents.length) return null;
|
|
2641
|
-
for (const agent of [...agents].sort((left, right) =>
|
|
2640
|
+
for (const agent of [...agents].sort((left, right) => compareCodePoints(left.id, right.id))) {
|
|
2642
2641
|
const mirrors = mirrorsByAgent.get(agent.id);
|
|
2643
2642
|
if (agent.description === null || agent.instruction === null || mirrors === void 0) return null;
|
|
2644
2643
|
indexedAgents.push({
|
|
2645
|
-
context: [...agent.declaration.context ?? []].sort(
|
|
2646
|
-
decisions: [...agent.declaration.decisions ?? []].sort(
|
|
2644
|
+
context: [...agent.declaration.context ?? []].sort(compareCodePoints),
|
|
2645
|
+
decisions: [...agent.declaration.decisions ?? []].sort(compareCodePoints),
|
|
2647
2646
|
declaration: agent.declaration,
|
|
2648
2647
|
description: agent.description,
|
|
2649
2648
|
handoffDescription: agent.handoffDescription,
|
|
2650
2649
|
id: agent.id,
|
|
2651
2650
|
instruction: agent.instruction,
|
|
2652
|
-
mirrors: [...mirrors].sort((left, right) =>
|
|
2651
|
+
mirrors: [...mirrors].sort((left, right) => compareCodePoints(left.path, right.path))
|
|
2653
2652
|
});
|
|
2654
2653
|
}
|
|
2655
2654
|
return indexedAgents;
|
|
@@ -2663,14 +2662,14 @@ var createProjectIndex = (input) => {
|
|
|
2663
2662
|
const agents = createIndexedAgents(input.agents, input.agentMirrors);
|
|
2664
2663
|
if (agents === null) return null;
|
|
2665
2664
|
const unresolved = input.manifest.value.unresolved ?? createNullPrototypeRecord([]);
|
|
2666
|
-
return
|
|
2665
|
+
return deepFreeze({
|
|
2667
2666
|
agents,
|
|
2668
|
-
context: [...input.context].sort((left, right) =>
|
|
2667
|
+
context: [...input.context].sort((left, right) => compareCodePoints(left.asset.path, right.asset.path)),
|
|
2669
2668
|
decisions: createIndexedDecisions(input.decisions, input.manifest),
|
|
2670
2669
|
formatVersion: 1,
|
|
2671
2670
|
manifest: input.manifest,
|
|
2672
2671
|
project: input.project,
|
|
2673
|
-
runtimes: [...input.runtimes].sort((left, right) =>
|
|
2672
|
+
runtimes: [...input.runtimes].sort((left, right) => compareCodePoints(left.asset.path, right.asset.path)),
|
|
2674
2673
|
unresolved
|
|
2675
2674
|
});
|
|
2676
2675
|
};
|
|
@@ -2765,7 +2764,7 @@ var addRelationshipCandidates = (candidates, relationship, pointer, entity) => {
|
|
|
2765
2764
|
};
|
|
2766
2765
|
/** Adds related repository references from sorted unresolved requirements. */
|
|
2767
2766
|
var addUnresolvedCandidates = (candidates, requirements, pointer, entity) => {
|
|
2768
|
-
for (const requirementId of Object.keys(requirements ?? {}).sort(
|
|
2767
|
+
for (const requirementId of Object.keys(requirements ?? {}).sort(compareCodePoints)) {
|
|
2769
2768
|
const requirement = requirements?.[requirementId];
|
|
2770
2769
|
if (requirement === void 0) continue;
|
|
2771
2770
|
addReferenceCandidates(candidates, requirement.related, childPointer(childPointer(pointer, requirementId), "related"), entity);
|
|
@@ -2824,7 +2823,7 @@ var addAgentCandidates = (candidates, agentId, agent) => {
|
|
|
2824
2823
|
...reference.symbol === void 0 ? {} : { symbol: reference.symbol }
|
|
2825
2824
|
});
|
|
2826
2825
|
}
|
|
2827
|
-
for (const variableId of Object.keys(bindings?.variableProviders ?? {}).sort(
|
|
2826
|
+
for (const variableId of Object.keys(bindings?.variableProviders ?? {}).sort(compareCodePoints)) {
|
|
2828
2827
|
const reference = bindings?.variableProviders?.[variableId];
|
|
2829
2828
|
if (reference !== void 0) candidates.push({
|
|
2830
2829
|
entity: {
|
|
@@ -2840,12 +2839,12 @@ var addAgentCandidates = (candidates, agentId, agent) => {
|
|
|
2840
2839
|
}
|
|
2841
2840
|
addImpactCandidates(candidates, agent.affectedBy, childPointer(pointer, "affectedBy"), entity);
|
|
2842
2841
|
const toolsPointer = childPointer(pointer, "tools");
|
|
2843
|
-
for (const capabilityId of Object.keys(agent.tools ?? {}).sort(
|
|
2842
|
+
for (const capabilityId of Object.keys(agent.tools ?? {}).sort(compareCodePoints)) {
|
|
2844
2843
|
const capability = agent.tools?.[capabilityId];
|
|
2845
2844
|
if (capability !== void 0) addCapabilityCandidates(candidates, capability, "tool", capabilityId, agentId, toolsPointer, [["inputSchema", capability.inputSchema], ["outputSchema", capability.outputSchema]]);
|
|
2846
2845
|
}
|
|
2847
2846
|
const skillsPointer = childPointer(pointer, "skills");
|
|
2848
|
-
for (const capabilityId of Object.keys(agent.skills ?? {}).sort(
|
|
2847
|
+
for (const capabilityId of Object.keys(agent.skills ?? {}).sort(compareCodePoints)) {
|
|
2849
2848
|
const capability = agent.skills?.[capabilityId];
|
|
2850
2849
|
if (capability !== void 0) addCapabilityCandidates(candidates, capability, "skill", capabilityId, agentId, skillsPointer);
|
|
2851
2850
|
}
|
|
@@ -2856,7 +2855,7 @@ var collectCandidates = (manifest) => {
|
|
|
2856
2855
|
const candidates = [];
|
|
2857
2856
|
for (const property of ["context", "decisions"]) {
|
|
2858
2857
|
const relationships = manifest[property];
|
|
2859
|
-
for (const referencedPath of Object.keys(relationships ?? {}).sort(
|
|
2858
|
+
for (const referencedPath of Object.keys(relationships ?? {}).sort(compareCodePoints)) {
|
|
2860
2859
|
const relationship = relationships?.[referencedPath];
|
|
2861
2860
|
if (relationship === void 0) continue;
|
|
2862
2861
|
const pointer = childPointer(`/${property}`, referencedPath);
|
|
@@ -2865,11 +2864,11 @@ var collectCandidates = (manifest) => {
|
|
|
2865
2864
|
}
|
|
2866
2865
|
}
|
|
2867
2866
|
addUnresolvedCandidates(candidates, manifest.unresolved, "/unresolved", null);
|
|
2868
|
-
for (const agentId of Object.keys(manifest.agents ?? {}).sort(
|
|
2867
|
+
for (const agentId of Object.keys(manifest.agents ?? {}).sort(compareCodePoints)) {
|
|
2869
2868
|
const agent = manifest.agents?.[agentId];
|
|
2870
2869
|
if (agent !== void 0) addAgentCandidates(candidates, agentId, agent);
|
|
2871
2870
|
}
|
|
2872
|
-
return candidates.sort((left, right) =>
|
|
2871
|
+
return candidates.sort((left, right) => compareCodePoints(left.pointer, right.pointer));
|
|
2873
2872
|
};
|
|
2874
2873
|
/** Tests whether discovery already owns a diagnostic for a path or one of its ancestors. */
|
|
2875
2874
|
var isBlockedPath$1 = (path, blockedPaths) => {
|
|
@@ -3054,7 +3053,7 @@ var readRuntimeGuidance = async (repository, manifestPath, manifest, discovery,
|
|
|
3054
3053
|
const runtimes = [];
|
|
3055
3054
|
const discoveredPaths = new Set(discovery.inventory.runtimeGuidance);
|
|
3056
3055
|
const blockedPaths = new Set(discovery.diagnostics.flatMap((diagnostic) => diagnostic.path === null ? [] : [diagnostic.path]));
|
|
3057
|
-
for (const path of [...discoveredPaths].sort(
|
|
3056
|
+
for (const path of [...discoveredPaths].sort(compareCodePoints)) {
|
|
3058
3057
|
const result = await readRepositoryTextAsset(repository, path, options.limits, signal);
|
|
3059
3058
|
addDiagnostics$1(collector, result.diagnostics);
|
|
3060
3059
|
if (result.asset === null) continue;
|
|
@@ -3067,7 +3066,7 @@ var readRuntimeGuidance = async (repository, manifestPath, manifest, discovery,
|
|
|
3067
3066
|
}
|
|
3068
3067
|
runtimes.push({ asset: result.asset });
|
|
3069
3068
|
}
|
|
3070
|
-
for (const agentId of Object.keys(manifest?.agents ?? {}).sort(
|
|
3069
|
+
for (const agentId of Object.keys(manifest?.agents ?? {}).sort(compareCodePoints)) {
|
|
3071
3070
|
const guidance = manifest?.agents?.[agentId]?.runtime.guidance;
|
|
3072
3071
|
if (guidance === void 0 || discoveredPaths.has(guidance) || isBlockedPath(guidance, blockedPaths)) continue;
|
|
3073
3072
|
collector.add({
|
|
@@ -3079,7 +3078,7 @@ var readRuntimeGuidance = async (repository, manifestPath, manifest, discovery,
|
|
|
3079
3078
|
});
|
|
3080
3079
|
}
|
|
3081
3080
|
const diagnostics = collector.finalize();
|
|
3082
|
-
return
|
|
3081
|
+
return deepFreeze({
|
|
3083
3082
|
diagnostics,
|
|
3084
3083
|
runtimes,
|
|
3085
3084
|
valid: diagnostics.length === 0
|
|
@@ -3192,7 +3191,7 @@ var inspectUniversalProject = async (context, options) => {
|
|
|
3192
3191
|
project: projectAssets.project,
|
|
3193
3192
|
runtimes: runtimeGuidance.runtimes
|
|
3194
3193
|
}) : null;
|
|
3195
|
-
return
|
|
3194
|
+
return deepFreeze({
|
|
3196
3195
|
diagnostics,
|
|
3197
3196
|
coverage,
|
|
3198
3197
|
formatVersion,
|
|
@@ -3201,9 +3200,6 @@ var inspectUniversalProject = async (context, options) => {
|
|
|
3201
3200
|
};
|
|
3202
3201
|
//#endregion
|
|
3203
3202
|
//#region src/project-validation/index.ts
|
|
3204
|
-
var isRecord = (candidate) => {
|
|
3205
|
-
return typeof candidate === "object" && candidate !== null && !Array.isArray(candidate);
|
|
3206
|
-
};
|
|
3207
3203
|
var invalidArgument$1 = () => {
|
|
3208
3204
|
throw new CoreOperationException({
|
|
3209
3205
|
code: "INVALID_ARGUMENT",
|
|
@@ -3211,14 +3207,14 @@ var invalidArgument$1 = () => {
|
|
|
3211
3207
|
});
|
|
3212
3208
|
};
|
|
3213
3209
|
var isRepositoryReader = (candidate) => {
|
|
3214
|
-
return
|
|
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";
|
|
3215
3211
|
};
|
|
3216
3212
|
var isAbortSignal = (candidate) => {
|
|
3217
|
-
return
|
|
3213
|
+
return isObjectValid(candidate, true) && typeof candidate["aborted"] === "boolean" && typeof candidate["addEventListener"] === "function" && typeof candidate["removeEventListener"] === "function";
|
|
3218
3214
|
};
|
|
3219
3215
|
var validateInput = (candidate) => {
|
|
3220
3216
|
try {
|
|
3221
|
-
if (!
|
|
3217
|
+
if (!isObjectValid(candidate, true)) return invalidArgument$1();
|
|
3222
3218
|
const repository = candidate["repository"];
|
|
3223
3219
|
const instructions = candidate["instructions"];
|
|
3224
3220
|
const signal = candidate["signal"];
|
|
@@ -3264,7 +3260,7 @@ var validateProjectState = async (input, options) => {
|
|
|
3264
3260
|
}, operationOptions);
|
|
3265
3261
|
session.throwIfAborted();
|
|
3266
3262
|
const counts = countDiagnosticsBySeverity(universal.diagnostics);
|
|
3267
|
-
return
|
|
3263
|
+
return deepFreeze({
|
|
3268
3264
|
project: universal.project,
|
|
3269
3265
|
resourceUsage: session.getResourceUsage(),
|
|
3270
3266
|
result: {
|
|
@@ -3408,7 +3404,7 @@ var decodeCursor = (cursor, inspectionDigest, view) => {
|
|
|
3408
3404
|
if (lastKey.length === 0 || match[4] !== createCursorChecksum(inspectionDigest, lastKey, view)) return invalidArgument();
|
|
3409
3405
|
return lastKey;
|
|
3410
3406
|
};
|
|
3411
|
-
var createViews = (items) =>
|
|
3407
|
+
var createViews = (items) => deepFreeze({
|
|
3412
3408
|
all: items,
|
|
3413
3409
|
diagnostics: items.filter(({ item }) => item.kind === "diagnostic"),
|
|
3414
3410
|
coverage: items.filter(({ item }) => item.kind === "coverage"),
|
|
@@ -3507,7 +3503,7 @@ var createPreparedProjectInspection = (input) => {
|
|
|
3507
3503
|
const { counts, coverageCounts, formatVersion, items, maxEntries, preparedBytes, resourceUsage: validationUsage, source, summary, valid } = input;
|
|
3508
3504
|
const views = createViews(items);
|
|
3509
3505
|
const inspectionDigest = createInspectionDigest(counts, coverageCounts, formatVersion, items, summary, valid);
|
|
3510
|
-
const resourceUsage =
|
|
3506
|
+
const resourceUsage = deepFreeze({
|
|
3511
3507
|
canonicalBytes: validationUsage.canonicalBytes,
|
|
3512
3508
|
peakRetainedBytes: Math.max(validationUsage.peakRetainedBytes, validationUsage.retainedBytes + preparedBytes),
|
|
3513
3509
|
preparedBytes,
|
|
@@ -3525,7 +3521,7 @@ var createPreparedProjectInspection = (input) => {
|
|
|
3525
3521
|
};
|
|
3526
3522
|
});
|
|
3527
3523
|
const nextCursor = records.at(-1)?.nextCursor ?? null;
|
|
3528
|
-
return
|
|
3524
|
+
return deepFreeze({
|
|
3529
3525
|
counts,
|
|
3530
3526
|
coverageCounts,
|
|
3531
3527
|
formatVersion,
|
|
@@ -3542,7 +3538,7 @@ var createPreparedProjectInspection = (input) => {
|
|
|
3542
3538
|
view: pageInput.view
|
|
3543
3539
|
});
|
|
3544
3540
|
};
|
|
3545
|
-
return
|
|
3541
|
+
return deepFreeze({
|
|
3546
3542
|
counts,
|
|
3547
3543
|
coverageCounts,
|
|
3548
3544
|
formatVersion,
|
|
@@ -3590,8 +3586,8 @@ var createProjectInspection = async (input, options) => {
|
|
|
3590
3586
|
warnings: state.result.warningCount,
|
|
3591
3587
|
acceptedWarnings: state.result.acceptedWarningCount
|
|
3592
3588
|
}, options.limits.maxRetainedBytes);
|
|
3593
|
-
const counts =
|
|
3594
|
-
const items =
|
|
3589
|
+
const counts = deepFreeze(estimate.counts);
|
|
3590
|
+
const items = deepFreeze(createKeyedItems(iterateProjectInspectionItems(state)));
|
|
3595
3591
|
return createPreparedProjectInspection({
|
|
3596
3592
|
counts,
|
|
3597
3593
|
coverageCounts: state.result.coverageCounts,
|
|
@@ -3617,7 +3613,7 @@ var core_exports = /* @__PURE__ */ __exportAll({ createCore: () => createCore })
|
|
|
3617
3613
|
*/
|
|
3618
3614
|
var createCore = (options) => {
|
|
3619
3615
|
const snapshot = normalizeCoreOptions(options);
|
|
3620
|
-
return
|
|
3616
|
+
return deepFreeze({
|
|
3621
3617
|
calculateContentDigest: (input) => {
|
|
3622
3618
|
const operation = createCoreOperationOptionsSnapshot(snapshot);
|
|
3623
3619
|
return calculateContentDigest(input, operation.limits);
|
|
@@ -3637,4 +3633,4 @@ var createCore = (options) => {
|
|
|
3637
3633
|
//#endregion
|
|
3638
3634
|
export { createCore as n, parseIntegrationBlock as r, core_exports as t };
|
|
3639
3635
|
|
|
3640
|
-
//# sourceMappingURL=core-
|
|
3636
|
+
//# sourceMappingURL=core-CFmT3SRC.js.map
|