@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.
Files changed (136) hide show
  1. package/README.md +12 -11
  2. package/dist/analysis-worker.js +180 -0
  3. package/dist/analysis-worker.js.map +1 -0
  4. package/dist/binding-coverage/index.d.ts +26 -0
  5. package/dist/binding-coverage/index.d.ts.map +1 -0
  6. package/dist/chunks/core-Cdeiu6xG.js +3364 -0
  7. package/dist/chunks/core-Cdeiu6xG.js.map +1 -0
  8. package/dist/chunks/errors-BE4DS3Ak.js +435 -0
  9. package/dist/chunks/errors-BE4DS3Ak.js.map +1 -0
  10. package/dist/chunks/{exceptions-HS9ofVy2.js → exceptions-IXsorE8t.js} +27 -28
  11. package/dist/chunks/exceptions-IXsorE8t.js.map +1 -0
  12. package/dist/chunks/lifecycle-D_RvxhDC.js +67 -0
  13. package/dist/chunks/lifecycle-D_RvxhDC.js.map +1 -0
  14. package/dist/chunks/options-5x9gu2Qb.js +604 -0
  15. package/dist/chunks/options-5x9gu2Qb.js.map +1 -0
  16. package/dist/chunks/repository-rpc-B_y0Kspf.js +124 -0
  17. package/dist/chunks/repository-rpc-B_y0Kspf.js.map +1 -0
  18. package/dist/chunks/scope-AGMcHUE_.js +1827 -0
  19. package/dist/chunks/scope-AGMcHUE_.js.map +1 -0
  20. package/dist/chunks/syntax-CVvExx4R.js +137 -0
  21. package/dist/chunks/syntax-CVvExx4R.js.map +1 -0
  22. package/dist/constants/index.d.ts +2 -1
  23. package/dist/constants/index.d.ts.map +1 -1
  24. package/dist/contracts/index.d.ts +37 -27
  25. package/dist/contracts/index.d.ts.map +1 -1
  26. package/dist/core/index.d.ts +1 -4
  27. package/dist/core/index.d.ts.map +1 -1
  28. package/dist/decision/index.d.ts +1 -1
  29. package/dist/decision-graph/index.d.ts +9 -7
  30. package/dist/decision-graph/index.d.ts.map +1 -1
  31. package/dist/diagnostic-utilities/index.d.ts +6 -2
  32. package/dist/diagnostic-utilities/index.d.ts.map +1 -1
  33. package/dist/diagnostics/index.d.ts +21 -33
  34. package/dist/diagnostics/index.d.ts.map +1 -1
  35. package/dist/exceptions/index.d.ts +25 -10
  36. package/dist/exceptions/index.d.ts.map +1 -1
  37. package/dist/export-inventory/index.d.ts +3 -0
  38. package/dist/export-inventory/index.d.ts.map +1 -0
  39. package/dist/export-inventory/inventory.d.ts +22 -0
  40. package/dist/export-inventory/inventory.d.ts.map +1 -0
  41. package/dist/export-inventory/syntax.d.ts +4 -0
  42. package/dist/export-inventory/syntax.d.ts.map +1 -0
  43. package/dist/export-inventory/types.d.ts +9 -0
  44. package/dist/export-inventory/types.d.ts.map +1 -0
  45. package/dist/format/index.d.ts +8 -0
  46. package/dist/format/index.d.ts.map +1 -1
  47. package/dist/impact-pattern-validation/index.d.ts +2 -0
  48. package/dist/impact-pattern-validation/index.d.ts.map +1 -0
  49. package/dist/impact-pattern-validation/inspection.d.ts +24 -0
  50. package/dist/impact-pattern-validation/inspection.d.ts.map +1 -0
  51. package/dist/index.d.ts +5 -3
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +4 -5776
  54. package/dist/integration-validation/index.d.ts +4 -0
  55. package/dist/integration-validation/index.d.ts.map +1 -0
  56. package/dist/integration-validation/inspection.d.ts +18 -0
  57. package/dist/integration-validation/inspection.d.ts.map +1 -0
  58. package/dist/integration-validation/parser.d.ts +9 -0
  59. package/dist/integration-validation/parser.d.ts.map +1 -0
  60. package/dist/integration-validation/types.d.ts +13 -0
  61. package/dist/integration-validation/types.d.ts.map +1 -0
  62. package/dist/manifest/index.d.ts +2 -4
  63. package/dist/manifest/index.d.ts.map +1 -1
  64. package/dist/manifest-validation/index.d.ts +7 -10
  65. package/dist/manifest-validation/index.d.ts.map +1 -1
  66. package/dist/node/index.d.ts +4 -0
  67. package/dist/node/index.d.ts.map +1 -0
  68. package/dist/node-inspection/analysis-worker.d.ts +2 -0
  69. package/dist/node-inspection/analysis-worker.d.ts.map +1 -0
  70. package/dist/node-inspection/client.d.ts +28 -0
  71. package/dist/node-inspection/client.d.ts.map +1 -0
  72. package/dist/node-inspection/constants.d.ts +21 -0
  73. package/dist/node-inspection/constants.d.ts.map +1 -0
  74. package/dist/node-inspection/errors.d.ts +11 -0
  75. package/dist/node-inspection/errors.d.ts.map +1 -0
  76. package/dist/node-inspection/lifecycle.d.ts +15 -0
  77. package/dist/node-inspection/lifecycle.d.ts.map +1 -0
  78. package/dist/node-inspection/protocol.d.ts +20 -0
  79. package/dist/node-inspection/protocol.d.ts.map +1 -0
  80. package/dist/node-inspection/repository-rpc.d.ts +28 -0
  81. package/dist/node-inspection/repository-rpc.d.ts.map +1 -0
  82. package/dist/node-inspection/runner.d.ts +2 -0
  83. package/dist/node-inspection/runner.d.ts.map +1 -0
  84. package/dist/node-inspection/types.d.ts +95 -0
  85. package/dist/node-inspection/types.d.ts.map +1 -0
  86. package/dist/node-runner.js +149 -0
  87. package/dist/node-runner.js.map +1 -0
  88. package/dist/node.js +335 -0
  89. package/dist/node.js.map +1 -0
  90. package/dist/options/index.d.ts +2 -14
  91. package/dist/options/index.d.ts.map +1 -1
  92. package/dist/project-inspection/index.d.ts +21 -1
  93. package/dist/project-inspection/index.d.ts.map +1 -1
  94. package/dist/project-validation/index.d.ts +33 -11
  95. package/dist/project-validation/index.d.ts.map +1 -1
  96. package/dist/repository-inspection-session/index.d.ts +2 -4
  97. package/dist/repository-inspection-session/index.d.ts.map +1 -1
  98. package/dist/repository-reference-validation/index.d.ts +12 -6
  99. package/dist/repository-reference-validation/index.d.ts.map +1 -1
  100. package/dist/retained-memory/index.d.ts +18 -0
  101. package/dist/retained-memory/index.d.ts.map +1 -0
  102. package/dist/scope/index.d.ts +3 -0
  103. package/dist/scope/index.d.ts.map +1 -0
  104. package/dist/scope/scope.d.ts +13 -0
  105. package/dist/scope/scope.d.ts.map +1 -0
  106. package/dist/scope-matching/index.d.ts +2 -1
  107. package/dist/scope-matching/index.d.ts.map +1 -1
  108. package/dist/scope-matching/matching.d.ts +11 -2
  109. package/dist/scope-matching/matching.d.ts.map +1 -1
  110. package/dist/scope-matching/patterns.d.ts +4 -0
  111. package/dist/scope-matching/patterns.d.ts.map +1 -0
  112. package/dist/scope.js +17 -0
  113. package/dist/scope.js.map +1 -0
  114. package/dist/universal-project-inspection/index.d.ts +13 -11
  115. package/dist/universal-project-inspection/index.d.ts.map +1 -1
  116. package/dist/warning-acceptance/acceptance.d.ts +11 -0
  117. package/dist/warning-acceptance/acceptance.d.ts.map +1 -0
  118. package/dist/warning-acceptance/index.d.ts +2 -0
  119. package/dist/warning-acceptance/index.d.ts.map +1 -0
  120. package/package.json +14 -6
  121. package/dist/adapter/index.d.ts +0 -131
  122. package/dist/adapter/index.d.ts.map +0 -1
  123. package/dist/adapter-availability/index.d.ts +0 -15
  124. package/dist/adapter-availability/index.d.ts.map +0 -1
  125. package/dist/adapter-execution/index.d.ts +0 -31
  126. package/dist/adapter-execution/index.d.ts.map +0 -1
  127. package/dist/adapter-repository/index.d.ts +0 -27
  128. package/dist/adapter-repository/index.d.ts.map +0 -1
  129. package/dist/adapter-retained-memory/index.d.ts +0 -8
  130. package/dist/adapter-retained-memory/index.d.ts.map +0 -1
  131. package/dist/adapter-validation/index.d.ts +0 -43
  132. package/dist/adapter-validation/index.d.ts.map +0 -1
  133. package/dist/adapter.js +0 -115
  134. package/dist/adapter.js.map +0 -1
  135. package/dist/chunks/exceptions-HS9ofVy2.js.map +0 -1
  136. package/dist/index.js.map +0 -1
