@telorun/kernel 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 (39) hide show
  1. package/dist/application-env.js +2 -2
  2. package/dist/application-env.js.map +1 -1
  3. package/dist/controllers/module/import-controller.d.ts.map +1 -1
  4. package/dist/controllers/module/import-controller.js +1 -0
  5. package/dist/controllers/module/import-controller.js.map +1 -1
  6. package/dist/invocation-contract-binding.d.ts +37 -1
  7. package/dist/invocation-contract-binding.d.ts.map +1 -1
  8. package/dist/invocation-contract-binding.js +109 -8
  9. package/dist/invocation-contract-binding.js.map +1 -1
  10. package/dist/kernel.d.ts.map +1 -1
  11. package/dist/kernel.js +14 -3
  12. package/dist/kernel.js.map +1 -1
  13. package/dist/manifest-schemas.js +2 -2
  14. package/dist/manifest-schemas.js.map +1 -1
  15. package/dist/observed-state.js +2 -2
  16. package/dist/observed-state.js.map +1 -1
  17. package/dist/resource-context.d.ts.map +1 -1
  18. package/dist/resource-context.js +2 -5
  19. package/dist/resource-context.js.map +1 -1
  20. package/dist/runtime-seam.d.ts.map +1 -1
  21. package/dist/runtime-seam.js +24 -4
  22. package/dist/runtime-seam.js.map +1 -1
  23. package/dist/schema-compiled-values.d.ts.map +1 -1
  24. package/dist/schema-compiled-values.js +25 -1
  25. package/dist/schema-compiled-values.js.map +1 -1
  26. package/dist/schema-validator.d.ts.map +1 -1
  27. package/dist/schema-validator.js +20 -35
  28. package/dist/schema-validator.js.map +1 -1
  29. package/package.json +4 -4
  30. package/src/application-env.ts +2 -2
  31. package/src/controllers/module/import-controller.ts +1 -0
  32. package/src/invocation-contract-binding.ts +120 -8
  33. package/src/kernel.ts +17 -3
  34. package/src/manifest-schemas.ts +2 -2
  35. package/src/observed-state.ts +2 -2
  36. package/src/resource-context.ts +2 -5
  37. package/src/runtime-seam.ts +29 -3
  38. package/src/schema-compiled-values.ts +28 -1
  39. package/src/schema-validator.ts +19 -35
@@ -7,7 +7,8 @@ import { createHash } from "node:crypto";
7
7
  import * as fs from "node:fs";
8
8
  import { createRequire } from "node:module";
9
9
  import * as path from "node:path";
10
- import { binaryKeyword, X_TELO_BINARY } from "@telorun/analyzer";
10
+ import { registerTeloKeywords } from "@telorun/analyzer";
11
+ import { X_TELO_TYPE } from "@telorun/sdk";
11
12
  import { mergeFilledDefaults, withBigIntsAsNumbers } from "./bigint-schema-view.js";
12
13
  import { formatAjvErrors } from "./manifest-schemas.js";
13
14
  /** Render a value for an error message without ever throwing — the offending
@@ -21,7 +22,7 @@ function describeValue(data) {
21
22
  return String(data);
22
23
  }
23
24
  }
24
- import { EXACT_TEMPLATE_REGEX, isTaggedSentinel, ManifestRootSchema, normalizeRefSlots, } from "@telorun/templating";
25
+ import { EXACT_TEMPLATE_REGEX, isTaggedSentinel, ManifestRootSchema, } from "@telorun/templating";
25
26
  const Ajv = AjvModule.default ?? AjvModule;
26
27
  // AJV's standalone subpath is CJS — the default export shows up as either
27
28
  // the function itself or `.default` depending on how the bundler/loader
@@ -156,13 +157,19 @@ const NAME_KEYED_SCHEMA_KEYWORDS = new Set([
156
157
  * two schemas that differ only there hash alike. */
157
158
  const DATA_VALUE_KEYWORDS = new Set(["const", "default", "enum", "examples"]);
