@telorun/analyzer 0.38.0 → 0.39.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.
@@ -1 +1 @@
1
- {"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAoB9B,OAAO,EAAsB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAuxB/F,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,OAAO,GAAE,qBAA0B;IAI/C;;;;;;;;;;;;;;OAcG;IACH,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,kBAAkB,EAAE;IAm1BvB,aAAa,CACX,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,kBAAkB,EAAE;IAMvB,SAAS,CACP,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,EAI1B,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,GACtC,gBAAgB,EAAE;IAmBrB,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,GACzB;QAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAsB5F"}
1
+ {"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAoB9B,OAAO,EAAsB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AA8xB/F,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,OAAO,GAAE,qBAA0B;IAI/C;;;;;;;;;;;;;;OAcG;IACH,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,kBAAkB,EAAE;IA81BvB,aAAa,CACX,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,kBAAkB,EAAE;IAMvB,SAAS,CACP,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,EAI1B,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,GACtC,gBAAgB,EAAE;IAmBrB,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,GACzB;QAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAsB5F"}
package/dist/analyzer.js CHANGED
@@ -20,6 +20,7 @@ import { DiagnosticSeverity } from "./types.js";
20
20
  import { extractCelRegionScopes, extractContextsFromSchema, getManifestItem, pathMatchesScope, resolveContextAnnotations, resolveTypeFieldToSchema, } from "./validate-cel-context.js";
21
21
  import { buildEvalPaths, evalPathsCover } from "./eval-paths.js";
22
22
  import { validateExtends } from "./validate-extends.js";
23
+ import { validateLogging } from "./validate-logging.js";
23
24
  import { validateBaseMapping } from "./validate-base-mapping.js";
24
25
  import { validateNestedInlineResources } from "./validate-nested-inline.js";
25
26
  import { validateProviderCoherence } from "./validate-provider-coherence.js";
@@ -339,11 +340,16 @@ function buildStepContextSchema(manifest, defSchema, allManifests, defs, aliases
339
340
  * handler dispatched directly, e.g. `Lambda.Function`), so it can't be rejected
340
341
  * statically without false positives. This is the sound subset of the runtime rule.
341
342
  */
343
+ /** The built-in namespace: globally resolvable, crossing no import boundary. */
344
+ const TELO_BUILTIN_MODULE = "Telo";
342
345
  const NON_INVOKABLE_CAPABILITIES = new Set([
343
346
  "Telo.Provider",
344
347
  "Telo.Mount",
345
348
  "Telo.Type",
346
349
  "Telo.Template",
350
+ // A sink is written to through a direct contract on the controller instance,
351
+ // never dispatched — so invoking one is statically wrong.
352
+ "Telo.Sink",
347
353
  ]);
