@moldea.ai/core 5.0.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +12 -11
  2. package/dist/analysis-worker.js +180 -0
  3. package/dist/analysis-worker.js.map +1 -0
  4. package/dist/binding-coverage/index.d.ts +26 -0
  5. package/dist/binding-coverage/index.d.ts.map +1 -0
  6. package/dist/chunks/core-Cdeiu6xG.js +3364 -0
  7. package/dist/chunks/core-Cdeiu6xG.js.map +1 -0
  8. package/dist/chunks/errors-BE4DS3Ak.js +435 -0
  9. package/dist/chunks/errors-BE4DS3Ak.js.map +1 -0
  10. package/dist/chunks/{exceptions-HS9ofVy2.js → exceptions-IXsorE8t.js} +27 -28
  11. package/dist/chunks/exceptions-IXsorE8t.js.map +1 -0
  12. package/dist/chunks/lifecycle-D_RvxhDC.js +67 -0
  13. package/dist/chunks/lifecycle-D_RvxhDC.js.map +1 -0
  14. package/dist/chunks/options-5x9gu2Qb.js +604 -0
  15. package/dist/chunks/options-5x9gu2Qb.js.map +1 -0
  16. package/dist/chunks/repository-rpc-B_y0Kspf.js +124 -0
  17. package/dist/chunks/repository-rpc-B_y0Kspf.js.map +1 -0
  18. package/dist/chunks/scope-AGMcHUE_.js +1827 -0
  19. package/dist/chunks/scope-AGMcHUE_.js.map +1 -0
  20. package/dist/chunks/syntax-CVvExx4R.js +137 -0
  21. package/dist/chunks/syntax-CVvExx4R.js.map +1 -0
  22. package/dist/constants/index.d.ts +2 -1
  23. package/dist/constants/index.d.ts.map +1 -1
  24. package/dist/contracts/index.d.ts +37 -27
  25. package/dist/contracts/index.d.ts.map +1 -1
  26. package/dist/core/index.d.ts +1 -4
  27. package/dist/core/index.d.ts.map +1 -1
  28. package/dist/decision/index.d.ts +1 -1
  29. package/dist/decision-graph/index.d.ts +9 -7
  30. package/dist/decision-graph/index.d.ts.map +1 -1
  31. package/dist/diagnostic-utilities/index.d.ts +6 -2
  32. package/dist/diagnostic-utilities/index.d.ts.map +1 -1
  33. package/dist/diagnostics/index.d.ts +21 -33
  34. package/dist/diagnostics/index.d.ts.map +1 -1
  35. package/dist/exceptions/index.d.ts +25 -10
  36. package/dist/exceptions/index.d.ts.map +1 -1
  37. package/dist/export-inventory/index.d.ts +3 -0
  38. package/dist/export-inventory/index.d.ts.map +1 -0
  39. package/dist/export-inventory/inventory.d.ts +22 -0
  40. package/dist/export-inventory/inventory.d.ts.map +1 -0
  41. package/dist/export-inventory/syntax.d.ts +4 -0
  42. package/dist/export-inventory/syntax.d.ts.map +1 -0
  43. package/dist/export-inventory/types.d.ts +9 -0
  44. package/dist/export-inventory/types.d.ts.map +1 -0
  45. package/dist/format/index.d.ts +8 -0
  46. package/dist/format/index.d.ts.map +1 -1
  47. package/dist/impact-pattern-validation/index.d.ts +2 -0
  48. package/dist/impact-pattern-validation/index.d.ts.map +1 -0
  49. package/dist/impact-pattern-validation/inspection.d.ts +24 -0
  50. package/dist/impact-pattern-validation/inspection.d.ts.map +1 -0
  51. package/dist/index.d.ts +5 -3
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +4 -5776
  54. package/dist/integration-validation/index.d.ts +4 -0
  55. package/dist/integration-validation/index.d.ts.map +1 -0
  56. package/dist/integration-validation/inspection.d.ts +18 -0
  57. package/dist/integration-validation/inspection.d.ts.map +1 -0
  58. package/dist/integration-validation/parser.d.ts +9 -0
  59. package/dist/integration-validation/parser.d.ts.map +1 -0
  60. package/dist/integration-validation/types.d.ts +13 -0
  61. package/dist/integration-validation/types.d.ts.map +1 -0
  62. package/dist/manifest/index.d.ts +2 -4
  63. package/dist/manifest/index.d.ts.map +1 -1
  64. package/dist/manifest-validation/index.d.ts +7 -10
  65. package/dist/manifest-validation/index.d.ts.map +1 -1
  66. package/dist/node/index.d.ts +4 -0
  67. package/dist/node/index.d.ts.map +1 -0
  68. package/dist/node-inspection/analysis-worker.d.ts +2 -0
  69. package/dist/node-inspection/analysis-worker.d.ts.map +1 -0
  70. package/dist/node-inspection/client.d.ts +28 -0
  71. package/dist/node-inspection/client.d.ts.map +1 -0
  72. package/dist/node-inspection/constants.d.ts +21 -0
  73. package/dist/node-inspection/constants.d.ts.map +1 -0
  74. package/dist/node-inspection/errors.d.ts +11 -0
  75. package/dist/node-inspection/errors.d.ts.map +1 -0
  76. package/dist/node-inspection/lifecycle.d.ts +15 -0
  77. package/dist/node-inspection/lifecycle.d.ts.map +1 -0
  78. package/dist/node-inspection/protocol.d.ts +20 -0
  79. package/dist/node-inspection/protocol.d.ts.map +1 -0
  80. package/dist/node-inspection/repository-rpc.d.ts +28 -0
  81. package/dist/node-inspection/repository-rpc.d.ts.map +1 -0
  82. package/dist/node-inspection/runner.d.ts +2 -0
  83. package/dist/node-inspection/runner.d.ts.map +1 -0
  84. package/dist/node-inspection/types.d.ts +95 -0
  85. package/dist/node-inspection/types.d.ts.map +1 -0
  86. package/dist/node-runner.js +149 -0
  87. package/dist/node-runner.js.map +1 -0
  88. package/dist/node.js +335 -0
  89. package/dist/node.js.map +1 -0
  90. package/dist/options/index.d.ts +2 -14
  91. package/dist/options/index.d.ts.map +1 -1
  92. package/dist/project-inspection/index.d.ts +21 -1
  93. package/dist/project-inspection/index.d.ts.map +1 -1
  94. package/dist/project-validation/index.d.ts +33 -11
  95. package/dist/project-validation/index.d.ts.map +1 -1
  96. package/dist/repository-inspection-session/index.d.ts +2 -4
  97. package/dist/repository-inspection-session/index.d.ts.map +1 -1
  98. package/dist/repository-reference-validation/index.d.ts +12 -6
  99. package/dist/repository-reference-validation/index.d.ts.map +1 -1
  100. package/dist/retained-memory/index.d.ts +18 -0
  101. package/dist/retained-memory/index.d.ts.map +1 -0
  102. package/dist/scope/index.d.ts +3 -0
  103. package/dist/scope/index.d.ts.map +1 -0
  104. package/dist/scope/scope.d.ts +13 -0
  105. package/dist/scope/scope.d.ts.map +1 -0
  106. package/dist/scope-matching/index.d.ts +2 -1
  107. package/dist/scope-matching/index.d.ts.map +1 -1
  108. package/dist/scope-matching/matching.d.ts +11 -2
  109. package/dist/scope-matching/matching.d.ts.map +1 -1
  110. package/dist/scope-matching/patterns.d.ts +4 -0
  111. package/dist/scope-matching/patterns.d.ts.map +1 -0
  112. package/dist/scope.js +17 -0
  113. package/dist/scope.js.map +1 -0
  114. package/dist/universal-project-inspection/index.d.ts +13 -11
  115. package/dist/universal-project-inspection/index.d.ts.map +1 -1
  116. package/dist/warning-acceptance/acceptance.d.ts +11 -0
  117. package/dist/warning-acceptance/acceptance.d.ts.map +1 -0
  118. package/dist/warning-acceptance/index.d.ts +2 -0
  119. package/dist/warning-acceptance/index.d.ts.map +1 -0
  120. package/package.json +14 -6
  121. package/dist/adapter/index.d.ts +0 -131
  122. package/dist/adapter/index.d.ts.map +0 -1
  123. package/dist/adapter-availability/index.d.ts +0 -15
  124. package/dist/adapter-availability/index.d.ts.map +0 -1
  125. package/dist/adapter-execution/index.d.ts +0 -31
  126. package/dist/adapter-execution/index.d.ts.map +0 -1
  127. package/dist/adapter-repository/index.d.ts +0 -27
  128. package/dist/adapter-repository/index.d.ts.map +0 -1
  129. package/dist/adapter-retained-memory/index.d.ts +0 -8
  130. package/dist/adapter-retained-memory/index.d.ts.map +0 -1
  131. package/dist/adapter-validation/index.d.ts +0 -43
  132. package/dist/adapter-validation/index.d.ts.map +0 -1
  133. package/dist/adapter.js +0 -115
  134. package/dist/adapter.js.map +0 -1
  135. package/dist/chunks/exceptions-HS9ofVy2.js.map +0 -1
  136. package/dist/index.js.map +0 -1
