@moldea.ai/core 7.0.1 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -6
- package/dist/analysis-worker.js +5 -5
- package/dist/chunks/{core-Cdeiu6xG.js → core-DC9KYL1H.js} +30 -28
- package/dist/chunks/core-DC9KYL1H.js.map +1 -0
- package/dist/chunks/{errors-BE4DS3Ak.js → errors-Dw1ahMS1.js} +4 -9
- package/dist/chunks/errors-Dw1ahMS1.js.map +1 -0
- package/dist/chunks/{exceptions-IXsorE8t.js → exceptions-CYf1pCKf.js} +1 -3
- package/dist/chunks/exceptions-CYf1pCKf.js.map +1 -0
- package/dist/chunks/{lifecycle-D_RvxhDC.js → lifecycle-h3DWn5vl.js} +2 -2
- package/dist/chunks/{lifecycle-D_RvxhDC.js.map → lifecycle-h3DWn5vl.js.map} +1 -1
- package/dist/chunks/{options-5x9gu2Qb.js → options-AMqX7rx_.js} +3 -9
- package/dist/chunks/options-AMqX7rx_.js.map +1 -0
- package/dist/chunks/{repository-rpc-B_y0Kspf.js → repository-rpc-ClAIx3-c.js} +2 -2
- package/dist/chunks/{repository-rpc-B_y0Kspf.js.map → repository-rpc-ClAIx3-c.js.map} +1 -1
- package/dist/chunks/{scope-AGMcHUE_.js → scope-DxhC1hq2.js} +7 -7
- package/dist/chunks/scope-DxhC1hq2.js.map +1 -0
- package/dist/chunks/{syntax-CVvExx4R.js → syntax-MNWJxC7y.js} +5 -3
- package/dist/chunks/syntax-MNWJxC7y.js.map +1 -0
- package/dist/exceptions/index.d.ts +0 -2
- package/dist/exceptions/index.d.ts.map +1 -1
- package/dist/export-inventory/inventory.d.ts +3 -3
- package/dist/export-inventory/inventory.d.ts.map +1 -1
- package/dist/export-inventory/syntax.d.ts.map +1 -1
- package/dist/format-validation/index.d.ts +0 -3
- package/dist/format-validation/index.d.ts.map +1 -1
- package/dist/impact-pattern-validation/inspection.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/manifest-validation/index.d.ts.map +1 -1
- package/dist/node-inspection/errors.d.ts.map +1 -1
- package/dist/node-runner.js +3 -3
- package/dist/node.js +5 -5
- package/dist/repository-reference-validation/index.d.ts.map +1 -1
- package/dist/scope.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/core-Cdeiu6xG.js.map +0 -1
- package/dist/chunks/errors-BE4DS3Ak.js.map +0 -1
- package/dist/chunks/exceptions-IXsorE8t.js.map +0 -1
- package/dist/chunks/options-5x9gu2Qb.js.map +0 -1
- package/dist/chunks/scope-AGMcHUE_.js.map +0 -1
- package/dist/chunks/syntax-CVvExx4R.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isCoreOperationErrorCode, i as isCoreOperation, n as CoreOperationException, r as isCoreConfigurationErrorCode, t as CoreConfigurationException } from "./exceptions-
|
|
1
|
+
import { a as isCoreOperationErrorCode, i as isCoreOperation, n as CoreOperationException, r as isCoreConfigurationErrorCode, t as CoreConfigurationException } from "./exceptions-CYf1pCKf.js";
|
|
2
2
|
import { RepositoryPathException, RepositorySourceException, isRepositoryPath } from "@moldea.ai/repository";
|
|
3
3
|
import { Buffer } from "node:buffer";
|
|
4
4
|
//#region src/node-inspection/constants.ts
|
|
@@ -283,7 +283,6 @@ var serializeInspectionFailure = (error) => {
|
|
|
283
283
|
options: {
|
|
284
284
|
code: error.code,
|
|
285
285
|
operation: error.operation,
|
|
286
|
-
...error.agentId === null ? {} : { agentId: error.agentId },
|
|
287
286
|
...error.code !== "RESOURCE_LIMIT_EXCEEDED" ? {} : {
|
|
288
287
|
limit: error.limit,
|
|
289
288
|
limitMaximum: error.limitMaximum,
|
|
@@ -347,7 +346,6 @@ var deserializeInspectionFailure = (failure) => {
|
|
|
347
346
|
const allowed = failure.family === "configuration" ? ["code", "operation"] : failure.family === "operation" ? [
|
|
348
347
|
"code",
|
|
349
348
|
"operation",
|
|
350
|
-
"agentId",
|
|
351
349
|
"limit",
|
|
352
350
|
"limitMaximum",
|
|
353
351
|
"nextAction",
|
|
@@ -359,12 +357,9 @@ var deserializeInspectionFailure = (failure) => {
|
|
|
359
357
|
"retryable",
|
|
360
358
|
"resource"
|
|
361
359
|
] : [];
|
|
362
|
-
if (Object.keys(options).some((key) => !allowed.includes(key))
|
|
360
|
+
if (Object.keys(options).some((key) => !allowed.includes(key))) throw createInspectionProcessFailure();
|
|
363
361
|
if ((failure.family === "operation" || failure.family === "configuration") && !isCoreOperation(options["operation"])) throw createInspectionProcessFailure();
|
|
364
|
-
const scope = {
|
|
365
|
-
operation: isCoreOperation(options["operation"]) ? options["operation"] : "create-project-inspection",
|
|
366
|
-
...typeof options["agentId"] === "string" ? { agentId: options["agentId"] } : {}
|
|
367
|
-
};
|
|
362
|
+
const scope = { operation: isCoreOperation(options["operation"]) ? options["operation"] : "create-project-inspection" };
|
|
368
363
|
if (failure.family === "path" && Object.keys(options).length === 0) return new RepositoryPathException();
|
|
369
364
|
if (failure.family === "configuration") {
|
|
370
365
|
const code = options["code"];
|
|
@@ -432,4 +427,4 @@ var deserializeInspectionFailure = (failure) => {
|
|
|
432
427
|
//#endregion
|
|
433
428
|
export { encodeInspectionMessage as a, NODE_INSPECTION_PROFILE as c, NODE_INSPECTION_TRANSPORT_BYTES as d, decodeInspectionMessage as i, NODE_INSPECTION_STDIO_BYTES as l, serializeInspectionFailure as n, NODE_INSPECTION_FILE_PAGE_BYTES as o, createInspectionProcessFailure as r, NODE_INSPECTION_LIFETIME_MS as s, deserializeInspectionFailure as t, NODE_INSPECTION_TERMINATION_GRACE_MS as u };
|
|
434
429
|
|
|
435
|
-
//# sourceMappingURL=errors-
|
|
430
|
+
//# sourceMappingURL=errors-Dw1ahMS1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-Dw1ahMS1.js","names":[],"sources":["../../src/node-inspection/constants.ts","../../src/node-inspection/protocol.ts","../../src/node-inspection/errors.ts"],"sourcesContent":["// whole-attempt lifetime and bounded bridge ownership, independent of source file size\nexport const NODE_INSPECTION_LIFETIME_MS = 120_000;\nexport const NODE_INSPECTION_TERMINATION_GRACE_MS = 1_000;\nexport const NODE_INSPECTION_MAX_REQUESTS = 4;\nexport const NODE_INSPECTION_FILE_PAGE_BYTES = 65_536;\nexport const NODE_INSPECTION_MESSAGE_BYTES = 1_048_576;\nexport const NODE_INSPECTION_STDIO_BYTES = 32_768;\n\n// two UTF-16 bytes per serialized byte, two copies at each owner, for every RPC credit\nexport const NODE_INSPECTION_TRANSPORT_BYTES =\n NODE_INSPECTION_MAX_REQUESTS * NODE_INSPECTION_MESSAGE_BYTES * 2 * 2 * 3;\n\n// fixed profile qualified in the constrained CLI and actual-worker lanes\nexport const NODE_INSPECTION_OLD_GENERATION_MIB = 512;\nexport const NODE_INSPECTION_YOUNG_GENERATION_MIB = 24;\n\n// immutable execution identity for consumers that authenticate prepared inspection state\nexport const NODE_INSPECTION_PROFILE = Object.freeze({\n lifetimeMs: NODE_INSPECTION_LIFETIME_MS,\n terminationGraceMs: NODE_INSPECTION_TERMINATION_GRACE_MS,\n maxReaderRequests: NODE_INSPECTION_MAX_REQUESTS,\n maxFilePageBytes: NODE_INSPECTION_FILE_PAGE_BYTES,\n maxMessageBytes: NODE_INSPECTION_MESSAGE_BYTES,\n maxStdioBytes: NODE_INSPECTION_STDIO_BYTES,\n transportBytes: NODE_INSPECTION_TRANSPORT_BYTES,\n oldGenerationMiB: NODE_INSPECTION_OLD_GENERATION_MIB,\n youngGenerationMiB: NODE_INSPECTION_YOUNG_GENERATION_MIB,\n});\n","import { Buffer } from 'node:buffer';\n\nimport { isRepositoryPath } from '@moldea.ai/repository';\n\nimport type { ICoreResourceLimits } from '../contracts/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\n\nimport { NODE_INSPECTION_FILE_PAGE_BYTES, NODE_INSPECTION_MESSAGE_BYTES } from './constants.js';\nimport type { INodeInspectionMessage } from './types.js';\n\n/** Creates the safe failure for an untrusted or inconsistent private protocol record. */\nexport const createInspectionProcessFailure = (cause?: unknown): CoreOperationException =>\n new CoreOperationException({\n code: 'INSPECTION_PROCESS_FAILED',\n operation: 'create-project-inspection',\n ...(cause === undefined ? {} : { cause }),\n });\n\nconst isRecord = (input: unknown): input is Record<string, unknown> =>\n input !== null && typeof input === 'object' && !Array.isArray(input);\nconst JSON_SHORT_ESCAPES = new Set([8, 9, 10, 12, 13]);\nconst isInteger = (input: unknown): input is number =>\n typeof input === 'number' && Number.isSafeInteger(input) && input >= 0;\nconst hasKeys = (\n input: Record<string, unknown>,\n required: string[],\n optional: string[] = [],\n): boolean =>\n required.every((key) => Object.hasOwn(input, key)) &&\n Object.keys(input).every((key) => required.includes(key) || optional.includes(key));\nconst isSnapshot = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, ['id', 'sourceKind']) &&\n typeof input['id'] === 'string' &&\n input['id'].length > 0 &&\n typeof input['sourceKind'] === 'string' &&\n input['sourceKind'].length > 0;\nconst isOptionalString = (input: Record<string, unknown>, key: string): boolean =>\n !Object.hasOwn(input, key) || typeof input[key] === 'string';\nconst isPageInput = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, ['maxItems', 'view'], ['cursor']) &&\n isInteger(input['maxItems']) &&\n input['maxItems'] > 0 &&\n ['all', 'diagnostics', 'coverage', 'metadata'].includes(String(input['view'])) &&\n isOptionalString(input, 'cursor');\nconst isLimits = (input: unknown): input is ICoreResourceLimits =>\n isRecord(input) &&\n hasKeys(input, [\n 'maxEntries',\n 'maxTotalBytesRead',\n 'maxFileBytes',\n 'maxManifestBytes',\n 'maxRetainedBytes',\n 'maxDiagnostics',\n 'maxCoverage',\n 'maxAcceptedWarnings',\n ]) &&\n Object.values(input).every((limit) => isInteger(limit) && limit > 0);\nconst isCounts = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, [\n 'agents',\n 'context',\n 'decisions',\n 'mirrors',\n 'runtimes',\n 'unresolved',\n 'diagnostics',\n 'errors',\n 'warnings',\n 'acceptedWarnings',\n 'coverage',\n 'metadata',\n ]) &&\n Object.values(input).every(isInteger);\nconst isSummary = (input: unknown): boolean =>\n input === null ||\n (isRecord(input) &&\n hasKeys(input, ['counts', 'manifestDigest', 'manifestPath', 'projectDigest', 'projectPath']) &&\n isRecord(input['counts']) &&\n hasKeys(input['counts'], [\n 'agents',\n 'context',\n 'decisions',\n 'mirrors',\n 'runtimes',\n 'unresolved',\n ]) &&\n Object.values(input['counts']).every(isInteger) &&\n typeof input['manifestDigest'] === 'string' &&\n typeof input['projectDigest'] === 'string' &&\n isRepositoryPath(input['manifestPath']) &&\n isRepositoryPath(input['projectPath']));\nconst isInspectionBase = (input: Record<string, unknown>): boolean =>\n isCounts(input['counts']) &&\n isRecord(input['coverageCounts']) &&\n hasKeys(input['coverageCounts'], [\n 'bindings',\n 'exportsPassed',\n 'exportsFailed',\n 'exportsNotChecked',\n ]) &&\n Object.values(input['coverageCounts']).every(isInteger) &&\n typeof input['valid'] === 'boolean' &&\n (input['formatVersion'] === null || input['formatVersion'] === 1) &&\n typeof input['inspectionDigest'] === 'string' &&\n isSnapshot(input['source']) &&\n isSummary(input['summary']);\nconst INSPECTION_KEYS = [\n 'counts',\n 'coverageCounts',\n 'valid',\n 'formatVersion',\n 'inspectionDigest',\n 'source',\n 'summary',\n];\nconst isMetadata = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, [...INSPECTION_KEYS, 'resourceUsage', 'maxAnalysisHeapBytes']) &&\n isInspectionBase(input) &&\n isInteger(input['maxAnalysisHeapBytes']) &&\n input['maxAnalysisHeapBytes'] > 0 &&\n isRecord(input['resourceUsage']) &&\n hasKeys(input['resourceUsage'], [\n 'canonicalBytes',\n 'peakRetainedBytes',\n 'preparedBytes',\n 'retainedBytes',\n 'totalBytesRead',\n ]) &&\n Object.values(input['resourceUsage']).every(isInteger);\nconst isPage = (input: unknown): boolean =>\n isRecord(input) &&\n hasKeys(input, [...INSPECTION_KEYS, 'page', 'view']) &&\n isInspectionBase(input) &&\n ['all', 'diagnostics', 'coverage', 'metadata'].includes(String(input['view'])) &&\n isRecord(input['page']) &&\n hasKeys(input['page'], ['isComplete', 'records', 'nextCursor', 'totalItems']) &&\n typeof input['page']['isComplete'] === 'boolean' &&\n isInteger(input['page']['totalItems']) &&\n (input['page']['nextCursor'] === null || typeof input['page']['nextCursor'] === 'string') &&\n Array.isArray(input['page']['records']) &&\n input['page']['records'].every(\n (record: unknown) =>\n isRecord(record) &&\n hasKeys(record, ['item', 'nextCursor']) &&\n (record['nextCursor'] === null || typeof record['nextCursor'] === 'string') &&\n isRecord(record['item']) &&\n typeof record['item']['kind'] === 'string' &&\n ['agent', 'diagnostic', 'coverage', 'metadata'].includes(record['item']['kind']) &&\n hasKeys(record['item'], ['kind', record['item']['kind']]) &&\n isRecord(record['item'][record['item']['kind']]),\n );\nconst isRequest = (input: unknown): boolean => {\n if (!isRecord(input)) return false;\n switch (input['method']) {\n case 'getEntry':\n return hasKeys(input, ['method', 'path']) && isRepositoryPath(input['path']);\n case 'listEntriesPage':\n return (\n hasKeys(input, ['method', 'maxEntries'], ['cursor', 'prefix']) &&\n isInteger(input['maxEntries']) &&\n input['maxEntries'] > 0 &&\n input['maxEntries'] <= 128 &&\n isOptionalString(input, 'cursor') &&\n (!Object.hasOwn(input, 'prefix') || isRepositoryPath(input['prefix']))\n );\n case 'readFilePage':\n return (\n hasKeys(input, ['method', 'path', 'maxBytes', 'offset']) &&\n isRepositoryPath(input['path']) &&\n isInteger(input['offset']) &&\n isInteger(input['maxBytes']) &&\n input['maxBytes'] > 0 &&\n input['maxBytes'] <= NODE_INSPECTION_FILE_PAGE_BYTES\n );\n default:\n return false;\n }\n};\n\n/** Validates closed control envelopes and their typed operation payloads on both bridges. */\nconst isMessage = (input: unknown): input is INodeInspectionMessage => {\n if (\n !isRecord(input) ||\n typeof input['attemptId'] !== 'string' ||\n !/^[a-f0-9]{32}$/.test(input['attemptId'])\n )\n return false;\n const keys = ['attemptId', 'kind'];\n switch (input['kind']) {\n case 'start':\n return (\n hasKeys(input, [...keys, 'snapshot', 'limits', 'deadline']) &&\n isSnapshot(input['snapshot']) &&\n isLimits(input['limits']) &&\n isInteger(input['deadline'])\n );\n case 'ready':\n return (\n hasKeys(input, [...keys, 'maxAnalysisHeapBytes']) &&\n isInteger(input['maxAnalysisHeapBytes']) &&\n input['maxAnalysisHeapBytes'] > 0\n );\n case 'run':\n case 'dispose':\n return hasKeys(input, keys);\n case 'prepared':\n return hasKeys(input, [...keys, 'inspection']) && isMetadata(input['inspection']);\n case 'read-page':\n return (\n hasKeys(input, [...keys, 'requestId', 'input']) &&\n isInteger(input['requestId']) &&\n isPageInput(input['input'])\n );\n case 'page':\n return (\n hasKeys(input, [...keys, 'requestId', 'result']) &&\n isInteger(input['requestId']) &&\n isPage(input['result'])\n );\n case 'reader-request':\n return (\n hasKeys(input, [...keys, 'requestId', 'request']) &&\n isInteger(input['requestId']) &&\n isRequest(input['request'])\n );\n case 'reader-response':\n return hasKeys(input, [...keys, 'requestId', 'result']) && isInteger(input['requestId']);\n case 'reader-failure':\n case 'failure':\n return (\n hasKeys(input, [\n ...keys,\n 'failure',\n ...(input['kind'] === 'reader-failure' ? ['requestId'] : []),\n ]) &&\n (input['kind'] !== 'reader-failure' || isInteger(input['requestId'])) &&\n isRecord(input['failure']) &&\n hasKeys(input['failure'], ['family', 'options']) &&\n ['configuration', 'operation', 'repository', 'path'].includes(\n String(input['failure']['family']),\n ) &&\n isRecord(input['failure']['options'])\n );\n default:\n return false;\n }\n};\n\n/** Counts escaped JSON bytes without first allocating a serialized oversized message. */\nconst countJsonBytes = (input: unknown, ancestors: WeakSet<object>, depth: number): number => {\n if (depth > 64) throw createInspectionProcessFailure();\n if (input === null) return 4;\n if (typeof input === 'boolean') return input ? 4 : 5;\n if (typeof input === 'number' && Number.isFinite(input)) return String(input).length;\n if (typeof input === 'string') {\n let bytes = 2;\n for (let index = 0; index < input.length; index++) {\n const code = input.charCodeAt(index);\n if (code === 34 || code === 92 || JSON_SHORT_ESCAPES.has(code)) bytes += 2;\n else if (code < 32) bytes += 6;\n else if (code < 128) bytes++;\n else if (code < 2048) bytes += 2;\n else if (\n code >= 0xd800 &&\n code <= 0xdbff &&\n index + 1 < input.length &&\n input.charCodeAt(index + 1) >= 0xdc00 &&\n input.charCodeAt(index + 1) <= 0xdfff\n ) {\n bytes += 4;\n index++;\n } else bytes += code >= 0xd800 && code <= 0xdfff ? 6 : 3;\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES) return bytes;\n }\n return bytes;\n }\n if (typeof input !== 'object' || ancestors.has(input)) throw createInspectionProcessFailure();\n ancestors.add(input);\n let bytes = 2;\n let count = 0;\n if (Array.isArray(input)) {\n for (const element of input) {\n bytes += (count++ === 0 ? 0 : 1) + countJsonBytes(element, ancestors, depth + 1);\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES) break;\n }\n } else {\n for (const key in input) {\n if (!Object.hasOwn(input, key)) continue;\n bytes +=\n (count++ === 0 ? 0 : 1) +\n countJsonBytes(key, ancestors, depth + 1) +\n 1 +\n countJsonBytes((input as Record<string, unknown>)[key], ancestors, depth + 1);\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES) break;\n }\n }\n ancestors.delete(input);\n return bytes;\n};\n\n/**\n * Admits a complete bounded record before serialization; no record is truncated.\n * @returns One private JSON frame.\n * @throws\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n */\nexport const encodeInspectionMessage = (message: INodeInspectionMessage): string => {\n const bytes = countJsonBytes(message, new WeakSet(), 0);\n if (bytes > NODE_INSPECTION_MESSAGE_BYTES)\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxInspectionMessageBytes',\n limitMaximum: NODE_INSPECTION_MESSAGE_BYTES,\n observedUsage: bytes,\n nextAction: null,\n operation: 'create-project-inspection',\n });\n if (!isMessage(message)) throw createInspectionProcessFailure();\n return JSON.stringify(message);\n};\n\n/**\n * Checks frame size before parsing and validates the closed message contract.\n * @returns A validated private message.\n * @throws\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n */\nexport const decodeInspectionMessage = (frame: unknown): INodeInspectionMessage => {\n if (typeof frame !== 'string' || Buffer.byteLength(frame) > NODE_INSPECTION_MESSAGE_BYTES)\n throw createInspectionProcessFailure();\n let message: unknown;\n try {\n message = JSON.parse(frame);\n } catch (cause) {\n throw createInspectionProcessFailure(cause);\n }\n if (!isMessage(message)) throw createInspectionProcessFailure();\n return message;\n};\n","import {\n RepositoryPathException,\n RepositorySourceException,\n isRepositoryPath,\n type IRepositoryOperation,\n type IRepositorySourceErrorCode,\n} from '@moldea.ai/repository';\n\nimport {\n CoreConfigurationException,\n CoreOperationException,\n isCoreConfigurationErrorCode,\n isCoreOperation,\n isCoreOperationErrorCode,\n} from '../exceptions/index.js';\n\nimport { createInspectionProcessFailure } from './protocol.js';\nimport type { INodeInspectionFailure } from './types.js';\n\n/** Serializes only documented exception fields, excluding native messages, causes and stacks. */\nexport const serializeInspectionFailure = (error: unknown): INodeInspectionFailure => {\n if (error instanceof CoreConfigurationException)\n return {\n family: 'configuration',\n options: {\n code: error.code,\n operation: error.operation,\n },\n };\n if (error instanceof CoreOperationException)\n return {\n family: 'operation',\n options: {\n code: error.code,\n operation: error.operation,\n ...(error.code !== 'RESOURCE_LIMIT_EXCEEDED'\n ? {}\n : {\n limit: error.limit,\n limitMaximum: error.limitMaximum,\n nextAction: error.nextAction,\n observedUsage: error.observedUsage,\n }),\n },\n };\n if (error instanceof RepositoryPathException) return { family: 'path', options: {} };\n if (error instanceof RepositorySourceException)\n return {\n family: 'repository',\n options: {\n code: error.code,\n operation: error.operation,\n path: error.path,\n retryable: error.retryable,\n ...(error.resource === null ? {} : { resource: error.resource }),\n },\n };\n return {\n family: 'operation',\n options: {\n code: 'INSPECTION_PROCESS_FAILED',\n operation: 'create-project-inspection',\n },\n };\n};\nconst REPOSITORY_CODES: IRepositorySourceErrorCode[] = [\n 'ENTRY_NOT_FOUND',\n 'ENTRY_NOT_FILE',\n 'ENTRY_NOT_DIRECTORY',\n 'INVALID_PAGE_REQUEST',\n 'ACCESS_DENIED',\n 'SOURCE_UNAVAILABLE',\n 'SNAPSHOT_CHANGED',\n 'PROVIDER_INCOMPLETE',\n 'INVALID_SOURCE_DATA',\n 'RESOURCE_LIMIT_EXCEEDED',\n 'ABORTED',\n];\nconst REPOSITORY_OPERATIONS: IRepositoryOperation[] = [\n 'create-reader',\n 'create-comparison',\n 'get-entry',\n 'read-file-page',\n 'list-entries-page',\n 'list-changes-page',\n];\nconst isNumber = (input: unknown): input is number =>\n typeof input === 'number' && Number.isSafeInteger(input) && input >= 0;\n\n/**\n * Reconstructs a documented typed failure after checking its safe transport fields.\n * @returns A package exception without a remote native cause or stack.\n * @throws\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n */\nexport const deserializeInspectionFailure = (failure: INodeInspectionFailure): Error => {\n const options = failure.options;\n const allowed =\n failure.family === 'configuration'\n ? ['code', 'operation']\n : failure.family === 'operation'\n ? ['code', 'operation', 'limit', 'limitMaximum', 'nextAction', 'observedUsage']\n : failure.family === 'repository'\n ? ['code', 'operation', 'path', 'retryable', 'resource']\n : [];\n if (Object.keys(options).some((key) => !allowed.includes(key)))\n throw createInspectionProcessFailure();\n if (\n (failure.family === 'operation' || failure.family === 'configuration') &&\n !isCoreOperation(options['operation'])\n )\n throw createInspectionProcessFailure();\n const scope = {\n operation: isCoreOperation(options['operation'])\n ? options['operation']\n : ('create-project-inspection' as const),\n };\n if (failure.family === 'path' && Object.keys(options).length === 0)\n return new RepositoryPathException();\n if (failure.family === 'configuration') {\n const code = options['code'];\n if (isCoreConfigurationErrorCode(code))\n return new CoreConfigurationException({ ...scope, code });\n }\n if (failure.family === 'operation') {\n const code = options['code'];\n if (\n isCoreOperationErrorCode(code) &&\n code !== 'RESOURCE_LIMIT_EXCEEDED' &&\n !['limit', 'limitMaximum', 'nextAction', 'observedUsage'].some((key) =>\n Object.hasOwn(options, key),\n )\n )\n return new CoreOperationException({ ...scope, code });\n if (\n options['code'] === 'RESOURCE_LIMIT_EXCEEDED' &&\n isNumber(options['limitMaximum']) &&\n options['limitMaximum'] > 0\n ) {\n if (\n options['limit'] === 'maxAnalysisHeapBytes' &&\n options['nextAction'] === 'review-inspection-capacity' &&\n options['observedUsage'] === null\n )\n return new CoreOperationException({\n ...scope,\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxAnalysisHeapBytes',\n limitMaximum: options['limitMaximum'],\n observedUsage: null,\n nextAction: 'review-inspection-capacity',\n });\n if (\n (options['limit'] === 'maxInspectionMessageBytes' ||\n options['limit'] === 'maxReaderRequests') &&\n options['nextAction'] === null &&\n isNumber(options['observedUsage'])\n )\n return new CoreOperationException({\n ...scope,\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: options['limit'],\n limitMaximum: options['limitMaximum'],\n nextAction: null,\n observedUsage: options['observedUsage'],\n });\n if (\n typeof options['limit'] === 'string' &&\n !['maxAnalysisHeapBytes', 'maxInspectionMessageBytes', 'maxReaderRequests'].includes(\n options['limit'],\n ) &&\n options['nextAction'] === 'reduce-input-or-increase-limit' &&\n isNumber(options['observedUsage'])\n )\n return new CoreOperationException({\n ...scope,\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: options['limit'],\n limitMaximum: options['limitMaximum'],\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: options['observedUsage'],\n });\n }\n }\n if (failure.family === 'repository') {\n const code = REPOSITORY_CODES.find((candidate) => candidate === options['code']);\n const operation = REPOSITORY_OPERATIONS.find((candidate) => candidate === options['operation']);\n const resource = options['resource'];\n if (\n code !== undefined &&\n operation !== undefined &&\n typeof options['retryable'] === 'boolean' &&\n (options['path'] === null || isRepositoryPath(options['path'])) &&\n (resource === undefined ||\n (resource !== null &&\n typeof resource === 'object' &&\n Object.keys(resource).length === 3 &&\n 'dimension' in resource &&\n typeof resource.dimension === 'string' &&\n 'limit' in resource &&\n isNumber(resource.limit) &&\n 'observed' in resource &&\n isNumber(resource.observed)))\n ) {\n return new RepositorySourceException({\n code,\n operation,\n path: options['path'],\n retryable: options['retryable'],\n ...(resource === undefined\n ? {}\n : {\n resource: resource as {\n dimension: string;\n limit: number;\n observed: number;\n },\n }),\n });\n }\n }\n throw createInspectionProcessFailure();\n};\n"],"mappings":";;;;AACA,IAAa,8BAA8B;AAC3C,IAAa,uCAAuC;AAEpD,IAAa,kCAAkC;AAC/C,IAAa,gCAAgC;AAC7C,IAAa,8BAA8B;AAG3C,IAAa,kCAAA,IACoB,gCAAgC,IAAI,IAAI;AAOzE,IAAa,0BAA0B,OAAO,OAAO;CACnD,YAAY;CACZ,oBAAoB;CACpB,mBAAA;CACA,kBAAkB;CAClB,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,kBAAA;CACA,oBAAA;AACF,CAAC;;;;AChBD,IAAa,kCAAkC,UAC7C,IAAI,uBAAuB;CACzB,MAAM;CACN,WAAW;CACX,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;AACzC,CAAC;AAEH,IAAM,YAAY,UAChB,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE,IAAM,qCAAqB,IAAI,IAAI;CAAC;CAAG;CAAG;CAAI;CAAI;AAAE,CAAC;AACrD,IAAM,aAAa,UACjB,OAAO,UAAU,YAAY,OAAO,cAAc,KAAK,KAAK,SAAS;AACvE,IAAM,WACJ,OACA,UACA,WAAqB,CAAC,MAEtB,SAAS,OAAO,QAAQ,OAAO,OAAO,OAAO,GAAG,CAAC,KACjD,OAAO,KAAK,KAAK,CAAC,CAAC,OAAO,QAAQ,SAAS,SAAS,GAAG,KAAK,SAAS,SAAS,GAAG,CAAC;AACpF,IAAM,cAAc,UAClB,SAAS,KAAK,KACd,QAAQ,OAAO,CAAC,MAAM,YAAY,CAAC,KACnC,OAAO,MAAM,UAAU,YACvB,M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AO,KAAK,QAAQ,CAAC,CAAC,WAAW,KACjC,eAAe,YACf,OAAO,SAAS,cAAc,YAC9B,WAAW,YACX,SAAS,SAAS,KAAK,KACvB,cAAc,YACd,SAAS,SAAS,QAAQ,IAE9B,OAAO,IAAI,0BAA0B;GACnC;GACA;GACA,MAAM,QAAQ;GACd,WAAW,QAAQ;GACnB,GAAI,aAAa,KAAA,IACb,CAAC,IACD,EACY,SAKZ;EACN,CAAC;CAEL;CACA,MAAM,+BAA+B;AACvC"}
|
|
@@ -63,7 +63,6 @@ var CoreOperationException = class extends Exception {
|
|
|
63
63
|
code;
|
|
64
64
|
operation;
|
|
65
65
|
retryable;
|
|
66
|
-
agentId;
|
|
67
66
|
limit;
|
|
68
67
|
limitMaximum;
|
|
69
68
|
nextAction;
|
|
@@ -75,7 +74,6 @@ var CoreOperationException = class extends Exception {
|
|
|
75
74
|
this.name = "CoreOperationException";
|
|
76
75
|
this.operation = options.operation;
|
|
77
76
|
this.retryable = OPERATION_ERROR_RETRYABILITY[options.code];
|
|
78
|
-
this.agentId = options.agentId ?? null;
|
|
79
77
|
this.limit = options.limit ?? null;
|
|
80
78
|
this.limitMaximum = options.limitMaximum ?? null;
|
|
81
79
|
this.nextAction = options.nextAction ?? null;
|
|
@@ -86,4 +84,4 @@ var CoreOperationException = class extends Exception {
|
|
|
86
84
|
//#endregion
|
|
87
85
|
export { isCoreOperationErrorCode as a, isCoreOperation as i, CoreOperationException as n, isCoreConfigurationErrorCode as r, CoreConfigurationException as t };
|
|
88
86
|
|
|
89
|
-
//# sourceMappingURL=exceptions-
|
|
87
|
+
//# sourceMappingURL=exceptions-CYf1pCKf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions-CYf1pCKf.js","names":[],"sources":["../../src/exceptions/index.ts"],"sourcesContent":["import { Exception } from 'error-message-utils';\n\n// stable configuration and operation failure codes\nexport type ICoreConfigurationErrorCode = 'INVALID_RESOURCE_LIMIT';\n\nexport type ICoreOperationErrorCode =\n | 'INVALID_ARGUMENT'\n | 'ABORTED'\n | 'RESOURCE_LIMIT_EXCEEDED'\n | 'INSPECTION_BUSY'\n | 'INSPECTION_TIMEOUT'\n | 'INSPECTION_PROCESS_FAILED'\n | 'CONTENT_INVALID';\n\nconst CORE_OPERATIONS = [\n 'create-core',\n 'normalize-text',\n 'calculate-content-digest',\n 'parse-manifest',\n 'match-manifest-scope',\n 'parse-decision',\n 'create-project-inspection',\n 'read-canonical-content-page',\n 'validate-project',\n] as const;\n\nexport type ICoreOperation = (typeof CORE_OPERATIONS)[number];\n\n// safe construction options for exported Core exceptions\nexport interface ICoreConfigurationExceptionOptions {\n readonly code: ICoreConfigurationErrorCode;\n readonly operation: ICoreOperation;\n readonly cause?: unknown;\n}\n\ninterface ICoreOperationExceptionOptionsBase {\n readonly operation: ICoreOperation;\n readonly cause?: unknown;\n}\n\n// logical budget refusals and verified isolated-worker heap exhaustion\nexport type ICoreResourceLimitNextAction =\n 'reduce-input-or-increase-limit' | 'review-inspection-capacity';\n\nexport type ICoreOperationExceptionOptions = ICoreOperationExceptionOptionsBase &\n (\n | {\n readonly code: 'RESOURCE_LIMIT_EXCEEDED';\n readonly limit: string;\n readonly limitMaximum: number;\n readonly nextAction: 'reduce-input-or-increase-limit';\n readonly observedUsage: number;\n }\n | {\n readonly code: 'RESOURCE_LIMIT_EXCEEDED';\n readonly limit: 'maxAnalysisHeapBytes';\n readonly limitMaximum: number;\n readonly nextAction: 'review-inspection-capacity';\n readonly observedUsage: null;\n }\n | {\n readonly code: 'RESOURCE_LIMIT_EXCEEDED';\n readonly limit: 'maxInspectionMessageBytes' | 'maxReaderRequests';\n readonly limitMaximum: number;\n readonly nextAction: null;\n readonly observedUsage: number;\n }\n | {\n readonly code: Exclude<ICoreOperationErrorCode, 'RESOURCE_LIMIT_EXCEEDED'>;\n readonly limit?: never;\n readonly limitMaximum?: never;\n readonly nextAction?: never;\n readonly observedUsage?: never;\n }\n );\n\nconst CONFIGURATION_ERROR_MESSAGES = {\n INVALID_RESOURCE_LIMIT: 'A Core resource limit is invalid.',\n} as const satisfies Readonly<Record<ICoreConfigurationErrorCode, string>>;\n\nconst OPERATION_ERROR_MESSAGES = {\n ABORTED: 'The Core operation was aborted.',\n CONTENT_INVALID: 'The canonical content is not valid UTF-8 text.',\n INVALID_ARGUMENT: 'The Core operation received an invalid argument.',\n INSPECTION_BUSY: 'Project inspection capacity is busy. Try again shortly.',\n INSPECTION_TIMEOUT: 'The isolated project inspection timed out.',\n INSPECTION_PROCESS_FAILED: 'The isolated project inspection failed.',\n RESOURCE_LIMIT_EXCEEDED: 'A Core resource limit was exceeded.',\n} as const satisfies Readonly<Record<ICoreOperationErrorCode, string>>;\n\nconst OPERATION_ERROR_RETRYABILITY = {\n ABORTED: true,\n CONTENT_INVALID: false,\n INVALID_ARGUMENT: false,\n INSPECTION_BUSY: true,\n INSPECTION_TIMEOUT: true,\n INSPECTION_PROCESS_FAILED: false,\n RESOURCE_LIMIT_EXCEEDED: false,\n} as const satisfies Readonly<Record<ICoreOperationErrorCode, boolean>>;\n\n/** Checks a transported operation against the authoritative Core operation set. */\nexport const isCoreOperation = (input: unknown): input is ICoreOperation =>\n CORE_OPERATIONS.some((operation) => operation === input);\n\n/** Checks a transported configuration code against the authoritative message registry. */\nexport const isCoreConfigurationErrorCode = (\n input: unknown,\n): input is ICoreConfigurationErrorCode =>\n typeof input === 'string' && Object.hasOwn(CONFIGURATION_ERROR_MESSAGES, input);\n\n/** Checks a transported operation code against the authoritative message registry. */\nexport const isCoreOperationErrorCode = (input: unknown): input is ICoreOperationErrorCode =>\n typeof input === 'string' && Object.hasOwn(OPERATION_ERROR_MESSAGES, input);\n\nconst attachCause = (exception: Error, cause: unknown): void => {\n if (cause === undefined) {\n return;\n }\n\n Object.defineProperty(exception, 'cause', {\n configurable: true,\n enumerable: false,\n value: cause,\n writable: false,\n });\n};\n\n/** Represents invalid immutable Core configuration. */\nexport class CoreConfigurationException extends Exception {\n public override readonly code: ICoreConfigurationErrorCode;\n\n public readonly operation: ICoreOperation;\n\n /** Creates a configuration exception with safe operation metadata. */\n public constructor(options: ICoreConfigurationExceptionOptions) {\n super(CONFIGURATION_ERROR_MESSAGES[options.code], options.code);\n this.code = options.code;\n this.name = 'CoreConfigurationException';\n this.operation = options.operation;\n attachCause(this, options.cause);\n }\n}\n\n/** Represents an operational failure that prevented Core from completing. */\nexport class CoreOperationException extends Exception {\n public override readonly code: ICoreOperationErrorCode;\n\n public readonly operation: ICoreOperation;\n\n public readonly retryable: boolean;\n\n public readonly limit: string | null;\n\n public readonly limitMaximum: number | null;\n\n public readonly nextAction: ICoreResourceLimitNextAction | null;\n\n public readonly observedUsage: number | null;\n\n /** Creates an operation exception with derived retry and safe scope metadata. */\n public constructor(options: ICoreOperationExceptionOptions) {\n super(OPERATION_ERROR_MESSAGES[options.code], options.code);\n this.code = options.code;\n this.name = 'CoreOperationException';\n this.operation = options.operation;\n this.retryable = OPERATION_ERROR_RETRYABILITY[options.code];\n this.limit = options.limit ?? null;\n this.limitMaximum = options.limitMaximum ?? null;\n this.nextAction = options.nextAction ?? null;\n this.observedUsage = options.observedUsage ?? null;\n attachCause(this, options.cause);\n }\n}\n"],"mappings":";;AAcA,IAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAoDA,IAAM,+BAA+B,EACnC,wBAAwB,oCAC1B;AAEA,IAAM,2BAA2B;CAC/B,SAAS;CACT,iBAAiB;CACjB,kBAAkB;CAClB,iBAAiB;CACjB,oBAAoB;CACpB,2BAA2B;CAC3B,yBAAyB;AAC3B;AAEA,IAAM,+BAA+B;CACnC,SAAS;CACT,iBAAiB;CACjB,kBAAkB;CAClB,iBAAiB;CACjB,oBAAoB;CACpB,2BAA2B;CAC3B,yBAAyB;AAC3B;;AAGA,IAAa,mBAAmB,UAC9B,gBAAgB,MAAM,cAAc,cAAc,KAAK;;AAGzD,IAAa,gCACX,UAEA,OAAO,UAAU,YAAY,OAAO,OAAO,8BAA8B,KAAK;;AAGhF,IAAa,4BAA4B,UACvC,OAAO,UAAU,YAAY,OAAO,OAAO,0BAA0B,KAAK;AAE5E,IAAM,eAAe,WAAkB,UAAyB;CAC9D,IAAI,UAAU,KAAA,GACZ;CAGF,OAAO,eAAe,WAAW,SAAS;EACxC,cAAc;EACd,YAAY;EACZ,OAAO;EACP,UAAU;CACZ,CAAC;AACH;;AAGA,IAAa,6BAAb,cAAgD,UAAU;CACxD;CAEA;;CAGA,YAAmB,SAA6C;EAC9D,MAAM,6BAA6B,QAAQ,OAAO,QAAQ,IAAI;EAC9D,KAAK,OAAO,QAAQ;EACpB,KAAK,OAAO;EACZ,KAAK,YAAY,QAAQ;EACzB,YAAY,MAAM,QAAQ,KAAK;CACjC;AACF;;AAGA,IAAa,yBAAb,cAA4C,UAAU;CACpD;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;;CAGA,YAAmB,SAAyC;EAC1D,MAAM,yBAAyB,QAAQ,OAAO,QAAQ,IAAI;EAC1D,KAAK,OAAO,QAAQ;EACpB,KAAK,OAAO;EACZ,KAAK,YAAY,QAAQ;EACzB,KAAK,YAAY,6BAA6B,QAAQ;EACtD,KAAK,QAAQ,QAAQ,SAAS;EAC9B,KAAK,eAAe,QAAQ,gBAAgB;EAC5C,KAAK,aAAa,QAAQ,cAAc;EACxC,KAAK,gBAAgB,QAAQ,iBAAiB;EAC9C,YAAY,MAAM,QAAQ,KAAK;CACjC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as encodeInspectionMessage, r as createInspectionProcessFailure, u as NODE_INSPECTION_TERMINATION_GRACE_MS } from "./errors-
|
|
1
|
+
import { a as encodeInspectionMessage, r as createInspectionProcessFailure, u as NODE_INSPECTION_TERMINATION_GRACE_MS } from "./errors-Dw1ahMS1.js";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
//#region src/node-inspection/lifecycle.ts
|
|
4
4
|
/** Serializes bounded IPC sends and waits for Node's send callback before admitting the next. */
|
|
@@ -64,4 +64,4 @@ var superviseInspectionChild = (child, requestStop) => {
|
|
|
64
64
|
//#endregion
|
|
65
65
|
export { createInspectionSender as n, superviseInspectionChild as r, createInspectionEnvironment as t };
|
|
66
66
|
|
|
67
|
-
//# sourceMappingURL=lifecycle-
|
|
67
|
+
//# sourceMappingURL=lifecycle-h3DWn5vl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-
|
|
1
|
+
{"version":3,"file":"lifecycle-h3DWn5vl.js","names":[],"sources":["../../src/node-inspection/lifecycle.ts"],"sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport process from 'node:process';\n\nimport { NODE_INSPECTION_TERMINATION_GRACE_MS } from './constants.js';\nimport { NODE_INSPECTION_MAX_REQUESTS } from './constants.js';\nimport { createInspectionProcessFailure, encodeInspectionMessage } from './protocol.js';\nimport type { INodeInspectionMessage } from './types.js';\n\n/** Serializes bounded IPC sends and waits for Node's send callback before admitting the next. */\nexport const createInspectionSender = (\n send: (frame: string, callback: (error: Error | null) => void) => void,\n): ((message: INodeInspectionMessage) => Promise<void>) => {\n let queued = 0;\n let tail = Promise.resolve();\n return async (message) => {\n if (queued >= NODE_INSPECTION_MAX_REQUESTS) throw createInspectionProcessFailure();\n queued++;\n const operation = tail.then(\n () =>\n new Promise<void>((resolve, reject) => {\n try {\n send(encodeInspectionMessage(message), (error) => {\n if (error !== null) reject(createInspectionProcessFailure(error));\n else resolve();\n });\n } catch (cause) {\n reject(cause instanceof Error ? cause : createInspectionProcessFailure(cause));\n }\n }),\n );\n tail = operation.catch(() => {});\n try {\n await operation;\n } finally {\n queued--;\n }\n };\n};\n\n/** Keeps only operating-system bootstrap variables; no credentials or Node overrides cross. */\nexport const createInspectionEnvironment = (): NodeJS.ProcessEnv => {\n const names = new Set(['systemroot', 'windir', 'temp', 'tmp', 'tmpdir']);\n return Object.fromEntries(\n Object.entries(process.env).filter(([name]) => names.has(name.toLowerCase())),\n );\n};\n\n/**\n * Supervises one owned child without PID polling, shell commands, or process-group killing.\n * @returns Idempotent termination and actual close notification.\n */\nexport const superviseInspectionChild = (\n child: ChildProcess,\n requestStop: () => void,\n): {\n closed: Promise<void>;\n terminate: () => void;\n} => {\n let hasClosed = false;\n let forceTimer: NodeJS.Timeout | undefined;\n const closed = new Promise<void>((resolve) => {\n child.once('close', () => {\n hasClosed = true;\n clearTimeout(forceTimer);\n resolve();\n });\n });\n return {\n closed,\n terminate: (): void => {\n if (hasClosed || forceTimer !== undefined) return;\n // Let the child close IPC. Local disconnect can suppress ChildProcess's close event.\n forceTimer = setTimeout(() => {\n if (!hasClosed) child.kill('SIGKILL');\n }, NODE_INSPECTION_TERMINATION_GRACE_MS);\n requestStop();\n },\n };\n};\n"],"mappings":";;;;AASA,IAAa,0BACX,SACyD;CACzD,IAAI,SAAS;CACb,IAAI,OAAO,QAAQ,QAAQ;CAC3B,OAAO,OAAO,YAAY;EACxB,IAAI,UAAA,GAAwC,MAAM,+BAA+B;EACjF;EACA,MAAM,YAAY,KAAK,WAEnB,IAAI,SAAe,SAAS,WAAW;GACrC,IAAI;IACF,KAAK,wBAAwB,OAAO,IAAI,UAAU;KAChD,IAAI,UAAU,MAAM,OAAO,+BAA+B,KAAK,CAAC;UAC3D,QAAQ;IACf,CAAC;GACH,SAAS,OAAO;IACd,OAAO,iBAAiB,QAAQ,QAAQ,+BAA+B,KAAK,CAAC;GAC/E;EACF,CAAC,CACL;EACA,OAAO,UAAU,YAAY,CAAC,CAAC;EAC/B,IAAI;GACF,MAAM;EACR,UAAU;GACR;EACF;CACF;AACF;;AAGA,IAAa,oCAAuD;CAClE,MAAM,wBAAQ,IAAI,IAAI;EAAC;EAAc;EAAU;EAAQ;EAAO;CAAQ,CAAC;CACvE,OAAO,OAAO,YACZ,OAAO,QAAQ,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,UAAU,MAAM,IAAI,KAAK,YAAY,CAAC,CAAC,CAC9E;AACF;;;;;AAMA,IAAa,4BACX,OACA,gBAIG;CACH,IAAI,YAAY;CAChB,IAAI;CAQJ,OAAO;EACL,QAAA,IARiB,SAAe,YAAY;GAC5C,MAAM,KAAK,eAAe;IACxB,YAAY;IACZ,aAAa,UAAU;IACvB,QAAQ;GACV,CAAC;EACH,CAEE;EACA,iBAAuB;GACrB,IAAI,aAAa,eAAe,KAAA,GAAW;GAE3C,aAAa,iBAAiB;IAC5B,IAAI,CAAC,WAAW,MAAM,KAAK,SAAS;GACtC,GAAG,oCAAoC;GACvC,YAAY;EACd;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as CoreOperationException, t as CoreConfigurationException } from "./exceptions-
|
|
1
|
+
import { n as CoreOperationException, t as CoreConfigurationException } from "./exceptions-CYf1pCKf.js";
|
|
2
2
|
import { isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
|
|
3
3
|
//#region src/constants/index.ts
|
|
4
4
|
var ACCEPTABLE_WARNING_CODES = Object.freeze([
|
|
@@ -193,12 +193,6 @@ var isRepositorySymbol = (value) => {
|
|
|
193
193
|
var isCanonicalMoldeaPath = (path) => {
|
|
194
194
|
return path === "/moldea" || path.startsWith("/moldea/");
|
|
195
195
|
};
|
|
196
|
-
/** Sorts repository references by path and then optional symbol. */
|
|
197
|
-
var sortRepositoryReferences = (references) => {
|
|
198
|
-
return [...references].sort((left, right) => {
|
|
199
|
-
return compareExactStrings(left.path, right.path) || compareExactStrings(left.symbol ?? "", right.symbol ?? "");
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
196
|
//#endregion
|
|
203
197
|
//#region src/immutable/index.ts
|
|
204
198
|
/**
|
|
@@ -599,6 +593,6 @@ var normalizeCoreOptions = (options) => {
|
|
|
599
593
|
return freezeRecursively({ limits: normalizeLimits(options?.["limits"]) });
|
|
600
594
|
};
|
|
601
595
|
//#endregion
|
|
602
|
-
export {
|
|
596
|
+
export { DEFAULT_CORE_RESOURCE_LIMITS as A, isSimpleGlob as C, parseManifestPath as D, parseDecisionIdFromPath as E, SUPPORTED_REPOSITORY_FORMAT_VERSIONS as M, trimRepositoryFormatWhitespace as O, isRuntimeGuidancePath as S, isVariableId as T, isDecisionPath as _, escapeJsonPointerSegment as a, isRepositorySymbol as b, freezeRecursively as c, hasNonWhitespace as d, hasUnsupportedGlobMetacharacter as f, isContextPath as g, isCapabilityDescription as h, createCoreDiagnosticCollector as i, RECOGNIZED_RUNTIME_IDS as j, ACCEPTABLE_WARNING_CODES as k, compareExactStrings as l, isCanonicalMoldeaPath as m, normalizeCoreOptions as n, normalizeDiagnostics as o, isCanonicalManifestPath as p, countDiagnosticsBySeverity as r, createNullPrototypeRecord as s, createCoreOperationOptionsSnapshot as t, countUnicodeScalars as u, isMirrorPath as v, isStableId as w, isReservedId as x, isNonEmptySingleLine as y };
|
|
603
597
|
|
|
604
|
-
//# sourceMappingURL=options-
|
|
598
|
+
//# sourceMappingURL=options-AMqX7rx_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-AMqX7rx_.js","names":[],"sources":["../../src/constants/index.ts","../../src/format-validation/index.ts","../../src/immutable/index.ts","../../src/diagnostic-utilities/index.ts","../../src/options/index.ts"],"sourcesContent":["import type { ICoreResourceLimits } from '../contracts/index.js';\nimport type { IRepositoryFormatVersion } from '../format/index.js';\n\n// warning codes whose findings may be explicitly accepted in the manifest\nexport const ACCEPTABLE_WARNING_CODES = Object.freeze([\n 'MOLDEA_IMPACT_PATTERN_UNMATCHED',\n 'MOLDEA_INTEGRATION_BLOCK_MISSING',\n 'MOLDEA_INTEGRATION_SKILL_MISSING',\n 'MOLDEA_INTEGRATION_BLOCK_STALE',\n] as const);\n\n// runtime labels selecting guidance without asserting SDK compatibility\nexport const RECOGNIZED_RUNTIME_IDS = Object.freeze([\n 'amazon-bedrock',\n 'anthropic',\n 'cerebras',\n 'claude-agent-sdk',\n 'cloudflare-agents',\n 'cohere',\n 'convex-agent',\n 'cursor-sdk',\n 'custom',\n 'deep-agents',\n 'eve',\n 'genkit',\n 'github-copilot-sdk',\n 'google-adk',\n 'google-genai',\n 'groq',\n 'hugging-face',\n 'ibm-watsonx-ai',\n 'langchain',\n 'langgraph',\n 'livekit-agents',\n 'mastra',\n 'microsoft-foundry',\n 'mistral',\n 'node-llama-cpp',\n 'ollama',\n 'openai',\n 'openai-agents-sdk',\n 'openai-codex',\n 'opencode-sdk',\n 'openrouter',\n 'pi-agent',\n 'strands-agents',\n 'tanstack-ai',\n 'vercel-ai-sdk',\n 'voltagent',\n] as const);\n\n// repository-format major versions interpreted by this Core release\nexport const SUPPORTED_REPOSITORY_FORMAT_VERSIONS: readonly IRepositoryFormatVersion[] =\n Object.freeze([1]);\n\n// default safety budgets applied independently to each Core operation\nexport const DEFAULT_CORE_RESOURCE_LIMITS: ICoreResourceLimits = Object.freeze({\n maxDiagnostics: 10_000,\n maxEntries: 100_000,\n maxCoverage: 10_000,\n maxAcceptedWarnings: 256,\n maxFileBytes: 8_388_608,\n maxManifestBytes: 2_097_152,\n maxRetainedBytes: 536_870_912,\n maxTotalBytesRead: 134_217_728,\n});\n","import { isRepositoryPath, parseRepositoryPath, type IRepositoryPath } from '@moldea.ai/repository';\n\nconst STABLE_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\nconst VARIABLE_ID_PATTERN = /^[A-Z][A-Z0-9_]*$/u;\nconst WINDOWS_RESERVED_ID_PATTERN = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/u;\nconst LINE_BREAK_CHARACTERS = ['\\n', '\\r', '\\u0085', '\\u2028', '\\u2029'] as const;\nconst UNSUPPORTED_GLOB_PATTERN = /[!?[\\]{}]/u;\n\nconst hasLineBreak = (value: string): boolean => {\n return LINE_BREAK_CHARACTERS.some((lineBreak) => value.includes(lineBreak));\n};\n\n/** Determines whether a code point belongs to the Repository Format version 1 whitespace set. */\nexport const isRepositoryFormatWhitespace = (codePoint: number): boolean => {\n return (\n (codePoint >= 0x0009 && codePoint <= 0x000d) ||\n codePoint === 0x0020 ||\n codePoint === 0x0085 ||\n codePoint === 0x00a0 ||\n codePoint === 0x1680 ||\n (codePoint >= 0x2000 && codePoint <= 0x200a) ||\n codePoint === 0x2028 ||\n codePoint === 0x2029 ||\n codePoint === 0x202f ||\n codePoint === 0x205f ||\n codePoint === 0x3000\n );\n};\n\n/** Compares strings by exact Unicode code-point order without locale behavior. */\nexport const compareExactStrings = (left: string, right: string): number => {\n const leftScalars = left[Symbol.iterator]();\n const rightScalars = right[Symbol.iterator]();\n\n while (true) {\n const leftScalar = leftScalars.next();\n const rightScalar = rightScalars.next();\n\n if (leftScalar.done === true) {\n return rightScalar.done === true ? 0 : -1;\n }\n\n if (rightScalar.done === true) {\n return 1;\n }\n\n const leftCodePoint = leftScalar.value.codePointAt(0) ?? 0;\n const rightCodePoint = rightScalar.value.codePointAt(0) ?? 0;\n\n if (leftCodePoint !== rightCodePoint) {\n return leftCodePoint < rightCodePoint ? -1 : 1;\n }\n }\n};\n\n/** Counts Unicode scalar values in valid JavaScript text. */\nexport const countUnicodeScalars = (value: string): number => {\n const scalars = value[Symbol.iterator]();\n let count = 0;\n\n while (scalars.next().done !== true) {\n count += 1;\n }\n\n return count;\n};\n\n/** Determines whether a JavaScript string contains only Unicode scalar values. */\nexport const isUnicodeScalarText = (value: string): boolean => {\n for (let index = 0; index < value.length; index += 1) {\n const codeUnit = value.charCodeAt(index);\n\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n if (index + 1 >= value.length) {\n return false;\n }\n\n const nextCodeUnit = value.charCodeAt(index + 1);\n\n if (nextCodeUnit < 0xdc00 || nextCodeUnit > 0xdfff) {\n return false;\n }\n\n index += 1;\n continue;\n }\n\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n return false;\n }\n }\n\n return true;\n};\n\n/** Determines whether a value contains at least one non-whitespace scalar. */\nexport const hasNonWhitespace = (value: string): boolean => {\n for (const scalar of value) {\n if (!isRepositoryFormatWhitespace(scalar.codePointAt(0) ?? 0)) {\n return true;\n }\n }\n\n return false;\n};\n\n/** Determines whether a value begins or ends with version 1 whitespace. */\nexport const hasSurroundingWhitespace = (value: string): boolean => {\n const firstCodePoint = value.codePointAt(0);\n const lastCodePoint = value.codePointAt(value.length - 1);\n\n return (\n (firstCodePoint !== undefined && isRepositoryFormatWhitespace(firstCodePoint)) ||\n (lastCodePoint !== undefined && isRepositoryFormatWhitespace(lastCodePoint))\n );\n};\n\n/** Removes only Repository Format version 1 whitespace from both edges. */\nexport const trimRepositoryFormatWhitespace = (value: string): string => {\n let start = 0;\n let end = value.length;\n\n while (start < end) {\n const codePoint = value.codePointAt(start);\n\n if (codePoint === undefined || !isRepositoryFormatWhitespace(codePoint)) {\n break;\n }\n\n start += codePoint > 0xffff ? 2 : 1;\n }\n\n while (end > start) {\n const codePoint = value.codePointAt(end - 1);\n\n if (codePoint === undefined || !isRepositoryFormatWhitespace(codePoint)) {\n break;\n }\n\n end -= 1;\n }\n\n return value.slice(start, end);\n};\n\n/** Determines whether a string is non-empty and contains no line break. */\nexport const isNonEmptySingleLine = (value: string): boolean => {\n return value.length > 0 && !hasLineBreak(value);\n};\n\n/** Determines whether a value satisfies stable moldea ID syntax. */\nexport const isStableId = (value: string): boolean => {\n return value.length <= 64 && STABLE_ID_PATTERN.test(value);\n};\n\n/** Determines whether an otherwise valid stable ID is filesystem-reserved. */\nexport const isReservedId = (value: string): boolean => WINDOWS_RESERVED_ID_PATTERN.test(value);\n\n/** Determines whether a value satisfies runtime-variable ID syntax. */\nexport const isVariableId = (value: string): boolean => {\n return value.length <= 64 && VARIABLE_ID_PATTERN.test(value);\n};\n\n/** Determines whether a parsed capability description satisfies version 1 limits. */\nexport const isCapabilityDescription = (value: string): boolean => {\n const scalarLength = countUnicodeScalars(value);\n\n return (\n scalarLength >= 1 &&\n scalarLength <= 1_000 &&\n !hasSurroundingWhitespace(value) &&\n !hasLineBreak(value) &&\n !value.includes('\\0') &&\n !value.includes('{{') &&\n !value.includes('}}')\n );\n};\n\n/** Parses a non-root repository-format logical path without throwing. */\nexport const parseManifestPath = (value: string): IRepositoryPath | null => {\n return value !== '/' && isRepositoryPath(value) ? parseRepositoryPath(value) : null;\n};\n\n/** Determines whether a path is the canonical manifest path. */\nexport const isCanonicalManifestPath = (path: IRepositoryPath): boolean => {\n return path === '/moldea/moldea.yaml';\n};\n\n/** Extracts the stable millisecond ID from one canonical immediate decision path. */\nexport const parseDecisionIdFromPath = (path: IRepositoryPath): string | null => {\n const match = /^\\/moldea\\/decisions\\/(\\d{13})-([a-z0-9]+(?:-[a-z0-9]+)*)\\.md$/u.exec(path);\n const id = match?.[1];\n const slug = match?.[2];\n\n return id !== undefined && slug !== undefined && isStableId(slug) ? id : null;\n};\n\n/** Determines whether a path is an allowed focused-context relationship key. */\nexport const isContextPath = (path: IRepositoryPath, allowProject: boolean): boolean => {\n if (allowProject && path === '/moldea/project.md') {\n return true;\n }\n\n return path.startsWith('/moldea/context/') && path.endsWith('.md');\n};\n\n/** Determines whether a path has the canonical immediate decision filename shape. */\nexport const isDecisionPath = (path: IRepositoryPath): boolean => {\n return parseDecisionIdFromPath(path) !== null;\n};\n\n/** Determines whether a path is canonical runtime guidance. */\nexport const isRuntimeGuidancePath = (path: IRepositoryPath): boolean => {\n return path.startsWith('/moldea/runtimes/') && path.endsWith('.md');\n};\n\n/** Determines whether a mirror path is outside canonical moldea content. */\nexport const isMirrorPath = (path: IRepositoryPath): boolean => {\n return path !== '/moldea' && !path.startsWith('/moldea/');\n};\n\n/** Determines whether an impact path contains prohibited glob metacharacters. */\nexport const hasUnsupportedGlobMetacharacter = (value: string): boolean => {\n return UNSUPPORTED_GLOB_PATTERN.test(value);\n};\n\n/** Determines whether a string satisfies the version 1 simple-glob grammar. */\nexport const isSimpleGlob = (value: string): boolean => {\n if (hasUnsupportedGlobMetacharacter(value) || value.includes('***')) {\n return false;\n }\n\n const segments = value.slice(1).split('/');\n\n if (segments.some((segment) => segment.includes('**') && segment !== '**')) {\n return false;\n }\n\n return value.includes('*') && isRepositoryPath(value.replaceAll('*', 'x'));\n};\n\n/** Determines whether a repository-reference symbol has the common safe shape. */\nexport const isRepositorySymbol = (value: string): boolean => {\n return isNonEmptySingleLine(value) && !value.includes('\\0');\n};\n\n/** Determines whether a canonical moldea reference incorrectly carries a symbol. */\nexport const isCanonicalMoldeaPath = (path: IRepositoryPath): boolean => {\n return path === '/moldea' || path.startsWith('/moldea/');\n};\n","/**\n * Recursively freezes a Core-owned value without cloning it.\n * @param value The detached acyclic value whose already-frozen objects are deeply frozen.\n * @returns The same value with every mutable reachable object frozen.\n */\nexport const freezeRecursively = <Value>(value: Value): Readonly<Value> => {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value;\n }\n\n for (const key of Reflect.ownKeys(value)) {\n const child = (value as Readonly<Record<PropertyKey, unknown>>)[key];\n freezeRecursively(child);\n }\n\n return Object.freeze(value);\n};\n\n/**\n * Creates a record that cannot collide with prototype-chain properties.\n * @param entries The own string-keyed entries to assign.\n * @returns A mutable null-prototype record for later normalization and freezing.\n */\nexport const createNullPrototypeRecord = <Value>(\n entries: Iterable<readonly [string, Value]>,\n): Record<string, Value> => {\n const record = Object.create(null) as Record<string, Value>;\n\n for (const [key, value] of entries) {\n record[key] = value;\n }\n\n return record;\n};\n","import type { IRepositoryPath } from '@moldea.ai/repository';\n\nimport { ACCEPTABLE_WARNING_CODES } from '../constants/index.js';\nimport type { ICoreResourceLimits } from '../contracts/index.js';\nimport type {\n ICoreDiagnostic,\n ICoreDiagnosticCode,\n IDiagnostic,\n IDiagnosticDetails,\n IDiagnosticEntity,\n ISourceRange,\n} from '../diagnostics/index.js';\nimport { CoreOperationException, type ICoreOperation } from '../exceptions/index.js';\nimport { compareExactStrings } from '../format-validation/index.js';\nimport { createNullPrototypeRecord, freezeRecursively } from '../immutable/index.js';\n\nconst CORE_DIAGNOSTIC_MESSAGES: Record<ICoreDiagnosticCode, string> = {\n MOLDEA_AGENT_DESCRIPTION_INVALID: 'The agent description is invalid.',\n MOLDEA_AGENT_DESCRIPTION_MISSING: 'The agent description is missing.',\n MOLDEA_AGENT_DIRECTORY_MISSING: 'The registered agent directory is missing.',\n MOLDEA_AGENT_DIRECTORY_UNREGISTERED: 'The agent directory is not registered.',\n MOLDEA_AGENT_HANDOFF_DESCRIPTION_INVALID: 'The agent handoff description is invalid.',\n MOLDEA_AGENT_IDENTITY_INVALID: 'The agent instruction identity is invalid.',\n MOLDEA_AGENT_INSTRUCTION_EMPTY: 'The agent instruction is empty.',\n MOLDEA_AGENT_INSTRUCTION_MISSING: 'The agent instruction is missing.',\n MOLDEA_CANONICAL_ASSET_SYMLINK: 'The canonical asset is a symlink.',\n MOLDEA_CANONICAL_PATH_UNRECOGNIZED: 'The canonical path is unrecognized.',\n MOLDEA_CAPABILITY_DESCRIPTION_INVALID: 'The capability description is invalid.',\n MOLDEA_CAPABILITY_DESCRIPTION_MISSING: 'The capability description is missing.',\n MOLDEA_CONTEXT_FILE_EMPTY: 'The focused context file is empty.',\n MOLDEA_CONTEXT_PATH_INVALID: 'The context relationship path is invalid.',\n MOLDEA_CONTEXT_RELATIONSHIP_EMPTY: 'The declared relationship has no bindings or impact paths.',\n MOLDEA_DECISION_BODY_EMPTY: 'The decision Markdown body is empty.',\n MOLDEA_DECISION_CREATED_AT_INVALID: 'The decision createdAt value is invalid.',\n MOLDEA_DECISION_FILENAME_INVALID: 'The decision path or filename is invalid.',\n MOLDEA_DECISION_FRONTMATTER_INVALID: 'The decision frontmatter is invalid.',\n MOLDEA_DECISION_FRONTMATTER_MISSING: 'The decision frontmatter or its delimiters are missing.',\n MOLDEA_DECISION_ID_DUPLICATE: 'The decision ID is duplicated.',\n MOLDEA_DECISION_PROPERTY_UNKNOWN: 'The decision frontmatter contains an unknown property.',\n MOLDEA_DECISION_REFERENCE_MISSING: 'The referenced decision does not exist.',\n MOLDEA_DECISION_RELATIONSHIP_INACTIVE: 'The referenced decision is not accepted.',\n MOLDEA_DECISION_SELF_SUPERSESSION: 'The decision supersedes itself.',\n MOLDEA_DECISION_STATUS_INVALID: 'The decision status is invalid.',\n MOLDEA_DECISION_SUPERSEDED_ORPHAN:\n 'The superseded decision has no active supersession relationship.',\n MOLDEA_DECISION_SUPERSESSION_CYCLE: 'The decision supersession graph contains a cycle.',\n MOLDEA_DECISION_SUPERSESSION_STATUS_INVALID:\n 'The decision supersession relationship has inconsistent statuses.',\n MOLDEA_DECISION_TIMESTAMP_MISMATCH:\n 'The decision filename timestamp and createdAt value do not match.',\n MOLDEA_ENTRY_TYPE_INVALID: 'The repository entry type is invalid.',\n MOLDEA_RUNTIME_ID_INVALID: 'The runtime ID is invalid.',\n MOLDEA_GLOB_INVALID: 'The impact pattern is invalid.',\n MOLDEA_ID_DUPLICATE: 'An ID is duplicated within its required scope.',\n MOLDEA_ID_INVALID: 'The ID is invalid.',\n MOLDEA_ID_RESERVED: 'The ID uses a reserved filesystem name.',\n MOLDEA_IMPACT_PATH_MISSING: 'The exact impact path does not exist.',\n MOLDEA_IMPACT_PATH_NOT_FILE: 'The exact impact path is not a regular file.',\n MOLDEA_MANIFEST_MISSING: 'The project manifest is missing.',\n MOLDEA_MANIFEST_PATH_INVALID: 'The manifest path is not the canonical manifest path.',\n MOLDEA_MANIFEST_PROPERTY_UNKNOWN: 'The manifest contains an unknown property.',\n MOLDEA_MANIFEST_ROOT_INVALID: 'The manifest root is not a mapping.',\n MOLDEA_MANIFEST_VALUE_INVALID: 'The manifest value is invalid.',\n MOLDEA_MANIFEST_VERSION_INVALID: 'The manifest version is not a valid integer major version.',\n MOLDEA_MANIFEST_VERSION_MISSING: 'The manifest version is missing.',\n MOLDEA_MANIFEST_VERSION_UNSUPPORTED: 'The manifest version is unsupported.',\n MOLDEA_MIRROR_PATH_DUPLICATE: 'The mirror path is assigned more than once.',\n MOLDEA_MIRROR_PATH_INSIDE_MOLDEA: 'The mirror path is inside /moldea.',\n MOLDEA_MIRROR_PATH_INVALID: 'The mirror path is invalid.',\n MOLDEA_MIRROR_MISSING: 'The declared mirror does not exist.',\n MOLDEA_MIRROR_NOT_FILE: 'The declared mirror is not a regular file.',\n MOLDEA_MIRROR_STALE: 'The declared mirror differs from its canonical instruction.',\n MOLDEA_MIRROR_SYMLINK: 'The declared mirror is a symlink.',\n MOLDEA_PATH_DUPLICATE: 'The path is duplicated.',\n MOLDEA_PATH_INVALID: 'The manifest logical path is invalid.',\n MOLDEA_PATTERN_DUPLICATE: 'The impact pattern is duplicated.',\n MOLDEA_PROJECT_FILE_EMPTY: 'The project file is empty.',\n MOLDEA_PROJECT_FILE_MISSING: 'The project file is missing.',\n MOLDEA_INTEGRATION_BLOCK_MISSING: 'The AGENTS.md moldea block is missing.',\n MOLDEA_INTEGRATION_SKILL_MISSING:\n 'The skill installation referenced by the AGENTS.md moldea block was not found.',\n MOLDEA_INTEGRATION_BLOCK_STALE: 'The AGENTS.md moldea block differs from its skill installation.',\n MOLDEA_IMPACT_PATTERN_UNMATCHED: 'The impact pattern matches no files.',\n MOLDEA_ACCEPTANCE_UNMATCHED: 'The warning acceptance matches no reported warning.',\n MOLDEA_REFERENCE_EXPORT_MISSING: 'The referenced export is missing.',\n MOLDEA_REFERENCE_MISSING: 'The referenced repository path does not exist.',\n MOLDEA_REFERENCE_NOT_FILE: 'The referenced repository path is not a regular file.',\n MOLDEA_REFERENCE_SYMLINK: 'The referenced repository path is a symlink.',\n MOLDEA_RUNTIME_GUIDANCE_EMPTY: 'The runtime guidance is empty.',\n MOLDEA_RUNTIME_GUIDANCE_MISSING: 'The referenced runtime guidance does not exist.',\n MOLDEA_SKILL_IMPLEMENTATION_MISSING: 'The registered skill implementation is missing.',\n MOLDEA_SYMBOL_FORBIDDEN: 'A canonical moldea reference must not include a symbol.',\n MOLDEA_SYMBOL_INVALID: 'The repository-reference symbol is invalid.',\n MOLDEA_TEXT_EMPTY: 'The required text document is empty.',\n MOLDEA_TEXT_INVALID_UNICODE:\n 'The text document contains an invalid Unicode scalar representation.',\n MOLDEA_TEXT_INVALID_UTF8: 'The text document is not valid UTF-8.',\n MOLDEA_TEXT_NUL_FORBIDDEN: 'The text document contains a forbidden NUL character.',\n MOLDEA_TOOL_IMPLEMENTATION_MISSING: 'The registered tool implementation is missing.',\n MOLDEA_VARIABLE_ID_INVALID: 'The runtime-variable ID is invalid.',\n MOLDEA_VARIABLE_PLACEHOLDER_MALFORMED:\n 'The agent instruction contains a malformed runtime-variable placeholder.',\n MOLDEA_VARIABLE_PROVIDER_UNDECLARED:\n 'A variable-provider binding exists for an undeclared variable.',\n MOLDEA_VARIABLE_UNDECLARED: 'The agent instruction references an undeclared runtime variable.',\n MOLDEA_VARIABLE_UNUSED: 'The declared runtime variable is unused by the agent instruction.',\n MOLDEA_YAML_DUPLICATE_KEY: 'The YAML document contains a duplicate mapping key.',\n MOLDEA_YAML_FEATURE_UNSUPPORTED: 'The YAML document uses an unsupported feature.',\n MOLDEA_YAML_MALFORMED: 'The YAML document is malformed.',\n MOLDEA_YAML_MULTIPLE_DOCUMENTS: 'The YAML stream contains more than one document.',\n};\n\nconst ENTITY_KEYS = [\n 'agentId',\n 'capabilityKind',\n 'capabilityId',\n 'decisionId',\n 'variableId',\n 'contextPath',\n 'integrationPath',\n] as const satisfies readonly (keyof IDiagnosticEntity)[];\n\n// private normalized diagnostic construction contracts\nexport interface ICoreDiagnosticInput {\n readonly code: ICoreDiagnosticCode;\n readonly details?: Readonly<Record<string, string | number | boolean | null>>;\n readonly entity?: IDiagnosticEntity | null;\n readonly path: IRepositoryPath | null;\n readonly pointer?: string | null;\n readonly range?: ISourceRange | null;\n readonly subject?: IRepositoryPath;\n readonly qualifier?: string | null;\n}\n\nexport interface ICoreDiagnosticCollector {\n add(input: ICoreDiagnosticInput): void;\n merge(input: ICoreDiagnosticInput): void;\n finalize(): readonly ICoreDiagnostic[];\n readonly size: number;\n}\n\ninterface ICoreDiagnosticBudget {\n count: number;\n}\n\nconst CORE_DIAGNOSTIC_BUDGET = Symbol('core-diagnostic-budget');\n\ntype ICoreOperationResourceLimits = ICoreResourceLimits & {\n readonly [CORE_DIAGNOSTIC_BUDGET]?: ICoreDiagnosticBudget;\n};\n\n/** Creates a detached limits view with one diagnostic budget for a complete Core operation. */\nexport const createCoreOperationResourceLimits = (\n limits: ICoreResourceLimits,\n): ICoreResourceLimits => {\n const operationLimits = limits as ICoreOperationResourceLimits;\n\n if (operationLimits[CORE_DIAGNOSTIC_BUDGET] !== undefined) {\n return limits;\n }\n\n return Object.freeze({\n ...limits,\n [CORE_DIAGNOSTIC_BUDGET]: { count: 0 },\n });\n};\n\n/** Registers raw diagnostics against the shared operation budget before normalization. */\nexport const registerCoreDiagnosticCandidates = (\n limits: ICoreResourceLimits,\n amount: number,\n operation: ICoreOperation,\n fallbackCount = 0,\n): number => {\n const budget = (limits as ICoreOperationResourceLimits)[CORE_DIAGNOSTIC_BUDGET];\n const currentCount = budget?.count ?? fallbackCount;\n\n if (amount > limits.maxDiagnostics - currentCount) {\n throw new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n limit: 'maxDiagnostics',\n limitMaximum: limits.maxDiagnostics,\n nextAction: 'reduce-input-or-increase-limit',\n observedUsage: currentCount + amount,\n operation,\n });\n }\n\n if (budget !== undefined) {\n budget.count += amount;\n }\n\n return fallbackCount + amount;\n};\n\nconst compareNullableStrings = (left: string | null, right: string | null): number => {\n if (left === null) {\n return right === null ? 0 : -1;\n }\n\n return right === null ? 1 : compareExactStrings(left, right);\n};\n\n/**\n * Normalizes trusted JSON-scalar diagnostic metadata.\n * @param details The optional detached metadata record.\n * @returns A frozen null-prototype record with canonical key order.\n */\nexport const normalizeDiagnosticDetails = (\n details: Readonly<Record<string, string | number | boolean | null>> | undefined,\n): IDiagnosticDetails => {\n const entries = Object.entries(details ?? {})\n .sort(([left], [right]) => compareExactStrings(left, right))\n .map(\n ([key, value]) =>\n [key, typeof value === 'number' && Object.is(value, -0) ? 0 : value] as const,\n );\n\n return freezeRecursively(createNullPrototypeRecord(entries));\n};\n\n/**\n * Normalizes a trusted diagnostic entity into canonical key order.\n * @param entity The optional diagnostic entity.\n * @returns The frozen normalized entity or `null`.\n */\nexport const normalizeDiagnosticEntity = (\n entity: IDiagnosticEntity | null | undefined,\n): IDiagnosticEntity | null => {\n if (entity === undefined || entity === null) {\n return null;\n }\n\n const entries = ENTITY_KEYS.flatMap((key) => {\n const value = entity[key];\n return value === undefined ? [] : ([[key, value]] as const);\n });\n\n return freezeRecursively(createNullPrototypeRecord(entries) as IDiagnosticEntity);\n};\n\n/** Serializes unordered diagnostic details with explicit exact-code-point key ordering. */\nexport const serializeDiagnosticDetails = (details: IDiagnosticDetails): string => {\n const entries = Object.entries(details).sort(([left], [right]) =>\n compareExactStrings(left, right),\n );\n\n return JSON.stringify(entries);\n};\n\nconst serializeDiagnostic = (diagnostic: IDiagnostic): string => {\n const entity =\n diagnostic.entity === null\n ? null\n : ENTITY_KEYS.map((key) => [key, diagnostic.entity?.[key] ?? null]);\n const range =\n diagnostic.range === null\n ? null\n : [\n diagnostic.range.start.line,\n diagnostic.range.start.column,\n diagnostic.range.start.offset,\n diagnostic.range.end.line,\n diagnostic.range.end.column,\n diagnostic.range.end.offset,\n ];\n\n return JSON.stringify([\n diagnostic.code,\n diagnostic.severity,\n diagnostic.severity === 'warning'\n ? [\n diagnostic.subject,\n diagnostic.qualifier,\n diagnostic.accepted ?? false,\n diagnostic.reason ?? null,\n ]\n : null,\n serializeDiagnosticDetails(diagnostic.details),\n entity,\n diagnostic.message,\n diagnostic.path,\n diagnostic.pointer,\n range,\n diagnostic.source,\n ]);\n};\n\nconst compareRanges = (left: ISourceRange | null, right: ISourceRange | null): number => {\n if (left === null) {\n return right === null ? 0 : -1;\n }\n\n if (right === null) {\n return 1;\n }\n\n return (\n left.start.line - right.start.line ||\n left.start.column - right.start.column ||\n left.start.offset - right.start.offset ||\n left.end.line - right.end.line ||\n left.end.column - right.end.column ||\n left.end.offset - right.end.offset\n );\n};\n\nconst readEntityValue = (\n entity: IDiagnosticEntity | null,\n key: keyof IDiagnosticEntity,\n): string => {\n return entity?.[key] ?? '';\n};\n\nconst compareDiagnostics = (left: IDiagnostic, right: IDiagnostic): number => {\n return (\n compareNullableStrings(left.path, right.path) ||\n compareRanges(left.range, right.range) ||\n compareNullableStrings(left.pointer, right.pointer) ||\n compareExactStrings(left.source, right.source) ||\n compareExactStrings(left.code, right.code) ||\n compareExactStrings(left.severity, right.severity) ||\n compareExactStrings(\n left.severity === 'warning'\n ? JSON.stringify([\n left.subject,\n left.qualifier,\n left.accepted ?? false,\n left.reason ?? null,\n ])\n : '',\n right.severity === 'warning'\n ? JSON.stringify([\n right.subject,\n right.qualifier,\n right.accepted ?? false,\n right.reason ?? null,\n ])\n : '',\n ) ||\n compareExactStrings(\n readEntityValue(left.entity, 'agentId'),\n readEntityValue(right.entity, 'agentId'),\n ) ||\n compareExactStrings(\n readEntityValue(left.entity, 'capabilityKind'),\n readEntityValue(right.entity, 'capabilityKind'),\n ) ||\n compareExactStrings(\n readEntityValue(left.entity, 'capabilityId'),\n readEntityValue(right.entity, 'capabilityId'),\n ) ||\n compareExactStrings(\n readEntityValue(left.entity, 'decisionId'),\n readEntityValue(right.entity, 'decisionId'),\n ) ||\n compareExactStrings(\n readEntityValue(left.entity, 'variableId'),\n readEntityValue(right.entity, 'variableId'),\n ) ||\n compareExactStrings(\n readEntityValue(left.entity, 'contextPath'),\n readEntityValue(right.entity, 'contextPath'),\n ) ||\n compareExactStrings(\n readEntityValue(left.entity, 'integrationPath'),\n readEntityValue(right.entity, 'integrationPath'),\n ) ||\n compareExactStrings(\n serializeDiagnosticDetails(left.details),\n serializeDiagnosticDetails(right.details),\n ) ||\n compareExactStrings(left.message, right.message)\n );\n};\n\n/** Classifies every catalog code by its documented validation responsibility. */\nconst getDiagnosticGroup = (code: ICoreDiagnosticCode): ICoreDiagnostic['group'] => {\n if (code.startsWith('MOLDEA_INTEGRATION_')) return 'integration';\n if (code.startsWith('MOLDEA_MIRROR_')) return 'mirrors';\n if (/^MOLDEA_(REFERENCE|IMPACT|SYMBOL|CONTEXT|DECISION|RUNTIME_GUIDANCE)_/.test(code))\n return 'references';\n if (code === 'MOLDEA_VARIABLE_ID_INVALID') return 'manifest';\n if (/^MOLDEA_(AGENT|VARIABLE|CAPABILITY|TOOL|SKILL|RUNTIME)_/.test(code)) return 'agents';\n if (/^MOLDEA_(MANIFEST_MISSING|PROJECT_FILE|ENTRY_TYPE|CANONICAL|TEXT)_/.test(code))\n return 'discovery';\n return 'manifest';\n};\n\n/**\n * Creates one normalized, immutable Core diagnostic.\n * @param input The trusted Core-owned diagnostic fields to normalize.\n * @returns A deeply immutable public diagnostic value.\n */\nexport const createCoreDiagnostic = (input: ICoreDiagnosticInput): ICoreDiagnostic => {\n const message = CORE_DIAGNOSTIC_MESSAGES[input.code];\n\n if (message === undefined) {\n throw new TypeError('The requested Core diagnostic is not implemented.');\n }\n\n const base = {\n code: input.code,\n details: normalizeDiagnosticDetails(input.details),\n entity: normalizeDiagnosticEntity(input.entity),\n message,\n path: input.path,\n pointer: input.pointer ?? null,\n range: input.range ?? null,\n group: getDiagnosticGroup(input.code),\n source: 'core' as const,\n };\n if (\n input.code === 'MOLDEA_IMPACT_PATTERN_UNMATCHED' ||\n input.code === 'MOLDEA_ACCEPTANCE_UNMATCHED' ||\n input.code === 'MOLDEA_INTEGRATION_BLOCK_MISSING' ||\n input.code === 'MOLDEA_INTEGRATION_SKILL_MISSING' ||\n input.code === 'MOLDEA_INTEGRATION_BLOCK_STALE'\n ) {\n if (input.subject === undefined) throw new TypeError('A warning subject is required.');\n return freezeRecursively({\n ...base,\n code: input.code,\n severity: 'warning' as const,\n subject: input.subject,\n qualifier: input.qualifier ?? null,\n acceptable: ACCEPTABLE_WARNING_CODES.some((code) => code === input.code),\n });\n }\n return freezeRecursively({ ...base, code: input.code, severity: 'error' as const });\n};\n\n/**\n * Deduplicates and sorts already-normalized Core diagnostics.\n * @param candidates The immutable diagnostics to combine.\n * @returns A frozen deterministic diagnostic collection.\n */\nexport const normalizeDiagnostics = (\n candidates: readonly IDiagnostic[],\n): readonly IDiagnostic[] => {\n const diagnostics = new Map<string, IDiagnostic>();\n\n for (const diagnostic of candidates) {\n const key = serializeDiagnostic(diagnostic);\n\n if (diagnostics.has(key)) {\n continue;\n }\n\n diagnostics.set(key, diagnostic);\n }\n\n return freezeRecursively([...diagnostics.values()].sort(compareDiagnostics));\n};\n\n/** Counts the complete normalized diagnostic result by severity once. */\nexport const countDiagnosticsBySeverity = (\n diagnostics: readonly IDiagnostic[],\n): {\n readonly errorCount: number;\n readonly warningCount: number;\n readonly acceptedWarningCount: number;\n readonly diagnosticCount: number;\n} => {\n let errorCount = 0;\n let warningCount = 0;\n let acceptedWarningCount = 0;\n\n for (const diagnostic of diagnostics) {\n if (diagnostic.severity === 'error') {\n errorCount += 1;\n } else if (diagnostic.accepted === true) {\n acceptedWarningCount += 1;\n } else {\n warningCount += 1;\n }\n }\n\n return { errorCount, warningCount, acceptedWarningCount, diagnosticCount: diagnostics.length };\n};\n\n/**\n * Creates a deterministic, deduplicating diagnostic collector for one operation.\n * @param limits The Core resource limits governing diagnostic output.\n * @param operation The operation reported by resource failures.\n * @returns A collector that freezes and sorts its final diagnostic array.\n */\nexport const createCoreDiagnosticCollector = (\n limits: ICoreResourceLimits,\n operation: ICoreOperation,\n): ICoreDiagnosticCollector => {\n const diagnostics = new Map<string, ICoreDiagnostic>();\n let proposalCount = 0;\n let fallbackRawCount = 0;\n\n const retain = (input: ICoreDiagnosticInput): void => {\n const diagnostic = createCoreDiagnostic(input);\n const key = serializeDiagnostic(diagnostic);\n\n proposalCount += 1;\n\n if (!diagnostics.has(key)) {\n diagnostics.set(key, diagnostic);\n }\n };\n\n return {\n add: (input): void => {\n fallbackRawCount = registerCoreDiagnosticCandidates(limits, 1, operation, fallbackRawCount);\n retain(input);\n },\n merge: retain,\n finalize: (): readonly ICoreDiagnostic[] => normalizeDiagnostics([...diagnostics.values()]),\n get size(): number {\n return proposalCount;\n },\n };\n};\n\n/**\n * Escapes one JSON Pointer reference token.\n * @param value The decoded mapping key or array index token.\n * @returns The RFC 6901 escaped token.\n */\nexport const escapeJsonPointerSegment = (value: string): string => {\n return value.replaceAll('~', '~0').replaceAll('/', '~1');\n};\n","import { DEFAULT_CORE_RESOURCE_LIMITS } from '../constants/index.js';\nimport type { ICoreOptions, ICoreResourceLimits } from '../contracts/index.js';\nimport { createCoreOperationResourceLimits } from '../diagnostic-utilities/index.js';\nimport { CoreConfigurationException } from '../exceptions/index.js';\nimport { freezeRecursively } from '../immutable/index.js';\n\n// complete immutable Core configuration\nexport interface ICoreOptionsSnapshot {\n readonly limits: ICoreResourceLimits;\n}\n\n/** Creates an operation-local options view with one shared raw-diagnostic budget. */\nexport const createCoreOperationOptionsSnapshot = (\n options: ICoreOptionsSnapshot,\n): ICoreOptionsSnapshot => {\n return Object.freeze({\n limits: createCoreOperationResourceLimits(options.limits),\n });\n};\n\nconst RESOURCE_LIMIT_KEYS = [\n 'maxEntries',\n 'maxTotalBytesRead',\n 'maxFileBytes',\n 'maxManifestBytes',\n 'maxRetainedBytes',\n 'maxDiagnostics',\n 'maxCoverage',\n 'maxAcceptedWarnings',\n] as const satisfies readonly (keyof ICoreResourceLimits)[];\n\nconst isRecord = (value: unknown): value is Readonly<Record<string, unknown>> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n};\n\n/**\n * Validates, copies, fills, and freezes all configured resource limits.\n * @param candidate The untrusted optional limit overrides.\n * @returns The complete frozen resource limits.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n */\nconst normalizeLimits = (candidate: unknown): ICoreResourceLimits => {\n if (candidate === undefined) {\n return DEFAULT_CORE_RESOURCE_LIMITS;\n }\n\n if (!isRecord(candidate)) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n const knownKeys = new Set<string>(RESOURCE_LIMIT_KEYS);\n\n if (Object.keys(candidate).some((key) => !knownKeys.has(key))) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n const normalized: ICoreResourceLimits = {\n ...DEFAULT_CORE_RESOURCE_LIMITS,\n };\n\n for (const key of RESOURCE_LIMIT_KEYS) {\n const value = candidate[key];\n\n if (value === undefined) {\n continue;\n }\n\n if (!Number.isSafeInteger(value) || (value as number) <= 0) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n\n (normalized as Record<keyof ICoreResourceLimits, number>)[key] = value as number;\n }\n\n return freezeRecursively(normalized);\n};\n\n/**\n * Validates and snapshots caller-owned Core resource limits.\n * @returns A deeply frozen configuration snapshot.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n */\nexport const normalizeCoreOptions = (options: ICoreOptions | undefined): ICoreOptionsSnapshot => {\n if (\n options !== undefined &&\n (!isRecord(options) || Reflect.ownKeys(options).some((key) => key !== 'limits'))\n ) {\n throw new CoreConfigurationException({\n code: 'INVALID_RESOURCE_LIMIT',\n operation: 'create-core',\n });\n }\n return freezeRecursively({ limits: normalizeLimits(options?.['limits']) });\n};\n"],"mappings":";;;AAIA,IAAa,2BAA2B,OAAO,OAAO;CACpD;CACA;CACA;CACA;AACF,CAAU;AAGV,IAAa,yBAAyB,OAAO,OAAO;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAU;AAGV,IAAa,uCACX,OAAO,OAAO,CAAC,CAAC,CAAC;AAGnB,IAAa,+BAAoD,OAAO,OAAO;CAC7E,gBAAgB;CAChB,YAAY;CACZ,aAAa;CACb,qBAAqB;CACrB,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;AACrB,CAA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AAS,EAAE,CAAC;AAC3E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./errors-
|
|
1
|
+
import "./errors-Dw1ahMS1.js";
|
|
2
2
|
import { RepositorySourceException, isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
|
|
3
3
|
import { Buffer } from "node:buffer";
|
|
4
4
|
//#region src/node-inspection/repository-rpc.ts
|
|
@@ -121,4 +121,4 @@ var executeRepositoryRpc = async (reader, request, signal) => {
|
|
|
121
121
|
//#endregion
|
|
122
122
|
export { parseRpcFilePage as i, parseRpcEntry as n, parseRpcEntryPage as r, executeRepositoryRpc as t };
|
|
123
123
|
|
|
124
|
-
//# sourceMappingURL=repository-rpc-
|
|
124
|
+
//# sourceMappingURL=repository-rpc-ClAIx3-c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-rpc-
|
|
1
|
+
{"version":3,"file":"repository-rpc-ClAIx3-c.js","names":[],"sources":["../../src/node-inspection/repository-rpc.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport {\n isRepositoryPath,\n parseRepositoryPath,\n RepositorySourceException,\n type IRepositoryEntry,\n type IRepositoryEntryPage,\n type IRepositoryFilePage,\n type IRepositoryReader,\n type IRepositorySnapshot,\n} from '@moldea.ai/repository';\n\nimport { NODE_INSPECTION_FILE_PAGE_BYTES } from './constants.js';\nimport type { INodeReaderRequest } from './types.js';\n\nconst invalidSource = (): never => {\n throw new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'create-reader',\n path: null,\n retryable: false,\n });\n};\nconst isRecord = (input: unknown): input is Record<string, unknown> =>\n input !== null && typeof input === 'object' && !Array.isArray(input);\nconst isInteger = (input: unknown): input is number =>\n typeof input === 'number' && Number.isSafeInteger(input) && input >= 0;\nconst keysMatch = (input: Record<string, unknown>, keys: string[]): boolean =>\n Object.keys(input).length === keys.length && keys.every((key) => Object.hasOwn(input, key));\n\n/** Validates the immutable source identity without coercing unknown boundary fields. */\nconst parseSnapshot = (input: unknown): IRepositorySnapshot => {\n if (\n !isRecord(input) ||\n !keysMatch(input, ['id', 'sourceKind']) ||\n typeof input['id'] !== 'string' ||\n input['id'].length === 0 ||\n typeof input['sourceKind'] !== 'string' ||\n input['sourceKind'].length === 0\n )\n return invalidSource();\n return { id: input['id'], sourceKind: input['sourceKind'] };\n};\n\n/** Converts one validated metadata-only repository entry. */\nexport const parseRpcEntry = (input: unknown): IRepositoryEntry | null => {\n if (input === null) return null;\n if (\n !isRecord(input) ||\n !keysMatch(input, ['path', 'type', 'byteLength', 'contentIdentity']) ||\n !isRepositoryPath(input['path']) ||\n (input['type'] !== 'file' && input['type'] !== 'directory' && input['type'] !== 'symlink') ||\n (input['byteLength'] !== null && !isInteger(input['byteLength'])) ||\n (input['contentIdentity'] !== null && typeof input['contentIdentity'] !== 'string')\n )\n return invalidSource();\n return {\n path: input['path'],\n type: input['type'],\n byteLength: input['byteLength'],\n contentIdentity: input['contentIdentity'],\n };\n};\n\n/** Converts a bounded listing page while retaining snapshot and continuation contracts. */\nexport const parseRpcEntryPage = (input: unknown): IRepositoryEntryPage => {\n if (\n !isRecord(input) ||\n !keysMatch(input, ['entries', 'isComplete', 'nextCursor', 'snapshot']) ||\n !Array.isArray(input['entries']) ||\n input['entries'].length > 128 ||\n typeof input['isComplete'] !== 'boolean' ||\n (input['nextCursor'] !== null && typeof input['nextCursor'] !== 'string')\n )\n return invalidSource();\n const entries: IRepositoryEntry[] = [];\n for (const candidate of input['entries']) {\n const entry = parseRpcEntry(candidate);\n if (entry === null) return invalidSource();\n entries.push(entry);\n }\n return {\n entries,\n isComplete: input['isComplete'],\n nextCursor: input['nextCursor'],\n snapshot: parseSnapshot(input['snapshot']),\n };\n};\n\n/** Decodes only an admitted 64 KiB binary page, never a complete repository file. */\nexport const parseRpcFilePage = (input: unknown): IRepositoryFilePage => {\n if (\n !isRecord(input) ||\n !keysMatch(input, ['bytes', 'isComplete', 'nextOffset', 'offset', 'snapshot', 'totalBytes']) ||\n typeof input['bytes'] !== 'string' ||\n input['bytes'].length > Math.ceil(NODE_INSPECTION_FILE_PAGE_BYTES / 3) * 4 ||\n !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(input['bytes']) ||\n typeof input['isComplete'] !== 'boolean' ||\n !isInteger(input['offset']) ||\n !isInteger(input['totalBytes']) ||\n (input['nextOffset'] !== null && !isInteger(input['nextOffset']))\n )\n return invalidSource();\n const bytes = Buffer.from(input['bytes'], 'base64');\n if (\n bytes.byteLength > NODE_INSPECTION_FILE_PAGE_BYTES ||\n bytes.toString('base64') !== input['bytes']\n )\n return invalidSource();\n return {\n bytes,\n isComplete: input['isComplete'],\n nextOffset: input['nextOffset'],\n offset: input['offset'],\n snapshot: parseSnapshot(input['snapshot']),\n totalBytes: input['totalBytes'],\n };\n};\n\n/**\n * Calls the real reader with inspection cancellation and returns a bounded transport value.\n * Reader failures propagate unchanged to the parent inspection owner.\n * @returns A metadata value or encoded byte page after actual reader settlement.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_FILE: The requested repository entry is not a file.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\n * - INVALID_PAGE_REQUEST: The repository page request is invalid.\n * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.\n * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\nexport const executeRepositoryRpc = async (\n reader: IRepositoryReader,\n request: INodeReaderRequest,\n signal: AbortSignal,\n): Promise<unknown> => {\n if (request.method === 'getEntry')\n return parseRpcEntry(await reader.getEntry(parseRepositoryPath(request.path), { signal }));\n if (request.method === 'listEntriesPage')\n return parseRpcEntryPage(\n await reader.listEntriesPage({\n maxEntries: request.maxEntries,\n signal,\n ...(request.prefix === undefined ? {} : { prefix: parseRepositoryPath(request.prefix) }),\n ...(request.cursor === undefined ? {} : { cursor: request.cursor }),\n }),\n );\n const page = await reader.readFilePage(parseRepositoryPath(request.path), {\n maxBytes: request.maxBytes,\n offset: request.offset,\n signal,\n });\n if (!(page.bytes instanceof Uint8Array) || page.bytes.byteLength > request.maxBytes)\n return invalidSource();\n const result = {\n ...page,\n bytes: Buffer.from(page.bytes.buffer, page.bytes.byteOffset, page.bytes.byteLength).toString(\n 'base64',\n ),\n };\n parseRpcFilePage(result);\n return result;\n};\n"],"mappings":";;;;AAgBA,IAAM,sBAA6B;CACjC,MAAM,IAAI,0BAA0B;EAClC,MAAM;EACN,WAAW;EACX,MAAM;EACN,WAAW;CACb,CAAC;AACH;AACA,IAAM,YAAY,UAChB,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE,IAAM,aAAa,UACjB,OAAO,UAAU,YAAY,OAAO,cAAc,KAAK,KAAK,SAAS;AACvE,IAAM,aAAa,OAAgC,SACjD,OAAO,KAAK,KAAK,CAAC,CAAC,WAAW,KAAK,UAAU,KAAK,OAAO,QAAQ,OAAO,OAAO,OAAO,GAAG,CAAC;;AAG5F,IAAM,iBAAiB,UAAwC;CAC7D,IACE,CAAC,SAAS,KAAK,KACf,CAAC,UAAU,OAAO,CAAC,MAAM,YAAY,CAAC,KACtC,OAAO,MAAM,UAAU,YACvB,MAAM,KAAK,CAAC,WAAW,KACvB,OAAO,MAAM,kBAAkB,YAC/B,MAAM,aAAa,CAAC,WAAW,GAE/B,OAAO,cAAc;CACvB,OAAO;EAAE,IAAI,MAAM;EAAO,YAAY,MAAM;CAAc;AAC5D;;AAGA,IAAa,iBAAiB,UAA4C;CACxE,IAAI,UAAU,MAAM,OAAO;CAC3B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-
import {
|
|
2
|
-
import { n as CoreOperationException } from "./exceptions-
|
|
1
|
+
import { C as isSimpleGlob, D as parseManifestPath, S as isRuntimeGuidancePath, T as isVariableId, _ as isDecisionPath, a as escapeJsonPointerSegment, b as isRepositorySymbol, c as freezeRecursively, d as hasNonWhitespace, f as hasUnsupportedGlobMetacharacter, g as isContextPath, h as isCapabilityDescription, i as createCoreDiagnosticCollector, j as RECOGNIZED_RUNTIME_IDS, k as ACCEPTABLE_WARNING_CODES, l as compareExactStrings, m as isCanonicalMoldeaPath, p as isCanonicalManifestPath, s as createNullPrototypeRecord, t as createCoreOperationOptionsSnapshot, u as countUnicodeScalars$1, v as isMirrorPath, w as isStableId, x as isReservedId, y as isNonEmptySingleLine } from "./options-AMqX7rx_.js";
|
|
2
|
+
import { n as CoreOperationException } from "./exceptions-CYf1pCKf.js";
|
|
3
3
|
import { parseRepositoryPath } from "@moldea.ai/repository";
|
|
4
4
|
import { Parser, isAlias, isMap, isScalar, isSeq, parseAllDocuments } from "yaml";
|
|
5
5
|
//#region src/text/index.ts
|
|
@@ -368,11 +368,11 @@ var addExactDeclaration = (declarations, owner, field, pointer, reference) => {
|
|
|
368
368
|
pointer
|
|
369
369
|
});
|
|
370
370
|
};
|
|
371
|
-
/** Adds
|
|
371
|
+
/** Adds repository references with their authored declaration pointers. */
|
|
372
372
|
var addReferenceDeclarations = (declarations, references, owner, field, pointer) => {
|
|
373
373
|
for (const [index, reference] of (references ?? []).entries()) addExactDeclaration(declarations, owner, field, childPointer$1(pointer, String(index)), reference);
|
|
374
374
|
};
|
|
375
|
-
/** Adds exact and simple-glob impact relationships in
|
|
375
|
+
/** Adds exact and simple-glob impact relationships in authored array order. */
|
|
376
376
|
var addAffectedByDeclarations = (declarations, affectedBy, owner, pointer) => {
|
|
377
377
|
for (const [index, pattern] of (affectedBy ?? []).entries()) declarations.push({
|
|
378
378
|
declaration: pattern.includes("*") ? {
|
|
@@ -738,7 +738,7 @@ var readReferenceList = (node, pointer, context, entity = null) => {
|
|
|
738
738
|
seen.add(key);
|
|
739
739
|
references.push(reference);
|
|
740
740
|
});
|
|
741
|
-
return
|
|
741
|
+
return references;
|
|
742
742
|
};
|
|
743
743
|
var readAffectedBy = (node, pointer, context, entity = null) => {
|
|
744
744
|
if (node.kind !== "sequence" || node.items.length === 0) {
|
|
@@ -777,7 +777,7 @@ var readAffectedBy = (node, pointer, context, entity = null) => {
|
|
|
777
777
|
seen.add(item.value);
|
|
778
778
|
values.push(item.value);
|
|
779
779
|
});
|
|
780
|
-
return values
|
|
780
|
+
return values;
|
|
781
781
|
};
|
|
782
782
|
var readRelationship = (node, pointer, context) => {
|
|
783
783
|
const entries = readMapping(node, pointer, /* @__PURE__ */ new Set(["affectedBy", "bindings"]), context);
|
|
@@ -1824,4 +1824,4 @@ var matchManifestScope = async (input, options) => {
|
|
|
1824
1824
|
//#endregion
|
|
1825
1825
|
export { createSourceLocator as a, calculateContentDigest as c, parseStrictYaml as i, calculateNormalizedTextDigest as l, inspectManifestDocument as n, collectManifestScopeDeclarations as o, parseManifestDocument as r, matchesRepositoryGlob as s, matchManifestScope as t, normalizeTextDocument as u };
|
|
1826
1826
|
|
|
1827
|
-
//# sourceMappingURL=scope-
|
|
1827
|
+
//# sourceMappingURL=scope-DxhC1hq2.js.map
|