@moldea.ai/core 6.0.0 → 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 (138) hide show
  1. package/README.md +12 -18
  2. package/dist/analysis-worker.js +14 -24
  3. package/dist/analysis-worker.js.map +1 -1
  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-DchheNDz.js → core-Cdeiu6xG.js} +743 -2684
  7. package/dist/chunks/core-Cdeiu6xG.js.map +1 -0
  8. package/dist/chunks/{errors-BQI1DEqf.js → errors-BE4DS3Ak.js} +27 -38
  9. package/dist/chunks/errors-BE4DS3Ak.js.map +1 -0
  10. package/dist/chunks/{exceptions-lzD3buFw.js → exceptions-IXsorE8t.js} +4 -16
  11. package/dist/chunks/exceptions-IXsorE8t.js.map +1 -0
  12. package/dist/chunks/{lifecycle-4EkWgEHm.js → lifecycle-D_RvxhDC.js} +2 -2
  13. package/dist/chunks/{lifecycle-4EkWgEHm.js.map → lifecycle-D_RvxhDC.js.map} +1 -1
  14. package/dist/chunks/{options-CxCT3dZU.js → options-5x9gu2Qb.js} +139 -152
  15. package/dist/chunks/options-5x9gu2Qb.js.map +1 -0
  16. package/dist/chunks/{repository-rpc-BWi6X1la.js → repository-rpc-B_y0Kspf.js} +2 -2
  17. package/dist/chunks/{repository-rpc-BWi6X1la.js.map → repository-rpc-B_y0Kspf.js.map} +1 -1
  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 +15 -15
  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 +4 -8
  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 +6 -4
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +4 -4
  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 +1 -1
  67. package/dist/node/index.d.ts.map +1 -1
  68. package/dist/node-inspection/client.d.ts +0 -4
  69. package/dist/node-inspection/client.d.ts.map +1 -1
  70. package/dist/node-inspection/errors.d.ts.map +1 -1
  71. package/dist/node-inspection/protocol.d.ts.map +1 -1
  72. package/dist/node-inspection/types.d.ts +4 -8
  73. package/dist/node-inspection/types.d.ts.map +1 -1
  74. package/dist/node-runner.js +4 -4
  75. package/dist/node-runner.js.map +1 -1
  76. package/dist/node.js +23 -13
  77. package/dist/node.js.map +1 -1
  78. package/dist/options/index.d.ts +2 -14
  79. package/dist/options/index.d.ts.map +1 -1
  80. package/dist/project-inspection/index.d.ts +1 -2
  81. package/dist/project-inspection/index.d.ts.map +1 -1
  82. package/dist/project-validation/index.d.ts +2 -4
  83. package/dist/project-validation/index.d.ts.map +1 -1
  84. package/dist/repository-inspection-session/index.d.ts +2 -4
  85. package/dist/repository-inspection-session/index.d.ts.map +1 -1
  86. package/dist/repository-reference-validation/index.d.ts +12 -6
  87. package/dist/repository-reference-validation/index.d.ts.map +1 -1
  88. package/dist/retained-memory/index.d.ts +18 -0
  89. package/dist/retained-memory/index.d.ts.map +1 -0
  90. package/dist/scope/index.d.ts +3 -0
  91. package/dist/scope/index.d.ts.map +1 -0
  92. package/dist/scope/scope.d.ts +13 -0
  93. package/dist/scope/scope.d.ts.map +1 -0
  94. package/dist/scope-matching/index.d.ts +2 -1
  95. package/dist/scope-matching/index.d.ts.map +1 -1
  96. package/dist/scope-matching/matching.d.ts +11 -2
  97. package/dist/scope-matching/matching.d.ts.map +1 -1
  98. package/dist/scope-matching/patterns.d.ts +4 -0
  99. package/dist/scope-matching/patterns.d.ts.map +1 -0
  100. package/dist/scope.js +17 -0
  101. package/dist/scope.js.map +1 -0
  102. package/dist/universal-project-inspection/index.d.ts +13 -11
  103. package/dist/universal-project-inspection/index.d.ts.map +1 -1
  104. package/dist/warning-acceptance/acceptance.d.ts +11 -0
  105. package/dist/warning-acceptance/acceptance.d.ts.map +1 -0
  106. package/dist/warning-acceptance/index.d.ts +2 -0
  107. package/dist/warning-acceptance/index.d.ts.map +1 -0
  108. package/package.json +6 -6
  109. package/dist/adapter/index.d.ts +0 -143
  110. package/dist/adapter/index.d.ts.map +0 -1
  111. package/dist/adapter-availability/index.d.ts +0 -15
  112. package/dist/adapter-availability/index.d.ts.map +0 -1
  113. package/dist/adapter-execution/index.d.ts +0 -34
  114. package/dist/adapter-execution/index.d.ts.map +0 -1
  115. package/dist/adapter-repository/index.d.ts +0 -27
  116. package/dist/adapter-repository/index.d.ts.map +0 -1
  117. package/dist/adapter-result-collection/collection.d.ts +0 -13
  118. package/dist/adapter-result-collection/collection.d.ts.map +0 -1
  119. package/dist/adapter-result-collection/index.d.ts +0 -3
  120. package/dist/adapter-result-collection/index.d.ts.map +0 -1
  121. package/dist/adapter-result-collection/types.d.ts +0 -31
  122. package/dist/adapter-result-collection/types.d.ts.map +0 -1
  123. package/dist/adapter-retained-memory/index.d.ts +0 -8
  124. package/dist/adapter-retained-memory/index.d.ts.map +0 -1
  125. package/dist/adapter-validation/index.d.ts +0 -43
  126. package/dist/adapter-validation/index.d.ts.map +0 -1
  127. package/dist/adapter.js +0 -116
  128. package/dist/adapter.js.map +0 -1
  129. package/dist/chunks/collection-CvbjjLf2.js +0 -73
  130. package/dist/chunks/collection-CvbjjLf2.js.map +0 -1
  131. package/dist/chunks/core-DchheNDz.js.map +0 -1
  132. package/dist/chunks/errors-BQI1DEqf.js.map +0 -1
  133. package/dist/chunks/exceptions-lzD3buFw.js.map +0 -1
  134. package/dist/chunks/options-CxCT3dZU.js.map +0 -1
  135. package/dist/custom-runtime-inspection/index.d.ts +0 -2
  136. package/dist/custom-runtime-inspection/index.d.ts.map +0 -1
  137. package/dist/custom-runtime-inspection/inspection.d.ts +0 -11
  138. package/dist/custom-runtime-inspection/inspection.d.ts.map +0 -1
