@moldea.ai/core 5.0.0 → 6.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 +11 -4
- package/dist/adapter/index.d.ts +16 -4
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter-execution/index.d.ts +12 -9
- package/dist/adapter-execution/index.d.ts.map +1 -1
- package/dist/adapter-result-collection/collection.d.ts +13 -0
- package/dist/adapter-result-collection/collection.d.ts.map +1 -0
- package/dist/adapter-result-collection/index.d.ts +3 -0
- package/dist/adapter-result-collection/index.d.ts.map +1 -0
- package/dist/adapter-result-collection/types.d.ts +31 -0
- package/dist/adapter-result-collection/types.d.ts.map +1 -0
- package/dist/adapter.js +3 -2
- package/dist/adapter.js.map +1 -1
- package/dist/analysis-worker.js +190 -0
- package/dist/analysis-worker.js.map +1 -0
- package/dist/chunks/collection-CvbjjLf2.js +73 -0
- package/dist/chunks/collection-CvbjjLf2.js.map +1 -0
- package/dist/chunks/core-DchheNDz.js +5305 -0
- package/dist/chunks/core-DchheNDz.js.map +1 -0
- package/dist/chunks/errors-BQI1DEqf.js +446 -0
- package/dist/chunks/errors-BQI1DEqf.js.map +1 -0
- package/dist/chunks/{exceptions-HS9ofVy2.js → exceptions-lzD3buFw.js} +26 -15
- package/dist/chunks/exceptions-lzD3buFw.js.map +1 -0
- package/dist/chunks/lifecycle-4EkWgEHm.js +67 -0
- package/dist/chunks/lifecycle-4EkWgEHm.js.map +1 -0
- package/dist/chunks/options-CxCT3dZU.js +617 -0
- package/dist/chunks/options-CxCT3dZU.js.map +1 -0
- package/dist/chunks/repository-rpc-BWi6X1la.js +124 -0
- package/dist/chunks/repository-rpc-BWi6X1la.js.map +1 -0
- package/dist/contracts/index.d.ts +28 -18
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/custom-runtime-inspection/index.d.ts +2 -0
- package/dist/custom-runtime-inspection/index.d.ts.map +1 -0
- package/dist/custom-runtime-inspection/inspection.d.ts +11 -0
- package/dist/custom-runtime-inspection/inspection.d.ts.map +1 -0
- package/dist/exceptions/index.d.ts +23 -4
- package/dist/exceptions/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5775
- 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 +32 -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 +99 -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 +325 -0
- package/dist/node.js.map +1 -0
- package/dist/project-inspection/index.d.ts +22 -1
- package/dist/project-inspection/index.d.ts.map +1 -1
- package/dist/project-metadata/index.d.ts.map +1 -1
- package/dist/project-validation/index.d.ts +34 -10
- package/dist/project-validation/index.d.ts.map +1 -1
- package/package.json +9 -1
- package/dist/chunks/exceptions-HS9ofVy2.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { INodeInspectionAdapter, INodeProjectInspection, INodeProjectInspectionInput, } from '../node-inspection/types.js';
|
|
2
|
+
export { createNodeProjectInspection } from '../node-inspection/client.js';
|
|
3
|
+
export { NODE_INSPECTION_PROFILE } from '../node-inspection/constants.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-worker.d.ts","sourceRoot":"","sources":["../../src/node-inspection/analysis-worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { INodeProjectInspection, INodeProjectInspectionInput } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Prepares content-free inspection inside one supervised subprocess and one analysis worker.
|
|
4
|
+
* The caller owns actual reader work and must dispose the returned handle before publishing success.
|
|
5
|
+
* @returns An async paging handle after the worker reports its actual heap and prepares inspection.
|
|
6
|
+
* @throws
|
|
7
|
+
* - INVALID_ARGUMENT: The Core operation received an invalid argument.
|
|
8
|
+
* - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.
|
|
9
|
+
* - DUPLICATE_ADAPTER_ID: A runtime adapter ID is registered more than once.
|
|
10
|
+
* - RESERVED_ADAPTER_ID: A reserved runtime adapter ID was supplied.
|
|
11
|
+
* - INVALID_ADAPTER_DEFINITION: A runtime adapter definition is invalid.
|
|
12
|
+
* - ABORTED: The Core operation was aborted.
|
|
13
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
14
|
+
* - ADAPTER_EXECUTION_FAILED: A runtime adapter failed during inspection.
|
|
15
|
+
* - INSPECTION_BUSY: Project inspection capacity is busy. Try again shortly.
|
|
16
|
+
* - INSPECTION_TIMEOUT: The isolated project inspection timed out.
|
|
17
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
18
|
+
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
19
|
+
* - ENTRY_NOT_FOUND: The requested repository entry was not found.
|
|
20
|
+
* - ENTRY_NOT_FILE: The requested repository entry is not a file.
|
|
21
|
+
* - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.
|
|
22
|
+
* - INVALID_PAGE_REQUEST: The repository page request is invalid.
|
|
23
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
24
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
25
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
|
|
26
|
+
* - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.
|
|
27
|
+
* - INVALID_SOURCE_DATA: The repository source returned invalid data.
|
|
28
|
+
* - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
|
|
29
|
+
* - ABORTED: The repository operation was aborted.
|
|
30
|
+
*/
|
|
31
|
+
export declare const createNodeProjectInspection: (input: INodeProjectInspectionInput) => Promise<INodeProjectInspection>;
|
|
32
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/node-inspection/client.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAEV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AA4BpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,2BAA2B,GACtC,OAAO,2BAA2B,KACjC,OAAO,CAAC,sBAAsB,CAsUhC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const NODE_INSPECTION_LIFETIME_MS = 120000;
|
|
2
|
+
export declare const NODE_INSPECTION_TERMINATION_GRACE_MS = 1000;
|
|
3
|
+
export declare const NODE_INSPECTION_MAX_REQUESTS = 4;
|
|
4
|
+
export declare const NODE_INSPECTION_FILE_PAGE_BYTES = 65536;
|
|
5
|
+
export declare const NODE_INSPECTION_MESSAGE_BYTES = 1048576;
|
|
6
|
+
export declare const NODE_INSPECTION_STDIO_BYTES = 32768;
|
|
7
|
+
export declare const NODE_INSPECTION_TRANSPORT_BYTES: number;
|
|
8
|
+
export declare const NODE_INSPECTION_OLD_GENERATION_MIB = 512;
|
|
9
|
+
export declare const NODE_INSPECTION_YOUNG_GENERATION_MIB = 24;
|
|
10
|
+
export declare const NODE_INSPECTION_PROFILE: Readonly<{
|
|
11
|
+
lifetimeMs: 120000;
|
|
12
|
+
terminationGraceMs: 1000;
|
|
13
|
+
maxReaderRequests: 4;
|
|
14
|
+
maxFilePageBytes: 65536;
|
|
15
|
+
maxMessageBytes: 1048576;
|
|
16
|
+
maxStdioBytes: 32768;
|
|
17
|
+
transportBytes: number;
|
|
18
|
+
oldGenerationMiB: 512;
|
|
19
|
+
youngGenerationMiB: 24;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/node-inspection/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,2BAA2B,SAAU,CAAC;AACnD,eAAO,MAAM,oCAAoC,OAAQ,CAAC;AAC1D,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,+BAA+B,QAAS,CAAC;AACtD,eAAO,MAAM,6BAA6B,UAAY,CAAC;AACvD,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAGlD,eAAO,MAAM,+BAA+B,QAC8B,CAAC;AAG3E,eAAO,MAAM,kCAAkC,MAAM,CAAC;AACtD,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAGvD,eAAO,MAAM,uBAAuB;;;;;;;;;;EAUlC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { INodeInspectionFailure } from './types.js';
|
|
2
|
+
/** Serializes only documented exception fields, excluding native messages, causes and stacks. */
|
|
3
|
+
export declare const serializeInspectionFailure: (error: unknown) => INodeInspectionFailure;
|
|
4
|
+
/**
|
|
5
|
+
* Reconstructs a documented typed failure after checking its safe transport fields.
|
|
6
|
+
* @returns A package exception without a remote native cause or stack.
|
|
7
|
+
* @throws
|
|
8
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
9
|
+
*/
|
|
10
|
+
export declare const deserializeInspectionFailure: (failure: INodeInspectionFailure) => Error;
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/node-inspection/errors.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,GAAI,OAAO,OAAO,KAAG,sBA+C3D,CAAC;AAyBF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,sBAAsB,KAAG,KA+I9E,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChildProcess } from 'node:child_process';
|
|
2
|
+
import type { INodeInspectionMessage } from './types.js';
|
|
3
|
+
/** Serializes bounded IPC sends and waits for Node's send callback before admitting the next. */
|
|
4
|
+
export declare const createInspectionSender: (send: (frame: string, callback: (error: Error | null) => void) => void) => ((message: INodeInspectionMessage) => Promise<void>);
|
|
5
|
+
/** Keeps only operating-system bootstrap variables; no credentials or Node overrides cross. */
|
|
6
|
+
export declare const createInspectionEnvironment: () => NodeJS.ProcessEnv;
|
|
7
|
+
/**
|
|
8
|
+
* Supervises one owned child without PID polling, shell commands, or process-group killing.
|
|
9
|
+
* @returns Idempotent termination and actual close notification.
|
|
10
|
+
*/
|
|
11
|
+
export declare const superviseInspectionChild: (child: ChildProcess, requestStop: () => void) => {
|
|
12
|
+
closed: Promise<void>;
|
|
13
|
+
terminate: () => void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/node-inspection/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,iGAAiG;AACjG,eAAO,MAAM,sBAAsB,GACjC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,KAAK,IAAI,KACrE,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CA0BrD,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,2BAA2B,QAAO,MAAM,CAAC,UAKrD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,YAAY,EACnB,aAAa,MAAM,IAAI,KACtB;IACD,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;CAsBvB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CoreOperationException } from '../exceptions/index.js';
|
|
2
|
+
import type { INodeInspectionMessage } from './types.js';
|
|
3
|
+
/** Creates the safe failure for an untrusted or inconsistent private protocol record. */
|
|
4
|
+
export declare const createInspectionProcessFailure: (cause?: unknown) => CoreOperationException;
|
|
5
|
+
/**
|
|
6
|
+
* Admits a complete bounded record before serialization; no record is truncated.
|
|
7
|
+
* @returns One private JSON frame.
|
|
8
|
+
* @throws
|
|
9
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
10
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
11
|
+
*/
|
|
12
|
+
export declare const encodeInspectionMessage: (message: INodeInspectionMessage) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Checks frame size before parsing and validates the closed message contract.
|
|
15
|
+
* @returns A validated private message.
|
|
16
|
+
* @throws
|
|
17
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
18
|
+
*/
|
|
19
|
+
export declare const decodeInspectionMessage: (frame: unknown) => INodeInspectionMessage;
|
|
20
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/node-inspection/protocol.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,yFAAyF;AACzF,eAAO,MAAM,8BAA8B,GAAI,QAAQ,OAAO,KAAG,sBAK7D,CAAC;AAsSL;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,sBAAsB,KAAG,MAazE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,OAAO,KAAG,sBAWxD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type IRepositoryEntry, type IRepositoryEntryPage, type IRepositoryFilePage, type IRepositoryReader } from '@moldea.ai/repository';
|
|
2
|
+
import type { INodeReaderRequest } from './types.js';
|
|
3
|
+
/** Converts one validated metadata-only repository entry. */
|
|
4
|
+
export declare const parseRpcEntry: (input: unknown) => IRepositoryEntry | null;
|
|
5
|
+
/** Converts a bounded listing page while retaining snapshot and continuation contracts. */
|
|
6
|
+
export declare const parseRpcEntryPage: (input: unknown) => IRepositoryEntryPage;
|
|
7
|
+
/** Decodes only an admitted 64 KiB binary page, never a complete repository file. */
|
|
8
|
+
export declare const parseRpcFilePage: (input: unknown) => IRepositoryFilePage;
|
|
9
|
+
/**
|
|
10
|
+
* Calls the real reader with inspection cancellation and returns a bounded transport value.
|
|
11
|
+
* Reader failures propagate unchanged to the parent inspection owner.
|
|
12
|
+
* @returns A metadata value or encoded byte page after actual reader settlement.
|
|
13
|
+
* @throws
|
|
14
|
+
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
15
|
+
* - ENTRY_NOT_FOUND: The requested repository entry was not found.
|
|
16
|
+
* - ENTRY_NOT_FILE: The requested repository entry is not a file.
|
|
17
|
+
* - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.
|
|
18
|
+
* - INVALID_PAGE_REQUEST: The repository page request is invalid.
|
|
19
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
20
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
21
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
|
|
22
|
+
* - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.
|
|
23
|
+
* - INVALID_SOURCE_DATA: The repository source returned invalid data.
|
|
24
|
+
* - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
|
|
25
|
+
* - ABORTED: The repository operation was aborted.
|
|
26
|
+
*/
|
|
27
|
+
export declare const executeRepositoryRpc: (reader: IRepositoryReader, request: INodeReaderRequest, signal: AbortSignal) => Promise<unknown>;
|
|
28
|
+
//# sourceMappingURL=repository-rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-rpc.d.ts","sourceRoot":"","sources":["../../src/node-inspection/repository-rpc.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA+BrD,6DAA6D;AAC7D,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,gBAAgB,GAAG,IAiBjE,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,oBAsBlD,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,mBA2BjD,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,iBAAiB,EACzB,SAAS,kBAAkB,EAC3B,QAAQ,WAAW,KAClB,OAAO,CAAC,OAAO,CA2BjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/node-inspection/runner.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { IRepositoryReader, IRepositorySnapshot } from '@moldea.ai/repository';
|
|
2
|
+
import type { IRepositoryFormatVersion } from '../format/index.js';
|
|
3
|
+
import type { ICoreResourceLimits, IProjectInspection, IProjectInspectionPageInput, IProjectInspectionPageResult } from '../contracts/index.js';
|
|
4
|
+
export interface INodeInspectionAdapter {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly supportedRepositoryFormatVersions: readonly IRepositoryFormatVersion[];
|
|
7
|
+
}
|
|
8
|
+
export interface INodeProjectInspectionInput {
|
|
9
|
+
repository: IRepositoryReader;
|
|
10
|
+
adapterRegistryUrl: URL;
|
|
11
|
+
limits?: Partial<ICoreResourceLimits>;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
deadline?: number;
|
|
14
|
+
}
|
|
15
|
+
export type INodeInspectionMetadata = Omit<IProjectInspection, 'readPage'> & {
|
|
16
|
+
readonly adapters: readonly INodeInspectionAdapter[];
|
|
17
|
+
readonly maxAnalysisHeapBytes: number;
|
|
18
|
+
};
|
|
19
|
+
export interface INodeProjectInspection extends INodeInspectionMetadata {
|
|
20
|
+
/**
|
|
21
|
+
* Reads one content-free page while this inspection owns process admission.
|
|
22
|
+
* @returns The bounded page from the existing prepared inspection.
|
|
23
|
+
* @throws
|
|
24
|
+
* - INVALID_ARGUMENT: The Core operation received an invalid argument.
|
|
25
|
+
* - ABORTED: The Core operation was aborted.
|
|
26
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
27
|
+
* - INSPECTION_TIMEOUT: The isolated project inspection timed out.
|
|
28
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
29
|
+
*/
|
|
30
|
+
readPage(input: IProjectInspectionPageInput): Promise<IProjectInspectionPageResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Closes the child and settles actual reader work before releasing admission.
|
|
33
|
+
* @returns A promise resolving after idempotent ownership cleanup.
|
|
34
|
+
* @throws
|
|
35
|
+
* - INVALID_ARGUMENT: The Core operation received an invalid argument.
|
|
36
|
+
* - ABORTED: The Core operation was aborted.
|
|
37
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
38
|
+
* - INSPECTION_TIMEOUT: The isolated project inspection timed out.
|
|
39
|
+
* - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.
|
|
40
|
+
*/
|
|
41
|
+
dispose(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export type INodeReaderRequest = {
|
|
44
|
+
method: 'getEntry';
|
|
45
|
+
path: string;
|
|
46
|
+
} | {
|
|
47
|
+
method: 'listEntriesPage';
|
|
48
|
+
maxEntries: number;
|
|
49
|
+
cursor?: string;
|
|
50
|
+
prefix?: string;
|
|
51
|
+
} | {
|
|
52
|
+
method: 'readFilePage';
|
|
53
|
+
path: string;
|
|
54
|
+
maxBytes: number;
|
|
55
|
+
offset: number;
|
|
56
|
+
};
|
|
57
|
+
export interface INodeInspectionFailure {
|
|
58
|
+
family: 'configuration' | 'operation' | 'repository' | 'path';
|
|
59
|
+
options: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
export type INodeInspectionMessage = {
|
|
62
|
+
attemptId: string;
|
|
63
|
+
} & ({
|
|
64
|
+
kind: 'start';
|
|
65
|
+
registryUrl: string;
|
|
66
|
+
snapshot: IRepositorySnapshot;
|
|
67
|
+
limits: ICoreResourceLimits;
|
|
68
|
+
deadline: number;
|
|
69
|
+
} | {
|
|
70
|
+
kind: 'ready';
|
|
71
|
+
maxAnalysisHeapBytes: number;
|
|
72
|
+
} | {
|
|
73
|
+
kind: 'run';
|
|
74
|
+
} | {
|
|
75
|
+
kind: 'prepared';
|
|
76
|
+
inspection: INodeInspectionMetadata;
|
|
77
|
+
} | {
|
|
78
|
+
kind: 'read-page';
|
|
79
|
+
requestId: number;
|
|
80
|
+
input: IProjectInspectionPageInput;
|
|
81
|
+
} | {
|
|
82
|
+
kind: 'page';
|
|
83
|
+
requestId: number;
|
|
84
|
+
result: IProjectInspectionPageResult;
|
|
85
|
+
} | {
|
|
86
|
+
kind: 'reader-request';
|
|
87
|
+
requestId: number;
|
|
88
|
+
request: INodeReaderRequest;
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'reader-response';
|
|
91
|
+
requestId: number;
|
|
92
|
+
result: unknown;
|
|
93
|
+
} | {
|
|
94
|
+
kind: 'failure';
|
|
95
|
+
failure: INodeInspectionFailure;
|
|
96
|
+
} | {
|
|
97
|
+
kind: 'dispose';
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/node-inspection/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB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
import { a as encodeInspectionMessage, i as decodeInspectionMessage, n as serializeInspectionFailure, r as createInspectionProcessFailure, s as NODE_INSPECTION_LIFETIME_MS } from "./chunks/errors-BQI1DEqf.js";
|
|
3
|
+
import { n as createInspectionSender } from "./chunks/lifecycle-4EkWgEHm.js";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { Worker } from "node:worker_threads";
|
|
6
|
+
//#region src/node-inspection/runner.ts
|
|
7
|
+
var worker;
|
|
8
|
+
var attemptId;
|
|
9
|
+
var heapMaximum;
|
|
10
|
+
var deadlineTimer;
|
|
11
|
+
var isClosing = false;
|
|
12
|
+
var hasRun = false;
|
|
13
|
+
var readerRequests = /* @__PURE__ */ new Set();
|
|
14
|
+
var send = createInspectionSender((frame, callback) => {
|
|
15
|
+
if (process.send === void 0 || !process.connected) throw createInspectionProcessFailure();
|
|
16
|
+
process.send(frame, callback);
|
|
17
|
+
});
|
|
18
|
+
/** Closes the worker before disconnecting the supervisor's private IPC channel. */
|
|
19
|
+
var close = async (failure) => {
|
|
20
|
+
if (isClosing) return;
|
|
21
|
+
isClosing = true;
|
|
22
|
+
clearTimeout(deadlineTimer);
|
|
23
|
+
const termination = worker?.terminate();
|
|
24
|
+
if (failure !== void 0 && attemptId !== void 0 && process.connected) try {
|
|
25
|
+
await send({
|
|
26
|
+
attemptId,
|
|
27
|
+
kind: "failure",
|
|
28
|
+
failure: serializeInspectionFailure(failure)
|
|
29
|
+
});
|
|
30
|
+
} catch {}
|
|
31
|
+
await termination;
|
|
32
|
+
readerRequests.clear();
|
|
33
|
+
process.removeListener("message", handleParentMessage);
|
|
34
|
+
process.removeListener("disconnect", handleDisconnect);
|
|
35
|
+
if (process.connected) process.disconnect();
|
|
36
|
+
};
|
|
37
|
+
var handleDisconnect = () => {
|
|
38
|
+
close();
|
|
39
|
+
};
|
|
40
|
+
var handleWorkerMessage = (frame) => {
|
|
41
|
+
try {
|
|
42
|
+
const message = decodeInspectionMessage(frame);
|
|
43
|
+
if (isClosing) return;
|
|
44
|
+
if (message.attemptId !== attemptId) throw createInspectionProcessFailure();
|
|
45
|
+
if (message.kind === "ready") {
|
|
46
|
+
if (heapMaximum !== void 0 || hasRun) throw createInspectionProcessFailure();
|
|
47
|
+
heapMaximum = message.maxAnalysisHeapBytes;
|
|
48
|
+
} else if (message.kind === "reader-request") {
|
|
49
|
+
if (!hasRun || readerRequests.has(message.requestId) || readerRequests.size >= 4) throw createInspectionProcessFailure();
|
|
50
|
+
readerRequests.add(message.requestId);
|
|
51
|
+
} else if (message.kind === "failure" && message.failure.options["limit"] === "maxAnalysisHeapBytes") throw createInspectionProcessFailure();
|
|
52
|
+
else if (![
|
|
53
|
+
"prepared",
|
|
54
|
+
"page",
|
|
55
|
+
"failure"
|
|
56
|
+
].includes(message.kind)) throw createInspectionProcessFailure();
|
|
57
|
+
send(message).catch((cause) => close(cause));
|
|
58
|
+
} catch (cause) {
|
|
59
|
+
close(cause);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/** Starts independent supervision before creating the sole analysis worker. */
|
|
63
|
+
var start = (message) => {
|
|
64
|
+
if (attemptId !== void 0 || isClosing) throw createInspectionProcessFailure();
|
|
65
|
+
attemptId = message.attemptId;
|
|
66
|
+
clearTimeout(deadlineTimer);
|
|
67
|
+
const remaining = Math.min(NODE_INSPECTION_LIFETIME_MS, message.deadline - Date.now());
|
|
68
|
+
if (remaining <= 0) {
|
|
69
|
+
close(new CoreOperationException({
|
|
70
|
+
code: "INSPECTION_TIMEOUT",
|
|
71
|
+
operation: "create-project-inspection"
|
|
72
|
+
}));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
deadlineTimer = setTimeout(() => {
|
|
76
|
+
close(new CoreOperationException({
|
|
77
|
+
code: "INSPECTION_TIMEOUT",
|
|
78
|
+
operation: "create-project-inspection"
|
|
79
|
+
}));
|
|
80
|
+
}, remaining);
|
|
81
|
+
worker = new Worker(new URL(import.meta.resolve("#moldea-core-analysis-worker")), {
|
|
82
|
+
execArgv: [],
|
|
83
|
+
env: process.env,
|
|
84
|
+
stdout: true,
|
|
85
|
+
stderr: true,
|
|
86
|
+
resourceLimits: {
|
|
87
|
+
maxOldGenerationSizeMb: 512,
|
|
88
|
+
maxYoungGenerationSizeMb: 24
|
|
89
|
+
},
|
|
90
|
+
workerData: encodeInspectionMessage(message)
|
|
91
|
+
});
|
|
92
|
+
let stdioBytes = 0;
|
|
93
|
+
const consumeStdio = (chunk) => {
|
|
94
|
+
stdioBytes += chunk.byteLength;
|
|
95
|
+
if (stdioBytes > 32768) close(createInspectionProcessFailure());
|
|
96
|
+
};
|
|
97
|
+
worker.stdout.on("data", consumeStdio);
|
|
98
|
+
worker.stderr.on("data", consumeStdio);
|
|
99
|
+
worker.on("message", handleWorkerMessage);
|
|
100
|
+
worker.on("messageerror", (cause) => {
|
|
101
|
+
close(createInspectionProcessFailure(cause));
|
|
102
|
+
});
|
|
103
|
+
worker.once("error", (error) => {
|
|
104
|
+
close(error.code === "ERR_WORKER_OUT_OF_MEMORY" && heapMaximum !== void 0 ? new CoreOperationException({
|
|
105
|
+
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
106
|
+
operation: "create-project-inspection",
|
|
107
|
+
limit: "maxAnalysisHeapBytes",
|
|
108
|
+
limitMaximum: heapMaximum,
|
|
109
|
+
observedUsage: null,
|
|
110
|
+
nextAction: "review-inspection-capacity"
|
|
111
|
+
}) : createInspectionProcessFailure(error));
|
|
112
|
+
});
|
|
113
|
+
worker.once("exit", () => {
|
|
114
|
+
if (!isClosing) close(createInspectionProcessFailure());
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
var handleParentMessage = (frame) => {
|
|
118
|
+
try {
|
|
119
|
+
const message = decodeInspectionMessage(frame);
|
|
120
|
+
if (isClosing) return;
|
|
121
|
+
if (message.kind === "start") {
|
|
122
|
+
start(message);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (message.attemptId !== attemptId || worker === void 0) throw createInspectionProcessFailure();
|
|
126
|
+
if (message.kind === "dispose") {
|
|
127
|
+
close();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (message.kind === "run") {
|
|
131
|
+
if (heapMaximum === void 0 || hasRun) throw createInspectionProcessFailure();
|
|
132
|
+
hasRun = true;
|
|
133
|
+
} else if (message.kind === "reader-response") {
|
|
134
|
+
if (!readerRequests.delete(message.requestId)) throw createInspectionProcessFailure();
|
|
135
|
+
} else if (message.kind !== "read-page" || !hasRun) throw createInspectionProcessFailure();
|
|
136
|
+
worker.postMessage(encodeInspectionMessage(message));
|
|
137
|
+
} catch (cause) {
|
|
138
|
+
close(cause);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
process.on("disconnect", handleDisconnect);
|
|
142
|
+
process.on("message", handleParentMessage);
|
|
143
|
+
deadlineTimer = setTimeout(() => {
|
|
144
|
+
close();
|
|
145
|
+
}, NODE_INSPECTION_LIFETIME_MS);
|
|
146
|
+
if (process.send === void 0 || !process.connected) close();
|
|
147
|
+
//#endregion
|
|
148
|
+
|
|
149
|
+
//# sourceMappingURL=node-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runner.js","names":[],"sources":["../src/node-inspection/runner.ts"],"sourcesContent":["import process from 'node:process';\nimport { Worker } from 'node:worker_threads';\n\nimport { CoreOperationException } from '../exceptions/index.js';\n\nimport {\n NODE_INSPECTION_LIFETIME_MS,\n NODE_INSPECTION_MAX_REQUESTS,\n NODE_INSPECTION_OLD_GENERATION_MIB,\n NODE_INSPECTION_STDIO_BYTES,\n NODE_INSPECTION_YOUNG_GENERATION_MIB,\n} from './constants.js';\nimport { serializeInspectionFailure } from './errors.js';\nimport { createInspectionSender } from './lifecycle.js';\nimport {\n createInspectionProcessFailure,\n decodeInspectionMessage,\n encodeInspectionMessage,\n} from './protocol.js';\nimport type { INodeInspectionMessage } from './types.js';\n\nlet worker: Worker | undefined;\nlet attemptId: string | undefined;\nlet heapMaximum: number | undefined;\nlet deadlineTimer: NodeJS.Timeout | undefined;\nlet isClosing = false;\nlet hasRun = false;\nconst readerRequests = new Set<number>();\nconst send = createInspectionSender((frame, callback) => {\n if (process.send === undefined || !process.connected) throw createInspectionProcessFailure();\n process.send(frame, callback);\n});\n\n/** Closes the worker before disconnecting the supervisor's private IPC channel. */\nconst close = async (failure?: unknown): Promise<void> => {\n if (isClosing) return;\n isClosing = true;\n clearTimeout(deadlineTimer);\n const termination = worker?.terminate();\n if (failure !== undefined && attemptId !== undefined && process.connected) {\n try {\n await send({ attemptId, kind: 'failure', failure: serializeInspectionFailure(failure) });\n } catch {\n /* parent disconnect remains authoritative when a failure cannot be delivered */\n }\n }\n await termination;\n readerRequests.clear();\n process.removeListener('message', handleParentMessage);\n process.removeListener('disconnect', handleDisconnect);\n if (process.connected) process.disconnect();\n};\n\nconst handleDisconnect = (): void => {\n void close();\n};\nconst handleWorkerMessage = (frame: unknown): void => {\n try {\n const message = decodeInspectionMessage(frame);\n if (isClosing) return;\n if (message.attemptId !== attemptId) throw createInspectionProcessFailure();\n if (message.kind === 'ready') {\n if (heapMaximum !== undefined || hasRun) throw createInspectionProcessFailure();\n heapMaximum = message.maxAnalysisHeapBytes;\n } else if (message.kind === 'reader-request') {\n if (\n !hasRun ||\n readerRequests.has(message.requestId) ||\n readerRequests.size >= NODE_INSPECTION_MAX_REQUESTS\n )\n throw createInspectionProcessFailure();\n readerRequests.add(message.requestId);\n } else if (\n message.kind === 'failure' &&\n message.failure.options['limit'] === 'maxAnalysisHeapBytes'\n )\n throw createInspectionProcessFailure();\n else if (!['prepared', 'page', 'failure'].includes(message.kind))\n throw createInspectionProcessFailure();\n void send(message).catch((cause: unknown) => close(cause));\n } catch (cause) {\n void close(cause);\n }\n};\n\n/** Starts independent supervision before creating the sole analysis worker. */\nconst start = (message: Extract<INodeInspectionMessage, { kind: 'start' }>): void => {\n if (attemptId !== undefined || isClosing) throw createInspectionProcessFailure();\n attemptId = message.attemptId;\n clearTimeout(deadlineTimer);\n const remaining = Math.min(NODE_INSPECTION_LIFETIME_MS, message.deadline - Date.now());\n if (remaining <= 0) {\n void close(\n new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n }),\n );\n return;\n }\n deadlineTimer = setTimeout(() => {\n void close(\n new CoreOperationException({\n code: 'INSPECTION_TIMEOUT',\n operation: 'create-project-inspection',\n }),\n );\n }, remaining);\n worker = new Worker(new URL(import.meta.resolve('#moldea-core-analysis-worker')), {\n execArgv: [],\n env: process.env,\n stdout: true,\n stderr: true,\n resourceLimits: {\n maxOldGenerationSizeMb: NODE_INSPECTION_OLD_GENERATION_MIB,\n maxYoungGenerationSizeMb: NODE_INSPECTION_YOUNG_GENERATION_MIB,\n },\n workerData: encodeInspectionMessage(message),\n });\n let stdioBytes = 0;\n const consumeStdio = (chunk: Buffer): void => {\n stdioBytes += chunk.byteLength;\n if (stdioBytes > NODE_INSPECTION_STDIO_BYTES) void close(createInspectionProcessFailure());\n };\n worker.stdout.on('data', consumeStdio);\n worker.stderr.on('data', consumeStdio);\n worker.on('message', handleWorkerMessage);\n worker.on('messageerror', (cause: unknown) => {\n void close(createInspectionProcessFailure(cause));\n });\n worker.once('error', (error: Error & { code?: string }) => {\n const failure =\n error.code === 'ERR_WORKER_OUT_OF_MEMORY' && heapMaximum !== undefined\n ? new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n operation: 'create-project-inspection',\n limit: 'maxAnalysisHeapBytes',\n limitMaximum: heapMaximum,\n observedUsage: null,\n nextAction: 'review-inspection-capacity',\n })\n : createInspectionProcessFailure(error);\n void close(failure);\n });\n worker.once('exit', () => {\n if (!isClosing) void close(createInspectionProcessFailure());\n });\n};\n\nconst handleParentMessage = (frame: unknown): void => {\n try {\n const message = decodeInspectionMessage(frame);\n if (isClosing) return;\n if (message.kind === 'start') {\n start(message);\n return;\n }\n if (message.attemptId !== attemptId || worker === undefined)\n throw createInspectionProcessFailure();\n if (message.kind === 'dispose') {\n void close();\n return;\n }\n if (message.kind === 'run') {\n if (heapMaximum === undefined || hasRun) throw createInspectionProcessFailure();\n hasRun = true;\n } else if (message.kind === 'reader-response') {\n if (!readerRequests.delete(message.requestId)) throw createInspectionProcessFailure();\n } else if (message.kind !== 'read-page' || !hasRun) throw createInspectionProcessFailure();\n worker.postMessage(encodeInspectionMessage(message));\n } catch (cause) {\n void close(cause);\n }\n};\n\nprocess.on('disconnect', handleDisconnect);\nprocess.on('message', handleParentMessage);\ndeadlineTimer = setTimeout(() => {\n void close();\n}, NODE_INSPECTION_LIFETIME_MS);\nif (process.send === undefined || !process.connected) void close();\n"],"mappings":";;;;;;AAqBA,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI,YAAY;AAChB,IAAI,SAAS;AACb,IAAM,iCAAiB,IAAI,IAAY;AACvC,IAAM,OAAO,wBAAwB,OAAO,aAAa;CACvD,IAAI,QAAQ,SAAS,KAAA,KAAa,CAAC,QAAQ,WAAW,MAAM,+BAA+B;CAC3F,QAAQ,KAAK,OAAO,QAAQ;AAC9B,CAAC;;AAGD,IAAM,QAAQ,OAAO,YAAqC;CACxD,IAAI,WAAW;CACf,YAAY;CACZ,aAAa,aAAa;CAC1B,MAAM,cAAc,QAAQ,UAAU;CACtC,IAAI,YAAY,KAAA,KAAa,cAAc,KAAA,KAAa,QAAQ,WAC9D,IAAI;EACF,MAAM,KAAK;GAAE;GAAW,MAAM;GAAW,SAAS,2BAA2B,OAAO;EAAE,CAAC;CACzF,QAAQ,CAER;CAEF,MAAM;CACN,eAAe,MAAM;CACrB,QAAQ,eAAe,WAAW,mBAAmB;CACrD,QAAQ,eAAe,cAAc,gBAAgB;CACrD,IAAI,QAAQ,WAAW,QAAQ,WAAW;AAC5C;AAEA,IAAM,yBAA+B;CACnC,MAAW;AACb;AACA,IAAM,uBAAuB,UAAyB;CACpD,IAAI;EACF,MAAM,UAAU,wBAAwB,KAAK;EAC7C,IAAI,WAAW;EACf,IAAI,QAA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