package/dist/node.js ADDED
@@ -0,0 +1,335 @@
1
+ import { c as freezeRecursively, n as normalizeCoreOptions } from "./chunks/options-5x9gu2Qb.js";
2
+ import { n as CoreOperationException } from "./chunks/exceptions-IXsorE8t.js";
3
+ import { c as NODE_INSPECTION_PROFILE, d as NODE_INSPECTION_TRANSPORT_BYTES, i as decodeInspectionMessage, n as serializeInspectionFailure, r as createInspectionProcessFailure, s as NODE_INSPECTION_LIFETIME_MS, t as deserializeInspectionFailure } from "./chunks/errors-BE4DS3Ak.js";
4
+ import { n as createInspectionSender, r as superviseInspectionChild, t as createInspectionEnvironment } from "./chunks/lifecycle-D_RvxhDC.js";
5
+ import { t as executeRepositoryRpc } from "./chunks/repository-rpc-B_y0Kspf.js";
6
+ import { RepositorySourceException } from "@moldea.ai/repository";
7
+ import { fork } from "node:child_process";
8
+ import { randomBytes } from "node:crypto";
9
+ import { fileURLToPath } from "node:url";
10
+ //#region src/node-inspection/client.ts
11
+ var isInspectionActive = false;
12
+ /** Stores one completion without an unhandled rejection before its owner begins awaiting it. */
13
+ var createCompletion = () => {
14
+ let resolve;
15
+ let reject;
16
+ const promise = new Promise((resolveResult, rejectResult) => {
17
+ resolve = resolveResult;
18
+ reject = rejectResult;
19
+ });
20
+ promise.catch(() => {});
21
+ return {
22
+ promise,
23
+ resolve,
24
+ reject
25
+ };
26
+ };
27
+ var aborted = (cause) => new CoreOperationException({
28
+ code: "ABORTED",
29
+ operation: "create-project-inspection",
30
+ ...cause === void 0 ? {} : { cause }
31
+ });
32
+ /**
33
+ * Prepares content-free inspection inside one supervised subprocess and one analysis worker.
34
+ * The caller owns actual reader work and must dispose the returned handle before publishing success.
35
+ * @returns An async paging handle after the worker reports its actual heap and prepares inspection.
36
+ * @throws
37
+ * - INVALID_ARGUMENT: The Core operation received an invalid argument.
38
+ * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.
39
+ * - ABORTED: The Core operation was aborted.
40
+ * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
41
+ * - INSPECTION_BUSY: Project inspection capacity is busy. Try again shortly.
42
+ * - INSPECTION_TIMEOUT: The isolated project inspection timed out.
43
+ * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
44
+ * - INVALID_REPOSITORY_PATH: The repository path is invalid.
45
+ * - ENTRY_NOT_FOUND: The requested repository entry was not found.
46
+ * - ENTRY_NOT_FILE: The requested repository entry is not a file.
47
+ * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.
48
+ * - INVALID_PAGE_REQUEST: The repository page request is invalid.
49
+ * - ACCESS_DENIED: Access to the repository source was denied.
50
+ * - SOURCE_UNAVAILABLE: The repository source is unavailable.
51
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
52
+ * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.
53
+ * - INVALID_SOURCE_DATA: The repository source returned invalid data.
54
+ * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
55
+ * - ABORTED: The repository operation was aborted.
56
+ */
57
+ var createNodeProjectInspection = async (input) => {
58
+ if (input === null || typeof input !== "object" || input.repository === null || typeof input.repository !== "object" || typeof input.repository.getEntry !== "function" || typeof input.repository.listEntriesPage !== "function" || typeof input.repository.readFilePage !== "function" || input.repository.snapshot === null || typeof input.repository.snapshot !== "object" || typeof input.repository.snapshot.id !== "string" || input.repository.snapshot.id.length === 0 || typeof input.repository.snapshot.sourceKind !== "string" || input.repository.snapshot.sourceKind.length === 0) throw new CoreOperationException({
59
+ code: "INVALID_ARGUMENT",
60
+ operation: "create-project-inspection"
61
+ });
62
+ let repository = input.repository;
63
+ const snapshot = {
64
+ id: repository.snapshot.id,
65
+ sourceKind: repository.snapshot.sourceKind
66
+ };
67
+ const signal = input.signal;
68
+ if (signal !== void 0 && (signal === null || typeof signal !== "object" || typeof signal.aborted !== "boolean" || typeof signal.addEventListener !== "function" || typeof signal.removeEventListener !== "function")) throw new CoreOperationException({
69
+ code: "INVALID_ARGUMENT",
70
+ operation: "create-project-inspection"
71
+ });
72
+ const { limits } = normalizeCoreOptions({ ...input.limits === void 0 ? {} : { limits: input.limits } });
73
+ if (input.deadline !== void 0 && (!Number.isSafeInteger(input.deadline) || input.deadline < 0)) throw new CoreOperationException({
74
+ code: "INVALID_ARGUMENT",
75
+ operation: "create-project-inspection"
76
+ });
77
+ if (signal?.aborted === true) throw aborted(signal.reason);
78
+ if (isInspectionActive) throw new CoreOperationException({
79
+ code: "INSPECTION_BUSY",
80
+ operation: "create-project-inspection"
81
+ });
82
+ if (limits.maxRetainedBytes <= 50331648) throw new CoreOperationException({
83
+ code: "RESOURCE_LIMIT_EXCEEDED",
84
+ operation: "create-project-inspection",
85
+ limit: "maxRetainedBytes",
86
+ limitMaximum: limits.maxRetainedBytes,
87
+ observedUsage: NODE_INSPECTION_TRANSPORT_BYTES,
88
+ nextAction: "reduce-input-or-increase-limit"
89
+ });
90
+ const deadline = Math.min(Date.now() + NODE_INSPECTION_LIFETIME_MS, input.deadline ?? Infinity);
91
+ if (deadline <= Date.now()) throw new CoreOperationException({
92
+ code: "INSPECTION_TIMEOUT",
93
+ operation: "create-project-inspection"
94
+ });
95
+ isInspectionActive = true;
96
+ const controller = new AbortController();
97
+ const attemptId = randomBytes(16).toString("hex");
98
+ const prepared = createCompletion();
99
+ let pendingPage;
100
+ let pageRequestId = 0;
101
+ let lastReaderRequestId = -1;
102
+ let hasAcknowledgedHeap = false;
103
+ let heapMaximum;
104
+ let hasPrepared = false;
105
+ let isClosing = false;
106
+ let failure;
107
+ let cleanupPromise;
108
+ const readerWork = /* @__PURE__ */ new Set();
109
+ const relayWork = /* @__PURE__ */ new Set();
110
+ const child = (() => {
111
+ try {
112
+ return fork(fileURLToPath(import.meta.resolve("#moldea-core-runner")), [], {
113
+ execPath: process.execPath,
114
+ execArgv: [],
115
+ env: createInspectionEnvironment(),
116
+ serialization: "advanced",
117
+ stdio: [
118
+ "ignore",
119
+ "ignore",
120
+ "pipe",
121
+ "ipc"
122
+ ]
123
+ });
124
+ } catch (cause) {
125
+ isInspectionActive = false;
126
+ throw createInspectionProcessFailure(cause);
127
+ }
128
+ })();
129
+ const send = createInspectionSender((frame, callback) => {
130
+ if (!child.connected) throw createInspectionProcessFailure();
131
+ child.send(frame, callback);
132
+ });
133
+ const supervision = superviseInspectionChild(child, () => {
134
+ send({
135
+ attemptId,
136
+ kind: "dispose"
137
+ }).catch(() => {
138
+ child.kill("SIGKILL");
139
+ });
140
+ });
141
+ /** Keeps admission until child closure and every real reader promise has settled. */
142
+ const cleanup = () => {
143
+ cleanupPromise ??= (async () => {
144
+ isClosing = true;
145
+ controller.abort(failure?.cause);
146
+ supervision.terminate();
147
+ await supervision.closed;
148
+ await Promise.allSettled([...readerWork, ...relayWork]);
149
+ repository = void 0;
150
+ clearTimeout(timer);
151
+ if (failure === void 0 && Date.now() >= deadline) fail(new CoreOperationException({
152
+ code: "INSPECTION_TIMEOUT",
153
+ operation: "create-project-inspection"
154
+ }));
155
+ signal?.removeEventListener("abort", handleAbort);
156
+ child.removeAllListeners("message");
157
+ child.removeAllListeners("error");
158
+ child.stderr?.removeAllListeners("data");
159
+ isInspectionActive = false;
160
+ })();
161
+ return cleanupPromise;
162
+ };
163
+ const fail = (cause) => {
164
+ if (failure === void 0) failure = { cause: cause instanceof Error ? cause : createInspectionProcessFailure(cause) };
165
+ prepared.reject(failure.cause);
166
+ pendingPage?.reject(failure.cause);
167
+ cleanup();
168
+ };
169
+ const getFailureCause = () => failure?.cause;
170
+ const handleAbort = () => {
171
+ fail(aborted(signal?.reason));
172
+ };
173
+ const timer = setTimeout(() => {
174
+ fail(new CoreOperationException({
175
+ code: "INSPECTION_TIMEOUT",
176
+ operation: "create-project-inspection"
177
+ }));
178
+ }, Math.max(1, deadline - Date.now()));
179
+ signal?.addEventListener("abort", handleAbort, { once: true });
180
+ const isCallerAborted = () => signal?.aborted === true;
181
+ if (isCallerAborted()) handleAbort();
182
+ child.once("error", (cause) => {
183
+ fail(createInspectionProcessFailure(cause));
184
+ });
185
+ supervision.closed.then(() => {
186
+ if (!isClosing) fail(createInspectionProcessFailure());
187
+ });
188
+ let stderrBytes = 0;
189
+ child.stderr?.on("data", (chunk) => {
190
+ stderrBytes += chunk.byteLength;
191
+ if (stderrBytes > 32768) fail(createInspectionProcessFailure());
192
+ });
193
+ child.on("message", (frame) => {
194
+ if (isClosing) return;
195
+ try {
196
+ const message = decodeInspectionMessage(frame);
197
+ if (message.attemptId !== attemptId) throw createInspectionProcessFailure();
198
+ if (message.kind === "ready") {
199
+ if (hasAcknowledgedHeap) throw createInspectionProcessFailure();
200
+ heapMaximum = message.maxAnalysisHeapBytes;
201
+ hasAcknowledgedHeap = true;
202
+ send({
203
+ attemptId,
204
+ kind: "run"
205
+ }).catch(fail);
206
+ } else if (message.kind === "prepared") {
207
+ if (!hasAcknowledgedHeap || hasPrepared || message.inspection.maxAnalysisHeapBytes !== heapMaximum || message.inspection.source.id !== snapshot.id || message.inspection.source.sourceKind !== snapshot.sourceKind) throw createInspectionProcessFailure();
208
+ hasPrepared = true;
209
+ prepared.resolve(freezeRecursively(message.inspection));
210
+ } else if (message.kind === "reader-request") {
211
+ if (!hasAcknowledgedHeap || hasPrepared || message.requestId !== lastReaderRequestId + 1 || readerWork.size >= 4) throw createInspectionProcessFailure();
212
+ lastReaderRequestId = message.requestId;
213
+ if (repository === void 0) throw createInspectionProcessFailure();
214
+ const work = executeRepositoryRpc(repository, message.request, controller.signal);
215
+ readerWork.add(work);
216
+ const relay = (async () => {
217
+ try {
218
+ const result = await work;
219
+ readerWork.delete(work);
220
+ if (!isClosing) await send({
221
+ attemptId,
222
+ kind: "reader-response",
223
+ requestId: message.requestId,
224
+ result
225
+ });
226
+ } catch (cause) {
227
+ if (cause instanceof RepositorySourceException && [
228
+ "ENTRY_NOT_FOUND",
229
+ "ENTRY_NOT_FILE",
230
+ "RESOURCE_LIMIT_EXCEEDED"
231
+ ].includes(cause.code)) try {
232
+ if (!isClosing) await send({
233
+ attemptId,
234
+ kind: "reader-failure",
235
+ requestId: message.requestId,
236
+ failure: serializeInspectionFailure(cause)
237
+ });
238
+ } catch (transportFailure) {
239
+ fail(transportFailure);
240
+ }
241
+ else fail(cause);
242
+ } finally {
243
+ readerWork.delete(work);
244
+ }
245
+ })();
246
+ relayWork.add(relay);
247
+ relay.finally(() => relayWork.delete(relay));
248
+ } else if (message.kind === "page") {
249
+ if (!hasPrepared || pendingPage === void 0 || message.requestId !== pageRequestId) throw createInspectionProcessFailure();
250
+ const completion = pendingPage;
251
+ pendingPage = void 0;
252
+ completion.resolve(freezeRecursively(message.result));
253
+ } else if (message.kind === "failure") {
254
+ if (message.failure.options["nextAction"] === "review-inspection-capacity" && (heapMaximum === void 0 || message.failure.options["limitMaximum"] !== heapMaximum)) throw createInspectionProcessFailure();
255
+ fail(deserializeInspectionFailure(message.failure));
256
+ } else throw createInspectionProcessFailure();
257
+ } catch (cause) {
258
+ fail(cause);
259
+ }
260
+ });
261
+ try {
262
+ await send({
263
+ attemptId,
264
+ kind: "start",
265
+ snapshot,
266
+ limits,
267
+ deadline
268
+ });
269
+ const metadata = await prepared.promise;
270
+ if (Date.now() >= deadline) throw new CoreOperationException({
271
+ code: "INSPECTION_TIMEOUT",
272
+ operation: "create-project-inspection"
273
+ });
274
+ return Object.freeze({
275
+ ...metadata,
276
+ readPage: async (pageInput) => {
277
+ if (failure !== void 0 || isClosing) throw failure?.cause ?? aborted();
278
+ if (pendingPage !== void 0 || pageInput === null || typeof pageInput !== "object" || Reflect.ownKeys(pageInput).some((key) => key !== "cursor" && key !== "maxItems" && key !== "view") || !Number.isSafeInteger(pageInput.maxItems) || pageInput.maxItems < 1 || pageInput.maxItems > limits.maxEntries || ![
279
+ "all",
280
+ "diagnostics",
281
+ "coverage",
282
+ "metadata"
283
+ ].includes(pageInput.view) || pageInput.cursor !== void 0 && typeof pageInput.cursor !== "string") throw new CoreOperationException({
284
+ code: "INVALID_ARGUMENT",
285
+ operation: "create-project-inspection"
286
+ });
287
+ const completion = createCompletion();
288
+ pendingPage = completion;
289
+ pageRequestId++;
290
+ try {
291
+ if (Date.now() >= deadline) throw new CoreOperationException({
292
+ code: "INSPECTION_TIMEOUT",
293
+ operation: "create-project-inspection"
294
+ });
295
+ await send({
296
+ attemptId,
297
+ kind: "read-page",
298
+ requestId: pageRequestId,
299
+ input: {
300
+ maxItems: pageInput.maxItems,
301
+ view: pageInput.view,
302
+ ...pageInput.cursor === void 0 ? {} : { cursor: pageInput.cursor }
303
+ }
304
+ });
305
+ const result = await completion.promise;
306
+ if (Date.now() >= deadline) throw new CoreOperationException({
307
+ code: "INSPECTION_TIMEOUT",
308
+ operation: "create-project-inspection"
309
+ });
310
+ return result;
311
+ } catch (cause) {
312
+ fail(cause);
313
+ await cleanup();
314
+ throw getFailureCause() ?? createInspectionProcessFailure(cause);
315
+ } finally {
316
+ if (pendingPage === completion) pendingPage = void 0;
317
+ }
318
+ },
319
+ dispose: async () => {
320
+ pendingPage?.reject(failure?.cause ?? aborted());
321
+ await cleanup();
322
+ const cause = getFailureCause();
323
+ if (cause !== void 0) throw cause;
324
+ }
325
+ });
326
+ } catch (cause) {
327
+ fail(cause);
328
+ await cleanup();
329
+ throw getFailureCause() ?? createInspectionProcessFailure(cause);
330
+ }
331
+ };
332
+ //#endregion
333
+ export { NODE_INSPECTION_PROFILE, createNodeProjectInspection };
334
+
335
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","names":[],"sources":["../src/node-inspection/client.ts"],"sourcesContent":["import { fork } from 'node:child_process';\nimport { randomBytes } from 'node:crypto';\nimport { fileURLToPath } from 'node:url';\n\nimport { RepositorySourceException } from '@moldea.ai/repository';\n\nimport { CoreOperationException } from '../exceptions/index.js';\nimport { freezeRecursively } from '../immutable/index.js';\nimport { normalizeCoreOptions } from '../options/index.js';\n\nimport {\n NODE_INSPECTION_LIFETIME_MS,\n NODE_INSPECTION_MAX_REQUESTS,\n NODE_INSPECTION_STDIO_BYTES,\n NODE_INSPECTION_TRANSPORT_BYTES,\n} from './constants.js';\nimport { deserializeInspectionFailure, serializeInspectionFailure } from './errors.js';\nimport {\n createInspectionEnvironment,\n createInspectionSender,\n superviseInspectionChild,\n} from './lifecycle.js';\nimport { createInspectionProcessFailure, decodeInspectionMessage } from './protocol.js';\nimport { executeRepositoryRpc } from './repository-rpc.js';\nimport type {\n INodeInspectionMetadata,\n INodeProjectInspection,\n INodeProjectInspectionInput,\n} from './types.js';\nimport type { IProjectInspectionPageResult } from '../contracts/index.js';\n\nlet isInspectionActive = false;\n\n/** Stores one completion without an unhandled rejection before its owner begins awaiting it. */\nconst createCompletion = <T>(): {\n promise: Promise<T>;\n resolve: (result: T) => void;\n reject: (cause: unknown) => void;\n} => {\n let resolve!: (result: T) => void;\n let reject!: (cause: unknown) => void;\n const promise = new Promise<T>((resolveResult, rejectResult) => {\n resolve = resolveResult;\n reject = rejectResult;\n });\n void promise.catch(() => {});\n return { promise, resolve, reject };\n};\n\nconst aborted = (cause?: unknown): CoreOperationException =>\n new CoreOperationException({\n code: 'ABORTED',\n operation: 'create-project-inspection',\n ...(cause === undefined ? {} : { cause }),\n });\n\n/**\n * Prepares content-free inspection inside one supervised subprocess and one analysis worker.\n * The caller owns actual reader work and must dispose the returned handle before publishing success.\n * @returns An async paging handle after the worker reports its actual heap and prepares inspection.\n * @throws\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n * - ABORTED: The Core operation was aborted.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\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 * - 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 * - 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 createNodeProjectInspection = async (\n input: INodeProjectInspectionInput,\n): Promise<INodeProjectInspection> => {\n if (\n input === null ||\n typeof input !== 'object' ||\n input.repository === null ||\n typeof input.repository !== 'object' ||\n typeof input.repository.getEntry !== 'function' ||\n typeof input.repository.listEntriesPage !== 'function' ||\n typeof input.repository.readFilePage !== 'function' ||\n input.repository.snapshot === null ||\n typeof input.repository.snapshot !== 'object' ||\n typeof input.repository.snapshot.id !== 'string' ||\n input.repository.snapshot.id.length === 0 ||\n typeof input.repository.snapshot.sourceKind !== 'string' ||\n input.repository.snapshot.sourceKind.length === 0\n ) {\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation: 'create-project-inspection',\n });\n }\n let repository: INodeProjectInspectionInput['repository'] | undefined = input.repository;\n const snapshot = { id: repository.snapshot.id, sourceKind: repository.snapshot.sourceKind };\n const signal = input.signal;\n if (\n signal !== undefined &&\n (signal === null ||\n typeof signal !== 'object' ||\n typeof signal.aborted !== 'boolean' ||\n typeof signal.addEventListener !== 'function' ||\n typeof signal.removeEventListener !== 'function')\n ) {\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation: 'create-project-inspection',\n });\n }\n const { limits } = normalizeCoreOptions({\n ...(input.limits === undefined ? {} : { limits: input.limits }),\n });\n if (input.deadline !== undefined && (!Number.isSafeInteger(input.deadline) || input.deadline < 0))\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation: 'create-project-inspection',\n });\n if (signal?.aborted === true) throw aborted(signal.reason);\n if (isInspectionActive)\n throw new CoreOperationException({\n code: 'INSPECTION_BUSY',\n operation: 'create-project-inspection',\n });\n if (limits.maxRetainedBytes <= NODE_INSPECTION_TRANSPORT_BYTES)\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n operation: 'create-project-inspection',\n limit: 'maxRetainedBytes',\n limitMaximum: limits.maxRetainedBytes,\n observedUsage: NODE_INSPECTION_TRANSPORT_BYTES,\n nextAction: 'reduce-input-or-increase-limit',\n });\n const deadline = Math.min(Date.now() + NODE_INSPECTION_LIFETIME_MS, input.deadline ?? Infinity);\n if (deadline <= Date.now())\n throw new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n });\n isInspectionActive = true;\n const controller = new AbortController();\n const attemptId = randomBytes(16).toString('hex');\n const prepared = createCompletion<INodeInspectionMetadata>();\n let pendingPage: ReturnType<typeof createCompletion<IProjectInspectionPageResult>> | undefined;\n let pageRequestId = 0;\n let lastReaderRequestId = -1;\n let hasAcknowledgedHeap = false;\n let heapMaximum: number | undefined;\n let hasPrepared = false;\n let isClosing = false;\n let failure: { cause: Error } | undefined;\n let cleanupPromise: Promise<void> | undefined;\n const readerWork = new Set<Promise<unknown>>();\n const relayWork = new Set<Promise<void>>();\n const child = (() => {\n try {\n return fork(fileURLToPath(import.meta.resolve('#moldea-core-runner')), [], {\n execPath: process.execPath,\n execArgv: [],\n env: createInspectionEnvironment(),\n serialization: 'advanced',\n stdio: ['ignore', 'ignore', 'pipe', 'ipc'],\n });\n } catch (cause) {\n isInspectionActive = false;\n throw createInspectionProcessFailure(cause);\n }\n })();\n const send = createInspectionSender((frame, callback) => {\n if (!child.connected) throw createInspectionProcessFailure();\n child.send(frame, callback);\n });\n const supervision = superviseInspectionChild(child, () => {\n void send({ attemptId, kind: 'dispose' }).catch(() => {\n child.kill('SIGKILL');\n });\n });\n\n /** Keeps admission until child closure and every real reader promise has settled. */\n const cleanup = (): Promise<void> => {\n cleanupPromise ??= (async () => {\n isClosing = true;\n controller.abort(failure?.cause);\n supervision.terminate();\n await supervision.closed;\n await Promise.allSettled([...readerWork, ...relayWork]);\n repository = undefined;\n clearTimeout(timer);\n if (failure === undefined && Date.now() >= deadline) {\n fail(\n new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n }),\n );\n }\n signal?.removeEventListener('abort', handleAbort);\n child.removeAllListeners('message');\n child.removeAllListeners('error');\n child.stderr?.removeAllListeners('data');\n isInspectionActive = false;\n })();\n return cleanupPromise;\n };\n const fail = (cause: unknown): void => {\n if (failure === undefined)\n failure = { cause: cause instanceof Error ? cause : createInspectionProcessFailure(cause) };\n prepared.reject(failure.cause);\n pendingPage?.reject(failure.cause);\n void cleanup();\n };\n const getFailureCause = (): Error | undefined => failure?.cause;\n const handleAbort = (): void => {\n fail(aborted(signal?.reason));\n };\n const timer = setTimeout(\n () => {\n fail(\n new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n }),\n );\n },\n Math.max(1, deadline - Date.now()),\n );\n signal?.addEventListener('abort', handleAbort, { once: true });\n // Re-read through a function because cancellation can change during listener registration.\n const isCallerAborted = (): boolean => signal?.aborted === true;\n if (isCallerAborted()) handleAbort();\n child.once('error', (cause: unknown) => {\n fail(createInspectionProcessFailure(cause));\n });\n void supervision.closed.then(() => {\n if (!isClosing) fail(createInspectionProcessFailure());\n });\n let stderrBytes = 0;\n child.stderr?.on('data', (chunk: Buffer) => {\n stderrBytes += chunk.byteLength;\n if (stderrBytes > NODE_INSPECTION_STDIO_BYTES) fail(createInspectionProcessFailure());\n });\n child.on('message', (frame: unknown) => {\n if (isClosing) return;\n try {\n const message = decodeInspectionMessage(frame);\n if (message.attemptId !== attemptId) throw createInspectionProcessFailure();\n if (message.kind === 'ready') {\n if (hasAcknowledgedHeap) throw createInspectionProcessFailure();\n heapMaximum = message.maxAnalysisHeapBytes;\n hasAcknowledgedHeap = true;\n void send({ attemptId, kind: 'run' }).catch(fail);\n } else if (message.kind === 'prepared') {\n if (\n !hasAcknowledgedHeap ||\n hasPrepared ||\n message.inspection.maxAnalysisHeapBytes !== heapMaximum ||\n message.inspection.source.id !== snapshot.id ||\n message.inspection.source.sourceKind !== snapshot.sourceKind\n )\n throw createInspectionProcessFailure();\n hasPrepared = true;\n prepared.resolve(freezeRecursively(message.inspection));\n } else if (message.kind === 'reader-request') {\n if (\n !hasAcknowledgedHeap ||\n hasPrepared ||\n message.requestId !== lastReaderRequestId + 1 ||\n readerWork.size >= NODE_INSPECTION_MAX_REQUESTS\n )\n throw createInspectionProcessFailure();\n lastReaderRequestId = message.requestId;\n if (repository === undefined) throw createInspectionProcessFailure();\n const work = executeRepositoryRpc(repository, message.request, controller.signal);\n readerWork.add(work);\n const relay = (async () => {\n try {\n const result = await work;\n readerWork.delete(work);\n if (!isClosing)\n await send({\n attemptId,\n kind: 'reader-response',\n requestId: message.requestId,\n result,\n });\n } catch (cause) {\n // Core decides whether absence or a reader resource refusal is recoverable at this check.\n if (\n cause instanceof RepositorySourceException &&\n ['ENTRY_NOT_FOUND', 'ENTRY_NOT_FILE', 'RESOURCE_LIMIT_EXCEEDED'].includes(cause.code)\n ) {\n try {\n if (!isClosing)\n await send({\n attemptId,\n kind: 'reader-failure',\n requestId: message.requestId,\n failure: serializeInspectionFailure(cause),\n });\n } catch (transportFailure) {\n fail(transportFailure);\n }\n } else fail(cause);\n } finally {\n readerWork.delete(work);\n }\n })();\n relayWork.add(relay);\n void relay.finally(() => relayWork.delete(relay));\n } else if (message.kind === 'page') {\n if (!hasPrepared || pendingPage === undefined || message.requestId !== pageRequestId)\n throw createInspectionProcessFailure();\n const completion = pendingPage;\n pendingPage = undefined;\n completion.resolve(freezeRecursively(message.result));\n } else if (message.kind === 'failure') {\n if (\n message.failure.options['nextAction'] === 'review-inspection-capacity' &&\n (heapMaximum === undefined || message.failure.options['limitMaximum'] !== heapMaximum)\n )\n throw createInspectionProcessFailure();\n fail(deserializeInspectionFailure(message.failure));\n } else throw createInspectionProcessFailure();\n } catch (cause) {\n fail(cause);\n }\n });\n try {\n await send({\n attemptId,\n kind: 'start',\n snapshot,\n limits,\n deadline,\n });\n const metadata = await prepared.promise;\n if (Date.now() >= deadline)\n throw new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n });\n return Object.freeze({\n ...metadata,\n readPage: async (pageInput): Promise<IProjectInspectionPageResult> => {\n if (failure !== undefined || isClosing) throw failure?.cause ?? aborted();\n if (\n pendingPage !== undefined ||\n pageInput === null ||\n typeof pageInput !== 'object' ||\n Reflect.ownKeys(pageInput).some(\n (key) => key !== 'cursor' && key !== 'maxItems' && key !== 'view',\n ) ||\n !Number.isSafeInteger(pageInput.maxItems) ||\n pageInput.maxItems < 1 ||\n pageInput.maxItems > limits.maxEntries ||\n !['all', 'diagnostics', 'coverage', 'metadata'].includes(pageInput.view) ||\n (pageInput.cursor !== undefined && typeof pageInput.cursor !== 'string')\n )\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation: 'create-project-inspection',\n });\n const completion = createCompletion<IProjectInspectionPageResult>();\n pendingPage = completion;\n pageRequestId++;\n try {\n if (Date.now() >= deadline)\n throw new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n });\n await send({\n attemptId,\n kind: 'read-page',\n requestId: pageRequestId,\n input: {\n maxItems: pageInput.maxItems,\n view: pageInput.view,\n ...(pageInput.cursor === undefined ? {} : { cursor: pageInput.cursor }),\n },\n });\n const result = await completion.promise;\n if (Date.now() >= deadline)\n throw new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n });\n return result;\n } catch (cause) {\n fail(cause);\n await cleanup();\n throw getFailureCause() ?? createInspectionProcessFailure(cause);\n } finally {\n if (pendingPage === completion) pendingPage = undefined;\n }\n },\n dispose: async (): Promise<void> => {\n pendingPage?.reject(failure?.cause ?? aborted());\n await cleanup();\n const cause = getFailureCause();\n if (cause !== undefined) throw cause;\n },\n } satisfies INodeProjectInspection);\n } catch (cause) {\n fail(cause);\n await cleanup();\n throw getFailureCause() ?? createInspectionProcessFailure(cause);\n }\n};\n"],"mappings":";;;;;;;;;;AA+BA,IAAI,qBAAqB;;AAGzB,IAAM,yBAID;CACH,IAAI;CACJ,IAAI;CACJ,MAAM,UAAU,IAAI,SAAY,eAAe,iBAAiB;EAC9D,UAAU;EACV,SAAS;CACX,CAAC;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MAAM,gBAAgB,KAAK,+BAA+B,KAAK;CACjE;AACF"}
@@ -1,25 +1,13 @@
1
- import type { IRuntimeAdapterContext, IRuntimeAdapterResult } from '../adapter/index.js';
2
1
  import type { ICoreOptions, ICoreResourceLimits } from '../contracts/index.js';