package/dist/adapter.js DELETED
@@ -1,115 +0,0 @@
1
- import { i as reserveRuntimeAdapterRetainedBytesIfTracked, n as CoreOperationException } from "./chunks/exceptions-HS9ofVy2.js";
2
- import { REPOSITORY_ROOT, RepositorySourceException, compareRepositoryPaths, parseRepositoryPath } from "@moldea.ai/repository";
3
- //#region src/adapter-repository/index.ts
4
- var invalidSourceData = (operation, path) => {
5
- throw new RepositorySourceException({
6
- code: "INVALID_SOURCE_DATA",
7
- operation,
8
- path,
9
- retryable: false
10
- });
11
- };
12
- var throwResourceLimitExceeded = (limit, limitMaximum, observedUsage) => {
13
- throw new CoreOperationException({
14
- code: "RESOURCE_LIMIT_EXCEEDED",
15
- limit,
16
- limitMaximum,
17
- nextAction: "reduce-input-or-increase-limit",
18
- observedUsage,
19
- operation: "validate-project"
20
- });
21
- };
22
- /**
23
- * Reads one complete adapter source file through bounded repository pages.
24
- * @param repository The Core-created repository for the current adapter invocation.
25
- * @param path The exact source file path.
26
- * @param options Optional cancellation controls.
27
- * @returns A promise resolving to one detached complete source buffer.
28
- * @throws
29
- * - INVALID_REPOSITORY_PATH: The repository path is invalid.
30
- * - ENTRY_NOT_FOUND: The requested repository entry was not found.
31
- * - ENTRY_NOT_FILE: The requested repository entry is not a file.
32
- * - INVALID_PAGE_REQUEST: The repository page request 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 the operation.
36
- * - INVALID_SOURCE_DATA: The repository source returned invalid data.
37
- * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.
38
- * - ABORTED: The repository operation was aborted.
39
- * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.
40
- */
41
- var readRuntimeAdapterFile = async (repository, path, options) => {
42
- const parsedPath = parseRepositoryPath(path);
43
- const entry = await repository.getEntry(parsedPath, options);
44
- if (entry === null) throw new RepositorySourceException({
45
- code: "ENTRY_NOT_FOUND",
46
- operation: "read-file-page",
47
- path: parsedPath,
48
- retryable: false
49
- });
50
- if (entry.type !== "file" || entry.byteLength === null) throw new RepositorySourceException({
51
- code: "ENTRY_NOT_FILE",
52
- operation: "read-file-page",
53
- path: parsedPath,
54
- retryable: false
55
- });
56
- if (entry.byteLength > repository.limits.maxFileBytes) return throwResourceLimitExceeded("maxFileBytes", repository.limits.maxFileBytes, entry.byteLength);
57
- reserveRuntimeAdapterRetainedBytesIfTracked(repository, entry.byteLength);
58
- const content = new Uint8Array(entry.byteLength);
59
- let offset = 0;
60
- let isFirstPage = true;
61
- while (isFirstPage || offset < entry.byteLength) {
62
- isFirstPage = false;
63
- options?.signal?.throwIfAborted();
64
- const page = await repository.readFilePage(parsedPath, {
65
- maxBytes: Math.min(repository.limits.maxPageBytes, Math.max(1, entry.byteLength - offset)),
66
- offset,
67
- ...options?.signal === void 0 ? {} : { signal: options.signal }
68
- });
69
- 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);
70
- content.set(page.bytes, offset);
71
- offset += page.bytes.byteLength;
72
- if (page.isComplete) {
73
- if (page.nextOffset !== null || offset !== content.byteLength) return invalidSourceData("read-file-page", parsedPath);
74
- return content;
75
- }
76
- if (page.nextOffset !== offset) return invalidSourceData("read-file-page", parsedPath);
77
- }
78
- return invalidSourceData("read-file-page", parsedPath);
79
- };
80
- /** Iterates one adapter-scoped descendant listing through bounded pages. */
81
- var iterateRuntimeAdapterEntries = (repository, options) => {
82
- const prefix = options?.prefix === void 0 ? REPOSITORY_ROOT : parseRepositoryPath(options.prefix);
83
- return { async *[Symbol.asyncIterator]() {
84
- let cursor;
85
- let entryCount = 0;
86
- let previousPath = null;
87
- do {
88
- options?.signal?.throwIfAborted();
89
- const page = await repository.listEntriesPage({
90
- ...cursor === void 0 ? {} : { cursor },
91
- maxEntries: repository.limits.maxPageEntries,
92
- prefix,
93
- ...options?.signal === void 0 ? {} : { signal: options.signal }
94
- });
95
- 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);
96
- for (const entry of page.entries) {
97
- if (previousPath !== null && compareRepositoryPaths(previousPath, entry.path) >= 0) return invalidSourceData("list-entries-page", entry.path);
98
- entryCount += 1;
99
- if (entryCount > repository.limits.maxEntries) return throwResourceLimitExceeded("maxEntries", repository.limits.maxEntries, entryCount);
100
- previousPath = entry.path;
101
- yield entry;
102
- }
103
- if (page.isComplete) {
104
- if (page.nextCursor !== null) return invalidSourceData("list-entries-page", prefix);
105
- return;
106
- }
107
- if (page.nextCursor === null || page.nextCursor === cursor) return invalidSourceData("list-entries-page", prefix);
108
- cursor = page.nextCursor;
109
- } while (true);
110
- } };
111
- };
112
- //#endregion
113
- export { iterateRuntimeAdapterEntries, readRuntimeAdapterFile };
114
-
115
- //# sourceMappingURL=adapter.js.map
@@ -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 +0,0 @@
1
- {"version":3,"file":"exceptions-HS9ofVy2.js","names":[],"sources":["../../src/adapter-retained-memory/index.ts","../../src/exceptions/index.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 { Exception } from 'error-message-utils';\n\n// stable configuration and operation failure codes\nexport type ICoreConfigurationErrorCode =\n | 'DUPLICATE_ADAPTER_ID'\n | 'RESERVED_ADAPTER_ID'\n | 'INVALID_ADAPTER_DEFINITION'\n | 'INVALID_RESOURCE_LIMIT';\n\nexport type ICoreOperationErrorCode =\n | 'INVALID_ARGUMENT'\n | 'ABORTED'\n | 'RESOURCE_LIMIT_EXCEEDED'\n | 'ADAPTER_EXECUTION_FAILED'\n | 'CONTENT_INVALID';\n\nexport type ICoreOperation =\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 | 'validate-adapter';\n\n// safe construction options for exported Core exceptions\nexport interface ICoreConfigurationExceptionOptions {\n readonly code: ICoreConfigurationErrorCode;\n readonly operation: ICoreOperation;\n readonly adapterId?: string;\n readonly cause?: unknown;\n}\n\ninterface ICoreOperationExceptionOptionsBase {\n readonly operation: ICoreOperation;\n readonly adapterId?: string;\n readonly agentId?: string;\n readonly cause?: unknown;\n}\n\n// complete resource-refusal metadata required by Core 5\nexport type ICoreResourceLimitNextAction = 'reduce-input-or-increase-limit';\n\nexport type ICoreOperationExceptionOptions = ICoreOperationExceptionOptionsBase &\n (\n | {\n readonly code: 'RESOURCE_LIMIT_EXCEEDED';\n readonly limit: string;\n readonly limitMaximum: number;\n readonly nextAction: ICoreResourceLimitNextAction;\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 DUPLICATE_ADAPTER_ID: 'A runtime adapter ID is registered more than once.',\n INVALID_ADAPTER_DEFINITION: 'A runtime adapter definition is invalid.',\n INVALID_RESOURCE_LIMIT: 'A Core resource limit is invalid.',\n RESERVED_ADAPTER_ID: 'A reserved runtime adapter ID was supplied.',\n} as const satisfies Readonly<Record<ICoreConfigurationErrorCode, string>>;\n\nconst OPERATION_ERROR_MESSAGES = {\n ABORTED: 'The Core operation was aborted.',\n ADAPTER_EXECUTION_FAILED: 'A runtime adapter failed during inspection.',\n CONTENT_INVALID: 'The canonical content is not valid UTF-8 text.',\n INVALID_ARGUMENT: 'The Core operation received an invalid argument.',\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 ADAPTER_EXECUTION_FAILED: false,\n CONTENT_INVALID: false,\n INVALID_ARGUMENT: false,\n RESOURCE_LIMIT_EXCEEDED: false,\n} as const satisfies Readonly<Record<ICoreOperationErrorCode, boolean>>;\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 public readonly adapterId: string | null;\n\n /** Creates a configuration exception with safe adapter 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 this.adapterId = options.adapterId ?? null;\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 adapterId: string | null;\n\n public readonly agentId: string | null;\n\n public readonly limit: string | null;\n\n public readonly limitMaximum: number | null;\n\n public readonly nextAction: ICoreResourceLimitNextAction | null;\n\n public readonly observedUsage: number | null;\n\n /** Creates an operation exception with derived retry and safe scope metadata. */\n public constructor(options: ICoreOperationExceptionOptions) {\n super(OPERATION_ERROR_MESSAGES[options.code], options.code);\n this.code = options.code;\n this.name = 'CoreOperationException';\n this.operation = options.operation;\n this.retryable = OPERATION_ERROR_RETRYABILITY[options.code];\n this.adapterId = options.adapterId ?? null;\n this.agentId = options.agentId ?? null;\n this.limit = options.limit ?? null;\n this.limitMaximum = options.limitMaximum ?? null;\n this.nextAction = options.nextAction ?? null;\n this.observedUsage = options.observedUsage ?? null;\n attachCause(this, options.cause);\n }\n}\n"],"mappings":";;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;;;ACoCA,IAAM,+BAA+B;CACnC,sBAAsB;CACtB,4BAA4B;CAC5B,wBAAwB;CACxB,qBAAqB;AACvB;AAEA,IAAM,2BAA2B;CAC/B,SAAS;CACT,0BAA0B;CAC1B,iBAAiB;CACjB,kBAAkB;CAClB,yBAAyB;AAC3B;AAEA,IAAM,+BAA+B;CACnC,SAAS;CACT,0BAA0B;CAC1B,iBAAiB;CACjB,kBAAkB;CAClB,yBAAyB;AAC3B;AAEA,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;CAEA;;CAGA,YAAmB,SAA6C;EAC9D,MAAM,6BAA6B,QAAQ,OAAO,QAAQ,IAAI;EAC9D,KAAK,OAAO,QAAQ;EACpB,KAAK,OAAO;EACZ,KAAK,YAAY,QAAQ;EACzB,KAAK,YAAY,QAAQ,aAAa;EACtC,YAAY,MAAM,QAAQ,KAAK;CACjC;AACF;;AAGA,IAAa,yBAAb,cAA4C,UAAU;CACpD;CAEA;CAEA;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,YAAY,QAAQ,aAAa;EACtC,KAAK,UAAU,QAAQ,WAAW;EAClC,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"}