348
354
  /**
349
355
  * Validate `x-telo-step-context` step `invoke` references (e.g. `Run.Sequence`
@@ -698,6 +704,12 @@ export class StaticAnalyzer {
698
704
  // so state builds up across successive calls (e.g. incremental editor validation).
699
705
  const ctx = registry?._context();
700
706
  const aliases = ctx?.aliases ?? new AliasResolver();
707
+ // `Telo` crosses no import boundary — the kernel built-ins are globally
708
+ // resolvable, which is what lets `kind: Telo.ConsoleSink` and
709
+ // `extends: Telo.LogSink` work with no `imports:` entry (§10.2). The kernel
710
+ // registers the same ungated alias at boot; registering it here keeps the
711
+ // static and runtime halves agreeing.
712
+ aliases.registerUngatedAlias(TELO_BUILTIN_MODULE, TELO_BUILTIN_MODULE);
701
713
  const defs = ctx?.definitions ?? new DefinitionRegistry();
702
714
  // Register module identities and aliases.
703
715
  // The root module doc (Telo.Application or Telo.Library) provides its own
@@ -748,6 +760,7 @@ export class StaticAnalyzer {
748
760
  let libResolver = aliasesByModule.get(moduleName);
749
761
  if (!libResolver) {
750
762
  libResolver = new AliasResolver();
763
+ libResolver.registerUngatedAlias(TELO_BUILTIN_MODULE, TELO_BUILTIN_MODULE);
751
764
  aliasesByModule.set(moduleName, libResolver);
752
765
  }
753
766
  libResolver.registerUngatedAlias("Self", moduleName);
@@ -834,6 +847,7 @@ export class StaticAnalyzer {
834
847
  let libResolver = aliasesByModule.get(ownModule);
835
848
  if (!libResolver) {
836
849
  libResolver = new AliasResolver();
850
+ libResolver.registerUngatedAlias(TELO_BUILTIN_MODULE, TELO_BUILTIN_MODULE);
837
851
  aliasesByModule.set(ownModule, libResolver);
838
852
  }
839
853
  if (!libResolver.hasAlias("Self")) {
@@ -903,6 +917,9 @@ export class StaticAnalyzer {
903
917
  }
904
918
  if (!options?.skipValidation) {
905
919
  diagnostics.push(...validateSchemaTypeRefs(allManifests, defs, aliases, aliasesByModule, rootModules));
920
+ // §14.1 / §10.3: redaction paths and `on_full: block` are statically
921
+ // detectable, so they fail `telo check` rather than only at boot.
922
+ diagnostics.push(...validateLogging(allManifests, defs, aliases, aliasesByModule));
906
923
  }
907
924
  resolveSchemaTypeRefs(allManifests, aliases, aliasesByModule);
908
925
  // Trusted-input fast path: when the caller has already attested that
@@ -1 +1 @@
1
- {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAwBvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,EAyjB/C,CAAC"}
1
+ {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA2GvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,EA8nB/C,CAAC"}
package/dist/builtins.js CHANGED
@@ -19,6 +19,83 @@ const PROVENANCE_METADATA = {
19
19
  license: { type: "string" },
20
20
  documentation: { type: "string" },
21
21
  };
22
+ /** The six named levels of `kernel/specs/logging.md` §5.1. The full 1–24 OTel
23
+ * range stays valid on the wire; only these are nameable in a manifest. */
24
+ const LOG_LEVEL_ENUM = ["trace", "debug", "info", "warn", "error", "fatal"];
25
+ const DURATION_PATTERN = "^\\s*\\d+(\\.\\d+)?\\s*(ms|s|m|h)\\s*$";
26
+ /** Fields every sink kind inherits from `Telo.LogSink` (§12.1). A concrete sink
27
+ * kind may narrow a default but must not remove a field — a buffering policy
28
+ * that cannot be configured from the only permitted configuration source is
29
+ * not a policy. */
30
+ const LOG_SINK_COMMON_PROPERTIES = {
31
+ level: { type: "string", enum: LOG_LEVEL_ENUM },
32
+ buffer: { type: "integer", minimum: 1 },
33
+ on_full: { type: "string", enum: ["block", "drop_new", "drop_old"] },
34
+ flush_interval: { type: "string", pattern: DURATION_PATTERN },
35
+ };
36
+ /** Threshold / redaction / sampling — the fields an `imports:` entry may
37
+ * override for its subtree (§12.2). Deliberately excludes `sinks`: sinks are
38
+ * process-level I/O and belong to the root Application that owns the process,
39
+ * so an imported library can never open a log file on its importer's behalf. */
40
+ const LOGGING_SCOPE_PROPERTIES = {
41
+ level: { type: "string", enum: LOG_LEVEL_ENUM },
42
+ attributes: { type: "object" },
43
+ redact: {
44
+ type: "object",
45
+ properties: {
46
+ paths: { type: "array", items: { type: "string" } },
47
+ censor: { type: "string" },
48
+ // Deletion destroys schema stability and hides that a field was present
49
+ // at all, so §14 offers this but never as the default.
50
+ remove: { type: "boolean" },
51
+ },
52
+ additionalProperties: false,
53
+ },
54
+ sampling: {
55
+ type: "object",
56
+ properties: {
57
+ first: { type: "integer", minimum: 0 },
58
+ thereafter: { type: "integer", minimum: 0 },
59
+ tick: { type: "string", pattern: DURATION_PATTERN },
60
+ sampleErrors: { type: "boolean" },
61
+ },
62
+ additionalProperties: false,
63
+ },
64
+ };
65
+ /** The per-import `logging:` override. */
66
+ const IMPORT_LOGGING_SCHEMA = {
67
+ type: "object",
68
+ "x-telo-eval": "compile",
69
+ properties: LOGGING_SCOPE_PROPERTIES,
70
+ additionalProperties: false,
71
+ };
72
+ /** The root Application's `logging:` block — the scope fields plus `sinks`.
73
+ *
74
+ * `x-telo-eval: compile` covers the whole block: every value resolves once at
75
+ * load, which is what lets a level come from the host environment through a
76
+ * `variables:` entry read with `!cel` rather than through a parallel
77
+ * `TELO_LOG_*` path that would be invisible to the analyzer and the editor
78
+ * (§12.3, D6). */
79
+ const ROOT_LOGGING_SCHEMA = {
80
+ type: "object",
81
+ "x-telo-eval": "compile",
82
+ properties: {
83
+ ...LOGGING_SCOPE_PROPERTIES,
84
+ // A list rather than a keyed map because sinks are root-only and therefore
85
+ // never merged; with no merge to disambiguate, a list matches how Telo
86
+ // spells every other ref-or-inline collection. `x-telo-inline` opts this one
87
+ // slot into inline-resource extraction — see normalize-inline-resources.ts.
88
+ sinks: {
89
+ type: "array",
90
+ items: {
91
+ type: "object",
92
+ "x-telo-ref": "telo#LogSink",
93
+ "x-telo-inline": true,
94
+ },
95
+ },
96
+ },
97
+ additionalProperties: false,
98
+ };
22
99
  export const KERNEL_BUILTINS = [
23
100
  { kind: "Telo.Abstract", metadata: { name: "Template", module: "Telo" } },
24
101
  { kind: "Telo.Abstract", metadata: { name: "Runnable", module: "Telo" } },
@@ -31,6 +108,59 @@ export const KERNEL_BUILTINS = [
31
108
  metadata: { name: "Provider", module: "Telo" },
32
109
  schema: { "x-telo-eval": "compile" },
33
110
  },
111
+ // The sink lifecycle role: attach, write a record, flush, detach. Deliberately
112
+ // payload-opaque — it carries no filtering and no encoding — so a future
113
+ // `Telo.TraceSink` reuses the same capability with a different record type.
114
+ // Scoped to record-stream sinks; metrics aggregate rather than stream and are
115
+ // not covered. See kernel/specs/logging.md §10.
116
+ { kind: "Telo.Abstract", metadata: { name: "Sink", module: "Telo" } },
117
+ // The abstract every *log* sink kind extends, carrying the log-specific
118
+ // configuration. A kernel built-in resolvable without an import, so a sink
119
+ // author depends on the kernel contract rather than on a standard-library
120
+ // module version and kernel↔module skew never becomes a compatibility surface
121
+ // for "where do logs go".
122
+ {
123
+ kind: "Telo.Abstract",
124
+ metadata: { name: "LogSink", module: "Telo" },
125
+ capability: "Telo.Sink",
126
+ schema: {
127
+ type: "object",
128
+ properties: LOG_SINK_COMMON_PROPERTIES,
129
+ additionalProperties: true,
130
+ },
131
+ },
132
+ {
133
+ kind: "Telo.Definition",
134
+ metadata: { name: "ConsoleSink", module: "Telo" },
135
+ capability: "Telo.Sink",
136
+ extends: "Telo.LogSink",
137
+ schema: {
138
+ type: "object",
139
+ properties: {
140
+ ...LOG_SINK_COMMON_PROPERTIES,
141
+ destination: { type: "string", enum: ["stderr", "stdout"] },
142
+ encoding: { type: "string", enum: ["auto", "pretty", "json"] },
143
+ color: { type: "string", enum: ["auto", "always", "never"] },
144
+ },
145
+ additionalProperties: false,
146
+ },
147
+ },
148
+ {
149
+ kind: "Telo.Definition",
150
+ metadata: { name: "FileSink", module: "Telo" },
151
+ capability: "Telo.Sink",
152
+ extends: "Telo.LogSink",
153
+ schema: {
154
+ type: "object",
155
+ properties: {
156
+ ...LOG_SINK_COMMON_PROPERTIES,
157
+ destination: { type: "string" },
158
+ encoding: { type: "string", enum: ["json", "pretty"] },
159
+ },
160
+ required: ["destination"],
161
+ additionalProperties: false,
162
+ },
163
+ },
34
164
  {
35
165
  kind: "Telo.Definition",
36
166
  metadata: { name: "Abstract", module: "Telo" },
@@ -270,6 +400,7 @@ export const KERNEL_BUILTINS = [
270
400
  { type: "array", items: { type: "string" } },
271
401
  ],
272
402
  },
403
+ logging: IMPORT_LOGGING_SCHEMA,
273
404
  },
