@telorun/kernel 0.69.0 → 0.70.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 (46) hide show
  1. package/dist/bigint-json.d.ts +45 -0
  2. package/dist/bigint-json.d.ts.map +1 -0
  3. package/dist/bigint-json.js +65 -0
  4. package/dist/bigint-json.js.map +1 -0
  5. package/dist/bigint-schema-view.d.ts +34 -0
  6. package/dist/bigint-schema-view.d.ts.map +1 -0
  7. package/dist/bigint-schema-view.js +85 -0
  8. package/dist/bigint-schema-view.js.map +1 -0
  9. package/dist/cel-handlers.d.ts.map +1 -1
  10. package/dist/cel-handlers.js +6 -8
  11. package/dist/cel-handlers.js.map +1 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/invocation-contract-binding.d.ts +0 -6
  17. package/dist/invocation-contract-binding.d.ts.map +1 -1
  18. package/dist/invocation-contract-binding.js +9 -64
  19. package/dist/invocation-contract-binding.js.map +1 -1
  20. package/dist/kernel.d.ts.map +1 -1
  21. package/dist/kernel.js +10 -3
  22. package/dist/kernel.js.map +1 -1
  23. package/dist/logging/encode-json.d.ts.map +1 -1
  24. package/dist/logging/encode-json.js +13 -9
  25. package/dist/logging/encode-json.js.map +1 -1
  26. package/dist/logging/encode-pretty.d.ts.map +1 -1
  27. package/dist/logging/encode-pretty.js +13 -4
  28. package/dist/logging/encode-pretty.js.map +1 -1
  29. package/dist/resource-context.d.ts +10 -1
  30. package/dist/resource-context.d.ts.map +1 -1
  31. package/dist/resource-context.js +40 -11
  32. package/dist/resource-context.js.map +1 -1
  33. package/dist/schema-validator.d.ts.map +1 -1
  34. package/dist/schema-validator.js +23 -12
  35. package/dist/schema-validator.js.map +1 -1
  36. package/package.json +3 -3
  37. package/src/bigint-json.ts +69 -0
  38. package/src/bigint-schema-view.ts +76 -0
  39. package/src/cel-handlers.ts +6 -9
  40. package/src/index.ts +1 -0
  41. package/src/invocation-contract-binding.ts +9 -55
  42. package/src/kernel.ts +11 -0
  43. package/src/logging/encode-json.ts +14 -9
  44. package/src/logging/encode-pretty.ts +12 -3
  45. package/src/resource-context.ts +44 -11
  46. package/src/schema-validator.ts +23 -12
@@ -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,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;uEAKuE;AACvE,SAAS,aAAa,CAAC,IAAa;IAClC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AACD,OAAO,EACL,oBAAoB,EACpB,gBAA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,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.69.0",
3
+ "version": "0.70.0",
4
4
  "description": "Telo Runtime - A lightweight, polyglot execution host.",
5
5
  "keywords": [
6
6
  "telo",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "@marcbachmann/cel-js": "^7.6.1",
63
63
  "@sinclair/typebox": "^0.34.48",
64
- "@telorun/analyzer": "0.56.0",
64
+ "@telorun/analyzer": "0.56.1",
65
65
  "@telorun/glob": "0.2.0",
66
66
  "@telorun/templating": "0.12.0",
67
67
  "ajv": "^8.17.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.68.0"
78
+ "@telorun/sdk": "0.70.0"
79
79
  },