3
- import type { IRepositoryFormatVersion } from '../format/index.js';
4
- export interface IRuntimeAdapterSnapshot {
5
- readonly id: string;
6
- readonly supportedRepositoryFormatVersions: readonly IRepositoryFormatVersion[];
7
- readonly inspect: (context: IRuntimeAdapterContext) => Promise<IRuntimeAdapterResult>;
8
- }
9
2
  export interface ICoreOptionsSnapshot {
10
- readonly adapters: readonly IRuntimeAdapterSnapshot[];
11
3
  readonly limits: ICoreResourceLimits;
12
4
  }
13
5
  /** Creates an operation-local options view with one shared raw-diagnostic budget. */
14
6
  export declare const createCoreOperationOptionsSnapshot: (options: ICoreOptionsSnapshot) => ICoreOptionsSnapshot;
15
7
  /**
16
- * Validates and snapshots caller-owned Core construction options.
17
- * @param options The optional adapters and resource-limit overrides.
18
- * @returns A deeply frozen, deterministically ordered configuration snapshot.
8
+ * Validates and snapshots caller-owned Core resource limits.
9
+ * @returns A deeply frozen configuration snapshot.
19
10
  * @throws
20
- * - DUPLICATE_ADAPTER_ID: A runtime adapter ID is registered more than once.
21
- * - RESERVED_ADAPTER_ID: A reserved runtime adapter ID was supplied.
22
- * - INVALID_ADAPTER_DEFINITION: A runtime adapter definition is invalid.
23
11
  * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.
24
12
  */
