@telorun/analyzer 0.72.0 → 0.74.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 (208) hide show
  1. package/dist/analyzer.d.ts.map +1 -1
  2. package/dist/analyzer.js +76 -20
  3. package/dist/artifact-axes.d.ts +14 -0
  4. package/dist/artifact-axes.d.ts.map +1 -0
  5. package/dist/artifact-axes.js +12 -0
  6. package/dist/artifact-layer-index.d.ts +2 -2
  7. package/dist/artifact-layer-index.d.ts.map +1 -1
  8. package/dist/artifact-layer-index.js +9 -4
  9. package/dist/artifact-selector.d.ts +47 -21
  10. package/dist/artifact-selector.d.ts.map +1 -1
  11. package/dist/artifact-selector.js +85 -16
  12. package/dist/builtins.d.ts.map +1 -1
  13. package/dist/builtins.js +144 -113
  14. package/dist/call-graph.d.ts +12 -1
  15. package/dist/call-graph.d.ts.map +1 -1
  16. package/dist/call-graph.js +22 -0
  17. package/dist/catch-scope.js +1 -1
  18. package/dist/cel-scope-query.d.ts.map +1 -1
  19. package/dist/cel-scope-query.js +32 -11
  20. package/dist/cel-scope.d.ts.map +1 -1
  21. package/dist/cel-scope.js +1 -0
  22. package/dist/eval-paths.d.ts +36 -5
  23. package/dist/eval-paths.d.ts.map +1 -1
  24. package/dist/eval-paths.js +47 -6
  25. package/dist/extends-resolution.d.ts +12 -0
  26. package/dist/extends-resolution.d.ts.map +1 -1
  27. package/dist/extends-resolution.js +23 -0
  28. package/dist/forwarded-declaration.d.ts +26 -0
  29. package/dist/forwarded-declaration.d.ts.map +1 -0
  30. package/dist/forwarded-declaration.js +31 -0
  31. package/dist/index.d.ts +10 -4
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +5 -2
  34. package/dist/kernel-globals.d.ts.map +1 -1
  35. package/dist/kernel-globals.js +21 -5
  36. package/dist/module-alias-scope.d.ts +11 -0
  37. package/dist/module-alias-scope.d.ts.map +1 -1
  38. package/dist/module-alias-scope.js +10 -0
  39. package/dist/module-file-claims.d.ts +17 -1
  40. package/dist/module-file-claims.d.ts.map +1 -1
  41. package/dist/module-file-claims.js +38 -3
  42. package/dist/module-named-files.d.ts +72 -0
  43. package/dist/module-named-files.d.ts.map +1 -0
  44. package/dist/module-named-files.js +115 -0
  45. package/dist/native-entries.d.ts +83 -0
  46. package/dist/native-entries.d.ts.map +1 -0
  47. package/dist/native-entries.js +169 -0
  48. package/dist/nearest-name.d.ts +22 -0
  49. package/dist/nearest-name.d.ts.map +1 -0
  50. package/dist/nearest-name.js +43 -0
  51. package/dist/normalize-inline-resources.d.ts +41 -13
  52. package/dist/normalize-inline-resources.d.ts.map +1 -1
  53. package/dist/normalize-inline-resources.js +236 -54
  54. package/dist/reference-field-map.d.ts +59 -1
  55. package/dist/reference-field-map.d.ts.map +1 -1
  56. package/dist/reference-field-map.js +200 -34
  57. package/dist/release/destinations.d.ts +59 -0
  58. package/dist/release/destinations.d.ts.map +1 -0
  59. package/dist/release/destinations.js +75 -0
  60. package/dist/release/index.d.ts +6 -2
  61. package/dist/release/index.d.ts.map +1 -1
  62. package/dist/release/index.js +3 -1
  63. package/dist/release/ledger.d.ts +20 -11
  64. package/dist/release/ledger.d.ts.map +1 -1
  65. package/dist/release/ledger.js +43 -14
  66. package/dist/release/payload-digest.d.ts +2 -1
  67. package/dist/release/payload-digest.d.ts.map +1 -1
  68. package/dist/release/payload-digest.js +2 -1
  69. package/dist/release/release-plan.d.ts +3 -2
  70. package/dist/release/release-plan.d.ts.map +1 -1
  71. package/dist/release/release-plan.js +12 -19
  72. package/dist/release/workspace-config.d.ts +114 -34
  73. package/dist/release/workspace-config.d.ts.map +1 -1
  74. package/dist/release/workspace-config.js +322 -38
  75. package/dist/release/workspace-schema.d.ts +41 -0
  76. package/dist/release/workspace-schema.d.ts.map +1 -0
  77. package/dist/release/workspace-schema.js +77 -0
  78. package/dist/resolve-ref-sentinels.d.ts.map +1 -1
  79. package/dist/resolve-ref-sentinels.js +8 -5
  80. package/dist/resolve-throws-union.d.ts +25 -4
  81. package/dist/resolve-throws-union.d.ts.map +1 -1
  82. package/dist/resolve-throws-union.js +62 -32
  83. package/dist/resolve-zone-requirements.d.ts.map +1 -1
  84. package/dist/resolve-zone-requirements.js +2 -1
  85. package/dist/rewrite-synthetic-origins.d.ts +6 -1
  86. package/dist/rewrite-synthetic-origins.d.ts.map +1 -1
  87. package/dist/rewrite-synthetic-origins.js +107 -13
  88. package/dist/schema-compat.d.ts.map +1 -1
  89. package/dist/schema-compat.js +18 -5
  90. package/dist/schema-error-report.d.ts +7 -0
  91. package/dist/schema-error-report.d.ts.map +1 -1
  92. package/dist/schema-error-report.js +9 -4
  93. package/dist/schema-walk.d.ts +47 -13
  94. package/dist/schema-walk.d.ts.map +1 -1
  95. package/dist/schema-walk.js +150 -30
  96. package/dist/scope-declarations.d.ts +59 -0
  97. package/dist/scope-declarations.d.ts.map +1 -0
  98. package/dist/scope-declarations.js +45 -0
  99. package/dist/source-entries.d.ts +119 -0
  100. package/dist/source-entries.d.ts.map +1 -0
  101. package/dist/source-entries.js +349 -0
  102. package/dist/step-bodies.d.ts +24 -0
  103. package/dist/step-bodies.d.ts.map +1 -0
  104. package/dist/step-bodies.js +28 -0
  105. package/dist/telo-version.d.ts +1 -1
  106. package/dist/telo-version.js +1 -1
  107. package/dist/template-body.d.ts +10 -0
  108. package/dist/template-body.d.ts.map +1 -1
  109. package/dist/template-body.js +25 -0
  110. package/dist/validate-cel-context.d.ts +23 -8
  111. package/dist/validate-cel-context.d.ts.map +1 -1
  112. package/dist/validate-cel-context.js +51 -18
  113. package/dist/validate-exports.d.ts +28 -0
  114. package/dist/validate-exports.d.ts.map +1 -0
  115. package/dist/validate-exports.js +146 -0
  116. package/dist/validate-extends.d.ts.map +1 -1
  117. package/dist/validate-extends.js +37 -1
  118. package/dist/validate-module-artifact.d.ts +4 -2
  119. package/dist/validate-module-artifact.d.ts.map +1 -1
  120. package/dist/validate-module-artifact.js +43 -4
  121. package/dist/validate-native-entries.d.ts +15 -0
  122. package/dist/validate-native-entries.d.ts.map +1 -0
  123. package/dist/validate-native-entries.js +103 -0
  124. package/dist/validate-observed-state.d.ts +7 -1
  125. package/dist/validate-observed-state.d.ts.map +1 -1
  126. package/dist/validate-observed-state.js +24 -6
  127. package/dist/validate-provider-coherence.d.ts +4 -8
  128. package/dist/validate-provider-coherence.d.ts.map +1 -1
  129. package/dist/validate-provider-coherence.js +12 -123
  130. package/dist/validate-reference-forms.d.ts.map +1 -1
  131. package/dist/validate-reference-forms.js +2 -2
  132. package/dist/validate-references.d.ts.map +1 -1
  133. package/dist/validate-references.js +152 -65
  134. package/dist/validate-scope-reach.d.ts +31 -0
  135. package/dist/validate-scope-reach.d.ts.map +1 -0
  136. package/dist/validate-scope-reach.js +180 -0
  137. package/dist/validate-source-entries.d.ts +16 -0
  138. package/dist/validate-source-entries.d.ts.map +1 -0
  139. package/dist/validate-source-entries.js +90 -0
  140. package/dist/validate-template-body.d.ts +36 -0
  141. package/dist/validate-template-body.d.ts.map +1 -0
  142. package/dist/validate-template-body.js +246 -0
  143. package/dist/validate-throws-coverage.d.ts.map +1 -1
  144. package/dist/validate-throws-coverage.js +21 -39
  145. package/dist/value-type-keyword.d.ts +22 -5
  146. package/dist/value-type-keyword.d.ts.map +1 -1
  147. package/dist/value-type-keyword.js +16 -7
  148. package/package.json +4 -3
  149. package/src/analyzer.ts +97 -20
  150. package/src/artifact-axes.ts +24 -0
  151. package/src/artifact-layer-index.ts +9 -6
  152. package/src/artifact-selector.ts +110 -35
  153. package/src/builtins.ts +160 -113
  154. package/src/call-graph.ts +30 -0
  155. package/src/catch-scope.ts +1 -1
  156. package/src/cel-scope-query.ts +28 -9
  157. package/src/cel-scope.ts +1 -0
  158. package/src/eval-paths.ts +53 -6
  159. package/src/extends-resolution.ts +24 -0
  160. package/src/forwarded-declaration.ts +32 -0
  161. package/src/index.ts +37 -1
  162. package/src/kernel-globals.ts +28 -5
  163. package/src/migrations/CLAUDE.md +35 -0
  164. package/src/module-alias-scope.ts +17 -0
  165. package/src/module-file-claims.ts +63 -4
  166. package/src/module-named-files.ts +162 -0
  167. package/src/native-entries.ts +227 -0
  168. package/src/nearest-name.ts +47 -0
  169. package/src/normalize-inline-resources.ts +326 -70
  170. package/src/reference-field-map.ts +257 -52
  171. package/src/release/CLAUDE.md +32 -0
  172. package/src/release/destinations.ts +105 -0
  173. package/src/release/index.ts +33 -2
  174. package/src/release/ledger.ts +51 -21
  175. package/src/release/payload-digest.ts +2 -1
  176. package/src/release/release-plan.ts +16 -26
  177. package/src/release/workspace-config.ts +483 -47
  178. package/src/release/workspace-schema.ts +99 -0
  179. package/src/resolve-ref-sentinels.ts +7 -6
  180. package/src/resolve-throws-union.ts +87 -32
  181. package/src/resolve-zone-requirements.ts +2 -1
  182. package/src/rewrite-synthetic-origins.ts +107 -16
  183. package/src/schema-compat.ts +18 -4
  184. package/src/schema-error-report.ts +16 -4
  185. package/src/schema-walk.ts +162 -34
  186. package/src/scope-declarations.ts +98 -0
  187. package/src/source-entries.ts +502 -0
  188. package/src/step-bodies.ts +55 -0
  189. package/src/telo-version.ts +1 -1
  190. package/src/template-body.ts +25 -0
  191. package/src/validate-cel-context.ts +60 -18
  192. package/src/validate-exports.ts +185 -0
  193. package/src/validate-extends.ts +43 -0
  194. package/src/validate-module-artifact.ts +46 -3
  195. package/src/validate-native-entries.ts +147 -0
  196. package/src/validate-observed-state.ts +36 -7
  197. package/src/validate-provider-coherence.ts +17 -127
  198. package/src/validate-reference-forms.ts +2 -3
  199. package/src/validate-references.ts +151 -66
  200. package/src/validate-scope-reach.ts +213 -0
  201. package/src/validate-source-entries.ts +120 -0
  202. package/src/validate-template-body.ts +274 -0
  203. package/src/validate-throws-coverage.ts +24 -31
  204. package/src/value-type-keyword.ts +35 -9
  205. package/dist/validate-template-dispatch.d.ts +0 -27
  206. package/dist/validate-template-dispatch.d.ts.map +0 -1
  207. package/dist/validate-template-dispatch.js +0 -95
  208. package/src/validate-template-dispatch.ts +0 -99
