@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.
- package/README.md +4 -4
- 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 +11 -23
- package/dist/analysis-worker.js.map +1 -1
- 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-CMuQrqRI.js → core-CFmT3SRC.js} +170 -231
- package/dist/chunks/core-CFmT3SRC.js.map +1 -0
- package/dist/chunks/{errors-BhiLG9F0.js → errors-Uvb-9X1u.js} +29 -75
- 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-Bdi_ydtH.js → lifecycle-DuAHgnYH.js} +2 -2
- package/dist/chunks/{lifecycle-Bdi_ydtH.js.map → lifecycle-DuAHgnYH.js.map} +1 -1
- package/dist/chunks/{options-BVF3DQHm.js → options-C5360E_N.js} +23 -174
- package/dist/chunks/options-C5360E_N.js.map +1 -0
- package/dist/chunks/repository-rpc-B9YaeLba.js +143 -0
- package/dist/chunks/repository-rpc-B9YaeLba.js.map +1 -0
- package/dist/chunks/{scope-DoNl6LhC.js → scope-CNg6Gnpi.js} +214 -151
- package/dist/chunks/scope-CNg6Gnpi.js.map +1 -0
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +2 -6
- package/dist/contracts/index.d.ts.map +1 -1
- 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/diagnostics/index.d.ts +2 -2
- package/dist/diagnostics/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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/integration-validation/agents-inspection.d.ts +3 -3
- package/dist/integration-validation/agents-inspection.d.ts.map +1 -1
- package/dist/integration-validation/claude-inspection.d.ts +3 -2
- package/dist/integration-validation/claude-inspection.d.ts.map +1 -1
- package/dist/integration-validation/inspection.d.ts +4 -2
- package/dist/integration-validation/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 +3 -8
- package/dist/integration-validation/types.d.ts.map +1 -1
- package/dist/integration-validation/utilities.d.ts +0 -8
- package/dist/integration-validation/utilities.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 +7 -6
- package/dist/node-inspection/repository-rpc.d.ts.map +1 -1
- package/dist/node-inspection/types.d.ts +7 -12
- package/dist/node-inspection/types.d.ts.map +1 -1
- package/dist/node-runner.js +3 -3
- package/dist/node.js +19 -35
- 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 +1 -1
- package/dist/project-validation/index.d.ts.map +1 -1
- package/dist/repository-inspection-session/index.d.ts +5 -8
- package/dist/repository-inspection-session/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-CMuQrqRI.js.map +0 -1
- package/dist/chunks/errors-BhiLG9F0.js.map +0 -1
- package/dist/chunks/exceptions-CYf1pCKf.js.map +0 -1
- package/dist/chunks/options-BVF3DQHm.js.map +0 -1
- package/dist/chunks/repository-rpc-CiKFu86B.js +0 -178
- package/dist/chunks/repository-rpc-CiKFu86B.js.map +0 -1
- package/dist/chunks/scope-DoNl6LhC.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as CoreOperationException, t as CoreConfigurationException } from "./exceptions-
|
|
2
|
-
import {
|
|
1
|
+
import { n as CoreOperationException, t as CoreConfigurationException } from "./exceptions-AT654xUL.js";
|
|
2
|
+
import { compareCodePoints, deepFreeze, isObjectValid } from "jg-utilities";
|
|
3
3
|
//#region src/constants/index.ts
|
|
4
4
|
var ACCEPTABLE_WARNING_CODES = Object.freeze([
|
|
5
5
|
"MOLDEA_IMPACT_PATTERN_UNMATCHED",
|
|
6
6
|
"MOLDEA_INTEGRATION_BLOCK_MISSING",
|
|
7
7
|
"MOLDEA_INTEGRATION_SKILL_MISSING",
|
|
8
8
|
"MOLDEA_INTEGRATION_BLOCK_STALE",
|
|
9
|
-
"
|
|
9
|
+
"MOLDEA_INTEGRATION_LINK_UNRESOLVED",
|
|
10
10
|
"MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING"
|
|
11
11
|
]);
|
|
12
12
|
var RECOGNIZED_RUNTIME_IDS = Object.freeze([
|
|
@@ -59,158 +59,8 @@ var DEFAULT_CORE_RESOURCE_LIMITS = Object.freeze({
|
|
|
59
59
|
maxTotalBytesRead: 134217728
|
|
60
60
|
});
|
|
61
61
|
//#endregion
|
|
62
|
-
//#region src/format-validation/index.ts
|
|
63
|
-
var STABLE_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
64
|
-
var VARIABLE_ID_PATTERN = /^[A-Z][A-Z0-9_]*$/u;
|
|
65
|
-
var WINDOWS_RESERVED_ID_PATTERN = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/u;
|
|
66
|
-
var LINE_BREAK_CHARACTERS = [
|
|
67
|
-
"\n",
|
|
68
|
-
"\r",
|
|
69
|
-
"
",
|
|
70
|
-
"\u2028",
|
|
71
|
-
"\u2029"
|
|
72
|
-
];
|
|
73
|
-
var UNSUPPORTED_GLOB_PATTERN = /[!?[\]{}]/u;
|
|
74
|
-
var hasLineBreak = (value) => {
|
|
75
|
-
return LINE_BREAK_CHARACTERS.some((lineBreak) => value.includes(lineBreak));
|
|
76
|
-
};
|
|
77
|
-
/** Determines whether a code point belongs to the Repository Format version 1 whitespace set. */
|
|
78
|
-
var isRepositoryFormatWhitespace = (codePoint) => {
|
|
79
|
-
return codePoint >= 9 && codePoint <= 13 || codePoint === 32 || codePoint === 133 || codePoint === 160 || codePoint === 5760 || codePoint >= 8192 && codePoint <= 8202 || codePoint === 8232 || codePoint === 8233 || codePoint === 8239 || codePoint === 8287 || codePoint === 12288;
|
|
80
|
-
};
|
|
81
|
-
/** Compares strings by exact Unicode code-point order without locale behavior. */
|
|
82
|
-
var compareExactStrings = (left, right) => {
|
|
83
|
-
const leftScalars = left[Symbol.iterator]();
|
|
84
|
-
const rightScalars = right[Symbol.iterator]();
|
|
85
|
-
while (true) {
|
|
86
|
-
const leftScalar = leftScalars.next();
|
|
87
|
-
const rightScalar = rightScalars.next();
|
|
88
|
-
if (leftScalar.done === true) return rightScalar.done === true ? 0 : -1;
|
|
89
|
-
if (rightScalar.done === true) return 1;
|
|
90
|
-
const leftCodePoint = leftScalar.value.codePointAt(0) ?? 0;
|
|
91
|
-
const rightCodePoint = rightScalar.value.codePointAt(0) ?? 0;
|
|
92
|
-
if (leftCodePoint !== rightCodePoint) return leftCodePoint < rightCodePoint ? -1 : 1;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
/** Counts Unicode scalar values in valid JavaScript text. */
|
|
96
|
-
var countUnicodeScalars = (value) => {
|
|
97
|
-
const scalars = value[Symbol.iterator]();
|
|
98
|
-
let count = 0;
|
|
99
|
-
while (scalars.next().done !== true) count += 1;
|
|
100
|
-
return count;
|
|
101
|
-
};
|
|
102
|
-
/** Determines whether a value contains at least one non-whitespace scalar. */
|
|
103
|
-
var hasNonWhitespace = (value) => {
|
|
104
|
-
for (const scalar of value) if (!isRepositoryFormatWhitespace(scalar.codePointAt(0) ?? 0)) return true;
|
|
105
|
-
return false;
|
|
106
|
-
};
|
|
107
|
-
/** Determines whether a value begins or ends with version 1 whitespace. */
|
|
108
|
-
var hasSurroundingWhitespace = (value) => {
|
|
109
|
-
const firstCodePoint = value.codePointAt(0);
|
|
110
|
-
const lastCodePoint = value.codePointAt(value.length - 1);
|
|
111
|
-
return firstCodePoint !== void 0 && isRepositoryFormatWhitespace(firstCodePoint) || lastCodePoint !== void 0 && isRepositoryFormatWhitespace(lastCodePoint);
|
|
112
|
-
};
|
|
113
|
-
/** Removes only Repository Format version 1 whitespace from both edges. */
|
|
114
|
-
var trimRepositoryFormatWhitespace = (value) => {
|
|
115
|
-
let start = 0;
|
|
116
|
-
let end = value.length;
|
|
117
|
-
while (start < end) {
|
|
118
|
-
const codePoint = value.codePointAt(start);
|
|
119
|
-
if (codePoint === void 0 || !isRepositoryFormatWhitespace(codePoint)) break;
|
|
120
|
-
start += codePoint > 65535 ? 2 : 1;
|
|
121
|
-
}
|
|
122
|
-
while (end > start) {
|
|
123
|
-
const codePoint = value.codePointAt(end - 1);
|
|
124
|
-
if (codePoint === void 0 || !isRepositoryFormatWhitespace(codePoint)) break;
|
|
125
|
-
end -= 1;
|
|
126
|
-
}
|
|
127
|
-
return value.slice(start, end);
|
|
128
|
-
};
|
|
129
|
-
/** Determines whether a string is non-empty and contains no line break. */
|
|
130
|
-
var isNonEmptySingleLine = (value) => {
|
|
131
|
-
return value.length > 0 && !hasLineBreak(value);
|
|
132
|
-
};
|
|
133
|
-
/** Determines whether a value satisfies stable moldea ID syntax. */
|
|
134
|
-
var isStableId = (value) => {
|
|
135
|
-
return value.length <= 64 && STABLE_ID_PATTERN.test(value);
|
|
136
|
-
};
|
|
137
|
-
/** Determines whether an otherwise valid stable ID is filesystem-reserved. */
|
|
138
|
-
var isReservedId = (value) => WINDOWS_RESERVED_ID_PATTERN.test(value);
|
|
139
|
-
/** Determines whether a value satisfies runtime-variable ID syntax. */
|
|
140
|
-
var isVariableId = (value) => {
|
|
141
|
-
return value.length <= 64 && VARIABLE_ID_PATTERN.test(value);
|
|
142
|
-
};
|
|
143
|
-
/** Determines whether a parsed capability description satisfies version 1 limits. */
|
|
144
|
-
var isCapabilityDescription = (value) => {
|
|
145
|
-
const scalarLength = countUnicodeScalars(value);
|
|
146
|
-
return scalarLength >= 1 && scalarLength <= 1e3 && !hasSurroundingWhitespace(value) && !hasLineBreak(value) && !value.includes("\0") && !value.includes("{{") && !value.includes("}}");
|
|
147
|
-
};
|
|
148
|
-
/** Parses a non-root repository-format logical path without throwing. */
|
|
149
|
-
var parseManifestPath = (value) => {
|
|
150
|
-
return value !== "/" && isRepositoryPath(value) ? parseRepositoryPath(value) : null;
|
|
151
|
-
};
|
|
152
|
-
/** Determines whether a path is the canonical manifest path. */
|
|
153
|
-
var isCanonicalManifestPath = (path) => {
|
|
154
|
-
return path === "/moldea/moldea.yaml";
|
|
155
|
-
};
|
|
156
|
-
/** Extracts the stable millisecond ID from one canonical immediate decision path. */
|
|
157
|
-
var parseDecisionIdFromPath = (path) => {
|
|
158
|
-
const match = /^\/moldea\/decisions\/(\d{13})-([a-z0-9]+(?:-[a-z0-9]+)*)\.md$/u.exec(path);
|
|
159
|
-
const id = match?.[1];
|
|
160
|
-
const slug = match?.[2];
|
|
161
|
-
return id !== void 0 && slug !== void 0 && isStableId(slug) ? id : null;
|
|
162
|
-
};
|
|
163
|
-
/** Determines whether a path is an allowed focused-context relationship key. */
|
|
164
|
-
var isContextPath = (path, allowProject) => {
|
|
165
|
-
if (allowProject && path === "/moldea/project.md") return true;
|
|
166
|
-
return path.startsWith("/moldea/context/") && path.endsWith(".md");
|
|
167
|
-
};
|
|
168
|
-
/** Determines whether a path has the canonical immediate decision filename shape. */
|
|
169
|
-
var isDecisionPath = (path) => {
|
|
170
|
-
return parseDecisionIdFromPath(path) !== null;
|
|
171
|
-
};
|
|
172
|
-
/** Determines whether a path is canonical runtime guidance. */
|
|
173
|
-
var isRuntimeGuidancePath = (path) => {
|
|
174
|
-
return path.startsWith("/moldea/runtimes/") && path.endsWith(".md");
|
|
175
|
-
};
|
|
176
|
-
/** Determines whether a mirror path is outside canonical moldea content. */
|
|
177
|
-
var isMirrorPath = (path) => {
|
|
178
|
-
return path !== "/moldea" && !path.startsWith("/moldea/");
|
|
179
|
-
};
|
|
180
|
-
/** Determines whether an impact path contains prohibited glob metacharacters. */
|
|
181
|
-
var hasUnsupportedGlobMetacharacter = (value) => {
|
|
182
|
-
return UNSUPPORTED_GLOB_PATTERN.test(value);
|
|
183
|
-
};
|
|
184
|
-
/** Determines whether a string satisfies the version 1 simple-glob grammar. */
|
|
185
|
-
var isSimpleGlob = (value) => {
|
|
186
|
-
if (hasUnsupportedGlobMetacharacter(value) || value.includes("***")) return false;
|
|
187
|
-
if (value.slice(1).split("/").some((segment) => segment.includes("**") && segment !== "**")) return false;
|
|
188
|
-
return value.includes("*") && isRepositoryPath(value.replaceAll("*", "x"));
|
|
189
|
-
};
|
|
190
|
-
/** Determines whether a repository-reference symbol has the common safe shape. */
|
|
191
|
-
var isRepositorySymbol = (value) => {
|
|
192
|
-
return isNonEmptySingleLine(value) && !value.includes("\0");
|
|
193
|
-
};
|
|
194
|
-
/** Determines whether a canonical moldea reference incorrectly carries a symbol. */
|
|
195
|
-
var isCanonicalMoldeaPath = (path) => {
|
|
196
|
-
return path === "/moldea" || path.startsWith("/moldea/");
|
|
197
|
-
};
|
|
198
|
-
//#endregion
|
|
199
62
|
//#region src/immutable/index.ts
|
|
200
63
|
/**
|
|
201
|
-
* Recursively freezes a Core-owned value without cloning it.
|
|
202
|
-
* @param value The detached acyclic value whose already-frozen objects are deeply frozen.
|
|
203
|
-
* @returns The same value with every mutable reachable object frozen.
|
|
204
|
-
*/
|
|
205
|
-
var freezeRecursively = (value) => {
|
|
206
|
-
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
207
|
-
for (const key of Reflect.ownKeys(value)) {
|
|
208
|
-
const child = value[key];
|
|
209
|
-
freezeRecursively(child);
|
|
210
|
-
}
|
|
211
|
-
return Object.freeze(value);
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
64
|
* Creates a record that cannot collide with prototype-chain properties.
|
|
215
65
|
* @param entries The own string-keyed entries to assign.
|
|
216
66
|
* @returns A mutable null-prototype record for later normalization and freezing.
|
|
@@ -284,7 +134,7 @@ var CORE_DIAGNOSTIC_MESSAGES = {
|
|
|
284
134
|
MOLDEA_INTEGRATION_BLOCK_MISSING: "The AGENTS.md moldea block is missing.",
|
|
285
135
|
MOLDEA_INTEGRATION_SKILL_MISSING: "The skill installation referenced by the AGENTS.md moldea block was not found.",
|
|
286
136
|
MOLDEA_INTEGRATION_BLOCK_STALE: "The AGENTS.md moldea block differs from its skill installation.",
|
|
287
|
-
|
|
137
|
+
MOLDEA_INTEGRATION_LINK_UNRESOLVED: "This instruction file's link doesn't lead to a file in the repository.",
|
|
288
138
|
MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING: "Claude Code instructions do not load AGENTS.md.",
|
|
289
139
|
MOLDEA_IMPACT_PATTERN_UNMATCHED: "The impact pattern matches no files.",
|
|
290
140
|
MOLDEA_ACCEPTANCE_UNMATCHED: "The warning acceptance matches no reported warning.",
|
|
@@ -347,7 +197,7 @@ var registerCoreDiagnosticCandidates = (limits, amount, operation, fallbackCount
|
|
|
347
197
|
};
|
|
348
198
|
var compareNullableStrings = (left, right) => {
|
|
349
199
|
if (left === null) return right === null ? 0 : -1;
|
|
350
|
-
return right === null ? 1 :
|
|
200
|
+
return right === null ? 1 : compareCodePoints(left, right);
|
|
351
201
|
};
|
|
352
202
|
/**
|
|
353
203
|
* Normalizes trusted JSON-scalar diagnostic metadata.
|
|
@@ -355,7 +205,8 @@ var compareNullableStrings = (left, right) => {
|
|
|
355
205
|
* @returns A frozen null-prototype record with canonical key order.
|
|
356
206
|
*/
|
|
357
207
|
var normalizeDiagnosticDetails = (details) => {
|
|
358
|
-
|
|
208
|
+
const entries = Object.entries(details ?? {}).sort(([left], [right]) => compareCodePoints(left, right)).map(([key, value]) => [key, typeof value === "number" && Object.is(value, -0) ? 0 : value]);
|
|
209
|
+
return deepFreeze(createNullPrototypeRecord(entries));
|
|
359
210
|
};
|
|
360
211
|
/**
|
|
361
212
|
* Normalizes a trusted diagnostic entity into canonical key order.
|
|
@@ -364,14 +215,15 @@ var normalizeDiagnosticDetails = (details) => {
|
|
|
364
215
|
*/
|
|
365
216
|
var normalizeDiagnosticEntity = (entity) => {
|
|
366
217
|
if (entity === void 0 || entity === null) return null;
|
|
367
|
-
|
|
218
|
+
const entries = ENTITY_KEYS.flatMap((key) => {
|
|
368
219
|
const value = entity[key];
|
|
369
220
|
return value === void 0 ? [] : [[key, value]];
|
|
370
|
-
})
|
|
221
|
+
});
|
|
222
|
+
return deepFreeze(createNullPrototypeRecord(entries));
|
|
371
223
|
};
|
|
372
224
|
/** Serializes unordered diagnostic details with explicit exact-code-point key ordering. */
|
|
373
225
|
var serializeDiagnosticDetails = (details) => {
|
|
374
|
-
const entries = Object.entries(details).sort(([left], [right]) =>
|
|
226
|
+
const entries = Object.entries(details).sort(([left], [right]) => compareCodePoints(left, right));
|
|
375
227
|
return JSON.stringify(entries);
|
|
376
228
|
};
|
|
377
229
|
var serializeDiagnostic = (diagnostic) => {
|
|
@@ -411,7 +263,7 @@ var readEntityValue = (entity, key) => {
|
|
|
411
263
|
return entity?.[key] ?? "";
|
|
412
264
|
};
|
|
413
265
|
var compareDiagnostics = (left, right) => {
|
|
414
|
-
return compareNullableStrings(left.path, right.path) || compareRanges(left.range, right.range) || compareNullableStrings(left.pointer, right.pointer) ||
|
|
266
|
+
return compareNullableStrings(left.path, right.path) || compareRanges(left.range, right.range) || compareNullableStrings(left.pointer, right.pointer) || compareCodePoints(left.source, right.source) || compareCodePoints(left.code, right.code) || compareCodePoints(left.severity, right.severity) || compareCodePoints(left.severity === "warning" ? JSON.stringify([
|
|
415
267
|
left.subject,
|
|
416
268
|
left.qualifier,
|
|
417
269
|
left.accepted ?? false,
|
|
@@ -421,7 +273,7 @@ var compareDiagnostics = (left, right) => {
|
|
|
421
273
|
right.qualifier,
|
|
422
274
|
right.accepted ?? false,
|
|
423
275
|
right.reason ?? null
|
|
424
|
-
]) : "") ||
|
|
276
|
+
]) : "") || compareCodePoints(readEntityValue(left.entity, "agentId"), readEntityValue(right.entity, "agentId")) || compareCodePoints(readEntityValue(left.entity, "capabilityKind"), readEntityValue(right.entity, "capabilityKind")) || compareCodePoints(readEntityValue(left.entity, "capabilityId"), readEntityValue(right.entity, "capabilityId")) || compareCodePoints(readEntityValue(left.entity, "decisionId"), readEntityValue(right.entity, "decisionId")) || compareCodePoints(readEntityValue(left.entity, "variableId"), readEntityValue(right.entity, "variableId")) || compareCodePoints(readEntityValue(left.entity, "contextPath"), readEntityValue(right.entity, "contextPath")) || compareCodePoints(readEntityValue(left.entity, "integrationPath"), readEntityValue(right.entity, "integrationPath")) || compareCodePoints(serializeDiagnosticDetails(left.details), serializeDiagnosticDetails(right.details)) || compareCodePoints(left.message, right.message);
|
|
425
277
|
};
|
|
426
278
|
/** Classifies every catalog code by its documented validation responsibility. */
|
|
427
279
|
var getDiagnosticGroup = (code) => {
|
|
@@ -452,9 +304,9 @@ var createCoreDiagnostic = (input) => {
|
|
|
452
304
|
group: getDiagnosticGroup(input.code),
|
|
453
305
|
source: "core"
|
|
454
306
|
};
|
|
455
|
-
if (input.code === "MOLDEA_IMPACT_PATTERN_UNMATCHED" || input.code === "MOLDEA_ACCEPTANCE_UNMATCHED" || input.code === "MOLDEA_INTEGRATION_BLOCK_MISSING" || input.code === "MOLDEA_INTEGRATION_SKILL_MISSING" || input.code === "MOLDEA_INTEGRATION_BLOCK_STALE" || input.code === "
|
|
307
|
+
if (input.code === "MOLDEA_IMPACT_PATTERN_UNMATCHED" || input.code === "MOLDEA_ACCEPTANCE_UNMATCHED" || input.code === "MOLDEA_INTEGRATION_BLOCK_MISSING" || input.code === "MOLDEA_INTEGRATION_SKILL_MISSING" || input.code === "MOLDEA_INTEGRATION_BLOCK_STALE" || input.code === "MOLDEA_INTEGRATION_LINK_UNRESOLVED" || input.code === "MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING") {
|
|
456
308
|
if (input.subject === void 0) throw new TypeError("A warning subject is required.");
|
|
457
|
-
return
|
|
309
|
+
return deepFreeze({
|
|
458
310
|
...base,
|
|
459
311
|
code: input.code,
|
|
460
312
|
severity: "warning",
|
|
@@ -463,7 +315,7 @@ var createCoreDiagnostic = (input) => {
|
|
|
463
315
|
acceptable: ACCEPTABLE_WARNING_CODES.some((code) => code === input.code)
|
|
464
316
|
});
|
|
465
317
|
}
|
|
466
|
-
return
|
|
318
|
+
return deepFreeze({
|
|
467
319
|
...base,
|
|
468
320
|
code: input.code,
|
|
469
321
|
severity: "error"
|
|
@@ -481,7 +333,7 @@ var normalizeDiagnostics = (candidates) => {
|
|
|
481
333
|
if (diagnostics.has(key)) continue;
|
|
482
334
|
diagnostics.set(key, diagnostic);
|
|
483
335
|
}
|
|
484
|
-
return
|
|
336
|
+
return deepFreeze([...diagnostics.values()].sort(compareDiagnostics));
|
|
485
337
|
};
|
|
486
338
|
/** Counts the complete normalized diagnostic result by severity once. */
|
|
487
339
|
var countDiagnosticsBySeverity = (diagnostics) => {
|
|
@@ -550,9 +402,6 @@ var RESOURCE_LIMIT_KEYS = [
|
|
|
550
402
|
"maxCoverage",
|
|
551
403
|
"maxAcceptedWarnings"
|
|
552
404
|
];
|
|
553
|
-
var isRecord = (value) => {
|
|
554
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
555
|
-
};
|
|
556
405
|
/**
|
|
557
406
|
* Validates, copies, fills, and freezes all configured resource limits.
|
|
558
407
|
* @param candidate The untrusted optional limit overrides.
|
|
@@ -562,7 +411,7 @@ var isRecord = (value) => {
|
|
|
562
411
|
*/
|
|
563
412
|
var normalizeLimits = (candidate) => {
|
|
564
413
|
if (candidate === void 0) return DEFAULT_CORE_RESOURCE_LIMITS;
|
|
565
|
-
if (!
|
|
414
|
+
if (!isObjectValid(candidate, true)) throw new CoreConfigurationException({
|
|
566
415
|
code: "INVALID_RESOURCE_LIMIT",
|
|
567
416
|
operation: "create-core"
|
|
568
417
|
});
|
|
@@ -581,7 +430,7 @@ var normalizeLimits = (candidate) => {
|
|
|
581
430
|
});
|
|
582
431
|
normalized[key] = value;
|
|
583
432
|
}
|
|
584
|
-
return
|
|
433
|
+
return deepFreeze(normalized);
|
|
585
434
|
};
|
|
586
435
|
/**
|
|
587
436
|
* Validates and snapshots caller-owned Core resource limits.
|
|
@@ -590,13 +439,13 @@ var normalizeLimits = (candidate) => {
|
|
|
590
439
|
* - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.
|
|
591
440
|
*/
|
|
592
441
|
var normalizeCoreOptions = (options) => {
|
|
593
|
-
if (options !== void 0 && (!
|
|
442
|
+
if (options !== void 0 && (!isObjectValid(options, true) || Reflect.ownKeys(options).some((key) => key !== "limits"))) throw new CoreConfigurationException({
|
|
594
443
|
code: "INVALID_RESOURCE_LIMIT",
|
|
595
444
|
operation: "create-core"
|
|
596
445
|
});
|
|
597
|
-
return
|
|
446
|
+
return deepFreeze({ limits: normalizeLimits(options?.["limits"]) });
|
|
598
447
|
};
|
|
599
448
|
//#endregion
|
|
600
|
-
export {
|
|
449
|
+
export { escapeJsonPointerSegment as a, ACCEPTABLE_WARNING_CODES as c, SUPPORTED_REPOSITORY_FORMAT_VERSIONS as d, createCoreDiagnosticCollector as i, DEFAULT_CORE_RESOURCE_LIMITS as l, normalizeCoreOptions as n, normalizeDiagnostics as o, countDiagnosticsBySeverity as r, createNullPrototypeRecord as s, createCoreOperationOptionsSnapshot as t, RECOGNIZED_RUNTIME_IDS as u };
|
|
601
450
|
|
|
602
|
-
//# sourceMappingURL=options-
|
|
451
|
+
//# sourceMappingURL=options-C5360E_N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-C5360E_N.js","names":[],"sources":["../../src/constants/index.ts","../../src/immutable/index.ts","../../src/diagnostic-utilities/index.ts","../../src/options/index.ts"],"sourcesContent":["import type { ICoreResourceLimits } from '../contracts/index.js';\nimport type { IRepositoryFormatVersion } from '../format/index.js';\n\n// warning codes whose findings may be explicitly accepted in the manifest\nexport const ACCEPTABLE_WARNING_CODES = Object.freeze([\n 'MOLDEA_IMPACT_PATTERN_UNMATCHED',\n 'MOLDEA_INTEGRATION_BLOCK_MISSING',\n 'MOLDEA_INTEGRATION_SKILL_MISSING',\n 'MOLDEA_INTEGRATION_BLOCK_STALE',\n 'MOLDEA_INTEGRATION_LINK_UNRESOLVED',\n 'MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING',\n] as const);\n\n// runtime labels selecting guidance without asserting SDK compatibility\nexport const RECOGNIZED_RUNTIME_IDS = Object.freeze([\n 'amazon-bedrock',\n 'anthropic',\n 'cerebras',\n 'claude-agent-sdk',\n 'cloudflare-agents',\n 'cohere',\n 'convex-agent',\n 'cursor-sdk',\n 'custom',\n 'deep-agents',\n 'eve',\n 'genkit',\n 'github-copilot-sdk',\n 'google-adk',\n 'google-genai',\n 'groq',\n 'hugging-face',\n 'ibm-watsonx-ai',\n 'langchain',\n 'langgraph',\n 'livekit-agents',\n 'mastra',\n 'microsoft-foundry',\n 'mistral',\n 'node-llama-cpp',\n 'ollama',\n 'openai',\n 'openai-agents-sdk',\n 'openai-codex',\n 'opencode-sdk',\n 'openrouter',\n 'pi-agent',\n 'strands-agents',\n 'tanstack-ai',\n 'vercel-ai-sdk',\n 'voltagent',\n] as const);\n\n// repository-format major versions interpreted by this Core release\nexport const SUPPORTED_REPOSITORY_FORMAT_VERSIONS: readonly IRepositoryFormatVersion[] =\n Object.freeze([1]);\n\n// default safety budgets applied independently to each Core operation\nexport const DEFAULT_CORE_RESOURCE_LIMITS: ICoreResourceLimits = Object.freeze({\n maxDiagnostics: 10_000,\n maxEntries: 100_000,\n maxCoverage: 10_000,\n maxAcceptedWarnings: 256,\n maxFileBytes: 8_388_608,\n maxManifestBytes: 2_097_152,\n maxRetainedBytes: 536_870_912,\n maxTotalBytesRead: 134_217_728,\n});\n","/**\n * Creates a record that cannot collide with prototype-chain properties.\n * @param entries The own string-keyed entries to assign.\n * @returns A mutable null-prototype record for later normalization and freezing.\n */\nexport const createNullPrototypeRecord = <Value>(\n entries: Iterable<readonly [string, Value]>,\n): Record<string, Value> => {\n const record = Object.create(null) as Record<string, Value>;\n\n for (const [key, value] of entries) {\n record[key] = value;\n }\n\n return record;\n};\n","import { compareCodePoints, deepFreeze } from 'jg-utilities';\n\nimport type { IRepositoryPath } from '@moldea.ai/repository';\n\nimport { ACCEPTABLE_WARNING_CODES } from '../constants/index.js';\nimport type { ICoreResourceLimits } from '../contracts/index.js';\nimport type {\n ICoreDiagnostic,\n ICoreDiagnosticCode,\n IDiagnostic,\n IDiagnosticDetails,\n IDiagnosticEntity,\n ISourceRange,\n} from '../diagnostics/index.js';\nimport { CoreOperationException, type ICoreOperation } from '../exceptions/index.js';\nimport { createNullPrototypeRecord } from '../immutable/index.js';\n\nconst CORE_DIAGNOSTIC_MESSAGES: Record<ICoreDiagnosticCode, string> = {\n MOLDEA_AGENT_DESCRIPTION_INVALID: 'The agent description is invalid.',\n MOLDEA_AGENT_DESCRIPTION_MISSING: 'The agent description is missing.',\n MOLDEA_AGENT_DIRECTORY_MISSING: 'The registered agent directory is missing.',\n MOLDEA_AGENT_DIRECTORY_UNREGISTERED: 'The agent directory is not registered.',\n MOLDEA_AGENT_HANDOFF_DESCRIPTION_INVALID: 'The agent handoff description is invalid.',\n MOLDEA_AGENT_IDENTITY_INVALID: 'The agent instruction identity is invalid.',\n MOLDEA_AGENT_INSTRUCTION_EMPTY: 'The agent instruction is empty.',\n MOLDEA_AGENT_INSTRUCTION_MISSING: 'The agent instruction is missing.',\n MOLDEA_CANONICAL_ASSET_SYMLINK: 'The canonical asset is a symlink.',\n MOLDEA_CANONICAL_PATH_UNRECOGNIZED: 'The canonical path is unrecognized.',\n MOLDEA_CAPABILITY_DESCRIPTION_INVALID: 'The capability description is invalid.',\n MOLDEA_CAPABILITY_DESCRIPTION_MISSING: 'The capability description is missing.',\n MOLDEA_CONTEXT_FILE_EMPTY: 'The focused context file is empty.',\n MOLDEA_CONTEXT_PATH_INVALID: 'The context relationship path is invalid.',\n MOLDEA_CONTEXT_RELATIONSHIP_EMPTY: 'The declared relationship has no bindings or impact paths.',\n MOLDEA_DECISION_BODY_EMPTY: 'The decision Markdown body is empty.',\n MOLDEA_DECISION_CREATED_AT_INVALID: 'The decision createdAt value is invalid.',\n MOLDEA_DECISION_FILENAME_INVALID: 'The decision path or filename is invalid.',\n MOLDEA_DECISION_FRONTMATTER_INVALID: 'The decision frontmatter is invalid.',\n MOLDEA_DECISION_FRONTMATTER_MISSING: 'The decision frontmatter or its delimiters are missing.',\n MOLDEA_DECISION_ID_DUPLICATE: 'The decision ID is duplicated.',\n MOLDEA_DECISION_PROPERTY_UNKNOWN: 'The decision frontmatter contains an unknown property.',\n MOLDEA_DECISION_REFERENCE_MISSING: 'The referenced decision does not exist.',\n MOLDEA_DECISION_RELATIONSHIP_INACTIVE: 'The referenced decision is not accepted.',\n MOLDEA_DECISION_SELF_SUPERSESSION: 'The decision supersedes itself.',\n MOLDEA_DECISION_STATUS_INVALID: 'The decision status is invalid.',\n MOLDEA_DECISION_SUPERSEDED_ORPHAN:\n 'The superseded decision has no active supersession relationship.',\n MOLDEA_DECISION_SUPERSESSION_CYCLE: 'The decision supersession graph contains a cycle.',\n MOLDEA_DECISION_SUPERSESSION_STATUS_INVALID:\n 'The decision supersession relationship has inconsistent statuses.',\n MOLDEA_DECISION_TIMESTAMP_MISMATCH:\n 'The decision filename timestamp and createdAt value do not match.',\n MOLDEA_ENTRY_TYPE_INVALID: 'The repository entry type is invalid.',\n MOLDEA_RUNTIME_ID_INVALID: 'The runtime ID is invalid.',\n MOLDEA_GLOB_INVALID: 'The impact pattern is invalid.',\n MOLDEA_ID_DUPLICATE: 'An ID is duplicated within its required scope.',\n MOLDEA_ID_INVALID: 'The ID is invalid.',\n MOLDEA_ID_RESERVED: 'The ID uses a reserved filesystem name.',\n MOLDEA_IMPACT_PATH_MISSING: 'The exact impact path does not exist.',\n MOLDEA_IMPACT_PATH_NOT_FILE: 'The exact impact path is not a regular file.',\n MOLDEA_MANIFEST_MISSING: 'The project manifest is missing.',\n MOLDEA_MANIFEST_PATH_INVALID: 'The manifest path is not the canonical manifest path.',\n MOLDEA_MANIFEST_PROPERTY_UNKNOWN: 'The manifest contains an unknown property.',\n MOLDEA_MANIFEST_ROOT_INVALID: 'The manifest root is not a mapping.',\n MOLDEA_MANIFEST_VALUE_INVALID: 'The manifest value is invalid.',\n MOLDEA_MANIFEST_VERSION_INVALID: 'The manifest version is not a valid integer major version.',\n MOLDEA_MANIFEST_VERSION_MISSING: 'The manifest version is missing.',\n MOLDEA_MANIFEST_VERSION_UNSUPPORTED: 'The manifest version is unsupported.',\n MOLDEA_MIRROR_PATH_DUPLICATE: 'The mirror path is assigned more than once.',\n MOLDEA_MIRROR_PATH_INSIDE_MOLDEA: 'The mirror path is inside /moldea.',\n MOLDEA_MIRROR_PATH_INVALID: 'The mirror path is invalid.',\n MOLDEA_MIRROR_MISSING: 'The declared mirror does not exist.',\n MOLDEA_MIRROR_NOT_FILE: 'The declared mirror is not a regular file.',\n MOLDEA_MIRROR_STALE: 'The declared mirror differs from its canonical instruction.',\n MOLDEA_MIRROR_SYMLINK: 'The declared mirror is a symlink.',\n MOLDEA_PATH_DUPLICATE: 'The path is duplicated.',\n MOLDEA_PATH_INVALID: 'The manifest logical path is invalid.',\n MOLDEA_PATTERN_DUPLICATE: 'The impact pattern is duplicated.',\n MOLDEA_PROJECT_FILE_EMPTY: 'The project file is empty.',\n MOLDEA_PROJECT_FILE_MISSING: 'The project file is missing.',\n MOLDEA_INTEGRATION_BLOCK_MISSING: 'The AGENTS.md moldea block is missing.',\n MOLDEA_INTEGRATION_SKILL_MISSING:\n 'The skill installation referenced by the AGENTS.md moldea block was not found.',\n MOLDEA_INTEGRATION_BLOCK_STALE: 'The AGENTS.md moldea block differs from its skill installation.',\n MOLDEA_INTEGRATION_LINK_UNRESOLVED:\n \"This instruction file's link doesn't lead to a file in the repository.\",\n MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING: 'Claude Code instructions do not load AGENTS.md.',\n MOLDEA_IMPACT_PATTERN_UNMATCHED: 'The impact pattern matches no files.',\n MOLDEA_ACCEPTANCE_UNMATCHED: 'The warning acceptance matches no reported warning.',\n MOLDEA_REFERENCE_EXPORT_MISSING: 'The referenced export is missing.',\n MOLDEA_REFERENCE_MISSING: 'The referenced repository path does not exist.',\n MOLDEA_REFERENCE_NOT_FILE: 'The referenced repository path is not a regular file.',\n MOLDEA_REFERENCE_SYMLINK: 'The referenced repository path is a symlink.',\n MOLDEA_RUNTIME_GUIDANCE_EMPTY: 'The runtime guidance is empty.',\n MOLDEA_RUNTIME_GUIDANCE_MISSING: 'The referenced runtime guidance does not exist.',\n MOLDEA_SKILL_IMPLEMENTATION_MISSING: 'The registered skill implementation is missing.',\n MOLDEA_SYMBOL_FORBIDDEN: 'A canonical moldea reference must not include a symbol.',\n MOLDEA_SYMBOL_INVALID: 'The repository-reference symbol is invalid.',\n MOLDEA_TEXT_EMPTY: 'The required text document is empty.',\n MOLDEA_TEXT_INVALID_UNICODE:\n 'The text document contains an invalid Unicode scalar representation.',\n MOLDEA_TEXT_INVALID_UTF8: 'The text document is not valid UTF-8.',\n MOLDEA_TEXT_NUL_FORBIDDEN: 'The text document contains a forbidden NUL character.',\n MOLDEA_TOOL_IMPLEMENTATION_MISSING: 'The registered tool implementation is missing.',\n MOLDEA_VARIABLE_ID_INVALID: 'The runtime-variable ID is invalid.',\n MOLDEA_VARIABLE_PLACEHOLDER_MALFORMED:\n 'The agent instruction contains a malformed runtime-variable placeholder.',\n MOLDEA_VARIABLE_PROVIDER_UNDECLARED:\n 'A variable-provider binding exists for an undeclared variable.',\n MOLDEA_VARIABLE_UNDECLARED: 'The agent instruction references an undeclared runtime variable.',\n MOLDEA_VARIABLE_UNUSED: 'The declared runtime variable is unused by the agent instruction.',\n MOLDEA_YAML_DUPLICATE_KEY: 'The YAML document contains a duplicate mapping key.',\n MOLDEA_YAML_FEATURE_UNSUPPORTED: 'The YAML document uses an unsupported feature.',\n MOLDEA_YAML_MALFORMED: 'The YAML document is malformed.',\n MOLDEA_YAML_MULTIPLE_DOCUMENTS: 'The YAML stream contains more than one document.',\n};\n\nconst ENTITY_KEYS = [\n 'agentId',\n 'capabilityKind',\n 'capabilityId',\n 'decisionId',\n 'variableId',\n 'contextPath',\n 'integrationPath',\n] as const satisfies readonly (keyof IDiagnosticEntity)[];\n\n// private normalized diagnostic construction contracts\nexport interface ICoreDiagnosticInput {\n readonly code: ICoreDiagnosticCode;\n readonly details?: Readonly<Record<string, string | number | boolean | null>>;\n readonly entity?: IDiagnosticEntity | null;\n readonly path: IRepositoryPath | null;\n readonly pointer?: string | null;\n readonly range?: ISourceRange | null;\n readonly subject?: IRepositoryPath;\n readonly qualifier?: string | null;\n}\n\nexport interface ICoreDiagnosticCollector {\n add(input: ICoreDiagnosticInput): void;\n merge(input: ICoreDiagnosticInput): void;\n finalize(): readonly ICoreDiagnostic[];\n readonly size: number;\n}\n\ninterface ICoreDiagnosticBudget {\n count: number;\n}\n\nconst CORE_DIAGNOSTIC_BUDGET = Symbol('core-diagnostic-budget');\n\ntype ICoreOperationResourceLimits = ICoreResourceLimits & {\n readonly [CORE_DIAGNOSTIC_BUDGET]?: ICoreDiagnosticBudget;\n};\n\n/** Creates a detached limits view with one diagnostic budget for a complete Core operation. */\nexport const createCoreOperationResourceLimits = (\n limits: ICoreResourceLimits,\n): ICoreResourceLimits => {\n const operationLimits = limits as ICoreOperationResourceLimits;\n\n if (operationLimits[CORE_DIAGNOSTIC_BUDGET] !== undefined) {\n return limits;\n }\n\n return Object.freeze({\n ...limits,\n [CORE_DIAGNOSTIC_BUDGET]: { count: 0 },\n });\n};\n\n/** Registers raw diagnostics against the shared operation budget before normalization. */\nexport const registerCoreDiagnosticCandidates = (\n limits: ICoreResourceLimits,\n amount: number,\n operation: ICoreOperation,\n fallbackCount = 0,\n): number => {\n const budget = (limits as ICoreOperationResourceLimits)[CORE_DIAGNOSTIC_BUDGET];\n const currentCount = budget?.count ?? fallbackCount;\n\n if (amount > limits.maxDiagnostics - currentCount) {\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxDiagnostics',\n limitMaximum: limits.maxDiagnostics,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: currentCount + amount,\n operation,\n });\n }\n\n if (budget !== undefined) {\n budget.count += amount;\n }\n\n return fallbackCount + amount;\n};\n\nconst compareNullableStrings = (left: string | null, right: string | null): number => {\n if (left === null) {\n return right === null ? 0 : -1;\n }\n\n return right === null ? 1 : compareCodePoints(left, right);\n};\n\n/**\n * Normalizes trusted JSON-scalar diagnostic metadata.\n * @param details The optional detached metadata record.\n * @returns A frozen null-prototype record with canonical key order.\n */\nexport const normalizeDiagnosticDetails = (\n details: Readonly<Record<string, string | number | boolean | null>> | undefined,\n): IDiagnosticDetails => {\n const entries = Object.entries(details ?? {})\n .sort(([left], [right]) => compareCodePoints(left, right))\n .map(\n ([key, value]) =>\n [key, typeof value === 'number' && Object.is(value, -0) ? 0 : value] as const,\n );\n\n return deepFreeze(createNullPrototypeRecord(entries));\n};\n\n/**\n * Normalizes a trusted diagnostic entity into canonical key order.\n * @param entity The optional diagnostic entity.\n * @returns The frozen normalized entity or `null`.\n */\nexport const normalizeDiagnosticEntity = (\n entity: IDiagnosticEntity | null | undefined,\n): IDiagnosticEntity | null => {\n if (entity === undefined || entity === null) {\n return null;\n }\n\n const entries = ENTITY_KEYS.flatMap((key) => {\n const value = entity[key];\n return value === undefined ? [] : ([[key, value]] as const);\n });\n\n return deepFreeze(createNullPrototypeRecord(entries) as IDiagnosticEntity);\n};\n\n/** Serializes unordered diagnostic details with explicit exact-code-point key ordering. */\nexport const serializeDiagnosticDetails = (details: IDiagnosticDetails): string => {\n const entries = Object.entries(details).sort(([left], [right]) => compareCodePoints(left, right));\n\n return JSON.stringify(entries);\n};\n\nconst serializeDiagnostic = (diagnostic: IDiagnostic): string => {\n const entity =\n diagnostic.entity === null\n ? null\n : ENTITY_KEYS.map((key) => [key, diagnostic.entity?.[key] ?? null]);\n const range =\n diagnostic.range === null\n ? null\n : [\n diagnostic.range.start.line,\n diagnostic.range.start.column,\n diagnostic.range.start.offset,\n diagnostic.range.end.line,\n diagnostic.range.end.column,\n diagnostic.range.end.offset,\n ];\n\n return JSON.stringify([\n diagnostic.code,\n diagnostic.severity,\n diagnostic.severity === 'warning'\n ? [\n diagnostic.subject,\n diagnostic.qualifier,\n diagnostic.accepted ?? false,\n diagnostic.reason ?? null,\n ]\n : null,\n serializeDiagnosticDetails(diagnostic.details),\n entity,\n diagnostic.message,\n diagnostic.path,\n diagnostic.pointer,\n range,\n diagnostic.source,\n ]);\n};\n\nconst compareRanges = (left: ISourceRange | null, right: ISourceRange | null): number => {\n if (left === null) {\n return right === null ? 0 : -1;\n }\n\n if (right === null) {\n return 1;\n }\n\n return (\n left.start.line - right.start.line ||\n left.start.column - right.start.column ||\n left.start.offset - right.start.offset ||\n left.end.line - right.end.line ||\n left.end.column - right.end.column ||\n left.end.offset - right.end.offset\n );\n};\n\nconst readEntityValue = (\n entity: IDiagnosticEntity | null,\n key: keyof IDiagnosticEntity,\n): string => {\n return entity?.[key] ?? '';\n};\n\nconst compareDiagnostics = (left: IDiagnostic, right: IDiagnostic): number => {\n return (\n compareNullableStrings(left.path, right.path) ||\n compareRanges(left.range, right.range) ||\n compareNullableStrings(left.pointer, right.pointer) ||\n compareCodePoints(left.source, right.source) ||\n compareCodePoints(left.code, right.code) ||\n compareCodePoints(left.severity, right.severity) ||\n compareCodePoints(\n left.severity === 'warning'\n ? JSON.stringify([\n left.subject,\n left.qualifier,\n left.accepted ?? false,\n left.reason ?? null,\n ])\n : '',\n right.severity === 'warning'\n ? JSON.stringify([\n right.subject,\n right.qualifier,\n right.accepted ?? false,\n right.reason ?? null,\n ])\n : '',\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'agentId'),\n readEntityValue(right.entity, 'agentId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'capabilityKind'),\n readEntityValue(right.entity, 'capabilityKind'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'capabilityId'),\n readEntityValue(right.entity, 'capabilityId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'decisionId'),\n readEntityValue(right.entity, 'decisionId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'variableId'),\n readEntityValue(right.entity, 'variableId'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'contextPath'),\n readEntityValue(right.entity, 'contextPath'),\n ) ||\n compareCodePoints(\n readEntityValue(left.entity, 'integrationPath'),\n readEntityValue(right.entity, 'integrationPath'),\n ) ||\n compareCodePoints(\n serializeDiagnosticDetails(left.details),\n serializeDiagnosticDetails(right.details),\n ) ||\n compareCodePoints(left.message, right.message)\n );\n};\n\n/** Classifies every catalog code by its documented validation responsibility. */\nconst getDiagnosticGroup = (code: ICoreDiagnosticCode): ICoreDiagnostic['group'] => {\n if (code.startsWith('MOLDEA_INTEGRATION_')) return 'integration';\n if (code.startsWith('MOLDEA_MIRROR_')) return 'mirrors';\n if (/^MOLDEA_(REFERENCE|IMPACT|SYMBOL|CONTEXT|DECISION|RUNTIME_GUIDANCE)_/.test(code))\n return 'references';\n if (code === 'MOLDEA_VARIABLE_ID_INVALID') return 'manifest';\n if (/^MOLDEA_(AGENT|VARIABLE|CAPABILITY|TOOL|SKILL|RUNTIME)_/.test(code)) return 'agents';\n if (/^MOLDEA_(MANIFEST_MISSING|PROJECT_FILE|ENTRY_TYPE|CANONICAL|TEXT)_/.test(code))\n return 'discovery';\n return 'manifest';\n};\n\n/**\n * Creates one normalized, immutable Core diagnostic.\n * @param input The trusted Core-owned diagnostic fields to normalize.\n * @returns A deeply immutable public diagnostic value.\n */\nexport const createCoreDiagnostic = (input: ICoreDiagnosticInput): ICoreDiagnostic => {\n const message = CORE_DIAGNOSTIC_MESSAGES[input.code];\n\n if (message === undefined) {\n throw new TypeError('The requested Core diagnostic is not implemented.');\n }\n\n const base = {\n code: input.code,\n details: normalizeDiagnosticDetails(input.details),\n entity: normalizeDiagnosticEntity(input.entity),\n message,\n path: input.path,\n pointer: input.pointer ?? null,\n range: input.range ?? null,\n group: getDiagnosticGroup(input.code),\n source: 'core' as const,\n };\n if (\n input.code === 'MOLDEA_IMPACT_PATTERN_UNMATCHED' ||\n input.code === 'MOLDEA_ACCEPTANCE_UNMATCHED' ||\n input.code === 'MOLDEA_INTEGRATION_BLOCK_MISSING' ||\n input.code === 'MOLDEA_INTEGRATION_SKILL_MISSING' ||\n input.code === 'MOLDEA_INTEGRATION_BLOCK_STALE' ||\n input.code === 'MOLDEA_INTEGRATION_LINK_UNRESOLVED' ||\n input.code === 'MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING'\n ) {\n if (input.subject === undefined) throw new TypeError('A warning subject is required.');\n return deepFreeze({\n ...base,\n code: input.code,\n severity: 'warning' as const,\n subject: input.subject,\n qualifier: input.qualifier ?? null,\n acceptable: ACCEPTABLE_WARNING_CODES.some((code) => code === input.code),\n });\n }\n return deepFreeze({ ...base, code: input.code, severity: 'error' as const });\n};\n\n/**\n * Deduplicates and sorts already-normalized Core diagnostics.\n * @param candidates The immutable diagnostics to combine.\n * @returns A frozen deterministic diagnostic collection.\n */\nexport const normalizeDiagnostics = (\n candidates: readonly IDiagnostic[],\n): readonly IDiagnostic[] => {\n const diagnostics = new Map<string, IDiagnostic>();\n\n for (const diagnostic of candidates) {\n const key = serializeDiagnostic(diagnostic);\n\n if (diagnostics.has(key)) {\n continue;\n }\n\n diagnostics.set(key, diagnostic);\n }\n\n return deepFreeze([...diagnostics.values()].sort(compareDiagnostics));\n};\n\n/** Counts the complete normalized diagnostic result by severity once. */\nexport const countDiagnosticsBySeverity = (\n diagnostics: readonly IDiagnostic[],\n): {\n readonly errorCount: number;\n readonly warningCount: number;\n readonly acceptedWarningCount: number;\n readonly diagnosticCount: number;\n} => {\n let errorCount = 0;\n let warningCount = 0;\n let acceptedWarningCount = 0;\n\n for (const diagnostic of diagnostics) {\n if (diagnostic.severity === 'error') {\n errorCount += 1;\n } else if (diagnostic.accepted === true) {\n acceptedWarningCount += 1;\n } else {\n warningCount += 1;\n }\n }\n\n return { errorCount, warningCount, acceptedWarningCount, diagnosticCount: diagnostics.length };\n};\n\n/**\n * Creates a deterministic, deduplicating diagnostic collector for one operation.\n * @param limits The Core resource limits governing diagnostic output.\n * @param operation The operation reported by resource failures.\n * @returns A collector that freezes and sorts its final diagnostic array.\n */\nexport const createCoreDiagnosticCollector = (\n limits: ICoreResourceLimits,\n operation: ICoreOperation,\n): ICoreDiagnosticCollector => {\n const diagnostics = new Map<string, ICoreDiagnostic>();\n let proposalCount = 0;\n let fallbackRawCount = 0;\n\n const retain = (input: ICoreDiagnosticInput): void => {\n const diagnostic = createCoreDiagnostic(input);\n const key = serializeDiagnostic(diagnostic);\n\n proposalCount += 1;\n\n if (!diagnostics.has(key)) {\n diagnostics.set(key, diagnostic);\n }\n };\n\n return {\n add: (input): void => {\n fallbackRawCount = registerCoreDiagnosticCandidates(limits, 1, operation, fallbackRawCount);\n retain(input);\n },\n merge: retain,\n finalize: (): readonly ICoreDiagnostic[] => normalizeDiagnostics([...diagnostics.values()]),\n get size(): number {\n return proposalCount;\n },\n };\n};\n\n/**\n * Escapes one JSON Pointer reference token.\n * @param value The decoded mapping key or array index token.\n * @returns The RFC 6901 escaped token.\n */\nexport const escapeJsonPointerSegment = (value: string): string => {\n return value.replaceAll('~', '~0').replaceAll('/', '~1');\n};\n","import { deepFreeze, isObjectValid } from 'jg-utilities';\n\nimport { DEFAULT_CORE_RESOURCE_LIMITS } from '../constants/index.js';\nimport type { ICoreOptions, ICoreResourceLimits } from '../contracts/index.js';\nimport { createCoreOperationResourceLimits } from '../diagnostic-utilities/index.js';\nimport { CoreConfigurationException } from '../exceptions/index.js';\n\n// complete immutable Core configuration\nexport interface ICoreOptionsSnapshot {\n readonly limits: ICoreResourceLimits;\n}\n\n/** Creates an operation-local options view with one shared raw-diagnostic budget. */\nexport const createCoreOperationOptionsSnapshot = (\n options: ICoreOptionsSnapshot,\n): ICoreOptionsSnapshot => {\n return Object.freeze({\n limits: createCoreOperationResourceLimits(options.limits),\n });\n};\n\nconst RESOURCE_LIMIT_KEYS = [\n 'maxEntries',\n 'maxTotalBytesRead',\n 'maxFileBytes',\n 'maxManifestBytes',\n 'maxRetainedBytes',\n 'maxDiagnostics',\n 'maxCoverage',\n 'maxAcceptedWarnings',\n] as const satisfies readonly (keyof ICoreResourceLimits)[];\n\n/**\n * Validates, copies, fills, and freezes all configured resource limits.\n * @param candidate The untrusted optional limit overrides.\n * @returns The complete frozen resource limits.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n */\nconst normalizeLimits = (candidate: unknown): ICoreResourceLimits => {\n if (candidate === undefined) {\n return DEFAULT_CORE_RESOURCE_LIMITS;\n }\n\n if (!isObjectValid(candidate, true)) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n const knownKeys = new Set<string>(RESOURCE_LIMIT_KEYS);\n\n if (Object.keys(candidate).some((key) => !knownKeys.has(key))) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n const normalized: ICoreResourceLimits = {\n ...DEFAULT_CORE_RESOURCE_LIMITS,\n };\n\n for (const key of RESOURCE_LIMIT_KEYS) {\n const value: unknown = candidate[key];\n\n if (value === undefined) {\n continue;\n }\n\n if (!Number.isSafeInteger(value) || (value as number) <= 0) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n (normalized as Record<keyof ICoreResourceLimits, number>)[key] = value as number;\n }\n\n return deepFreeze(normalized);\n};\n\n/**\n * Validates and snapshots caller-owned Core resource limits.\n * @returns A deeply frozen configuration snapshot.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n */\nexport const normalizeCoreOptions = (options: ICoreOptions | undefined): ICoreOptionsSnapshot => {\n if (\n options !== undefined &&\n (!isObjectValid(options, true) || Reflect.ownKeys(options).some((key) => key !== 'limits'))\n ) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n return deepFreeze({ limits: normalizeLimits(options?.['limits']) });\n};\n"],"mappings":";;;AAIA,IAAa,2BAA2B,OAAO,OAAO;CACpD;CACA;CACA;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F,IACE,YAAY,KAAA,MACX,CAAC,cAAc,SAAS,IAAI,KAAK,QAAQ,QAAQ,OAAO,CAAC,CAAC,MAAM,QAAQ,QAAQ,QAAQ,IAEzF,MAAM,IAAI,2BAA2B;EACnC,MAAM;EACN,WAAW;CACb,CAAC;CAEH,OAAO,WAAW,EAAE,QAAQ,gBAAgB,UAAU,SAAS,EAAE,CAAC;AACpE"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import "./errors-Uvb-9X1u.js";
|
|
2
|
+
import { isObjectValid } from "jg-utilities";
|
|
3
|
+
import { REPOSITORY_LINK_TEXT_MAX_BYTES, RepositorySourceException, isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
|
|
4
|
+
import { Buffer } from "node:buffer";
|
|
5
|
+
//#region src/node-inspection/repository-rpc.ts
|
|
6
|
+
var invalidSource = () => {
|
|
7
|
+
throw new RepositorySourceException({
|
|
8
|
+
code: "INVALID_SOURCE_DATA",
|
|
9
|
+
operation: "create-reader",
|
|
10
|
+
path: null,
|
|
11
|
+
retryable: false
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var isInteger = (input) => typeof input === "number" && Number.isSafeInteger(input) && input >= 0;
|
|
15
|
+
var keysMatch = (input, keys) => Object.keys(input).length === keys.length && keys.every((key) => Object.hasOwn(input, key));
|
|
16
|
+
/** Validates the immutable source identity without coercing unknown boundary fields. */
|
|
17
|
+
var parseSnapshot = (input) => {
|
|
18
|
+
if (!isObjectValid(input, true) || !keysMatch(input, ["id", "sourceKind"]) || typeof input["id"] !== "string" || input["id"].length === 0 || typeof input["sourceKind"] !== "string" || input["sourceKind"].length === 0) return invalidSource();
|
|
19
|
+
return {
|
|
20
|
+
id: input["id"],
|
|
21
|
+
sourceKind: input["sourceKind"]
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** Converts one validated metadata-only repository entry. */
|
|
25
|
+
var parseRpcEntry = (input) => {
|
|
26
|
+
if (input === null) return null;
|
|
27
|
+
if (!isObjectValid(input, true)) return invalidSource();
|
|
28
|
+
const entry = input;
|
|
29
|
+
if (!keysMatch(entry, [
|
|
30
|
+
"path",
|
|
31
|
+
"type",
|
|
32
|
+
"byteLength",
|
|
33
|
+
"contentIdentity"
|
|
34
|
+
]) || !isRepositoryPath(entry["path"]) || entry["type"] !== "file" && entry["type"] !== "directory" && entry["type"] !== "symlink" || entry["byteLength"] !== null && !isInteger(entry["byteLength"]) || entry["contentIdentity"] !== null && typeof entry["contentIdentity"] !== "string") return invalidSource();
|
|
35
|
+
return {
|
|
36
|
+
path: entry["path"],
|
|
37
|
+
type: entry["type"],
|
|
38
|
+
byteLength: entry["byteLength"],
|
|
39
|
+
contentIdentity: entry["contentIdentity"]
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/** Converts a bounded listing page while retaining snapshot and continuation contracts. */
|
|
43
|
+
var parseRpcEntryPage = (input) => {
|
|
44
|
+
if (!isObjectValid(input, true)) return invalidSource();
|
|
45
|
+
const page = input;
|
|
46
|
+
if (!keysMatch(page, [
|
|
47
|
+
"entries",
|
|
48
|
+
"isComplete",
|
|
49
|
+
"nextCursor",
|
|
50
|
+
"snapshot"
|
|
51
|
+
]) || !Array.isArray(page["entries"]) || page["entries"].length > 128 || typeof page["isComplete"] !== "boolean" || page["nextCursor"] !== null && typeof page["nextCursor"] !== "string") return invalidSource();
|
|
52
|
+
const entries = [];
|
|
53
|
+
for (const candidate of page["entries"]) {
|
|
54
|
+
const entry = parseRpcEntry(candidate);
|
|
55
|
+
if (entry === null) return invalidSource();
|
|
56
|
+
entries.push(entry);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
entries,
|
|
60
|
+
isComplete: page["isComplete"],
|
|
61
|
+
nextCursor: page["nextCursor"],
|
|
62
|
+
snapshot: parseSnapshot(page["snapshot"])
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/** Converts one link's stored text, admitting only text within the shared byte limit. */
|
|
66
|
+
var parseRpcLinkText = (input) => {
|
|
67
|
+
if (input === null) return null;
|
|
68
|
+
if (typeof input !== "string" || Buffer.byteLength(input, "utf8") > REPOSITORY_LINK_TEXT_MAX_BYTES) return invalidSource();
|
|
69
|
+
return input;
|
|
70
|
+
};
|
|
71
|
+
/** Decodes only an admitted 64 KiB binary page, never a complete repository file. */
|
|
72
|
+
var parseRpcFilePage = (input) => {
|
|
73
|
+
if (!isObjectValid(input, true)) return invalidSource();
|
|
74
|
+
const filePage = input;
|
|
75
|
+
if (!keysMatch(filePage, [
|
|
76
|
+
"bytes",
|
|
77
|
+
"isComplete",
|
|
78
|
+
"nextOffset",
|
|
79
|
+
"offset",
|
|
80
|
+
"snapshot",
|
|
81
|
+
"totalBytes"
|
|
82
|
+
]) || typeof filePage["bytes"] !== "string" || filePage["bytes"].length > Math.ceil(65536 / 3) * 4 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(filePage["bytes"]) || typeof filePage["isComplete"] !== "boolean" || !isInteger(filePage["offset"]) || !isInteger(filePage["totalBytes"]) || filePage["nextOffset"] !== null && !isInteger(filePage["nextOffset"])) return invalidSource();
|
|
83
|
+
const bytes = Buffer.from(filePage["bytes"], "base64");
|
|
84
|
+
if (bytes.byteLength > 65536 || bytes.toString("base64") !== filePage["bytes"]) return invalidSource();
|
|
85
|
+
return {
|
|
86
|
+
bytes,
|
|
87
|
+
isComplete: filePage["isComplete"],
|
|
88
|
+
nextOffset: filePage["nextOffset"],
|
|
89
|
+
offset: filePage["offset"],
|
|
90
|
+
snapshot: parseSnapshot(filePage["snapshot"]),
|
|
91
|
+
totalBytes: filePage["totalBytes"]
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
/** Encodes one bounded byte page after confirming it respects the requested bound. */
|
|
95
|
+
var encodeFilePage = (page, maxBytes) => {
|
|
96
|
+
if (!(page.bytes instanceof Uint8Array) || page.bytes.byteLength > maxBytes) return invalidSource();
|
|
97
|
+
const result = {
|
|
98
|
+
...page,
|
|
99
|
+
bytes: Buffer.from(page.bytes.buffer, page.bytes.byteOffset, page.bytes.byteLength).toString("base64")
|
|
100
|
+
};
|
|
101
|
+
parseRpcFilePage(result);
|
|
102
|
+
return result;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Calls the real reader with inspection cancellation and returns a bounded transport value.
|
|
106
|
+
* Reader failures propagate unchanged to the parent inspection owner.
|
|
107
|
+
* @returns A metadata value, link text, or encoded byte page after actual reader settlement.
|
|
108
|
+
* @throws
|
|
109
|
+
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
110
|
+
* - ENTRY_NOT_FOUND: The requested repository entry was not found.
|
|
111
|
+
* - ENTRY_NOT_FILE: The requested repository entry is not a file.
|
|
112
|
+
* - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.
|
|
113
|
+
* - ENTRY_NOT_LINK: The requested repository entry is not a symlink.
|
|
114
|
+
* - INVALID_PAGE_REQUEST: The repository page request is invalid.
|
|
115
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
116
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
117
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
|
|
118
|
+
* - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.
|
|
119
|
+
* - INVALID_SOURCE_DATA: The repository source returned invalid data.
|
|
120
|
+
* - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
|
|
121
|
+
* - ABORTED: The repository operation was aborted.
|
|
122
|
+
*/
|
|
123
|
+
var executeRepositoryRpc = async (sources, request, signal) => {
|
|
124
|
+
const getReader = (source) => source === "repository" ? sources.repository : sources.instructions ?? invalidSource();
|
|
125
|
+
if (request.method === "readLinkText") return parseRpcLinkText(await getReader(request.source).readLinkText(parseRepositoryPath(request.path), { signal }));
|
|
126
|
+
if (request.method === "getEntry") return parseRpcEntry(await getReader(request.source).getEntry(parseRepositoryPath(request.path), { signal }));
|
|
127
|
+
const reader = sources.repository;
|
|
128
|
+
if (request.method === "listEntriesPage") return parseRpcEntryPage(await reader.listEntriesPage({
|
|
129
|
+
maxEntries: request.maxEntries,
|
|
130
|
+
signal,
|
|
131
|
+
...request.prefix === void 0 ? {} : { prefix: parseRepositoryPath(request.prefix) },
|
|
132
|
+
...request.cursor === void 0 ? {} : { cursor: request.cursor }
|
|
133
|
+
}));
|
|
134
|
+
return encodeFilePage(await getReader(request.source).readFilePage(parseRepositoryPath(request.path), {
|
|
135
|
+
maxBytes: request.maxBytes,
|
|
136
|
+
offset: request.offset,
|
|
137
|
+
signal
|
|
138
|
+
}), request.maxBytes);
|
|
139
|
+
};
|
|
140
|
+
//#endregion
|
|
141
|
+
export { parseRpcLinkText as a, parseRpcFilePage as i, parseRpcEntry as n, parseRpcEntryPage as r, executeRepositoryRpc as t };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=repository-rpc-B9YaeLba.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-rpc-B9YaeLba.js","names":[],"sources":["../../src/node-inspection/repository-rpc.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport { isObjectValid } from 'jg-utilities';\n\nimport {\n REPOSITORY_LINK_TEXT_MAX_BYTES,\n isRepositoryPath,\n parseRepositoryPath,\n RepositorySourceException,\n type IRepositoryEntry,\n type IRepositoryEntryPage,\n type IRepositoryFilePage,\n type IRepositoryReader,\n type IRepositorySnapshot,\n} from '@moldea.ai/repository';\n\nimport { NODE_INSPECTION_FILE_PAGE_BYTES } from './constants.js';\nimport type { INodeReaderRequest, INodeReaderSources } from './types.js';\n\nconst invalidSource = (): never => {\n throw new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'create-reader',\n path: null,\n retryable: false,\n });\n};\nconst isInteger = (input: unknown): input is number =>\n typeof input === 'number' && Number.isSafeInteger(input) && input >= 0;\nconst keysMatch = (input: Readonly<Record<string, unknown>>, keys: string[]): boolean =>\n Object.keys(input).length === keys.length && keys.every((key) => Object.hasOwn(input, key));\n\n/** Validates the immutable source identity without coercing unknown boundary fields. */\nconst parseSnapshot = (input: unknown): IRepositorySnapshot => {\n if (\n !isObjectValid(input, true) ||\n !keysMatch(input, ['id', 'sourceKind']) ||\n typeof input['id'] !== 'string' ||\n input['id'].length === 0 ||\n typeof input['sourceKind'] !== 'string' ||\n input['sourceKind'].length === 0\n )\n return invalidSource();\n return { id: input['id'], sourceKind: input['sourceKind'] };\n};\n\n/** Converts one validated metadata-only repository entry. */\nexport const parseRpcEntry = (input: unknown): IRepositoryEntry | null => {\n if (input === null) return null;\n if (!isObjectValid(input, true)) return invalidSource();\n const entry: Readonly<Record<string, unknown>> = input;\n if (\n !keysMatch(entry, ['path', 'type', 'byteLength', 'contentIdentity']) ||\n !isRepositoryPath(entry['path']) ||\n (entry['type'] !== 'file' && entry['type'] !== 'directory' && entry['type'] !== 'symlink') ||\n (entry['byteLength'] !== null && !isInteger(entry['byteLength'])) ||\n (entry['contentIdentity'] !== null && typeof entry['contentIdentity'] !== 'string')\n )\n return invalidSource();\n return {\n path: entry['path'],\n type: entry['type'],\n byteLength: entry['byteLength'],\n contentIdentity: entry['contentIdentity'],\n };\n};\n\n/** Converts a bounded listing page while retaining snapshot and continuation contracts. */\nexport const parseRpcEntryPage = (input: unknown): IRepositoryEntryPage => {\n if (!isObjectValid(input, true)) return invalidSource();\n const page: Readonly<Record<string, unknown>> = input;\n if (\n !keysMatch(page, ['entries', 'isComplete', 'nextCursor', 'snapshot']) ||\n !Array.isArray(page['entries']) ||\n page['entries'].length > 128 ||\n typeof page['isComplete'] !== 'boolean' ||\n (page['nextCursor'] !== null && typeof page['nextCursor'] !== 'string')\n )\n return invalidSource();\n const entries: IRepositoryEntry[] = [];\n for (const candidate of page['entries']) {\n const entry = parseRpcEntry(candidate);\n if (entry === null) return invalidSource();\n entries.push(entry);\n }\n return {\n entries,\n isComplete: page['isComplete'],\n nextCursor: page['nextCursor'],\n snapshot: parseSnapshot(page['snapshot']),\n };\n};\n\n/** Converts one link's stored text, admitting only text within the shared byte limit. */\nexport const parseRpcLinkText = (input: unknown): string | null => {\n if (input === null) return null;\n if (\n typeof input !== 'string' ||\n Buffer.byteLength(input, 'utf8') > REPOSITORY_LINK_TEXT_MAX_BYTES\n )\n return invalidSource();\n return input;\n};\n\n/** Decodes only an admitted 64 KiB binary page, never a complete repository file. */\nexport const parseRpcFilePage = (input: unknown): IRepositoryFilePage => {\n if (!isObjectValid(input, true)) return invalidSource();\n const filePage: Readonly<Record<string, unknown>> = input;\n if (\n !keysMatch(filePage, [\n 'bytes',\n 'isComplete',\n 'nextOffset',\n 'offset',\n 'snapshot',\n 'totalBytes',\n ]) ||\n typeof filePage['bytes'] !== 'string' ||\n filePage['bytes'].length > Math.ceil(NODE_INSPECTION_FILE_PAGE_BYTES / 3) * 4 ||\n !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(filePage['bytes']) ||\n typeof filePage['isComplete'] !== 'boolean' ||\n !isInteger(filePage['offset']) ||\n !isInteger(filePage['totalBytes']) ||\n (filePage['nextOffset'] !== null && !isInteger(filePage['nextOffset']))\n )\n return invalidSource();\n const bytes = Buffer.from(filePage['bytes'], 'base64');\n if (\n bytes.byteLength > NODE_INSPECTION_FILE_PAGE_BYTES ||\n bytes.toString('base64') !== filePage['bytes']\n )\n return invalidSource();\n return {\n bytes,\n isComplete: filePage['isComplete'],\n nextOffset: filePage['nextOffset'],\n offset: filePage['offset'],\n snapshot: parseSnapshot(filePage['snapshot']),\n totalBytes: filePage['totalBytes'],\n };\n};\n\n/** Encodes one bounded byte page after confirming it respects the requested bound. */\nconst encodeFilePage = (page: IRepositoryFilePage, maxBytes: number): unknown => {\n if (!(page.bytes instanceof Uint8Array) || page.bytes.byteLength > maxBytes)\n return invalidSource();\n const result = {\n ...page,\n bytes: Buffer.from(page.bytes.buffer, page.bytes.byteOffset, page.bytes.byteLength).toString(\n 'base64',\n ),\n };\n parseRpcFilePage(result);\n return result;\n};\n\n/**\n * Calls the real reader with inspection cancellation and returns a bounded transport value.\n * Reader failures propagate unchanged to the parent inspection owner.\n * @returns A metadata value, link text, or encoded byte page after actual reader settlement.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_FILE: The requested repository entry is not a file.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\n * - ENTRY_NOT_LINK: The requested repository entry is not a symlink.\n * - INVALID_PAGE_REQUEST: The repository page request is invalid.\n * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.\n * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\nexport const executeRepositoryRpc = async (\n sources: INodeReaderSources,\n request: INodeReaderRequest,\n signal: AbortSignal,\n): Promise<unknown> => {\n const getReader = (source: 'instructions' | 'repository'): IRepositoryReader =>\n source === 'repository' ? sources.repository : (sources.instructions ?? invalidSource());\n if (request.method === 'readLinkText')\n return parseRpcLinkText(\n await getReader(request.source).readLinkText(parseRepositoryPath(request.path), { signal }),\n );\n if (request.method === 'getEntry')\n return parseRpcEntry(\n await getReader(request.source).getEntry(parseRepositoryPath(request.path), { signal }),\n );\n const reader = sources.repository;\n if (request.method === 'listEntriesPage')\n return parseRpcEntryPage(\n await reader.listEntriesPage({\n maxEntries: request.maxEntries,\n signal,\n ...(request.prefix === undefined ? {} : { prefix: parseRepositoryPath(request.prefix) }),\n ...(request.cursor === undefined ? {} : { cursor: request.cursor }),\n }),\n );\n return encodeFilePage(\n await getReader(request.source).readFilePage(parseRepositoryPath(request.path), {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