@telorun/kernel 0.49.0 → 0.51.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 (199) hide show
  1. package/dist/controller-loader.d.ts +6 -1
  2. package/dist/controller-loader.d.ts.map +1 -1
  3. package/dist/controller-loader.js +2 -0
  4. package/dist/controller-loader.js.map +1 -1
  5. package/dist/controller-loaders/bundle-builder.d.ts +2 -1
  6. package/dist/controller-loaders/bundle-builder.d.ts.map +1 -1
  7. package/dist/controller-loaders/bundle-builder.js +14 -9
  8. package/dist/controller-loaders/bundle-builder.js.map +1 -1
  9. package/dist/controller-loaders/npm-loader.d.ts +8 -2
  10. package/dist/controller-loaders/npm-loader.d.ts.map +1 -1
  11. package/dist/controller-loaders/npm-loader.js +19 -10
  12. package/dist/controller-loaders/npm-loader.js.map +1 -1
  13. package/dist/controllers/logging/console-sink-controller.d.ts +15 -0
  14. package/dist/controllers/logging/console-sink-controller.d.ts.map +1 -0
  15. package/dist/controllers/logging/console-sink-controller.js +40 -0
  16. package/dist/controllers/logging/console-sink-controller.js.map +1 -0
  17. package/dist/controllers/logging/file-sink-controller.d.ts +11 -0
  18. package/dist/controllers/logging/file-sink-controller.d.ts.map +1 -0
  19. package/dist/controllers/logging/file-sink-controller.js +33 -0
  20. package/dist/controllers/logging/file-sink-controller.js.map +1 -0
  21. package/dist/controllers/logging/sink-identity.d.ts +37 -0
  22. package/dist/controllers/logging/sink-identity.d.ts.map +1 -0
  23. package/dist/controllers/logging/sink-identity.js +40 -0
  24. package/dist/controllers/logging/sink-identity.js.map +1 -0
  25. package/dist/controllers/module/import-controller.d.ts.map +1 -1
  26. package/dist/controllers/module/import-controller.js +25 -0
  27. package/dist/controllers/module/import-controller.js.map +1 -1
  28. package/dist/controllers/resource-definition/resource-definition-controller.d.ts.map +1 -1
  29. package/dist/controllers/resource-definition/resource-definition-controller.js +1 -0
  30. package/dist/controllers/resource-definition/resource-definition-controller.js.map +1 -1
  31. package/dist/evaluation-context.d.ts +27 -1
  32. package/dist/evaluation-context.d.ts.map +1 -1
  33. package/dist/evaluation-context.js +84 -16
  34. package/dist/evaluation-context.js.map +1 -1
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/internal-context.d.ts +4 -0
  40. package/dist/internal-context.d.ts.map +1 -1
  41. package/dist/kernel.d.ts +26 -0
  42. package/dist/kernel.d.ts.map +1 -1
  43. package/dist/kernel.js +78 -5
  44. package/dist/kernel.js.map +1 -1
  45. package/dist/logging/bootstrap-writer.d.ts +23 -0
  46. package/dist/logging/bootstrap-writer.d.ts.map +1 -0
  47. package/dist/logging/bootstrap-writer.js +31 -0
  48. package/dist/logging/bootstrap-writer.js.map +1 -0
  49. package/dist/logging/color-precedence.d.ts +27 -0
  50. package/dist/logging/color-precedence.d.ts.map +1 -0
  51. package/dist/logging/color-precedence.js +47 -0
  52. package/dist/logging/color-precedence.js.map +1 -0
  53. package/dist/logging/console-sink.d.ts +45 -0
  54. package/dist/logging/console-sink.d.ts.map +1 -0
  55. package/dist/logging/console-sink.js +56 -0
  56. package/dist/logging/console-sink.js.map +1 -0
  57. package/dist/logging/debug-wire-sink.d.ts +38 -0
  58. package/dist/logging/debug-wire-sink.d.ts.map +1 -0
  59. package/dist/logging/debug-wire-sink.js +85 -0
  60. package/dist/logging/debug-wire-sink.js.map +1 -0
  61. package/dist/logging/drop-accounting.d.ts +34 -0
  62. package/dist/logging/drop-accounting.d.ts.map +1 -0
  63. package/dist/logging/drop-accounting.js +98 -0
  64. package/dist/logging/drop-accounting.js.map +1 -0
  65. package/dist/logging/encode-json.d.ts +28 -0
  66. package/dist/logging/encode-json.d.ts.map +1 -0
  67. package/dist/logging/encode-json.js +86 -0
  68. package/dist/logging/encode-json.js.map +1 -0
  69. package/dist/logging/encode-pretty.d.ts +7 -0
  70. package/dist/logging/encode-pretty.d.ts.map +1 -0
  71. package/dist/logging/encode-pretty.js +104 -0
  72. package/dist/logging/encode-pretty.js.map +1 -0
  73. package/dist/logging/file-sink.d.ts +33 -0
  74. package/dist/logging/file-sink.d.ts.map +1 -0
  75. package/dist/logging/file-sink.js +72 -0
  76. package/dist/logging/file-sink.js.map +1 -0
  77. package/dist/logging/index.d.ts +39 -0
  78. package/dist/logging/index.d.ts.map +1 -0
  79. package/dist/logging/index.js +27 -0
  80. package/dist/logging/index.js.map +1 -0
  81. package/dist/logging/kernel-logging.d.ts +110 -0
  82. package/dist/logging/kernel-logging.d.ts.map +1 -0
  83. package/dist/logging/kernel-logging.js +199 -0
  84. package/dist/logging/kernel-logging.js.map +1 -0
  85. package/dist/logging/log-sink.d.ts +9 -0
  86. package/dist/logging/log-sink.d.ts.map +1 -0
  87. package/dist/logging/log-sink.js +8 -0
  88. package/dist/logging/log-sink.js.map +1 -0
  89. package/dist/logging/logging-host.d.ts +14 -0
  90. package/dist/logging/logging-host.d.ts.map +1 -0
  91. package/dist/logging/logging-host.js +27 -0
  92. package/dist/logging/logging-host.js.map +1 -0
  93. package/dist/logging/logging-pipeline.d.ts +89 -0
  94. package/dist/logging/logging-pipeline.d.ts.map +1 -0
  95. package/dist/logging/logging-pipeline.js +349 -0
  96. package/dist/logging/logging-pipeline.js.map +1 -0
  97. package/dist/logging/normalize-attributes.d.ts +48 -0
  98. package/dist/logging/normalize-attributes.d.ts.map +1 -0
  99. package/dist/logging/normalize-attributes.js +140 -0
  100. package/dist/logging/normalize-attributes.js.map +1 -0
  101. package/dist/logging/record-buffer.d.ts +24 -0
  102. package/dist/logging/record-buffer.d.ts.map +1 -0
  103. package/dist/logging/record-buffer.js +78 -0
  104. package/dist/logging/record-buffer.js.map +1 -0
  105. package/dist/logging/redact-attributes.d.ts +45 -0
  106. package/dist/logging/redact-attributes.d.ts.map +1 -0
  107. package/dist/logging/redact-attributes.js +152 -0
  108. package/dist/logging/redact-attributes.js.map +1 -0
  109. package/dist/logging/sampler.d.ts +34 -0
  110. package/dist/logging/sampler.d.ts.map +1 -0
  111. package/dist/logging/sampler.js +52 -0
  112. package/dist/logging/sampler.js.map +1 -0
  113. package/dist/logging/scope-config.d.ts +32 -0
  114. package/dist/logging/scope-config.d.ts.map +1 -0
  115. package/dist/logging/scope-config.js +2 -0
  116. package/dist/logging/scope-config.js.map +1 -0
  117. package/dist/logging/span-id.d.ts +24 -0
  118. package/dist/logging/span-id.d.ts.map +1 -0
  119. package/dist/logging/span-id.js +85 -0
  120. package/dist/logging/span-id.js.map +1 -0
  121. package/dist/logging/to-error-value.d.ts +3 -0
  122. package/dist/logging/to-error-value.d.ts.map +1 -0
  123. package/dist/logging/to-error-value.js +79 -0
  124. package/dist/logging/to-error-value.js.map +1 -0
  125. package/dist/logging/trace-parent.d.ts +54 -0
  126. package/dist/logging/trace-parent.d.ts.map +1 -0
  127. package/dist/logging/trace-parent.js +92 -0
  128. package/dist/logging/trace-parent.js.map +1 -0
  129. package/dist/manifest-schemas.d.ts +1 -1
  130. package/dist/manifest-schemas.d.ts.map +1 -1
  131. package/dist/manifest-schemas.js +12 -0
  132. package/dist/manifest-schemas.js.map +1 -1
  133. package/dist/module-context.d.ts +16 -0
  134. package/dist/module-context.d.ts.map +1 -1
  135. package/dist/module-context.js +6 -0
  136. package/dist/module-context.js.map +1 -1
  137. package/dist/resource-context.d.ts +15 -1
  138. package/dist/resource-context.d.ts.map +1 -1
  139. package/dist/resource-context.js +45 -0
  140. package/dist/resource-context.js.map +1 -1
  141. package/dist/schema-compiled-values.d.ts.map +1 -1
  142. package/dist/schema-compiled-values.js +7 -0
  143. package/dist/schema-compiled-values.js.map +1 -1
  144. package/dist/schema-validator.d.ts +8 -1
  145. package/dist/schema-validator.d.ts.map +1 -1
  146. package/dist/schema-validator.js +13 -3
  147. package/dist/schema-validator.js.map +1 -1
  148. package/dist/transports/oci/oci-transport.d.ts +2 -0
  149. package/dist/transports/oci/oci-transport.d.ts.map +1 -1
  150. package/dist/transports/oci/oci-transport.js +15 -1
  151. package/dist/transports/oci/oci-transport.js.map +1 -1
  152. package/dist/transports/registry-transport.d.ts +2 -0
  153. package/dist/transports/registry-transport.d.ts.map +1 -1
  154. package/dist/transports/registry-transport.js +13 -0
  155. package/dist/transports/registry-transport.js.map +1 -1
  156. package/dist/transports/transport.d.ts +15 -0
  157. package/dist/transports/transport.d.ts.map +1 -1
  158. package/package.json +17 -3
  159. package/src/controller-loader.ts +7 -1
  160. package/src/controller-loaders/bundle-builder.ts +18 -10
  161. package/src/controller-loaders/npm-loader.ts +32 -11
  162. package/src/controllers/logging/console-sink-controller.ts +46 -0
  163. package/src/controllers/logging/file-sink-controller.ts +40 -0
  164. package/src/controllers/logging/sink-identity.ts +53 -0
  165. package/src/controllers/module/import-controller.ts +27 -0
  166. package/src/controllers/resource-definition/resource-definition-controller.ts +1 -0
  167. package/src/evaluation-context.ts +93 -15
  168. package/src/index.ts +54 -0
  169. package/src/internal-context.ts +4 -0
  170. package/src/kernel.ts +98 -8
  171. package/src/logging/bootstrap-writer.ts +38 -0
  172. package/src/logging/color-precedence.ts +62 -0
  173. package/src/logging/console-sink.ts +86 -0
  174. package/src/logging/debug-wire-sink.ts +85 -0
  175. package/src/logging/drop-accounting.ts +108 -0
  176. package/src/logging/encode-json.ts +98 -0
  177. package/src/logging/encode-pretty.ts +117 -0
  178. package/src/logging/file-sink.ts +87 -0
  179. package/src/logging/index.ts +65 -0
  180. package/src/logging/kernel-logging.ts +266 -0
  181. package/src/logging/log-sink.ts +18 -0
  182. package/src/logging/logging-host.ts +33 -0
  183. package/src/logging/logging-pipeline.ts +465 -0
  184. package/src/logging/normalize-attributes.ts +228 -0
  185. package/src/logging/record-buffer.ts +72 -0
  186. package/src/logging/redact-attributes.ts +168 -0
  187. package/src/logging/sampler.ts +76 -0
  188. package/src/logging/scope-config.ts +32 -0
  189. package/src/logging/span-id.ts +84 -0
  190. package/src/logging/to-error-value.ts +89 -0
  191. package/src/logging/trace-parent.ts +110 -0
  192. package/src/manifest-schemas.ts +12 -0
  193. package/src/module-context.ts +23 -0
  194. package/src/resource-context.ts +48 -0
  195. package/src/schema-compiled-values.ts +6 -0
  196. package/src/schema-validator.ts +20 -5
  197. package/src/transports/oci/oci-transport.ts +16 -0
  198. package/src/transports/registry-transport.ts +14 -0
  199. package/src/transports/transport.ts +17 -0