package/README.md CHANGED
@@ -4,20 +4,20 @@
4
4
 
5
5
  Source-neutral, deterministic, content-safe interpretation of the `moldea` repository format.
6
6
 
7
- Version 6 accepts caller-supplied text and `@moldea.ai/repository` version 2 readers. The main, format, and adapter entry points remain environment-neutral. Repository access belongs to the caller-supplied reader. Project validation returns content-free summaries, diagnostics, evidence, agent assignments, and metadata. Canonical document bodies are available only through an explicit path-scoped byte-range operation.
7
+ Version 7 accepts caller-supplied text and `@moldea.ai/repository` version 2 readers. The main, format, and scope entry points remain environment-neutral. Repository access belongs to the caller-supplied reader. Project validation returns content-free summaries, diagnostics, binding coverage, agent assignments, and metadata. Canonical document bodies are available only through an explicit path-scoped byte-range operation.
8
8
 
9
9
  ## Install
10
10
 
11
11
  ```bash
12
- pnpm add @moldea.ai/core@6 @moldea.ai/repository@2
12
+ pnpm add @moldea.ai/core@7 @moldea.ai/repository@2
13
13
  ```
14
14
 
15
15
  ## Public entry points
16
16
 
17
17
  - `@moldea.ai/core` exposes Core construction, operations, results, diagnostics, limits, and exceptions.
18
18
  - `@moldea.ai/core/format` exposes repository-format contracts.
19
- - `@moldea.ai/core/adapter` exposes the per-agent runtime-adapter contract and bounded reader utilities.
20
- - `@moldea.ai/core/node` exposes supervised Node inspection with asynchronous paging and disposal. It imports only a caller-selected trusted installed adapter registry, never project application code. Its frozen `NODE_INSPECTION_PROFILE` reports the fixed heap, lifetime, bridge and transport settings for authenticated consumer state; it does not configure them. Each inspection handle separately reports the runtime's actual V8 heap limit.
19
+ - `@moldea.ai/core/scope` exposes the standalone manifest-only relationship matcher without source analysis or TypeScript.
20
+ - `@moldea.ai/core/node` exposes supervised Node inspection with asynchronous paging and disposal. It runs fixed Core code and never imports project application code. Its frozen `NODE_INSPECTION_PROFILE` reports the fixed heap, lifetime, bridge and transport settings for authenticated consumer state; it does not configure them. Each inspection handle separately reports the runtime's actual V8 heap limit.
21
21
 
22
22
  ## Text and document parsing
23
23
 
@@ -52,7 +52,7 @@ const result = await core.matchManifestScope({
52
52
  });
53
53
  ```
54
54
 
55
- `matchManifestScope` parses only the supplied manifest and matches sorted, deduplicated changed paths against exact relationships and supported globs. It reads no other repository file, returns no canonical content, and invokes no adapter. This is the preactivation boundary for callers that already know the changed paths.
55
+ `matchManifestScope` parses only the supplied manifest and matches sorted, deduplicated changed paths against exact relationships and supported globs. It reads no other repository file, returns no canonical content, and loads no TypeScript. This is the preactivation boundary for callers that already know the changed paths.
56
56
 
57
57
  ## Content-free project validation
58
58
 
@@ -66,29 +66,23 @@ const repository = createMemoryRepositoryReader([
66
66
  const result = await core.validateProject({ repository });
67
67
  ```
68
68
 
69
- `validateProject` returns validity, runtime-inspection status, format version, source identity, summary counts and digests, diagnostics, and runtime evidence. It never returns manifest, project, context, decision, runtime-guidance, mirror, description, or instruction bodies.
69
+ `validateProject` returns validity, format version, source identity, summary counts and digests, diagnostics, binding coverage, and aggregate `coverageCounts`. It never returns manifest, project, context, decision, runtime-guidance, mirror, description, instruction, or source bodies. Validity means zero error diagnostics.
70
70
 
