autotel-schema 20.0.0 → 20.0.2

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.
package/dist/cli.d.cts CHANGED
@@ -8,6 +8,5 @@
8
8
  * Both operate on snapshot JSON produced by `serializeSnapshot(contractToSnapshot(contract))`.
9
9
  * Commit the baseline; regenerate `current` in CI; gate the merge on `check`.
10
10
  */
11
- declare function run(argv: string[]): number;
12
- //#endregion
13
- export { run };
11
+ export declare function run(argv: string[]): number;
12
+ //#endregion
package/dist/cli.d.ts CHANGED
@@ -8,6 +8,5 @@
8
8
  * Both operate on snapshot JSON produced by `serializeSnapshot(contractToSnapshot(contract))`.
9
9
  * Commit the baseline; regenerate `current` in CI; gate the merge on `check`.
10
10
  */
11
- declare function run(argv: string[]): number;
12
- //#endregion
13
- export { run };
11
+ export declare function run(argv: string[]): number;
12
+ //#endregion
@@ -13,13 +13,13 @@ import { o as Stability, r as AttributeType, s as TelemetryContract } from "./co
13
13
  */
14
14
  declare const SCHEMA_ATTRS: {
15
15
  /** The service this contract describes (mirrors `service.name`). */
16
- readonly SERVICE: "telemetry.schema.service";
16
+ readonly SERVICE: 'telemetry.schema.service';
17
17
  /** Semver of the telemetry contract that produced this span. */
18
- readonly VERSION: "telemetry.schema.version";
18
+ readonly VERSION: 'telemetry.schema.version';
19
19
  };
20
20
  type SchemaAttributeKey = (typeof SCHEMA_ATTRS)[keyof typeof SCHEMA_ATTRS];
21
21
  /** Snapshot file spec marker — bump only on a breaking snapshot format change. */
22
- declare const SNAPSHOT_SPEC: "autotel-schema-snapshot/v1";
22
+ declare const SNAPSHOT_SPEC: 'autotel-schema-snapshot/v1';
23
23
  //#endregion
24
24
  //#region src/snapshot.d.ts
25
25
  /** Flattened, fully-resolved attribute record in a snapshot. */
@@ -13,13 +13,13 @@ import { o as Stability, r as AttributeType, s as TelemetryContract } from "./co
13
13
  */
14
14
  declare const SCHEMA_ATTRS: {
15
15
  /** The service this contract describes (mirrors `service.name`). */
16
- readonly SERVICE: "telemetry.schema.service";
16
+ readonly SERVICE: 'telemetry.schema.service';
17
17
  /** Semver of the telemetry contract that produced this span. */
18
- readonly VERSION: "telemetry.schema.version";
18
+ readonly VERSION: 'telemetry.schema.version';
19
19
  };
20
20
  type SchemaAttributeKey = (typeof SCHEMA_ATTRS)[keyof typeof SCHEMA_ATTRS];
21
21
  /** Snapshot file spec marker — bump only on a breaking snapshot format change. */
22
- declare const SNAPSHOT_SPEC: "autotel-schema-snapshot/v1";
22
+ declare const SNAPSHOT_SPEC: 'autotel-schema-snapshot/v1';
23
23
  //#endregion
24
24
  //#region src/snapshot.d.ts
25
25
  /** Flattened, fully-resolved attribute record in a snapshot. */
package/dist/diff.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as diffSnapshots, i as SnapshotDiff, n as ChangeType, o as formatDiff, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind } from "./diff-B9GL_E28.cjs";
1
+ import { a as diffSnapshots, i as SnapshotDiff, n as ChangeType, o as formatDiff, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind } from "./diff-DFAepPMY.cjs";
2
2
  export { ChangeKind, ChangeType, SnapshotChange, SnapshotDiff, diffSnapshots, formatDiff, hasBreakingChanges };
package/dist/diff.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as diffSnapshots, i as SnapshotDiff, n as ChangeType, o as formatDiff, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind } from "./diff-DenUg42T.js";
1
+ import { a as diffSnapshots, i as SnapshotDiff, n as ChangeType, o as formatDiff, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind } from "./diff-DUpKxJjh.js";
2
2
  export { ChangeKind, ChangeType, SnapshotChange, SnapshotDiff, diffSnapshots, formatDiff, hasBreakingChanges };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_snapshot = require('./snapshot-CG3MM2sd.cjs');
3
- const require_processor = require('./processor-35CBa8U1.cjs');
3
+ const require_processor = require('./processor-CsvGNvJL.cjs');
4
4
  const require_diff = require('./diff.cjs');
5
5
 
6
6
  //#region src/completeness.ts
