@moldea.ai/core 5.0.1 → 7.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 +12 -11
- package/dist/analysis-worker.js +180 -0
- package/dist/analysis-worker.js.map +1 -0
- package/dist/binding-coverage/index.d.ts +26 -0
- package/dist/binding-coverage/index.d.ts.map +1 -0
- package/dist/chunks/core-Cdeiu6xG.js +3364 -0
- package/dist/chunks/core-Cdeiu6xG.js.map +1 -0
- package/dist/chunks/errors-BE4DS3Ak.js +435 -0
- package/dist/chunks/errors-BE4DS3Ak.js.map +1 -0
- package/dist/chunks/{exceptions-HS9ofVy2.js → exceptions-IXsorE8t.js} +27 -28
- package/dist/chunks/exceptions-IXsorE8t.js.map +1 -0
- package/dist/chunks/lifecycle-D_RvxhDC.js +67 -0
- package/dist/chunks/lifecycle-D_RvxhDC.js.map +1 -0
- package/dist/chunks/options-5x9gu2Qb.js +604 -0
- package/dist/chunks/options-5x9gu2Qb.js.map +1 -0
- package/dist/chunks/repository-rpc-B_y0Kspf.js +124 -0
- package/dist/chunks/repository-rpc-B_y0Kspf.js.map +1 -0
- package/dist/chunks/scope-AGMcHUE_.js +1827 -0
- package/dist/chunks/scope-AGMcHUE_.js.map +1 -0
- package/dist/chunks/syntax-CVvExx4R.js +137 -0
- package/dist/chunks/syntax-CVvExx4R.js.map +1 -0
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +37 -27
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/decision/index.d.ts +1 -1
- package/dist/decision-graph/index.d.ts +9 -7
- package/dist/decision-graph/index.d.ts.map +1 -1
- package/dist/diagnostic-utilities/index.d.ts +6 -2
- package/dist/diagnostic-utilities/index.d.ts.map +1 -1
- package/dist/diagnostics/index.d.ts +21 -33
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/exceptions/index.d.ts +25 -10
- package/dist/exceptions/index.d.ts.map +1 -1
- package/dist/export-inventory/index.d.ts +3 -0
- package/dist/export-inventory/index.d.ts.map +1 -0
- package/dist/export-inventory/inventory.d.ts +22 -0
- package/dist/export-inventory/inventory.d.ts.map +1 -0
- package/dist/export-inventory/syntax.d.ts +4 -0
- package/dist/export-inventory/syntax.d.ts.map +1 -0
- package/dist/export-inventory/types.d.ts +9 -0
- package/dist/export-inventory/types.d.ts.map +1 -0
- package/dist/format/index.d.ts +8 -0
- package/dist/format/index.d.ts.map +1 -1
- package/dist/impact-pattern-validation/index.d.ts +2 -0
- package/dist/impact-pattern-validation/index.d.ts.map +1 -0
- package/dist/impact-pattern-validation/inspection.d.ts +24 -0
- package/dist/impact-pattern-validation/inspection.d.ts.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5776
- package/dist/integration-validation/index.d.ts +4 -0
- package/dist/integration-validation/index.d.ts.map +1 -0
- package/dist/integration-validation/inspection.d.ts +18 -0
- package/dist/integration-validation/inspection.d.ts.map +1 -0
- package/dist/integration-validation/parser.d.ts +9 -0
- package/dist/integration-validation/parser.d.ts.map +1 -0
- package/dist/integration-validation/types.d.ts +13 -0
- package/dist/integration-validation/types.d.ts.map +1 -0
- package/dist/manifest/index.d.ts +2 -4
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest-validation/index.d.ts +7 -10
- package/dist/manifest-validation/index.d.ts.map +1 -1
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node-inspection/analysis-worker.d.ts +2 -0
- package/dist/node-inspection/analysis-worker.d.ts.map +1 -0
- package/dist/node-inspection/client.d.ts +28 -0
- package/dist/node-inspection/client.d.ts.map +1 -0
- package/dist/node-inspection/constants.d.ts +21 -0
- package/dist/node-inspection/constants.d.ts.map +1 -0
- package/dist/node-inspection/errors.d.ts +11 -0
- package/dist/node-inspection/errors.d.ts.map +1 -0
- package/dist/node-inspection/lifecycle.d.ts +15 -0
- package/dist/node-inspection/lifecycle.d.ts.map +1 -0
- package/dist/node-inspection/protocol.d.ts +20 -0
- package/dist/node-inspection/protocol.d.ts.map +1 -0
- package/dist/node-inspection/repository-rpc.d.ts +28 -0
- package/dist/node-inspection/repository-rpc.d.ts.map +1 -0
- package/dist/node-inspection/runner.d.ts +2 -0
- package/dist/node-inspection/runner.d.ts.map +1 -0
- package/dist/node-inspection/types.d.ts +95 -0
- package/dist/node-inspection/types.d.ts.map +1 -0
- package/dist/node-runner.js +149 -0
- package/dist/node-runner.js.map +1 -0
- package/dist/node.js +335 -0
- package/dist/node.js.map +1 -0
- package/dist/options/index.d.ts +2 -14
- package/dist/options/index.d.ts.map +1 -1
- package/dist/project-inspection/index.d.ts +21 -1
- package/dist/project-inspection/index.d.ts.map +1 -1
- package/dist/project-validation/index.d.ts +33 -11
- package/dist/project-validation/index.d.ts.map +1 -1
- package/dist/repository-inspection-session/index.d.ts +2 -4
- package/dist/repository-inspection-session/index.d.ts.map +1 -1
- package/dist/repository-reference-validation/index.d.ts +12 -6
- package/dist/repository-reference-validation/index.d.ts.map +1 -1
- package/dist/retained-memory/index.d.ts +18 -0
- package/dist/retained-memory/index.d.ts.map +1 -0
- package/dist/scope/index.d.ts +3 -0
- package/dist/scope/index.d.ts.map +1 -0
- package/dist/scope/scope.d.ts +13 -0
- package/dist/scope/scope.d.ts.map +1 -0
- package/dist/scope-matching/index.d.ts +2 -1
- package/dist/scope-matching/index.d.ts.map +1 -1
- package/dist/scope-matching/matching.d.ts +11 -2
- package/dist/scope-matching/matching.d.ts.map +1 -1
- package/dist/scope-matching/patterns.d.ts +4 -0
- package/dist/scope-matching/patterns.d.ts.map +1 -0
- package/dist/scope.js +17 -0
- package/dist/scope.js.map +1 -0
- package/dist/universal-project-inspection/index.d.ts +13 -11
- package/dist/universal-project-inspection/index.d.ts.map +1 -1
- package/dist/warning-acceptance/acceptance.d.ts +11 -0
- package/dist/warning-acceptance/acceptance.d.ts.map +1 -0
- package/dist/warning-acceptance/index.d.ts +2 -0
- package/dist/warning-acceptance/index.d.ts.map +1 -0
- package/package.json +14 -6
- package/dist/adapter/index.d.ts +0 -131
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapter-availability/index.d.ts +0 -15
- package/dist/adapter-availability/index.d.ts.map +0 -1
- package/dist/adapter-execution/index.d.ts +0 -31
- package/dist/adapter-execution/index.d.ts.map +0 -1
- package/dist/adapter-repository/index.d.ts +0 -27
- package/dist/adapter-repository/index.d.ts.map +0 -1
- package/dist/adapter-retained-memory/index.d.ts +0 -8
- package/dist/adapter-retained-memory/index.d.ts.map +0 -1
- package/dist/adapter-validation/index.d.ts +0 -43
- package/dist/adapter-validation/index.d.ts.map +0 -1
- package/dist/adapter.js +0 -115
- package/dist/adapter.js.map +0 -1
- package/dist/chunks/exceptions-HS9ofVy2.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { a as isCoreOperationErrorCode, i as isCoreOperation, n as CoreOperationException, r as isCoreConfigurationErrorCode, t as CoreConfigurationException } from "./exceptions-IXsorE8t.js";
|
|
2
|
+
import { RepositoryPathException, RepositorySourceException, isRepositoryPath } from "@moldea.ai/repository";
|
|
3
|
+
import { Buffer } from "node:buffer";
|
|
4
|
+
//#region src/node-inspection/constants.ts
|
|
5
|
+
var NODE_INSPECTION_LIFETIME_MS = 12e4;
|
|
6
|
+
var NODE_INSPECTION_TERMINATION_GRACE_MS = 1e3;
|
|
7
|
+
var NODE_INSPECTION_FILE_PAGE_BYTES = 65536;
|
|
8
|
+
var NODE_INSPECTION_MESSAGE_BYTES = 1048576;
|
|
9
|
+
var NODE_INSPECTION_STDIO_BYTES = 32768;
|
|
10
|
+
var NODE_INSPECTION_TRANSPORT_BYTES = 4 * NODE_INSPECTION_MESSAGE_BYTES * 2 * 2 * 3;
|
|
11
|
+
var NODE_INSPECTION_PROFILE = Object.freeze({
|
|
12
|
+
lifetimeMs: NODE_INSPECTION_LIFETIME_MS,
|
|
13
|
+
terminationGraceMs: NODE_INSPECTION_TERMINATION_GRACE_MS,
|
|
14
|
+
maxReaderRequests: 4,
|
|
15
|
+
maxFilePageBytes: NODE_INSPECTION_FILE_PAGE_BYTES,
|
|
16
|
+
maxMessageBytes: NODE_INSPECTION_MESSAGE_BYTES,
|
|
17
|
+
maxStdioBytes: NODE_INSPECTION_STDIO_BYTES,
|
|
18
|
+
transportBytes: NODE_INSPECTION_TRANSPORT_BYTES,
|
|
19
|
+
oldGenerationMiB: 512,
|
|
20
|
+
youngGenerationMiB: 24
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/node-inspection/protocol.ts
|
|
24
|
+
/** Creates the safe failure for an untrusted or inconsistent private protocol record. */
|
|
25
|
+
var createInspectionProcessFailure = (cause) => new CoreOperationException({
|
|
26
|
+
code: "INSPECTION_PROCESS_FAILED",
|
|
27
|
+
operation: "create-project-inspection",
|
|
28
|
+
...cause === void 0 ? {} : { cause }
|
|
29
|
+
});
|
|
30
|
+
var isRecord = (input) => input !== null && typeof input === "object" && !Array.isArray(input);
|
|
31
|
+
var JSON_SHORT_ESCAPES = /* @__PURE__ */ new Set([
|
|
32
|
+
8,
|
|
33
|
+
9,
|
|
34
|
+
10,
|
|
35
|
+
12,
|
|
36
|
+
13
|
|
37
|
+
]);
|
|
38
|
+
var isInteger = (input) => typeof input === "number" && Number.isSafeInteger(input) && input >= 0;
|
|
39
|
+
var hasKeys = (input, required, optional = []) => required.every((key) => Object.hasOwn(input, key)) && Object.keys(input).every((key) => required.includes(key) || optional.includes(key));
|
|
40
|
+
var isSnapshot = (input) => isRecord(input) && hasKeys(input, ["id", "sourceKind"]) && typeof input["id"] === "string" && input["id"].length > 0 && typeof input["sourceKind"] === "string" && input["sourceKind"].length > 0;
|
|
41
|
+
var isOptionalString = (input, key) => !Object.hasOwn(input, key) || typeof input[key] === "string";
|
|
42
|
+
var isPageInput = (input) => isRecord(input) && hasKeys(input, ["maxItems", "view"], ["cursor"]) && isInteger(input["maxItems"]) && input["maxItems"] > 0 && [
|
|
43
|
+
"all",
|
|
44
|
+
"diagnostics",
|
|
45
|
+
"coverage",
|
|
46
|
+
"metadata"
|
|
47
|
+
].includes(String(input["view"])) && isOptionalString(input, "cursor");
|
|
48
|
+
var isLimits = (input) => isRecord(input) && hasKeys(input, [
|
|
49
|
+
"maxEntries",
|
|
50
|
+
"maxTotalBytesRead",
|
|
51
|
+
"maxFileBytes",
|
|
52
|
+
"maxManifestBytes",
|
|
53
|
+
"maxRetainedBytes",
|
|
54
|
+
"maxDiagnostics",
|
|
55
|
+
"maxCoverage",
|
|
56
|
+
"maxAcceptedWarnings"
|
|
57
|
+
]) && Object.values(input).every((limit) => isInteger(limit) && limit > 0);
|
|
58
|
+
var isCounts = (input) => isRecord(input) && hasKeys(input, [
|
|
59
|
+
"agents",
|
|
60
|
+
"context",
|
|
61
|
+
"decisions",
|
|
62
|
+
"mirrors",
|
|
63
|
+
"runtimes",
|
|
64
|
+
"unresolved",
|
|
65
|
+
"diagnostics",
|
|
66
|
+
"errors",
|
|
67
|
+
"warnings",
|
|
68
|
+
"acceptedWarnings",
|
|
69
|
+
"coverage",
|
|
70
|
+
"metadata"
|
|
71
|
+
]) && Object.values(input).every(isInteger);
|
|
72
|
+
var isSummary = (input) => input === null || isRecord(input) && hasKeys(input, [
|
|
73
|
+
"counts",
|
|
74
|
+
"manifestDigest",
|
|
75
|
+
"manifestPath",
|
|
76
|
+
"projectDigest",
|
|
77
|
+
"projectPath"
|
|
78
|
+
]) && isRecord(input["counts"]) && hasKeys(input["counts"], [
|
|
79
|
+
"agents",
|
|
80
|
+
"context",
|
|
81
|
+
"decisions",
|
|
82
|
+
"mirrors",
|
|
83
|
+
"runtimes",
|
|
84
|
+
"unresolved"
|
|
85
|
+
]) && Object.values(input["counts"]).every(isInteger) && typeof input["manifestDigest"] === "string" && typeof input["projectDigest"] === "string" && isRepositoryPath(input["manifestPath"]) && isRepositoryPath(input["projectPath"]);
|
|
86
|
+
var isInspectionBase = (input) => isCounts(input["counts"]) && isRecord(input["coverageCounts"]) && hasKeys(input["coverageCounts"], [
|
|
87
|
+
"bindings",
|
|
88
|
+
"exportsPassed",
|
|
89
|
+
"exportsFailed",
|
|
90
|
+
"exportsNotChecked"
|
|
91
|
+
]) && Object.values(input["coverageCounts"]).every(isInteger) && typeof input["valid"] === "boolean" && (input["formatVersion"] === null || input["formatVersion"] === 1) && typeof input["inspectionDigest"] === "string" && isSnapshot(input["source"]) && isSummary(input["summary"]);
|
|
92
|
+
var INSPECTION_KEYS = [
|
|
93
|
+
"counts",
|
|
94
|
+
"coverageCounts",
|
|
95
|
+
"valid",
|
|
96
|
+
"formatVersion",
|
|
97
|
+
"inspectionDigest",
|
|
98
|
+
"source",
|
|
99
|
+
"summary"
|
|
100
|
+
];
|
|
101
|
+
var isMetadata = (input) => isRecord(input) && hasKeys(input, [
|
|
102
|
+
...INSPECTION_KEYS,
|
|
103
|
+
"resourceUsage",
|
|
104
|
+
"maxAnalysisHeapBytes"
|
|
105
|
+
]) && isInspectionBase(input) && isInteger(input["maxAnalysisHeapBytes"]) && input["maxAnalysisHeapBytes"] > 0 && isRecord(input["resourceUsage"]) && hasKeys(input["resourceUsage"], [
|
|
106
|
+
"canonicalBytes",
|
|
107
|
+
"peakRetainedBytes",
|
|
108
|
+
"preparedBytes",
|
|
109
|
+
"retainedBytes",
|
|
110
|
+
"totalBytesRead"
|
|
111
|
+
]) && Object.values(input["resourceUsage"]).every(isInteger);
|
|
112
|
+
var isPage = (input) => isRecord(input) && hasKeys(input, [
|
|
113
|
+
...INSPECTION_KEYS,
|
|
114
|
+
"page",
|
|
115
|
+
"view"
|
|
116
|
+
]) && isInspectionBase(input) && [
|
|
117
|
+
"all",
|
|
118
|
+
"diagnostics",
|
|
119
|
+
"coverage",
|
|
120
|
+
"metadata"
|
|
121
|
+
].includes(String(input["view"])) && isRecord(input["page"]) && hasKeys(input["page"], [
|
|
122
|
+
"isComplete",
|
|
123
|
+
"records",
|
|
124
|
+
"nextCursor",
|
|
125
|
+
"totalItems"
|
|
126
|
+
]) && typeof input["page"]["isComplete"] === "boolean" && isInteger(input["page"]["totalItems"]) && (input["page"]["nextCursor"] === null || typeof input["page"]["nextCursor"] === "string") && Array.isArray(input["page"]["records"]) && input["page"]["records"].every((record) => isRecord(record) && hasKeys(record, ["item", "nextCursor"]) && (record["nextCursor"] === null || typeof record["nextCursor"] === "string") && isRecord(record["item"]) && typeof record["item"]["kind"] === "string" && [
|
|
127
|
+
"agent",
|
|
128
|
+
"diagnostic",
|
|
129
|
+
"coverage",
|
|
130
|
+
"metadata"
|
|
131
|
+
].includes(record["item"]["kind"]) && hasKeys(record["item"], ["kind", record["item"]["kind"]]) && isRecord(record["item"][record["item"]["kind"]]));
|
|
132
|
+
var isRequest = (input) => {
|
|
133
|
+
if (!isRecord(input)) return false;
|
|
134
|
+
switch (input["method"]) {
|
|
135
|
+
case "getEntry": return hasKeys(input, ["method", "path"]) && isRepositoryPath(input["path"]);
|
|
136
|
+
case "listEntriesPage": return hasKeys(input, ["method", "maxEntries"], ["cursor", "prefix"]) && isInteger(input["maxEntries"]) && input["maxEntries"] > 0 && input["maxEntries"] <= 128 && isOptionalString(input, "cursor") && (!Object.hasOwn(input, "prefix") || isRepositoryPath(input["prefix"]));
|
|
137
|
+
case "readFilePage": return hasKeys(input, [
|
|
138
|
+
"method",
|
|
139
|
+
"path",
|
|
140
|
+
"maxBytes",
|
|
141
|
+
"offset"
|
|
142
|
+
]) && isRepositoryPath(input["path"]) && isInteger(input["offset"]) && isInteger(input["maxBytes"]) && input["maxBytes"] > 0 && input["maxBytes"] <= 65536;
|
|
143
|
+
default: return false;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/** Validates closed control envelopes and their typed operation payloads on both bridges. */
|
|
147
|
+
var isMessage = (input) => {
|
|
148
|
+
if (!isRecord(input) || typeof input["attemptId"] !== "string" || !/^[a-f0-9]{32}$/.test(input["attemptId"])) return false;
|
|
149
|
+
const keys = ["attemptId", "kind"];
|
|
150
|
+
switch (input["kind"]) {
|
|
151
|
+
case "start": return hasKeys(input, [
|
|
152
|
+
...keys,
|
|
153
|
+
"snapshot",
|
|
154
|
+
"limits",
|
|
155
|
+
"deadline"
|
|
156
|
+
]) && isSnapshot(input["snapshot"]) && isLimits(input["limits"]) && isInteger(input["deadline"]);
|
|
157
|
+
case "ready": return hasKeys(input, [...keys, "maxAnalysisHeapBytes"]) && isInteger(input["maxAnalysisHeapBytes"]) && input["maxAnalysisHeapBytes"] > 0;
|
|
158
|
+
case "run":
|
|
159
|
+
case "dispose": return hasKeys(input, keys);
|
|
160
|
+
case "prepared": return hasKeys(input, [...keys, "inspection"]) && isMetadata(input["inspection"]);
|
|
161
|
+
case "read-page": return hasKeys(input, [
|
|
162
|
+
...keys,
|
|
163
|
+
"requestId",
|
|
164
|
+
"input"
|
|
165
|
+
]) && isInteger(input["requestId"]) && isPageInput(input["input"]);
|
|
166
|
+
case "page": return hasKeys(input, [
|
|
167
|
+
...keys,
|
|
168
|
+
"requestId",
|
|
169
|
+
"result"
|
|
170
|
+
]) && isInteger(input["requestId"]) && isPage(input["result"]);
|
|
171
|
+
case "reader-request": return hasKeys(input, [
|
|
172
|
+
...keys,
|
|
173
|
+
"requestId",
|
|
174
|
+
"request"
|
|
175
|
+
]) && isInteger(input["requestId"]) && isRequest(input["request"]);
|
|
176
|
+
case "reader-response": return hasKeys(input, [
|
|
177
|
+
...keys,
|
|
178
|
+
"requestId",
|
|
179
|
+
"result"
|
|
180
|
+
]) && isInteger(input["requestId"]);
|
|
181
|
+
case "reader-failure":
|
|
182
|
+
case "failure": return hasKeys(input, [
|
|
183
|
+
...keys,
|
|
184
|
+
"failure",
|
|
185
|
+
...input["kind"] === "reader-failure" ? ["requestId"] : []
|
|
186
|
+
]) && (input["kind"] !== "reader-failure" || isInteger(input["requestId"])) && isRecord(input["failure"]) && hasKeys(input["failure"], ["family", "options"]) && [
|
|
187
|
+
"configuration",
|
|
188
|
+
"operation",
|
|
189
|
+
"repository",
|
|
190
|
+
"path"
|
|
191
|
+
].includes(String(input["failure"]["family"])) && isRecord(input["failure"]["options"]);
|
|
192
|
+
default: return false;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
/** Counts escaped JSON bytes without first allocating a serialized oversized message. */
|
|
196
|
+
var countJsonBytes = (input, ancestors, depth) => {
|
|
197
|
+
if (depth > 64) throw createInspectionProcessFailure();
|
|
198
|
+
if (input === null) return 4;
|
|
199
|
+
if (typeof input === "boolean") return input ? 4 : 5;
|
|
200
|
+
if (typeof input === "number" && Number.isFinite(input)) return String(input).length;
|
|
201
|
+
if (typeof input === "string") {
|
|
202
|
+
let bytes = 2;
|
|
203
|
+
for (let index = 0; index < input.length; index++) {
|
|
204
|
+
const code = input.charCodeAt(index);
|
|
205
|
+
if (code === 34 || code === 92 || JSON_SHORT_ESCAPES.has(code)) bytes += 2;
|
|
206
|
+
else if (code < 32) bytes += 6;
|
|
207
|
+
else if (code < 128) bytes++;
|
|
208
|
+
else if (code < 2048) bytes += 2;
|
|
209
|
+
else if (code >= 55296 && code <= 56319 && index + 1 < input.length && input.charCodeAt(index + 1) >= 56320 && input.charCodeAt(index + 1) <= 57343) {
|
|
210
|
+
bytes += 4;
|
|
211
|
+
index++;
|
|
212
|
+
} else bytes += code >= 55296 && code <= 57343 ? 6 : 3;
|
|
213
|
+
if (bytes > 1048576) return bytes;
|
|
214
|
+
}
|
|
215
|
+
return bytes;
|
|
216
|
+
}
|
|
217
|
+
if (typeof input !== "object" || ancestors.has(input)) throw createInspectionProcessFailure();
|
|
218
|
+
ancestors.add(input);
|
|
219
|
+
let bytes = 2;
|
|
220
|
+
let count = 0;
|
|
221
|
+
if (Array.isArray(input)) for (const element of input) {
|
|
222
|
+
bytes += (count++ === 0 ? 0 : 1) + countJsonBytes(element, ancestors, depth + 1);
|
|
223
|
+
if (bytes > 1048576) break;
|
|
224
|
+
}
|
|
225
|
+
else for (const key in input) {
|
|
226
|
+
if (!Object.hasOwn(input, key)) continue;
|
|
227
|
+
bytes += (count++ === 0 ? 0 : 1) + countJsonBytes(key, ancestors, depth + 1) + 1 + countJsonBytes(input[key], ancestors, depth + 1);
|
|
228
|
+
if (bytes > 1048576) break;
|
|
229
|
+
}
|
|
230
|
+
ancestors.delete(input);
|
|
231
|
+
return bytes;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Admits a complete bounded record before serialization; no record is truncated.
|
|
235
|
+
* @returns One private JSON frame.
|
|
236
|
+
* @throws
|
|
237
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
238
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
239
|
+
*/
|
|
240
|
+
var encodeInspectionMessage = (message) => {
|
|
241
|
+
const bytes = countJsonBytes(message, /* @__PURE__ */ new WeakSet(), 0);
|
|
242
|
+
if (bytes > 1048576) throw new CoreOperationException({
|
|
243
|
+
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
244
|
+
limit: "maxInspectionMessageBytes",
|
|
245
|
+
limitMaximum: NODE_INSPECTION_MESSAGE_BYTES,
|
|
246
|
+
observedUsage: bytes,
|
|
247
|
+
nextAction: null,
|
|
248
|
+
operation: "create-project-inspection"
|
|
249
|
+
});
|
|
250
|
+
if (!isMessage(message)) throw createInspectionProcessFailure();
|
|
251
|
+
return JSON.stringify(message);
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Checks frame size before parsing and validates the closed message contract.
|
|
255
|
+
* @returns A validated private message.
|
|
256
|
+
* @throws
|
|
257
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
258
|
+
*/
|
|
259
|
+
var decodeInspectionMessage = (frame) => {
|
|
260
|
+
if (typeof frame !== "string" || Buffer.byteLength(frame) > 1048576) throw createInspectionProcessFailure();
|
|
261
|
+
let message;
|
|
262
|
+
try {
|
|
263
|
+
message = JSON.parse(frame);
|
|
264
|
+
} catch (cause) {
|
|
265
|
+
throw createInspectionProcessFailure(cause);
|
|
266
|
+
}
|
|
267
|
+
if (!isMessage(message)) throw createInspectionProcessFailure();
|
|
268
|
+
return message;
|
|
269
|
+
};
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/node-inspection/errors.ts
|
|
272
|
+
/** Serializes only documented exception fields, excluding native messages, causes and stacks. */
|
|
273
|
+
var serializeInspectionFailure = (error) => {
|
|
274
|
+
if (error instanceof CoreConfigurationException) return {
|
|
275
|
+
family: "configuration",
|
|
276
|
+
options: {
|
|
277
|
+
code: error.code,
|
|
278
|
+
operation: error.operation
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
if (error instanceof CoreOperationException) return {
|
|
282
|
+
family: "operation",
|
|
283
|
+
options: {
|
|
284
|
+
code: error.code,
|
|
285
|
+
operation: error.operation,
|
|
286
|
+
...error.agentId === null ? {} : { agentId: error.agentId },
|
|
287
|
+
...error.code !== "RESOURCE_LIMIT_EXCEEDED" ? {} : {
|
|
288
|
+
limit: error.limit,
|
|
289
|
+
limitMaximum: error.limitMaximum,
|
|
290
|
+
nextAction: error.nextAction,
|
|
291
|
+
observedUsage: error.observedUsage
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
if (error instanceof RepositoryPathException) return {
|
|
296
|
+
family: "path",
|
|
297
|
+
options: {}
|
|
298
|
+
};
|
|
299
|
+
if (error instanceof RepositorySourceException) return {
|
|
300
|
+
family: "repository",
|
|
301
|
+
options: {
|
|
302
|
+
code: error.code,
|
|
303
|
+
operation: error.operation,
|
|
304
|
+
path: error.path,
|
|
305
|
+
retryable: error.retryable,
|
|
306
|
+
...error.resource === null ? {} : { resource: error.resource }
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
return {
|
|
310
|
+
family: "operation",
|
|
311
|
+
options: {
|
|
312
|
+
code: "INSPECTION_PROCESS_FAILED",
|
|
313
|
+
operation: "create-project-inspection"
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
var REPOSITORY_CODES = [
|
|
318
|
+
"ENTRY_NOT_FOUND",
|
|
319
|
+
"ENTRY_NOT_FILE",
|
|
320
|
+
"ENTRY_NOT_DIRECTORY",
|
|
321
|
+
"INVALID_PAGE_REQUEST",
|
|
322
|
+
"ACCESS_DENIED",
|
|
323
|
+
"SOURCE_UNAVAILABLE",
|
|
324
|
+
"SNAPSHOT_CHANGED",
|
|
325
|
+
"PROVIDER_INCOMPLETE",
|
|
326
|
+
"INVALID_SOURCE_DATA",
|
|
327
|
+
"RESOURCE_LIMIT_EXCEEDED",
|
|
328
|
+
"ABORTED"
|
|
329
|
+
];
|
|
330
|
+
var REPOSITORY_OPERATIONS = [
|
|
331
|
+
"create-reader",
|
|
332
|
+
"create-comparison",
|
|
333
|
+
"get-entry",
|
|
334
|
+
"read-file-page",
|
|
335
|
+
"list-entries-page",
|
|
336
|
+
"list-changes-page"
|
|
337
|
+
];
|
|
338
|
+
var isNumber = (input) => typeof input === "number" && Number.isSafeInteger(input) && input >= 0;
|
|
339
|
+
/**
|
|
340
|
+
* Reconstructs a documented typed failure after checking its safe transport fields.
|
|
341
|
+
* @returns A package exception without a remote native cause or stack.
|
|
342
|
+
* @throws
|
|
343
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
344
|
+
*/
|
|
345
|
+
var deserializeInspectionFailure = (failure) => {
|
|
346
|
+
const options = failure.options;
|
|
347
|
+
const allowed = failure.family === "configuration" ? ["code", "operation"] : failure.family === "operation" ? [
|
|
348
|
+
"code",
|
|
349
|
+
"operation",
|
|
350
|
+
"agentId",
|
|
351
|
+
"limit",
|
|
352
|
+
"limitMaximum",
|
|
353
|
+
"nextAction",
|
|
354
|
+
"observedUsage"
|
|
355
|
+
] : failure.family === "repository" ? [
|
|
356
|
+
"code",
|
|
357
|
+
"operation",
|
|
358
|
+
"path",
|
|
359
|
+
"retryable",
|
|
360
|
+
"resource"
|
|
361
|
+
] : [];
|
|
362
|
+
if (Object.keys(options).some((key) => !allowed.includes(key)) || Object.hasOwn(options, "agentId") && typeof options["agentId"] !== "string") throw createInspectionProcessFailure();
|
|
363
|
+
if ((failure.family === "operation" || failure.family === "configuration") && !isCoreOperation(options["operation"])) throw createInspectionProcessFailure();
|
|
364
|
+
const scope = {
|
|
365
|
+
operation: isCoreOperation(options["operation"]) ? options["operation"] : "create-project-inspection",
|
|
366
|
+
...typeof options["agentId"] === "string" ? { agentId: options["agentId"] } : {}
|
|
367
|
+
};
|
|
368
|
+
if (failure.family === "path" && Object.keys(options).length === 0) return new RepositoryPathException();
|
|
369
|
+
if (failure.family === "configuration") {
|
|
370
|
+
const code = options["code"];
|
|
371
|
+
if (isCoreConfigurationErrorCode(code)) return new CoreConfigurationException({
|
|
372
|
+
...scope,
|
|
373
|
+
code
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
if (failure.family === "operation") {
|
|
377
|
+
const code = options["code"];
|
|
378
|
+
if (isCoreOperationErrorCode(code) && code !== "RESOURCE_LIMIT_EXCEEDED" && ![
|
|
379
|
+
"limit",
|
|
380
|
+
"limitMaximum",
|
|
381
|
+
"nextAction",
|
|
382
|
+
"observedUsage"
|
|
383
|
+
].some((key) => Object.hasOwn(options, key))) return new CoreOperationException({
|
|
384
|
+
...scope,
|
|
385
|
+
code
|
|
386
|
+
});
|
|
387
|
+
if (options["code"] === "RESOURCE_LIMIT_EXCEEDED" && isNumber(options["limitMaximum"]) && options["limitMaximum"] > 0) {
|
|
388
|
+
if (options["limit"] === "maxAnalysisHeapBytes" && options["nextAction"] === "review-inspection-capacity" && options["observedUsage"] === null) return new CoreOperationException({
|
|
389
|
+
...scope,
|
|
390
|
+
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
391
|
+
limit: "maxAnalysisHeapBytes",
|
|
392
|
+
limitMaximum: options["limitMaximum"],
|
|
393
|
+
observedUsage: null,
|
|
394
|
+
nextAction: "review-inspection-capacity"
|
|
395
|
+
});
|
|
396
|
+
if ((options["limit"] === "maxInspectionMessageBytes" || options["limit"] === "maxReaderRequests") && options["nextAction"] === null && isNumber(options["observedUsage"])) return new CoreOperationException({
|
|
397
|
+
...scope,
|
|
398
|
+
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
399
|
+
limit: options["limit"],
|
|
400
|
+
limitMaximum: options["limitMaximum"],
|
|
401
|
+
nextAction: null,
|
|
402
|
+
observedUsage: options["observedUsage"]
|
|
403
|
+
});
|
|
404
|
+
if (typeof options["limit"] === "string" && ![
|
|
405
|
+
"maxAnalysisHeapBytes",
|
|
406
|
+
"maxInspectionMessageBytes",
|
|
407
|
+
"maxReaderRequests"
|
|
408
|
+
].includes(options["limit"]) && options["nextAction"] === "reduce-input-or-increase-limit" && isNumber(options["observedUsage"])) return new CoreOperationException({
|
|
409
|
+
...scope,
|
|
410
|
+
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
411
|
+
limit: options["limit"],
|
|
412
|
+
limitMaximum: options["limitMaximum"],
|
|
413
|
+
nextAction: "reduce-input-or-increase-limit",
|
|
414
|
+
observedUsage: options["observedUsage"]
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (failure.family === "repository") {
|
|
419
|
+
const code = REPOSITORY_CODES.find((candidate) => candidate === options["code"]);
|
|
420
|
+
const operation = REPOSITORY_OPERATIONS.find((candidate) => candidate === options["operation"]);
|
|
421
|
+
const resource = options["resource"];
|
|
422
|
+
if (code !== void 0 && operation !== void 0 && typeof options["retryable"] === "boolean" && (options["path"] === null || isRepositoryPath(options["path"])) && (resource === void 0 || resource !== null && typeof resource === "object" && Object.keys(resource).length === 3 && "dimension" in resource && typeof resource.dimension === "string" && "limit" in resource && isNumber(resource.limit) && "observed" in resource && isNumber(resource.observed))) return new RepositorySourceException({
|
|
423
|
+
code,
|
|
424
|
+
operation,
|
|
425
|
+
path: options["path"],
|
|
426
|
+
retryable: options["retryable"],
|
|
427
|
+
...resource === void 0 ? {} : { resource }
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
throw createInspectionProcessFailure();
|
|
431
|
+
};
|
|
432
|
+
//#endregion
|
|
433
|
+
export { encodeInspectionMessage as a, NODE_INSPECTION_PROFILE as c, NODE_INSPECTION_TRANSPORT_BYTES as d, decodeInspectionMessage as i, NODE_INSPECTION_STDIO_BYTES as l, serializeInspectionFailure as n, NODE_INSPECTION_FILE_PAGE_BYTES as o, createInspectionProcessFailure as r, NODE_INSPECTION_LIFETIME_MS as s, deserializeInspectionFailure as t, NODE_INSPECTION_TERMINATION_GRACE_MS as u };
|
|
434
|
+
|
|
435
|
+
//# sourceMappingURL=errors-BE4DS3Ak.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-BE4DS3Ak.js","names":[],"sources":["../../src/node-inspection/constants.ts","../../src/node-inspection/protocol.ts","../../src/node-inspection/errors.ts"],"sourcesContent":["// whole-attempt lifetime and bounded bridge ownership, independent of source file size\nexport const NODE_INSPECTION_LIFETIME_MS = 120_000;\nexport const NODE_INSPECTION_TERMINATION_GRACE_MS = 1_000;\nexport const NODE_INSPECTION_MAX_REQUESTS = 4;\nexport const NODE_INSPECTION_FILE_PAGE_BYTES = 65_536;\nexport const NODE_INSPECTION_MESSAGE_BYTES = 1_048_576;\nexport const NODE_INSPECTION_STDIO_BYTES = 32_768;\n\n// two UTF-16 bytes per serialized byte, two copies at each owner, for every RPC credit\nexport const NODE_INSPECTION_TRANSPORT_BYTES =\n NODE_INSPECTION_MAX_REQUESTS * NODE_INSPECTION_MESSAGE_BYTES * 2 * 2 * 3;\n\n// fixed profile qualified in the constrained CLI and actual-worker lanes\nexport const NODE_INSPECTION_OLD_GENERATION_MIB = 512;\nexport const NODE_INSPECTION_YOUNG_GENERATION_MIB = 24;\n\n// immutable execution identity for consumers that authenticate prepared inspection state\nexport const NODE_INSPECTION_PROFILE = Object.freeze({\n lifetimeMs: NODE_INSPECTION_LIFETIME_MS,\n terminationGraceMs: NODE_INSPECTION_TERMINATION_GRACE_MS,\n maxReaderRequests: NODE_INSPECTION_MAX_REQUESTS,\n maxFilePageBytes: NODE_INSPECTION_FILE_PAGE_BYTES,\n maxMessageBytes: NODE_INSPECTION_MESSAGE_BYTES,\n maxStdioBytes: NODE_INSPECTION_STDIO_BYTES,\n transportBytes: NODE_INSPECTION_TRANSPORT_BYTES,\n oldGenerationMiB: NODE_INSPECTION_OLD_GENERATION_MIB,\n youngGenerationMiB: NODE_INSPECTION_YOUNG_GENERATION_MIB,\n});\n","import { Buffer } from 'node:buffer';\n\nimport { isRepositoryPath } from '@moldea.ai/repository';\n\nimport type { ICoreResourceLimits } from '../contracts/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\n\nimport { NODE_INSPECTION_FILE_PAGE_BYTES, NODE_INSPECTION_MESSAGE_BYTES } from './constants.js';\nimport type { INodeInspectionMessage } from './types.js';\n\n/** Creates the safe failure for an untrusted or inconsistent private protocol record. */\nexport const createInspectionProcessFailure = (cause?: unknown): CoreOperationException =>\n new CoreOperationException({\n code: 'INSPECTION_PROCESS_FAILED',\n operation: 'create-project-inspection',\n ...(cause === undefined ? {} : { cause }),\n });\n\nconst isRecord = (input: unknown): input is Record<string, unknown> =>\n input !== null && typeof input === 'object' && !Array.isArray(input);\nconst JSON_SHORT_ESCAPES = new Set([8, 9, 10, 12, 13]);\nconst isInteger = (input: unknown): input is number =>\n typeof input === 'number' && Number.isSafeInteger(input) && input >= 0;\nconst hasKeys = (\n input: Record<string, unknown>,\n required: string[],\n optional: string[] = [],\n): boolean =>\n required.every((key) => Object.hasOwn(input, key)) &&\n Object.keys(input).every((key) => required.includes(key) || optional.includes(key));\nconst isSnapshot = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, ['id', 'sourceKind']) &&\n typeof input['id'] === 'string' &&\n input['id'].length > 0 &&\n typeof input['sourceKind'] === 'string' &&\n input['sourceKind'].length > 0;\nconst isOptionalString = (input: Record<string, unknown>, key: string): boolean =>\n !Object.hasOwn(input, key) || typeof input[key] === 'string';\nconst isPageInput = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, ['maxItems', 'view'], ['cursor']) &&\n isInteger(input['maxItems']) &&\n input['maxItems'] > 0 &&\n ['all', 'diagnostics', 'coverage', 'metadata'].includes(String(input['view'])) &&\n isOptionalString(input, 'cursor');\nconst isLimits = (input: unknown): input is ICoreResourceLimits =>\n isRecord(input) &&\n hasKeys(input, [\n 'maxEntries',\n 'maxTotalBytesRead',\n 'maxFileBytes',\n 'maxManifestBytes',\n 'maxRetainedBytes',\n 'maxDiagnostics',\n 'maxCoverage',\n 'maxAcceptedWarnings',\n ]) &&\n Object.values(input).every((limit) => isInteger(limit) && limit > 0);\nconst isCounts = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, [\n 'agents',\n 'context',\n 'decisions',\n 'mirrors',\n 'runtimes',\n 'unresolved',\n 'diagnostics',\n 'errors',\n 'warnings',\n 'acceptedWarnings',\n 'coverage',\n 'metadata',\n ]) &&\n Object.values(input).every(isInteger);\nconst isSummary = (input: unknown): boolean =>\n input === null ||\n (isRecord(input) &&\n hasKeys(input, ['counts', 'manifestDigest', 'manifestPath', 'projectDigest', 'projectPath']) &&\n isRecord(input['counts']) &&\n hasKeys(input['counts'], [\n 'agents',\n 'context',\n 'decisions',\n 'mirrors',\n 'runtimes',\n 'unresolved',\n ]) &&\n Object.values(input['counts']).every(isInteger) &&\n typeof input['manifestDigest'] === 'string' &&\n typeof input['projectDigest'] === 'string' &&\n isRepositoryPath(input['manifestPath']) &&\n isRepositoryPath(input['projectPath']));\nconst isInspectionBase = (input: Record<string, unknown>): boolean =>\n isCounts(input['counts']) &&\n isRecord(input['coverageCounts']) &&\n hasKeys(input['coverageCounts'], [\n 'bindings',\n 'exportsPassed',\n 'exportsFailed',\n 'exportsNotChecked',\n ]) &&\n Object.values(input['coverageCounts']).every(isInteger) &&\n typeof input['valid'] === 'boolean' &&\n (input['formatVersion'] === null || input['formatVersion'] === 1) &&\n typeof input['inspectionDigest'] === 'string' &&\n isSnapshot(input['source']) &&\n isSummary(input['summary']);\nconst INSPECTION_KEYS = [\n 'counts',\n 'coverageCounts',\n 'valid',\n 'formatVersion',\n 'inspectionDigest',\n 'source',\n 'summary',\n];\nconst isMetadata = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, [...INSPECTION_KEYS, 'resourceUsage', 'maxAnalysisHeapBytes']) &&\n isInspectionBase(input) &&\n isInteger(input['maxAnalysisHeapBytes']) &&\n input['maxAnalysisHeapBytes'] > 0 &&\n isRecord(input['resourceUsage']) &&\n hasKeys(input['resourceUsage'], [\n 'canonicalBytes',\n 'peakRetainedBytes',\n 'preparedBytes',\n 'retainedBytes',\n 'totalBytesRead',\n ]) &&\n Object.values(input['resourceUsage']).every(isInteger);\nconst isPage = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, [...INSPECTION_KEYS, 'page', 'view']) &&\n isInspectionBase(input) &&\n ['all', 'diagnostics', 'coverage', 'metadata'].includes(String(input['view'])) &&\n isRecord(input['page']) &&\n hasKeys(input['page'], ['isComplete', 'records', 'nextCursor', 'totalItems']) &&\n typeof input['page']['isComplete'] === 'boolean' &&\n isInteger(input['page']['totalItems']) &&\n (input['page']['nextCursor'] === null || typeof input['page']['nextCursor'] === 'string') &&\n Array.isArray(input['page']['records']) &&\n input['page']['records'].every(\n (record: unknown) =>\n isRecord(record) &&\n hasKeys(record, ['item', 'nextCursor']) &&\n (record['nextCursor'] === null || typeof record['nextCursor'] === 'string') &&\n isRecord(record['item']) &&\n typeof record['item']['kind'] === 'string' &&\n ['agent', 'diagnostic', 'coverage', 'metadata'].includes(record['item']['kind']) &&\n hasKeys(record['item'], ['kind', record['item']['kind']]) &&\n isRecord(record['item'][record['item']['kind']]),\n );\nconst isRequest = (input: unknown): boolean => {\n if (!isRecord(input)) return false;\n switch (input['method']) {\n case 'getEntry':\n return hasKeys(input, ['method', 'path']) && isRepositoryPath(input['path']);\n case 'listEntriesPage':\n return (\n hasKeys(input, ['method', 'maxEntries'], ['cursor', 'prefix']) &&\n isInteger(input['maxEntries']) &&\n input['maxEntries'] > 0 &&\n input['maxEntries'] <= 128 &&\n isOptionalString(input, 'cursor') &&\n (!Object.hasOwn(input, 'prefix') || isRepositoryPath(input['prefix']))\n );\n case 'readFilePage':\n return (\n hasKeys(input, ['method', 'path', 'maxBytes', 'offset']) &&\n isRepositoryPath(input['path']) &&\n isInteger(input['offset']) &&\n isInteger(input['maxBytes']) &&\n input['maxBytes'] > 0 &&\n input['maxBytes'] <= NODE_INSPECTION_FILE_PAGE_BYTES\n );\n default:\n return false;\n }\n};\n\n/** Validates closed control envelopes and their typed operation payloads on both bridges. */\nconst isMessage = (input: unknown): input is INodeInspectionMessage => {\n if (\n !isRecord(input) ||\n typeof input['attemptId'] !== 'string' ||\n !/^[a-f0-9]{32}$/.test(input['attemptId'])\n )\n return false;\n const keys = ['attemptId', 'kind'];\n switch (input['kind']) {\n case 'start':\n return (\n hasKeys(input, [...keys, 'snapshot', 'limits', 'deadline']) &&\n isSnapshot(input['snapshot']) &&\n isLimits(input['limits']) &&\n isInteger(input['deadline'])\n );\n case 'ready':\n return (\n hasKeys(input, [...keys, 'maxAnalysisHeapBytes']) &&\n isInteger(input['maxAnalysisHeapBytes']) &&\n input['maxAnalysisHeapBytes'] > 0\n );\n case 'run':\n case 'dispose':\n return hasKeys(input, keys);\n case 'prepared':\n return hasKeys(input, [...keys, 'inspection']) && isMetadata(input['inspection']);\n case 'read-page':\n return (\n hasKeys(input, [...keys, 'requestId', 'input']) &&\n isInteger(input['requestId']) &&\n isPageInput(input['input'])\n );\n case 'page':\n return (\n hasKeys(input, [...keys, 'requestId', 'result']) &&\n isInteger(input['requestId']) &&\n isPage(input['result'])\n );\n case 'reader-request':\n return (\n hasKeys(input, [...keys, 'requestId', 'request']) &&\n isInteger(input['requestId']) &&\n isRequest(input['request'])\n );\n case 'reader-response':\n return hasKeys(input, [...keys, 'requestId', 'result']) && isInteger(input['requestId']);\n case 'reader-failure':\n case 'failure':\n return (\n hasKeys(input, [\n ...keys,\n 'failure',\n ...(input['kind'] === 'reader-failure' ? ['requestId'] : []),\n ]) &&\n (input['kind'] !== 'reader-failure' || isInteger(input['requestId'])) &&\n isRecord(input['failure']) &&\n hasKeys(input['failure'], ['family', 'options']) &&\n ['configuration', 'operation', 'repository', 'path'].includes(\n String(input['failure']['family']),\n ) &&\n isRecord(input['failure']['options'])\n );\n default:\n return false;\n }\n};\n\n/** Counts escaped JSON bytes without first allocating a serialized oversized message. */\nconst countJsonBytes = (input: unknown, ancestors: WeakSet<object>, depth: number): number => {\n if (depth > 64) throw createInspectionProcessFailure();\n if (input === null) return 4;\n if (typeof input === 'boolean') return input ? 4 : 5;\n if (typeof input === 'number' && Number.isFinite(input)) return String(input).length;\n if (typeof input === 'string') {\n let bytes = 2;\n for (let index = 0; index < input.length; index++) {\n const code = input.charCodeAt(index);\n if (code === 34 || code === 92 || JSON_SHORT_ESCAPES.has(code)) bytes += 2;\n else if (code < 32) bytes += 6;\n else if (code < 128) bytes++;\n else if (code < 2048) bytes += 2;\n else if (\n code >= 0xd800 &&\n code <= 0xdbff &&\n index + 1 < input.length &&\n input.charCodeAt(index + 1) >= 0xdc00 &&\n input.charCodeAt(index + 1) <= 0xdfff\n ) {\n bytes += 4;\n index++;\n } else bytes += code >= 0xd800 && code <= 0xdfff ? 6 : 3;\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES) return bytes;\n }\n return bytes;\n }\n if (typeof input !== 'object' || ancestors.has(input)) throw createInspectionProcessFailure();\n ancestors.add(input);\n let bytes = 2;\n let count = 0;\n if (Array.isArray(input)) {\n for (const element of input) {\n bytes += (count++ === 0 ? 0 : 1) + countJsonBytes(element, ancestors, depth + 1);\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES) break;\n }\n } else {\n for (const key in input) {\n if (!Object.hasOwn(input, key)) continue;\n bytes +=\n (count++ === 0 ? 0 : 1) +\n countJsonBytes(key, ancestors, depth + 1) +\n 1 +\n countJsonBytes((input as Record<string, unknown>)[key], ancestors, depth + 1);\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES) break;\n }\n }\n ancestors.delete(input);\n return bytes;\n};\n\n/**\n * Admits a complete bounded record before serialization; no record is truncated.\n * @returns One private JSON frame.\n * @throws\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n */\nexport const encodeInspectionMessage = (message: INodeInspectionMessage): string => {\n const bytes = countJsonBytes(message, new WeakSet(), 0);\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES)\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxInspectionMessageBytes',\n limitMaximum: NODE_INSPECTION_MESSAGE_BYTES,\n observedUsage: bytes,\n nextAction: null,\n operation: 'create-project-inspection',\n });\n if (!isMessage(message)) throw createInspectionProcessFailure();\n return JSON.stringify(message);\n};\n\n/**\n * Checks frame size before parsing and validates the closed message contract.\n * @returns A validated private message.\n * @throws\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n */\nexport const decodeInspectionMessage = (frame: unknown): INodeInspectionMessage => {\n if (typeof frame !== 'string' || Buffer.byteLength(frame) > NODE_INSPECTION_MESSAGE_BYTES)\n throw createInspectionProcessFailure();\n let message: unknown;\n try {\n message = JSON.parse(frame);\n } catch (cause) {\n throw createInspectionProcessFailure(cause);\n }\n if (!isMessage(message)) throw createInspectionProcessFailure();\n return message;\n};\n","import {\n RepositoryPathException,\n RepositorySourceException,\n isRepositoryPath,\n type IRepositoryOperation,\n type IRepositorySourceErrorCode,\n} from '@moldea.ai/repository';\n\nimport {\n CoreConfigurationException,\n CoreOperationException,\n isCoreConfigurationErrorCode,\n isCoreOperation,\n isCoreOperationErrorCode,\n} from '../exceptions/index.js';\n\nimport { createInspectionProcessFailure } from './protocol.js';\nimport type { INodeInspectionFailure } from './types.js';\n\n/** Serializes only documented exception fields, excluding native messages, causes and stacks. */\nexport const serializeInspectionFailure = (error: unknown): INodeInspectionFailure => {\n if (error instanceof CoreConfigurationException)\n return {\n family: 'configuration',\n options: {\n code: error.code,\n operation: error.operation,\n },\n };\n if (error instanceof CoreOperationException)\n return {\n family: 'operation',\n options: {\n code: error.code,\n operation: error.operation,\n ...(error.agentId === null ? {} : { agentId: error.agentId }),\n ...(error.code !== 'RESOURCE_LIMIT_EXCEEDED'\n ? {}\n : {\n limit: error.limit,\n limitMaximum: error.limitMaximum,\n nextAction: error.nextAction,\n observedUsage: error.observedUsage,\n }),\n },\n };\n if (error instanceof RepositoryPathException) return { family: 'path', options: {} };\n if (error instanceof RepositorySourceException)\n return {\n family: 'repository',\n options: {\n code: error.code,\n operation: error.operation,\n path: error.path,\n retryable: error.retryable,\n ...(error.resource === null ? {} : { resource: error.resource }),\n },\n };\n return {\n family: 'operation',\n options: {\n code: 'INSPECTION_PROCESS_FAILED',\n operation: 'create-project-inspection',\n },\n };\n};\nconst REPOSITORY_CODES: IRepositorySourceErrorCode[] = [\n 'ENTRY_NOT_FOUND',\n 'ENTRY_NOT_FILE',\n 'ENTRY_NOT_DIRECTORY',\n 'INVALID_PAGE_REQUEST',\n 'ACCESS_DENIED',\n 'SOURCE_UNAVAILABLE',\n 'SNAPSHOT_CHANGED',\n 'PROVIDER_INCOMPLETE',\n 'INVALID_SOURCE_DATA',\n 'RESOURCE_LIMIT_EXCEEDED',\n 'ABORTED',\n];\nconst REPOSITORY_OPERATIONS: IRepositoryOperation[] = [\n 'create-reader',\n 'create-comparison',\n 'get-entry',\n 'read-file-page',\n 'list-entries-page',\n 'list-changes-page',\n];\nconst isNumber = (input: unknown): input is number =>\n typeof input === 'number' && Number.isSafeInteger(input) && input >= 0;\n\n/**\n * Reconstructs a documented typed failure after checking its safe transport fields.\n * @returns A package exception without a remote native cause or stack.\n * @throws\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n */\nexport const deserializeInspectionFailure = (failure: INodeInspectionFailure): Error => {\n const options = failure.options;\n const allowed =\n failure.family === 'configuration'\n ? ['code', 'operation']\n : failure.family === 'operation'\n ? ['code', 'operation', 'agentId', 'limit', 'limitMaximum', 'nextAction', 'observedUsage']\n : failure.family === 'repository'\n ? ['code', 'operation', 'path', 'retryable', 'resource']\n : [];\n if (\n Object.keys(options).some((key) => !allowed.includes(key)) ||\n (Object.hasOwn(options, 'agentId') && typeof options['agentId'] !== 'string')\n )\n throw createInspectionProcessFailure();\n if (\n (failure.family === 'operation' || failure.family === 'configuration') &&\n !isCoreOperation(options['operation'])\n )\n throw createInspectionProcessFailure();\n const scope = {\n operation: isCoreOperation(options['operation'])\n ? options['operation']\n : ('create-project-inspection' as const),\n ...(typeof options['agentId'] === 'string' ? { agentId: options['agentId'] } : {}),\n };\n if (failure.family === 'path' && Object.keys(options).length === 0)\n return new RepositoryPathException();\n if (failure.family === 'configuration') {\n const code = options['code'];\n if (isCoreConfigurationErrorCode(code))\n return new CoreConfigurationException({ ...scope, code });\n }\n if (failure.family === 'operation') {\n const code = options['code'];\n if (\n isCoreOperationErrorCode(code) &&\n code !== 'RESOURCE_LIMIT_EXCEEDED' &&\n !['limit', 'limitMaximum', 'nextAction', 'observedUsage'].some((key) =>\n Object.hasOwn(options, key),\n )\n )\n return new CoreOperationException({ ...scope, code });\n if (\n options['code'] === 'RESOURCE_LIMIT_EXCEEDED' &&\n isNumber(options['limitMaximum']) &&\n options['limitMaximum'] > 0\n ) {\n if (\n options['limit'] === 'maxAnalysisHeapBytes' &&\n options['nextAction'] === 'review-inspection-capacity' &&\n options['observedUsage'] === null\n )\n return new CoreOperationException({\n ...scope,\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxAnalysisHeapBytes',\n limitMaximum: options['limitMaximum'],\n observedUsage: null,\n nextAction: 'review-inspection-capacity',\n });\n if (\n (options['limit'] === 'maxInspectionMessageBytes' ||\n options['limit'] === 'maxReaderRequests') &&\n options['nextAction'] === null &&\n isNumber(options['observedUsage'])\n )\n return new CoreOperationException({\n ...scope,\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: options['limit'],\n limitMaximum: options['limitMaximum'],\n nextAction: null,\n observedUsage: options['observedUsage'],\n });\n if (\n typeof options['limit'] === 'string' &&\n !['maxAnalysisHeapBytes', 'maxInspectionMessageBytes', 'maxReaderRequests'].includes(\n options['limit'],\n ) &&\n options['nextAction'] === 'reduce-input-or-increase-limit' &&\n isNumber(options['observedUsage'])\n )\n return new CoreOperationException({\n ...scope,\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: options['limit'],\n limitMaximum: options['limitMaximum'],\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: options['observedUsage'],\n });\n }\n }\n if (failure.family === 'repository') {\n const code = REPOSITORY_CODES.find((candidate) => candidate === options['code']);\n const operation = REPOSITORY_OPERATIONS.find((candidate) => candidate === options['operation']);\n const resource = options['resource'];\n if (\n code !== undefined &&\n operation !== undefined &&\n typeof options['retryable'] === 'boolean' &&\n (options['path'] === null || isRepositoryPath(options['path'])) &&\n (resource === undefined ||\n (resource !== null &&\n typeof resource === 'object' &&\n Object.keys(resource).length === 3 &&\n 'dimension' in resource &&\n typeof resource.dimension === 'string' &&\n 'limit' in resource &&\n isNumber(resource.limit) &&\n 'observed' in resource &&\n isNumber(resource.observed)))\n ) {\n return new RepositorySourceException({\n code,\n operation,\n path: options['path'],\n retryable: options['retryable'],\n ...(resource === undefined\n ? {}\n : {\n resource: resource as {\n dimension: string;\n limit: number;\n observed: number;\n },\n }),\n });\n }\n }\n throw createInspectionProcessFailure();\n};\n"],"mappings":";;;;AACA,IAAa,8BAA8B;AAC3C,IAAa,uCAAuC;AAEpD,IAAa,kCAAkC;AAC/C,IAAa,gCAAgC;AAC7C,IAAa,8BAA8B;AAG3C,IAAa,kCAAA,IACoB,gCAAgC,IAAI,IAAI;AAOzE,IAAa,0BAA0B,OAAO,OAAO;CACnD,YAAY;CACZ,oB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ACY,SAKZ;EACN,CAAC;CAEL;CACA,MAAM,+BAA+B;AACvC"}
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import { Exception } from "error-message-utils";
|
|
2
|
-
//#region src/adapter-retained-memory/index.ts
|
|
3
|
-
var retainedByteReservations = /* @__PURE__ */ new WeakMap();
|
|
4
|
-
/** Registers the retained-memory reservation owned by one inspection session. */
|
|
5
|
-
var registerRuntimeAdapterRetainedByteReservation = (repository, reserve) => {
|
|
6
|
-
if (retainedByteReservations.has(repository)) throw new TypeError("The runtime adapter repository is already registered.");
|
|
7
|
-
retainedByteReservations.set(repository, reserve);
|
|
8
|
-
};
|
|
9
|
-
/** Reserves a complete adapter-owned buffer when Core owns the repository session. */
|
|
10
|
-
var reserveRuntimeAdapterRetainedBytesIfTracked = (repository, byteLength) => {
|
|
11
|
-
const reserve = retainedByteReservations.get(repository);
|
|
12
|
-
if (reserve !== void 0) reserve(byteLength);
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
2
|
//#region src/exceptions/index.ts
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
var CORE_OPERATIONS = [
|
|
4
|
+
"create-core",
|
|
5
|
+
"normalize-text",
|
|
6
|
+
"calculate-content-digest",
|
|
7
|
+
"parse-manifest",
|
|
8
|
+
"match-manifest-scope",
|
|
9
|
+
"parse-decision",
|
|
10
|
+
"create-project-inspection",
|
|
11
|
+
"read-canonical-content-page",
|
|
12
|
+
"validate-project"
|
|
13
|
+
];
|
|
14
|
+
var CONFIGURATION_ERROR_MESSAGES = { INVALID_RESOURCE_LIMIT: "A Core resource limit is invalid." };
|
|
22
15
|
var OPERATION_ERROR_MESSAGES = {
|
|
23
16
|
ABORTED: "The Core operation was aborted.",
|
|
24
|
-
ADAPTER_EXECUTION_FAILED: "A runtime adapter failed during inspection.",
|
|
25
17
|
CONTENT_INVALID: "The canonical content is not valid UTF-8 text.",
|
|
26
18
|
INVALID_ARGUMENT: "The Core operation received an invalid argument.",
|
|
19
|
+
INSPECTION_BUSY: "Project inspection capacity is busy. Try again shortly.",
|
|
20
|
+
INSPECTION_TIMEOUT: "The isolated project inspection timed out.",
|
|
21
|
+
INSPECTION_PROCESS_FAILED: "The isolated project inspection failed.",
|
|
27
22
|
RESOURCE_LIMIT_EXCEEDED: "A Core resource limit was exceeded."
|
|
28
23
|
};
|
|
29
24
|
var OPERATION_ERROR_RETRYABILITY = {
|
|
30
25
|
ABORTED: true,
|
|
31
|
-
ADAPTER_EXECUTION_FAILED: false,
|
|
32
26
|
CONTENT_INVALID: false,
|
|
33
27
|
INVALID_ARGUMENT: false,
|
|
28
|
+
INSPECTION_BUSY: true,
|
|
29
|
+
INSPECTION_TIMEOUT: true,
|
|
30
|
+
INSPECTION_PROCESS_FAILED: false,
|
|
34
31
|
RESOURCE_LIMIT_EXCEEDED: false
|
|
35
32
|
};
|
|
33
|
+
/** Checks a transported operation against the authoritative Core operation set. */
|
|
34
|
+
var isCoreOperation = (input) => CORE_OPERATIONS.some((operation) => operation === input);
|
|
35
|
+
/** Checks a transported configuration code against the authoritative message registry. */
|
|
36
|
+
var isCoreConfigurationErrorCode = (input) => typeof input === "string" && Object.hasOwn(CONFIGURATION_ERROR_MESSAGES, input);
|
|
37
|
+
/** Checks a transported operation code against the authoritative message registry. */
|
|
38
|
+
var isCoreOperationErrorCode = (input) => typeof input === "string" && Object.hasOwn(OPERATION_ERROR_MESSAGES, input);
|
|
36
39
|
var attachCause = (exception, cause) => {
|
|
37
40
|
if (cause === void 0) return;
|
|
38
41
|
Object.defineProperty(exception, "cause", {
|
|
@@ -46,14 +49,12 @@ var attachCause = (exception, cause) => {
|
|
|
46
49
|
var CoreConfigurationException = class extends Exception {
|
|
47
50
|
code;
|
|
48
51
|
operation;
|
|
49
|
-
|
|
50
|
-
/** Creates a configuration exception with safe adapter metadata. */
|
|
52
|
+
/** Creates a configuration exception with safe operation metadata. */
|
|
51
53
|
constructor(options) {
|
|
52
54
|
super(CONFIGURATION_ERROR_MESSAGES[options.code], options.code);
|
|
53
55
|
this.code = options.code;
|
|
54
56
|
this.name = "CoreConfigurationException";
|
|
55
57
|
this.operation = options.operation;
|
|
56
|
-
this.adapterId = options.adapterId ?? null;
|
|
57
58
|
attachCause(this, options.cause);
|
|
58
59
|
}
|
|
59
60
|
};
|
|
@@ -62,7 +63,6 @@ var CoreOperationException = class extends Exception {
|
|
|
62
63
|
code;
|
|
63
64
|
operation;
|
|
64
65
|
retryable;
|
|
65
|
-
adapterId;
|
|
66
66
|
agentId;
|
|
67
67
|
limit;
|
|
68
68
|
limitMaximum;
|
|
@@ -75,7 +75,6 @@ var CoreOperationException = class extends Exception {
|
|
|
75
75
|
this.name = "CoreOperationException";
|
|
76
76
|
this.operation = options.operation;
|
|
77
77
|
this.retryable = OPERATION_ERROR_RETRYABILITY[options.code];
|
|
78
|
-
this.adapterId = options.adapterId ?? null;
|
|
79
78
|
this.agentId = options.agentId ?? null;
|
|
80
79
|
this.limit = options.limit ?? null;
|
|
81
80
|
this.limitMaximum = options.limitMaximum ?? null;
|
|
@@ -85,6 +84,6 @@ var CoreOperationException = class extends Exception {
|
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
86
|
//#endregion
|
|
88
|
-
export {
|
|
87
|
+
export { isCoreOperationErrorCode as a, isCoreOperation as i, CoreOperationException as n, isCoreConfigurationErrorCode as r, CoreConfigurationException as t };
|
|
89
88
|
|
|
90
|
-
//# sourceMappingURL=exceptions-
|
|
89
|
+
//# sourceMappingURL=exceptions-IXsorE8t.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions-IXsorE8t.js","names":[],"sources":["../../src/exceptions/index.ts"],"sourcesContent":["import { Exception } from 'error-message-utils';\n\n// stable configuration and operation failure codes\nexport type ICoreConfigurationErrorCode = 'INVALID_RESOURCE_LIMIT';\n\nexport type ICoreOperationErrorCode =\n | 'INVALID_ARGUMENT'\n | 'ABORTED'\n | 'RESOURCE_LIMIT_EXCEEDED'\n | 'INSPECTION_BUSY'\n | 'INSPECTION_TIMEOUT'\n | 'INSPECTION_PROCESS_FAILED'\n | 'CONTENT_INVALID';\n\nconst CORE_OPERATIONS = [\n 'create-core',\n 'normalize-text',\n 'calculate-content-digest',\n 'parse-manifest',\n 'match-manifest-scope',\n 'parse-decision',\n 'create-project-inspection',\n 'read-canonical-content-page',\n 'validate-project',\n] as const;\n\nexport type ICoreOperation = (typeof CORE_OPERATIONS)[number];\n\n// safe construction options for exported Core exceptions\nexport interface ICoreConfigurationExceptionOptions {\n readonly code: ICoreConfigurationErrorCode;\n readonly operation: ICoreOperation;\n readonly cause?: unknown;\n}\n\ninterface ICoreOperationExceptionOptionsBase {\n readonly operation: ICoreOperation;\n readonly agentId?: string;\n readonly cause?: unknown;\n}\n\n// logical budget refusals and verified isolated-worker heap exhaustion\nexport type ICoreResourceLimitNextAction =\n 'reduce-input-or-increase-limit' | 'review-inspection-capacity';\n\nexport type ICoreOperationExceptionOptions = ICoreOperationExceptionOptionsBase &\n (\n | {\n readonly code: 'RESOURCE_LIMIT_EXCEEDED';\n readonly limit: string;\n readonly limitMaximum: number;\n readonly nextAction: 'reduce-input-or-increase-limit';\n readonly observedUsage: number;\n }\n | {\n readonly code: 'RESOURCE_LIMIT_EXCEEDED';\n readonly limit: 'maxAnalysisHeapBytes';\n readonly limitMaximum: number;\n readonly nextAction: 'review-inspection-capacity';\n readonly observedUsage: null;\n }\n | {\n readonly code: 'RESOURCE_LIMIT_EXCEEDED';\n readonly limit: 'maxInspectionMessageBytes' | 'maxReaderRequests';\n readonly limitMaximum: number;\n readonly nextAction: null;\n readonly observedUsage: number;\n }\n | {\n readonly code: Exclude<ICoreOperationErrorCode, 'RESOURCE_LIMIT_EXCEEDED'>;\n readonly limit?: never;\n readonly limitMaximum?: never;\n readonly nextAction?: never;\n readonly observedUsage?: never;\n }\n );\n\nconst CONFIGURATION_ERROR_MESSAGES = {\n INVALID_RESOURCE_LIMIT: 'A Core resource limit is invalid.',\n} as const satisfies Readonly<Record<ICoreConfigurationErrorCode, string>>;\n\nconst OPERATION_ERROR_MESSAGES = {\n ABORTED: 'The Core operation was aborted.',\n CONTENT_INVALID: 'The canonical content is not valid UTF-8 text.',\n INVALID_ARGUMENT: 'The Core operation received an invalid argument.',\n INSPECTION_BUSY: 'Project inspection capacity is busy. Try again shortly.',\n INSPECTION_TIMEOUT: 'The isolated project inspection timed out.',\n INSPECTION_PROCESS_FAILED: 'The isolated project inspection failed.',\n RESOURCE_LIMIT_EXCEEDED: 'A Core resource limit was exceeded.',\n} as const satisfies Readonly<Record<ICoreOperationErrorCode, string>>;\n\nconst OPERATION_ERROR_RETRYABILITY = {\n ABORTED: true,\n CONTENT_INVALID: false,\n INVALID_ARGUMENT: false,\n INSPECTION_BUSY: true,\n INSPECTION_TIMEOUT: true,\n INSPECTION_PROCESS_FAILED: false,\n RESOURCE_LIMIT_EXCEEDED: false,\n} as const satisfies Readonly<Record<ICoreOperationErrorCode, boolean>>;\n\n/** Checks a transported operation against the authoritative Core operation set. */\nexport const isCoreOperation = (input: unknown): input is ICoreOperation =>\n CORE_OPERATIONS.some((operation) => operation === input);\n\n/** Checks a transported configuration code against the authoritative message registry. */\nexport const isCoreConfigurationErrorCode = (\n input: unknown,\n): input is ICoreConfigurationErrorCode =>\n typeof input === 'string' && Object.hasOwn(CONFIGURATION_ERROR_MESSAGES, input);\n\n/** Checks a transported operation code against the authoritative message registry. */\nexport const isCoreOperationErrorCode = (input: unknown): input is ICoreOperationErrorCode =>\n typeof input === 'string' && Object.hasOwn(OPERATION_ERROR_MESSAGES, input);\n\nconst attachCause = (exception: Error, cause: unknown): void => {\n if (cause === undefined) {\n return;\n }\n\n Object.defineProperty(exception, 'cause', {\n configurable: true,\n enumerable: false,\n value: cause,\n writable: false,\n });\n};\n\n/** Represents invalid immutable Core configuration. */\nexport class CoreConfigurationException extends Exception {\n public override readonly code: ICoreConfigurationErrorCode;\n\n public readonly operation: ICoreOperation;\n\n /** Creates a configuration exception with safe operation metadata. */\n public constructor(options: ICoreConfigurationExceptionOptions) {\n super(CONFIGURATION_ERROR_MESSAGES[options.code], options.code);\n this.code = options.code;\n this.name = 'CoreConfigurationException';\n this.operation = options.operation;\n attachCause(this, options.cause);\n }\n}\n\n/** Represents an operational failure that prevented Core from completing. */\nexport class CoreOperationException extends Exception {\n public override readonly code: ICoreOperationErrorCode;\n\n public readonly operation: ICoreOperation;\n\n public readonly retryable: boolean;\n\n public readonly agentId: string | null;\n\n public readonly limit: string | null;\n\n public readonly limitMaximum: number | null;\n\n public readonly nextAction: ICoreResourceLimitNextAction | null;\n\n public readonly observedUsage: number | null;\n\n /** Creates an operation exception with derived retry and safe scope metadata. */\n public constructor(options: ICoreOperationExceptionOptions) {\n super(OPERATION_ERROR_MESSAGES[options.code], options.code);\n this.code = options.code;\n this.name = 'CoreOperationException';\n this.operation = options.operation;\n this.retryable = OPERATION_ERROR_RETRYABILITY[options.code];\n this.agentId = options.agentId ?? null;\n this.limit = options.limit ?? null;\n this.limitMaximum = options.limitMaximum ?? null;\n this.nextAction = options.nextAction ?? null;\n this.observedUsage = options.observedUsage ?? null;\n attachCause(this, options.cause);\n }\n}\n"],"mappings":";;AAcA,IAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAqDA,IAAM,+BAA+B,EACnC,wBAAwB,oCAC1B;AAEA,IAAM,2BAA2B;CAC/B,SAAS;CACT,iBAAiB;CACjB,kBAAkB;CAClB,iBAAiB;CACjB,oBAAoB;CACpB,2BAA2B;CAC3B,yBAAyB;AAC3B;AAEA,IAAM,+BAA+B;CACnC,SAAS;CACT,iBAAiB;CACjB,kBAAkB;CAClB,iBAAiB;CACjB,oBAAoB;CACpB,2BAA2B;CAC3B,yBAAyB;AAC3B;;AAGA,IAAa,mBAAmB,UAC9B,gBAAgB,MAAM,cAAc,cAAc,KAAK;;AAGzD,IAAa,gCACX,UAEA,OAAO,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