274
405
  required: ["metadata", "source"],
275
406
  additionalProperties: false,
@@ -428,6 +559,11 @@ export const KERNEL_BUILTINS = [
428
559
  { type: "array", items: { type: "string" } },
429
560
  ],
430
561
  },
562
+ // Threshold / redaction / sampling override for this import's
563
+ // subtree. Attached to the import rather than to a map keyed
564
+ // by module name because an alias is already uniqueness-
565
+ // enforced, while module names collide (§12.2, D9).
566
+ logging: IMPORT_LOGGING_SCHEMA,
431
567
  },
432
568
  additionalProperties: false,
433
569
  },
@@ -497,6 +633,11 @@ export const KERNEL_BUILTINS = [
497
633
  additionalProperties: false,
498
634
  },
499
635
  },
636
+ // Structured logging configuration. The manifest is the only
637
+ // configuration source — there is no TELO_LOG_* variable and no logging
638
+ // CLI flag — so a level derived from the host environment goes through a
639
+ // `variables:` entry read with `!cel`. See kernel/specs/logging.md §12.
640
+ logging: ROOT_LOGGING_SCHEMA,
500
641
  },
501
642
  required: ["metadata"],
502
643
  additionalProperties: false,
@@ -562,6 +703,11 @@ export const KERNEL_BUILTINS = [
562
703
  { type: "array", items: { type: "string" } },
563
704
  ],