25
13
  export declare const normalizeCoreOptions: (options: ICoreOptions | undefined) => ICoreOptionsSnapshot;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAInE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,iCAAiC,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAChF,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACvF;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACtD,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED,qFAAqF;AACrF,eAAO,MAAM,kCAAkC,GAC7C,SAAS,oBAAoB,KAC5B,oBAKF,CAAC;AAkMF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,YAAY,GAAG,SAAS,KAAG,oBASxE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM/E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED,qFAAqF;AACrF,eAAO,MAAM,kCAAkC,GAC7C,SAAS,oBAAoB,KAC5B,oBAIF,CAAC;AAqEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,YAAY,GAAG,SAAS,KAAG,oBAWxE,CAAC"}
@@ -1,5 +1,25 @@
1
1
  import type { IProjectInspection, IProjectInspectionInput } from '../contracts/index.js';
2
2
  import type { ICoreOptionsSnapshot } from '../options/index.js';
3
- /** Prepares one immutable content-free inspection for synchronous bounded page reads. */
3
+ /**
4
+ * Prepares one immutable content-free inspection for synchronous bounded page reads.
5
+ * @param input The source-neutral reader and optional cancellation signal.
6
+ * @param options The immutable operation limits.
7
+ * @returns A promise resolving to the complete prepared inspection.
8
+ * @throws
9
+ * - INVALID_ARGUMENT: The Core operation received an invalid argument.
10
+ * - INVALID_REPOSITORY_PATH: The repository path is invalid.
11
+ * - ENTRY_NOT_FOUND: The requested repository entry was not found.
12
+ * - ENTRY_NOT_FILE: The requested repository entry is not a file.
13
+ * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.
14
+ * - ACCESS_DENIED: Access to the repository source was denied.
15
+ * - SOURCE_UNAVAILABLE: The repository source is unavailable.
16
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
17
+ * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.
18
+ * - INVALID_SOURCE_DATA: The repository source returned invalid data.
19
+ * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
20
+ * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
21
+ * - ABORTED: The repository operation was aborted.
22
+ * - ABORTED: The Core operation was aborted.
23
+ */
4
24
  export declare const createProjectInspection: (input: IProjectInspectionInput, options: ICoreOptionsSnapshot) => Promise<IProjectInspection>;