@@ -44,9 +44,7 @@ function score(field, points, detail) {
44
44
  * partial slice.
45
45
  */
46
46
  function scoreGenAiCompleteness(spans, options = {}) {
47
- const fields = [];
48
- fields.push(anySpanHas(spans, "gen_ai.input.messages") ? score("llm_input", 1, "gen_ai.input.messages present") : score("llm_input", 0, "no span carries gen_ai.input.messages"));
49
- fields.push(anySpanHas(spans, "gen_ai.output.messages") ? score("llm_output", 1, "gen_ai.output.messages present") : score("llm_output", 0, "no span carries gen_ai.output.messages"));
47
+ const fields = [anySpanHas(spans, "gen_ai.input.messages") ? score("llm_input", 1, "gen_ai.input.messages present") : score("llm_input", 0, "no span carries gen_ai.input.messages"), anySpanHas(spans, "gen_ai.output.messages") ? score("llm_output", 1, "gen_ai.output.messages present") : score("llm_output", 0, "no span carries gen_ai.output.messages")];
50
48
  const hasResponseModel = anySpanHas(spans, "gen_ai.response.model");
51
49
  const hasRequestModel = anySpanHas(spans, "gen_ai.request.model");
52
50
  fields.push(hasResponseModel || hasRequestModel ? score("model_name", 1, hasResponseModel ? "gen_ai.response.model present" : "gen_ai.request.model present (no response model)") : score("model_name", 0, "neither request nor response model recorded"));
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { a as diffSnapshots, c as ContractSnapshot, d as contractToSnapshot, f as parseSnapshot, g as SchemaAttributeKey, h as SNAPSHOT_SPEC, i as SnapshotDiff, l as SnapshotAttribute, m as SCHEMA_ATTRS, n as ChangeType, o as formatDiff, p as serializeSnapshot, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind, u as SnapshotSpan } from "./diff-B9GL_E28.cjs";
1
+ import { a as diffSnapshots, c as ContractSnapshot, d as contractToSnapshot, f as parseSnapshot, g as SchemaAttributeKey, h as SNAPSHOT_SPEC, i as SnapshotDiff, l as SnapshotAttribute, m as SCHEMA_ATTRS, n as ChangeType, o as formatDiff, p as serializeSnapshot, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind, u as SnapshotSpan } from "./diff-DFAepPMY.cjs";
2
2
  import { A as validateScenarioSpec, C as ScenarioViolationCode, D as isScenarioClosed, E as formatScenarioResult, F as ViolationCode, I as ViolationSeverity, L as formatViolation, M as EmittedSpan, N as SchemaViolation, O as parseCardinality, P as ValidateOptions, R as hasErrors, S as ScenarioViolation, T as evaluateScenario, _ as ScenarioOutcome, a as SpanSpec, b as ScenarioSpan, c as allowsAdditionalAttributes, d as Cardinality, f as CheckScenarioOptions, g as ScenarioEventSpec, h as ScenarioAddition, i as STABILITIES, j as EmittedAttributeValue, k as proposeScenario, l as defineContract, m as EvaluateScenarioOptions, n as AttributeSpec, o as Stability, p as CompletionBoundary, r as AttributeType, s as TelemetryContract, t as ATTRIBUTE_TYPES, u as resolveAttributeSpec, v as ScenarioProposal, w as checkScenario, x as ScenarioSpec, y as ScenarioResult, z as validateSpan } from "./contract-CfOaZcD0.cjs";
3
3
  import { OtelContext, ReadableSpanLike, SCHEMA_VIOLATION_ATTRS, SchemaProcessorMode, SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, SpanLike, SpanProcessorLike, createSchemaValidationProcessor } from "./processor.cjs";
4
4
  //#region src/completeness.d.ts
5
5
  /** The ten fields a GenAI trace is scored on. */
6
- declare const GENAI_COMPLETENESS_FIELDS: readonly ["llm_input", "llm_output", "model_name", "token_usage", "cost_usd", "latency_per_span", "tool_call_args", "tool_call_results", "span_tree", "span_count"];
6
+ export declare const GENAI_COMPLETENESS_FIELDS: readonly ['llm_input', 'llm_output', 'model_name', 'token_usage', 'cost_usd', 'latency_per_span', 'tool_call_args', 'tool_call_results', 'span_tree', 'span_count'];
7
7
  type GenAiCompletenessField = (typeof GENAI_COMPLETENESS_FIELDS)[number];
8
8
  /** Per-field outcome: 1 present, 0.5 partial, 0 absent. */
9
9
  interface FieldScore {
@@ -61,9 +61,9 @@ interface CompletenessResult {
61
61
  * Pass every span of one trace — the tree and count checks are meaningless on a
62
62
  * partial slice.
63
63
  */
64
- declare function scoreGenAiCompleteness(spans: ScenarioSpan[], options?: CompletenessOptions): CompletenessResult;
64
+ export declare function scoreGenAiCompleteness(spans: ScenarioSpan[], options?: CompletenessOptions): CompletenessResult;
65
65
  /** One line per field, for a CLI or a failed assertion. */
66
- declare function formatCompleteness(result: CompletenessResult): string;
66
+ export declare function formatCompleteness(result: CompletenessResult): string;
67
67
  //#endregion
68
68
  //#region src/redaction.d.ts
69
69
  /**
@@ -84,19 +84,19 @@ declare function formatCompleteness(result: CompletenessResult): string;
84
84
  * });
85
85
  * ```
86
86
  */
87
- declare function highCardinalityKeys(contract: TelemetryContract): string[];
87
+ export declare function highCardinalityKeys(contract: TelemetryContract): string[];
88
88
  /**
89
89
  * Predicate form of {@link highCardinalityKeys} — `true` when `key` is declared
90
90
  * high-cardinality anywhere in the contract. Useful inside a custom
91
91
  * `spanNameNormalizer` or redactor callback.
92
92
  */
93
- declare function isHighCardinalityKey(contract: TelemetryContract, key: string): boolean;
93
+ export declare function isHighCardinalityKey(contract: TelemetryContract, key: string): boolean;
94
94
  //#endregion
95
95
  //#region src/contracts/agent-security.d.ts
96
96
  /**
97
97
  * Published telemetry contract for Google SAIF-aligned agent security observability.
98
98
  * Span names are illustrative — attributes are the stable surface under validation.
99
99
  */
100
- declare const AGENT_SECURITY_TELEMETRY_CONTRACT: TelemetryContract;
100
+ export declare const AGENT_SECURITY_TELEMETRY_CONTRACT: TelemetryContract;
101
101
  //#endregion
102
- export { AGENT_SECURITY_TELEMETRY_CONTRACT, ATTRIBUTE_TYPES, type AttributeSpec, type AttributeType, type Cardinality, type ChangeKind, type ChangeType, type CheckScenarioOptions, type CompletenessOptions, type CompletenessResult, type CompletenessVerdict, type CompletionBoundary, type ContractSnapshot, type EmittedAttributeValue, type EmittedSpan, type EvaluateScenarioOptions, type FieldScore, GENAI_COMPLETENESS_FIELDS, type GenAiCompletenessField, type OtelContext, type ReadableSpanLike, SCHEMA_ATTRS, SCHEMA_VIOLATION_ATTRS, SNAPSHOT_SPEC, STABILITIES, type ScenarioAddition, type ScenarioEventSpec, type ScenarioOutcome, type ScenarioProposal, type ScenarioResult, type ScenarioSpan, type ScenarioSpec, type ScenarioViolation, type ScenarioViolationCode, type SchemaAttributeKey, type SchemaProcessorMode, type SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, type SchemaViolation, type SnapshotAttribute, type SnapshotChange, type SnapshotDiff, type SnapshotSpan, type SpanLike, type SpanProcessorLike, type SpanSpec, type Stability, type TelemetryContract, type ValidateOptions, type ViolationCode, type ViolationSeverity, allowsAdditionalAttributes, checkScenario, contractToSnapshot, createSchemaValidationProcessor, defineContract, diffSnapshots, evaluateScenario, formatCompleteness, formatDiff, formatScenarioResult, formatViolation, hasBreakingChanges, hasErrors, highCardinalityKeys, isHighCardinalityKey, isScenarioClosed, parseCardinality, parseSnapshot, proposeScenario, resolveAttributeSpec, scoreGenAiCompleteness, serializeSnapshot, validateScenarioSpec, validateSpan };
102
+ export { ATTRIBUTE_TYPES, type AttributeSpec, type AttributeType, type Cardinality, type ChangeKind, type ChangeType, type CheckScenarioOptions, type CompletenessOptions, type CompletenessResult, type CompletenessVerdict, type CompletionBoundary, type ContractSnapshot, type EmittedAttributeValue, type EmittedSpan, type EvaluateScenarioOptions, type FieldScore, type GenAiCompletenessField, type OtelContext, type ReadableSpanLike, SCHEMA_ATTRS, SCHEMA_VIOLATION_ATTRS, SNAPSHOT_SPEC, STABILITIES, type ScenarioAddition, type ScenarioEventSpec, type ScenarioOutcome, type ScenarioProposal, type ScenarioResult, type ScenarioSpan, type ScenarioSpec, type ScenarioViolation, type ScenarioViolationCode, type SchemaAttributeKey, type SchemaProcessorMode, type SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, type SchemaViolation, type SnapshotAttribute, type SnapshotChange, type SnapshotDiff, type SnapshotSpan, type SpanLike, type SpanProcessorLike, type SpanSpec, type Stability, type TelemetryContract, type ValidateOptions, type ViolationCode, type ViolationSeverity, allowsAdditionalAttributes, checkScenario, contractToSnapshot, createSchemaValidationProcessor, defineContract, diffSnapshots, evaluateScenario, formatDiff, formatScenarioResult, formatViolation, hasBreakingChanges, hasErrors, isScenarioClosed, parseCardinality, parseSnapshot, proposeScenario, resolveAttributeSpec, serializeSnapshot, validateScenarioSpec, validateSpan };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { a as diffSnapshots, c as ContractSnapshot, d as contractToSnapshot, f as parseSnapshot, g as SchemaAttributeKey, h as SNAPSHOT_SPEC, i as SnapshotDiff, l as SnapshotAttribute, m as SCHEMA_ATTRS, n as ChangeType, o as formatDiff, p as serializeSnapshot, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind, u as SnapshotSpan } from "./diff-DenUg42T.js";
1
+ import { a as diffSnapshots, c as ContractSnapshot, d as contractToSnapshot, f as parseSnapshot, g as SchemaAttributeKey, h as SNAPSHOT_SPEC, i as SnapshotDiff, l as SnapshotAttribute, m as SCHEMA_ATTRS, n as ChangeType, o as formatDiff, p as serializeSnapshot, r as SnapshotChange, s as hasBreakingChanges, t as ChangeKind, u as SnapshotSpan } from "./diff-DUpKxJjh.js";
2
2
  import { A as validateScenarioSpec, C as ScenarioViolationCode, D as isScenarioClosed, E as formatScenarioResult, F as ViolationCode, I as ViolationSeverity, L as formatViolation, M as EmittedSpan, N as SchemaViolation, O as parseCardinality, P as ValidateOptions, R as hasErrors, S as ScenarioViolation, T as evaluateScenario, _ as ScenarioOutcome, a as SpanSpec, b as ScenarioSpan, c as allowsAdditionalAttributes, d as Cardinality, f as CheckScenarioOptions, g as ScenarioEventSpec, h as ScenarioAddition, i as STABILITIES, j as EmittedAttributeValue, k as proposeScenario, l as defineContract, m as EvaluateScenarioOptions, n as AttributeSpec, o as Stability, p as CompletionBoundary, r as AttributeType, s as TelemetryContract, t as ATTRIBUTE_TYPES, u as resolveAttributeSpec, v as ScenarioProposal, w as checkScenario, x as ScenarioSpec, y as ScenarioResult, z as validateSpan } from "./contract-CfOaZcD0.js";
3
3
  import { OtelContext, ReadableSpanLike, SCHEMA_VIOLATION_ATTRS, SchemaProcessorMode, SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, SpanLike, SpanProcessorLike, createSchemaValidationProcessor } from "./processor.js";
4
4
  //#region src/completeness.d.ts
5
5
  /** The ten fields a GenAI trace is scored on. */
6
- declare const GENAI_COMPLETENESS_FIELDS: readonly ["llm_input", "llm_output", "model_name", "token_usage", "cost_usd", "latency_per_span", "tool_call_args", "tool_call_results", "span_tree", "span_count"];
6
+ export declare const GENAI_COMPLETENESS_FIELDS: readonly ['llm_input', 'llm_output', 'model_name', 'token_usage', 'cost_usd', 'latency_per_span', 'tool_call_args', 'tool_call_results', 'span_tree', 'span_count'];
7
7
  type GenAiCompletenessField = (typeof GENAI_COMPLETENESS_FIELDS)[number];
8
8
  /** Per-field outcome: 1 present, 0.5 partial, 0 absent. */
9
9
  interface FieldScore {
@@ -61,9 +61,9 @@ interface CompletenessResult {
61
61
  * Pass every span of one trace — the tree and count checks are meaningless on a
62
62
  * partial slice.
63
63
  */
64
- declare function scoreGenAiCompleteness(spans: ScenarioSpan[], options?: CompletenessOptions): CompletenessResult;
64
+ export declare function scoreGenAiCompleteness(spans: ScenarioSpan[], options?: CompletenessOptions): CompletenessResult;
65
65
  /** One line per field, for a CLI or a failed assertion. */
66
- declare function formatCompleteness(result: CompletenessResult): string;
66
+ export declare function formatCompleteness(result: CompletenessResult): string;
67
67
  //#endregion
68
68
  //#region src/redaction.d.ts
69
69
  /**
@@ -84,19 +84,19 @@ declare function formatCompleteness(result: CompletenessResult): string;
84
84
  * });
85
85
  * ```
86
86
  */
87
- declare function highCardinalityKeys(contract: TelemetryContract): string[];
87
+ export declare function highCardinalityKeys(contract: TelemetryContract): string[];
88
88
  /**
89
89
  * Predicate form of {@link highCardinalityKeys} — `true` when `key` is declared
90
90
  * high-cardinality anywhere in the contract. Useful inside a custom
91
91
  * `spanNameNormalizer` or redactor callback.
92
92
  */
93
- declare function isHighCardinalityKey(contract: TelemetryContract, key: string): boolean;
93
+ export declare function isHighCardinalityKey(contract: TelemetryContract, key: string): boolean;
94
94
  //#endregion
95
95
  //#region src/contracts/agent-security.d.ts
96
96
  /**
97
97
  * Published telemetry contract for Google SAIF-aligned agent security observability.
98
98
  * Span names are illustrative — attributes are the stable surface under validation.
99
99
  */
100
- declare const AGENT_SECURITY_TELEMETRY_CONTRACT: TelemetryContract;
100
+ export declare const AGENT_SECURITY_TELEMETRY_CONTRACT: TelemetryContract;
101
101
  //#endregion
102
- export { AGENT_SECURITY_TELEMETRY_CONTRACT, ATTRIBUTE_TYPES, type AttributeSpec, type AttributeType, type Cardinality, type ChangeKind, type ChangeType, type CheckScenarioOptions, type CompletenessOptions, type CompletenessResult, type CompletenessVerdict, type CompletionBoundary, type ContractSnapshot, type EmittedAttributeValue, type EmittedSpan, type EvaluateScenarioOptions, type FieldScore, GENAI_COMPLETENESS_FIELDS, type GenAiCompletenessField, type OtelContext, type ReadableSpanLike, SCHEMA_ATTRS, SCHEMA_VIOLATION_ATTRS, SNAPSHOT_SPEC, STABILITIES, type ScenarioAddition, type ScenarioEventSpec, type ScenarioOutcome, type ScenarioProposal, type ScenarioResult, type ScenarioSpan, type ScenarioSpec, type ScenarioViolation, type ScenarioViolationCode, type SchemaAttributeKey, type SchemaProcessorMode, type SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, type SchemaViolation, type SnapshotAttribute, type SnapshotChange, type SnapshotDiff, type SnapshotSpan, type SpanLike, type SpanProcessorLike, type SpanSpec, type Stability, type TelemetryContract, type ValidateOptions, type ViolationCode, type ViolationSeverity, allowsAdditionalAttributes, checkScenario, contractToSnapshot, createSchemaValidationProcessor, defineContract, diffSnapshots, evaluateScenario, formatCompleteness, formatDiff, formatScenarioResult, formatViolation, hasBreakingChanges, hasErrors, highCardinalityKeys, isHighCardinalityKey, isScenarioClosed, parseCardinality, parseSnapshot, proposeScenario, resolveAttributeSpec, scoreGenAiCompleteness, serializeSnapshot, validateScenarioSpec, validateSpan };
102
+ export { ATTRIBUTE_TYPES, type AttributeSpec, type AttributeType, type Cardinality, type ChangeKind, type ChangeType, type CheckScenarioOptions, type CompletenessOptions, type CompletenessResult, type CompletenessVerdict, type CompletionBoundary, type ContractSnapshot, type EmittedAttributeValue, type EmittedSpan, type EvaluateScenarioOptions, type FieldScore, type GenAiCompletenessField, type OtelContext, type ReadableSpanLike, SCHEMA_ATTRS, SCHEMA_VIOLATION_ATTRS, SNAPSHOT_SPEC, STABILITIES, type ScenarioAddition, type ScenarioEventSpec, type ScenarioOutcome, type ScenarioProposal, type ScenarioResult, type ScenarioSpan, type ScenarioSpec, type ScenarioViolation, type ScenarioViolationCode, type SchemaAttributeKey, type SchemaProcessorMode, type SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, type SchemaViolation, type SnapshotAttribute, type SnapshotChange, type SnapshotDiff, type SnapshotSpan, type SpanLike, type SpanProcessorLike, type SpanSpec, type Stability, type TelemetryContract, type ValidateOptions, type ViolationCode, type ViolationSeverity, allowsAdditionalAttributes, checkScenario, contractToSnapshot, createSchemaValidationProcessor, defineContract, diffSnapshots, evaluateScenario, formatDiff, formatScenarioResult, formatViolation, hasBreakingChanges, hasErrors, isScenarioClosed, parseCardinality, parseSnapshot, proposeScenario, resolveAttributeSpec, serializeSnapshot, validateScenarioSpec, validateSpan };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as SNAPSHOT_SPEC, i as SCHEMA_ATTRS, n as parseSnapshot, r as serializeSnapshot, t as contractToSnapshot } from "./snapshot-BFIxChH0.js";
2
- import { _ as proposeScenario, a as hasErrors, c as STABILITIES, d as resolveAttributeSpec, f as checkScenario, g as parseCardinality, h as isScenarioClosed, i as formatViolation, l as allowsAdditionalAttributes, m as formatScenarioResult, n as SchemaValidationSpanProcessor, o as validateSpan, p as evaluateScenario, r as createSchemaValidationProcessor, s as ATTRIBUTE_TYPES, t as SCHEMA_VIOLATION_ATTRS, u as defineContract, v as validateScenarioSpec } from "./processor-DJA9y_Y8.js";
2
+ import { _ as proposeScenario, a as hasErrors, c as STABILITIES, d as resolveAttributeSpec, f as checkScenario, g as parseCardinality, h as isScenarioClosed, i as formatViolation, l as allowsAdditionalAttributes, m as formatScenarioResult, n as SchemaValidationSpanProcessor, o as validateSpan, p as evaluateScenario, r as createSchemaValidationProcessor, s as ATTRIBUTE_TYPES, t as SCHEMA_VIOLATION_ATTRS, u as defineContract, v as validateScenarioSpec } from "./processor-CUjsISHY.js";
3
3
  import { diffSnapshots, formatDiff, hasBreakingChanges } from "./diff.js";
4
4
 
5
5
  //#region src/completeness.ts
@@ -43,9 +43,7 @@ function score(field, points, detail) {
43
43
  * partial slice.
44
44
  */
45
45
  function scoreGenAiCompleteness(spans, options = {}) {
46
- const fields = [];
47
- fields.push(anySpanHas(spans, "gen_ai.input.messages") ? score("llm_input", 1, "gen_ai.input.messages present") : score("llm_input", 0, "no span carries gen_ai.input.messages"));
48
- fields.push(anySpanHas(spans, "gen_ai.output.messages") ? score("llm_output", 1, "gen_ai.output.messages present") : score("llm_output", 0, "no span carries gen_ai.output.messages"));
46
+ const fields = [anySpanHas(spans, "gen_ai.input.messages") ? score("llm_input", 1, "gen_ai.input.messages present") : score("llm_input", 0, "no span carries gen_ai.input.messages"), anySpanHas(spans, "gen_ai.output.messages") ? score("llm_output", 1, "gen_ai.output.messages present") : score("llm_output", 0, "no span carries gen_ai.output.messages")];
49
47
  const hasResponseModel = anySpanHas(spans, "gen_ai.response.model");
50
48
  const hasRequestModel = anySpanHas(spans, "gen_ai.request.model");
51
49
  fields.push(hasResponseModel || hasRequestModel ? score("model_name", 1, hasResponseModel ? "gen_ai.response.model present" : "gen_ai.request.model present (no response model)") : score("model_name", 0, "neither request nor response model recorded"));
@@ -59,7 +59,7 @@ function validateScenarioSpec(name, spec) {
59
59
  if (eventSpec.cardinality !== void 0) try {
60
60
  parseCardinality(eventSpec.cardinality);
61
61
  } catch (error) {
62
- throw new Error(`autotel-schema: ${scope} event "${event}": ${error instanceof Error ? error.message : String(error)}`);
62
+ throw new Error(`autotel-schema: ${scope} event "${event}": ${error instanceof Error ? error.message : String(error)}`, { cause: error });
63
63
  }
64
64
  if (eventSpec.status !== void 0) assert$1(eventSpec.status === "ok" || eventSpec.status === "error", `${scope} event "${event}" has invalid status "${eventSpec.status}"`);
65
65
  }
@@ -59,7 +59,7 @@ function validateScenarioSpec(name, spec) {
59
59
  if (eventSpec.cardinality !== void 0) try {
60
60
  parseCardinality(eventSpec.cardinality);
61
61
  } catch (error) {
62
- throw new Error(`autotel-schema: ${scope} event "${event}": ${error instanceof Error ? error.message : String(error)}`);
62
+ throw new Error(`autotel-schema: ${scope} event "${event}": ${error instanceof Error ? error.message : String(error)}`, { cause: error });
63
63
  }
64
64
  if (eventSpec.status !== void 0) assert$1(eventSpec.status === "ok" || eventSpec.status === "error", `${scope} event "${event}" has invalid status "${eventSpec.status}"`);
65
65
  }
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_processor = require('./processor-35CBa8U1.cjs');
2
+ const require_processor = require('./processor-CsvGNvJL.cjs');
3
3
 
4
4
  exports.SCHEMA_VIOLATION_ATTRS = require_processor.SCHEMA_VIOLATION_ATTRS;
5
5
  exports.SchemaValidationSpanProcessor = require_processor.SchemaValidationSpanProcessor;
@@ -1,11 +1,11 @@
1
1
  import { N as SchemaViolation, P as ValidateOptions, j as EmittedAttributeValue, s as TelemetryContract } from "./contract-CfOaZcD0.cjs";
2
2
  //#region src/processor.d.ts
3
3
  /** A ReadableSpan as this processor reads one, without a hard SDK dependency. */
4
- interface ReadableSpanLike {
4
+ export interface ReadableSpanLike {
5
5
  name: string;
6
6
  attributes: Record<string, EmittedAttributeValue>;
7
7
  }
8
- interface SpanLike {
8
+ export interface SpanLike {
9
9
  spanContext(): {
10
10
  traceId: string;
11
11
  spanId: string;
@@ -16,20 +16,20 @@ interface SpanLike {
16
16
  * and naming it here keeps the SpanProcessor signature matchable without taking
17
17
  * a dependency on the SDK.
18
18
  */
19
- interface OtelContext {
19
+ export interface OtelContext {
20
20
  getValue?: (key: symbol) => ContextValue;
21
21
  }
22
22
  /** Whatever OTel stored under a context key. This package never reads one. */
23
- type ContextValue = object | string | number | boolean | undefined;
24
- interface SpanProcessorLike {
23
+ export type ContextValue = object | string | number | boolean | undefined;
24
+ export interface SpanProcessorLike {
25
25
  onStart(span: SpanLike, parentContext: OtelContext): void;
26
26
  onEnd(span: ReadableSpanLike): void;
27
27
  shutdown(): Promise<void>;
28
28
  forceFlush(): Promise<void>;
29
29
  }
30
30
  /** How the processor reacts to a contract violation. */
31
- type SchemaProcessorMode = 'warn' | 'throw' | 'silent';
32
- interface SchemaValidationProcessorOptions extends ValidateOptions {
31
+ export type SchemaProcessorMode = 'warn' | 'throw' | 'silent';
32
+ export interface SchemaValidationProcessorOptions extends ValidateOptions {
33
33
  contract: TelemetryContract;
34
34
  /**
35
35
  * `warn` (default): log each distinct violation once per interval.
@@ -64,16 +64,16 @@ interface SchemaValidationProcessorOptions extends ValidateOptions {
64
64
  stampViolations?: boolean;
65
65
  }
66
66
  /** Attributes written onto a span carrying contract violations. */
67
- declare const SCHEMA_VIOLATION_ATTRS: {
68
- readonly count: "autotel.schema.violations";
69
- readonly severity: "autotel.schema.violation.severity";
70
- readonly codes: "autotel.schema.violation.codes";
67
+ export declare const SCHEMA_VIOLATION_ATTRS: {
68
+ readonly count: 'autotel.schema.violations';
69
+ readonly severity: 'autotel.schema.violation.severity';
70
+ readonly codes: 'autotel.schema.violation.codes';
71
71
  };
72
72
  /**
73
73
  * Validates each ending span against a {@link TelemetryContract}. Bounded,
74
74
  * deduplicated warnings; fail-open on any internal error.
75
75
  */
76
- declare class SchemaValidationSpanProcessor implements SpanProcessorLike {
76
+ export declare class SchemaValidationSpanProcessor implements SpanProcessorLike {
77
77
  private readonly opts;
78
78
  private readonly enabled;
79
79
  private readonly warnIntervalMs;
@@ -98,6 +98,5 @@ declare class SchemaValidationSpanProcessor implements SpanProcessorLike {
98
98
  forceFlush(): Promise<void>;
99
99
  shutdown(): Promise<void>;
100
100
  }
101
- declare function createSchemaValidationProcessor(opts: SchemaValidationProcessorOptions): SchemaValidationSpanProcessor;
102
- //#endregion
103
- export { ContextValue, OtelContext, ReadableSpanLike, SCHEMA_VIOLATION_ATTRS, SchemaProcessorMode, SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, SpanLike, SpanProcessorLike, createSchemaValidationProcessor };
101
+ export declare function createSchemaValidationProcessor(opts: SchemaValidationProcessorOptions): SchemaValidationSpanProcessor;
102
+ //#endregion
@@ -1,11 +1,11 @@
1
1
  import { N as SchemaViolation, P as ValidateOptions, j as EmittedAttributeValue, s as TelemetryContract } from "./contract-CfOaZcD0.js";
2
2
  //#region src/processor.d.ts
3
3
  /** A ReadableSpan as this processor reads one, without a hard SDK dependency. */
4
- interface ReadableSpanLike {
4
+ export interface ReadableSpanLike {
5
5
  name: string;
6
6
  attributes: Record<string, EmittedAttributeValue>;
7
7
  }
8
- interface SpanLike {
8
+ export interface SpanLike {
9
9
  spanContext(): {
10
10
  traceId: string;
11
11
  spanId: string;
@@ -16,20 +16,20 @@ interface SpanLike {
16
16
  * and naming it here keeps the SpanProcessor signature matchable without taking
17
17
  * a dependency on the SDK.
18
18
  */
19
- interface OtelContext {
19
+ export interface OtelContext {
20
20
  getValue?: (key: symbol) => ContextValue;
21
21
  }
22
22
  /** Whatever OTel stored under a context key. This package never reads one. */
23
- type ContextValue = object | string | number | boolean | undefined;
24
- interface SpanProcessorLike {
23
+ export type ContextValue = object | string | number | boolean | undefined;
24
+ export interface SpanProcessorLike {
25
25
  onStart(span: SpanLike, parentContext: OtelContext): void;
26
26
  onEnd(span: ReadableSpanLike): void;
27
27
  shutdown(): Promise<void>;
28
28
  forceFlush(): Promise<void>;
29
29
  }
30
30
  /** How the processor reacts to a contract violation. */
31
- type SchemaProcessorMode = 'warn' | 'throw' | 'silent';
32
- interface SchemaValidationProcessorOptions extends ValidateOptions {
31
+ export type SchemaProcessorMode = 'warn' | 'throw' | 'silent';
32
+ export interface SchemaValidationProcessorOptions extends ValidateOptions {
33
33
  contract: TelemetryContract;
34
34
  /**
35
35
  * `warn` (default): log each distinct violation once per interval.
@@ -64,16 +64,16 @@ interface SchemaValidationProcessorOptions extends ValidateOptions {
64
64
  stampViolations?: boolean;
65
65
  }
66
66
  /** Attributes written onto a span carrying contract violations. */
67
- declare const SCHEMA_VIOLATION_ATTRS: {
68
- readonly count: "autotel.schema.violations";
69
- readonly severity: "autotel.schema.violation.severity";
70
- readonly codes: "autotel.schema.violation.codes";
67
+ export declare const SCHEMA_VIOLATION_ATTRS: {
68
+ readonly count: 'autotel.schema.violations';
69
+ readonly severity: 'autotel.schema.violation.severity';
70
+ readonly codes: 'autotel.schema.violation.codes';
71
71
  };
72
72
  /**
73
73
  * Validates each ending span against a {@link TelemetryContract}. Bounded,
74
74
  * deduplicated warnings; fail-open on any internal error.
75
75
  */
76
- declare class SchemaValidationSpanProcessor implements SpanProcessorLike {
76
+ export declare class SchemaValidationSpanProcessor implements SpanProcessorLike {
77
77
  private readonly opts;
78
78
  private readonly enabled;
79
79
  private readonly warnIntervalMs;
@@ -98,6 +98,5 @@ declare class SchemaValidationSpanProcessor implements SpanProcessorLike {
98
98
  forceFlush(): Promise<void>;
99
99
  shutdown(): Promise<void>;
100
100
  }
101
- declare function createSchemaValidationProcessor(opts: SchemaValidationProcessorOptions): SchemaValidationSpanProcessor;
102
- //#endregion
103
- export { ContextValue, OtelContext, ReadableSpanLike, SCHEMA_VIOLATION_ATTRS, SchemaProcessorMode, SchemaValidationProcessorOptions, SchemaValidationSpanProcessor, SpanLike, SpanProcessorLike, createSchemaValidationProcessor };
101
+ export declare function createSchemaValidationProcessor(opts: SchemaValidationProcessorOptions): SchemaValidationSpanProcessor;
102
+ //#endregion
package/dist/processor.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as SchemaValidationSpanProcessor, r as createSchemaValidationProcessor, t as SCHEMA_VIOLATION_ATTRS } from "./processor-DJA9y_Y8.js";
1
+ import { n as SchemaValidationSpanProcessor, r as createSchemaValidationProcessor, t as SCHEMA_VIOLATION_ATTRS } from "./processor-CUjsISHY.js";
2
2
 
3
3
  export { SCHEMA_VIOLATION_ATTRS, SchemaValidationSpanProcessor, createSchemaValidationProcessor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-schema",
3
- "version": "20.0.0",
3
+ "version": "20.0.2",
4
4
  "description": "Your telemetry surface as a typed, versioned contract — declare the spans and attributes your service emits, validate live spans against them, and diff the surface across commits to catch breaking trace changes before they ship.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "author": "Jag Reehal <jag@jagreehal.com> (https://jagreehal.com)",
47
47
  "license": "Apache-2.0",
48
48
  "peerDependencies": {
49
- "autotel": "7.9.0"
49
+ "autotel": "7.10.1"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "autotel": {
@@ -54,11 +54,11 @@
54
54
  }
55
55
  },
56
56
  "devDependencies": {
57
- "@types/node": "^26.1.2",
57
+ "@types/node": "^26.6.3",
58
58
  "rimraf": "^6.1.3",
59
- "tsdown": "^0.22.14",
60
- "typescript": "^6.0.3",
61
- "vitest": "^4.1.10"
59
+ "tsdown": "^0.23.0",
60
+ "typescript": "^7.0.2",
61
+ "vitest": "^5.0.2"
62
62
  },
63
63
  "repository": {
64
64
  "type": "git",
@@ -72,8 +72,8 @@
72
72
  "scripts": {
73
73
  "build": "tsdown",
74
74
  "dev": "tsdown --watch",
75
- "lint": "eslint src/**/*.ts",
76
- "lint:fix": "eslint src/**/*.ts --fix",
75
+ "lint": "oxlint -c oxlint.json --disable-nested-config src",
76
+ "lint:fix": "pnpm lint --fix",
77
77
  "type-check": "tsc --noEmit",
78
78
  "test": "vitest run",
79
79
  "test:watch": "vitest",