@telorun/analyzer 0.56.1 → 0.57.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.
@@ -40,6 +40,11 @@ export declare function gatherPropertySchemas(schema: Record<string, any>): Arra
40
40
  * hardcoded; recursion is driven entirely by the schema annotations.
41
41
  */
42
42
  export declare function walkStepArray(steps: unknown[], stepItemSchema: Record<string, any> | undefined, rootSchema: Record<string, any>, basePath: string, visit: (step: Record<string, any>, stepPath: string) => void): void;
43
+ /** A pure-CEL leaf and the schema of the field it sits in. */
44
+ export interface CelValueSlot {
45
+ readonly path: string;
46
+ readonly schema: Record<string, any>;
47
+ }
43
48
  export interface StaticAnalyzerOptions {
44
49
  celHandlers?: CelHandlers;
45
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIzE,OAAO,EACL,aAAa,EAEb,KAAK,YAAY,EAElB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAsBlC,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAiBvF,OAAO,EAAsB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAqF/F;;;;;uDAKuD;AACvD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAA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RefSentinel, isTaggedSentinel } from "@telorun/templating";
2
+ import { defaultRegistry, isRefSentinel, isTaggedSentinel, } from "@telorun/templating";
3
3
  import { AliasResolver, moduleScopedDefResolver, scopeResolverForModule, } from "./alias-resolver.js";
4
4
  import { buildCelEnvironment, buildImportInputCelEnvironment, buildTypedCelEnvironment, } from "./cel-environment.js";
5
5
  import { DefinitionRegistry } from "./definition-registry.js";
@@ -25,12 +25,13 @@ import { rewriteSyntheticOrigins } from "./rewrite-synthetic-origins.js";
25
25
  import { celTypeSatisfiesJsonSchema, substituteCelFields, validateAgainstSchema, } from "./schema-compat.js";
26
26
  import { collectValueSchemaIssues } from "./validate-value-schema.js";
27
27
  import { DiagnosticSeverity } from "./types.js";
28
- import { extractAccessChains, extractCelRegionScopes, extractContextsFromSchema, getManifestItem, pathMatchesScope, resolveContextAnnotations, resolveTypeFieldToSchema, } from "./validate-cel-context.js";
28
+ import { extractAccessChains, extractCelRegionScopes, getManifestItem, pathMatchesScope, resolveContextAnnotations, resolveTypeFieldToSchema, } from "./validate-cel-context.js";
29
29
  import { buildEvalPaths, evalPathsCover } from "./eval-paths.js";
30
30
  import { BINDINGS_ANNOTATION, bindingContextProperties, bindingPathChain, CEL_RESERVED_WORDS, findBindingSites, resolveBindingOrder, schemaAtChain, } from "./cel-bindings.js";
31
31
  import { validateExtends } from "./validate-extends.js";
32
32
  import { validateLogging } from "./validate-logging.js";
33
33
  import { validateModuleArtifact } from "./validate-module-artifact.js";
34
+ import { validateIncludePlacement } from "./validate-include-placement.js";
34
35
  import { validateModuleMetadata } from "./validate-module-metadata.js";
35
36
  import { validateBaseMapping } from "./validate-base-mapping.js";
36
37
  import { validateInvocationContract } from "./validate-invocation-contract.js";
@@ -735,68 +736,49 @@ function celAccessChains(env, expr) {
735
736
  }
736
737
  const CEL_PURE_RE = /^\s*\$\{\{[^}]*\}\}\s*$/;
737
738
  const CEL_EXPR_RE = /\$\{\{\s*([^}]+?)\s*\}\}/;