5
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-inspection/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EAOxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAmchE,yFAAyF;AACzF,eAAO,MAAM,uBAAuB,GAClC,OAAO,uBAAuB,EAC9B,SAAS,oBAAoB,KAC5B,OAAO,CAAC,kBAAkB,CAiC5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-inspection/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EAOxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAsdhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,uBAAuB,EAC9B,SAAS,oBAAoB,KAC5B,OAAO,CAAC,kBAAkB,CAmC5B,CAAC"}
@@ -7,25 +7,47 @@ export interface IProjectValidationState {
7
7
  readonly result: IProjectValidationResult;
8
8
  }
9
9
  /**
10
- * Inspects one coherent repository snapshot through universal and adapter validation.
10
+ * Inspects one coherent repository snapshot through universal file and export validation.
11
11
  * @param input The untrusted source-neutral reader and optional cancellation signal.
12
12
  * @param options The immutable Core configuration snapshot.
13
13
  * @returns A promise resolving to the frozen all-or-nothing project inspection result.
14
14
  * @throws
15
15
  * - INVALID_ARGUMENT: The Core operation received an invalid argument.
16
- * - INVALID_REPOSITORY_PATH: A repository path is invalid.
17
- * - ENTRY_NOT_FOUND: A discovered file disappeared from the reader snapshot.
18
- * - ENTRY_NOT_FILE: A discovered file changed type during inspection.
19
- * - ENTRY_NOT_DIRECTORY: A discovered directory changed type during inspection.
16
+ * - INVALID_REPOSITORY_PATH: The repository path is invalid.
17
+ * - ENTRY_NOT_FOUND: The requested repository entry was not found.
18
+ * - ENTRY_NOT_FILE: The requested repository entry is not a file.
19
+ * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.
20
20
  * - ACCESS_DENIED: Access to the repository source was denied.
21
21
  * - SOURCE_UNAVAILABLE: The repository source is unavailable.
22
- * - SNAPSHOT_CHANGED: The repository snapshot changed during inspection.
23
- * - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
24
- * - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
25
- * - ABORTED: Project inspection or a repository operation was aborted.
26
- * - ADAPTER_EXECUTION_FAILED: A runtime adapter failed or returned an invalid result.
22
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
23
+ * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.
24
+ * - INVALID_SOURCE_DATA: The repository source returned invalid data.
25
+ * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
26
+ * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
27
+ * - ABORTED: The repository operation was aborted.
28
+ * - ABORTED: The Core operation was aborted.
27
29
  */