158
159
  /** Annotations that DO emit validation code, and so must survive the strip and stay
159
- * in the cache key. `x-telo-binary` is the first: bytes have no JSON Schema type,
160
+ * in the cache key. `x-telo-type` is the only one: bytes have no JSON Schema type,
160
161
  * so the keyword is the only thing standing between a byte slot and "accepts any
161
162
  * object". Stripping it would silently reduce the slot to an empty schema — the
162
163
  * precise regression the annotation was introduced to close — and, because the key
163
164
  * is meant to describe the compiled validator, a keyword that changes the validator
164
- * belongs in it. */
165
- const VALIDATING_ANNOTATIONS = new Set([X_TELO_BINARY]);
165
+ * belongs in it.
166
+ *
167
+ * Its names need no canonicalization to be safe in a key, unlike `x-telo-ref`'s:
168
+ * the vocabulary is closed and `Telo.`-qualified, so an author writes the
169
+ * canonical name or none, and a named SHAPE reaches the annotation as a `$ref`
170
+ * the loader already resolved. There is nothing here that the analyzer's baked
171
+ * view and the runtime could spell differently. */
172
+ const VALIDATING_ANNOTATIONS = new Set([X_TELO_TYPE]);
166
173
  /** Deep-clone `schema` without its `x-telo-*` annotations — applied, like
167
174
  * {@link collapseSentinelsToSource}, before both AJV compilation and cache
168
175
  * hashing.
@@ -183,9 +190,7 @@ const VALIDATING_ANNOTATIONS = new Set([X_TELO_BINARY]);
183
190
  *
184
191
  * Stripping is what makes the key describe the compiled validator and nothing
185
192
  * else, so the two views converge without either side having to agree on an
186
- * annotation's spelling. `normalizeRefSlots` runs FIRST and is unaffected: it
187
- * reads `x-telo-ref` to drop a legacy scalar `type` at a ref slot, which does
188
- * change validation, and it has already done so by the time this runs. */
193
+ * annotation's spelling. */
189
194
  function stripTeloAnnotations(value, nameKeyed = false) {
190
195
  // An array's items are schema nodes (`allOf`, tuple `items`), never names.
191
196
  if (Array.isArray(value))
@@ -248,27 +253,12 @@ export class SchemaValidator {
248
253
  code: { source: true },
249
254
  });
250
255
  addFormats.default(this.ajv);
251
- for (const kw of [
252
- "x-telo-ref",
253
- "x-telo-eval",
254
- "x-telo-scope",
255
- "x-telo-context",
256
- "x-telo-context-from",
257
- "x-telo-context-ref-from",
258
- "x-telo-schema-from",
259
- "x-telo-topology-role",
260
- "x-telo-step-context",
261
- "x-telo-widget",
262
- "x-telo-type",
263
- "x-telo-inline",
264
- ]) {
265
- this.ajv.addKeyword(kw);
266
- }
267
- // Not a no-op like the rest: bytes have no JSON Schema type, so this keyword IS
268
- // the check. Defined as codegen in the analyzer so it inlines into the
269
- // standalone validators compiled and cached below, rather than needing the
270
- // implementation present at load.
271
- this.ajv.addKeyword(binaryKeyword());
256
+ // One registration site for every Telo keyword: the annotations as no-ops
257
+ // and `x-telo-type` as the one that actually checks. `x-telo-type` is defined
258
+ // as codegen in the analyzer so it inlines into the standalone validators
259
+ // compiled and cached below, rather than needing the implementation present
260
+ // at load.
261
+ registerTeloKeywords(this.ajv);
272
262
  // Register the shared manifest root so module schemas can
273
263
  // `$ref: "telo://manifest#/$defs/ResourceRef"` without each manifest
274
264
  // bundling its own copy. Mirrors the analyzer's createAjv().
@@ -342,12 +332,7 @@ export class SchemaValidator {
342
332
  },
343
333
  }
344
334
  : normalized;
345
- // Drop the legacy scalar `type` an older published module may still pin on
346
- // its `x-telo-ref` slots. Schema validation runs in create() before Phase 5
347
- // injection, so a ref slot holds the resolved `{kind, name, alias?}` object
348
- // (or an unresolved sentinel) — both objects the stale `type: "string"`
349
- // would otherwise reject.
350
- const injected = normalizeRefSlots(withImplicit);
335
+ const injected = withImplicit;
351
336
  // Canonicalize CEL/template carriers (an inline `${{ }}` left in a
352
337
  // `description`, a `!cel` tag, …) to their bare source text so AJV can
353
338
  // meta-validate the schema it compiles, and so the raw (warm-pass) and
