@telorun/analyzer 0.70.0 → 0.72.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 (122) hide show
  1. package/dist/analysis-registry.d.ts.map +1 -1
  2. package/dist/analysis-registry.js +4 -5
  3. package/dist/analyzer.d.ts.map +1 -1
  4. package/dist/analyzer.js +92 -10
  5. package/dist/call-graph.d.ts.map +1 -1
  6. package/dist/call-graph.js +10 -4
  7. package/dist/catch-scope.d.ts +72 -0
  8. package/dist/catch-scope.d.ts.map +1 -0
  9. package/dist/catch-scope.js +102 -0
  10. package/dist/cel-scope-query.d.ts +14 -0
  11. package/dist/cel-scope-query.d.ts.map +1 -1
  12. package/dist/cel-scope-query.js +36 -6
  13. package/dist/definition-registry.d.ts.map +1 -1
  14. package/dist/definition-registry.js +3 -4
  15. package/dist/deprecation.d.ts +21 -0
  16. package/dist/deprecation.d.ts.map +1 -0
  17. package/dist/deprecation.js +26 -0
  18. package/dist/flatten-for-analyzer.d.ts +2 -2
  19. package/dist/flatten-for-analyzer.d.ts.map +1 -1
  20. package/dist/flatten-for-analyzer.js +1 -1
  21. package/dist/index.d.ts +5 -3
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +3 -2
  24. package/dist/manifest-visitor.d.ts +17 -1
  25. package/dist/manifest-visitor.d.ts.map +1 -1
  26. package/dist/manifest-visitor.js +16 -4
  27. package/dist/migrations/report.d.ts +1 -1
  28. package/dist/migrations/report.d.ts.map +1 -1
  29. package/dist/migrations/report.js +5 -0
  30. package/dist/module-alias-scope.d.ts +65 -0
  31. package/dist/module-alias-scope.d.ts.map +1 -0
  32. package/dist/module-alias-scope.js +25 -0
  33. package/dist/{zone-module-documents.d.ts → module-documents.d.ts} +11 -7
  34. package/dist/module-documents.d.ts.map +1 -0
  35. package/dist/ref-sentinel-target.d.ts +38 -0
  36. package/dist/ref-sentinel-target.d.ts.map +1 -0
  37. package/dist/ref-sentinel-target.js +13 -0
  38. package/dist/ref-slot.d.ts +15 -0
  39. package/dist/ref-slot.d.ts.map +1 -1
  40. package/dist/ref-slot.js +7 -0
  41. package/dist/resolve-schema-type-refs.d.ts.map +1 -1
  42. package/dist/resolve-schema-type-refs.js +2 -1
  43. package/dist/resolve-throws-union.d.ts +47 -2
  44. package/dist/resolve-throws-union.d.ts.map +1 -1
  45. package/dist/resolve-throws-union.js +199 -20
  46. package/dist/resolve-zone-requirements.d.ts +3 -3
  47. package/dist/resolve-zone-requirements.d.ts.map +1 -1
  48. package/dist/resolve-zone-requirements.js +12 -12
  49. package/dist/schema-compat.d.ts.map +1 -1
  50. package/dist/schema-compat.js +13 -1
  51. package/dist/schema-error-report.d.ts.map +1 -1
  52. package/dist/schema-error-report.js +48 -4
  53. package/dist/schema-keywords.d.ts.map +1 -1
  54. package/dist/schema-keywords.js +3 -1
  55. package/dist/schema-walk.d.ts +27 -0
  56. package/dist/schema-walk.d.ts.map +1 -1
  57. package/dist/schema-walk.js +44 -0
  58. package/dist/telo-version.d.ts +1 -1
  59. package/dist/telo-version.js +1 -1
  60. package/dist/template-body.d.ts.map +1 -1
  61. package/dist/template-body.js +2 -4
  62. package/dist/types.d.ts +20 -3
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/types.js +11 -0
  65. package/dist/validate-identifier-names.d.ts +2 -2
  66. package/dist/validate-identifier-names.d.ts.map +1 -1
  67. package/dist/validate-identifier-names.js +22 -7
  68. package/dist/validate-invocation-contract.d.ts +5 -0
  69. package/dist/validate-invocation-contract.d.ts.map +1 -1
  70. package/dist/validate-invocation-contract.js +114 -3
  71. package/dist/validate-logging.d.ts.map +1 -1
  72. package/dist/validate-logging.js +2 -2
  73. package/dist/validate-ref-slots.d.ts +1 -1
  74. package/dist/validate-ref-slots.d.ts.map +1 -1
  75. package/dist/validate-ref-slots.js +34 -0
  76. package/dist/validate-references.d.ts +16 -5
  77. package/dist/validate-references.d.ts.map +1 -1
  78. package/dist/validate-references.js +57 -15
  79. package/dist/validate-resource-inputs.d.ts +1 -26
  80. package/dist/validate-resource-inputs.d.ts.map +1 -1
  81. package/dist/validate-resource-inputs.js +12 -2
  82. package/dist/validate-schema-type-refs.d.ts.map +1 -1
  83. package/dist/validate-schema-type-refs.js +2 -1
  84. package/dist/validate-throws-coverage.d.ts +5 -1
  85. package/dist/validate-throws-coverage.d.ts.map +1 -1
  86. package/dist/validate-throws-coverage.js +241 -86
  87. package/package.json +3 -3
  88. package/src/analysis-registry.ts +4 -5
  89. package/src/analyzer.ts +115 -11
  90. package/src/call-graph.ts +9 -3
  91. package/src/catch-scope.ts +157 -0
  92. package/src/cel-scope-query.ts +45 -8
  93. package/src/definition-registry.ts +3 -6
  94. package/src/deprecation.ts +36 -0
  95. package/src/flatten-for-analyzer.ts +3 -3
  96. package/src/index.ts +10 -3
  97. package/src/manifest-visitor.ts +30 -5
  98. package/src/migrations/report.ts +5 -1
  99. package/src/module-alias-scope.ts +94 -0
  100. package/src/{zone-module-documents.ts → module-documents.ts} +10 -6
  101. package/src/ref-sentinel-target.ts +46 -0
  102. package/src/ref-slot.ts +19 -0
  103. package/src/resolve-schema-type-refs.ts +2 -1
  104. package/src/resolve-throws-union.ts +253 -20
  105. package/src/resolve-zone-requirements.ts +14 -14
  106. package/src/schema-compat.ts +13 -0
  107. package/src/schema-error-report.ts +50 -6
  108. package/src/schema-keywords.ts +4 -1
  109. package/src/schema-walk.ts +56 -0
  110. package/src/telo-version.ts +1 -1
  111. package/src/template-body.ts +2 -5
  112. package/src/types.ts +21 -3
  113. package/src/validate-identifier-names.ts +28 -9
  114. package/src/validate-invocation-contract.ts +128 -2
  115. package/src/validate-logging.ts +2 -3
  116. package/src/validate-ref-slots.ts +41 -1
  117. package/src/validate-references.ts +74 -14
  118. package/src/validate-resource-inputs.ts +26 -3
  119. package/src/validate-schema-type-refs.ts +2 -1
  120. package/src/validate-throws-coverage.ts +344 -92
  121. package/dist/zone-module-documents.d.ts.map +0 -1
  122. /package/dist/{zone-module-documents.js → module-documents.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EAAE,gBAAgB,EAAE,EAC7B,OAAO,GAAE,uBAA4B,GACpC,eAAe;IAsBlB;;;;OAIG;IACH,kBAAkB,IAAI,kBAAkB,EAAE;IAI1C,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAM/D;;;;gCAI4B;IAC5B,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAMlF;;;;;;;;yCAQqC;IACrC,qBAAqB,CAAC,GAAG,EAAE;QACzB,QAAQ,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAChC,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS;IAQpD;;qFAEiF;IACjF,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;IAUzC,QAAQ,IAAI,MAAM,EAAE;IAIpB;mEAC+D;IAC/D,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAIxC;;;gCAG4B;IAC5B,oBAAoB,IAAI,MAAM,EAAE;IAIhC;wEACoE;IACpE,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIhD;;;;;;;;iDAQ6C;IAC7C,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS;IAqB9D;;;;;gEAK4D;IAC5D,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAiB7D,qFAAqF;IACrF,QAAQ,IAAI,eAAe;CAG5B"}
@@ -6,6 +6,7 @@ import { computeSuggestKind, computeValidUserFacingKinds } from "./kind-suggest.
6
6
  import { visitManifest as runVisitManifest } from "./manifest-visitor.js";
7
7
  import { resolveContract } from "./invocation-contract.js";
8
8
  import { createResolveCtx, resolveThrowsUnion } from "./resolve-throws-union.js";
9
+ import { moduleAliasScope } from "./module-alias-scope.js";
9
10
  import { isRefEntry, isScopeEntry } from "./reference-field-map.js";
10
11
  import { resolveSchemaTypeRefs as resolveSchemaTypeRefsIn } from "./resolve-schema-type-refs.js";
11
12
  /**
@@ -206,8 +207,7 @@ export class AnalysisRegistry {
206
207
  */
207
208
  resolveSchemaFrom(schemaFrom, declaringKind) {
208
209
  const def = this.resolveDefinition(declaringKind);
209
- const ownerModule = def?.metadata?.module;
210
- const scope = (ownerModule ? this.aliasesByModule.get(ownerModule) : undefined) ?? this.aliases;
210
+ const scope = moduleAliasScope(def?.metadata, this.aliases, this.aliasesByModule);
211
211
  return this.defs.resolveSchemaFromNode(schemaFrom, scope);
212
212
  }
213
213
  /**
@@ -271,7 +271,7 @@ export class AnalysisRegistry {
271
271
  * the kind was read off. Falls back to the global table when the module is
272
272
  * unknown or is a root. */
273
273
  resolveDefinitionIn(kind, module) {
274
- const scope = (module ? this.aliasesByModule.get(module) : undefined) ?? this.aliases;
274
+ const scope = moduleAliasScope({ module }, this.aliases, this.aliasesByModule);
275
275
  const canonical = scope.resolveKind(kind);
276
276
  return this.defs.resolve(kind) ?? (canonical ? this.defs.resolve(canonical) : undefined);
277
277
  }
@@ -285,8 +285,7 @@ export class AnalysisRegistry {
285
285
  * fall back to an un-inherited view. Mirrors the module-scope selection in
286
286
  * `expandedFieldMapForResource`. */
287
287
  resolverForDefinition(def) {
288
- const ownModule = def?.metadata?.module;
289
- const scope = (ownModule ? this.aliasesByModule.get(ownModule) : undefined) ?? this.aliases;
288
+ const scope = moduleAliasScope(def?.metadata, this.aliases, this.aliasesByModule);
290
289
  return (kind) => {
291
290
  const canonical = scope.resolveKind(kind);
292
291
  return this.defs.resolve(kind) ?? (canonical ? this.defs.resolve(canonical) : undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc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AAC,CAAC;CACtC;AA6DD,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAkFD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,OAAO,GAAE,qBAA0B;IAI/C;;;;;;;;;;;;;;OAcG;IACH,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,EAC3B,eAAe,CAAC,EAAE,eAAe,GAChC,kBAAkB,EAAE;IAsiEvB,aAAa,CACX,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,EAC3B,eAAe,CAAC,EAAE,eAAe,GAChC,kBAAkB,EAAE;IAMvB,SAAS,CACP,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,EAI1B,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,GACtC,gBAAgB,EAAE;IAyBrB,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,GACzB;QAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAsB5F"}
package/dist/analyzer.js CHANGED
@@ -3,6 +3,7 @@ import { defaultRegistry, isRefSentinel, isTaggedSentinel, plainChainOf, } from
3
3
  import { AliasResolver, scopeResolverForModule, } from "./alias-resolver.js";
4
4
  import { buildCelEnvironment, isKindDocument, } from "./cel-environment.js";
5
5
  import { DefinitionRegistry } from "./definition-registry.js";
6
+ import { readDeprecation } from "./deprecation.js";
6
7
  import { effectiveAuthorSchema } from "./extends-resolution.js";
7
8
  import { analyzerContractScope, resolveContract, } from "./invocation-contract.js";
8
9
  import { buildCallGraph } from "./call-graph.js";
@@ -11,6 +12,7 @@ import { buildKernelGlobalsIndex, KERNEL_GLOBAL_NAMES, } from "./kernel-globals.
11
12
  import { buildObservedStateIndex, buildObservedStateResourcesSchema, collectRunReachableNames, observedStateRead, validateObservedStateDeclarations, } from "./validate-observed-state.js";
12
13
  import { computeSuggestKind } from "./kind-suggest.js";
13
14
  import { visitManifest } from "./manifest-visitor.js";
15
+ import { declaringModuleScope, moduleAliasScope } from "./module-alias-scope.js";
14
16
  import { isModuleKind } from "./module-kinds.js";
15
17
  import { normalizeInlineResources } from "./normalize-inline-resources.js";
16
18
  import { REF_VALIDATION_SKIP_KINDS } from "./system-kinds.js";
@@ -43,7 +45,7 @@ import { validateSchemaTypeRefs } from "./validate-schema-type-refs.js";
43
45
  import { rewriteSyntheticOrigins } from "./rewrite-synthetic-origins.js";
44
46
  import { celTypeSatisfiesJsonSchema, checkSchemaCompatibility, navigateSchemaToExprPath, substituteCelFields, validateAgainstSchema, } from "./schema-compat.js";
45
47
  import { collectValueSchemaIssues } from "./validate-value-schema.js";
46
- import { DiagnosticSeverity } from "./types.js";
48
+ import { DiagnosticSeverity, DiagnosticTag, } from "./types.js";
47
49
  import { extractAccessChains, } from "./validate-cel-context.js";
48
50
  import { celEvalModeAt, celEvalSites, mergeCelEvalSites, NO_CEL_EVAL_SITES, } from "./eval-paths.js";
49
51
  import { BINDINGS_ANNOTATION, findBindingSites, resolveBindingOrder, } from "./cel-bindings.js";
@@ -818,9 +820,10 @@ export class StaticAnalyzer {
818
820
  continue;
819
821
  const def = m;
820
822
  const ownModule = def.metadata?.module;
821
- const scopeResolver = ownModule && !rootModules.has(ownModule)
822
- ? (aliasesByModule.get(ownModule) ?? new AliasResolver())
823
- : aliases;
823
+ const scopeResolver = declaringModuleScope(ownModule, aliases, {
824
+ aliasesByModule,
825
+ rootModules,
826
+ });
824
827
  // Canonicalize alias-form `x-telo-ref` constraints in the DECLARING module's
825
828
  // scope, before the schema reaches `register()` and the lazily-built field
826
829
  // maps. Same pre-resolution `capability` / `extends` get below.
@@ -1216,7 +1219,7 @@ export class StaticAnalyzer {
1216
1219
  // analyzer knowing it exists: going native costs a module, not a change
1217
1220
  // here.
1218
1221
  const resolveRegionDef = (kind, module) => {
1219
- const scope = (module ? aliasesByModule.get(module) : undefined) ?? aliases;
1222
+ const scope = moduleAliasScope({ module }, aliases, aliasesByModule);
1220
1223
  const canonical = scope.resolveKind(kind);
1221
1224
  return defs.resolve(kind) ?? (canonical ? defs.resolve(canonical) : undefined);
1222
1225
  };
@@ -1244,7 +1247,10 @@ export class StaticAnalyzer {
1244
1247
  if (!ownModule || !m.metadata?.name || typeof m.schema !== "object" || m.schema === null) {
1245
1248
  continue;
1246
1249
  }
1247
- const scopeResolver = rootModules.has(ownModule) ? aliases : (aliasesByModule.get(ownModule) ?? new AliasResolver());
1250
+ const scopeResolver = declaringModuleScope(ownModule, aliases, {
1251
+ aliasesByModule,
1252
+ rootModules,
1253
+ });
1248
1254
  const canonicalKind = scopeResolver.resolveKind(m.kind) ?? m.kind;
1249
1255
  if (defs.resolve(canonicalKind)?.capability !== "Telo.Type")
1250
1256
  continue;
@@ -1303,7 +1309,7 @@ export class StaticAnalyzer {
1303
1309
  // unchecked where it is declared and its consequences land at whichever
1304
1310
  // CEL site reads it — for a hyphen, sometimes as silent arithmetic. Takes
1305
1311
  // the call graph for step names rather than re-walking the step arrays.
1306
- diagnostics.push(...validateIdentifierNames(allManifests, defs, aliases, rootModules, getCallGraph()));
1312
+ diagnostics.push(...validateIdentifierNames(allManifests, defs, aliases, rootModules, getCallGraph(), { aliasesByModule, rootModules }));
1307
1313
  // A file embed resolves at resource creation, so one written on a doc that
1308
1314
  // is never instantiated is read by nothing and would ship silently.
1309
1315
  diagnostics.push(...validateIncludePlacement(allManifests));
@@ -1618,6 +1624,74 @@ export class StaticAnalyzer {
1618
1624
  });
1619
1625
  continue;
1620
1626
  }
1627
+ // An abstract names a CONTRACT for reference slots, not something to
1628
+ // instantiate — the kernel refuses it outright at `create()`. Reported
1629
+ // here, at the declaration, because that is the line the author has to
1630
+ // change and because a runtime-only refusal is exactly the shape static
1631
+ // analysis exists to remove. The hint mirrors the kernel's: the concrete
1632
+ // implementations this analysis holds, or the reason there are none.
1633
+ //
1634
+ // Injected declarations never reach this loop (skipped above), which is
1635
+ // what keeps a `resources:` entry — kind-only and routinely abstract by
1636
+ // design — out of it.
1637
+ if (definition.kind === "Telo.Abstract") {
1638
+ const canonical = resolvedKind ?? m.kind;
1639
+ const impls = defs
1640
+ .getByExtends(canonical)
1641
+ .filter((d) => d.kind !== "Telo.Abstract")
1642
+ .map((d) => `${d.metadata.module}.${d.metadata.name}`);
1643
+ const kindInfo = canonical !== m.kind ? `'${m.kind}' (resolved to '${canonical}')` : `'${m.kind}'`;
1644
+ const hint = impls.length
1645
+ ? `instantiate a concrete implementation: ${impls.join(", ")}`
1646
+ : "no concrete implementations are registered — import a module that provides one";
1647
+ diagnostics.push({
1648
+ severity: DiagnosticSeverity.Error,
1649
+ code: "ABSTRACT_KIND_INSTANTIATED",
1650
+ source: SOURCE,
1651
+ message: `Kind ${kindInfo} is abstract and cannot be instantiated directly; ${hint}.`,
1652
+ data: { resource, filePath, path: "kind" },
1653
+ });
1654
+ continue;
1655
+ }
1656
+ // A kind its own author marked `metadata.deprecated` still works exactly as
1657
+ // it did — the manifest is valid and keeps running — so this is a WARNING,
1658
+ // reported at the declaration because `kind:` is the line that has to
1659
+ // change. Emitted here rather than in a pass of its own so it reads the
1660
+ // kind THIS walk resolved: the resolution is alias- and gate-aware and
1661
+ // scope-dependent, and a second implementation of it would eventually
1662
+ // disagree about which definition a name means.
1663
+ //
1664
+ // Entry-module-scoped, like every other "not the consumer's to fix" check:
1665
+ // a library's internal use of a kind its own author deprecated is that
1666
+ // author's concern, and reporting it floods a consumer with lines they
1667
+ // cannot act on.
1668
+ //
1669
+ // No `DiagnosticFix`. `replacedBy` names a kind through the DECLARING
1670
+ // module's aliases; writing it into the consumer's file would produce a
1671
+ // prefix that resolves to nothing there — and a kind swap is not a
1672
+ // whole-value replacement anyway, since the successor needs its own import
1673
+ // and usually a different configuration.
1674
+ const deprecation = readDeprecation(definition.metadata);
1675
+ if (deprecation && (!ownModule || rootModules.has(ownModule))) {
1676
+ // Quoted CANONICALLY, not verbatim: `Self.Thing` is how the declaring
1677
+ // library names its own kind and means nothing where the warning lands.
1678
+ const declaringScope = scopeResolverForModule(definition.metadata?.module, rootModules, aliasesByModule) ?? aliases;
1679
+ const replacement = deprecation.replacedBy
1680
+ ? (declaringScope.resolveKind(deprecation.replacedBy) ?? deprecation.replacedBy)
1681
+ : undefined;
1682
+ diagnostics.push({
1683
+ severity: DiagnosticSeverity.Warning,
1684
+ code: "DEPRECATED_KIND",
1685
+ source: SOURCE,
1686
+ // Warning-grade AND a deprecation: the severity says it must
1687
+ // eventually be dealt with, the tag says what it is, and an editor
1688
+ // strikes the kind through on the strength of the second.
1689
+ tags: [DiagnosticTag.Deprecated],
1690
+ message: `Kind '${m.kind}' is deprecated: ${deprecation.reason}` +
1691
+ (replacement ? ` Use '${replacement}' instead.` : ""),
1692
+ data: { resource, filePath, path: "kind" },
1693
+ });
1694
+ }
1621
1695
  // Validate resource config against the definition's AUTHOR-FACING schema —
1622
1696
  // inheritance-resolved, with `kind` / `metadata` injected. See
1623
1697
  // `validationSchemaFor`, which is where both derivations and the reason
@@ -2317,8 +2391,16 @@ export class StaticAnalyzer {
2317
2391
  diagnostics.push(...validateInvocationContract(allManifests, defs, aliases, aliasesByModule));
2318
2392
  // Validate provider coherence rules for `provide:` template-target definitions.
2319
2393
  diagnostics.push(...validateProviderCoherence(allManifests, defs, aliases));
2320
- // Validate throws: declarations and catches: coverage (rules 1, 2, 4, 7)
2321
- diagnostics.push(...validateThrowsCoverage(allManifests, defs, aliases, this.celEnv, aliasesByModule, rootModules));
2394
+ // Validate throws: declarations and catches: coverage (rules 1, 2, 4, 7).
2395
+ // The library document sets collected for the zone stage serve here too: a
2396
+ // library's exported entry point is forwarded into the flat set while the
2397
+ // siblings it invokes are not, so without them the walk stops at the
2398
+ // boundary and reports an empty union for a body that plainly throws.
2399
+ const libraryManifests = new Map();
2400
+ for (const doc of options?.moduleDocuments ?? []) {
2401
+ libraryManifests.set(doc.module, doc.manifests);
2402
+ }
2403
+ diagnostics.push(...validateThrowsCoverage(allManifests, defs, aliases, this.celEnv, aliasesByModule, rootModules, libraryManifests));
2322
2404
  // Warn about declared variables / secrets / ports that no CEL references.
2323
2405
  diagnostics.push(...validateUnusedDeclarations(allManifests, this.celEnv));
2324
2406
  // A `!ref` at a definition's dispatch slot must name a sibling `resources:`
@@ -2326,7 +2408,7 @@ export class StaticAnalyzer {
2326
2408
  // advertise a resolution nothing performs.
2327
2409
  diagnostics.push(...validateTemplateDispatch(allManifests, rootModules));
2328
2410
  // A library's declared resource inputs, and every import that supplies them.
2329
- diagnostics.push(...validateResourceInputs(allManifests, defs, aliases, rootModules, (supplied, required) => kindSatisfies(supplied, required, defs)));
2411
+ diagnostics.push(...validateResourceInputs(allManifests, defs, aliases, rootModules, (supplied, required, isDeclaration) => kindSatisfies(supplied, required, defs, isDeclaration)));
2330
2412
  // Reroute diagnostics on synthetic (inline-extracted) resources back to
2331
2413
  // the chain root so position-index lookups land on the parent doc.
2332
2414
  return rewriteSyntheticOrigins(suppressUnreadableModuleDiagnostics(diagnostics, unreadableFiles), allManifests);
@@ -1 +1 @@
1
- {"version":3,"file":"call-graph.d.ts","sourceRoot":"","sources":["../src/call-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAOnE,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,WAAW,EACjB,MAAM,eAAe,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AC,MAAM,CAAC,CAAC,CAmB1B"}
@@ -1,10 +1,12 @@
1
1
  import { isRefSentinel, isTaggedSentinel } from "@telorun/templating";
2
+ import { refSentinelTarget } from "./ref-sentinel-target.js";
2
3
  import { enclosingOf, propertySchemas, resolveLocalRef, } from "./manifest-navigation.js";
3
4
  import { visitManifest } from "./manifest-visitor.js";
4
5
  import { possibleUses, readRefSlot, transfersControl, } from "./ref-slot.js";
5
6
  import { isStepSlot } from "./step-slot.js";
6
7
  import { isInlineResource, isRefEntry, resolveFieldEntries, } from "./reference-field-map.js";
7
8
  import { DEPENDENCY_GRAPH_SKIP_KINDS as SYSTEM_KINDS } from "./system-kinds.js";
9
+ import { moduleAliasScope } from "./module-alias-scope.js";
8
10
  export const resourceId = (kind, name) => `${kind}\0${name}`;
9
11
  /**
10
12
  * The id a manifest's node is keyed by.
@@ -437,8 +439,7 @@ export function buildCallGraph(resources, registry, options = {}) {
437
439
  const direct = registry.resolve(manifest.kind);
438
440
  if (direct)
439
441
  return direct;
440
- const module = manifest.metadata?.module;
441
- const scope = (module ? options.aliasesByModule?.get(module) : undefined) ?? options.aliases;
442
+ const scope = moduleAliasScope(manifest.metadata, options.aliases, options.aliasesByModule);
442
443
  const canonical = scope?.resolveKind(manifest.kind);
443
444
  return canonical ? registry.resolve(canonical) : undefined;
444
445
  };
@@ -695,8 +696,13 @@ export function buildCallGraph(resources, registry, options = {}) {
695
696
  * here: an unresolved `!ref <name>` sentinel and the `{kind, name}` object
696
697
  * `resolveRefSentinels` rewrites it into. */
697
698
  function refTargetName(value) {
698
- if (isRefSentinel(value))
699
- return value.source;
699
+ // An edge's target is taken VERBATIM — `resolveScopedName` and the node index
700
+ // are what resolve it, and a cross-module `Alias.name` is a target this graph
701
+ // legitimately carries unresolved. That is this pass's reduction over the
702
+ // shared parse, not a second reading of the tag.
703
+ const sentinel = refSentinelTarget(value);
704
+ if (sentinel)
705
+ return sentinel.source;
700
706
  if (!value || typeof value !== "object")
701
707
  return undefined;
702
708
  const name = value.name;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Which `catches:` lists answer for one dispatch site.
3
+ *
4
+ * A catch list is one rung of a SCOPE LADDER — a route's, its router's, its
5
+ * server's — and every rule over those lists needs the same two answers: what
6
+ * a scope list is checked against, and which scopes enclose a given site. This
7
+ * module owns that model; the rule checks in `validate-throws-coverage.ts` read
8
+ * one answer instead of rebuilding it beside four unrelated jobs.
9
+ *
10
+ * Browser-safe: no Node built-ins.
11
+ */
12
+ import type { DefinitionRegistry } from "./definition-registry.js";
13
+ import type { AliasResolver } from "./alias-resolver.js";
14
+ import type { ResourceManifest } from "@telorun/sdk";
15
+ import { type ResolveCtx } from "./resolve-throws-union.js";
16
+ /** What a list proves it renders: the codes its coverage-proving `when:` clauses
17
+ * name, and whether it ends in a catch-all.
18
+ *
19
+ * Unfiltered by any denominator, because this is also what an enclosing scope
20
+ * contributes DOWNWARD — a server entry naming a code the server's own closure
21
+ * could not enumerate still renders it for the route that throws it. Filtering
22
+ * the local answer against the declared union happens where that answer is
23
+ * used, and subtracting from the declared set makes the two equivalent there. */
24
+ export interface ProvenCoverage {
25
+ codes: Set<string>;
26
+ hasCatchAll: boolean;
27
+ }
28
+ export declare const NO_COVERAGE: ProvenCoverage;
29
+ /** A declaration inside another resource's `x-telo-scope` array, kept with the
30
+ * resource that encloses it and the path it is written at in that resource's
31
+ * document. Both are needed: the owner is the only place its kind's alias scope
32
+ * can be found, and the only document position lookup can reach. */
33
+ export interface ScopedManifest {
34
+ manifest: ResourceManifest;
35
+ owner: ResourceManifest;
36
+ /** Concrete owner-relative path of the declaration (`with[0]`). */
37
+ path: string;
38
+ }
39
+ /** Every `with:`-scoped declaration in the set, once each.
40
+ *
41
+ * Scoped resources are absent from the flat manifest list, so every check that
42
+ * iterates it skips them — and standing a server up around a test is exactly
43
+ * that shape, so the sanctioned pattern was the one the pass could not see.
44
+ * Discovered through the shared visitor rather than a second scope walk. */
45
+ export declare function collectScopedManifests(manifests: ResourceManifest[], defs: DefinitionRegistry, aliases: AliasResolver, aliasesByModule: Map<string, AliasResolver>, rootModules: Set<string>): ScopedManifest[];
46
+ /** Which resources each resource's scope list encloses, along the slots that
47
+ * declare `throwsThrough` — one fact stated once, since the edge a throws
48
+ * closure crosses is the edge a catch scope encloses through. */
49
+ export declare function buildEnclosers(manifests: ResourceManifest[], definitionOf: (m: ResourceManifest) => {
50
+ schema?: Record<string, any>;
51
+ } | undefined, moduleOf: (m: ResourceManifest) => string | undefined, ctx: ResolveCtx): Map<ResourceManifest, ResourceManifest[]>;
52
+ /**
53
+ * What every scope enclosing a resource is guaranteed to render for it.
54
+ *
55
+ * **Across enclosers this INTERSECTS, and that is the whole correctness of the
56
+ * reduction.** Coverage claims that a throw cannot escape unrendered, so it holds
57
+ * only when EVERY path to the site renders it — a router mounted on a public
58
+ * server with a catch-all and an internal one without is covered on one path and
59
+ * bare on the other, and unioning the two reported it as fully covered while the
60
+ * internal server answered with the built-in envelope. A resource with no
61
+ * encloser contributes nothing rather than everything: the empty set is the
62
+ * identity for the site's own coverage, and treating "no paths" as "all paths
63
+ * agree" would assert coverage no list provides.
64
+ *
65
+ * A resource's OWN scope list is unioned in, because it applies on every path.
66
+ *
67
+ * Memoized, and a cycle among `throwsThrough` edges resolves to what has been
68
+ * accumulated so far rather than raising: this answers what a scope renders, and
69
+ * no cycle makes that answer larger.
70
+ */
71
+ export declare function enclosingCoverage(manifest: ResourceManifest, ownScope: Map<ResourceManifest, ProvenCoverage>, enclosers: Map<ResourceManifest, ResourceManifest[]>, memo?: Map<ResourceManifest, ProvenCoverage>, walking?: Set<ResourceManifest>): ProvenCoverage;
72
+ //# sourceMappingURL=catch-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catch-scope.d.ts","sourceRoot":"","sources":["../src/catch-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK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,CAAC,EAC/C,SAAS,EAAE,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,CAAC,EACpD,IAAI,GAAE,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAa,EACvD,OAAO,GAAE,GAAG,CAAC,gBAAgB,CAAa,GACzC,cAAc,CAgChB"}
@@ -0,0 +1,102 @@
1
+ import { visitManifest } from "./manifest-visitor.js";
2
+ import { forEachDrivenSlot } from "./schema-walk.js";
3
+ import { resolveRefManifest } from "./resolve-throws-union.js";
4
+ export const NO_COVERAGE = { codes: new Set(), hasCatchAll: false };
5
+ /** Every `with:`-scoped declaration in the set, once each.
6
+ *
7
+ * Scoped resources are absent from the flat manifest list, so every check that
8
+ * iterates it skips them — and standing a server up around a test is exactly
9
+ * that shape, so the sanctioned pattern was the one the pass could not see.
10
+ * Discovered through the shared visitor rather than a second scope walk. */
11
+ export function collectScopedManifests(manifests, defs, aliases, aliasesByModule, rootModules) {
12
+ const scoped = [];
13
+ visitManifest(manifests, defs, {
14
+ onScope: (event) => {
15
+ for (const { manifest, path } of event.declarations) {
16
+ if (!manifest?.kind || !manifest.metadata?.name)
17
+ continue;
18
+ scoped.push({ manifest, owner: event.source, path });
19
+ }
20
+ },
21
+ }, { aliases, aliasesByModule, rootModules });
22
+ return scoped;
23
+ }
24
+ /** Which resources each resource's scope list encloses, along the slots that
25
+ * declare `throwsThrough` — one fact stated once, since the edge a throws
26
+ * closure crosses is the edge a catch scope encloses through. */
27
+ export function buildEnclosers(manifests, definitionOf, moduleOf, ctx) {
28
+ const enclosers = new Map();
29
+ for (const manifest of manifests) {
30
+ const definition = definitionOf(manifest);
31
+ if (!definition?.schema)
32
+ continue;
33
+ forEachDrivenSlot(definition.schema, manifest, (driven) => {
34
+ if (driven.kind !== "ref" || !driven.slot.throwsThrough)
35
+ return;
36
+ const target = resolveRefManifest(driven.data, ctx, moduleOf(manifest));
37
+ if (!target || target === manifest)
38
+ return;
39
+ const list = enclosers.get(target);
40
+ if (list)
41
+ list.push(manifest);
42
+ else
43
+ enclosers.set(target, [manifest]);
44
+ });
45
+ }
46
+ return enclosers;
47
+ }
48
+ /**
49
+ * What every scope enclosing a resource is guaranteed to render for it.
50
+ *
51
+ * **Across enclosers this INTERSECTS, and that is the whole correctness of the
52
+ * reduction.** Coverage claims that a throw cannot escape unrendered, so it holds
53
+ * only when EVERY path to the site renders it — a router mounted on a public
54
+ * server with a catch-all and an internal one without is covered on one path and
55
+ * bare on the other, and unioning the two reported it as fully covered while the
56
+ * internal server answered with the built-in envelope. A resource with no
57
+ * encloser contributes nothing rather than everything: the empty set is the
58
+ * identity for the site's own coverage, and treating "no paths" as "all paths
59
+ * agree" would assert coverage no list provides.
60
+ *
61
+ * A resource's OWN scope list is unioned in, because it applies on every path.
62
+ *
63
+ * Memoized, and a cycle among `throwsThrough` edges resolves to what has been
64
+ * accumulated so far rather than raising: this answers what a scope renders, and
65
+ * no cycle makes that answer larger.
66
+ */
67
+ export function enclosingCoverage(manifest, ownScope, enclosers, memo = new Map(), walking = new Set()) {
68
+ const cached = memo.get(manifest);
69
+ if (cached)
70
+ return cached;
71
+ if (walking.has(manifest))
72
+ return NO_COVERAGE;
73
+ walking.add(manifest);
74
+ try {
75
+ const own = ownScope.get(manifest);
76
+ const result = {
77
+ codes: new Set(own?.codes ?? []),
78
+ hasCatchAll: own?.hasCatchAll ?? false,
79
+ };
80
+ const outer = (enclosers.get(manifest) ?? []).map((e) => enclosingCoverage(e, ownScope, enclosers, memo, walking));
81
+ if (outer.length > 0) {
82
+ const [first, ...rest] = outer;
83
+ const shared = new Set(first.codes);
84
+ let everyCatchAll = first.hasCatchAll;
85
+ for (const other of rest) {
86
+ for (const code of [...shared])
87
+ if (!other.codes.has(code))
88
+ shared.delete(code);
89
+ everyCatchAll &&= other.hasCatchAll;
90
+ }
91
+ for (const code of shared)
92
+ result.codes.add(code);
93
+ if (everyCatchAll)
94
+ result.hasCatchAll = true;
95
+ }
96
+ memo.set(manifest, result);
97
+ return result;
98
+ }
99
+ finally {
100
+ walking.delete(manifest);
101
+ }
102
+ }
@@ -24,6 +24,12 @@ export interface ContextDeclarationSite {
24
24
  kind: string;
25
25
  name: string;
26
26
  path: string;
27
+ /** The declaring module, when the manifest carries one. Part of the identity,
28
+ * not decoration: a resource name is unique inside its module and not across a
29
+ * flattened set, so `(kind, name)` alone lets a host locating this site land on
30
+ * another library's same-named document — which for go-to-declaration means
31
+ * jumping to the wrong file with nothing to indicate it. */
32
+ module?: string;
27
33
  }
28
34
  /** The analyzer state a query resolves against — what an `AnalysisRegistry`
29
35
  * already holds, plus the manifest set the caller analyzed. */
@@ -101,6 +107,14 @@ export declare class CelScopeQuery {
101
107
  * and no resource kind is named here.
102
108
  */
103
109
  stepDeclarationPath(resource: ResourceManifest, stepName: string): string | undefined;
110
+ /** The kind's declaration, resolved in the scope of the module that DECLARED
111
+ * this resource — the same rule the manifest visitor applies, and the reason
112
+ * it has to be the same one: everything this query offers is read off the
113
+ * definition, so resolving a forwarded library resource's `kind: Http.Api`
114
+ * through the entry's aliases alone found nothing and the editor silently
115
+ * offered no `request` / `result` at a site `telo check` accepts. A
116
+ * completion list is a claim that the name it offers will pass the checker,
117
+ * so the two must resolve a kind identically. */
104
118
  private definitionFor;
105
119
  /** The `x-telo-context` region this path falls in, matched exactly as the
106
120
  * manifest visitor matches it for an expression it walked onto. */
@@ -1 +1 @@
1
- {"version":3,"file":"cel-scope-query.d.ts","sourceRoot":"","sources":["../src/cel-scope-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;A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SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS;IAI7F;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ;IAe3D;;;;;;;;;;;;;;;;;;OAkBG;IACH,sBAAsB,CACpB,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EAAE,GACd,sBAAsB,GAAG,SAAS;IA0CrC;oFACgF;IAChF,OAAO,CAAC,QAAQ;IAgFhB;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAqBrF;;;;;;;sDAOkD;IAClD,OAAO,CAAC,aAAa;IAOrB;wEACoE;IACpE,OAAO,CAAC,YAAY;CAarB"}
@@ -1,6 +1,7 @@
1
1
  import { buildCelEnvironment } from "./cel-environment.js";
2
2
  import { CelScopeResolver } from "./cel-scope.js";
3
3
  import { buildKernelGlobalsIndex } from "./kernel-globals.js";
4
+ import { moduleAliasScope } from "./module-alias-scope.js";
4
5
  import { isModuleKind } from "./module-kinds.js";
5
6
  import { navigateConcretePath } from "./manifest-path.js";
6
7
  import { findManifest } from "./find-manifest.js";
@@ -158,7 +159,12 @@ export class CelScopeQuery {
158
159
  const metadata = origin.manifest.metadata;
159
160
  if (!origin.manifest.kind || !metadata?.name)
160
161
  return undefined;
161
- return { kind: origin.manifest.kind, name: metadata.name, path: base };
162
+ return {
163
+ kind: origin.manifest.kind,
164
+ name: metadata.name,
165
+ path: base,
166
+ ...(metadata.module === undefined ? {} : { module: metadata.module }),
167
+ };
162
168
  }
163
169
  /** The manifest and path an annotated context property is derived from, and
164
170
  * whether that node holds a property MAP (names directly) or a JSON Schema. */
@@ -204,10 +210,25 @@ export class CelScopeQuery {
204
210
  const kindValue = navigateConcretePath(root, first.slice(0, hash).split("/").join("."));
205
211
  if (typeof kindValue !== "string")
206
212
  return undefined;
207
- const canonical = this.ctx.aliases.resolveKind(kindValue) ?? kindValue;
208
- const suffix = canonical.slice(canonical.indexOf(".") + 1);
209
- const target = this.manifests.find((m) => (m.kind === "Telo.Definition" || m.kind === "Telo.Abstract") &&
213
+ // The kind was read off THIS resource, so it is spelled in the alias scope
214
+ // of the module that declared it — not the entry's.
215
+ const scope = moduleAliasScope(resource.metadata, this.ctx.aliases, this.ctx.aliasesByModule);
216
+ const canonical = scope.resolveKind(kindValue) ?? kindValue;
217
+ const dot = canonical.indexOf(".");
218
+ const owningModule = dot === -1 ? undefined : canonical.slice(0, dot);
219
+ const suffix = canonical.slice(dot + 1);
220
+ // Matched by MODULE AND NAME once the canonical form carries a module: a
221
+ // definition name is unique inside its module and not across a flattened
222
+ // set, so two libraries each declaring an `Api` would otherwise resolve to
223
+ // whichever came first — and the editor would type a context region off the
224
+ // wrong kind's annotations, silently. Falls back to name alone only when the
225
+ // kind did not resolve to a canonical form, where there is nothing to narrow
226
+ // by and a best-effort match is still better than none.
227
+ const named = this.manifests.filter((m) => (m.kind === "Telo.Definition" || m.kind === "Telo.Abstract") &&
210
228
  m.metadata?.name === suffix);
229
+ const target = (owningModule
230
+ ? named.find((m) => m.metadata?.module === owningModule)
231
+ : undefined) ?? (owningModule && named.length > 1 ? undefined : named[0]);
211
232
  if (!target)
212
233
  return undefined;
213
234
  return { manifest: target, path: first.slice(hash + 1), propertyMap: false };
@@ -249,9 +270,18 @@ export class CelScopeQuery {
249
270
  }
250
271
  return undefined;
251
272
  }
273
+ /** The kind's declaration, resolved in the scope of the module that DECLARED
274
+ * this resource — the same rule the manifest visitor applies, and the reason
275
+ * it has to be the same one: everything this query offers is read off the
276
+ * definition, so resolving a forwarded library resource's `kind: Http.Api`
277
+ * through the entry's aliases alone found nothing and the editor silently
278
+ * offered no `request` / `result` at a site `telo check` accepts. A
279
+ * completion list is a claim that the name it offers will pass the checker,
280
+ * so the two must resolve a kind identically. */
252
281
  definitionFor(resource) {
253
- const { defs, aliases } = this.ctx;
254
- const canonical = aliases.resolveKind(resource.kind);
282
+ const { defs, aliases, aliasesByModule } = this.ctx;
283
+ const scope = moduleAliasScope(resource.metadata, aliases, aliasesByModule);
284
+ const canonical = scope.resolveKind(resource.kind);
255
285
  return defs.resolve(resource.kind) ?? (canonical ? defs.resolve(canonical) : undefined);
256
286
  }
257
287
  /** The `x-telo-context` region this path falls in, matched exactly as the
@@ -1 +1 @@
1
- {"version":3,"file":"definition-registry.d.ts","sourceRoot":"","sources":["../src/definition-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,0BAA0B,CAAC;AAOlC,qBAAa,kBAAkB;;IAK7B;;sFAEkF;IAClF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAyD;IAC5F;;mFAE+E;IAC/E,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwC;IAClE,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D;iFAC6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqD;IACtF;;;;wEAIoE;IACpE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IAEzD,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,IAAI;IAqC9C,OAAO,CAAC,aAAa;IASrB;;;;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AAU,EAAE,MAAM,EAClB,UAAU,EAAE,aAAa,GACxB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS;IAsBlC,OAAO,CAAC,uBAAuB;IAU/B;;;;;;;oCAOgC;IAChC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;IAQjC;;;;;;+EAM2E;IAC3E,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAavC;;qEAEiE;IACjE,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAgBxD,KAAK,IAAI,MAAM,EAAE;CAGlB"}
@@ -1,5 +1,6 @@
1
1
  import { canonicalTypeSchemaId } from "@telorun/sdk";
2
2
  import { KERNEL_BUILTINS } from "./builtins.js";
3
+ import { moduleAliasScope } from "./module-alias-scope.js";
3
4
  import { buildFieldMapAtPath, buildReferenceFieldMap, isSchemaFromEntry, } from "./reference-field-map.js";
4
5
  import { createAjv, navigateJsonPointer } from "./schema-compat.js";
5
6
  import { formatSingleError, reduceSchemaErrors, schemaIssues, } from "./schema-error-report.js";
@@ -343,8 +344,7 @@ export class DefinitionRegistry {
343
344
  // (e.g. `Ai.AgentStream` in a library that imports `Ai`), which the root/global
344
345
  // resolver doesn't know — using the global scope here left the base field map
345
346
  // unresolved, so Phase-5 injection saw no ref fields and skipped injection.
346
- const ownModule = resource.metadata?.module;
347
- const moduleScope = (ownModule ? aliasesByModule.get(ownModule) : undefined) ?? aliases;
347
+ const moduleScope = moduleAliasScope(resource.metadata, aliases, aliasesByModule);
348
348
  const baseMap = this.getFieldMapForKind(resource.kind, moduleScope);
349
349
  if (!baseMap)
350
350
  return undefined;
@@ -352,8 +352,7 @@ export class DefinitionRegistry {
352
352
  const def = this.resolve(resource.kind) ?? this.resolve(resolvedKind);
353
353
  // schema-from anchors resolve in the DEFINITION's module scope (where the anchor
354
354
  // kind is declared), which may differ from the resource's own module.
355
- const ownerModule = def?.metadata?.module;
356
- const ownerScope = (ownerModule ? aliasesByModule.get(ownerModule) : undefined) ?? aliases;
355
+ const ownerScope = moduleAliasScope(def?.metadata, aliases, aliasesByModule);
357
356
  const expanded = new Map();
358
357
  for (const [path, entry] of baseMap) {
359
358
  if (!isSchemaFromEntry(entry)) {