28
30
  export declare const validateProjectState: (input: IProjectValidationInput, options: ICoreOptionsSnapshot) => Promise<IProjectValidationState>;
29
- /** Validates one project without returning canonical document bodies. */
31
+ /**
32
+ * Validates one project without returning canonical document bodies.
33
+ * @param input The source-neutral reader and optional cancellation signal.
34
+ * @param options The immutable operation limits.
35
+ * @returns A promise resolving to the complete validation result.
36
+ * @throws
37
+ * - INVALID_ARGUMENT: The Core operation received an invalid argument.
38
+ * - INVALID_REPOSITORY_PATH: The repository path is invalid.
39
+ * - ENTRY_NOT_FOUND: The requested repository entry was not found.
40
+ * - ENTRY_NOT_FILE: The requested repository entry is not a file.
41
+ * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.
42
+ * - ACCESS_DENIED: Access to the repository source was denied.
43
+ * - SOURCE_UNAVAILABLE: The repository source is unavailable.
44
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
45
+ * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.
46
+ * - INVALID_SOURCE_DATA: The repository source returned invalid data.
47
+ * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
48
+ * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
49
+ * - ABORTED: The repository operation was aborted.
50
+ * - ABORTED: The Core operation was aborted.
51
+ */
30
52
  export declare const validateProject: (input: IProjectValidationInput, options: ICoreOptionsSnapshot) => Promise<IProjectValidationResult>;