80
80
  "optionalDependencies": {
81
81
  "esbuild": "^0.25.12"
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Makes a CEL integer JSON-serializable everywhere, once, for the whole process.
3
+ *
4
+ * CEL models `int` as int64, which this runtime evaluates to a JS BigInt — so
5
+ * `size(group)`, `sum(...)` and integer arithmetic all produce one. `JSON.stringify`
6
+ * THROWS on a BigInt, and there is a JSON boundary at the end of nearly every
7
+ * manifest: an HTTP response body, an NDJSON or SSE frame, a persisted value, an
8
+ * assertion message. Each of those used to answer the question for itself, and the
9
+ * one an author actually meets — an `application/json` response — answered it by
10
+ * throwing, which pushed the answer into the manifest as `double(...)`: a cast that
11
+ * says "make this a float" about a value that is an integer, and that silently loses
12
+ * precision past 2^53.
13
+ *
14
+ * `BigInt.prototype.toJSON` is the sanctioned extension point, and until
15
+ * `JSON.rawJSON` existed it could not be used honestly: `toJSON` must return a JSON
16
+ * *value*, so the only options were a lossy `Number` or a type-changing string.
17
+ * `JSON.rawJSON` emits verbatim text, so a BigInt serializes as its exact decimal
18
+ * digits — legal JSON (the format puts no precision limit on numbers), and already
19
+ * what `fast-json-stringify` emits for a schema-typed `integer`. Installing it is
20
+ * therefore not a new policy; it is what makes the runtime's two JSON serializers
21
+ * agree at every magnitude instead of only below 2^53. Normative statement:
22
+ * `kernel/specs/invocation-contract.md` §4.4.
23
+ *
24
+ * A process-global prototype patch, in the same spirit as the `process.env`
25
+ * guardrail (`host-env.ts`): installed at `boot()`, idempotent across in-process
26
+ * kernels, and non-enumerable so nothing walking `BigInt.prototype` sees it. Every
27
+ * JSON boundary in the process gets it — the kernel's, the standard library's, a
28
+ * third-party module's, and one not yet written.
29
+ *
30
+ * It lives in the kernel rather than the SDK because installing a global is a
31
+ * composition-root action: a controller has no business calling it, and the SDK is
32
+ * the module-author surface. What a module author needs is the consequence —
33
+ * `bigIntAt`, in `@telorun/sdk`, for a sink or codec that must encode a wide
34
+ * integer differently.
35
+ */
36
+
37
+ import { BIGINT_JSON_INSTALLED_KEY, isBigIntJsonEnabled } from "@telorun/sdk";
38
+
39
+ /** `JSON.rawJSON` (ES2025). Absent only on a runtime older than this kernel
40
+ * supports — `engines` pins Node >= 24, and Bun 1.3 has it. */
41
+ const rawJSON = (JSON as { rawJSON?: (text: string) => unknown }).rawJSON;
42
+
43
+ /**
44
+ * Install `BigInt.prototype.toJSON`. Idempotent and process-global.
45
+ *
46
+ * Throws rather than degrading when `JSON.rawJSON` is missing. A quiet no-op would
47
+ * leave every JSON boundary throwing `Do not know how to serialize a BigInt` at
48
+ * some unrelated point later — each site that used to carry its own BigInt handling
49
+ * now relies on this — and nothing in that failure names the runtime as the cause.
50
+ */
51
+ export function enableBigIntJson(): void {
52
+ if (isBigIntJsonEnabled()) return;
53
+ if (typeof rawJSON !== "function") {
54
+ throw new Error(
55
+ "JSON.rawJSON is unavailable, so a CEL integer (int64) cannot be serialized " +
56
+ "exactly. Telo requires Node.js >= 24 or Bun >= 1.3.",
57
+ );
58
+ }
59
+ (globalThis as Record<symbol, unknown>)[BIGINT_JSON_INSTALLED_KEY] = true;
60
+
61
+ Object.defineProperty(BigInt.prototype, "toJSON", {
62
+ value: function toJSON(this: bigint): unknown {
63
+ return rawJSON(this.toString());
64
+ },
65
+ writable: true,
66
+ enumerable: false,
67
+ configurable: true,
68
+ });
69
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The BigInt-normalized VIEW a JSON Schema validator can check, and merging its
3
+ * default-fills back onto the real value.
4
+ *
5
+ * CEL evaluates an integer to a BigInt, which AJV does not recognise as `integer`
6
+ * or `number` — `typeof data == "number"` is the whole of its type check. So a
7
+ * computed integer reaching a declared integer slot is rejected for a reason the
8
+ * author cannot act on, and cannot fix without casting the value to a float. The
9
+ * value is not wrong; the validator cannot see it.
10
+ *
11
+ * Validating a normalized view rather than coercing in place is what keeps that a
12
+ * validator concern: the dispatched value keeps its BigInts, since a controller may
13
+ * need the full 64-bit range, and serialization emits them exactly (see
14
+ * `enableBigIntJson` in `@telorun/sdk`). A value beyond the safe-integer range loses
15
+ * precision in the VIEW, which can only affect a bound check at the extremes.
16
+ */
17
+
18
+ /** A structural copy of `value` with every BigInt rendered as a Number. Returns
19
+ * the SAME reference when there was nothing to change, which is what lets a
20
+ * caller skip the merge-back entirely on the common path. Non-plain objects (a
21
+ * live `Stream`, a resource instance) pass through by reference — they are not
22
+ * data to be walked. */
23
+ export function withBigIntsAsNumbers(value: unknown): unknown {
24
+ if (typeof value === "bigint") return Number(value);
25
+ if (Array.isArray(value)) {
26
+ let changed = false;
27
+ const items = value.map((item) => {
28
+ const next = withBigIntsAsNumbers(item);
29
+ if (next !== item) changed = true;
30
+ return next;
31
+ });
32
+ return changed ? items : value;
33
+ }
34
+ if (!value || typeof value !== "object") return value;
35
+ if (Object.getPrototypeOf(value) !== Object.prototype) return value;
36
+ let changed = false;
37
+ const out: Record<string, unknown> = {};
38
+ for (const [key, item] of Object.entries(value as Record<string, unknown>)) {
39
+ const next = withBigIntsAsNumbers(item);
40
+ if (next !== item) changed = true;
41
+ out[key] = next;
42
+ }
43
+ return changed ? out : value;
44
+ }
45
+
46
+ /** Copy keys an AJV `useDefaults` fill added to `view` back onto `target`.
47
+ * Only ADDITIONS are taken: a key already present came from the caller and its
48
+ * original (possibly BigInt) value is the one to keep.
49
+ *
50
+ * Arrays are walked index-wise, not treated as leaves: AJV writes a default at
51
+ * every level it finds one, including inside `items`, and `Collection.Sort`'s
52
+ * `orderBy[].descending` is exactly that shape. Bailing at the array boundary
53
+ * would drop those fills silently — a worse failure than the throw it replaced,
54
+ * because the call then succeeds with the default missing. This mirrors the
55
+ * copy side, where `copyForDefaults` already fans out through an `[]` segment. */
56
+ export function mergeFilledDefaults(target: unknown, view: unknown): unknown {
57
+ if (target === view) return target;
58
+ if (!target || typeof target !== "object") return target;
59
+ if (!view || typeof view !== "object") return target;
60
+
61
+ if (Array.isArray(target)) {
62
+ if (!Array.isArray(view)) return target;
63
+ for (let i = 0; i < target.length && i < view.length; i++) {
64
+ target[i] = mergeFilledDefaults(target[i], view[i]);
65
+ }
66
+ return target;
67
+ }
68
+ if (Array.isArray(view)) return target;
69
+
70
+ const out = target as Record<string, unknown>;
71
+ for (const [key, filled] of Object.entries(view as Record<string, unknown>)) {
72
+ if (!(key in out)) out[key] = filled;
73
+ else out[key] = mergeFilledDefaults(out[key], filled);
74
+ }
75
+ return out;
76
+ }
@@ -12,13 +12,10 @@ export const nodeCelHandlers = {
12
12
  createHmac(algorithm, key).update(message).digest("hex"),
13
13
  base64Encode: (s: string) => Buffer.from(s, "utf8").toString("base64"),
14
14
  base64Decode: (s: string) => Buffer.from(s, "base64").toString("utf8"),
15
- // cel-js represents int / uint as BigInt JSON.stringify throws on BigInts,
16
- // so coerce them down to Number unconditionally. CEL int is i64 and JS Number
17
- // is f64, so values outside ±2^53 lose precision; that's accepted behaviour
18
- // for Telo manifests, which never carry > 2^53 integer values in practice.
19
- // JSON.stringify returns undefined for top-level undefined / function / symbol
20
- // the CEL signature is `json(dyn): string`, so coerce that to "null" rather
21
- // than break the contract. (CEL `null` already serializes to "null".)
22
- json: (value: unknown) =>
23
- JSON.stringify(value, (_k, v) => (typeof v === "bigint" ? Number(v) : v)) ?? "null",
15
+ // An int / uint is a BigInt here and serializes as its exact digits — see
16
+ // `enableBigIntJson` in `@telorun/sdk`, installed at boot. JSON.stringify
17
+ // returns undefined for top-level undefined / function / symbol the CEL
18
+ // signature is `json(dyn): string`, so coerce that to "null" rather than break
19
+ // the contract. (CEL `null` already serializes to "null".)
20
+ json: (value: unknown) => JSON.stringify(value) ?? "null",
24
21
  };
package/src/index.ts CHANGED
@@ -44,6 +44,7 @@ export type {
44
44
  } from "./transports/transport.js";
45
45
  export { ExecutionContext } from "./execution-context.js";
46
46
  export { Kernel, type KernelOptions } from "./kernel.js";
47
+ export { enableBigIntJson } from "./bigint-json.js";
47
48
  export { nodeCelHandlers } from "./cel-handlers.js";
48
49
  export { ModuleContext } from "./module-context.js";
49
50
  export { ManifestRegistry as Registry } from "./registry.js";
@@ -305,27 +305,23 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
305
305
  instance.invoke = async (inputs: any, ...rest: unknown[]) => {
306
306
  let effective = inputs;
307
307
  if (input) {
308
+ // 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.
308
314
  effective = copyForDefaults(inputs, input.defaultPaths());
309
- // Validate a BIGINT-NORMALIZED view, not the values themselves. CEL
310
- // evaluates an integer literal to a BigInt, which a JSON Schema
311
- // validator does not recognise as `integer` — so every computed integer
312
- // reaching a declared integer input would be rejected for a reason the
313
- // author cannot act on. The dispatched values keep their BigInts, since
314
- // a controller may need the full 64-bit range.
315
- const view = withBigIntsAsNumbers(effective);
316
315
  try {
317
- input.validate(view);
316
+ input.validate(effective);
318
317
  } catch (error) {
319
318
  throw contractViolation("inputType", describeTarget, error);
320
319
  }
321
- // Defaults are additive, so anything the validator filled into the view
322
- // is a key the caller omitted — copy exactly those back.
323
- effective = mergeFilledDefaults(effective, view);
324
320
  }
325
321
  const result = await original(effective, ...rest);
326
322
  if (output) {
327
323
  try {
328
- output.validate(withBigIntsAsNumbers(result));
324
+ output.validate(result);
329
325
  } catch (error) {
330
326
  throw contractViolation("outputType", describeTarget, error);
331
327
  }
@@ -339,7 +335,7 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
339
335
  instance.provide = async (...args: unknown[]) => {
340
336
  const result = await original(...args);
341
337
  try {
342
- output.validate(withBigIntsAsNumbers(result));
338
+ output.validate(result);
343
339
  } catch (error) {
344
340
  throw contractViolation("outputType", describeTarget, error);
345
341
  }
@@ -348,45 +344,3 @@ export function bindContract(instance: ResourceInstance, binding: ContractBindin
348
344
  }
349
345
  }
350
346
 
351
- /** A structural copy with every BigInt rendered as a Number, for validation
352
- * only. A value beyond the safe-integer range loses precision in the VIEW,
353
- * which can only affect a bound check at the extremes; the dispatched value is
354
- * untouched. Non-plain objects (a live `Stream`, a resource instance) pass
355
- * through by reference — they are not data to be walked. */
356
- export function withBigIntsAsNumbers(value: unknown): unknown {
357
- if (typeof value === "bigint") return Number(value);
358
- if (Array.isArray(value)) {
359
- let changed = false;
360
- const items = value.map((item) => {
361
- const next = withBigIntsAsNumbers(item);
362
- if (next !== item) changed = true;
363
- return next;
364
- });
365
- return changed ? items : value;
366
- }
367
- if (!value || typeof value !== "object") return value;
368
- if (Object.getPrototypeOf(value) !== Object.prototype) return value;
369
- let changed = false;
370
- const out: Record<string, unknown> = {};
371
- for (const [key, item] of Object.entries(value as Record<string, unknown>)) {
372
- const next = withBigIntsAsNumbers(item);
373
- if (next !== item) changed = true;
374
- out[key] = next;
375
- }
376
- return changed ? out : value;
377
- }
378
-
379
- /** Copy keys the validator's default-fill added to `view` back onto `target`.
380
- * Only ADDITIONS are taken: a key already present came from the caller and its
381
- * original (possibly BigInt) value is the one to dispatch. */
382
- function mergeFilledDefaults(target: unknown, view: unknown): unknown {
383
- if (target === view) return target;
384
- if (!target || typeof target !== "object" || Array.isArray(target)) return target;
385
- if (!view || typeof view !== "object" || Array.isArray(view)) return target;
386
- const out = target as Record<string, unknown>;
387
- for (const [key, filled] of Object.entries(view as Record<string, unknown>)) {
388
- if (!(key in out)) out[key] = filled;
389
- else out[key] = mergeFilledDefaults(out[key], filled);
390
- }
391
- return out;
392
- }
package/src/kernel.ts CHANGED
@@ -38,6 +38,7 @@ import {
38
38
  import { parseArgs } from "util";
39
39
  import { ControllerRegistry } from "./controller-registry.js";
40
40
  import { EventBus } from "./events.js";
41
+ import { enableBigIntJson } from "./bigint-json.js";
41
42
  import { hostEnv, lockControllerEnv } from "./host-env.js";
42
43
  import { KernelTracer } from "./tracing.js";
43
44
  import { KernelLogging, type LoggingManifestBlock } from "./logging/kernel-logging.js";
@@ -761,6 +762,13 @@ export class Kernel implements IKernel {
761
762
  }
762
763
  this._bootCalled = true;
763
764
 
765
+ // Make a CEL integer JSON-serializable before any controller runs. CEL
766
+ // models `int` as int64 (a JS BigInt here), and `JSON.stringify` throws on
767
+ // one — so every JSON boundary a manifest can reach, in this kernel and in
768
+ // any module, needs the answer installed before the first value crosses it.
769
+ // Process-global and idempotent, like the env guardrail below.
770
+ enableBigIntJson();
771
+
764
772
  // Lock the ambient host environment before any controller runs: a key the
765
773
  // manifest binds via `variables`/`secrets`/`ports` must be read through
766
774
  // `ctx.env` or the declared binding, never the raw `process.env` var. Every
@@ -1145,6 +1153,7 @@ export class Kernel implements IKernel {
1145
1153
  args?: ParsedArgs,
1146
1154
  ownerPrefix = "",
1147
1155
  owningContext?: IEvaluationContext,
1156
+ resolvedKind?: string,
1148
1157
  ): ResourceContext {
1149
1158
  return new ResourceContextImpl(
1150
1159
  this,
@@ -1158,6 +1167,7 @@ export class Kernel implements IKernel {
1158
1167
  args,
1159
1168
  ownerPrefix,
1160
1169
  owningContext ?? moduleContext,
1170
+ resolvedKind,
1161
1171
  );
1162
1172
  }
1163
1173
 
@@ -1308,6 +1318,7 @@ export class Kernel implements IKernel {
1308
1318
  // Snapshot publication targets the context that OWNS the instance — for a
1309
1319
  // `with:`-scoped resource that is the per-run scope child, not the module.
1310
1320
  evalContext,
1321
+ resolvedKind,
1311
1322
  );
1312
1323
  const instance = await controller.create(processedResource, ctx);
1313
1324
  if (!instance) return null;
@@ -1,4 +1,4 @@
1
- import { formatUnixNano, type AnyValue, type ErrorValue, type LogRecord } from "@telorun/sdk";
1
+ import { bigIntAt, formatUnixNano, type AnyValue, type ErrorValue, type LogRecord } from "@telorun/sdk";
2
2
 
3
3
  /**
4
4
  * The `json` encoding — `kernel/specs/logging.md` §11.1. One JSON object per
@@ -83,16 +83,21 @@ function sortKeysDeep(value: AnyValue): AnyValue {
83
83
  }
84
84
 
85
85
  function makeReplacer(encodeBytes: BytesEncoder) {
86
- return function replacer(this: unknown, _key: string, value: unknown): unknown {
87
- if (typeof value === "bigint") {
88
- // Values beyond 2^53 lose precision in a JS receiver, so they degrade to a
89
- // decimal string rather than to a wrong number — the same reasoning OTLP
90
- // gives for quoting its 64-bit fields.
91
- return value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER)
92
- ? Number(value)
93
- : value.toString();
86
+ return function replacer(this: unknown, key: string, value: unknown): unknown {
87
+ // Read the BigInt off the HOLDER, not off `value`: `BigInt.prototype.toJSON`
88
+ // has already rewritten it to the exact-digits form every other JSON boundary
89
+ // wants (see `enableBigIntJson`). A log record is the one destination where
90
+ // that is wrong a value beyond 2^53 loses precision in a JS receiver, so it
91
+ // degrades to a decimal string rather than to a wrong number, the same
92
+ // reasoning OTLP gives for quoting its 64-bit fields.
93
+ const source = bigIntAt(this, key);
94
+ if (source !== undefined) {
95
+ return source >= MIN_SAFE && source <= MAX_SAFE ? Number(source) : source.toString();
94
96
  }
95
97
  if (value instanceof Uint8Array) return encodeBytes(value);
96
98
  return value;
97
99
  };
98
100
  }
101
+
102
+ const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
103
+ const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
@@ -1,4 +1,4 @@
1
- import { severityFloor, type AnyValue, type ErrorValue, type LogRecord } from "@telorun/sdk";
1
+ import { bigIntAt, severityFloor, type AnyValue, type ErrorValue, type LogRecord } from "@telorun/sdk";
2
2
 
3
3
  /**
4
4
  * The `pretty` encoding — `kernel/specs/logging.md` §11.2. For humans on a
@@ -90,8 +90,17 @@ function quoteIfNeeded(text: string): string {
90
90
  return /[\s"=]/.test(text) ? JSON.stringify(text) : text;
91
91
  }
92
92
 
93
- function jsonSafe(_key: string, value: unknown): unknown {
94
- if (typeof value === "bigint") return value.toString();
93
+ function jsonSafe(this: unknown, key: string, value: unknown): unknown {
94
+ // Read the integer off the HOLDER, not off `value`: `BigInt.prototype.toJSON`
95
+ // (see `enableBigIntJson`) runs BEFORE a replacer, so by the time this is
96
+ // called a wide integer is already the exact-digits form every wire encoding
97
+ // wants. This console encoding renders it as a decimal string instead, and
98
+ // matching on `typeof value === "bigint"` would silently stop doing so —
99
+ // a changed encoding, not an error. Reading the holder keeps the rendering
100
+ // identical whether or not the patch is installed, which matters because a
101
+ // test can call this encoder outside a booted kernel.
102
+ const source = bigIntAt(this, key);
103
+ if (source !== undefined) return source.toString();
95
104
  if (value instanceof Uint8Array) return `<${value.byteLength} bytes>`;
96
105
  return value;
97
106
  }
@@ -33,6 +33,7 @@ import { isRefSentinel } from "@telorun/templating";
33
33
  import { ZoneContext } from "./zone-context.js";
34
34
  import * as path from "path";
35
35
  import { pathToFileURL } from "url";
36
+ import { withBigIntsAsNumbers } from "./bigint-schema-view.js";
36
37
  import type { ModuleArtifact } from "./bundle/module-artifact.js";
37
38
  import { hostEnv } from "./host-env.js";
38
39
  import type { LoggingHost } from "./logging/logging-host.js";
@@ -74,6 +75,12 @@ export class ResourceContextImpl implements ResourceContext {
74
75
  * eagerly for every context would allocate per resource for nothing. */
75
76
  #log: Logger | undefined;
76
77
 
78
+ /** The resolved kind. It cannot come from `metadata`, which is the resource's
79
+ * metadata BLOCK — `kind` is its sibling, not its member, so reading
80
+ * `metadata.kind` yielded `undefined` and every controller record went out
81
+ * with no resource identity at all (§7.3). */
82
+ #resolvedKind: string | undefined;
83
+
77
84
  /**
78
85
  * The resource's structured logger, stamped with its identity, module, and
79
86
  * import-alias scope so a record identifies *which instance* emitted it — the
@@ -82,8 +89,8 @@ export class ResourceContextImpl implements ResourceContext {
82
89
  */
83
90
  get log(): Logger {
84
91
  if (!this.#log) {
85
- const kind = this.metadata?.kind as string | undefined;
86
- const name = this.metadata?.metadata?.name as string | undefined;
92
+ const kind = this.#resolvedKind;
93
+ const name = this.metadata?.name as string | undefined;
87
94
  const resource =
88
95
  kind && name
89
96
  ? { kind, name, id: `${this.ownerPrefix}${kind}.${name}` }
@@ -150,7 +157,17 @@ export class ResourceContextImpl implements ResourceContext {
150
157
  * dispatch fails.
151
158
  */
152
159
  private readonly owningContext: IEvaluationContext = moduleContext,
160
+ /**
161
+ * The resolved kind, known long before `create()` runs. Passed here rather
162
+ * than waited for at `bindResourceIdentity` so `ctx.log` carries resource
163
+ * identity from the moment the context exists: a controller that captures
164
+ * `ctx.log` in its constructor — the natural thing to do when the logger is
165
+ * handed to a helper — would otherwise hold an identity-less logger for the
166
+ * resource's whole life, and nothing would report that it had.
167
+ */
168
+ resolvedKind?: string,
153
169
  ) {
170
+ this.#resolvedKind = resolvedKind;
154
171
  // `ctx.env` is the sanctioned host-env channel for controllers — always the
155
172
  // real environment (kernel passes its snapshot), never the locked Proxy.
156
173
  this.env = env ?? hostEnv();
@@ -313,7 +330,11 @@ export class ResourceContextImpl implements ResourceContext {
313
330
  additionalProperties: false,
314
331
  },
315
332
  );
316
- const isValid = validate(stripCompiledValues(value));
333
+ // A BigInt-normalized view: AJV reads `integer` as `typeof == "number"`, so a
334
+ // CEL integer (int64) would be rejected at a slot it satisfies. This validator
335
+ // runs without `useDefaults` and already checks a derived value, so there is
336
+ // nothing to merge back. See `bigint-schema-view.ts`.
337
+ const isValid = validate(withBigIntsAsNumbers(stripCompiledValues(value)));
317
338
  if (!isValid) {
318
339
  throw new RuntimeError(
319
340
  "ERR_INVALID_VALUE",
@@ -343,6 +364,10 @@ export class ResourceContextImpl implements ResourceContext {
343
364
  manifest: Record<string, unknown>,
344
365
  ): void {
345
366
  this.#self = handle;
367
+ // The kind is NOT restated here. It is set at construction — the single
368
+ // production site always has it — and `#log` is memoized on first access, so
369
+ // a late assignment could not reach a logger a controller already holds. A
370
+ // fallback here would read as a guarantee it cannot provide.
346
371
  this.#zones = new ZoneContext({
347
372
  resourceName: (this.metadata?.name as string) ?? "<unnamed>",
348
373
  resolvedKind,
@@ -420,10 +445,16 @@ export class ResourceContextImpl implements ResourceContext {
420
445
  // settlement is already observed here.
421
446
  const tracked = this.owningContext
422
447
  .runDetached(fn) // bare scope-detach primitive
423
- .catch(async (err: unknown) => {
424
- const detail =
425
- err instanceof Error ? { name: err.name, message: err.message } : { message: String(err) };
426
- await this.emitEvent("background.task.error", { resource: this.metadata.name, error: detail });
448
+ .catch((err: unknown) => {
449
+ // A detached task has no caller to throw to, so this record is the only
450
+ // report. It replaces the bus event rather than joining it: `eventName`
451
+ // IS the bridge to the event bus (§4), and a record already reaches every
452
+ // sink including the debug wire, so emitting both would ship two copies
453
+ // of one fact with two payload shapes to keep in step.
454
+ this.log.error("Detached task failed", undefined, {
455
+ error: err,
456
+ eventName: "background.task.error",
457
+ });
427
458
  })
428
459
  .finally(() => {
429
460
  this.pendingDetached.delete(tracked);
@@ -448,10 +479,12 @@ export class ResourceContextImpl implements ResourceContext {
448
479
  await Promise.race([Promise.allSettled([...this.pendingDetached]), timeout]);
449
480
  if (timer) clearTimeout(timer);
450
481
  if (this.pendingDetached.size > 0) {
451
- await this.emitEvent("background.task.abandoned", {
452
- resource: this.metadata.name,
453
- count: this.pendingDetached.size,
454
- });
482
+ this.log.warn(
483
+ `Abandoned ${this.pendingDetached.size} background task(s) after waiting ` +
484
+ `${DETACHED_DRAIN_TIMEOUT_MS}ms for them to drain`,
485
+ { "telo.detached.abandoned": this.pendingDetached.size },
486
+ { eventName: "background.task.abandoned" },
487
+ );
455
488
  }
456
489
  }
457
490
 
@@ -8,17 +8,15 @@ import * as fs from "node:fs";
8
8
  import { createRequire } from "node:module";
9
9
  import * as path from "node:path";
10
10
  import { binaryKeyword, X_TELO_BINARY } from "@telorun/analyzer";
11
+ import { mergeFilledDefaults, withBigIntsAsNumbers } from "./bigint-schema-view.js";
11
12
  import { formatAjvErrors } from "./manifest-schemas.js";
12
13
 
13
- /** Render a value for an error message without ever throwing.
14
- *
15
- * `JSON.stringify` refuses BigInt, and CEL evaluates an integer literal to one —
16
- * so serializing the offending data threw from inside the message template and
17
- * the thrown stringify error REPLACED the validation failure. The author was
18
- * told "cannot serialize BigInt" instead of which field was wrong. */
14
+ /** Render a value for an error message without ever throwing — the offending
15
+ * data may be cyclic, and a throw here would REPLACE the validation failure
16
+ * with an unrelated error naming no field. */
19
17
  function describeValue(data: unknown): string {
20
18
  try {
21
- return JSON.stringify(data, (_k, v) => (typeof v === "bigint" ? `${v}` : v)) ?? String(data);
19
+ return JSON.stringify(data) ?? String(data);
22
20
  } catch {
23
21
  return String(data);
24
22
  }
@@ -399,19 +397,32 @@ export class SchemaValidator {
399
397
  const validate = this.compileAjvOrLoadCached(sanitized, hash, persist);
400
398
  if (persist) this.persistedHashes.add(hash);
401
399
 
400
+ // AJV's type check is `typeof data == "number"`, so a CEL integer — a BigInt —
401
+ // is rejected at an `integer` slot no matter what the author writes. Check a
402
+ // normalized VIEW instead and merge the `useDefaults` fills back, so the value
403
+ // that reaches the controller keeps its 64-bit range. `withBigIntsAsNumbers`
404
+ // returns the same reference when there was nothing to normalize, which is what
405
+ // keeps the BigInt-free path byte-identical to a plain `validate(data)`.
406
+ const check = (data: any): boolean => {
407
+ const view = withBigIntsAsNumbers(data);
408
+ const ok = validate(view);
409
+ if (ok && view !== data) mergeFilledDefaults(data, view);
410
+ return ok;
411
+ };
412
+
402
413
  const validator = {
403
414
  validate: (data: any) => {
404
- const isValid = validate(data);
405
- if (!isValid) {
415
+ if (!check(data)) {
416
+ // Reports `data`, not the normalized view: the view renders a wide
417
+ // integer through a double, so the digits it prints for the offending
418
+ // value would not be the ones the author wrote.
406
419
  throw new RuntimeError(
407
420
  "ERR_RESOURCE_SCHEMA_VALIDATION_FAILED",
408
421
  `Invalid value passed: ${describeValue(data)}. Error: ${formatAjvErrors(validate.errors)}`,
409
422
  );
410
423
  }
411
424
  },
412
- isValid: (data: any) => {
413
- return validate(data);
414
- },
425
+ isValid: (data: any) => check(data),
415
426
  };
416
427
 
417
428
  this.hashCache.set(hash, validator);