564
705
  },
706
+ // Threshold / redaction / sampling override for this import's
707
+ // subtree. Attached to the import rather than to a map keyed
708
+ // by module name because an alias is already uniqueness-
709
+ // enforced, while module names collide (§12.2, D9).
710
+ logging: IMPORT_LOGGING_SCHEMA,
565
711
  },
566
712
  additionalProperties: false,
567
713
  },
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ export { flattenForAnalyzer, flattenLoadedModule, forwardReExportManifests, pars
6
6
  export { buildEvalPaths, evalPathCovers } from "./eval-paths.js";
7
7
  export { ancestorChain, controllerBearingAncestor, effectiveAuthorSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, resolveParent, } from "./extends-resolution.js";
8
8
  export type { DefResolver } from "./extends-resolution.js";
9
+ export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from "./redaction-path.js";
10
+ export type { RedactionSegment } from "./redaction-path.js";
9
11
  export { buildReferenceFieldMap, isRefEntry, isScopeEntry } from "./reference-field-map.js";
10
12
  export type { ReferenceFieldMap, RefFieldEntry } from "./reference-field-map.js";
11
13
  export { visitManifest } from "./manifest-visitor.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.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ACf,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC3E,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export { StaticAnalyzer } from "./analyzer.js";
3
3
  export { flattenForAnalyzer, flattenLoadedModule, forwardReExportManifests, parseExportEntry, reExportSpecsFromExports, resolveExportedKinds, selectModuleManifestsForAnalysis, stampExportedKinds, stampReExportedKinds, } from "./flatten-for-analyzer.js";
4
4
  export { buildEvalPaths, evalPathCovers } from "./eval-paths.js";
5
5
  export { ancestorChain, controllerBearingAncestor, effectiveAuthorSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, resolveParent, } from "./extends-resolution.js";
6
+ export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from "./redaction-path.js";
6
7
  export { buildReferenceFieldMap, isRefEntry, isScopeEntry } from "./reference-field-map.js";
7
8
  export { visitManifest } from "./manifest-visitor.js";
8
9
  export { Loader } from "./manifest-loader.js";
@@ -1 +1 @@
1
- {"version":3,"file":"inline-imports.d.ts","sourceRoot":"","sources":["../src/inline-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D;;6CAE6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,gBAAgB,EAChC,cAAc,EAAE,gBAAgB,GAAG,SAAS,GAC3C,eAAe,EAAE,CA+BnB;AAED;;;;;;;iFAOiF;AACjF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAmB9D"}
1
+ {"version":3,"file":"inline-imports.d.ts","sourceRoot":"","sources":["../src/inline-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D;;6CAE6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,gBAAgB,EAChC,cAAc,EAAE,gBAAgB,GAAG,SAAS,GAC3C,eAAe,EAAE,CAgCnB;AAED;;;;;;;iFAOiF;AACjF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAmB9D"}
@@ -38,6 +38,7 @@ export function inlineImportManifests(moduleManifest, modulePosition) {
38
38
  ...(entry.variables !== undefined ? { variables: entry.variables } : {}),
39
39
  ...(entry.secrets !== undefined ? { secrets: entry.secrets } : {}),
40
40
  ...(entry.runtime !== undefined ? { runtime: entry.runtime } : {}),
41
+ ...(entry.logging !== undefined ? { logging: entry.logging } : {}),
41
42
  };
42
43
  out.push({ manifest, position: synthPosition(modulePosition, alias, scalar) });
43
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-inline-resources.d.ts","sourceRoot":"","sources":["../src/normalize-inline-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA8BzD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE,aAAa,EACvB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAC3C,gBAAgB,EAAE,CAsEpB"}
1
+ {"version":3,"file":"normalize-inline-resources.d.ts","sourceRoot":"","sources":["../src/normalize-inline-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA6CzD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE,aAAa,EACvB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAC3C,gBAAgB,EAAE,CA0EpB"}
@@ -5,6 +5,20 @@ const SYSTEM_KINDS = new Set([
5
5
  "Telo.Library",
6
6
  "Telo.Import",
7
7
  ]);
8
+ /**
9
+ * System kinds are excluded from inline extraction by default, but a single slot
10
+ * may opt back in with `x-telo-inline: true` — `Telo.Application.logging.sinks`
11
+ * is the case this exists for.
12
+ *
13
+ * The opt-in is per slot rather than per kind because this pass runs *upstream*
14
+ * of schema validation on both the analyzer and runtime paths. Admitting the
15
+ * whole Application document would rewrite an inline `{kind, ...}` in `targets`
16
+ * into a valid `{kind, name}` before AJV ever saw it, silently converting a
17
+ * deliberate rejection into a working feature.
18
+ */
19
+ function acceptsInline(resourceKind, entry) {
20
+ return !SYSTEM_KINDS.has(resourceKind) || entry.inline === true;
21
+ }
8
22
  /** Replaces characters outside [a-zA-Z0-9_] with underscores. */
9
23
  function sanitizeName(raw) {
10
24
  return raw.replace(/[^a-zA-Z0-9_]/g, "_");
@@ -55,7 +69,10 @@ export function normalizeInlineResources(resources, registry, aliases, aliasesBy
55
69
  const result = resources.map(cloneForMutation);
56
70
  // Queue: all non-system resources with a name. Extracted resources are appended.
57
71
  // Filter the CLONES (not the originals) so traversal mutates copies.
58
- const queue = result.filter((r) => typeof r.metadata?.name === "string" && !!r.kind && !SYSTEM_KINDS.has(r.kind));
72
+ // System kinds join the queue too: their inline-accepting slots are filtered
73
+ // per entry below, so a system document is walked but only its opted-in slots
74
+ // are extracted from.
75
+ const queue = result.filter((r) => typeof r.metadata?.name === "string" && !!r.kind);
59
76
  let i = 0;
60
77
  while (i < queue.length) {
61
78
  const resource = queue[i++];
@@ -82,6 +99,8 @@ export function normalizeInlineResources(resources, registry, aliases, aliasesBy
82
99
  for (const [fieldPath, entry] of fieldMap) {
83
100
  if (!isRefEntry(entry))
84
101
  continue;
102
+ if (!acceptsInline(resource.kind, entry))
103
+ continue;
85
104
  const inScope = scopePrefixes.some((prefix) => fieldPath === prefix ||
86
105
  fieldPath.startsWith(prefix + ".") ||
87
106
  fieldPath.startsWith(prefix + "["));
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The redaction path grammar of `kernel/specs/logging.md` §14 — a hand-written
3
+ * parser over a closed grammar.
4
+ *
5
+ * §14.1 makes this a security requirement rather than a style preference. The
6
+ * implementation this syntax is borrowed from compiles paths through the
7
+ * `Function` constructor and validates them by "evaluate it and see whether it
8
+ * parses", which is exactly why that implementation must forbid user input. A
9
+ * real parser removes the injection surface entirely and, as a bonus, makes
10
+ * paths statically checkable by `telo check`.
11
+ *
12
+ * Browser-safe by construction: this module is imported by both the analyzer's
13
+ * static check and the kernel's runtime redaction pass, so the grammar has one
14
+ * definition rather than two that can drift.
15
+ *
16
+ * Grammar:
17
+ *
18
+ * path := segment ( "." segment | bracket )*
19
+ * segment := bareKey | "*"
20
+ * bracket := "[" ( quoted | integer | "*" ) "]"
21
+ * quoted := '"' ... '"' | "'" ... "'"
22
+ *
23
+ * More than one wildcard per path is supported — `items[*].tokens[*].value` is
24
+ * valid. The one-wildcard limit in the best-known implementation is an artifact
25
+ * of how it compiles accessors, not a property of the grammar.
26
+ */
27
+ export type RedactionSegment = {
28
+ kind: "key";
29
+ name: string;
30
+ } | {
31
+ kind: "wildcard";
32
+ };
33
+ export declare class RedactionPathError extends Error {
34
+ readonly code = "INVALID_REDACTION_PATH";
35
+ readonly path: string;
36
+ readonly offset: number;
37
+ constructor(path: string, offset: number, detail: string);
38
+ }
39
+ /**
40
+ * Parse a redaction path into its segments. Throws {@link RedactionPathError}
41
+ * with the offending offset so `telo check` can point at the character rather
42
+ * than the whole path.
43
+ */
44
+ export declare function parseRedactionPath(path: string): RedactionSegment[];
45
+ /** `true` when the path contains a wildcard anywhere but its last segment.
46
+ * §14.2 measures intermediate wildcards at 25–55% over plain serialization,
47
+ * against 1–2% for explicit paths, so a runtime may warn when one is used. */
48
+ export declare function hasIntermediateWildcard(segments: readonly RedactionSegment[]): boolean;
49
+ //# sourceMappingURL=redaction-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction-path.d.ts","sourceRoot":"","sources":["../src/redaction-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAEpF,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,4BAA4B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAMzD;AAID;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAyCnE;AA2CD;;+EAE+E;AAC/E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,OAAO,CAKtF"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * The redaction path grammar of `kernel/specs/logging.md` §14 — a hand-written
3
+ * parser over a closed grammar.
4
+ *
5
+ * §14.1 makes this a security requirement rather than a style preference. The
6
+ * implementation this syntax is borrowed from compiles paths through the
7
+ * `Function` constructor and validates them by "evaluate it and see whether it
8
+ * parses", which is exactly why that implementation must forbid user input. A
9
+ * real parser removes the injection surface entirely and, as a bonus, makes
10
+ * paths statically checkable by `telo check`.
11
+ *
12
+ * Browser-safe by construction: this module is imported by both the analyzer's
13
+ * static check and the kernel's runtime redaction pass, so the grammar has one
14
+ * definition rather than two that can drift.
15
+ *
16
+ * Grammar:
17
+ *
18
+ * path := segment ( "." segment | bracket )*
19
+ * segment := bareKey | "*"
20
+ * bracket := "[" ( quoted | integer | "*" ) "]"
21
+ * quoted := '"' ... '"' | "'" ... "'"
22
+ *
23
+ * More than one wildcard per path is supported — `items[*].tokens[*].value` is
24
+ * valid. The one-wildcard limit in the best-known implementation is an artifact
25
+ * of how it compiles accessors, not a property of the grammar.
26
+ */
27
+ export class RedactionPathError extends Error {
28
+ code = "INVALID_REDACTION_PATH";
29
+ path;
30
+ offset;
31
+ constructor(path, offset, detail) {
32
+ super(`Invalid redaction path "${path}" at position ${offset}: ${detail}`);
33
+ this.name = "RedactionPathError";
34
+ this.path = path;
35
+ this.offset = offset;
36
+ }
37
+ }
38
+ const BARE_KEY_TERMINATORS = new Set([".", "[", "]"]);
39
+ /**
40
+ * Parse a redaction path into its segments. Throws {@link RedactionPathError}
41
+ * with the offending offset so `telo check` can point at the character rather
42
+ * than the whole path.
43
+ */
44
+ export function parseRedactionPath(path) {
45
+ if (path.length === 0)
46
+ throw new RedactionPathError(path, 0, "path is empty");
47
+ const segments = [];
48
+ let index = 0;
49
+ let expectSegment = true;
50
+ while (index < path.length) {
51
+ const char = path[index];
52
+ if (char === "[") {
53
+ index = parseBracket(path, index, segments);
54
+ expectSegment = false;
55
+ continue;
56
+ }
57
+ if (char === ".") {
58
+ if (expectSegment) {
59
+ throw new RedactionPathError(path, index, "expected a key before '.'");
60
+ }
61
+ index += 1;
62
+ expectSegment = true;
63
+ continue;
64
+ }
65
+ if (char === "]") {
66
+ throw new RedactionPathError(path, index, "unmatched ']'");
67
+ }
68
+ const start = index;
69
+ while (index < path.length && !BARE_KEY_TERMINATORS.has(path[index]))
70
+ index += 1;
71
+ const raw = path.slice(start, index);
72
+ if (raw.length === 0)
73
+ throw new RedactionPathError(path, start, "empty key");
74
+ segments.push(raw === "*" ? { kind: "wildcard" } : { kind: "key", name: raw });
75
+ expectSegment = false;
76
+ }
77
+ if (expectSegment) {
78
+ throw new RedactionPathError(path, path.length, "path ends with a trailing '.'");
79
+ }
80
+ return segments;
81
+ }
82
+ function parseBracket(path, open, segments) {
83
+ let index = open + 1;
84
+ if (index >= path.length)
85
+ throw new RedactionPathError(path, open, "unterminated '['");
86
+ const quote = path[index];
87
+ if (quote === '"' || quote === "'") {
88
+ index += 1;
89
+ const start = index;
90
+ while (index < path.length && path[index] !== quote)
91
+ index += 1;
92
+ if (index >= path.length) {
93
+ throw new RedactionPathError(path, start, `unterminated ${quote} quoted key`);
94
+ }
95
+ const name = path.slice(start, index);
96
+ if (name.length === 0)
97
+ throw new RedactionPathError(path, start, "empty quoted key");
98
+ index += 1;
99
+ if (path[index] !== "]") {
100
+ throw new RedactionPathError(path, index, "expected ']' after quoted key");
101
+ }
102
+ segments.push({ kind: "key", name });
103
+ return index + 1;
104
+ }
105
+ const start = index;
106
+ while (index < path.length && path[index] !== "]")
107
+ index += 1;
108
+ if (index >= path.length)
109
+ throw new RedactionPathError(path, open, "unterminated '['");
110
+ const raw = path.slice(start, index);
111
+ if (raw.length === 0)
112
+ throw new RedactionPathError(path, start, "empty '[]'");
113
+ if (raw === "*") {
114
+ segments.push({ kind: "wildcard" });
115
+ }
116
+ else if (/^\d+$/.test(raw)) {
117
+ segments.push({ kind: "key", name: raw });
118
+ }
119
+ else {
120
+ throw new RedactionPathError(path, start, `expected a quoted key, an integer index, or '*', got "${raw}" — quote it as ["${raw}"]`);
121
+ }
122
+ return index + 1;
123
+ }
124
+ /** `true` when the path contains a wildcard anywhere but its last segment.
125
+ * §14.2 measures intermediate wildcards at 25–55% over plain serialization,
126
+ * against 1–2% for explicit paths, so a runtime may warn when one is used. */
127
+ export function hasIntermediateWildcard(segments) {
128
+ for (let i = 0; i < segments.length - 1; i += 1) {
129
+ if (segments[i].kind === "wildcard")
130
+ return true;
131
+ }
132
+ return false;
133
+ }
@@ -8,6 +8,18 @@ export interface RefFieldEntry {
8
8
  /** x-telo-context schema declared on this ref slot, if any. Describes the CEL invocation
9
9
  * context available to resources placed in this slot. */
10
10
  context?: Record<string, any>;
11
+ /** `x-telo-inline: true` — this slot accepts an inline `{kind, ...config}`
12
+ * definition, not only a `!ref`.
13
+ *
14
+ * Only meaningful on the *system* kinds (`Telo.Application` and friends),
15
+ * which are otherwise excluded from inline-resource normalization wholesale.
16
+ * Ordinary resource kinds accept inline definitions at every ref slot and
17
+ * need no annotation. The flag exists so `logging.sinks` can opt in without
18
+ * also legalizing an inline definition in `targets`, where the Application
19
+ * schema rejects one deliberately — normalization runs upstream of AJV, so
20
+ * an unconditional opt-in would rewrite the value into a valid shape before
21
+ * the schema ever saw it. */
22
+ inline?: boolean;
11
23
  }
12
24
  /** An entry for a field that declares an execution scope (x-telo-scope). */
13
25
  export interface ScopeFieldEntry {
@@ -1 +1 @@
1
- {"version":3,"file":"reference-field-map.d.ts","sourceRoot":"","sources":["../src/reference-field-map.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B;sDACkD;IAClD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0FAA0F;IAC1F,OAAO,EAAE,OAAO,CAAC;IACjB;8DAC0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B;2CACuC;IACvC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B;AAED;8CAC8C;AAC9C,MAAM,WAAW,oBAAoB;IACnC;;qFAEiF;IACjF,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAEnF;0FAC0F;AAC1F,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE3D,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,aAAa,CAEvE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,eAAe,CAE3E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE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CAAC,GAAG,iBAAiB,CAQrF;AASD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE,CAa/D;AAED;;;8CAG8C;AAC9C,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,UAAU,EAAE,MAAM,GACjB,iBAAiB,CAInB"}
@@ -103,6 +103,13 @@ export function buildReferenceFieldMap(schema) {
103
103
  }
104
104
  return map;
105
105
  }
106
+ /** `x-telo-inline` declared on any `anyOf` branch marks the whole slot as
107
+ * inline-accepting, matching how {@link collectRefs} unions branch refs. */
108
+ function collectInlineFlag(node) {
109
+ if (!Array.isArray(node.anyOf))
110
+ return false;
111
+ return node.anyOf.some((branch) => branch?.["x-telo-inline"] === true);
112
+ }
106
113
  export function collectRefs(node) {
107
114
  const refs = [];
108
115
  if (typeof node["x-telo-ref"] === "string") {
@@ -156,6 +163,8 @@ function traverseNode(node, path, map, root, visitedRefs = new Set()) {
156
163
  const entry = { refs, isArray: path.includes("[]") };
157
164
  if (node["x-telo-context"])
158
165
  entry.context = node["x-telo-context"];
166
+ if (node["x-telo-inline"] === true || collectInlineFlag(node))
167
+ entry.inline = true;
159
168
  map.set(path, entry);
160
169
  // A node can mix item-level ref branches (a bare string / `{kind, name}`)
161
170
  // with object branches that carry their OWN nested refs — e.g. Application
@@ -1 +1 @@
1
- {"version":3,"file":"schema-compat.d.ts","sourceRoot":"","sources":["../src/schema-compat.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,GAAG,KAA0C,CAAC;AAEpD;;;;;;;mCAOmC;AACnC,wBAAgB,SAAS,IAAI,YAAY,CAAC,OAAO,GAAG,CAAC,CAOpD;AAKD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;oEAEoE;AACpE,wBAAgB,wBAAwB,CACtC,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CAAC,GAAG,OAAO,CAwB5E;AAID,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAOtG;AAED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAUlF;AAED;iGACiG;AACjG,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,OAAO,CAqCT"}
@@ -285,6 +285,14 @@ export function celTypeSatisfiesJsonSchema(celType, schema) {
285
285
  export function celPlaceholderForSchema(schema) {
286
286
  if (schema.default !== undefined)
287
287
  return schema.default;
288
+ // An enum-constrained field needs a placeholder drawn from the enum: the
289
+ // type-based fallbacks below ("" for a string, 0 for a number) satisfy `type`
290
+ // but violate `enum`, so a CEL expression feeding any enum field would report
291
+ // a spurious SCHEMA_VIOLATION against a value the author never wrote. The
292
+ // member chosen is irrelevant — only its acceptability to AJV matters, since
293
+ // the real value is checked at runtime once the expression resolves.
294
+ if (Array.isArray(schema.enum) && schema.enum.length > 0)
295
+ return schema.enum[0];
288
296
  switch (schema.type) {
289
297
  case "integer":
290
298
  case "number":