31
53
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-validation/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,mBAAmB,EACnB,u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,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,uBAAuB,EAC9B,SAAS,oBAAoB,KAC5B,OAAO,CAAC,wBAAwB,CAAwD,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { type IRepositoryEntry, type IRepositoryOperationOptions, type IRepositoryPath, type IRepositoryReader } from '@moldea.ai/repository';
2
2
  import type { ICoreResourceLimits } from '../contracts/index.js';
3
- import type { IRuntimeAdapterRepository } from '../adapter/index.js';
4
3
  export interface IRepositoryInspectionListOptions extends IRepositoryOperationOptions {
5
4
  readonly prefix?: IRepositoryPath;
6
5
  }
@@ -10,14 +9,13 @@ export interface IRepositoryInspectionReader {
10
9
  readCompleteFile(path: IRepositoryPath, options?: IRepositoryOperationOptions): Promise<Uint8Array>;
11
10
  }
12
11
  export interface IRepositoryInspectionSession {
13
- readonly adapterRepository: IRuntimeAdapterRepository;
14
12
  readonly reader: IRepositoryInspectionReader;
15
13
  /** Returns deterministic logical resource usage for the current validation state. */
16
14
  getResourceUsage(): IRepositoryInspectionResourceUsage;
17
15
  /**
18
16
  * Stops work at an inspection boundary when cancellation was requested.
19
17
  * @throws
20
- * - ABORTED: Repository inspection was aborted.
18
+ * - ABORTED: The Core operation was aborted.
21
19
  */
22
20
  throwIfAborted(): void;
23
21
  }