@@ -0,0 +1,89 @@
1
+ import { type LogAttributes, type LogAttributesInput, type LogOptions, type Logger, type ResourceRef } from "@telorun/sdk";
2
+ import type { DropCause, LogSinkInstance } from "./log-sink.js";
3
+ import { type AttributeLimits } from "./normalize-attributes.js";
4
+ import type { ScopeConfig } from "./scope-config.js";
5
+ export type { ScopeConfig } from "./scope-config.js";
6
+ /**
7
+ * The emission pipeline — `kernel/specs/logging.md` §10.1:
8
+ *
9
+ * controller → Logger → [threshold] → [redaction] → [sampling] → fan-out → Sink₁..Sinkₙ
10
+ *
11
+ * Redaction runs **before** serialization and before any sink sees the record.
12
+ *
13
+ * The logger core is deliberately independent of the sink set (D1): the debug
14
+ * wire is *one sink*, not the pipeline. Logging works with no debug consumer
15
+ * attached and with tracing off, and no sink depends on the event bus — which
16
+ * short-circuits to zero cost when unsubscribed and therefore cannot carry logs.
17
+ */
18
+ /** Ambient span context, supplied by the host so §7.2's automatic attachment
19
+ * needs no cooperation from the controller. Returns `undefined` when no span is
20
+ * active, in which case all three trace fields are omitted. */
21
+ export type TraceContextProvider = () => {
22
+ traceId: string;
23
+ spanId: string;
24
+ traceFlags?: number;
25
+ } | undefined;
26
+ export declare const ROOT_SCOPE_CONFIG: ScopeConfig;
27
+ export interface PipelineOptions {
28
+ /** The process's real stderr — the fallback diagnostic stream of §8.4. This is
29
+ * the one place a logger may not surface an error inline; it is reported
30
+ * out-of-band, never swallowed. */
31
+ fallbackStream: {
32
+ write(chunk: string): unknown;
33
+ };
34
+ traceContext?: TraceContextProvider;
35
+ limits?: AttributeLimits;
36
+ /** Records held before the first declared sink attaches, replayed in order
37
+ * (§12.1). Bounded, and overflow is counted like any other drop. */
38
+ bootstrapCapacity?: number;
39
+ }
40
+ export declare class LoggingPipeline {
41
+ #private;
42
+ constructor(options: PipelineOptions);
43
+ /** Wire the ambient trace source once the kernel's tracer exists. */
44
+ setTraceContextProvider(provider: TraceContextProvider | undefined): void;
45
+ get sinkCount(): number;
46
+ /**
47
+ * Attach a sink and replay the bootstrap backlog into it, in original order.
48
+ * Attaching changes the minimum-level gate, so it is recomputed and the new
49
+ * threshold propagates to guests (§12.4).
50
+ */
51
+ attach(sink: LogSinkInstance): void;
52
+ detach(sink: LogSinkInstance): void;
53
+ /**
54
+ * Stop holding records for replay. Called once every declared sink has
55
+ * attached: the bootstrap buffer covers the pre-attach window, and a consumer
56
+ * connecting later (the debug wire) wants the live stream, not the whole
57
+ * process history.
58
+ */
59
+ sealBootstrap(): void;
60
+ /**
61
+ * The severity at or above which a record is created for a scope at
62
+ * `scopeThreshold`: the minimum — most verbose — effective level across all
63
+ * attached sinks. A record failing this gate reaches no sink and is never
64
+ * created, formatted, or sent across an FFI boundary.
65
+ *
66
+ * With no sink attached the scope's own threshold governs, so records still
67
+ * reach the bootstrap buffer and are replayed once a sink arrives.
68
+ */
69
+ gateFor(scopeThreshold: number): number;
70
+ get gateVersion(): number;
71
+ /** Count a drop against a sink. Exposed so a sink's own buffer can report
72
+ * saturation without reaching into the registry directly. */
73
+ recordDrop(sinkId: string, cause: DropCause, count?: number): void;
74
+ /** Lifetime drop total for a (sink, cause) pair, for assertions and for the
75
+ * shutdown report. */
76
+ dropTotal(sinkId: string, cause: DropCause): number;
77
+ createLogger(scope: ScopeConfig, resource?: ResourceRef, bound?: LogAttributes): Logger;
78
+ /** Build and dispatch a record. Never throws (§8.4). */
79
+ emit(scope: ScopeConfig, severity: number, message: string, resource: ResourceRef | undefined, bound: LogAttributes | undefined, attributes: LogAttributesInput | undefined, options: LogOptions | undefined): void;
80
+ /** §10.5's fatal tiering: drain every sync-flushable sink to completion before
81
+ * returning, and merely *initiate* the rest. Blocking on a sink that cannot
82
+ * be synchronously drained is a deadlock on an event loop, not durability. */
83
+ flushFatal(): void;
84
+ flush(): Promise<void>;
85
+ /** Final flush and release. Outstanding drop reports are emitted first so a
86
+ * run that ends while still dropping does not lose its accounting. */
87
+ close(): Promise<void>;
88
+ }
89
+ //# sourceMappingURL=logging-pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging-pipeline.d.ts","sourceRoot":"","sources":["../../src/logging/logging-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,MAAM,EAEX,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;;;;;;;;GAWG;AAEH;;gEAEgE;AAChE,MAAM,MAAM,oBAAoB,GAAG,MAC/B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD,SAAS,CAAC;AAEd,eAAO,MAAM,iBAAiB,EAAE,WAG/B,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B;;wCAEoC;IACpC,cAAc,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAClD,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;yEACqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAKD,qBAAa,eAAe;;gBAkBd,OAAO,EAAE,eAAe;IAQpC,qEAAqE;IACrE,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI;IAIzE,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAUnC,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAMnC;;;;;OAKG;IACH,aAAa,IAAI,IAAI;IAQrB;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;IAevC,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;kEAC8D;IAC9D,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,SAAI,GAAG,IAAI;IAI7D;2BACuB;IACvB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM;IAInD,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,MAAM;IAIvF,wDAAwD;IACxD,IAAI,CACF,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,WAAW,GAAG,SAAS,EACjC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,UAAU,EAAE,kBAAkB,GAAG,SAAS,EAC1C,OAAO,EAAE,UAAU,GAAG,SAAS,GAC9B,IAAI;IA0HP;;mFAE+E;IAC/E,UAAU,IAAI,IAAI;IAWZ,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAW5B;2EACuE;IACjE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAkD7B"}
@@ -0,0 +1,349 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _LoggingPipeline_instances, _LoggingPipeline_sinks, _LoggingPipeline_drops, _LoggingPipeline_fallback, _LoggingPipeline_limits, _LoggingPipeline_bootstrapCapacity, _LoggingPipeline_traceContext, _LoggingPipeline_gateVersion, _LoggingPipeline_gateCache, _LoggingPipeline_bootstrap, _LoggingPipeline_bootstrapDropped, _LoggingPipeline_samplers, _LoggingPipeline_lastFallbackReport, _LoggingPipeline_buildRecord, _LoggingPipeline_dispatch, _LoggingPipeline_writeTo, _LoggingPipeline_bufferBootstrap, _LoggingPipeline_samplerFor, _LoggingPipeline_invalidateGate, _LoggingPipeline_reportDrops, _LoggingPipeline_reportFallback, _ScopedLogger_pipeline, _ScopedLogger_scope, _ScopedLogger_resource, _ScopedLogger_bound, _ScopedLogger_cachedGate, _ScopedLogger_cachedVersion;
13
+ import { nowUnixNano, severityText as canonicalSeverityText, SEVERITY, } from "@telorun/sdk";
14
+ import { DropRegistry, PIPELINE_SINK_ID } from "./drop-accounting.js";
15
+ import { normalizeAttributes } from "./normalize-attributes.js";
16
+ import { EMPTY_REDACTION_POLICY, redactAttributes, redactError } from "./redact-attributes.js";
17
+ import { Sampler } from "./sampler.js";
18
+ import { toErrorValue } from "./to-error-value.js";
19
+ export const ROOT_SCOPE_CONFIG = {
20
+ threshold: SEVERITY.info,
21
+ redaction: EMPTY_REDACTION_POLICY,
22
+ };
23
+ const DEFAULT_BOOTSTRAP_CAPACITY = 1024;
24
+ const FALLBACK_REPORT_INTERVAL_MS = 5000;
25
+ export class LoggingPipeline {
26
+ constructor(options) {
27
+ _LoggingPipeline_instances.add(this);
28
+ _LoggingPipeline_sinks.set(this, []);
29
+ _LoggingPipeline_drops.set(this, void 0);
30
+ _LoggingPipeline_fallback.set(this, void 0);
31
+ _LoggingPipeline_limits.set(this, void 0);
32
+ _LoggingPipeline_bootstrapCapacity.set(this, void 0);
33
+ _LoggingPipeline_traceContext.set(this, void 0);
34
+ /** Bumped whenever the sink set changes, so a logger's cached gate
35
+ * invalidates without every logger being tracked and rewritten (§12.4). */
36
+ _LoggingPipeline_gateVersion.set(this, 0);
37
+ _LoggingPipeline_gateCache.set(this, new Map());
38
+ _LoggingPipeline_bootstrap.set(this, []);
39
+ _LoggingPipeline_bootstrapDropped.set(this, 0);
40
+ _LoggingPipeline_samplers.set(this, new Map());
41
+ _LoggingPipeline_lastFallbackReport.set(this, new Map());
42
+ __classPrivateFieldSet(this, _LoggingPipeline_fallback, options.fallbackStream, "f");
43
+ __classPrivateFieldSet(this, _LoggingPipeline_traceContext, options.traceContext, "f");
44
+ __classPrivateFieldSet(this, _LoggingPipeline_limits, options.limits, "f");
45
+ __classPrivateFieldSet(this, _LoggingPipeline_bootstrapCapacity, options.bootstrapCapacity ?? DEFAULT_BOOTSTRAP_CAPACITY, "f");
46
+ __classPrivateFieldSet(this, _LoggingPipeline_drops, new DropRegistry((report) => __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_reportDrops).call(this, report)), "f");
47
+ }
48
+ /** Wire the ambient trace source once the kernel's tracer exists. */
49
+ setTraceContextProvider(provider) {
50
+ __classPrivateFieldSet(this, _LoggingPipeline_traceContext, provider, "f");
51
+ }
52
+ get sinkCount() {
53
+ return __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").length;
54
+ }
55
+ /**
56
+ * Attach a sink and replay the bootstrap backlog into it, in original order.
57
+ * Attaching changes the minimum-level gate, so it is recomputed and the new
58
+ * threshold propagates to guests (§12.4).
59
+ */
60
+ attach(sink) {
61
+ __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").push(sink);
62
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_invalidateGate).call(this);
63
+ if (__classPrivateFieldGet(this, _LoggingPipeline_bootstrap, "f")) {
64
+ for (const record of __classPrivateFieldGet(this, _LoggingPipeline_bootstrap, "f")) {
65
+ if (record.severityNumber >= sink.level)
66
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_writeTo).call(this, sink, record);
67
+ }
68
+ }
69
+ }
70
+ detach(sink) {
71
+ const index = __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").indexOf(sink);
72
+ if (index >= 0)
73
+ __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").splice(index, 1);
74
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_invalidateGate).call(this);
75
+ }
76
+ /**
77
+ * Stop holding records for replay. Called once every declared sink has
78
+ * attached: the bootstrap buffer covers the pre-attach window, and a consumer
79
+ * connecting later (the debug wire) wants the live stream, not the whole
80
+ * process history.
81
+ */
82
+ sealBootstrap() {
83
+ if (__classPrivateFieldGet(this, _LoggingPipeline_bootstrapDropped, "f") > 0) {
84
+ __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").record(PIPELINE_SINK_ID, "buffer_full", __classPrivateFieldGet(this, _LoggingPipeline_bootstrapDropped, "f"));
85
+ __classPrivateFieldSet(this, _LoggingPipeline_bootstrapDropped, 0, "f");
86
+ }
87
+ __classPrivateFieldSet(this, _LoggingPipeline_bootstrap, undefined, "f");
88
+ }
89
+ /**
90
+ * The severity at or above which a record is created for a scope at
91
+ * `scopeThreshold`: the minimum — most verbose — effective level across all
92
+ * attached sinks. A record failing this gate reaches no sink and is never
93
+ * created, formatted, or sent across an FFI boundary.
94
+ *
95
+ * With no sink attached the scope's own threshold governs, so records still
96
+ * reach the bootstrap buffer and are replayed once a sink arrives.
97
+ */
98
+ gateFor(scopeThreshold) {
99
+ const cached = __classPrivateFieldGet(this, _LoggingPipeline_gateCache, "f").get(scopeThreshold);
100
+ if (cached !== undefined)
101
+ return cached;
102
+ let gate = scopeThreshold;
103
+ if (__classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").length > 0) {
104
+ gate = Number.POSITIVE_INFINITY;
105
+ for (const sink of __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f")) {
106
+ const effective = Number.isFinite(sink.level) ? sink.level : scopeThreshold;
107
+ if (effective < gate)
108
+ gate = effective;
109
+ }
110
+ }
111
+ __classPrivateFieldGet(this, _LoggingPipeline_gateCache, "f").set(scopeThreshold, gate);
112
+ return gate;
113
+ }
114
+ get gateVersion() {
115
+ return __classPrivateFieldGet(this, _LoggingPipeline_gateVersion, "f");
116
+ }
117
+ /** Count a drop against a sink. Exposed so a sink's own buffer can report
118
+ * saturation without reaching into the registry directly. */
119
+ recordDrop(sinkId, cause, count = 1) {
120
+ __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").record(sinkId, cause, count);
121
+ }
122
+ /** Lifetime drop total for a (sink, cause) pair, for assertions and for the
123
+ * shutdown report. */
124
+ dropTotal(sinkId, cause) {
125
+ return __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").total(sinkId, cause);
126
+ }
127
+ createLogger(scope, resource, bound) {
128
+ return new ScopedLogger(this, scope, resource, bound);
129
+ }
130
+ /** Build and dispatch a record. Never throws (§8.4). */
131
+ emit(scope, severity, message, resource, bound, attributes, options) {
132
+ try {
133
+ const record = __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_buildRecord).call(this, scope, severity, message, resource, bound, attributes, options);
134
+ const sampler = __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_samplerFor).call(this, scope);
135
+ if (sampler && !sampler.shouldEmit(record, Date.now())) {
136
+ __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").record(PIPELINE_SINK_ID, "sampled");
137
+ return;
138
+ }
139
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_dispatch).call(this, record);
140
+ // `fatal` never alters control flow — no exit, no panic — but it does
141
+ // oblige an immediate flush: synchronous on every sink that supports it,
142
+ // initiated without waiting on the rest (§10.5).
143
+ if (severity >= SEVERITY.fatal)
144
+ this.flushFatal();
145
+ }
146
+ catch (err) {
147
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_reportFallback).call(this, "<pipeline>", err);
148
+ }
149
+ }
150
+ /** §10.5's fatal tiering: drain every sync-flushable sink to completion before
151
+ * returning, and merely *initiate* the rest. Blocking on a sink that cannot
152
+ * be synchronously drained is a deadlock on an event loop, not durability. */
153
+ flushFatal() {
154
+ for (const sink of __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f")) {
155
+ try {
156
+ if (sink.syncFlushable)
157
+ sink.flushSync();
158
+ else
159
+ void sink.flush().catch((err) => __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_reportFallback).call(this, sink.sinkId, err));
160
+ }
161
+ catch (err) {
162
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_reportFallback).call(this, sink.sinkId, err);
163
+ }
164
+ }
165
+ }
166
+ async flush() {
167
+ await Promise.all(__classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").map((sink) => sink.flush().catch((err) => {
168
+ __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").record(sink.sinkId, "sink_error");
169
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_reportFallback).call(this, sink.sinkId, err);
170
+ })));
171
+ }
172
+ /** Final flush and release. Outstanding drop reports are emitted first so a
173
+ * run that ends while still dropping does not lose its accounting. */
174
+ async close() {
175
+ __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").reportPending();
176
+ await this.flush();
177
+ await Promise.all(__classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").map((sink) => sink.close().catch((err) => __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_reportFallback).call(this, sink.sinkId, err))));
178
+ __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").length = 0;
179
+ __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").dispose();
180
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_invalidateGate).call(this);
181
+ }
182
+ }
183
+ _LoggingPipeline_sinks = new WeakMap(), _LoggingPipeline_drops = new WeakMap(), _LoggingPipeline_fallback = new WeakMap(), _LoggingPipeline_limits = new WeakMap(), _LoggingPipeline_bootstrapCapacity = new WeakMap(), _LoggingPipeline_traceContext = new WeakMap(), _LoggingPipeline_gateVersion = new WeakMap(), _LoggingPipeline_gateCache = new WeakMap(), _LoggingPipeline_bootstrap = new WeakMap(), _LoggingPipeline_bootstrapDropped = new WeakMap(), _LoggingPipeline_samplers = new WeakMap(), _LoggingPipeline_lastFallbackReport = new WeakMap(), _LoggingPipeline_instances = new WeakSet(), _LoggingPipeline_buildRecord = function _LoggingPipeline_buildRecord(scope, severity, message, resource, bound, attributes, options) {
184
+ const merged = bound || attributes || scope.attributes
185
+ ? { ...scope.attributes, ...bound, ...attributes }
186
+ : undefined;
187
+ const normalized = normalizeAttributes(merged, {
188
+ limits: __classPrivateFieldGet(this, _LoggingPipeline_limits, "f"),
189
+ secretValues: scope.secretValues,
190
+ censor: scope.redaction.censor,
191
+ });
192
+ redactAttributes(normalized.attributes, scope.redaction);
193
+ const error = options?.error === undefined ? undefined : toErrorValue(options.error);
194
+ redactError(error, scope.redaction);
195
+ const timestamp = options?.timestamp ?? nowUnixNano();
196
+ const record = {
197
+ timestamp,
198
+ severityNumber: severity,
199
+ severityText: options?.severityText ?? canonicalSeverityText(severity),
200
+ message,
201
+ };
202
+ // A bridged record's origin time precedes the moment the runtime saw it.
203
+ if (options?.timestamp !== undefined)
204
+ record.observedTimestamp = nowUnixNano();
205
+ if (normalized.attributes && Object.keys(normalized.attributes).length > 0) {
206
+ record.attributes = normalized.attributes;
207
+ }
208
+ if (normalized.droppedCount > 0)
209
+ record.droppedAttributesCount = normalized.droppedCount;
210
+ if (error)
211
+ record.error = error;
212
+ if (resource)
213
+ record.resource = resource;
214
+ if (scope.module)
215
+ record.module = scope.module;
216
+ if (scope.scope)
217
+ record.scope = scope.scope;
218
+ if (options?.eventName)
219
+ record.eventName = options.eventName.slice(0, 256);
220
+ const trace = __classPrivateFieldGet(this, _LoggingPipeline_traceContext, "f")?.call(this);
221
+ if (trace) {
222
+ record.traceId = trace.traceId;
223
+ record.spanId = trace.spanId;
224
+ if (trace.traceFlags !== undefined)
225
+ record.traceFlags = trace.traceFlags;
226
+ }
227
+ return record;
228
+ }, _LoggingPipeline_dispatch = function _LoggingPipeline_dispatch(record) {
229
+ if (__classPrivateFieldGet(this, _LoggingPipeline_sinks, "f").length === 0) {
230
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_bufferBootstrap).call(this, record);
231
+ return;
232
+ }
233
+ if (__classPrivateFieldGet(this, _LoggingPipeline_bootstrap, "f"))
234
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_bufferBootstrap).call(this, record);
235
+ for (const sink of __classPrivateFieldGet(this, _LoggingPipeline_sinks, "f")) {
236
+ if (record.severityNumber < sink.level)
237
+ continue;
238
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_writeTo).call(this, sink, record);
239
+ }
240
+ }, _LoggingPipeline_writeTo = function _LoggingPipeline_writeTo(sink, record) {
241
+ try {
242
+ sink.write(record);
243
+ }
244
+ catch (err) {
245
+ __classPrivateFieldGet(this, _LoggingPipeline_drops, "f").record(sink.sinkId, "sink_error");
246
+ __classPrivateFieldGet(this, _LoggingPipeline_instances, "m", _LoggingPipeline_reportFallback).call(this, sink.sinkId, err);
247
+ }
248
+ }, _LoggingPipeline_bufferBootstrap = function _LoggingPipeline_bufferBootstrap(record) {
249
+ const buffer = __classPrivateFieldGet(this, _LoggingPipeline_bootstrap, "f");
250
+ if (!buffer)
251
+ return;
252
+ if (buffer.length >= __classPrivateFieldGet(this, _LoggingPipeline_bootstrapCapacity, "f")) {
253
+ __classPrivateFieldSet(this, _LoggingPipeline_bootstrapDropped, __classPrivateFieldGet(this, _LoggingPipeline_bootstrapDropped, "f") + 1, "f");
254
+ return;
255
+ }
256
+ buffer.push(record);
257
+ }, _LoggingPipeline_samplerFor = function _LoggingPipeline_samplerFor(scope) {
258
+ if (!scope.sampling)
259
+ return undefined;
260
+ let sampler = __classPrivateFieldGet(this, _LoggingPipeline_samplers, "f").get(scope);
261
+ if (!sampler) {
262
+ sampler = new Sampler(scope.sampling);
263
+ __classPrivateFieldGet(this, _LoggingPipeline_samplers, "f").set(scope, sampler);
264
+ }
265
+ return sampler;
266
+ }, _LoggingPipeline_invalidateGate = function _LoggingPipeline_invalidateGate() {
267
+ __classPrivateFieldSet(this, _LoggingPipeline_gateVersion, __classPrivateFieldGet(this, _LoggingPipeline_gateVersion, "f") + 1, "f");
268
+ __classPrivateFieldSet(this, _LoggingPipeline_gateCache, new Map(), "f");
269
+ }, _LoggingPipeline_reportDrops = function _LoggingPipeline_reportDrops(report) {
270
+ this.emit(ROOT_SCOPE_CONFIG, SEVERITY.warn, `dropped ${report.count} log record(s)`, undefined, undefined, {
271
+ "telo.log.sink": report.sinkId,
272
+ "telo.log.drop_cause": report.cause,
273
+ "telo.log.dropped": report.count,
274
+ "telo.log.dropped_total": report.total,
275
+ }, { eventName: "telo.log.dropped" });
276
+ }, _LoggingPipeline_reportFallback = function _LoggingPipeline_reportFallback(sinkId, err) {
277
+ const now = Date.now();
278
+ const last = __classPrivateFieldGet(this, _LoggingPipeline_lastFallbackReport, "f").get(sinkId) ?? 0;
279
+ if (now - last < FALLBACK_REPORT_INTERVAL_MS)
280
+ return;
281
+ __classPrivateFieldGet(this, _LoggingPipeline_lastFallbackReport, "f").set(sinkId, now);
282
+ const detail = err instanceof Error ? `${err.name}: ${err.message}` : String(err);
283
+ try {
284
+ __classPrivateFieldGet(this, _LoggingPipeline_fallback, "f").write(`[telo:logging] sink "${sinkId}" failed: ${detail}\n`);
285
+ }
286
+ catch {
287
+ // The fallback stream itself is gone. There is nowhere left to report to,
288
+ // and throwing here would break the application — which §8.4 forbids.
289
+ }
290
+ };
291
+ class ScopedLogger {
292
+ constructor(pipeline, scope, resource, bound) {
293
+ _ScopedLogger_pipeline.set(this, void 0);
294
+ _ScopedLogger_scope.set(this, void 0);
295
+ _ScopedLogger_resource.set(this, void 0);
296
+ _ScopedLogger_bound.set(this, void 0);
297
+ _ScopedLogger_cachedGate.set(this, Number.NaN);
298
+ _ScopedLogger_cachedVersion.set(this, -1);
299
+ __classPrivateFieldSet(this, _ScopedLogger_pipeline, pipeline, "f");
300
+ __classPrivateFieldSet(this, _ScopedLogger_scope, scope, "f");
301
+ __classPrivateFieldSet(this, _ScopedLogger_resource, resource, "f");
302
+ __classPrivateFieldSet(this, _ScopedLogger_bound, bound, "f");
303
+ }
304
+ enabled(severity) {
305
+ const version = __classPrivateFieldGet(this, _ScopedLogger_pipeline, "f").gateVersion;
306
+ if (version !== __classPrivateFieldGet(this, _ScopedLogger_cachedVersion, "f")) {
307
+ __classPrivateFieldSet(this, _ScopedLogger_cachedGate, __classPrivateFieldGet(this, _ScopedLogger_pipeline, "f").gateFor(__classPrivateFieldGet(this, _ScopedLogger_scope, "f").threshold), "f");
308
+ __classPrivateFieldSet(this, _ScopedLogger_cachedVersion, version, "f");
309
+ }
310
+ return severity >= __classPrivateFieldGet(this, _ScopedLogger_cachedGate, "f");
311
+ }
312
+ log(severity, message, attributes, options) {
313
+ if (!this.enabled(severity))
314
+ return;
315
+ __classPrivateFieldGet(this, _ScopedLogger_pipeline, "f").emit(__classPrivateFieldGet(this, _ScopedLogger_scope, "f"), severity, message, __classPrivateFieldGet(this, _ScopedLogger_resource, "f"), __classPrivateFieldGet(this, _ScopedLogger_bound, "f"), attributes, options);
316
+ }
317
+ /** Binding merges once, here — never per record — so a child logger costs one
318
+ * spread at creation and nothing at emit time (§8.3). */
319
+ with(attributes) {
320
+ const normalized = normalizeAttributes(attributes).attributes;
321
+ return new ScopedLogger(__classPrivateFieldGet(this, _ScopedLogger_pipeline, "f"), __classPrivateFieldGet(this, _ScopedLogger_scope, "f"), __classPrivateFieldGet(this, _ScopedLogger_resource, "f"), {
322
+ ...__classPrivateFieldGet(this, _ScopedLogger_bound, "f"),
323
+ ...normalized,
324
+ });
325
+ }
326
+ flush() {
327
+ return __classPrivateFieldGet(this, _ScopedLogger_pipeline, "f").flush();
328
+ }
329
+ trace(message, attributes, options) {
330
+ this.log(SEVERITY.trace, message, attributes, options);
331
+ }
332
+ debug(message, attributes, options) {
333
+ this.log(SEVERITY.debug, message, attributes, options);
334
+ }
335
+ info(message, attributes, options) {
336
+ this.log(SEVERITY.info, message, attributes, options);
337
+ }
338
+ warn(message, attributes, options) {
339
+ this.log(SEVERITY.warn, message, attributes, options);
340
+ }
341
+ error(message, attributes, options) {
342
+ this.log(SEVERITY.error, message, attributes, options);
343
+ }
344
+ fatal(message, attributes, options) {
345
+ this.log(SEVERITY.fatal, message, attributes, options);
346
+ }
347
+ }
348
+ _ScopedLogger_pipeline = new WeakMap(), _ScopedLogger_scope = new WeakMap(), _ScopedLogger_resource = new WeakMap(), _ScopedLogger_bound = new WeakMap(), _ScopedLogger_cachedGate = new WeakMap(), _ScopedLogger_cachedVersion = new WeakMap();
349
+ //# sourceMappingURL=logging-pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging-pipeline.js","sourceRoot":"","sources":["../../src/logging/logging-pipeline.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,WAAW,EACX,YAAY,IAAI,qBAAqB,EACrC,QAAQ,GAOT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAmB,MAAM,sBAAsB,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AE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,UAA+B,EAAE,OAAoB;QAC1E,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IACD,KAAK,CAAC,OAAe,EAAE,UAA+B,EAAE,OAAoB;QAC1E,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,CAAC,OAAe,EAAE,UAA+B,EAAE,OAAoB;QACzE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,CAAC,OAAe,EAAE,UAA+B,EAAE,OAAoB;QACzE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,KAAK,CAAC,OAAe,EAAE,UAA+B,EAAE,OAAoB;QAC1E,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IACD,KAAK,CAAC,OAAe,EAAE,UAA+B,EAAE,OAAoB;QAC1E,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ import { type LogAttributes, type LogAttributesInput } from "@telorun/sdk";
2
+ /**
3
+ * Attribute normalization — `kernel/specs/logging.md` §6.3.
4
+ *
5
+ * Resolves deferred values, applies every limit, scrubs secret values, and
6
+ * detects cycles in a single traversal. The caps are not optional hardening:
7
+ * they bound the blast radius of a redaction miss and of a cyclic or
8
+ * pathological value graph, so the traversal is iterative with a bounded
9
+ * counter rather than recursive, and an exception raised inside a user-supplied
10
+ * deferred value is caught and rendered as a diagnostic string rather than
11
+ * propagated (§8.4 — a logging call never throws).
12
+ *
13
+ * Secret scrubbing happens here rather than in the path-based pass because this
14
+ * traversal already visits every node, and §14 requires manifest secrets to
15
+ * redact with no configuration at all.
16
+ */
17
+ export interface AttributeLimits {
18
+ /** Excess attributes are dropped and counted into `dropped_attributes_count`. */
19
+ attributeCount: number;
20
+ /** Unlimited when `undefined`; when set, longer strings truncate and are marked. */
21
+ valueLength?: number;
22
+ /** Over-deep subtrees are replaced with `"[depth exceeded]"`. */
23
+ depth: number;
24
+ /** Arrays and maps truncate, recording the original length. */
25
+ collectionElements: number;
26
+ /** Deferred-value resolutions per record. Beyond this the traversal stops
27
+ * resolving and substitutes a diagnostic string. */
28
+ deferredSteps: number;
29
+ }
30
+ export declare const DEFAULT_ATTRIBUTE_LIMITS: AttributeLimits;
31
+ export declare const DEPTH_EXCEEDED = "[depth exceeded]";
32
+ export declare const CIRCULAR = "[circular]";
33
+ export interface NormalizeOptions {
34
+ limits?: AttributeLimits;
35
+ /** Exact string values to replace with the censor token. Sourced from the
36
+ * emitting module context's resolved `secrets:`, so redaction follows the
37
+ * same cascade the threshold does. */
38
+ secretValues?: ReadonlySet<string>;
39
+ censor?: string;
40
+ }
41
+ export interface NormalizedAttributes {
42
+ attributes: LogAttributes | undefined;
43
+ /** Non-zero when limits truncated attributes; emitted as
44
+ * `dropped_attributes_count` and omitted when zero. */
45
+ droppedCount: number;
46
+ }
47
+ export declare function normalizeAttributes(input: LogAttributesInput | undefined, options?: NormalizeOptions): NormalizedAttributes;
48
+ //# sourceMappingURL=normalize-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-attributes.d.ts","sourceRoot":"","sources":["../../src/logging/normalize-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvG;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,eAAe;IAC9B,iFAAiF;IACjF,cAAc,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,kBAAkB,EAAE,MAAM,CAAC;IAC3B;yDACqD;IACrD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,wBAAwB,EAAE,eAMtC,CAAC;AAEF,eAAO,MAAM,cAAc,qBAAqB,CAAC;AACjD,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;2CAEuC;IACvC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,aAAa,GAAG,SAAS,CAAC;IACtC;4DACwD;IACxD,YAAY,EAAE,MAAM,CAAC;CACtB;AAgBD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,kBAAkB,GAAG,SAAS,EACrC,OAAO,GAAE,gBAAqB,GAC7B,oBAAoB,CAkItB"}