@@ -1 +1 @@
1
- {"version":3,"file":"schema-validator.js","sourceRoot":"","sources":["../src/schema-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAiB,eAAe,EAAE,WAAW,EAAE,YAAY,EAAyB,MAAM,cAAc,CAAC;AAChH,OAAO,SAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,iBAAiB,MAAM,8BAA8B,CAAC;AAC7D,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;+CAE+C;AAC/C,SA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AiB,CAC1F,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,EAAE,CAAC,IAAS,EAAE,EAAE;gBACrB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;oBAAE,OAAO,KAAK,CAAC;gBACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,IAAI,CAAC;wBACH,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI;4BAAE,OAAO,KAAK,CAAC;oBACtE,CAAC;oBAAC,MAAM,CAAC;wBACP,OAAO,KAAK,CAAC;oBACf,CAAC;gBACH,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/kernel",
3
- "version": "0.72.0",
3
+ "version": "0.74.0",
4
4
  "description": "Telo Runtime - A lightweight, polyglot execution host.",
5
5
  "keywords": [
6
6
  "telo",
@@ -61,9 +61,9 @@
61
61
  "dependencies": {
62
62
  "@marcbachmann/cel-js": "^7.6.1",
63
63
  "@sinclair/typebox": "^0.34.48",
64
- "@telorun/analyzer": "0.57.0",
64
+ "@telorun/analyzer": "0.59.0",
65
65
  "@telorun/glob": "0.2.0",
66
- "@telorun/templating": "0.13.0",
66
+ "@telorun/templating": "0.15.0",
67
67
  "ajv": "^8.17.1",
68
68
  "ajv-formats": "^3.0.1",
69
69
  "packageurl-js": "^2.0.1",
@@ -75,7 +75,7 @@
75
75
  "@types/tar-stream": "^3.1.3",
76
76
  "typescript": "^5.0.0",
77
77
  "vitest": "^2.1.8",
78
- "@telorun/sdk": "0.72.0"
78
+ "@telorun/sdk": "0.74.0"
79
79
  },
80
80
  "optionalDependencies": {
81
81
  "esbuild": "^0.25.12"
@@ -2,7 +2,7 @@ import {
2
2
  type DefResolver,
3
3
  effectiveAuthorSchema,
4
4
  residualEntrySchema,
5
- withStreamPropertiesSkipped,
5
+ withLiveValuesSkipped,
6
6
  } from "@telorun/analyzer";
7
7
  import type {
8
8
  ResourceContext,
@@ -270,7 +270,7 @@ export function precompileDefinitionSchemas(
270
270
  try {
271
271
  const schema = resolveTypeFieldSchema(declared, lookup);
272
272
  if (!schema) return;
273
- compile(withStreamPropertiesSkipped(schema, (ref) => lookup(ref) as any));
273
+ compile(withLiveValuesSkipped(schema, (ref) => lookup(ref) as any));
274
274
  } catch {
275
275
  // An unresolvable contract is a dispatch-time error, not a warm failure.
276
276
  }
@@ -88,6 +88,7 @@ export async function create(
88
88
  const rawManifests = await ctx.loadModule(resolvedUrl, {
89
89
  compile: true,
90
90
  desugarImports: true,
91
+ migrate: true,
91
92
  });
92
93
 
93
94
  // Normalize in the library's own scope: extract inline resources and resolve
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  type ContractDirection,
3
+ declaredScalarPaths,
4
+ type DeclaredScalarForm,
5
+ type DeclaredScalarPath,
3
6
  defaultBearingPaths,
4
7
  effectiveContractField,
5
8
  type DefResolver,
6
- withStreamPropertiesSkipped,
9
+ withLiveValuesSkipped,
7
10
  } from "@telorun/analyzer";
8
11
  import type { ResourceDefinition, ResourceInstance, ResourceManifest } from "@telorun/sdk";
9
12
  import {
@@ -63,6 +66,10 @@ export interface BoundContract {
63
66
  /** Paths a default can be written to — how far the caller's value must be
64
67
  * copied before validation runs. Empty when the contract declares none. */
65
68
  defaultPaths(): string[][];
69
+ /** Paths whose declared type fixes a scalar representation — the leaves a
70
+ * value is normalized at, in either direction. Empty when the contract
71
+ * declares none. */
72
+ scalarPaths(): DeclaredScalarPath[];
66
73
  }
67
74
 
68
75
  const CONTRACT_ERROR: Record<ContractDirection, string> = {
@@ -123,6 +130,7 @@ export function resolveBoundContract(
123
130
 
124
131
  let compiled: { validate(value: unknown): void } | undefined;
125
132
  let paths: string[][] | undefined;
133
+ let scalars: DeclaredScalarPath[] | undefined;
126
134
 
127
135
  const resolve = (): { validate(value: unknown): void } => {
128
136
  if (compiled !== undefined) return compiled;
@@ -138,8 +146,9 @@ export function resolveBoundContract(
138
146
  `The type is not registered, so the contract cannot be enforced.`,
139
147
  );
140
148
  }
141
- const stripped = withStreamPropertiesSkipped(schema, factory.resolveRef);
149
+ const stripped = withLiveValuesSkipped(schema, factory.resolveRef);
142
150
  paths = defaultBearingPaths(stripped, factory.resolveRef);
151
+ scalars = declaredScalarPaths(stripped, factory.resolveRef);
143
152
  // Compile by NAME whenever the declaration is one, so the type's CEL
144
153
  // `rules:` are composed in — including when a stream had to be stripped, in
145
154
  // which case the stream-bearing properties are dropped from the schema the
@@ -159,6 +168,10 @@ export function resolveBoundContract(
159
168
  resolve();
160
169
  return paths ?? [];
161
170
  },
171
+ scalarPaths: () => {
172
+ resolve();
173
+ return scalars ?? [];
174
+ },
162
175
  };
163
176
  }
164
177
 
@@ -214,6 +227,91 @@ function copyAlong(node: unknown, segments: readonly string[]): unknown {
214
227
  return node;
215
228
  }
216
229
 
230
+ /**
231
+ * `value` with every leaf normalized to the representation its declaration
232
+ * names, copied along the containers above each one so the producer's own object
233
+ * is not rewritten under it.
234
+ *
235
+ * A declared shape says what the value IS, not only what it must pass — the same
236
+ * service a JSON Schema gives an HTTP response serializer. Telo's CEL layer
237
+ * takes the declaration literally: `integer` types as CEL `int` and a CEL int is
238
+ * a BigInt, so a controller handing back a plain JS number at an `integer` slot
239
+ * makes the contract a lie that surfaces nowhere until an expression composes it
240
+ * — `result.n + 1` type-checking statically and then dying at dispatch with
241
+ * `no such overload: dyn<double> + int`. Normalizing at the boundary that
242
+ * already knows the declared shape closes it for every kind at once, instead of
243
+ * once per module after each report.
244
+ *
245
+ * BOTH DIRECTIONS, deliberately. A controller cannot be written correctly
246
+ * against a slot that hands it a JS number when the manifest wrote a literal and
247
+ * a BigInt when CEL computed the same value — it would have to accept either at
248
+ * every declared-integer field, which is what `typeof x === "number"` guards
249
+ * around the standard library were quietly relying on. One representation per
250
+ * declaration is what makes the declared type something a controller can read.
251
+ *
252
+ * Only an EXACT conversion is performed: an integral number becomes an int64,
253
+ * and a BigInt becomes a double only when the round-trip is lossless. A
254
+ * fractional number at an integer slot, a string, a null, a magnitude no double
255
+ * can hold — all are left exactly as they arrived, so a value that genuinely
256
+ * violates the contract is still rejected rather than quietly repaired into
257
+ * something that passes, and a 64-bit integer is never truncated to reach a
258
+ * `number` slot (which is the `double(...)` defect this whole line of work
259
+ * exists to retire).
260
+ */
261
+ export function normalizeDeclaredScalars(
262
+ value: unknown,
263
+ paths: readonly DeclaredScalarPath[],
264
+ ): unknown {
265
+ if (paths.length === 0 || !value || typeof value !== "object") return value;
266
+ let out: unknown = value;
267
+ for (const { path, form } of paths) out = normalizeAlong(out, path, form);
268
+ return out;
269
+ }
270
+
271
+ function normalizeAlong(
272
+ node: unknown,
273
+ segments: readonly string[],
274
+ form: DeclaredScalarForm,
275
+ ): unknown {
276
+ if (!node || typeof node !== "object") return node;
277
+ const [head, ...rest] = segments;
278
+
279
+ if (head === "[]") {
280
+ if (!Array.isArray(node)) return node;
281
+ let changed = false;
282
+ const next = node.map((item) => {
283
+ const value = rest.length === 0 ? asForm(item, form) : normalizeAlong(item, rest, form);
284
+ if (value !== item) changed = true;
285
+ return value;
286
+ });
287
+ return changed ? next : node;
288
+ }
289
+
290
+ const container = node as Record<string, unknown>;
291
+ if (!(head! in container)) return node;
292
+ const child = container[head!];
293
+ const next = rest.length === 0 ? asForm(child, form) : normalizeAlong(child, rest, form);
294
+ if (next === child) return node;
295
+ // Copy-on-write, and only once a leaf actually moved: a producer may hand back
296
+ // an object it retains (a cached record, a live config), and rewriting it in
297
+ // place would change what it holds.
298
+ const copy = shallowCopy(container);
299
+ copy[head!] = next;
300
+ return copy;
301
+ }
302
+
303
+ function asForm(value: unknown, form: DeclaredScalarForm): unknown {
304
+ if (form === "int64") {
305
+ return typeof value === "number" && Number.isInteger(value) ? BigInt(value) : value;
306
+ }
307
+ if (typeof value !== "bigint") return value;
308
+ const asNumber = Number(value);
309
+ // Lossless only. Past the safe range a double cannot hold the integer, and
310
+ // handing back a silently-rounded one is the precision loss the int64 work
311
+ // exists to remove.
312
+ return BigInt(asNumber) === value ? asNumber : value;
313
+ }
314
+
217
315
  /**
218
316
  * Raise a contract violation as a structured {@link InvokeError}.
219
317
  *
@@ -306,11 +404,19 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
306
404
  let effective = inputs;
307
405
  if (input) {
308
406
  // Copied only so the validator's default-fill cannot mutate what the
309
- // caller still holds. The BigInt normalization a JSON Schema validator
310
- // needs (CEL evaluates an integer to one, which AJV does not recognise
311
- // as `integer`) belongs to the validator and is applied there — see
312
- // `bigint-schema-view.ts`. Doing it here as well would walk every input
313
- // tree twice per dispatch, and split one concern across two layers.
407
+ // caller still holds. Making the value READABLE to a JSON Schema
408
+ // validator regardless of representation is the validator's own concern
409
+ // and is applied there (`bigint-schema-view.ts`).
410
+ //
411
+ // Deliberately NOT normalized on this side. Normalization states what a
412
+ // value IS to whoever reads it next, and on the way in that reader is a
413
+ // controller written in the host language — a declared `integer` reaching
414
+ // one as an int64 is a change to the authoring surface of every module,
415
+ // not a repair to a lie. On the way OUT the reader is CEL, which already
416
+ // types the declaration as `int`, so there the declaration and the value
417
+ // genuinely disagree. The asymmetry is the point: a controller still sees
418
+ // whatever the call site produced and must accept both, which is what
419
+ // `bigint-schema-view.ts` documents.
314
420
  effective = copyForDefaults(inputs, input.defaultPaths());
315
421
  try {
316
422
  input.validate(effective);
@@ -325,6 +431,12 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
325
431
  } catch (error) {
326
432
  throw contractViolation("outputType", describeTarget, error);
327
433
  }
434
+ // AFTER validation, not before: the validator fills declared defaults,
435
+ // and a default written as a plain YAML number is exactly the leaf that
436
+ // has to come out normalized too. Validation itself is indifferent to
437
+ // which representation arrives (`bigint-schema-view.ts`), so ordering
438
+ // costs nothing there.
439
+ return normalizeDeclaredScalars(result, output.scalarPaths());
328
440
  }
329
441
  return result;
330
442
  };
@@ -339,7 +451,7 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
339
451
  } catch (error) {
340
452
  throw contractViolation("outputType", describeTarget, error);
341
453
  }
342
- return result;
454
+ return normalizeDeclaredScalars(result, output.scalarPaths());
343
455
  };
344
456
  }
345
457
  }
package/src/kernel.ts CHANGED
@@ -271,7 +271,7 @@ export class Kernel implements IKernel {
271
271
  }
272
272
 
273
273
  async loadManifests(url: string): Promise<ResourceManifest[]> {
274
- const graph = await this.loader.loadGraph(url, { desugarImports: true });
274
+ const graph = await this.loader.loadGraph(url, { desugarImports: true, migrate: true });
275
275
  if (graph.errors.length > 0) throw graph.errors[0].error;
276
276
  return flattenForAnalyzer(graph);
277
277
  }
@@ -447,7 +447,7 @@ export class Kernel implements IKernel {
447
447
  // `desugarImports` expands each module's inline `imports:` map into synthetic
448
448
  // Telo.Import manifests before discovery walks the graph, so inline imports
449
449
  // resolve identically to authored Telo.Import docs.
450
- const analysisGraph = await this.loader.loadGraph(sourceUrl, { desugarImports: true });
450
+ const analysisGraph = await this.loader.loadGraph(sourceUrl, { desugarImports: true, migrate: true });
451
451
  if (analysisGraph.errors.length > 0) {
452
452
  throw analysisGraph.errors[0].error;
453
453
  }
@@ -491,6 +491,20 @@ export class Kernel implements IKernel {
491
491
  this.logging.kernelLogger().warn(d.message, { "telo.diagnostic.code": d.code });
492
492
  }
493
493
  }
494
+ // A migration rewrites the entry module's own manifest silently otherwise:
495
+ // `telo check`, VS Code and the editor all report the deprecation, and
496
+ // `telo run` — the command an author actually uses — would be the only
497
+ // surface that does not. Already scoped to the entry's own files by the
498
+ // loader, so a published dependency's spelling never appears here.
499
+ for (const d of analysisGraph.migrationDiagnostics) {
500
+ const filePath = (d.data as { filePath?: string } | undefined)?.filePath;
501
+ this.logging
502
+ .kernelLogger()
503
+ .warn(
504
+ filePath ? `${filePath}: ${d.message}` : d.message,
505
+ d.code === undefined ? undefined : { "telo.diagnostic.code": d.code },
506
+ );
507
+ }
494
508
  const staticManifests = flattenForAnalyzer(analysisGraph);
495
509
  this.staticManifests = staticManifests;
496
510
 
@@ -623,7 +637,7 @@ export class Kernel implements IKernel {
623
637
  // routes them to the import-controller, which actually loads and runs them.
624
638
  // Without it (analysis-only desugar) inline imports would pass validation
625
639
  // and then never execute.
626
- const lm = await this.loader.loadModule(sourceUrl, { compile: true, desugarImports: true });
640
+ const lm = await this.loader.loadModule(sourceUrl, { compile: true, desugarImports: true, migrate: true });
627
641
  const allManifests = flattenLoadedModule(lm);
628
642
 
629
643
  // Phase 2: normalize inline resources — extract inline values from x-telo-ref slots
@@ -2,7 +2,7 @@ import AjvModule from "ajv";
2
2
  import addFormats from "ajv-formats";
3
3
  // One definition of the `status:` block's shape, shared with `telo check` — the
4
4
  // `required:` restriction is reported by the analyzer, which can name the fix.
5
- import { binaryKeyword, OBSERVED_STATE_SCHEMA } from "@telorun/analyzer";
5
+ import { OBSERVED_STATE_SCHEMA, registerTeloKeywords } from "@telorun/analyzer";
6
6
  const Ajv = AjvModule.default ?? AjvModule;
7
7
 
8
8
  // Re-export the shared ResourceRef fragment from the templating package
@@ -177,7 +177,7 @@ export const ResourceAbstractSchema = {
177
177
  };
178
178
 
179
179
  const ajv = new Ajv({ allErrors: true, strict: false });
180
- ajv.addKeyword(binaryKeyword());
180
+ registerTeloKeywords(ajv);
181
181
  addFormats.default(ajv);
182
182
 
183
183
  // Lazy-compile validator: the AJV codegen cost (≈10–15 ms for these
@@ -1,4 +1,4 @@
1
- import { binaryKeyword } from "@telorun/analyzer";
1
+ import { registerTeloKeywords } from "@telorun/analyzer";
2
2
  import AjvModule from "ajv";
3
3
  import { detachSnapshotValue, OBSERVED_STATE_KEY, RuntimeError } from "@telorun/sdk";
4
4
 
@@ -58,7 +58,7 @@ function mark(target: Record<string, unknown>, info: ObservedStateInfo): void {
58
58
  }
59
59
 
60
60
  const ajv = new Ajv({ allErrors: true, strict: false });
61
- ajv.addKeyword(binaryKeyword());
61
+ registerTeloKeywords(ajv);
62
62
  // Compiling a status schema costs ~ms and a resource may report repeatedly, so
63
63
  // keep the validator keyed on the schema object it came from. The kind's folded
64
64
  // `status:` is stamped once at registration, so this hits.
@@ -28,7 +28,7 @@ import {
28
28
  type TypeRule,
29
29
  type ZoneEntry,
30
30
  } from "@telorun/sdk";
31
- import { binaryKeyword } from "@telorun/analyzer";
31
+ import { registerTeloKeywords } from "@telorun/analyzer";
32
32
  import { isRefSentinel } from "@telorun/templating";
33
33
  import { ZoneContext } from "./zone-context.js";
34
34
  import * as path from "path";
@@ -317,10 +317,7 @@ export class ResourceContextImpl implements ResourceContext {
317
317
  removeAdditional: true,
318
318
  });
319
319
  addFormats.default(ajv);
320
- for (const kw of ["x-telo-ref", "x-telo-scope", "x-telo-context", "x-telo-schema-from"]) {
321
- ajv.addKeyword(kw);
322
- }
323
- ajv.addKeyword(binaryKeyword());
320
+ registerTeloKeywords(ajv);
324
321
  const validate = ajv.compile(
325
322
  "type" in schema && typeof schema.type === "string"
326
323
  ? schema
@@ -4,8 +4,10 @@ import {
4
4
  collectZoneModuleDocuments,
5
5
  diagnosticFix,
6
6
  flattenForAnalyzer,
7
+ remapMigratedPaths,
7
8
  type AnalysisDiagnostic,
8
9
  type DiagnosticData,
10
+ type LoadedGraph,
9
11
  type ManifestSource,
10
12
  type ZoneModuleDocuments,
11
13
  } from "@telorun/analyzer";
@@ -224,14 +226,26 @@ export class KernelRuntimeSeam implements RuntimeSeam {
224
226
  // `analyze()`'s — carried out of the try so the checks below can see them.
225
227
  let parseDiagnostics: AnalysisDiagnostic[] = [];
226
228
  let versionDiagnostics: AnalysisDiagnostic[] = [];
229
+ let migrationDiagnostics: AnalysisDiagnostic[] = [];
227
230
  let moduleDocuments: ZoneModuleDocuments[] = [];
231
+ // Carried out of the try for the same reason the diagnostics are: analysis
232
+ // runs over the MIGRATED tree while every path a caller resolves points at
233
+ // the raw file, so the driver's provenance record has to be in hand below.
234
+ let loadedGraph: LoadedGraph | undefined;
228
235
  try {
236
+ // `migrate` unconditionally: this seam answers "does this manifest load
237
+ // and check", and the runtime it stands in for reads a legacy spelling
238
+ // through the same rewrite. A raw view is a round-trip editor's need, not
239
+ // a supervisor's.
229
240
  const graph = await loader.loadGraph(source, {
230
241
  desugarImports: options?.desugarImports ?? true,
242
+ migrate: true,
231
243
  });
232
244
  if (graph.errors.length > 0) throw graph.errors[0].error;
245
+ loadedGraph = graph;
233
246
  parseDiagnostics = graph.parseDiagnostics;
234
247
  versionDiagnostics = graph.versionDiagnostics;
248
+ migrationDiagnostics = graph.migrationDiagnostics;
235
249
  manifests = flattenForAnalyzer(graph);
236
250
  // The zone stage derives each imported library's export contracts from
237
251
  // its own full documents, which the flattened list drops.
@@ -254,17 +268,29 @@ export class KernelRuntimeSeam implements RuntimeSeam {
254
268
  // treating a parse failure as fatal before analysis.
255
269
  if (parseDiagnostics.length > 0) {
256
270
  return {
257
- diagnostics: [...parseDiagnostics, ...versionDiagnostics].map(toCheckDiagnostic),
271
+ diagnostics: [...parseDiagnostics, ...migrationDiagnostics, ...versionDiagnostics].map(
272
+ toCheckDiagnostic,
273
+ ),
258
274
  };
259
275
  }
260
276
 
261
277
  // `analyze()` never sees version skew, so without merging these a major
262
278
  // mismatch — which `load()` refuses to boot on — would check clean.
263
- const diagnostics = new StaticAnalyzer({ celHandlers: nodeCelHandlers }).analyze(manifests, {
279
+ //
280
+ // The remap is the same call `assembleGraphDiagnostics` makes for the CLI
281
+ // and VS Code, and it is not optional here: a caller acts on `path` (a
282
+ // module's `Assert.Manifest` matches on it), so this seam reporting the
283
+ // MIGRATED spelling while every other surface reports the author's would
284
+ // make one manifest mean two things depending on who asked. A no-op when
285
+ // nothing was migrated.
286
+ const analysis = new StaticAnalyzer({ celHandlers: nodeCelHandlers }).analyze(manifests, {
264
287
  moduleDocuments,
265
288
  });
289
+ const diagnostics = remapMigratedPaths(loadedGraph, analysis);
266
290
  return {
267
- diagnostics: [...versionDiagnostics, ...diagnostics].map(toCheckDiagnostic),
291
+ diagnostics: [...migrationDiagnostics, ...versionDiagnostics, ...diagnostics].map(
292
+ toCheckDiagnostic,
293
+ ),
268
294
  };
269
295
  }
270
296
  }
@@ -1,4 +1,5 @@
1
1
  import { isCompiledValue } from "@telorun/sdk";
2
+ import { selectUnionBranch } from "@telorun/analyzer";
2
3
 
3
4
  /** Returns a schema-appropriate placeholder value for a CompiledValue field. */
4
5
  function placeholderForSchema(schema: Record<string, unknown>): unknown {
@@ -9,6 +10,19 @@ function placeholderForSchema(schema: Record<string, unknown>): unknown {
9
10
  // author never wrote. Mirrors `celPlaceholderForSchema` in the analyzer, which
10
11
  // performs the same substitution for the static half.
11
12
  if (Array.isArray(schema.enum) && schema.enum.length > 0) return schema.enum[0];
13
+ // A union with no `type` of its own: take the first branch that yields a
14
+ // placeholder, so a whole-field CEL leaf at an `anyOf` slot is not handed the
15
+ // `""` fallback that only a string branch would accept. Mirrors the analyzer's
16
+ // `celPlaceholderForSchema`, which makes the same substitution for the static
17
+ // half — the two must agree or one rejects what the other passes.
18
+ if (schema.type === undefined) {
19
+ const branches = (schema.anyOf ?? schema.oneOf) as Record<string, unknown>[] | undefined;
20
+ if (Array.isArray(branches)) {
21
+ for (const branch of branches) {
22
+ if (branch && typeof branch === "object") return placeholderForSchema(branch);
23
+ }
24
+ }
25
+ }
12
26
  switch (schema.type) {
13
27
  case "integer":
14
28
  case "number":
@@ -113,7 +127,20 @@ export function stripCompiledValues(
113
127
  // that merely appears twice is still stripped both times.
114
128
  const ancestors = new Set<object>();
115
129
 
116
- const walk = (value: unknown, nodeSchema: Record<string, unknown>): unknown => {
130
+ const walk = (value: unknown, rawNodeSchema: Record<string, unknown>): unknown => {
131
+ // A UNION carries no `type` / `items` / `properties` of its own, so descending
132
+ // through one hands every CEL leaf underneath the schema-unaware `""`
133
+ // placeholder — which the branches then reject, reporting violations against
134
+ // a value the author never wrote (`/success/1 must be integer` for a `!cel`
135
+ // inside a list). Resolving the branch first is what lets the leaves be
136
+ // placed. Shared with the analyzer rather than reimplemented: the static and
137
+ // dispatch halves must choose the same branch, or one reports what the other
138
+ // accepts.
139
+ const nodeSchema = selectUnionBranch(
140
+ resolveSchemaRef(rawNodeSchema, root),
141
+ value,
142
+ root as Record<string, any>,
143
+ ) as Record<string, unknown>;
117
144
  const resolved = resolveSchemaRef(nodeSchema, root);
118
145
 
119
146
  if (isCompiledValue(value)) return placeholderForSchema(resolved);