@@ -34,7 +32,7 @@ export interface IRepositoryInspectionResourceUsage {
34
32
  * @param signal Optional cancellation shared by every inspection operation.
35
33
  * @returns A session that pages source metadata and range-reads bounded canonical files.
36
34
  * @throws
37
- * - ABORTED: Repository inspection was aborted before the session was created.
35
+ * - ABORTED: The Core operation was aborted.
38
36
  */
39
37
  export declare const createRepositoryInspectionSession: (repository: IRepositoryReader, limits: ICoreResourceLimits, signal?: AbortSignal) => IRepositoryInspectionSession;
40
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repository-inspection-session/index.ts"],"names":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}
@@ -1,4 +1,5 @@
1
1
  import { type IRepositoryPath } from '@moldea.ai/repository';
2
+ import type { IBindingCoverage } from '../binding-coverage/index.js';
2
3
  import type { ICanonicalDiscoveryResult } from '../canonical-discovery/index.js';
3
4
  import type { ICoreResourceLimits } from '../contracts/index.js';
4
5
  import type { ICoreDiagnostic } from '../diagnostics/index.js';
@@ -12,15 +13,20 @@ import type { IRepositoryInspectionReader } from '../repository-inspection-sessi
12
13
  * @param discovery Canonical discovery state used to suppress dependent path diagnostics.
13
14
  * @param limits The resource limits applied to emitted diagnostics.
14
15
  * @param signal Optional cancellation forwarded to exact repository lookups.
16
+ * @param coverage Operation-owned binding coverage populated only for regular files.
15
17
  * @returns Deeply immutable deterministic repository-reference diagnostics.
16
18
  * @throws
17
- * - INVALID_REPOSITORY_PATH: A repository path is invalid.
19
+ * - INVALID_REPOSITORY_PATH: The repository path is invalid.
20
+ * - ENTRY_NOT_FOUND: The requested repository entry was not found.
21
+ * - ENTRY_NOT_FILE: The requested repository entry is not a file.
18
22
  * - ACCESS_DENIED: Access to the repository source was denied.
19
23
  * - SOURCE_UNAVAILABLE: The repository source is unavailable.
20
- * - SNAPSHOT_CHANGED: The repository snapshot changed during validation.
21
- * - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
22
- * - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
23
- * - ABORTED: Repository inspection or a repository lookup was aborted.
24
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
25
+ * - INVALID_SOURCE_DATA: The repository source returned invalid data.
26
+ * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
27
+ * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
28
+ * - ABORTED: The Core operation was aborted.
29
+ * - ABORTED: The repository operation was aborted.
24
30
  */
25
- export declare const validateRepositoryReferences: (repository: IRepositoryInspectionReader, manifestPath: IRepositoryPath, manifest: IMoldeaManifestV1, discovery: ICanonicalDiscoveryResult, limits: ICoreResourceLimits, signal?: AbortSignal) => Promise<readonly ICoreDiagnostic[]>;
31
+ export declare const validateRepositoryReferences: (repository: IRepositoryInspectionReader, manifestPath: IRepositoryPath, manifest: IMoldeaManifestV1, discovery: ICanonicalDiscoveryResult, limits: ICoreResourceLimits, signal?: AbortSignal, coverage?: IBindingCoverage[]) => Promise<readonly ICoreDiagnostic[]>;
26
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repository-reference-validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAMjE,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAEV,iBAAiB,EAMlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAqX7F;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,GACvC,YAAY,2BAA2B,EACvC,cAAc,eAAe,EAC7B,UAAU,iBAAiB,EAC3B,WAAW,yBAAyB,EACpC,QAAQ,mBAAmB,EAC3B,SAAS,WAAW,KACnB,OAAO,CAAC,SAAS,eAAe,EAAE,CA2BpC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repository-reference-validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,8BAA8B,CAAC;AAI3F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAMjE,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAEV,iBAAiB,EAMlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AA6Y7F;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,4BAA4B,GACvC,YAAY,2BAA2B,EACvC,cAAc,eAAe,EAC7B,UAAU,iBAAiB,EAC3B,WAAW,yBAAyB,EACpC,QAAQ,mBAAmB,EAC3B,SAAS,WAAW,EACpB,WAAU,gBAAgB,EAAO,KAChC,OAAO,CAAC,SAAS,eAAe,EAAE,CAkFpC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { IRepositoryPath } from '@moldea.ai/repository';
2
+ import type { IRepositoryInspectionReader } from '../repository-inspection-session/index.js';
3
+ export interface IRetainedMemory {
4
+ reserve(bytes: number): void;
5
+ tryReserve(bytes: number): boolean;
6
+ release(bytes: number): void;
7
+ readSourceFile(path: IRepositoryPath): Promise<{
8
+ bytes: Uint8Array;
9
+ release: () => void;
10
+ }>;
11
+ }
12
+ /** Registers the sole memory owner for one internal reader. */
13
+ export declare const registerRetainedMemory: (reader: IRepositoryInspectionReader, ledger: IRetainedMemory) => void;
14
+ /** Returns the ledger shared by all phases of a repository inspection. */
15
+ export declare const getRetainedMemory: (reader: IRepositoryInspectionReader) => IRetainedMemory;
16
+ /** Reserves retained coverage in production sessions and leaves standalone file-check readers untracked. */
17
+ export declare const reserveRetainedBytesIfTracked: (reader: IRepositoryInspectionReader, bytes: number) => void;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/retained-memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAG7F,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;CAC5F;AAID,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,GACjC,QAAQ,2BAA2B,EACnC,QAAQ,eAAe,KACtB,IAGF,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,GAAI,QAAQ,2BAA2B,KAAG,eAKvE,CAAC;AAEF,4GAA4G;AAC5G,eAAO,MAAM,6BAA6B,GACxC,QAAQ,2BAA2B,EACnC,OAAO,MAAM,KACZ,IAEF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { IManifestScopeInput, IManifestScopeResult, IManifestScopeCounts, IManifestScopeDeclaration, IManifestScopeMatch, IManifestScopeOwner, IManifestScopeOwnerKind, IManifestScopeRelationshipField, IExactManifestScopeDeclaration, IGlobManifestScopeDeclaration, } from '../scope-matching/index.js';
2
+ export { matchManifestScope } from './scope.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,+BAA+B,EAC/B,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}