@@ -1,7 +1,9 @@
1
1
  export { extractAccessChains, validateChainAgainstSchema } from "@telorun/templating";
2
2
  import { elementSchemaOf, isLiveSlot, mergeTypeSchemas, parseCanonicalTypeSchemaId, } from "@telorun/sdk";
3
3
  import { KERNEL_BUILTINS } from "./builtins.js";
4
+ import { moduleAliasScope } from "./module-alias-scope.js";
4
5
  import { withRefSlotsAsReadings } from "./ref-slot-reading.js";
6
+ import { dispatchTargetOf } from "./template-body.js";
5
7
  // Where CEL is evaluated is one reader (`eval-paths.ts`), and the region half of
6
8
  // it moved there so the scope walk and the `x-telo-eval` walk answer the same
7
9
  // question in one place. Re-exported: this module is where every existing
@@ -279,18 +281,20 @@ function collectionBindingWithheld(schema, manifestRoot, allManifests) {
279
281
  * Example: `properties.self.x-telo-context-from-root: "schema"` reads
280
282
  * `manifestRoot.schema` and uses it as the schema of the `self` CEL variable.
281
283
  *
282
- * - `x-telo-context-from-ref-kind`: reads a kind name from `manifestRoot.<refPath>`,
283
- * resolves it via the definition registry, and returns that kind's `<field>` schema
284
- * (e.g. `outputType`/`inputType`). Used to type `result` against the dispatch
285
- * target's declared output shape.
284
+ * - `x-telo-context-from-ref-kind`: reads a KIND from `manifestRoot.<refPath>` —
285
+ * a field holding a kind name, or a definition's dispatch slot holding a
286
+ * `!ref` to a `resources:` entry (whose kind it is) — and returns the
287
+ * `<field>` schema (e.g. `outputType`/`inputType`) the entry itself declares,
288
+ * else the one the kind's definition declares. Used to type `result` against
289
+ * the dispatch target's declared output shape.
286
290
  *
287
291
  * Syntax: `<refPath>#<field>` — slashes traverse the manifest tree.
288
292
  *
289
- * Example: `x-telo-context-from-ref-kind: "provide/kind#outputType"` reads
290
- * `manifestRoot.provide.kind` as a kind name, looks up the kind's Telo.Definition,
291
- * and returns the `outputType` schema.
293
+ * Example: `x-telo-context-from-ref-kind: "provide#outputType"` resolves
294
+ * `manifestRoot.provide` (`!ref source`) to the entry named `source`, and
295
+ * returns its `outputType` schema, or its kind's.
292
296
  *
293
- * Accepts either a single string or an array of strings. With an array, paths
297
+ * Accepts either a single string or an array of strings. With an array, slots
294
298
  * are tried in order and the first one that resolves to a usable schema wins —
295
299
  * used by `result:` to find its dispatch target under whichever entry-point
296
300
  * field (`provide:` or `invoke:`) the definition declares.
@@ -311,7 +315,7 @@ export function resolveContextAnnotations(schema, manifestItem, opts) {
311
315
  const normalizedOpts = Array.isArray(opts)
312
316
  ? { allManifests: opts }
313
317
  : (opts ?? {});
314
- const { manifestRoot = manifestItem, defs, aliases, allManifests } = normalizedOpts;
318
+ const { manifestRoot = manifestItem, defs, aliases, aliasesByModule, allManifests } = normalizedOpts;
315
319
  const from = schema["x-telo-context-from"];
316
320
  if (from) {
317
321
  const navigated = navigatePath(manifestItem, from.split("/"));
@@ -391,28 +395,37 @@ export function resolveContextAnnotations(schema, manifestItem, opts) {
391
395
  }
392
396
  }
393
397
  if (defs) {
398
+ // The kind is read off THIS document, so it is spelled in the alias scope
399
+ // of the module that declared it — a library's dispatch target is written
400
+ // through an import the consumer has no reason to have.
401
+ const scope = moduleAliasScope(manifestRoot.metadata, aliases, aliasesByModule);
394
402
  for (const fromRefKind of fromRefKinds) {
395
403
  const hashIdx = fromRefKind.indexOf("#");
396
404
  if (hashIdx <= 0)
397
405
  continue;
398
406
  const refPath = fromRefKind.slice(0, hashIdx);
399
407
  const field = fromRefKind.slice(hashIdx + 1);
400
- const kindValue = navigatePath(manifestRoot, refPath.split("/"));
401
- if (typeof kindValue !== "string" || kindValue.length === 0)
408
+ const target = kindAtPath(manifestRoot, refPath);
409
+ if (!target)
402
410
  continue;
403
- const canonical = aliases?.resolveKind(kindValue) ?? kindValue;
404
- const def = defs.resolve(canonical);
405
- const typeField = def
406
- ? def[field]
407
- : undefined;
411
+ // The entry's own field first — a per-instance narrowing (`outputType:`
412
+ // on the entry) is what the kernel binds — then the kind's.
413
+ const own = target.entry?.[field];
414
+ const ownResolved = own !== undefined ? resolveTypeFieldToSchema(own, allManifests ?? []) : undefined;
415
+ if (ownResolved && typeof ownResolved === "object")
416
+ return ownResolved;
417
+ const canonical = scope?.resolveKind(target.kind) ?? target.kind;
418
+ const def = defs.resolve(canonical) ?? defs.resolve(target.kind);
419
+ const typeField = def ? def[field] : undefined;
408
420
  const resolved = resolveTypeFieldToSchema(typeField, allManifests ?? []);
409
421
  if (resolved && typeof resolved === "object") {
410
422
  return resolved;
411
423
  }
412
424
  }
413
425
  }
414
- // Open fallback so unresolved types never produce false-positive CEL diagnostics.
415
- return { type: "object", additionalProperties: true };
426
+ // Untyped (`dyn`) so an unresolved type never produces a false-positive CEL
427
+ // diagnostic; an open object would still type as `map` and refuse `acc + x`.
428
+ return {};
416
429
  }
417
430
  const refFrom = schema["x-telo-context-ref-from"];
418
431
  if (refFrom && allManifests) {
@@ -516,6 +529,26 @@ function navigatePath(obj, segments) {
516
529
  }
517
530
  return cur;
518
531
  }
532
+ /** The kind an `x-telo-context-from-ref-kind` path names: a field holding a
533
+ * kind NAME (`targetKind`), or a definition's dispatch slot holding a `!ref`
534
+ * to a `resources:` entry, which carries the kind — and, where it narrows
535
+ * one, the contract field itself. */
536
+ export function kindAtPath(manifestRoot, refPath) {
537
+ const segments = refPath.split("/");
538
+ const value = navigatePath(manifestRoot, segments);
539
+ if (typeof value === "string")
540
+ return value.length > 0 ? { kind: value } : undefined;
541
+ // The dispatch-slot reading is a fact about ONE built-in document, not about
542
+ // the annotation: `resources:` is a `Telo.Definition`'s entry list. The
543
+ // annotation itself is generic vocabulary any kind may declare, and without
544
+ // this gate a third-party kind whose own `resources:` array means something
545
+ // else would have a slot silently resolved against it — a wrong answer with
546
+ // nothing reporting it, which is worse than no answer.
547
+ if (segments.length !== 1 || manifestRoot.kind !== "Telo.Definition")
548
+ return undefined;
549
+ const dispatch = dispatchTargetOf(manifestRoot, segments[0]);
550
+ return dispatch ? { kind: dispatch.kind, entry: dispatch.entry } : undefined;
551
+ }
519
552
  /**
520
553
  * Walk a JSON Schema tree and collect all `x-telo-context` annotations,
521
554
  * returning them as `{ scope, schema }` pairs using JSONPath-style scopes —
@@ -0,0 +1,28 @@
1
+ import type { ResourceManifest } from "@telorun/sdk";
2
+ import type { AliasResolver } from "./alias-resolver.js";
3
+ import type { DefinitionRegistry } from "./definition-registry.js";
4
+ import { type AnalysisDiagnostic } from "./types.js";
5
+ /**
6
+ * A LIBRARY'S EXPORT LIST IS CHECKED WHERE IT IS WRITTEN.
7
+ *
8
+ * `exports.kinds` and `exports.resources` are a library's public contract, and
9
+ * they were read as a GATE only: a listed name resolved when a consumer asked
10
+ * for it, and one that named nothing failed in the consumer's file
11
+ * (`UNDEFINED_KIND` on `kind: L.Client`, with nothing wrong in that file) while
12
+ * the author who could fix it saw a clean check. Both entries are resolved here,
13
+ * against what the library declares:
14
+ *
15
+ * - a bare kind names a `Telo.Definition` / `Telo.Abstract` of this module, and
16
+ * `Alias.Kind` re-exports through an import declared in this file
17
+ * (`EXPORT_KIND_UNKNOWN`). The one mistake that reads as intended — a bare
18
+ * name that IS a kind, of an imported module — gets the re-export spelling
19
+ * in its message, because a clean check was read as confirmation it worked;
20
+ * - a bare instance names a resource declared in this module, and
21
+ * `Alias.name` an instance the aliased import exports
22
+ * (`EXPORT_RESOURCE_UNKNOWN`).
23
+ *
24
+ * Runs on the library as an ENTRY — a consumer's flattened analysis drops the
25
+ * library doc, and the list is not the consumer's to fix. Browser-safe.
26
+ */
27
+ export declare function validateExports(manifests: ResourceManifest[], registry: DefinitionRegistry, aliases: AliasResolver, rootModules: ReadonlySet<string>): AnalysisDiagnostic[];
28
+ //# sourceMappingURL=validate-exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-exports.d.ts","sourceRoot":"","sources":["../src/validate-exports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAC/B,kBAAkB,EAAE,CAoJtB"}
@@ -0,0 +1,146 @@
1
+ import { nearestName } from "./nearest-name.js";
2
+ import { parseExportEntry } from "./flatten-for-analyzer.js";
3
+ import { DiagnosticSeverity } from "./types.js";
4
+ const SOURCE = "telo-analyzer";
5
+ /**
6
+ * A LIBRARY'S EXPORT LIST IS CHECKED WHERE IT IS WRITTEN.
7
+ *
8
+ * `exports.kinds` and `exports.resources` are a library's public contract, and
9
+ * they were read as a GATE only: a listed name resolved when a consumer asked
10
+ * for it, and one that named nothing failed in the consumer's file
11
+ * (`UNDEFINED_KIND` on `kind: L.Client`, with nothing wrong in that file) while
12
+ * the author who could fix it saw a clean check. Both entries are resolved here,
13
+ * against what the library declares:
14
+ *
15
+ * - a bare kind names a `Telo.Definition` / `Telo.Abstract` of this module, and
16
+ * `Alias.Kind` re-exports through an import declared in this file
17
+ * (`EXPORT_KIND_UNKNOWN`). The one mistake that reads as intended — a bare
18
+ * name that IS a kind, of an imported module — gets the re-export spelling
19
+ * in its message, because a clean check was read as confirmation it worked;
20
+ * - a bare instance names a resource declared in this module, and
21
+ * `Alias.name` an instance the aliased import exports
22
+ * (`EXPORT_RESOURCE_UNKNOWN`).
23
+ *
24
+ * Runs on the library as an ENTRY — a consumer's flattened analysis drops the
25
+ * library doc, and the list is not the consumer's to fix. Browser-safe.
26
+ */
27
+ export function validateExports(manifests, registry, aliases, rootModules) {
28
+ const out = [];
29
+ for (const lib of manifests) {
30
+ if (lib.kind !== "Telo.Library")
31
+ continue;
32
+ const moduleName = lib.metadata?.name;
33
+ if (!moduleName || !rootModules.has(moduleName))
34
+ continue;
35
+ const exports = lib.exports;
36
+ if (!exports || typeof exports !== "object")
37
+ continue;
38
+ const filePath = lib.metadata?.source;
39
+ const resource = { kind: lib.kind, name: moduleName };
40
+ const own = (m) => {
41
+ const mod = m.metadata?.module;
42
+ return mod === undefined || mod === moduleName;
43
+ };
44
+ const declaredKinds = new Set();
45
+ const instances = new Set();
46
+ const importAliases = new Map();
47
+ const forwardedByModule = new Map();
48
+ for (const m of manifests) {
49
+ const name = m.metadata?.name;
50
+ if (typeof name !== "string")
51
+ continue;
52
+ const meta = m.metadata;
53
+ if (meta.forwardedExport && meta.module) {
54
+ let set = forwardedByModule.get(meta.module);
55
+ if (!set)
56
+ forwardedByModule.set(meta.module, (set = new Set()));
57
+ set.add(name);
58
+ continue;
59
+ }
60
+ if (!own(m))
61
+ continue;
62
+ if (m.kind === "Telo.Definition" || m.kind === "Telo.Abstract")
63
+ declaredKinds.add(name);
64
+ else if (m.kind === "Telo.Import")
65
+ importAliases.set(name, meta.resolvedModuleName);
66
+ else if (m.kind !== "Telo.Library" && m.kind !== "Telo.Application")
67
+ instances.add(name);
68
+ }
69
+ const report = (code, path, message, fix) => out.push({
70
+ severity: DiagnosticSeverity.Error,
71
+ code,
72
+ source: SOURCE,
73
+ message: `Telo.Library/${moduleName}: ${message}`,
74
+ data: { resource, filePath, path, ...(fix ? { fix: { replacement: fix } } : {}) },
75
+ });
76
+ const kinds = exports.kinds;
77
+ if (Array.isArray(kinds)) {
78
+ kinds.forEach((entry, i) => {
79
+ if (typeof entry !== "string")
80
+ return;
81
+ const path = `exports.kinds[${i}]`;
82
+ const { alias, name } = parseExportEntry(entry);
83
+ if (alias) {
84
+ if (!importAliases.has(alias)) {
85
+ report("EXPORT_KIND_UNKNOWN", path, `'exports.kinds: ${entry}' re-exports through '${alias}', which is not an import ` +
86
+ `of this library. Imports: ${[...importAliases.keys()].join(", ") || "(none)"}.`);
87
+ return;
88
+ }
89
+ const canonical = aliases.resolveKind(entry);
90
+ if (canonical && !registry.resolve(canonical)) {
91
+ report("EXPORT_KIND_UNKNOWN", path, `'exports.kinds: ${entry}' names no kind '${name}' exported by '${alias}'.`);
92
+ }
93
+ return;
94
+ }
95
+ if (declaredKinds.has(name))
96
+ return;
97
+ // The natural first attempt at a re-export: the imported kind's bare
98
+ // suffix. It resolves as a kind — just not as one this library owns.
99
+ const viaImport = [...importAliases.keys()].find((a) => {
100
+ const canonical = aliases.resolveKind(`${a}.${name}`);
101
+ return canonical !== undefined && registry.resolve(canonical) !== undefined;
102
+ });
103
+ if (viaImport) {
104
+ report("EXPORT_KIND_UNKNOWN", path, `'exports.kinds: ${name}' is not a kind this library declares — it is ` +
105
+ `'${viaImport}.${name}', an imported kind. Re-export it as '${viaImport}.${name}', ` +
106
+ `or declare a local kind that extends it.`, `${viaImport}.${name}`);
107
+ return;
108
+ }
109
+ const suggestion = nearestName(name, [...declaredKinds]);
110
+ report("EXPORT_KIND_UNKNOWN", path, `'exports.kinds: ${name}' names no Telo.Definition or Telo.Abstract of this library. ` +
111
+ `Declared: ${[...declaredKinds].join(", ") || "(none)"}.` +
112
+ (suggestion ? ` Did you mean '${suggestion}'?` : ""), suggestion);
113
+ });
114
+ }
115
+ const resources = exports.resources;
116
+ if (Array.isArray(resources)) {
117
+ resources.forEach((entry, i) => {
118
+ if (typeof entry !== "string")
119
+ return;
120
+ const path = `exports.resources[${i}]`;
121
+ const { alias, name } = parseExportEntry(entry);
122
+ if (alias) {
123
+ if (!importAliases.has(alias)) {
124
+ report("EXPORT_RESOURCE_UNKNOWN", path, `'exports.resources: ${entry}' re-exports through '${alias}', which is not an ` +
125
+ `import of this library. Imports: ${[...importAliases.keys()].join(", ") || "(none)"}.`);
126
+ return;
127
+ }
128
+ const targetModule = importAliases.get(alias);
129
+ const exported = targetModule ? forwardedByModule.get(targetModule) : undefined;
130
+ if (exported && !exported.has(name)) {
131
+ report("EXPORT_RESOURCE_UNKNOWN", path, `'exports.resources: ${entry}' names no instance '${name}' exported by '${alias}'. ` +
132
+ `Exported: ${[...exported].join(", ") || "(none)"}.`);
133
+ }
134
+ return;
135
+ }
136
+ if (instances.has(name))
137
+ return;
138
+ const suggestion = nearestName(name, [...instances]);
139
+ report("EXPORT_RESOURCE_UNKNOWN", path, `'exports.resources: ${name}' names no resource declared in this library. ` +
140
+ `Declared: ${[...instances].join(", ") || "(none)"}.` +
141
+ (suggestion ? ` Did you mean '${suggestion}'?` : ""), suggestion);
142
+ });
143
+ }
144
+ }
145
+ return out;
146
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"validate-extends.d.ts","sourceRoot":"","sources":["../src/validate-extends.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAQnE,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAiCzE,wBAAgB,eAAe,CAC7B,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,aAAa,GACrB,kBAAkB,EAAE,CAqMtB"}
1
+ {"version":3,"file":"validate-extends.d.ts","sourceRoot":"","sources":["../src/validate-extends.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AASnE,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAiCzE,wBAAgB,eAAe,CAC7B,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,aAAa,GACrB,kBAAkB,EAAE,CA2OtB"}
@@ -1,4 +1,4 @@
1
- import { controllerBearingAncestor, effectiveAuthorSchema, inheritedCapability, isInheritedDelegation, } from "./extends-resolution.js";
1
+ import { controllerBearingAncestor, effectiveAuthorSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, } from "./extends-resolution.js";
2
2
  import { DiagnosticSeverity } from "./types.js";
3
3
  const SOURCE = "telo-analyzer";
4
4
  /** Alias-form pattern for `extends`: "<Alias>.<AbstractName>", two PascalCase segments. */
@@ -59,6 +59,39 @@ export function validateExtends(manifests, registry, aliases) {
59
59
  const filePath = m.metadata?.source;
60
60
  const resource = { kind: m.kind, name };
61
61
  const label = `${m.kind}/${name}`;
62
+ // `base:` is read on exactly one path — the inherited-controller one, which
63
+ // the kernel takes only when the definition has NO body of its own. A
64
+ // `resources:` block or a dispatch slot selects the template path, and
65
+ // `base:` is then never evaluated: the kind silently became an empty
66
+ // template, and the failure landed in the CONSUMER's resource as a `{}`
67
+ // where a parent instance should have been. Refused here, where the two
68
+ // blocks sit side by side, and at registration in the kernel.
69
+ //
70
+ // WHETHER there is a body is `hasOwnControllerOrTemplate` — the same
71
+ // predicate the kernel branches on, so the two halves cannot disagree about
72
+ // what a body is. Deciding it here with a key scan did disagree: an empty
73
+ // `resources: []` is falsy to a length test and truthy to the kernel's, so
74
+ // it passed `telo check` and threw `ERR_BASE_WITH_TEMPLATE_BODY` at boot —
75
+ // a brand-new guard shipping with the very gap it was written to close. The
76
+ // scan survives for one job only: naming the offending key in the message.
77
+ if (m.base != null) {
78
+ const hasBody = hasOwnControllerOrTemplate(m);
79
+ const bodyKey = ["resources", "controllers", "invoke", "run", "provide", "mount"].find((key) => m[key] !== undefined) ?? "resources";
80
+ if (hasBody) {
81
+ diagnostics.push({
82
+ severity: DiagnosticSeverity.Error,
83
+ code: "BASE_WITH_TEMPLATE_BODY",
84
+ source: SOURCE,
85
+ message: `${label}: 'base:' maps this kind's config onto the inherited controller of ` +
86
+ `'${typeof extendsOf(m) === "string" ? extendsOf(m) : "<no extends>"}', so the ` +
87
+ `definition may not also declare '${bodyKey}:'. With '${bodyKey}:' the kind is a ` +
88
+ `template and 'base:' is never evaluated. Either drop 'base:' and dispatch to a ` +
89
+ `'resources:' entry with '!ref', or drop '${bodyKey}:' and build the parent's config ` +
90
+ `in 'base:' alone.`,
91
+ data: { resource, filePath, path: bodyKey },
92
+ });
93
+ }
94
+ }
62
95
  // --- extends validation ---
63
96
  // At this point `m.extends` is whatever the manifest declared (alias form, e.g.
64
97
  // "Ai.Model"). Resolve through the AliasResolver to the canonical form before
@@ -219,3 +252,6 @@ export function validateExtends(manifests, registry, aliases) {
219
252
  }
220
253
  return diagnostics;
221
254
  }
255
+ function extendsOf(m) {
256
+ return m.extends;
257
+ }
@@ -14,10 +14,12 @@ import { type AnalysisDiagnostic } from "./types.js";
14
14
  * selector (spec §1), which is what every module with two `js` controllers relies
15
15
  * on.
16
16
  *
17
- * 1. **Controller selector qualifiers.** `os` / `arch` / `libc` / `siblings` are
17
+ * 1. **Controller selector qualifiers.** The platform axes and `siblings` are
18
18
  * authored surface. An unknown qualifier is reported rather than ignored, since
19
19
  * ignoring is what makes a typo invisible; an invalid value is reported here
20
- * instead of throwing from the loader later.
20
+ * instead of throwing from the loader later, and so is a combination no host
21
+ * can match (`selectorContradictions`, shared with `native:` and
22
+ * `exports.code:`).
21
23
  * 2. **The published layer index.** The owner doc's JSON Schema covers shape; the
22
24
  * semantic rules — controller-requires-selector, singletons carry none, no
23
25
  * duplicate selector, the token grammar (`os: Linux` passes the schema and
@@ -1 +1 @@
1
- {"version":3,"file":"validate-module-artifact.d.ts","sourceRoot":"","sources":["../src/validate-module-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUrD,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,EAAE,CAQ1F"}
1
+ {"version":3,"file":"validate-module-artifact.d.ts","sourceRoot":"","sources":["../src/validate-module-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWrD,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,EAAE,CAQ1F"}
@@ -1,5 +1,5 @@
1
1
  import { parseLayerIndex, LayerIndexError } from "./artifact-layer-index.js";
2
- import { ArtifactSelectorError, PLATFORM_AXES, selectorFromQualifiers, selectorKey, } from "./artifact-selector.js";
2
+ import { ArtifactSelectorError, PLATFORM_AXES, selectorContradictions, selectorFromQualifiers, selectorKey, } from "./artifact-selector.js";
3
3
  import { readLibraryCandidates } from "./module-library.js";
4
4
  import { DiagnosticSeverity } from "./types.js";
5
5
  const SOURCE = "telo-analyzer";
@@ -17,10 +17,12 @@ const SOURCE = "telo-analyzer";
17
17
  * selector (spec §1), which is what every module with two `js` controllers relies
18
18
  * on.
19
19
  *
20
- * 1. **Controller selector qualifiers.** `os` / `arch` / `libc` / `siblings` are
20
+ * 1. **Controller selector qualifiers.** The platform axes and `siblings` are
21
21
  * authored surface. An unknown qualifier is reported rather than ignored, since
22
22
  * ignoring is what makes a typo invisible; an invalid value is reported here
23
- * instead of throwing from the loader later.
23
+ * instead of throwing from the loader later, and so is a combination no host
24
+ * can match (`selectorContradictions`, shared with `native:` and
25
+ * `exports.code:`).
24
26
  * 2. **The published layer index.** The owner doc's JSON Schema covers shape; the
25
27
  * semantic rules — controller-requires-selector, singletons carry none, no
26
28
  * duplicate selector, the token grammar (`os: Linux` passes the schema and
@@ -68,6 +70,15 @@ function validateLibraryCandidates(manifest, out) {
68
70
  // mean a consumer's import resolves by whichever candidate is read first.
69
71
  const seen = new Map();
70
72
  for (const candidate of candidates) {
73
+ for (const contradiction of selectorContradictions(candidate.selector)) {
74
+ out.push({
75
+ severity: DiagnosticSeverity.Error,
76
+ code: `LIBRARY_${contradiction.rule}`,
77
+ source: SOURCE,
78
+ message: `Telo.Library/${metadata?.name ?? "(unnamed)"}: ${candidate.origin}: ${contradiction.detail}`,
79
+ data: { resource, filePath: metadata?.source, path: "exports/code" },
80
+ });
81
+ }
71
82
  const key = selectorKey(candidate.selector);
72
83
  const first = seen.get(key);
73
84
  if (first) {
@@ -143,7 +154,35 @@ function validateControllerSelectors(manifest, out) {
143
154
  // Validate the selector; the value is not otherwise needed here, since
144
155
  // candidates sharing a selector legitimately share a layer.
145
156
  try {
146
- selectorFromQualifiers(parsed.format, parsed.qualifiers, candidate);
157
+ const selector = selectorFromQualifiers(parsed.format, parsed.qualifiers, candidate);
158
+ for (const contradiction of selectorContradictions(selector)) {
159
+ out.push({
160
+ severity: DiagnosticSeverity.Error,
161
+ code: `CONTROLLER_${contradiction.rule}`,
162
+ source: SOURCE,
163
+ message: `${manifest.kind}/${name ?? "(unnamed)"}: controller candidate "${candidate}": ` +
164
+ contradiction.detail,
165
+ data: { resource, filePath, path: `${at}?${contradiction.axis}` },
166
+ });
167
+ }
168
+ // A `dylib` opens over the Rust controller ABI, and a library built
169
+ // against another version of it must never match — so the candidate states
170
+ // which, in the `telo` family.
171
+ if (parsed.format === "dylib" && !selector.abi?.startsWith("telo-")) {
172
+ out.push({
173
+ severity: DiagnosticSeverity.Error,
174
+ code: "CONTROLLER_DYLIB_ABI_MISSING",
175
+ source: SOURCE,
176
+ message: `${manifest.kind}/${name ?? "(unnamed)"}: dylib candidate "${candidate}" ` +
177
+ (selector.abi === undefined
178
+ ? `states no abi. `
179
+ : `states abi=${selector.abi}, which is not a Rust controller ABI. `) +
180
+ `A dylib is built against one version of the Rust controller ABI and must say which — ` +
181
+ `add abi=telo-<version>, e.g. abi=telo-2. Without it the Rust kernel downloads the ` +
182
+ `library on every host and refuses it only when it opens it.`,
183
+ data: { resource, filePath, path: at },
184
+ });
185
+ }
147
186
  }
148
187
  catch (err) {
149
188
  if (!(err instanceof ArtifactSelectorError))
@@ -0,0 +1,15 @@
1
+ import type { ResourceManifest } from "@telorun/sdk";
2
+ import { type AnalysisDiagnostic } from "./types.js";
3
+ /**
4
+ * The strict half of `native-entries.ts`: what `telo check` reports about a
5
+ * module doc's `native:` block.
6
+ *
7
+ * Every rule is decidable from the manifest and would otherwise surface only on
8
+ * a consumer's host, as a native file that never matches or a layer that
9
+ * overwrites another's file. Shape errors (a missing key, an unknown one) are
10
+ * left to the owner doc's JSON Schema, which reports them in the same pass.
11
+ *
12
+ * Entry-module-scoped: a dependency's block is not the consumer's to fix.
13
+ */
14
+ export declare function validateNativeEntries(manifests: ResourceManifest[], entryModules?: ReadonlySet<string>): AnalysisDiagnostic[];
15
+ //# sourceMappingURL=validate-native-entries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-native-entries.d.ts","sourceRoot":"","sources":["../src/validate-native-entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMrD,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,kBAAkB,EAAE,CA0HtB"}
@@ -0,0 +1,103 @@
1
+ import { describeSelector, selectorContradictions, selectorKey } from "./artifact-selector.js";
2
+ import { moduleDocumentClaims } from "./module-file-claims.js";
3
+ import { describeClaim, nativeClaimConflicts } from "./module-named-files.js";
4
+ import { readNativeEntries } from "./native-entries.js";
5
+ import { DiagnosticSeverity } from "./types.js";
6
+ const SOURCE = "telo-analyzer";
7
+ /**
8
+ * The strict half of `native-entries.ts`: what `telo check` reports about a
9
+ * module doc's `native:` block.
10
+ *
11
+ * Every rule is decidable from the manifest and would otherwise surface only on
12
+ * a consumer's host, as a native file that never matches or a layer that
13
+ * overwrites another's file. Shape errors (a missing key, an unknown one) are
14
+ * left to the owner doc's JSON Schema, which reports them in the same pass.
15
+ *
16
+ * Entry-module-scoped: a dependency's block is not the consumer's to fix.
17
+ */
18
+ export function validateNativeEntries(manifests, entryModules) {
19
+ const out = [];
20
+ for (const manifest of manifests) {
21
+ if (manifest.kind !== "Telo.Application" && manifest.kind !== "Telo.Library")
22
+ continue;
23
+ const metadata = (manifest.metadata ?? {});
24
+ const name = typeof metadata.name === "string" ? metadata.name : undefined;
25
+ const owned = entryModules === undefined ||
26
+ (typeof metadata.module === "string"
27
+ ? entryModules.has(metadata.module)
28
+ : name === undefined || entryModules.has(name));
29
+ if (!owned)
30
+ continue;
31
+ const label = `${manifest.kind}/${name ?? "(unnamed)"}`;
32
+ const report = (code, path, message) => out.push({
33
+ severity: DiagnosticSeverity.Error,
34
+ code,
35
+ source: SOURCE,
36
+ message: `${label}: ${message}`,
37
+ data: {
38
+ resource: { kind: manifest.kind, name },
39
+ filePath: typeof metadata.source === "string" ? metadata.source : undefined,
40
+ path,
41
+ },
42
+ });
43
+ const { entries, problems } = readNativeEntries(manifest);
44
+ for (const problem of problems) {
45
+ if (problem.kind === "shape")
46
+ continue;
47
+ report(problem.kind === "escape" ? "NATIVE_PATH_ESCAPES_MODULE" : "NATIVE_ENTRY_INVALID", problem.path, problem.message);
48
+ }
49
+ if (entries.length === 0)
50
+ continue;
51
+ const moduleName = typeof metadata.module === "string" ? metadata.module : name;
52
+ for (const { entry, claim } of nativeClaimConflicts(entries, moduleDocumentClaims(manifests, moduleName))) {
53
+ report("NATIVE_PATH_CLAIMED", `native[${entry.index}].path`, `${entry.origin}: path '${entry.path}' is also named by ${describeClaim(claim)}. A native ` +
54
+ `file ships only in its platform's native layer and a file extracts from exactly one ` +
55
+ `layer, so publish refuses it — give the native entry its own file, or drop the other ` +
56
+ `declaration.`);
57
+ }
58
+ const bySelector = new Map();
59
+ const byPath = new Map();
60
+ for (const entry of entries) {
61
+ const at = `native[${entry.index}]`;
62
+ if (entry.selector.format === "node" && entry.selector.abi === undefined) {
63
+ report("NATIVE_NODE_ABI_MISSING", at, `${entry.origin}: a 'node' addon is built against one Node ABI and must state it — ` +
64
+ `add abi: node-<NODE_MODULE_VERSION>, e.g. 'node-137'. Without it the file matches ` +
65
+ `every Node release and fails to load on all but one.`);
66
+ }
67
+ for (const contradiction of selectorContradictions(entry.selector)) {
68
+ report(`NATIVE_${contradiction.rule}`, `${at}.${contradiction.axis}`, `${entry.origin}: ${contradiction.detail}`);
69
+ }
70
+ const key = `${entry.name}\0${selectorKey(entry.selector)}`;
71
+ const twin = bySelector.get(key);
72
+ if (twin) {
73
+ report("NATIVE_ENTRY_DUPLICATE", at, `${entry.origin}: ${twin.origin} already declares '${entry.name}' for ` +
74
+ `${describeSelector(entry.selector)}. A name has one entry per platform tuple, or ` +
75
+ `a lookup by name could resolve to either file.`);
76
+ }
77
+ else {
78
+ bySelector.set(key, entry);
79
+ }
80
+ const sharer = byPath.get(entry.path);
81
+ if (sharer && selectorKey(sharer.selector) !== selectorKey(entry.selector)) {
82
+ report("NATIVE_PATH_SHARED", `${at}.path`, `${entry.origin}: path '${entry.path}' is also declared by ${sharer.origin} for ` +
83
+ `${describeSelector(sharer.selector)}. Every layer of a module extracts into one ` +
84
+ `directory, so each platform tuple needs its own path — e.g. ` +
85
+ `'native/<os>-<arch>/…'.`);
86
+ }
87
+ else if (!sharer) {
88
+ byPath.set(entry.path, entry);
89
+ }
90
+ const through = [...byPath.values()].find((other) => other !== entry &&
91
+ (entry.path.startsWith(`${other.path}/`) || other.path.startsWith(`${entry.path}/`)));
92
+ if (through) {
93
+ const relation = entry.path.startsWith(`${through.path}/`)
94
+ ? `runs through '${through.path}' as a directory`
95
+ : `is a directory that '${through.path}' runs through`;
96
+ report("NATIVE_PATH_NESTED", `${at}.path`, `${entry.origin}: path '${entry.path}' ${relation}, and ${through.origin} declares ` +
97
+ `'${through.path}'. Every layer of a module extracts into one directory, so a path ` +
98
+ `cannot be both a file and a directory — give each entry its own path.`);
99
+ }
100
+ }
101
+ }
102
+ return out;
103
+ }
@@ -70,12 +70,18 @@ export declare function observedStateRead(chain: readonly string[]): ObservedSta
70
70
  export declare function collectRunReachableNames(graph: CallGraph): Set<string>;
71
71
  /** What a resource name resolves to for CEL purposes. `status` is present only
72
72
  * when the kind declares one; `scoped` marks a resource declared inside an
73
- * `x-telo-scope` slot, which resolves only within that scope's regions. */
73
+ * `x-telo-scope` slot, which resolves only within that scope's regions.
74
+ * `forwardedFrom` marks a dependency's declaration, keyed by
75
+ * `forwardedResourceKey`: it is in no consumer's `resources`, but a read inside
76
+ * that dependency's own manifests still resolves to it. */
74
77
  export interface AnalyzedResource {
75
78
  kind: string;
76
79
  status?: Record<string, any>;
77
80
  scoped?: boolean;
81
+ forwardedFrom?: string;
78
82
  }
83
+ /** The index key of a name a dependency declares, as read from inside it. */
84
+ export declare function forwardedResourceKey(module: string, name: string): string;
79
85
  /**
80
86
  * Index every resource a CEL `resources.…` read can name: the module's own
81
87
  * top-level resources, the ones declared inside `x-telo-scope` slots (a
@@ -1 +1 @@
1
- {"version":3,"file":"validate-observed-state.d.ts","sourceRoot":"","sources":["../src/validate-observed-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIzE,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgBjD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,SAAS,EAAE,SAAS,gBAAgB,EAAE,GACrC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CA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