@moldea.ai/core 6.0.0 → 7.0.1
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 +13 -19
- package/dist/analysis-worker.js +14 -24
- package/dist/analysis-worker.js.map +1 -1
- package/dist/binding-coverage/index.d.ts +26 -0
- package/dist/binding-coverage/index.d.ts.map +1 -0
- package/dist/chunks/{core-DchheNDz.js → core-Cdeiu6xG.js} +743 -2684
- package/dist/chunks/core-Cdeiu6xG.js.map +1 -0
- package/dist/chunks/{errors-BQI1DEqf.js → errors-BE4DS3Ak.js} +27 -38
- package/dist/chunks/errors-BE4DS3Ak.js.map +1 -0
- package/dist/chunks/{exceptions-lzD3buFw.js → exceptions-IXsorE8t.js} +4 -16
- package/dist/chunks/exceptions-IXsorE8t.js.map +1 -0
- package/dist/chunks/{lifecycle-4EkWgEHm.js → lifecycle-D_RvxhDC.js} +2 -2
- package/dist/chunks/{lifecycle-4EkWgEHm.js.map → lifecycle-D_RvxhDC.js.map} +1 -1
- package/dist/chunks/{options-CxCT3dZU.js → options-5x9gu2Qb.js} +139 -152
- package/dist/chunks/options-5x9gu2Qb.js.map +1 -0
- package/dist/chunks/{repository-rpc-BWi6X1la.js → repository-rpc-B_y0Kspf.js} +2 -2
- package/dist/chunks/{repository-rpc-BWi6X1la.js.map → repository-rpc-B_y0Kspf.js.map} +1 -1
- 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 +15 -15
- 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 +4 -8
- 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 +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- 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 +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node-inspection/client.d.ts +0 -4
- package/dist/node-inspection/client.d.ts.map +1 -1
- package/dist/node-inspection/errors.d.ts.map +1 -1
- package/dist/node-inspection/protocol.d.ts.map +1 -1
- package/dist/node-inspection/types.d.ts +4 -8
- package/dist/node-inspection/types.d.ts.map +1 -1
- package/dist/node-runner.js +4 -4
- package/dist/node-runner.js.map +1 -1
- package/dist/node.js +23 -13
- package/dist/node.js.map +1 -1
- package/dist/options/index.d.ts +2 -14
- package/dist/options/index.d.ts.map +1 -1
- package/dist/project-inspection/index.d.ts +1 -2
- package/dist/project-inspection/index.d.ts.map +1 -1
- package/dist/project-validation/index.d.ts +2 -4
- 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 +6 -6
- package/dist/adapter/index.d.ts +0 -143
- 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 -34
- 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-result-collection/collection.d.ts +0 -13
- package/dist/adapter-result-collection/collection.d.ts.map +0 -1
- package/dist/adapter-result-collection/index.d.ts +0 -3
- package/dist/adapter-result-collection/index.d.ts.map +0 -1
- package/dist/adapter-result-collection/types.d.ts +0 -31
- package/dist/adapter-result-collection/types.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 -116
- package/dist/adapter.js.map +0 -1
- package/dist/chunks/collection-CvbjjLf2.js +0 -73
- package/dist/chunks/collection-CvbjjLf2.js.map +0 -1
- package/dist/chunks/core-DchheNDz.js.map +0 -1
- package/dist/chunks/errors-BQI1DEqf.js.map +0 -1
- package/dist/chunks/exceptions-lzD3buFw.js.map +0 -1
- package/dist/chunks/options-CxCT3dZU.js.map +0 -1
- package/dist/custom-runtime-inspection/index.d.ts +0 -2
- package/dist/custom-runtime-inspection/index.d.ts.map +0 -1
- package/dist/custom-runtime-inspection/inspection.d.ts +0 -11
- package/dist/custom-runtime-inspection/inspection.d.ts.map +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type IRepositoryEntry, type IRepositoryOperationOptions, type IRepositoryPath } from '@moldea.ai/repository';
|
|
2
|
-
import type { IRuntimeAdapterRepository } from '../adapter/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Reads one complete adapter source file through bounded repository pages.
|
|
5
|
-
* @param repository The Core-created repository for the current adapter invocation.
|
|
6
|
-
* @param path The exact source file path.
|
|
7
|
-
* @param options Optional cancellation controls.
|
|
8
|
-
* @returns A promise resolving to one detached complete source buffer.
|
|
9
|
-
* @throws
|
|
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
|
-
* - INVALID_PAGE_REQUEST: The repository page request is invalid.
|
|
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
|
-
* - INVALID_SOURCE_DATA: The repository source returned invalid data.
|
|
18
|
-
* - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
|
|
19
|
-
* - ABORTED: The repository operation was aborted.
|
|
20
|
-
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
21
|
-
*/
|
|
22
|
-
export declare const readRuntimeAdapterFile: (repository: IRuntimeAdapterRepository, path: IRepositoryPath, options?: IRepositoryOperationOptions) => Promise<Uint8Array>;
|
|
23
|
-
/** Iterates one adapter-scoped descendant listing through bounded pages. */
|
|
24
|
-
export declare const iterateRuntimeAdapterEntries: (repository: IRuntimeAdapterRepository, options?: IRepositoryOperationOptions & {
|
|
25
|
-
readonly prefix?: IRepositoryPath;
|
|
26
|
-
}) => AsyncIterable<IRepositoryEntry>;
|
|
27
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-repository/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AA+BrE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,yBAAyB,EACrC,MAAM,eAAe,EACrB,UAAU,2BAA2B,KACpC,OAAO,CAAC,UAAU,CAyEpB,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B,GACvC,YAAY,yBAAyB,EACrC,UAAU,2BAA2B,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,KAC5E,aAAa,CAAC,gBAAgB,CA6DhC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IRuntimeAdapterContext } from '../adapter/index.js';
|
|
2
|
-
import type { IRuntimeAdapterOutputCounts } from '../adapter-validation/index.js';
|
|
3
|
-
import type { ICoreResourceLimits } from '../contracts/index.js';
|
|
4
|
-
import type { IRuntimeAdapterOutputBudget, IRuntimeAdapterResultCollector } from './types.js';
|
|
5
|
-
/** Creates the immutable admission view from Core's authoritative raw counters. */
|
|
6
|
-
export declare const createRuntimeAdapterOutputBudget: (counts: IRuntimeAdapterOutputCounts, limits: ICoreResourceLimits) => IRuntimeAdapterOutputBudget;
|
|
7
|
-
/**
|
|
8
|
-
* Collects one adapter result without constructing records beyond its remaining allowance.
|
|
9
|
-
* @param context The trusted invocation agent, raw output budget, and operation signal.
|
|
10
|
-
* @returns Independent collectors and one final immutable adapter result.
|
|
11
|
-
*/
|
|
12
|
-
export declare const createRuntimeAdapterResultCollector: (context: Pick<IRuntimeAdapterContext, "agent" | "outputBudget" | "signal">) => IRuntimeAdapterResultCollector;
|
|
13
|
-
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/adapter-result-collection/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,KAAK,EACV,2BAA2B,EAE3B,8BAA8B,EAC/B,MAAM,YAAY,CAAC;AAEpB,mFAAmF;AACnF,eAAO,MAAM,gCAAgC,GAC3C,QAAQ,2BAA2B,EACnC,QAAQ,mBAAmB,KAC1B,2BAUC,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,GAC9C,SAAS,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,cAAc,GAAG,QAAQ,CAAC,KACzE,8BAkDF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-result-collection/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,2BAA2B,EAC3B,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,gCAAgC,EAChC,mCAAmC,GACpC,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { IAdapterDiagnostic } from '../diagnostics/index.js';
|
|
2
|
-
import type { IRuntimeAdapterEvidence, IRuntimeAdapterResult } from '../adapter/index.js';
|
|
3
|
-
export interface IRuntimeAdapterOutputBudget {
|
|
4
|
-
readonly diagnostics: {
|
|
5
|
-
readonly maximum: number;
|
|
6
|
-
readonly remaining: number;
|
|
7
|
-
};
|
|
8
|
-
readonly evidence: {
|
|
9
|
-
readonly maximum: number;
|
|
10
|
-
readonly remaining: number;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface IRuntimeAdapterRecordCollector<TRecord> {
|
|
14
|
-
/**
|
|
15
|
-
* Admits one record before executing its factory.
|
|
16
|
-
* @param factory Constructs the record only after admission succeeds.
|
|
17
|
-
* @throws
|
|
18
|
-
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
19
|
-
* - ABORTED: The Core operation was aborted.
|
|
20
|
-
*/
|
|
21
|
-
add(factory: () => TRecord): void;
|
|
22
|
-
/** Checks admitted records without exposing or copying the result collection. */
|
|
23
|
-
some(predicate: (record: TRecord) => boolean): boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface IRuntimeAdapterResultCollector {
|
|
26
|
-
readonly diagnostics: IRuntimeAdapterRecordCollector<IAdapterDiagnostic>;
|
|
27
|
-
readonly evidence: IRuntimeAdapterRecordCollector<IRuntimeAdapterEvidence>;
|
|
28
|
-
/** Returns the complete immutable result for Core's authoritative validation. */
|
|
29
|
-
finalize(): IRuntimeAdapterResult;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapter-result-collection/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG1F,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,WAAW,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/E,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7E;AAGD,MAAM,WAAW,8BAA8B,CAAC,OAAO;IACrD;;;;;;OAMG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC;IAClC,iFAAiF;IACjF,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC;CACxD;AAGD,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,WAAW,EAAE,8BAA8B,CAAC,kBAAkB,CAAC,CAAC;IACzE,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,CAAC,uBAAuB,CAAC,CAAC;IAE3E,iFAAiF;IACjF,QAAQ,IAAI,qBAAqB,CAAC;CACnC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { IRuntimeAdapterRepository } from '../adapter/index.js';
|
|
2
|
-
type IRetainedByteReservation = (byteLength: number) => void;
|
|
3
|
-
/** Registers the retained-memory reservation owned by one inspection session. */
|
|
4
|
-
export declare const registerRuntimeAdapterRetainedByteReservation: (repository: IRuntimeAdapterRepository, reserve: IRetainedByteReservation) => void;
|
|
5
|
-
/** Reserves a complete adapter-owned buffer when Core owns the repository session. */
|
|
6
|
-
export declare const reserveRuntimeAdapterRetainedBytesIfTracked: (repository: IRuntimeAdapterRepository, byteLength: number) => void;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-retained-memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,KAAK,wBAAwB,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;AAK7D,iFAAiF;AACjF,eAAO,MAAM,6CAA6C,GACxD,YAAY,yBAAyB,EACrC,SAAS,wBAAwB,KAChC,IAMF,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,2CAA2C,GACtD,YAAY,yBAAyB,EACrC,YAAY,MAAM,KACjB,IAMF,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { IRuntimeAdapterEvidence, IRuntimeAdapterRepository } from '../adapter/index.js';
|
|
2
|
-
import type { ICoreResourceLimits, IIndexedAgent, IMoldeaProjectIndex } from '../contracts/index.js';
|
|
3
|
-
import type { IAdapterDiagnostic } from '../diagnostics/index.js';
|
|
4
|
-
export interface IValidatedRuntimeAdapterResult {
|
|
5
|
-
readonly evidence: readonly IRuntimeAdapterEvidence[];
|
|
6
|
-
readonly diagnostics: readonly IAdapterDiagnostic[];
|
|
7
|
-
}
|
|
8
|
-
export interface IRuntimeAdapterOutputCounts {
|
|
9
|
-
diagnostics: number;
|
|
10
|
-
evidence: number;
|
|
11
|
-
}
|
|
12
|
-
interface IAdapterValidationContext {
|
|
13
|
-
readonly adapterId: string;
|
|
14
|
-
readonly agents: readonly IIndexedAgent[];
|
|
15
|
-
readonly project: IMoldeaProjectIndex;
|
|
16
|
-
readonly repository: IRuntimeAdapterRepository;
|
|
17
|
-
readonly limits: ICoreResourceLimits;
|
|
18
|
-
readonly signal?: AbortSignal;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Deduplicates and sorts normalized evidence from every completed adapter.
|
|
22
|
-
* @param candidates The normalized evidence items to combine.
|
|
23
|
-
* @returns A frozen deterministic evidence collection.
|
|
24
|
-
*/
|
|
25
|
-
export declare const normalizeRuntimeAdapterEvidence: (candidates: readonly IRuntimeAdapterEvidence[]) => readonly IRuntimeAdapterEvidence[];
|
|
26
|
-
/**
|
|
27
|
-
* Validates and normalizes one untrusted runtime adapter result.
|
|
28
|
-
* @param candidate The result returned by the adapter implementation.
|
|
29
|
-
* @param context The invoking adapter scope, project, reader, limits, and signal.
|
|
30
|
-
* @returns A promise resolving to frozen deterministic evidence and diagnostics.
|
|
31
|
-
* @throws
|
|
32
|
-
* - INVALID_REPOSITORY_PATH: An adapter repository reference path is invalid.
|
|
33
|
-
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
34
|
-
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
35
|
-
* - SNAPSHOT_CHANGED: The repository snapshot changed during validation.
|
|
36
|
-
* - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
|
|
37
|
-
* - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
|
|
38
|
-
* - ABORTED: Adapter validation or a repository operation was aborted.
|
|
39
|
-
* - ADAPTER_EXECUTION_FAILED: The adapter result violates its public contract.
|
|
40
|
-
*/
|
|
41
|
-
export declare const validateRuntimeAdapterResult: (candidate: unknown, context: IAdapterValidationContext, outputCounts: IRuntimeAdapterOutputCounts) => Promise<IValidatedRuntimeAdapterResult>;
|
|
42
|
-
export {};
|
|
43
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-validation/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,uBAAuB,EAEvB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EACV,kBAAkB,EAMnB,MAAM,yBAAyB,CAAC;AA4FjC,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACrD;AAGD,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,yBAAyB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AA8nBD;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,GAC1C,YAAY,SAAS,uBAAuB,EAAE,KAC7C,SAAS,uBAAuB,EAQlC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,4BAA4B,GACvC,WAAW,OAAO,EAClB,SAAS,yBAAyB,EAClC,cAAc,2BAA2B,KACxC,OAAO,CAAC,8BAA8B,CA4DxC,CAAC"}
|
package/dist/adapter.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { i as reserveRuntimeAdapterRetainedBytesIfTracked, n as createRuntimeAdapterResultCollector } from "./chunks/collection-CvbjjLf2.js";
|
|
2
|
-
import { n as CoreOperationException } from "./chunks/exceptions-lzD3buFw.js";
|
|
3
|
-
import { REPOSITORY_ROOT, RepositorySourceException, compareRepositoryPaths, parseRepositoryPath } from "@moldea.ai/repository";
|
|
4
|
-
//#region src/adapter-repository/index.ts
|
|
5
|
-
var invalidSourceData = (operation, path) => {
|
|
6
|
-
throw new RepositorySourceException({
|
|
7
|
-
code: "INVALID_SOURCE_DATA",
|
|
8
|
-
operation,
|
|
9
|
-
path,
|
|
10
|
-
retryable: false
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var throwResourceLimitExceeded = (limit, limitMaximum, observedUsage) => {
|
|
14
|
-
throw new CoreOperationException({
|
|
15
|
-
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
16
|
-
limit,
|
|
17
|
-
limitMaximum,
|
|
18
|
-
nextAction: "reduce-input-or-increase-limit",
|
|
19
|
-
observedUsage,
|
|
20
|
-
operation: "validate-project"
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Reads one complete adapter source file through bounded repository pages.
|
|
25
|
-
* @param repository The Core-created repository for the current adapter invocation.
|
|
26
|
-
* @param path The exact source file path.
|
|
27
|
-
* @param options Optional cancellation controls.
|
|
28
|
-
* @returns A promise resolving to one detached complete source buffer.
|
|
29
|
-
* @throws
|
|
30
|
-
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
31
|
-
* - ENTRY_NOT_FOUND: The requested repository entry was not found.
|
|
32
|
-
* - ENTRY_NOT_FILE: The requested repository entry is not a file.
|
|
33
|
-
* - INVALID_PAGE_REQUEST: The repository page request is invalid.
|
|
34
|
-
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
35
|
-
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
36
|
-
* - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
|
|
37
|
-
* - INVALID_SOURCE_DATA: The repository source returned invalid data.
|
|
38
|
-
* - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
|
|
39
|
-
* - ABORTED: The repository operation was aborted.
|
|
40
|
-
* - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
|
|
41
|
-
*/
|
|
42
|
-
var readRuntimeAdapterFile = async (repository, path, options) => {
|
|
43
|
-
const parsedPath = parseRepositoryPath(path);
|
|
44
|
-
const entry = await repository.getEntry(parsedPath, options);
|
|
45
|
-
if (entry === null) throw new RepositorySourceException({
|
|
46
|
-
code: "ENTRY_NOT_FOUND",
|
|
47
|
-
operation: "read-file-page",
|
|
48
|
-
path: parsedPath,
|
|
49
|
-
retryable: false
|
|
50
|
-
});
|
|
51
|
-
if (entry.type !== "file" || entry.byteLength === null) throw new RepositorySourceException({
|
|
52
|
-
code: "ENTRY_NOT_FILE",
|
|
53
|
-
operation: "read-file-page",
|
|
54
|
-
path: parsedPath,
|
|
55
|
-
retryable: false
|
|
56
|
-
});
|
|
57
|
-
if (entry.byteLength > repository.limits.maxFileBytes) return throwResourceLimitExceeded("maxFileBytes", repository.limits.maxFileBytes, entry.byteLength);
|
|
58
|
-
reserveRuntimeAdapterRetainedBytesIfTracked(repository, entry.byteLength);
|
|
59
|
-
const content = new Uint8Array(entry.byteLength);
|
|
60
|
-
let offset = 0;
|
|
61
|
-
let isFirstPage = true;
|
|
62
|
-
while (isFirstPage || offset < entry.byteLength) {
|
|
63
|
-
isFirstPage = false;
|
|
64
|
-
options?.signal?.throwIfAborted();
|
|
65
|
-
const page = await repository.readFilePage(parsedPath, {
|
|
66
|
-
maxBytes: Math.min(repository.limits.maxPageBytes, Math.max(1, entry.byteLength - offset)),
|
|
67
|
-
offset,
|
|
68
|
-
...options?.signal === void 0 ? {} : { signal: options.signal }
|
|
69
|
-
});
|
|
70
|
-
if (page.snapshot.id !== repository.snapshot.id || page.offset !== offset || page.totalBytes !== entry.byteLength || !(page.bytes instanceof Uint8Array) || page.bytes.byteLength > repository.limits.maxPageBytes || page.bytes.byteLength > content.byteLength - offset || page.bytes.byteLength === 0 && !page.isComplete) return invalidSourceData("read-file-page", parsedPath);
|
|
71
|
-
content.set(page.bytes, offset);
|
|
72
|
-
offset += page.bytes.byteLength;
|
|
73
|
-
if (page.isComplete) {
|
|
74
|
-
if (page.nextOffset !== null || offset !== content.byteLength) return invalidSourceData("read-file-page", parsedPath);
|
|
75
|
-
return content;
|
|
76
|
-
}
|
|
77
|
-
if (page.nextOffset !== offset) return invalidSourceData("read-file-page", parsedPath);
|
|
78
|
-
}
|
|
79
|
-
return invalidSourceData("read-file-page", parsedPath);
|
|
80
|
-
};
|
|
81
|
-
/** Iterates one adapter-scoped descendant listing through bounded pages. */
|
|
82
|
-
var iterateRuntimeAdapterEntries = (repository, options) => {
|
|
83
|
-
const prefix = options?.prefix === void 0 ? REPOSITORY_ROOT : parseRepositoryPath(options.prefix);
|
|
84
|
-
return { async *[Symbol.asyncIterator]() {
|
|
85
|
-
let cursor;
|
|
86
|
-
let entryCount = 0;
|
|
87
|
-
let previousPath = null;
|
|
88
|
-
do {
|
|
89
|
-
options?.signal?.throwIfAborted();
|
|
90
|
-
const page = await repository.listEntriesPage({
|
|
91
|
-
...cursor === void 0 ? {} : { cursor },
|
|
92
|
-
maxEntries: repository.limits.maxPageEntries,
|
|
93
|
-
prefix,
|
|
94
|
-
...options?.signal === void 0 ? {} : { signal: options.signal }
|
|
95
|
-
});
|
|
96
|
-
if (page.snapshot.id !== repository.snapshot.id || page.entries.length > repository.limits.maxPageEntries || page.entries.length === 0 && !page.isComplete) return invalidSourceData("list-entries-page", prefix);
|
|
97
|
-
for (const entry of page.entries) {
|
|
98
|
-
if (previousPath !== null && compareRepositoryPaths(previousPath, entry.path) >= 0) return invalidSourceData("list-entries-page", entry.path);
|
|
99
|
-
entryCount += 1;
|
|
100
|
-
if (entryCount > repository.limits.maxEntries) return throwResourceLimitExceeded("maxEntries", repository.limits.maxEntries, entryCount);
|
|
101
|
-
previousPath = entry.path;
|
|
102
|
-
yield entry;
|
|
103
|
-
}
|
|
104
|
-
if (page.isComplete) {
|
|
105
|
-
if (page.nextCursor !== null) return invalidSourceData("list-entries-page", prefix);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (page.nextCursor === null || page.nextCursor === cursor) return invalidSourceData("list-entries-page", prefix);
|
|
109
|
-
cursor = page.nextCursor;
|
|
110
|
-
} while (true);
|
|
111
|
-
} };
|
|
112
|
-
};
|
|
113
|
-
//#endregion
|
|
114
|
-
export { createRuntimeAdapterResultCollector, iterateRuntimeAdapterEntries, readRuntimeAdapterFile };
|
|
115
|
-
|
|
116
|
-
//# sourceMappingURL=adapter.js.map
|
package/dist/adapter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","names":[],"sources":["../src/adapter-repository/index.ts"],"sourcesContent":["import {\n REPOSITORY_ROOT,\n RepositorySourceException,\n compareRepositoryPaths,\n parseRepositoryPath,\n type IRepositoryEntry,\n type IRepositoryOperationOptions,\n type IRepositoryPath,\n} from '@moldea.ai/repository';\n\nimport type { IRuntimeAdapterRepository } from '../adapter/index.js';\nimport { reserveRuntimeAdapterRetainedBytesIfTracked } from '../adapter-retained-memory/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\n\nconst invalidSourceData = (\n operation: 'list-entries-page' | 'read-file-page',\n path: IRepositoryPath,\n): never => {\n throw new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation,\n path,\n retryable: false,\n });\n};\n\nconst throwResourceLimitExceeded = (\n limit: 'maxEntries' | 'maxFileBytes' | 'maxTotalBytesRead',\n limitMaximum: number,\n observedUsage: number,\n): never => {\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit,\n limitMaximum,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage,\n operation: 'validate-project',\n });\n};\n\n/**\n * Reads one complete adapter source file through bounded repository pages.\n * @param repository The Core-created repository for the current adapter invocation.\n * @param path The exact source file path.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to one detached complete source buffer.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_FILE: The requested repository entry is not a file.\n * - 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 * - 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 * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n */\nexport const readRuntimeAdapterFile = async (\n repository: IRuntimeAdapterRepository,\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n): Promise<Uint8Array> => {\n const parsedPath = parseRepositoryPath(path);\n const entry = await repository.getEntry(parsedPath, options);\n\n if (entry === null) {\n throw new RepositorySourceException({\n code: 'ENTRY_NOT_FOUND',\n operation: 'read-file-page',\n path: parsedPath,\n retryable: false,\n });\n }\n\n if (entry.type !== 'file' || entry.byteLength === null) {\n throw new RepositorySourceException({\n code: 'ENTRY_NOT_FILE',\n operation: 'read-file-page',\n path: parsedPath,\n retryable: false,\n });\n }\n\n if (entry.byteLength > repository.limits.maxFileBytes) {\n return throwResourceLimitExceeded(\n 'maxFileBytes',\n repository.limits.maxFileBytes,\n entry.byteLength,\n );\n }\n\n reserveRuntimeAdapterRetainedBytesIfTracked(repository, entry.byteLength);\n const content = new Uint8Array(entry.byteLength);\n let offset = 0;\n let isFirstPage = true;\n\n while (isFirstPage || offset < entry.byteLength) {\n isFirstPage = false;\n options?.signal?.throwIfAborted();\n const page = await repository.readFilePage(parsedPath, {\n maxBytes: Math.min(repository.limits.maxPageBytes, Math.max(1, entry.byteLength - offset)),\n offset,\n ...(options?.signal === undefined ? {} : { signal: options.signal }),\n });\n\n if (\n page.snapshot.id !== repository.snapshot.id ||\n page.offset !== offset ||\n page.totalBytes !== entry.byteLength ||\n !(page.bytes instanceof Uint8Array) ||\n page.bytes.byteLength > repository.limits.maxPageBytes ||\n page.bytes.byteLength > content.byteLength - offset ||\n (page.bytes.byteLength === 0 && !page.isComplete)\n ) {\n return invalidSourceData('read-file-page', parsedPath);\n }\n\n content.set(page.bytes, offset);\n offset += page.bytes.byteLength;\n\n if (page.isComplete) {\n if (page.nextOffset !== null || offset !== content.byteLength) {\n return invalidSourceData('read-file-page', parsedPath);\n }\n\n return content;\n }\n\n if (page.nextOffset !== offset) {\n return invalidSourceData('read-file-page', parsedPath);\n }\n }\n\n return invalidSourceData('read-file-page', parsedPath);\n};\n\n/** Iterates one adapter-scoped descendant listing through bounded pages. */\nexport const iterateRuntimeAdapterEntries = (\n repository: IRuntimeAdapterRepository,\n options?: IRepositoryOperationOptions & { readonly prefix?: IRepositoryPath },\n): AsyncIterable<IRepositoryEntry> => {\n const prefix =\n options?.prefix === undefined ? REPOSITORY_ROOT : parseRepositoryPath(options.prefix);\n\n return {\n async *[Symbol.asyncIterator](): AsyncIterator<IRepositoryEntry> {\n let cursor: string | undefined;\n let entryCount = 0;\n let previousPath: IRepositoryPath | null = null;\n\n do {\n options?.signal?.throwIfAborted();\n const page = await repository.listEntriesPage({\n ...(cursor === undefined ? {} : { cursor }),\n maxEntries: repository.limits.maxPageEntries,\n prefix,\n ...(options?.signal === undefined ? {} : { signal: options.signal }),\n });\n\n if (\n page.snapshot.id !== repository.snapshot.id ||\n page.entries.length > repository.limits.maxPageEntries ||\n (page.entries.length === 0 && !page.isComplete)\n ) {\n return invalidSourceData('list-entries-page', prefix);\n }\n\n for (const entry of page.entries) {\n if (previousPath !== null && compareRepositoryPaths(previousPath, entry.path) >= 0) {\n return invalidSourceData('list-entries-page', entry.path);\n }\n\n entryCount += 1;\n if (entryCount > repository.limits.maxEntries) {\n return throwResourceLimitExceeded(\n 'maxEntries',\n repository.limits.maxEntries,\n entryCount,\n );\n }\n\n previousPath = entry.path;\n yield entry;\n }\n\n if (page.isComplete) {\n if (page.nextCursor !== null) {\n return invalidSourceData('list-entries-page', prefix);\n }\n\n return;\n }\n\n if (page.nextCursor === null || page.nextCursor === cursor) {\n return invalidSourceData('list-entries-page', prefix);\n }\n\n cursor = page.nextCursor;\n } while (true);\n },\n };\n};\n"],"mappings":"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"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { n as CoreOperationException } from "./exceptions-lzD3buFw.js";
|
|
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
|
-
//#region src/adapter-result-collection/collection.ts
|
|
16
|
-
/** Creates the immutable admission view from Core's authoritative raw counters. */
|
|
17
|
-
var createRuntimeAdapterOutputBudget = (counts, limits) => Object.freeze({
|
|
18
|
-
diagnostics: Object.freeze({
|
|
19
|
-
maximum: limits.maxDiagnostics,
|
|
20
|
-
remaining: limits.maxDiagnostics - counts.diagnostics
|
|
21
|
-
}),
|
|
22
|
-
evidence: Object.freeze({
|
|
23
|
-
maximum: limits.maxEvidence,
|
|
24
|
-
remaining: limits.maxEvidence - counts.evidence
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* Collects one adapter result without constructing records beyond its remaining allowance.
|
|
29
|
-
* @param context The trusted invocation agent, raw output budget, and operation signal.
|
|
30
|
-
* @returns Independent collectors and one final immutable adapter result.
|
|
31
|
-
*/
|
|
32
|
-
var createRuntimeAdapterResultCollector = (context) => {
|
|
33
|
-
const diagnostics = [];
|
|
34
|
-
const evidence = [];
|
|
35
|
-
const createCollector = (kind, records) => {
|
|
36
|
-
const { maximum, remaining } = context.outputBudget[kind];
|
|
37
|
-
let admitted = 0;
|
|
38
|
-
return Object.freeze({
|
|
39
|
-
some: (predicate) => records.some(predicate),
|
|
40
|
-
add: (factory) => {
|
|
41
|
-
if (context.signal?.aborted) throw new CoreOperationException({
|
|
42
|
-
adapterId: context.agent.declaration.runtime.id,
|
|
43
|
-
cause: context.signal.reason,
|
|
44
|
-
code: "ABORTED",
|
|
45
|
-
operation: "validate-adapter"
|
|
46
|
-
});
|
|
47
|
-
if (admitted >= remaining) throw new CoreOperationException({
|
|
48
|
-
adapterId: context.agent.declaration.runtime.id,
|
|
49
|
-
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
50
|
-
limit: kind === "diagnostics" ? "maxDiagnostics" : "maxEvidence",
|
|
51
|
-
limitMaximum: maximum,
|
|
52
|
-
nextAction: "reduce-input-or-increase-limit",
|
|
53
|
-
observedUsage: maximum - remaining + admitted + 1,
|
|
54
|
-
operation: "validate-adapter"
|
|
55
|
-
});
|
|
56
|
-
admitted += 1;
|
|
57
|
-
records.push(factory());
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
return Object.freeze({
|
|
62
|
-
diagnostics: createCollector("diagnostics", diagnostics),
|
|
63
|
-
evidence: createCollector("evidence", evidence),
|
|
64
|
-
finalize: () => Object.freeze({
|
|
65
|
-
diagnostics: Object.freeze(diagnostics),
|
|
66
|
-
evidence: Object.freeze(evidence)
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
//#endregion
|
|
71
|
-
export { reserveRuntimeAdapterRetainedBytesIfTracked as i, createRuntimeAdapterResultCollector as n, registerRuntimeAdapterRetainedByteReservation as r, createRuntimeAdapterOutputBudget as t };
|
|
72
|
-
|
|
73
|
-
//# sourceMappingURL=collection-CvbjjLf2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collection-CvbjjLf2.js","names":[],"sources":["../../src/adapter-retained-memory/index.ts","../../src/adapter-result-collection/collection.ts"],"sourcesContent":["import type { IRuntimeAdapterRepository } from '../adapter/index.js';\ntype IRetainedByteReservation = (byteLength: number) => void;\n\n// reservations belong to Core-created adapter repositories and remain private to the session\nconst retainedByteReservations = new WeakMap<IRuntimeAdapterRepository, IRetainedByteReservation>();\n\n/** Registers the retained-memory reservation owned by one inspection session. */\nexport const registerRuntimeAdapterRetainedByteReservation = (\n repository: IRuntimeAdapterRepository,\n reserve: IRetainedByteReservation,\n): void => {\n if (retainedByteReservations.has(repository)) {\n throw new TypeError('The runtime adapter repository is already registered.');\n }\n\n retainedByteReservations.set(repository, reserve);\n};\n\n/** Reserves a complete adapter-owned buffer when Core owns the repository session. */\nexport const reserveRuntimeAdapterRetainedBytesIfTracked = (\n repository: IRuntimeAdapterRepository,\n byteLength: number,\n): void => {\n const reserve = retainedByteReservations.get(repository);\n\n if (reserve !== undefined) {\n reserve(byteLength);\n }\n};\n","import type {\n IRuntimeAdapterContext,\n IRuntimeAdapterEvidence,\n IRuntimeAdapterResult,\n} from '../adapter/index.js';\nimport type { IRuntimeAdapterOutputCounts } from '../adapter-validation/index.js';\nimport type { ICoreResourceLimits } from '../contracts/index.js';\nimport type { IAdapterDiagnostic } from '../diagnostics/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\n\nimport type {\n IRuntimeAdapterOutputBudget,\n IRuntimeAdapterRecordCollector,\n IRuntimeAdapterResultCollector,\n} from './types.js';\n\n/** Creates the immutable admission view from Core's authoritative raw counters. */\nexport const createRuntimeAdapterOutputBudget = (\n counts: IRuntimeAdapterOutputCounts,\n limits: ICoreResourceLimits,\n): IRuntimeAdapterOutputBudget =>\n Object.freeze({\n diagnostics: Object.freeze({\n maximum: limits.maxDiagnostics,\n remaining: limits.maxDiagnostics - counts.diagnostics,\n }),\n evidence: Object.freeze({\n maximum: limits.maxEvidence,\n remaining: limits.maxEvidence - counts.evidence,\n }),\n });\n\n/**\n * Collects one adapter result without constructing records beyond its remaining allowance.\n * @param context The trusted invocation agent, raw output budget, and operation signal.\n * @returns Independent collectors and one final immutable adapter result.\n */\nexport const createRuntimeAdapterResultCollector = (\n context: Pick<IRuntimeAdapterContext, 'agent' | 'outputBudget' | 'signal'>,\n): IRuntimeAdapterResultCollector => {\n const diagnostics: IAdapterDiagnostic[] = [];\n const evidence: IRuntimeAdapterEvidence[] = [];\n\n const createCollector = <TRecord>(\n kind: keyof IRuntimeAdapterOutputBudget,\n records: TRecord[],\n ): IRuntimeAdapterRecordCollector<TRecord> => {\n const { maximum, remaining } = context.outputBudget[kind];\n let admitted = 0;\n\n return Object.freeze({\n some: (predicate: (record: TRecord) => boolean): boolean => records.some(predicate),\n add: (factory: () => TRecord): void => {\n if (context.signal?.aborted) {\n throw new CoreOperationException({\n adapterId: context.agent.declaration.runtime.id,\n cause: context.signal.reason,\n code: 'ABORTED',\n operation: 'validate-adapter',\n });\n }\n\n if (admitted >= remaining) {\n throw new CoreOperationException({\n adapterId: context.agent.declaration.runtime.id,\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: kind === 'diagnostics' ? 'maxDiagnostics' : 'maxEvidence',\n limitMaximum: maximum,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: maximum - remaining + admitted + 1,\n operation: 'validate-adapter',\n });\n }\n\n admitted += 1;\n records.push(factory());\n },\n });\n };\n\n return Object.freeze({\n diagnostics: createCollector('diagnostics', diagnostics),\n evidence: createCollector('evidence', evidence),\n finalize: (): IRuntimeAdapterResult =>\n Object.freeze({\n diagnostics: Object.freeze(diagnostics),\n evidence: Object.freeze(evidence),\n }),\n });\n};\n"],"mappings":";;AAIA,IAAM,2CAA2B,IAAI,QAA6D;;AAGlG,IAAa,iDACX,YACA,YACS;CACT,IAAI,yBAAyB,IAAI,UAAU,GACzC,MAAM,IAAI,UAAU,uDAAuD;CAG7E,yBAAyB,IAAI,YAAY,OAAO;AAClD;;AAGA,IAAa,+CACX,YACA,eACS;CACT,MAAM,UAAU,yBAAyB,IAAI,UAAU;CAEvD,IAAI,YAAY,KAAA,GACd,QAAQ,UAAU;AAEtB;;;;ACXA,IAAa,oCACX,QACA,WAEA,OAAO,OAAO;CACZ,aAAa,OAAO,OAAO;EACzB,SAAS,OAAO;EAChB,WAAW,OAAO,iBAAiB,OAAO;CAC5C,CAAC;CACD,UAAU,OAAO,OAAO;EACtB,SAAS,OAAO;EAChB,WAAW,OAAO,cAAc,OAAO;CACzC,CAAC;AACH,CAAC;;;;;;AAOH,IAAa,uCACX,YACmC;CACnC,MAAM,cAAoC,CAAC;CAC3C,MAAM,WAAsC,CAAC;CAE7C,MAAM,mBACJ,MACA,YAC4C;EAC5C,MAAM,EAAE,SAAS,cAAc,QAAQ,aAAa;EACpD,IAAI,WAAW;EAEf,OAAO,OAAO,OAAO;GACnB,OAAO,cAAqD,QAAQ,KAAK,SAAS;GAClF,MAAM,YAAiC;IACrC,IAAI,QAAQ,QAAQ,SAClB,MAAM,IAAI,uBAAuB;KAC/B,WAAW,QAAQ,MAAM,YAAY,QAAQ;KAC7C,OAAO,QAAQ,OAAO;KACtB,MAAM;KACN,WAAW;IACb,CAAC;IAGH,IAAI,YAAY,WACd,MAAM,IAAI,uBAAuB;KAC/B,WAAW,QAAQ,MAAM,YAAY,QAAQ;KAC7C,MAAM;KACN,OAAO,SAAS,gBAAgB,mBAAmB;KACnD,cAAc;KACd,YAAY;KACZ,eAAe,UAAU,YAAY,WAAW;KAChD,WAAW;IACb,CAAC;IAGH,YAAY;IACZ,QAAQ,KAAK,QAAQ,CAAC;GACxB;EACF,CAAC;CACH;CAEA,OAAO,OAAO,OAAO;EACnB,aAAa,gBAAgB,eAAe,WAAW;EACvD,UAAU,gBAAgB,YAAY,QAAQ;EAC9C,gBACE,OAAO,OAAO;GACZ,aAAa,OAAO,OAAO,WAAW;GACtC,UAAU,OAAO,OAAO,QAAQ;EAClC,CAAC;CACL,CAAC;AACH"}
|