71
- `runtimeInspection` is `complete` when applicable runtime checks finish without unverified relationships, `incomplete` when any relationship remains unverified, and `not-run` when universal checks or adapter availability prevent runtime inspection. Validity remains based on errors. Warning-only results are valid, and projects without runtime relationships are complete. Every prepared inspection and page preserves the same aggregate status.
72
-
73
- `createProjectInspection` validates the snapshot once, prepares one immutable content-free record set, and returns synchronous bounded page reads for the `metadata`, `diagnostics`, `evidence`, and `all` views. The `metadata` and `all` views include one independently keyed `agent` record per canonical agent with exactly its `agentId` and manifest-declared `runtimeId`, distinct from asset metadata and adapter evidence. Each page uses a semantic continuation cursor tied to the complete inspection digest and view. Page reads perform no repository access, revalidation, sorting, digesting, or adapter execution.
71
+ `createProjectInspection` validates the snapshot once and prepares immutable content-free records for the `metadata`, `diagnostics`, `coverage`, and `all` views. Metadata includes an `agent` record with exactly its canonical `agentId` and manifest-declared `runtimeId`. Every inspection and page carries the same aggregate counts. Semantic cursors bind continuation to the complete inspection digest and view. Page reads perform no repository access, revalidation, sorting, digesting, or source analysis.
74
72
 
75
73
  The prepared inspection retains only its content-free records, summary, source identity, deterministic resource accounting, and page indexes. Core preflights the complete logical cost before it constructs the prepared collections, indexes, or digest. It does not retain canonical document bodies. `readCanonicalContentPage` is the only Core project operation that returns a body, and it requires an explicit canonical `/moldea/**` file path, byte offset, and byte bound. Returned chunks end at a complete UTF-8 scalar.
76
74
 
77
- ## Per-agent runtime adapters
78
-
79
- Universal validation must succeed before adapters run. Core invokes a configured package adapter once for each matching agent, in deterministic adapter and agent order. Each invocation receives only that agent, a bounded reader, a shared cancellation signal, the remaining operation-wide diagnostic/evidence allowance as `outputBudget`, and an exact same-runtime `resolveAgent(reference)` function for bindings that genuinely require another agent. It never receives the complete agent collection.
80
-
81
- Adapters use `createRuntimeAdapterResultCollector(context)` from `@moldea.ai/core/adapter`. Its `diagnostics.add(factory)` and `evidence.add(factory)` methods reserve raw admission before constructing records; `finalize()` returns the existing `{ evidence, diagnostics }` result. Earlier invocations consume the allowance before deduplication. Exhaustion raises `RESOURCE_LIMIT_EXCEEDED`, and Core still checks the complete raw result independently.
75
+ ## Binding coverage
82
76
 
83
- For the reserved `custom` runtime, Core reports `CUSTOM_RUNTIME_RELATIONSHIP_UNVERIFIED` warnings for declared bindings, capabilities, schemas, and variable providers. Core registers no custom adapter and infers no SDK or native handoff graph.
77
+ Core checks each declared binding's file and, when a symbol is named, its syntax-only runtime export inventory. TypeScript and JavaScript ESM are recognized conservatively. A proven missing export is an error and a `failed` coverage record. CommonJS, declaration files, wildcard exports, malformed source, and insufficient parsing capacity remain `not-checked`, with a reason. Coverage names the checks performed; it does not establish runtime wiring, behavior, provider compatibility, or business correctness.
84
78
 
85
- Adapter evidence and diagnostics are validated, normalized, deduplicated, sorted, and limited before exposure. An unexpected adapter failure or invalid output rejects the complete operation with `ADAPTER_EXECUTION_FAILED`.
79
+ `RECOGNIZED_RUNTIME_IDS` contains 35 runtime labels plus `custom`. Labels select agent guidance. Core applies the same universal checks to every label and does not interpret SDK calls. Use the installed SDK's type definitions and real application tests to establish runtime behavior. Handoffs remain runtime-native behavior.
86
80
 
87
- Every diagnostic has a required `severity`. Structural and confirmed adapter failures are errors. An adapter may identify a specific declared relationship whose recognized source is unverified with a warning carrying closed, source-safe context. Validation remains valid when it has warnings but no errors; `errorCount` and `warningCount` describe the complete result. Prepared inspection reports the same totals on every page as `counts.errors` and `counts.warnings`. A warning establishes neither the relationship nor a wiring failure.
81
+ Every diagnostic has `severity`, `group`, and stable `source: 'core'`. The groups are `discovery`, `manifest`, `references`, `agents`, `mirrors`, and `integration`. The result reports complete `errorCount`, unaccepted `warningCount`, `acceptedWarningCount`, and `diagnosticCount`; warnings do not invalidate a project. Manifest `acceptedWarnings` match a warning's code, subject, and qualifier and require a non-empty reason. Accepted findings remain visible. Unmatched impact patterns are best-effort warnings; a skipped check never makes an acceptance obsolete. Validation and inspection also check the root `/AGENTS.md` managed block against its referenced skill installation, reporting missing blocks, missing installation files, or drift as acceptable integration warnings. `parseIntegrationBlock(text)` extracts the safe relative installation path or a reason it could not be found. Manifest-only operations and `scope` do not read the integration.
88
82
 
89
83
  ## Resource and trust boundaries
90
84
 
91
- Core uses independent limits for distinct entries, total bytes read, per-file bytes, manifest bytes, logical retained bytes, diagnostics, and evidence. The default logical retained-memory ceiling is 512 MiB. Project inspection accounts for canonical validation state, complete adapter file buffers, transient read pages, and prepared content-free records before completing, and reports deterministic logical usage without exposing document bodies. A complete adapter buffer is reserved before allocation and remains charged for the inspection lifetime. The adapter-facing repository adds per-page entry and byte limits. Core executes no repository code, follows no symlink, receives no host path or source credential, and returns logical paths only.
85
+ Core uses independent limits for distinct entries, total bytes read, per-file bytes, manifest bytes, logical retained bytes, diagnostics, and coverage records. The default logical retained-memory ceiling is 512 MiB. Before parsing a supported source, Core reserves `65536 + sourceBytes * (8 + 512)` bytes for text and syntax nodes. A reservation miss records `resource-limit` without parsing; a source read, cancellation, or operation budget failure rejects the whole operation. Each distinct source is parsed at most once per operation. Source buffers and syntax reservations are released after analysis; only export names remain in the inventory cache. Core executes no repository code, follows no symlink, receives no host path or source credential, and returns logical paths only.
92
86
 