738
- /** Recursively walk `data`+`schema` together, type-checking every pure CEL template
739
- * string via `env.check()`. Returns `SchemaIssue[]` for any type mismatches found. */
740
- function collectCelTypeIssues(data, schema, path, definition, manifest, baseTypedEnv, rootEnv, rootModuleManifest) {
741
- const issues = [];
742
- // A pure CEL value type-checks the same regardless of surface form: a
743
- // `${{ }}` string and a `!cel`-tagged sentinel must behave identically.
739
+ /** Restore the delimiters an engine's fix was computed without, so the
740
+ * replacement is the whole scalar rather than a bare expression that would be
741
+ * read back as literal text. A tagged scalar carries no wrapper and passes
742
+ * through untouched. */
743
+ function rewrapFix(fix, wrapper) {
744
+ if (!fix || !wrapper)
745
+ return fix;
746
+ return { replacement: wrapper.prefix + fix.replacement + wrapper.suffix };
747
+ }
748
+ /** Recursively walk `data`+`schema` together, collecting every pure CEL leaf
749
+ * with the schema of the field holding it.
750
+ *
751
+ * Type *checking* is deliberately not done here. It belongs to the templating
752
+ * engine, which owns the expression's syntax and now runs it once against the
753
+ * environment typed for that path; checking again here would mean two verdicts
754
+ * from two environments about one expression — which is exactly how an opaque
755
+ * "no matching overload" used to survive next to the diagnostic that explained
756
+ * it. What this walk supplies is the half the engine cannot know: the declared
757
+ * type of the slot the value flows into. The comparison happens once both are
758
+ * in hand (`reportCelReturnMismatches`). */
759
+ function collectCelValueSlots(data, schema, path) {
760
+ const slots = [];
761
+ // A pure CEL value behaves the same regardless of surface form: a
762
+ // `${{ … }}` string and a `!cel`-tagged sentinel are the same expression.
744
763
  let celExpr;
745
764
  if (isTaggedSentinel(data)) {
746
765
  // Non-CEL engines (e.g. `!literal`) are analyzed by their own engine pass.
747
766
  if (data.engine !== "cel")
748
- return issues;
767
+ return slots;
749
768
  celExpr = data.source;
750
769
  }
751
770
  else if (typeof data === "string" && CEL_PURE_RE.test(data)) {
752
771
  celExpr = data.match(CEL_EXPR_RE)?.[1]?.trim();
753
772
  }
754
773
  if (celExpr !== undefined) {
755
- {
756
- const expr = celExpr;
757
- // Merge x-telo-context variables for this path if applicable
758
- let typedEnv = baseTypedEnv;
759
- if (definition.schema) {
760
- for (const ctx of extractContextsFromSchema(definition.schema)) {
761
- if (!pathMatchesScope(path, ctx.scope))
762
- continue;
763
- typedEnv = buildTypedCelEnvironment(rootEnv, manifest, ctx.schema, rootModuleManifest);
764
- break;
765
- }
766
- }
767
- let checkResult;
768
- try {
769
- checkResult = typedEnv.check(expr);
770
- }
771
- catch {
772
- /* degrade gracefully */
773
- }
774
- if (checkResult?.valid === false && checkResult.error) {
775
- // env.check() rejected the expression itself — e.g. wrong method, wrong
776
- // argument types, wrong operator overload. Surface the first line of the
777
- // error message; the tail is a source-code caret diagram we don't need.
778
- const message = String(checkResult.error.message ?? checkResult.error)
779
- .split("\n")[0]
780
- .trim();
781
- issues.push({ message: `CEL type error: ${message}`, path });
782
- }
783
- else if (checkResult?.valid && checkResult.type && schema) {
784
- const celType = checkResult.type.split("<")[0];
785
- if (!celTypeSatisfiesJsonSchema(celType, schema)) {
786
- const expected = schema["x-telo-type"] ?? schema.type ?? "unknown";
787
- issues.push({
788
- message: `CEL returns '${checkResult.type}' but field expects '${expected}'`,
789
- path,
790
- });
791
- }
792
- }
793
- }
794
- return issues;
774
+ if (schema)
775
+ slots.push({ path, schema });
776
+ return slots;
795
777
  }
796
778
  if (Array.isArray(data)) {
797
779
  const itemSchema = (schema.items ?? {});
798
780
  for (let i = 0; i < data.length; i++) {
799
- issues.push(...collectCelTypeIssues(data[i], itemSchema, `${path}[${i}]`, definition, manifest, baseTypedEnv, rootEnv, rootModuleManifest));
781
+ slots.push(...collectCelValueSlots(data[i], itemSchema, `${path}[${i}]`));
800
782
  }
801
783
  }
802
784
  else if (data !== null && typeof data === "object") {
@@ -805,10 +787,10 @@ function collectCelTypeIssues(data, schema, path, definition, manifest, baseType
805
787
  ? schema.additionalProperties
806
788
  : {};
807
789
  for (const [k, v] of Object.entries(data)) {
808
- issues.push(...collectCelTypeIssues(v, (props[k] ?? mapValueSchema), path ? `${path}.${k}` : k, definition, manifest, baseTypedEnv, rootEnv, rootModuleManifest));
790
+ slots.push(...collectCelValueSlots(v, (props[k] ?? mapValueSchema), path ? `${path}.${k}` : k));
809
791
  }
810
792
  }
811
- return issues;
793
+ return slots;
812
794
  }
813
795
  export class StaticAnalyzer {
814
796
  celEnv;
@@ -1251,6 +1233,9 @@ export class StaticAnalyzer {
1251
1233
  // these fields, which is precisely why they need a check: a mistyped one
1252
1234
  // has no runtime failure mode that would ever surface it.
1253
1235
  diagnostics.push(...validateModuleMetadata(allManifests, defs, aliases));
1236
+ // A file embed resolves at resource creation, so one written on a doc that
1237
+ // is never instantiated is read by nothing and would ship silently.
1238
+ diagnostics.push(...validateIncludePlacement(allManifests));
1254
1239
  }
1255
1240
  resolveSchemaTypeRefs(allManifests, aliases, aliasesByModule);
1256
1241
  // Trusted-input fast path: when the caller has already attested that
@@ -1381,6 +1366,14 @@ export class StaticAnalyzer {
1381
1366
  // the entry's; see `buildKernelGlobalsSchema`.
1382
1367
  const moduleManifest = allManifests.find((mm) => mm.kind === "Telo.Application") ??
1383
1368
  allManifests.find((mm) => mm.kind === "Telo.Library");
1369
+ // Every pure-CEL leaf, with the slot it flows into. Compared against the
1370
+ // type the engine walk resolves, once both halves exist — see
1371
+ // `collectCelValueSlots`.
1372
+ const celReturnSlots = [];
1373
+ const celTypeByPath = new Map();
1374
+ // Context-free typed environments, one per manifest. Reused across every
1375
+ // expression in it — see the build site for why a matched context opts out.
1376
+ const typedEnvByManifest = new Map();
1384
1377
  // Validate each non-definition, non-system resource
1385
1378
  for (const m of allManifests) {
1386
1379
  const filePath = m.metadata?.source;
@@ -1458,7 +1451,15 @@ export class StaticAnalyzer {
1458
1451
  code: "UNDEFINED_KIND",
1459
1452
  source: SOURCE,
1460
1453
  message: `No Telo.Definition found for kind '${m.kind}'.${hint}`,
1461
- data: { resource, filePath, path: "kind", suggestedKind },
1454
+ // `suggestedKind` is kept beside the generic `fix` because it names
1455
+ // what the replacement IS; the fix is how to apply it.
1456
+ data: {
1457
+ resource,
1458
+ filePath,
1459
+ path: "kind",
1460
+ suggestedKind,
1461
+ ...(suggestedKind ? { fix: { replacement: suggestedKind } } : {}),
1462
+ },
1462
1463
  });
1463
1464
  continue;
1464
1465
  }
@@ -1481,23 +1482,12 @@ export class StaticAnalyzer {
1481
1482
  },
1482
1483
  }
1483
1484
  : authorSchema;
1484
- // Phase 1: CEL type checking walk data+schema together, check env.check() return types.
1485
- // A Telo.Import's variables/secrets are a config-only contract evaluated against the
1486
- // IMPORTING module's scope, so type them from the owning module doc (matched by
1487
- // `metadata.module`) and drop `resources`/`env` so referencing them is an error. A
1488
- // library's own internal import is validated against that library in the library's
1489
- // standalone analysis; in this flattened app pass the library doc is absent, so the
1490
- // importer is undefined here and variables/secrets fall back to a permissive `map`
1491
- // (no false positives) while resources/env stay rejected.
1492
- const importerModule = m.kind === "Telo.Import"
1493
- ? allManifests.find((mm) => (mm.kind === "Telo.Application" || mm.kind === "Telo.Library") &&
1494
- mm.metadata?.name ===
1495
- m.metadata?.module)
1496
- : undefined;
1497
- const baseTypedEnv = m.kind === "Telo.Import"
1498
- ? buildImportInputCelEnvironment(this.celEnv, importerModule)
1499
- : buildTypedCelEnvironment(this.celEnv, m, undefined, moduleManifest);
1500
- const celIssues = collectCelTypeIssues(m, schema, "", definition, m, baseTypedEnv, this.celEnv, moduleManifest);
1485
+ // Phase 1: collect the pure-CEL leaves and the schema of the slot each
1486
+ // flows into. The expression's own type is resolved later, by the
1487
+ // engine walk that owns type-checking; this half only knows the target.
1488
+ for (const slot of collectCelValueSlots(m, schema, "")) {
1489
+ celReturnSlots.push({ manifest: m, resource, filePath, ...slot });
1490
+ }
1501
1491
  // Phase 2+3: AJV on substituted data — CEL fields replaced with typed placeholders
1502
1492
  const ajvIssues = validateAgainstSchema(substituteCelFields(m, schema), schema);
1503
1493
  // Phase 4: value slots that must satisfy a type declared elsewhere on
@@ -1505,7 +1495,7 @@ export class StaticAnalyzer {
1505
1495
  // decision table against its declared `outputType`, so a mistyped branch
1506
1496
  // is caught here rather than on the one input that selects it.
1507
1497
  const valueSchemaIssues = collectValueSchemaIssues(m, schema, allManifests);
1508
- const issues = [...celIssues, ...ajvIssues, ...valueSchemaIssues];
1498
+ const issues = [...ajvIssues, ...valueSchemaIssues];
1509
1499
  for (const issue of issues) {
1510
1500
  diagnostics.push({
1511
1501
  severity: DiagnosticSeverity.Error,
@@ -1876,50 +1866,116 @@ export class StaticAnalyzer {
1876
1866
  });
1877
1867
  return;
1878
1868
  }
1879
- const findings = engine.analyze(expr, { celEnv: this.celEnv, contextSchema: effectiveContext });
1880
- for (const f of findings) {
1881
- if (f.code === "CEL_SYNTAX_ERROR") {
1869
+ // The engine type-checks, so it gets the environment typed for THIS
1870
+ // path not the bare base one. A `Telo.Import`'s variables/secrets
1871
+ // are a config-only contract evaluated in the IMPORTING module's
1872
+ // scope, so they type from the owning module doc and drop
1873
+ // `resources`/`env`, making a reference to either an error.
1874
+ //
1875
+ // Cached per manifest when no `x-telo-context` applied, which is most
1876
+ // expressions: the environment then depends only on the manifest, so
1877
+ // rebuilding it per expression is pure waste — a clone plus a
1878
+ // re-registration of every variable, on every keystroke in the IDE.
1879
+ // A matched context makes the environment path-specific (its schema is
1880
+ // resolved against the enclosing array item), so those still build
1881
+ // fresh rather than risk one item's types leaking into another's.
1882
+ const cached = effectiveContext === null ? typedEnvByManifest.get(m) : undefined;
1883
+ const typedEnv = cached ??
1884
+ (m.kind === "Telo.Import"
1885
+ ? buildImportInputCelEnvironment(this.celEnv, allManifests.find((mm) => (mm.kind === "Telo.Application" || mm.kind === "Telo.Library") &&
1886
+ mm.metadata?.name ===
1887
+ m.metadata?.module))
1888
+ : buildTypedCelEnvironment(this.celEnv, m, effectiveContext ?? undefined, moduleManifest));
1889
+ if (effectiveContext === null && !cached)
1890
+ typedEnvByManifest.set(m, typedEnv);
1891
+ const result = engine.analyze(expr, { celEnv: typedEnv, contextSchema: effectiveContext });
1892
+ if (result.type !== undefined) {
1893
+ let byPath = celTypeByPath.get(m);
1894
+ if (!byPath)
1895
+ celTypeByPath.set(m, (byPath = new Map()));
1896
+ byPath.set(path, result.type);
1897
+ }
1898
+ // A non-deterministic call in a compile-eval field is baked once at
1899
+ // load: `nowIso()` there freezes at boot. Sometimes that is the
1900
+ // intent (a boot timestamp, a run id), so it warns rather than
1901
+ // blocking. The engine reports which calls re-evaluate; the eval mode
1902
+ // is manifest policy and stays here.
1903
+ if (celRuleApplies && evalPathsCover(celCompilePaths, path)) {
1904
+ const volatile = [
1905
+ ...new Set(result.calls.filter((c) => c.deterministic === false).map((c) => c.name)),
1906
+ ].sort();
1907
+ if (volatile.length > 0) {
1882
1908
  diagnostics.push({
1883
- severity: DiagnosticSeverity.Error,
1884
- code: "CEL_SYNTAX_ERROR",
1909
+ severity: DiagnosticSeverity.Warning,
1910
+ code: "CEL_NONDETERMINISTIC_IN_COMPILE_FIELD",
1885
1911
  source: SOURCE,
1886
- message: `CEL syntax error at ${path}: ${f.message}`,
1912
+ message: `${m.kind}/${resource.name}: '${path}' is evaluated once at startup, so ${volatile.map((n) => `\`${n}()\``).join(", ")} ${volatile.length === 1 ? "is" : "are"} baked in at load and never re-evaluated. Move the expression to a field evaluated per call (x-telo-eval: runtime) if it should change over time.`,
1887
1913
  data: { resource, filePath, path },
1888
1914
  });
1889
1915
  }
1890
- else if (f.code === "CEL_UNKNOWN_FIELD") {
1916
+ }
1917
+ for (const f of result.diagnostics) {
1918
+ // A repair is applicable only when the analyzed expression covers
1919
+ // the whole scalar. For one `${{ }}` among literal text, replacing
1920
+ // the node would drop the text around it, so the correction stays
1921
+ // in the message and no fix is stamped.
1922
+ const fix = e.surface.whole ? rewrapFix(f.fix, e.surface.wrapper) : undefined;
1923
+ const data = { resource, filePath, path, ...(fix ? { fix } : {}) };
1924
+ if (f.code === "CEL_SYNTAX_ERROR") {
1891
1925
  diagnostics.push({
1892
1926
  severity: DiagnosticSeverity.Error,
1893
- code: "CEL_UNKNOWN_FIELD",
1927
+ code: "CEL_SYNTAX_ERROR",
1894
1928
  source: SOURCE,
1895
- message: `${m.kind}/${resource.name}: CEL at '${path}': ${f.message}`,
1896
- data: { resource, filePath, path },
1929
+ message: `CEL syntax error at ${path}: ${f.message}`,
1930
+ data,
1897
1931
  });
1898
1932
  }
1899
- else if (f.code === "CEL_NULLABLE_ACCESS") {
1933
+ else if (f.code === undefined) {
1934
+ // No code from a future engine — pass the message through, tagged
1935
+ // with a generic ENGINE_DIAGNOSTIC code so downstream filters can
1936
+ // still bucket it.
1900
1937
  diagnostics.push({
1901
1938
  severity: DiagnosticSeverity.Error,
1902
- code: "CEL_NULLABLE_ACCESS",
1939
+ code: "ENGINE_DIAGNOSTIC",
1903
1940
  source: SOURCE,
1904
- message: `${m.kind}/${resource.name}: CEL at '${path}': ${f.message}`,
1905
- data: { resource, filePath, path },
1941
+ message: `${m.kind}/${resource.name}: !${engineName} at '${path}': ${f.message}`,
1942
+ data,
1906
1943
  });
1907
1944
  }
1908
1945
  else {
1909
- // Unknown code from a future engine pass the message through,
1910
- // tagged with a generic ENGINE_DIAGNOSTIC code so downstream
1911
- // filters can still bucket it.
1946
+ // Named by ENGINE, not hardcoded to CEL: the seam exists so a
1947
+ // second engine can produce coded findings, and labelling them
1948
+ // `CEL` would misattribute the first one that does.
1912
1949
  diagnostics.push({
1913
1950
  severity: DiagnosticSeverity.Error,
1914
- code: f.code ?? "ENGINE_DIAGNOSTIC",
1951
+ code: f.code,
1915
1952
  source: SOURCE,
1916
1953
  message: `${m.kind}/${resource.name}: !${engineName} at '${path}': ${f.message}`,
1917
- data: { resource, filePath, path },
1954
+ data,
1918
1955
  });
1919
1956
  }
1920
1957
  }
1921
1958
  },
1922
1959
  }, { aliases });
1960
+ // The two halves of "does this expression fit the slot it flows into" meet
1961
+ // here: the engine resolved the expression's type during the walk above,
1962
+ // and the schema walk recorded the slot. An expression that failed to check
1963
+ // recorded no type and is already reported by its own diagnostic.
1964
+ for (const slot of celReturnSlots) {
1965
+ const type = celTypeByPath.get(slot.manifest)?.get(slot.path);
1966
+ if (type === undefined)
1967
+ continue;
1968
+ if (celTypeSatisfiesJsonSchema(type.split("<")[0], slot.schema))
1969
+ continue;
1970
+ const expected = slot.schema["x-telo-type"] ?? slot.schema.type ?? "unknown";
1971
+ diagnostics.push({
1972
+ severity: DiagnosticSeverity.Error,
1973
+ code: "CEL_TYPE_ERROR",
1974
+ source: SOURCE,
1975
+ message: `${slot.resource.kind}/${slot.resource.name}: CEL at '${slot.path}' returns '${type}' but the field expects '${expected}'.`,
1976
+ data: { resource: slot.resource, filePath: slot.filePath, path: slot.path },
1977
+ });
1978
+ }
1923
1979
  // Validate resource references (Phase 3)
1924
1980
  diagnostics.push(...validateReferences(allManifests, { aliases, definitions: defs, aliasesByModule }));
1925
1981
  // Validate step `invoke` references — the slots the reference field map
package/dist/index.d.ts CHANGED
@@ -64,6 +64,8 @@ export { MANIFEST_CACHE_BASE_URL, ManifestCacheSource, isHttpsModuleRef, manifes
64
64
  export type { ManifestCacheCoords } from "./sources/manifest-cache.js";
65
65
  export { LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
66
66
  export type { ArtifactSelector, LayerRole, PlatformAxis, PlatformTarget, } from "./artifact-selector.js";
67
+ export { collectModuleFileClaims } from "./module-file-claims.js";
68
+ export type { ModuleFileClaim } from "./module-file-claims.js";
67
69
  export { LayerIndexError, matchControllerLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
68
70
  export type { ArtifactLayer } from "./artifact-layer-index.js";
69
71
  export { validateModuleArtifact } from "./validate-module-artifact.js";
@@ -73,6 +75,6 @@ export { documentToAst, parseToAst } from "./yaml-ast.js";
73
75
  export type { AstDocument, AstMap, AstNode, AstPair, AstScalar, AstSeq } from "./yaml-ast.js";
74
76
  export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
75
77
  export type { CelNode, CelSegment } from "./cel-ast.js";
76
- export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity } from "./types.js";
77
- export type { AnalysisDiagnostic, AnalysisOptions, LoaderInitOptions, LoadOptions, ManifestSource, Position, PositionIndex, Range } from "./types.js";
78
+ export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity, diagnosticFix } from "./types.js";
79
+ export type { AnalysisDiagnostic, AnalysisOptions, DiagnosticData, DiagnosticFix, LoaderInitOptions, LoadOptions, ManifestSource, Position, PositionIndex, Range } from "./types.js";
78
80
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,YAAY,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,iCAAiC,EACjC,wBAAwB,E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F,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ export { parseVersionedRef, withRefVersion } from "./sources/versioned-ref.js";
36
36
  export { isLocalPathSource } from "./sources/local-path-ref.js";
37
37
  export { MANIFEST_CACHE_BASE_URL, ManifestCacheSource, isHttpsModuleRef, manifestCacheKey, manifestCacheUrl, ociManifestCacheCoords, urlManifestCacheCoords, } from "./sources/manifest-cache.js";
38
38
  export { LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
39
+ export { collectModuleFileClaims } from "./module-file-claims.js";
39
40
  export { LayerIndexError, matchControllerLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
40
41
  export { validateModuleArtifact } from "./validate-module-artifact.js";
41
42
  // Warnings everywhere, fatal at `telo publish` — descriptive metadata has no
@@ -45,4 +46,4 @@ export { PUBLISH_BLOCKING_CODES } from "./validate-module-metadata.js";
45
46
  export { withSyntheticPositions } from "./with-synthetic-positions.js";
46
47
  export { documentToAst, parseToAst } from "./yaml-ast.js";
47
48
  export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
48
- export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity } from "./types.js";
49
+ export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity, diagnosticFix } from "./types.js";
@@ -1,4 +1,5 @@
1
1
  import type { ResourceDefinition, ResourceManifest } from "@telorun/sdk";
2
+ import { type CelSurface } from "@telorun/templating";
2
3
  import type { AliasResolver } from "./alias-resolver.js";
3
4
  import type { DefinitionRegistry } from "./definition-registry.js";
4
5
  import { type RefFieldEntry, type SchemaFromFieldEntry } from "./reference-field-map.js";
@@ -100,6 +101,9 @@ export interface CelSiteEvent {
100
101
  contextSchema?: Record<string, any>;
101
102
  /** Scope of the matched context (e.g. `$.routes[*].handler`), if matched. */
102
103
  matchedScope?: string;
104
+ /** Where `expr` sits in the scalar at `path`, and the delimiters to restore
105
+ * around a corrected expression. See `CelSurface`. */
106
+ surface: CelSurface;
103
107
  }
104
108
  export interface ManifestVisitor {
105
109
  onResourceEnter?(e: ResourceEnterEvent): void;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-visitor.d.ts","sourceRoot":"","sources":["../src/manifest-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAGlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,gBAAgB,CAAC;IACzB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,gBAAgB,CAAC;IACzB,wEAAwE;IACxE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,uEAAuE;IACvE,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACpD;iFAC6E;IAC7E,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B;;2EAEuE;IACvE,eAAe,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACtD;AA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AC9B,eAAe,CAAC,CAAC,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9C,OAAO,CAAC,CAAC,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,CAAC,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7C,6EAA6E;IAC7E,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC;;+EAE2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;wDAMoD;IACpD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAsDD,wBAAgB,aAAa,CAC3B,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,eAAe,EACxB,OAAO,GAAE,YAAiB,GACzB,IAAI,CAuKN"}
@@ -1,4 +1,4 @@
1
- import { isRefSentinel, isTaggedSentinel, walkCelExpressions } from "@telorun/templating";
1
+ import { isRefSentinel, isTaggedSentinel, walkCelExpressions, } from "@telorun/templating";
2
2
  import { isRefEntry, isSchemaFromEntry, isScopeEntry, resolveFieldEntries, } from "./reference-field-map.js";
3
3
  import { extractContextsFromSchema, pathMatchesScope } from "./validate-cel-context.js";
4
4
  /** Synthetic entry for a value-tree-discovered ref — these carry no declared
@@ -189,7 +189,7 @@ export function visitManifest(resources, registry, visitor, options = {}) {
189
189
  }
190
190
  if (wantsCel) {
191
191
  const contexts = definition?.schema ? extractContextsFromSchema(definition.schema) : [];
192
- walkCelExpressions(r, "", (expr, path, engineName) => {
192
+ walkCelExpressions(r, "", (expr, path, engineName, surface) => {
193
193
  let contextSchema;
194
194
  let matchedScope;
195
195
  for (const ctx of contexts) {
@@ -199,7 +199,7 @@ export function visitManifest(resources, registry, visitor, options = {}) {
199
199
  break;
200
200
  }
201
201
  }
202
- visitor.onCel({ source: r, path, expr, engineName, contextSchema, matchedScope });
202
+ visitor.onCel({ source: r, path, expr, engineName, contextSchema, matchedScope, surface });
203
203
  });
204
204
  }
205
205
  visitor.onResourceExit?.({ source: r });
@@ -0,0 +1,65 @@
1
+ import { type TemplatingEngineRegistry } from "@telorun/templating";
2
+ import { type ArtifactSelector } from "./artifact-selector.js";
3
+ /**
4
+ * One module-relative file a manifest names, and the artifact layer it belongs
5
+ * to.
6
+ *
7
+ * The single answer to "why is this file in the payload", replacing two
8
+ * derivations that happened to agree: publish used to re-parse the manifest with
9
+ * PURL knowledge hardcoded into the CLI, and any second vocabulary — a tag that
10
+ * embeds a file, say — would have had to be added there by hand. Here the
11
+ * knowledge sits with whoever owns the syntax: a controller candidate is read by
12
+ * this module, and a tagged value is read by the engine that owns its tag, via
13
+ * `TemplatingEngine.fileClaims`. Publish maps role to layer and recognises
14
+ * neither.
15
+ *
16
+ * Deliberately NOT hung off `analyze()`. That pass runs over a flattened,
17
+ * import-inclusive manifest set, so its claims would mix in imported libraries'
18
+ * files — whose paths are relative to *their* module and must never join this
19
+ * artifact — and it would make packaging, today derivable offline from manifest
20
+ * text, a product of resolving the whole import graph. This is per-module by
21
+ * construction and needs nothing but the text.
22
+ *
23
+ * Browser-safe, like the rest of the analyzer: parsing and string work only, no
24
+ * filesystem. Whether a claimed file EXISTS is a separate question, asked by the
25
+ * Node-side caller that has a directory to look in.
26
+ */
27
+ interface ClaimBase {
28
+ /** Module-root-relative POSIX path — relative to the directory holding
29
+ * `telo.yaml`, never to the file the claim was written in. Publish inlines
30
+ * every `include:` partial into the published `telo.yaml`, so a
31
+ * per-file-relative path would change meaning in the artifact. */
32
+ readonly path: string;
33
+ /** Where the claim came from, for diagnostics: the PURL, or `!<tag>` and the
34
+ * path of the value that carried it. */
35
+ readonly origin: string;
36
+ }
37
+ /**
38
+ * A **discriminated union**, not one shape with optional fields: a controller
39
+ * layer is one per selector and carries sibling patterns, and an assets layer is
40
+ * neither. Optional fields on a single shape put the consumer one `!` away from
41
+ * a crash inside `selectorKey` with no useful message, and let a producer emit a
42
+ * controller claim with no selector that nothing would reject.
43
+ */
44
+ export type ModuleFileClaim = (ClaimBase & {
45
+ readonly role: "controller";
46
+ readonly selector: ArtifactSelector;
47
+ /** Extra payload patterns that belong in the same layer as this claim —
48
+ * `.gitignore`-style globs over the selected files, matched by the
49
+ * caller, which is the side that knows what was selected. */
50
+ readonly siblings: readonly string[];
51
+ }) | (ClaimBase & {
52
+ readonly role: "assets";
53
+ });
54
+ /**
55
+ * Every module-relative file the manifest names, from every syntax that can name
56
+ * one.
57
+ *
58
+ * `manifestText` is one module's `telo.yaml`. Publish passes the text it is
59
+ * about to ship — i.e. after `include:` partials have been inlined — but the
60
+ * answer does not depend on that: claims are root-relative, so collecting them
61
+ * before or after inlining gives the same set.
62
+ */
63
+ export declare function collectModuleFileClaims(manifestText: string, registry?: TemplatingEngineRegistry): ModuleFileClaim[];
64
+ export {};
65
+ //# sourceMappingURL=module-file-claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-file-claims.d.ts","sourceRoot":"","sources":["../src/module-file-claims.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAuC,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEpG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,UAAU,SAAS;IACjB;;;uEAGmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;6CACyC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,CAAC,SAAS,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC;;kEAE8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC,GACF,CAAC,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAiF9C;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,wBAA4C,GACrD,eAAe,EAAE,CAanB"}