93
87
  Every `RESOURCE_LIMIT_EXCEEDED` exception identifies the exceeded limit, its configured maximum, the observed or projected usage, and the stable `reduce-input-or-increase-limit` next action. Core refuses the operation before allocating retained state beyond the applicable ceiling.
94
88
 
@@ -1,7 +1,7 @@
1
- import { n as CoreOperationException } from "./chunks/exceptions-lzD3buFw.js";
2
- import { n as normalizeCoreOptions } from "./chunks/options-CxCT3dZU.js";
3
- import { a as encodeInspectionMessage, d as NODE_INSPECTION_TRANSPORT_BYTES, i as decodeInspectionMessage, n as serializeInspectionFailure, o as NODE_INSPECTION_FILE_PAGE_BYTES, r as createInspectionProcessFailure } from "./chunks/errors-BQI1DEqf.js";
4
- import { i as parseRpcFilePage, n as parseRpcEntry, r as parseRpcEntryPage } from "./chunks/repository-rpc-BWi6X1la.js";
1
+ import { n as normalizeCoreOptions } from "./chunks/options-5x9gu2Qb.js";
2
+ import { n as CoreOperationException } from "./chunks/exceptions-IXsorE8t.js";
3
+ import { a as encodeInspectionMessage, d as NODE_INSPECTION_TRANSPORT_BYTES, i as decodeInspectionMessage, n as serializeInspectionFailure, o as NODE_INSPECTION_FILE_PAGE_BYTES, r as createInspectionProcessFailure, t as deserializeInspectionFailure } from "./chunks/errors-BE4DS3Ak.js";
4
+ import { i as parseRpcFilePage, n as parseRpcEntry, r as parseRpcEntryPage } from "./chunks/repository-rpc-B_y0Kspf.js";
5
5
  import { RepositorySourceException } from "@moldea.ai/repository";
6
6
  import { parentPort, workerData } from "node:worker_threads";
7
7
  import { getHeapStatistics } from "node:v8";
@@ -74,26 +74,19 @@ var repository = {
74
74
  retryable: false
75
75
  }))
76
76
  };
77
- /** Imports only the caller-selected installed registry, after the parent acknowledges the heap. */
77
+ /** Prepares the fixed Core implementation after the parent acknowledges the heap. */
78
78
  var prepare = async () => {
79
- const registry = await import(start.registryUrl);
80
- if (registry === null || typeof registry !== "object" || !("adapters" in registry) || !Array.isArray(registry.adapters)) throw createInspectionProcessFailure();
81
- const adapters = registry.adapters;
82
- const { createCore } = await import("./chunks/core-DchheNDz.js").then((n) => n.t);
83
- const options = normalizeCoreOptions({
84
- adapters,
85
- limits: {
86
- ...start.limits,
87
- maxRetainedBytes: start.limits.maxRetainedBytes - NODE_INSPECTION_TRANSPORT_BYTES
88
- }
89
- });
90
- inspection = await createCore(options).createProjectInspection({ repository });
79
+ const { createCore } = await import("./chunks/core-Cdeiu6xG.js").then((n) => n.t);
80
+ inspection = await createCore(normalizeCoreOptions({ limits: {
81
+ ...start.limits,
82
+ maxRetainedBytes: start.limits.maxRetainedBytes - NODE_INSPECTION_TRANSPORT_BYTES
83
+ } })).createProjectInspection({ repository });
91
84
  const metadata = {
92
85
  source: inspection.source,
93
86
  formatVersion: inspection.formatVersion,
94
87
  valid: inspection.valid,
95
- runtimeInspection: inspection.runtimeInspection,
96
88
  counts: inspection.counts,
89
+ coverageCounts: inspection.coverageCounts,
97
90
  summary: inspection.summary,
98
91
  resourceUsage: inspection.resourceUsage,
99
92
  inspectionDigest: inspection.inspectionDigest
@@ -104,10 +97,6 @@ var prepare = async () => {
104
97
  inspection: {
105
98
  ...metadata,
106
99
  maxAnalysisHeapBytes,
107
- adapters: options.adapters.map((adapter) => ({
108
- id: adapter.id,
109
- supportedRepositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions]
110
- })),
111
100
  resourceUsage: {
112
101
  ...metadata.resourceUsage,
113
102
  retainedBytes: metadata.resourceUsage.retainedBytes + NODE_INSPECTION_TRANSPORT_BYTES,
@@ -141,11 +130,12 @@ port.on("message", (frame) => {
141
130
  if (hasRun) throw createInspectionProcessFailure();
142
131
  hasRun = true;
143
132
  prepare().catch(fail);
144
- } else if (message.kind === "reader-response") {
133
+ } else if (message.kind === "reader-response" || message.kind === "reader-failure") {
145
134
  const request = pending.get(message.requestId);
146
135
  if (request === void 0) throw createInspectionProcessFailure();
147
136
  pending.delete(message.requestId);
148
- request.resolve(message.result);
137
+ if (message.kind === "reader-failure") request.reject(deserializeInspectionFailure(message.failure));
138
+ else request.resolve(message.result);
149
139
  } else if (message.kind === "read-page") {
150
140
  if (inspection === void 0 || isReadingPage) throw createInspectionProcessFailure();
151
141
  isReadingPage = true;
@@ -1 +1 @@
1
- {"version":3,"file":"analysis-worker.js","names":[],"sources":["../src/node-inspection/analysis-worker.ts"],"sourcesContent":["import { getHeapStatistics } from 'node:v8';\nimport { parentPort, workerData } from 'node:worker_threads';\n\nimport { RepositorySourceException, type IRepositoryReader } from '@moldea.ai/repository';\n\nimport type { IRuntimeAdapter } from '../adapter/index.js';\nimport type { IProjectInspection } from '../contracts/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\nimport { normalizeCoreOptions } from '../options/index.js';\n\nimport {\n NODE_INSPECTION_FILE_PAGE_BYTES,\n NODE_INSPECTION_MAX_REQUESTS,\n NODE_INSPECTION_TRANSPORT_BYTES,\n} from './constants.js';\nimport { serializeInspectionFailure } from './errors.js';\nimport {\n createInspectionProcessFailure,\n decodeInspectionMessage,\n encodeInspectionMessage,\n} from './protocol.js';\nimport { parseRpcEntry, parseRpcEntryPage, parseRpcFilePage } from './repository-rpc.js';\nimport type { INodeInspectionMessage, INodeReaderRequest } from './types.js';\n\nconst port = parentPort;\nif (port === null) throw createInspectionProcessFailure();\nconst start = decodeInspectionMessage(workerData);\nif (start.kind !== 'start') throw createInspectionProcessFailure();\nconst attemptId = start.attemptId;\nconst maxAnalysisHeapBytes = getHeapStatistics().heap_size_limit;\nlet inspection: IProjectInspection | undefined;\nlet hasRun = false;\nlet isReadingPage = false;\nlet nextRequestId = 0;\nconst pending = new Map<\n number,\n { resolve: (result: unknown) => void; reject: (cause: unknown) => void }\n>();\nconst send = (message: INodeInspectionMessage): void => {\n port.postMessage(encodeInspectionMessage(message));\n};\n\n/** Admits at most four requests across both bridges; no unbounded transport wait queue exists. */\nconst requestReader = (request: INodeReaderRequest): Promise<unknown> => {\n if (pending.size >= NODE_INSPECTION_MAX_REQUESTS)\n return Promise.reject(\n new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n operation: 'create-project-inspection',\n limit: 'maxReaderRequests',\n limitMaximum: NODE_INSPECTION_MAX_REQUESTS,\n observedUsage: pending.size + 1,\n nextAction: null,\n }),\n );\n const requestId = nextRequestId++;\n return new Promise<unknown>((resolve, reject) => {\n pending.set(requestId, { resolve, reject });\n try {\n send({ attemptId, kind: 'reader-request', requestId, request });\n } catch (cause) {\n pending.delete(requestId);\n reject(cause instanceof Error ? cause : createInspectionProcessFailure(cause));\n }\n });\n};\n\nconst repository: IRepositoryReader = {\n snapshot: start.snapshot,\n getEntry: async (path) => parseRpcEntry(await requestReader({ method: 'getEntry', path })),\n listEntriesPage: async (options) =>\n parseRpcEntryPage(\n await requestReader({\n method: 'listEntriesPage',\n maxEntries: Math.min(128, options.maxEntries),\n ...(options.cursor === undefined ? {} : { cursor: options.cursor }),\n ...(options.prefix === undefined ? {} : { prefix: options.prefix }),\n }),\n ),\n readFilePage: async (path, options) =>\n parseRpcFilePage(\n await requestReader({\n method: 'readFilePage',\n path,\n offset: options.offset,\n maxBytes: Math.min(NODE_INSPECTION_FILE_PAGE_BYTES, options.maxBytes),\n }),\n ),\n compare: () =>\n Promise.reject(\n new RepositorySourceException({\n code: 'SOURCE_UNAVAILABLE',\n operation: 'create-comparison',\n path: null,\n retryable: false,\n }),\n ),\n};\n\n/** Imports only the caller-selected installed registry, after the parent acknowledges the heap. */\nconst prepare = async (): Promise<void> => {\n const registry: unknown = await import(start.registryUrl);\n if (\n registry === null ||\n typeof registry !== 'object' ||\n !('adapters' in registry) ||\n !Array.isArray(registry.adapters)\n )\n throw createInspectionProcessFailure();\n // Core remains the authoritative validator for every executable adapter definition.\n const adapters = registry.adapters as IRuntimeAdapter[];\n const { createCore } = await import('../core/index.js');\n const options = normalizeCoreOptions({\n adapters,\n limits: {\n ...start.limits,\n maxRetainedBytes: start.limits.maxRetainedBytes - NODE_INSPECTION_TRANSPORT_BYTES,\n },\n });\n const core = createCore(options);\n inspection = await core.createProjectInspection({ repository });\n const metadata = {\n source: inspection.source,\n formatVersion: inspection.formatVersion,\n valid: inspection.valid,\n runtimeInspection: inspection.runtimeInspection,\n counts: inspection.counts,\n summary: inspection.summary,\n resourceUsage: inspection.resourceUsage,\n inspectionDigest: inspection.inspectionDigest,\n };\n send({\n attemptId,\n kind: 'prepared',\n inspection: {\n ...metadata,\n maxAnalysisHeapBytes,\n adapters: options.adapters.map((adapter) => ({\n id: adapter.id,\n supportedRepositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions],\n })),\n resourceUsage: {\n ...metadata.resourceUsage,\n retainedBytes: metadata.resourceUsage.retainedBytes + NODE_INSPECTION_TRANSPORT_BYTES,\n peakRetainedBytes:\n metadata.resourceUsage.peakRetainedBytes + NODE_INSPECTION_TRANSPORT_BYTES,\n },\n },\n });\n};\n\n/** Translates worker failures to safe package contracts while the supervisor stays responsive. */\nconst fail = (cause: unknown): void => {\n try {\n const failure = serializeInspectionFailure(cause);\n if (\n cause instanceof CoreOperationException &&\n cause.code === 'RESOURCE_LIMIT_EXCEEDED' &&\n cause.limit === 'maxRetainedBytes' &&\n cause.observedUsage !== null\n ) {\n failure.options['limitMaximum'] = start.limits.maxRetainedBytes;\n failure.options['observedUsage'] = cause.observedUsage + NODE_INSPECTION_TRANSPORT_BYTES;\n }\n send({ attemptId, kind: 'failure', failure });\n } catch {\n port.close();\n }\n};\n\nport.on('message', (frame: unknown) => {\n try {\n const message = decodeInspectionMessage(frame);\n if (message.attemptId !== attemptId) throw createInspectionProcessFailure();\n if (message.kind === 'run') {\n if (hasRun) throw createInspectionProcessFailure();\n hasRun = true;\n void prepare().catch(fail);\n } else if (message.kind === 'reader-response') {\n const request = pending.get(message.requestId);\n if (request === undefined) throw createInspectionProcessFailure();\n pending.delete(message.requestId);\n request.resolve(message.result);\n } else if (message.kind === 'read-page') {\n if (inspection === undefined || isReadingPage) throw createInspectionProcessFailure();\n isReadingPage = true;\n try {\n if (message.input.maxItems > start.limits.maxEntries)\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation: 'create-project-inspection',\n });\n let maxItems = Math.min(256, message.input.maxItems);\n while (true) {\n try {\n const frame = encodeInspectionMessage({\n attemptId,\n kind: 'page',\n requestId: message.requestId,\n result: inspection.readPage({ ...message.input, maxItems }),\n });\n port.postMessage(frame);\n break;\n } catch (cause) {\n if (\n !(cause instanceof CoreOperationException) ||\n cause.code !== 'RESOURCE_LIMIT_EXCEEDED' ||\n cause.limit !== 'maxInspectionMessageBytes' ||\n maxItems === 1\n )\n throw cause;\n maxItems = Math.max(1, Math.floor(maxItems / 2));\n }\n }\n } finally {\n isReadingPage = false;\n }\n } else throw createInspectionProcessFailure();\n } catch (cause) {\n fail(cause);\n }\n});\nport.on('messageerror', fail);\nsend({ attemptId, kind: 'ready', maxAnalysisHeapBytes });\n"],"mappings":";;;;;;;;AAwBA,IAAM,OAAO;AACb,IAAI,SAAS,MAAM,MAAM,+BAA+B;AACxD,IAAM,QAAQ,wBAAwB,UAAU;AAChD,IAAI,MAAM,SAAS,SAAS,MAAM,+BAA+B;AACjE,IAAM,YAAY,MAAM;AACxB,IAAM,uBAAuB,kBAAkB,CAAC,CAAC;AACjD,IAAI;AACJ,IAAI,SAAS;AACb,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAM,0BAAU,IAAI,IAGlB;AACF,IAAM,QAAQ,YAA0C;CACtD,KAAK,YAAY,wBAAwB,OAAO,CAAC;AACnD;;AAGA,IAAM,iBAAiB,YAAkD;CACvE,IAAI,QAAQ,QAAA,GACV,OAAO,QAAQ,OACb,IAAI,uBAAuB;EACzB,MAAM;EACN,WAAW;EACX,OAAO;EACP,cAAA;EACA,eAAe,QAAQ,OAAO;EAC9B,YAAY;CACd,CAAC,CACH;CACF,MAAM,YAAY;CAClB,OAAO,IAAI,SAAkB,SAAS,WAAW;EAC/C,QAAQ,IAAI,WAAW;GAAE;GAAS;EAAO,CAAC;EAC1C,IAA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SAAS;GAChC,QAAQ,QAAQ,QAAQ,MAAM;EAChC,OAAO,IAAI,QAAQ,SAAS,aAAa;GACvC,IAAI,eAAe,KAAA,KAAa,eAAe,MAAM,+BAA+B;GACpF,gBAAgB;GAChB,IAAI;IACF,IAAI,QAAQ,MAAM,WAAW,MAAM,OAAO,YACxC,MAAM,IAAI,uBAAuB;KAC/B,MAAM;KACN,WAAW;IACb,CAAC;IACH,IAAI,WAAW,KAAK,IAAI,KAAK,QAAQ,MAAM,QAAQ;IACnD,OAAO,MACL,IAAI;KACF,MAAM,QAAQ,wBAAwB;MACpC;MACA,MAAM;MACN,WAAW,QAAQ;MACnB,QAAQ,WAAW,SAAS;OAAE,GAAG,QAAQ;OAAO;MAAS,CAAC;KAC5D,CAAC;KACD,KAAK,YAAY,KAAK;KACtB;IACF,SAAS,OAAO;KACd,IACE,EAAE,iBAAiB,2BACnB,MAAM,SAAS,6BACf,MAAM,UAAU,+BAChB,aAAa,GAEb,MAAM;KACR,WAAW,KAAK,IAAI,GAAG,KAAK,MAAM,WAAW,CAAC,CAAC;IACjD;GAEJ,UAAU;IACR,gBAAgB;GAClB;EACF,OAAO,MAAM,+BAA+B;CAC9C,SAAS,OAAO;EACd,KAAK,KAAK;CACZ;AACF,CAAC;AACD,KAAK,GAAG,gBAAgB,IAAI;AAC5B,KAAK;CAAE;CAAW,MAAM;CAAS;AAAqB,CAAC"}
1
+ {"version":3,"file":"analysis-worker.js","names":[],"sources":["../src/node-inspection/analysis-worker.ts"],"sourcesContent":["import { getHeapStatistics } from 'node:v8';\nimport { parentPort, workerData } from 'node:worker_threads';\n\nimport { RepositorySourceException, type IRepositoryReader } from '@moldea.ai/repository';\n\nimport type { IProjectInspection } from '../contracts/index.js';\nimport { CoreOperationException } from '../exceptions/index.js';\nimport { normalizeCoreOptions } from '../options/index.js';\n\nimport {\n NODE_INSPECTION_FILE_PAGE_BYTES,\n NODE_INSPECTION_MAX_REQUESTS,\n NODE_INSPECTION_TRANSPORT_BYTES,\n} from './constants.js';\nimport { deserializeInspectionFailure, serializeInspectionFailure } from './errors.js';\nimport {\n createInspectionProcessFailure,\n decodeInspectionMessage,\n encodeInspectionMessage,\n} from './protocol.js';\nimport { parseRpcEntry, parseRpcEntryPage, parseRpcFilePage } from './repository-rpc.js';\nimport type { INodeInspectionMessage, INodeReaderRequest } from './types.js';\n\nconst port = parentPort;\nif (port === null) throw createInspectionProcessFailure();\nconst start = decodeInspectionMessage(workerData);\nif (start.kind !== 'start') throw createInspectionProcessFailure();\nconst attemptId = start.attemptId;\nconst maxAnalysisHeapBytes = getHeapStatistics().heap_size_limit;\nlet inspection: IProjectInspection | undefined;\nlet hasRun = false;\nlet isReadingPage = false;\nlet nextRequestId = 0;\nconst pending = new Map<\n number,\n { resolve: (result: unknown) => void; reject: (cause: unknown) => void }\n>();\nconst send = (message: INodeInspectionMessage): void => {\n port.postMessage(encodeInspectionMessage(message));\n};\n\n/** Admits at most four requests across both bridges; no unbounded transport wait queue exists. */\nconst requestReader = (request: INodeReaderRequest): Promise<unknown> => {\n if (pending.size >= NODE_INSPECTION_MAX_REQUESTS)\n return Promise.reject(\n new CoreOperationException({\n code: 'RESOURCE_LIMIT_EXCEEDED',\n operation: 'create-project-inspection',\n limit: 'maxReaderRequests',\n limitMaximum: NODE_INSPECTION_MAX_REQUESTS,\n observedUsage: pending.size + 1,\n nextAction: null,\n }),\n );\n const requestId = nextRequestId++;\n return new Promise<unknown>((resolve, reject) => {\n pending.set(requestId, { resolve, reject });\n try {\n send({ attemptId, kind: 'reader-request', requestId, request });\n } catch (cause) {\n pending.delete(requestId);\n reject(cause instanceof Error ? cause : createInspectionProcessFailure(cause));\n }\n });\n};\n\nconst repository: IRepositoryReader = {\n snapshot: start.snapshot,\n getEntry: async (path) => parseRpcEntry(await requestReader({ method: 'getEntry', path })),\n listEntriesPage: async (options) =>\n parseRpcEntryPage(\n await requestReader({\n method: 'listEntriesPage',\n maxEntries: Math.min(128, options.maxEntries),\n ...(options.cursor === undefined ? {} : { cursor: options.cursor }),\n ...(options.prefix === undefined ? {} : { prefix: options.prefix }),\n }),\n ),\n readFilePage: async (path, options) =>\n parseRpcFilePage(\n await requestReader({\n method: 'readFilePage',\n path,\n offset: options.offset,\n maxBytes: Math.min(NODE_INSPECTION_FILE_PAGE_BYTES, options.maxBytes),\n }),\n ),\n compare: () =>\n Promise.reject(\n new RepositorySourceException({\n code: 'SOURCE_UNAVAILABLE',\n operation: 'create-comparison',\n path: null,\n retryable: false,\n }),\n ),\n};\n\n/** Prepares the fixed Core implementation after the parent acknowledges the heap. */\nconst prepare = async (): Promise<void> => {\n const { createCore } = await import('../core/index.js');\n const options = normalizeCoreOptions({\n limits: {\n ...start.limits,\n maxRetainedBytes: start.limits.maxRetainedBytes - NODE_INSPECTION_TRANSPORT_BYTES,\n },\n });\n const core = createCore(options);\n inspection = await core.createProjectInspection({ repository });\n const metadata = {\n source: inspection.source,\n formatVersion: inspection.formatVersion,\n valid: inspection.valid,\n counts: inspection.counts,\n coverageCounts: inspection.coverageCounts,\n summary: inspection.summary,\n resourceUsage: inspection.resourceUsage,\n inspectionDigest: inspection.inspectionDigest,\n };\n send({\n attemptId,\n kind: 'prepared',\n inspection: {\n ...metadata,\n maxAnalysisHeapBytes,\n resourceUsage: {\n ...metadata.resourceUsage,\n retainedBytes: metadata.resourceUsage.retainedBytes + NODE_INSPECTION_TRANSPORT_BYTES,\n peakRetainedBytes:\n metadata.resourceUsage.peakRetainedBytes + NODE_INSPECTION_TRANSPORT_BYTES,\n },\n },\n });\n};\n\n/** Translates worker failures to safe package contracts while the supervisor stays responsive. */\nconst fail = (cause: unknown): void => {\n try {\n const failure = serializeInspectionFailure(cause);\n if (\n cause instanceof CoreOperationException &&\n cause.code === 'RESOURCE_LIMIT_EXCEEDED' &&\n cause.limit === 'maxRetainedBytes' &&\n cause.observedUsage !== null\n ) {\n failure.options['limitMaximum'] = start.limits.maxRetainedBytes;\n failure.options['observedUsage'] = cause.observedUsage + NODE_INSPECTION_TRANSPORT_BYTES;\n }\n send({ attemptId, kind: 'failure', failure });\n } catch {\n port.close();\n }\n};\n\nport.on('message', (frame: unknown) => {\n try {\n const message = decodeInspectionMessage(frame);\n if (message.attemptId !== attemptId) throw createInspectionProcessFailure();\n if (message.kind === 'run') {\n if (hasRun) throw createInspectionProcessFailure();\n hasRun = true;\n void prepare().catch(fail);\n } else if (message.kind === 'reader-response' || message.kind === 'reader-failure') {\n const request = pending.get(message.requestId);\n if (request === undefined) throw createInspectionProcessFailure();\n pending.delete(message.requestId);\n if (message.kind === 'reader-failure')\n request.reject(deserializeInspectionFailure(message.failure));\n else request.resolve(message.result);\n } else if (message.kind === 'read-page') {\n if (inspection === undefined || isReadingPage) throw createInspectionProcessFailure();\n isReadingPage = true;\n try {\n if (message.input.maxItems > start.limits.maxEntries)\n throw new CoreOperationException({\n code: 'INVALID_ARGUMENT',\n operation: 'create-project-inspection',\n });\n let maxItems = Math.min(256, message.input.maxItems);\n while (true) {\n try {\n const frame = encodeInspectionMessage({\n attemptId,\n kind: 'page',\n requestId: message.requestId,\n result: inspection.readPage({ ...message.input, maxItems }),\n });\n port.postMessage(frame);\n break;\n } catch (cause) {\n if (\n !(cause instanceof CoreOperationException) ||\n cause.code !== 'RESOURCE_LIMIT_EXCEEDED' ||\n cause.limit !== 'maxInspectionMessageBytes' ||\n maxItems === 1\n )\n throw cause;\n maxItems = Math.max(1, Math.floor(maxItems / 2));\n }\n }\n } finally {\n isReadingPage = false;\n }\n } else throw createInspectionProcessFailure();\n } catch (cause) {\n fail(cause);\n }\n});\nport.on('messageerror', fail);\nsend({ attemptId, kind: 'ready', maxAnalysisHeapBytes });\n"],"mappings":";;;;;;;;AAuBA,IAAM,OAAO;AACb,IAAI,SAAS,MAAM,MAAM,+BAA+B;AACxD,IAAM,QAAQ,wBAAwB,UAAU;AAChD,IAAI,MAAM,SAAS,SAAS,MAAM,+BAA+B;AACjE,IAAM,YAAY,MAAM;AACxB,IAAM,uBAAuB,kBAAkB,CAAC,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 'agent-input-schema' | 'agent-output-schema' | 'variable-provider' | 'tool-implementation' | 'tool-registration' | 'tool-input-schema' | 'tool-output-schema' | 'skill-implementation' | 'skill-registration' | 'context-binding' | 'decision-binding';
3
+ export type IExportNotCheckedReason = 'no-symbol' | 'unsupported-file-type' | 'unresolved-exports' | 'unparseable-source' | 'resource-limit';
4
+ export type IBindingCoverage = {
5
+ entity: IDiagnosticEntity;
6
+ relationship: IBindingRelationship;
7
+ path: string;
8
+ symbol: string | null;
9
+ fileCheck: 'passed';
10
+ } & ({
11
+ exportCheck: 'passed';
12
+ } | {
13
+ exportCheck: 'failed';
14
+ } | {
15
+ exportCheck: 'not-checked';
16
+ exportNotCheckedReason: IExportNotCheckedReason;
17
+ });
18
+ export interface IBindingCoverageCounts {
19
+ readonly bindings: number;
20
+ readonly exportsPassed: number;
21
+ readonly exportsFailed: number;
22
+ readonly exportsNotChecked: number;
23
+ }
24
+ /** Counts every declared, existing binding by its actual export-check outcome. */
25
+ export declare const countBindingCoverage: (coverage: readonly IBindingCoverage[]) => IBindingCoverageCounts;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/binding-coverage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,MAAM,MAAM,oBAAoB,GAC5B,eAAe,GACf,oBAAoB,GACpB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,sBAAsB,GACtB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,CAAC;AAGvB,MAAM,MAAM,uBAAuB,GAC/B,WAAW,GACX,uBAAuB,GACvB,oBAAoB,GACpB,oBAAoB,GACpB,gBAAgB,CAAC;AAGrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,YAAY,EAAE,oBAAoB,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,QAAQ,CAAC;CACrB,GAAG,CACA;IAAE,WAAW,EAAE,QAAQ,CAAA;CAAE,GACzB;IAAE,WAAW,EAAE,QAAQ,CAAA;CAAE,GACzB;IAAE,WAAW,EAAE,aAAa,CAAC;IAAC,sBAAsB,EAAE,uBAAuB,CAAA;CAAE,CAClF,CAAC;AAGF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,GAC/B,UAAU,SAAS,gBAAgB,EAAE,KACpC,sBAKD,CAAC"}