observability-toolkit 1.8.5 → 2.1.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.
- package/README.md +167 -281
- package/dist/__tests__/find-constant-dedup.test.d.ts +11 -0
- package/dist/__tests__/find-constant-dedup.test.d.ts.map +1 -0
- package/dist/__tests__/find-constant-dedup.test.js +132 -0
- package/dist/__tests__/find-constant-dedup.test.js.map +1 -0
- package/dist/backends/backend-schemas.d.ts +309 -0
- package/dist/backends/backend-schemas.d.ts.map +1 -0
- package/dist/backends/backend-schemas.js +215 -0
- package/dist/backends/backend-schemas.js.map +1 -0
- package/dist/backends/cloud.d.ts +46 -0
- package/dist/backends/cloud.d.ts.map +1 -0
- package/dist/backends/cloud.js +520 -0
- package/dist/backends/cloud.js.map +1 -0
- package/dist/backends/cloud.test.d.ts +2 -0
- package/dist/backends/cloud.test.d.ts.map +1 -0
- package/dist/backends/cloud.test.js +436 -0
- package/dist/backends/cloud.test.js.map +1 -0
- package/dist/backends/index.d.ts +672 -236
- package/dist/backends/index.d.ts.map +1 -1
- package/dist/backends/index.js +334 -0
- package/dist/backends/index.js.map +1 -1
- package/dist/backends/index.test.js +606 -31
- package/dist/backends/index.test.js.map +1 -1
- package/dist/backends/local-jsonl-boolean-search.test.js +8 -7
- package/dist/backends/local-jsonl-boolean-search.test.js.map +1 -1
- package/dist/backends/local-jsonl-cache.test.js +33 -31
- package/dist/backends/local-jsonl-cache.test.js.map +1 -1
- package/dist/backends/local-jsonl-circuit-breaker.test.js +9 -7
- package/dist/backends/local-jsonl-circuit-breaker.test.js.map +1 -1
- package/dist/backends/local-jsonl-export.test.js +73 -58
- package/dist/backends/local-jsonl-export.test.js.map +1 -1
- package/dist/backends/local-jsonl-index.test.js +52 -50
- package/dist/backends/local-jsonl-index.test.js.map +1 -1
- package/dist/backends/local-jsonl-logs.test.js +47 -31
- package/dist/backends/local-jsonl-logs.test.js.map +1 -1
- package/dist/backends/local-jsonl-metrics.test.js +85 -82
- package/dist/backends/local-jsonl-metrics.test.js.map +1 -1
- package/dist/backends/local-jsonl-otlp-unwrap.test.d.ts +2 -0
- package/dist/backends/local-jsonl-otlp-unwrap.test.d.ts.map +1 -0
- package/dist/backends/local-jsonl-otlp-unwrap.test.js +602 -0
- package/dist/backends/local-jsonl-otlp-unwrap.test.js.map +1 -0
- package/dist/backends/local-jsonl-traces.test.js +161 -147
- package/dist/backends/local-jsonl-traces.test.js.map +1 -1
- package/dist/backends/local-jsonl.d.ts +64 -5
- package/dist/backends/local-jsonl.d.ts.map +1 -1
- package/dist/backends/local-jsonl.js +1821 -612
- package/dist/backends/local-jsonl.js.map +1 -1
- package/dist/backends/shared.d.ts +9 -0
- package/dist/backends/shared.d.ts.map +1 -0
- package/dist/backends/shared.js +9 -0
- package/dist/backends/shared.js.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.d.ts +40 -0
- package/dist/generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.js +27 -0
- package/dist/generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.d.ts +106 -0
- package/dist/generated/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.js +43 -0
- package/dist/generated/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.d.ts +111 -0
- package/dist/generated/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.js +42 -0
- package/dist/generated/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.d.ts +106 -0
- package/dist/generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.js +43 -0
- package/dist/generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/common/v1/common_pb.d.ts +243 -0
- package/dist/generated/opentelemetry/proto/common/v1/common_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/common/v1/common_pb.js +49 -0
- package/dist/generated/opentelemetry/proto/common/v1/common_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/logs/v1/logs_pb.d.ts +90 -0
- package/dist/generated/opentelemetry/proto/logs/v1/logs_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/logs/v1/logs_pb.js +66 -0
- package/dist/generated/opentelemetry/proto/logs/v1/logs_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/metrics/v1/metrics_pb.d.ts +1134 -0
- package/dist/generated/opentelemetry/proto/metrics/v1/metrics_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/metrics/v1/metrics_pb.js +223 -0
- package/dist/generated/opentelemetry/proto/metrics/v1/metrics_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/profiles/v1development/profiles_pb.d.ts +678 -0
- package/dist/generated/opentelemetry/proto/profiles/v1development/profiles_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/profiles/v1development/profiles_pb.js +107 -0
- package/dist/generated/opentelemetry/proto/profiles/v1development/profiles_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/resource/v1/resource_pb.d.ts +46 -0
- package/dist/generated/opentelemetry/proto/resource/v1/resource_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/resource/v1/resource_pb.js +25 -0
- package/dist/generated/opentelemetry/proto/resource/v1/resource_pb.js.map +1 -0
- package/dist/generated/opentelemetry/proto/trace/v1/trace_pb.d.ts +569 -0
- package/dist/generated/opentelemetry/proto/trace/v1/trace_pb.d.ts.map +1 -0
- package/dist/generated/opentelemetry/proto/trace/v1/trace_pb.js +195 -0
- package/dist/generated/opentelemetry/proto/trace/v1/trace_pb.js.map +1 -0
- package/dist/lib/agent-judge/agent-as-judge.d.ts +157 -0
- package/dist/lib/agent-judge/agent-as-judge.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-as-judge.js +137 -0
- package/dist/lib/agent-judge/agent-as-judge.js.map +1 -0
- package/dist/lib/agent-judge/agent-as-judge.test.d.ts +5 -0
- package/dist/lib/agent-judge/agent-as-judge.test.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-as-judge.test.js +839 -0
- package/dist/lib/agent-judge/agent-as-judge.test.js.map +1 -0
- package/dist/lib/agent-judge/agent-eval-metrics.d.ts +293 -0
- package/dist/lib/agent-judge/agent-eval-metrics.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-eval-metrics.js +715 -0
- package/dist/lib/agent-judge/agent-eval-metrics.js.map +1 -0
- package/dist/lib/agent-judge/agent-eval-metrics.test.d.ts +5 -0
- package/dist/lib/agent-judge/agent-eval-metrics.test.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-eval-metrics.test.js +676 -0
- package/dist/lib/agent-judge/agent-eval-metrics.test.js.map +1 -0
- package/dist/lib/agent-judge/agent-judge-classes.d.ts +95 -0
- package/dist/lib/agent-judge/agent-judge-classes.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-judge-classes.js +222 -0
- package/dist/lib/agent-judge/agent-judge-classes.js.map +1 -0
- package/dist/lib/agent-judge/agent-judge-classes.test.d.ts +6 -0
- package/dist/lib/agent-judge/agent-judge-classes.test.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-judge-classes.test.js +271 -0
- package/dist/lib/agent-judge/agent-judge-classes.test.js.map +1 -0
- package/dist/lib/agent-judge/agent-judge-consensus.d.ts +58 -0
- package/dist/lib/agent-judge/agent-judge-consensus.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-judge-consensus.js +149 -0
- package/dist/lib/agent-judge/agent-judge-consensus.js.map +1 -0
- package/dist/lib/agent-judge/agent-judge-consensus.test.d.ts +2 -0
- package/dist/lib/agent-judge/agent-judge-consensus.test.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-judge-consensus.test.js +170 -0
- package/dist/lib/agent-judge/agent-judge-consensus.test.js.map +1 -0
- package/dist/lib/agent-judge/agent-judge-verification.d.ts +89 -0
- package/dist/lib/agent-judge/agent-judge-verification.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-judge-verification.js +235 -0
- package/dist/lib/agent-judge/agent-judge-verification.js.map +1 -0
- package/dist/lib/agent-judge/agent-judge-verification.test.d.ts +5 -0
- package/dist/lib/agent-judge/agent-judge-verification.test.d.ts.map +1 -0
- package/dist/lib/agent-judge/agent-judge-verification.test.js +399 -0
- package/dist/lib/agent-judge/agent-judge-verification.test.js.map +1 -0
- package/dist/lib/audit/agent-auditor-scoring.d.ts +167 -0
- package/dist/lib/audit/agent-auditor-scoring.d.ts.map +1 -0
- package/dist/lib/audit/agent-auditor-scoring.js +338 -0
- package/dist/lib/audit/agent-auditor-scoring.js.map +1 -0
- package/dist/lib/audit/agent-auditor-scoring.test.d.ts +2 -0
- package/dist/lib/audit/agent-auditor-scoring.test.d.ts.map +1 -0
- package/dist/lib/audit/agent-auditor-scoring.test.js +576 -0
- package/dist/lib/audit/agent-auditor-scoring.test.js.map +1 -0
- package/dist/lib/audit/audit-record.d.ts +139 -0
- package/dist/lib/audit/audit-record.d.ts.map +1 -0
- package/dist/lib/audit/audit-record.js +288 -0
- package/dist/lib/audit/audit-record.js.map +1 -0
- package/dist/lib/audit/audit-record.test.d.ts +5 -0
- package/dist/lib/audit/audit-record.test.d.ts.map +1 -0
- package/dist/lib/audit/audit-record.test.js +258 -0
- package/dist/lib/audit/audit-record.test.js.map +1 -0
- package/dist/lib/audit/audit-scoring-constants.d.ts +57 -0
- package/dist/lib/audit/audit-scoring-constants.d.ts.map +1 -0
- package/dist/lib/audit/audit-scoring-constants.js +59 -0
- package/dist/lib/audit/audit-scoring-constants.js.map +1 -0
- package/dist/lib/audit/compliance-report.d.ts +125 -0
- package/dist/lib/audit/compliance-report.d.ts.map +1 -0
- package/dist/lib/audit/compliance-report.js +205 -0
- package/dist/lib/audit/compliance-report.js.map +1 -0
- package/dist/lib/audit/compliance-report.test.d.ts +5 -0
- package/dist/lib/audit/compliance-report.test.d.ts.map +1 -0
- package/dist/lib/audit/compliance-report.test.js +290 -0
- package/dist/lib/audit/compliance-report.test.js.map +1 -0
- package/dist/lib/audit/retention-guard.d.ts +41 -0
- package/dist/lib/audit/retention-guard.d.ts.map +1 -0
- package/dist/lib/audit/retention-guard.js +103 -0
- package/dist/lib/audit/retention-guard.js.map +1 -0
- package/dist/lib/audit/retention-guard.test.d.ts +5 -0
- package/dist/lib/audit/retention-guard.test.d.ts.map +1 -0
- package/dist/lib/audit/retention-guard.test.js +109 -0
- package/dist/lib/audit/retention-guard.test.js.map +1 -0
- package/dist/lib/audit/skill-auditor-scoring.d.ts +69 -0
- package/dist/lib/audit/skill-auditor-scoring.d.ts.map +1 -0
- package/dist/lib/audit/skill-auditor-scoring.js +149 -0
- package/dist/lib/audit/skill-auditor-scoring.js.map +1 -0
- package/dist/lib/audit/skill-auditor-scoring.test.d.ts +2 -0
- package/dist/lib/audit/skill-auditor-scoring.test.d.ts.map +1 -0
- package/dist/lib/audit/skill-auditor-scoring.test.js +369 -0
- package/dist/lib/audit/skill-auditor-scoring.test.js.map +1 -0
- package/dist/lib/audit/verification-events.d.ts +119 -0
- package/dist/lib/audit/verification-events.d.ts.map +1 -0
- package/dist/lib/audit/verification-events.js +175 -0
- package/dist/lib/audit/verification-events.js.map +1 -0
- package/dist/lib/audit/verification-events.test.d.ts +5 -0
- package/dist/lib/audit/verification-events.test.d.ts.map +1 -0
- package/dist/lib/audit/verification-events.test.js +197 -0
- package/dist/lib/audit/verification-events.test.js.map +1 -0
- package/dist/lib/core/constants-models.d.ts +90 -0
- package/dist/lib/core/constants-models.d.ts.map +1 -0
- package/dist/lib/core/constants-models.js +208 -0
- package/dist/lib/core/constants-models.js.map +1 -0
- package/dist/lib/core/constants-otel.d.ts +68 -0
- package/dist/lib/core/constants-otel.d.ts.map +1 -0
- package/dist/lib/core/constants-otel.js +128 -0
- package/dist/lib/core/constants-otel.js.map +1 -0
- package/dist/lib/core/constants-symlink.test.d.ts.map +1 -0
- package/dist/lib/{constants-symlink.test.js → core/constants-symlink.test.js} +25 -24
- package/dist/lib/core/constants-symlink.test.js.map +1 -0
- package/dist/lib/core/constants-telemetry.d.ts +21 -0
- package/dist/lib/core/constants-telemetry.d.ts.map +1 -0
- package/dist/lib/core/constants-telemetry.js +162 -0
- package/dist/lib/core/constants-telemetry.js.map +1 -0
- package/dist/lib/core/constants.d.ts +152 -0
- package/dist/lib/core/constants.d.ts.map +1 -0
- package/dist/lib/core/constants.js +223 -0
- package/dist/lib/core/constants.js.map +1 -0
- package/dist/lib/core/constants.test.d.ts.map +1 -0
- package/dist/lib/{constants.test.js → core/constants.test.js} +198 -82
- package/dist/lib/core/constants.test.js.map +1 -0
- package/dist/lib/core/doc-sync.test.d.ts +9 -0
- package/dist/lib/core/doc-sync.test.d.ts.map +1 -0
- package/dist/lib/core/doc-sync.test.js +159 -0
- package/dist/lib/core/doc-sync.test.js.map +1 -0
- package/dist/lib/core/edge-cases.test.d.ts.map +1 -0
- package/dist/lib/{edge-cases.test.js → core/edge-cases.test.js} +76 -73
- package/dist/lib/core/edge-cases.test.js.map +1 -0
- package/dist/lib/{file-utils.d.ts → core/file-utils.d.ts} +63 -8
- package/dist/lib/core/file-utils.d.ts.map +1 -0
- package/dist/lib/{file-utils.js → core/file-utils.js} +186 -93
- package/dist/lib/core/file-utils.js.map +1 -0
- package/dist/lib/core/file-utils.test-constants.d.ts +38 -0
- package/dist/lib/core/file-utils.test-constants.d.ts.map +1 -0
- package/dist/lib/core/file-utils.test-constants.js +40 -0
- package/dist/lib/core/file-utils.test-constants.js.map +1 -0
- package/dist/lib/core/file-utils.test.d.ts.map +1 -0
- package/dist/lib/{file-utils.test.js → core/file-utils.test.js} +240 -214
- package/dist/lib/core/file-utils.test.js.map +1 -0
- package/dist/lib/{input-validator.d.ts → core/input-validator.d.ts} +30 -20
- package/dist/lib/core/input-validator.d.ts.map +1 -0
- package/dist/lib/core/input-validator.fuzz.test.d.ts.map +1 -0
- package/dist/lib/{input-validator.fuzz.test.js → core/input-validator.fuzz.test.js} +41 -29
- package/dist/lib/core/input-validator.fuzz.test.js.map +1 -0
- package/dist/lib/{input-validator.js → core/input-validator.js} +83 -39
- package/dist/lib/core/input-validator.js.map +1 -0
- package/dist/lib/core/input-validator.test.d.ts.map +1 -0
- package/dist/lib/{input-validator.test.js → core/input-validator.test.js} +95 -45
- package/dist/lib/core/input-validator.test.js.map +1 -0
- package/dist/lib/{logger.d.ts → core/logger.d.ts} +4 -18
- package/dist/lib/core/logger.d.ts.map +1 -0
- package/dist/lib/core/logger.js +104 -0
- package/dist/lib/core/logger.js.map +1 -0
- package/dist/lib/core/logger.test.d.ts.map +1 -0
- package/dist/lib/core/logger.test.js.map +1 -0
- package/dist/lib/core/schema-types.d.ts +37 -0
- package/dist/lib/core/schema-types.d.ts.map +1 -0
- package/dist/lib/core/schema-types.js +29 -0
- package/dist/lib/core/schema-types.js.map +1 -0
- package/dist/lib/{server-utils.d.ts → core/server-utils.d.ts} +11 -1
- package/dist/lib/core/server-utils.d.ts.map +1 -0
- package/dist/lib/{server-utils.js → core/server-utils.js} +25 -5
- package/dist/lib/core/server-utils.js.map +1 -0
- package/dist/lib/core/shared-schemas.d.ts +301 -0
- package/dist/lib/core/shared-schemas.d.ts.map +1 -0
- package/dist/lib/core/shared-schemas.js +222 -0
- package/dist/lib/core/shared-schemas.js.map +1 -0
- package/dist/lib/core/shared-schemas.test.d.ts.map +1 -0
- package/dist/lib/{shared-schemas.test.js → core/shared-schemas.test.js} +48 -18
- package/dist/lib/core/shared-schemas.test.js.map +1 -0
- package/dist/lib/core/units.d.ts +67 -0
- package/dist/lib/core/units.d.ts.map +1 -0
- package/dist/lib/core/units.js +88 -0
- package/dist/lib/core/units.js.map +1 -0
- package/dist/lib/cost/cost-estimation.d.ts +264 -0
- package/dist/lib/cost/cost-estimation.d.ts.map +1 -0
- package/dist/lib/cost/cost-estimation.js +541 -0
- package/dist/lib/cost/cost-estimation.js.map +1 -0
- package/dist/lib/cost/cost-estimation.test.d.ts +5 -0
- package/dist/lib/cost/cost-estimation.test.d.ts.map +1 -0
- package/dist/lib/cost/cost-estimation.test.js +701 -0
- package/dist/lib/cost/cost-estimation.test.js.map +1 -0
- package/dist/lib/cost/pricing-cache.d.ts +59 -0
- package/dist/lib/cost/pricing-cache.d.ts.map +1 -0
- package/dist/lib/cost/pricing-cache.js +120 -0
- package/dist/lib/cost/pricing-cache.js.map +1 -0
- package/dist/lib/cost/pricing-cache.test.d.ts +5 -0
- package/dist/lib/cost/pricing-cache.test.d.ts.map +1 -0
- package/dist/lib/cost/pricing-cache.test.js +176 -0
- package/dist/lib/cost/pricing-cache.test.js.map +1 -0
- package/dist/lib/dashboard-file-utils.d.ts +35 -0
- package/dist/lib/dashboard-file-utils.d.ts.map +1 -0
- package/dist/lib/dashboard-file-utils.js +94 -0
- package/dist/lib/dashboard-file-utils.js.map +1 -0
- package/dist/lib/{error-sanitizer.d.ts → errors/error-sanitizer.d.ts} +5 -0
- package/dist/lib/errors/error-sanitizer.d.ts.map +1 -0
- package/dist/lib/{error-sanitizer.js → errors/error-sanitizer.js} +8 -6
- package/dist/lib/errors/error-sanitizer.js.map +1 -0
- package/dist/lib/errors/error-sanitizer.test.d.ts.map +1 -0
- package/dist/lib/{error-sanitizer.test.js → errors/error-sanitizer.test.js} +17 -11
- package/dist/lib/errors/error-sanitizer.test.js.map +1 -0
- package/dist/lib/{error-types.d.ts → errors/error-types.d.ts} +5 -0
- package/dist/lib/errors/error-types.d.ts.map +1 -0
- package/dist/lib/{error-types.js → errors/error-types.js} +34 -1
- package/dist/lib/errors/error-types.js.map +1 -0
- package/dist/lib/errors/error-types.test.d.ts.map +1 -0
- package/dist/lib/{error-types.test.js → errors/error-types.test.js} +51 -1
- package/dist/lib/errors/error-types.test.js.map +1 -0
- package/dist/lib/errors/query-sanitizer.d.ts.map +1 -0
- package/dist/lib/{query-sanitizer.js → errors/query-sanitizer.js} +9 -1
- package/dist/lib/errors/query-sanitizer.js.map +1 -0
- package/dist/lib/errors/query-sanitizer.test.d.ts.map +1 -0
- package/dist/lib/{query-sanitizer.test.js → errors/query-sanitizer.test.js} +9 -6
- package/dist/lib/errors/query-sanitizer.test.js.map +1 -0
- package/dist/lib/exports/confident-export.d.ts +105 -0
- package/dist/lib/exports/confident-export.d.ts.map +1 -0
- package/dist/lib/exports/confident-export.js +385 -0
- package/dist/lib/exports/confident-export.js.map +1 -0
- package/dist/lib/exports/confident-export.test.d.ts +7 -0
- package/dist/lib/exports/confident-export.test.d.ts.map +1 -0
- package/dist/lib/exports/confident-export.test.js +848 -0
- package/dist/lib/exports/confident-export.test.js.map +1 -0
- package/dist/lib/exports/datadog-export.d.ts +200 -0
- package/dist/lib/exports/datadog-export.d.ts.map +1 -0
- package/dist/lib/exports/datadog-export.js +488 -0
- package/dist/lib/exports/datadog-export.js.map +1 -0
- package/dist/lib/exports/datadog-export.test.d.ts +2 -0
- package/dist/lib/exports/datadog-export.test.d.ts.map +1 -0
- package/dist/lib/exports/datadog-export.test.js +890 -0
- package/dist/lib/exports/datadog-export.test.js.map +1 -0
- package/dist/lib/exports/export-config-schemas.d.ts +67 -0
- package/dist/lib/exports/export-config-schemas.d.ts.map +1 -0
- package/dist/lib/exports/export-config-schemas.js +120 -0
- package/dist/lib/exports/export-config-schemas.js.map +1 -0
- package/dist/lib/exports/export-config-schemas.test.d.ts +8 -0
- package/dist/lib/exports/export-config-schemas.test.d.ts.map +1 -0
- package/dist/lib/exports/export-config-schemas.test.js +503 -0
- package/dist/lib/exports/export-config-schemas.test.js.map +1 -0
- package/dist/lib/exports/export-utils.d.ts +127 -0
- package/dist/lib/exports/export-utils.d.ts.map +1 -0
- package/dist/lib/exports/export-utils.js +303 -0
- package/dist/lib/exports/export-utils.js.map +1 -0
- package/dist/lib/exports/export-utils.test.d.ts +5 -0
- package/dist/lib/exports/export-utils.test.d.ts.map +1 -0
- package/dist/lib/exports/export-utils.test.js +344 -0
- package/dist/lib/exports/export-utils.test.js.map +1 -0
- package/dist/lib/exports/langfuse-export.d.ts +129 -0
- package/dist/lib/exports/langfuse-export.d.ts.map +1 -0
- package/dist/lib/exports/langfuse-export.js +370 -0
- package/dist/lib/exports/langfuse-export.js.map +1 -0
- package/dist/lib/exports/langfuse-export.test.d.ts +7 -0
- package/dist/lib/exports/langfuse-export.test.d.ts.map +1 -0
- package/dist/lib/exports/langfuse-export.test.js +1020 -0
- package/dist/lib/exports/langfuse-export.test.js.map +1 -0
- package/dist/lib/{otlp-export.d.ts → exports/otlp-export.d.ts} +3 -2
- package/dist/lib/exports/otlp-export.d.ts.map +1 -0
- package/dist/lib/{otlp-export.js → exports/otlp-export.js} +51 -36
- package/dist/lib/exports/otlp-export.js.map +1 -0
- package/dist/lib/exports/otlp-format-converter.d.ts +70 -0
- package/dist/lib/exports/otlp-format-converter.d.ts.map +1 -0
- package/dist/lib/exports/otlp-format-converter.js +401 -0
- package/dist/lib/exports/otlp-format-converter.js.map +1 -0
- package/dist/lib/exports/otlp-proto-encode.d.ts +53 -0
- package/dist/lib/exports/otlp-proto-encode.d.ts.map +1 -0
- package/dist/lib/exports/otlp-proto-encode.js +165 -0
- package/dist/lib/exports/otlp-proto-encode.js.map +1 -0
- package/dist/lib/exports/otlp-proto-encode.test.d.ts +7 -0
- package/dist/lib/exports/otlp-proto-encode.test.d.ts.map +1 -0
- package/dist/lib/exports/otlp-proto-encode.test.js +997 -0
- package/dist/lib/exports/otlp-proto-encode.test.js.map +1 -0
- package/dist/lib/exports/phoenix-export.d.ts +119 -0
- package/dist/lib/exports/phoenix-export.d.ts.map +1 -0
- package/dist/lib/exports/phoenix-export.js +448 -0
- package/dist/lib/exports/phoenix-export.js.map +1 -0
- package/dist/lib/exports/phoenix-export.test.d.ts +11 -0
- package/dist/lib/exports/phoenix-export.test.d.ts.map +1 -0
- package/dist/lib/exports/phoenix-export.test.js +816 -0
- package/dist/lib/exports/phoenix-export.test.js.map +1 -0
- package/dist/lib/index.d.ts +16 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +31 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/judge/evaluation-hooks-schemas.d.ts +186 -0
- package/dist/lib/judge/evaluation-hooks-schemas.d.ts.map +1 -0
- package/dist/lib/judge/evaluation-hooks-schemas.js +125 -0
- package/dist/lib/judge/evaluation-hooks-schemas.js.map +1 -0
- package/dist/lib/judge/evaluation-hooks.d.ts +88 -0
- package/dist/lib/judge/evaluation-hooks.d.ts.map +1 -0
- package/dist/lib/judge/evaluation-hooks.js +658 -0
- package/dist/lib/judge/evaluation-hooks.js.map +1 -0
- package/dist/lib/judge/evaluation-hooks.test.d.ts +8 -0
- package/dist/lib/judge/evaluation-hooks.test.d.ts.map +1 -0
- package/dist/lib/judge/evaluation-hooks.test.js +934 -0
- package/dist/lib/judge/evaluation-hooks.test.js.map +1 -0
- package/dist/lib/judge/llm-as-judge.d.ts +138 -0
- package/dist/lib/judge/llm-as-judge.d.ts.map +1 -0
- package/dist/lib/judge/llm-as-judge.js +103 -0
- package/dist/lib/judge/llm-as-judge.js.map +1 -0
- package/dist/lib/judge/llm-as-judge.test.d.ts +2 -0
- package/dist/lib/judge/llm-as-judge.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-as-judge.test.js +2179 -0
- package/dist/lib/judge/llm-as-judge.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-bias.d.ts +44 -0
- package/dist/lib/judge/llm-judge-bias.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-bias.js +130 -0
- package/dist/lib/judge/llm-judge-bias.js.map +1 -0
- package/dist/lib/judge/llm-judge-bias.test.d.ts +2 -0
- package/dist/lib/judge/llm-judge-bias.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-bias.test.js +380 -0
- package/dist/lib/judge/llm-judge-bias.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-code.d.ts +99 -0
- package/dist/lib/judge/llm-judge-code.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-code.js +261 -0
- package/dist/lib/judge/llm-judge-code.js.map +1 -0
- package/dist/lib/judge/llm-judge-code.test.d.ts +2 -0
- package/dist/lib/judge/llm-judge-code.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-code.test.js +981 -0
- package/dist/lib/judge/llm-judge-code.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-config.d.ts +241 -0
- package/dist/lib/judge/llm-judge-config.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-config.js +390 -0
- package/dist/lib/judge/llm-judge-config.js.map +1 -0
- package/dist/lib/judge/llm-judge-config.test.d.ts +5 -0
- package/dist/lib/judge/llm-judge-config.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-config.test.js +392 -0
- package/dist/lib/judge/llm-judge-config.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-constants.d.ts +111 -0
- package/dist/lib/judge/llm-judge-constants.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-constants.js +150 -0
- package/dist/lib/judge/llm-judge-constants.js.map +1 -0
- package/dist/lib/judge/llm-judge-dag.d.ts +57 -0
- package/dist/lib/judge/llm-judge-dag.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-dag.js +217 -0
- package/dist/lib/judge/llm-judge-dag.js.map +1 -0
- package/dist/lib/judge/llm-judge-dag.test.d.ts +8 -0
- package/dist/lib/judge/llm-judge-dag.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-dag.test.js +973 -0
- package/dist/lib/judge/llm-judge-dag.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-domain.d.ts +42 -0
- package/dist/lib/judge/llm-judge-domain.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-domain.js +167 -0
- package/dist/lib/judge/llm-judge-domain.js.map +1 -0
- package/dist/lib/judge/llm-judge-domain.test.d.ts +6 -0
- package/dist/lib/judge/llm-judge-domain.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-domain.test.js +337 -0
- package/dist/lib/judge/llm-judge-domain.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-geval.d.ts +42 -0
- package/dist/lib/judge/llm-judge-geval.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-geval.js +213 -0
- package/dist/lib/judge/llm-judge-geval.js.map +1 -0
- package/dist/lib/judge/llm-judge-geval.test.d.ts +2 -0
- package/dist/lib/judge/llm-judge-geval.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-geval.test.js +556 -0
- package/dist/lib/judge/llm-judge-geval.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-otel.test.d.ts +9 -0
- package/dist/lib/judge/llm-judge-otel.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-otel.test.js +91 -0
- package/dist/lib/judge/llm-judge-otel.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-qag.d.ts +38 -0
- package/dist/lib/judge/llm-judge-qag.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-qag.js +205 -0
- package/dist/lib/judge/llm-judge-qag.js.map +1 -0
- package/dist/lib/judge/llm-judge-qag.test.d.ts +2 -0
- package/dist/lib/judge/llm-judge-qag.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-qag.test.js +386 -0
- package/dist/lib/judge/llm-judge-qag.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-resilience.d.ts +74 -0
- package/dist/lib/judge/llm-judge-resilience.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-resilience.js +146 -0
- package/dist/lib/judge/llm-judge-resilience.js.map +1 -0
- package/dist/lib/judge/llm-judge-resilience.test.d.ts +2 -0
- package/dist/lib/judge/llm-judge-resilience.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-resilience.test.js +353 -0
- package/dist/lib/judge/llm-judge-resilience.test.js.map +1 -0
- package/dist/lib/judge/llm-judge-security.d.ts +106 -0
- package/dist/lib/judge/llm-judge-security.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-security.js +314 -0
- package/dist/lib/judge/llm-judge-security.js.map +1 -0
- package/dist/lib/judge/llm-judge-security.test.d.ts +2 -0
- package/dist/lib/judge/llm-judge-security.test.d.ts.map +1 -0
- package/dist/lib/judge/llm-judge-security.test.js +1011 -0
- package/dist/lib/judge/llm-judge-security.test.js.map +1 -0
- package/dist/lib/observability/context-accumulator.d.ts +32 -0
- package/dist/lib/observability/context-accumulator.d.ts.map +1 -0
- package/dist/lib/observability/context-accumulator.js +87 -0
- package/dist/lib/observability/context-accumulator.js.map +1 -0
- package/dist/lib/observability/evaluation-events.d.ts +35 -0
- package/dist/lib/observability/evaluation-events.d.ts.map +1 -0
- package/dist/lib/observability/evaluation-events.js +90 -0
- package/dist/lib/observability/evaluation-events.js.map +1 -0
- package/dist/lib/observability/file-span-exporter.d.ts +17 -0
- package/dist/lib/observability/file-span-exporter.d.ts.map +1 -0
- package/dist/lib/observability/file-span-exporter.js +49 -0
- package/dist/lib/observability/file-span-exporter.js.map +1 -0
- package/dist/lib/observability/histogram-bucket-constants.d.ts +25 -0
- package/dist/lib/observability/histogram-bucket-constants.d.ts.map +1 -0
- package/dist/lib/observability/histogram-bucket-constants.js +60 -0
- package/dist/lib/observability/histogram-bucket-constants.js.map +1 -0
- package/dist/lib/observability/histogram.d.ts +112 -0
- package/dist/lib/observability/histogram.d.ts.map +1 -0
- package/dist/lib/observability/histogram.js +170 -0
- package/dist/lib/observability/histogram.js.map +1 -0
- package/dist/lib/observability/histogram.test.d.ts +5 -0
- package/dist/lib/observability/histogram.test.d.ts.map +1 -0
- package/dist/lib/observability/histogram.test.js +385 -0
- package/dist/lib/observability/histogram.test.js.map +1 -0
- package/dist/lib/observability/indexer.d.ts +114 -0
- package/dist/lib/observability/indexer.d.ts.map +1 -0
- package/dist/lib/{indexer.js → observability/indexer.js} +65 -16
- package/dist/lib/observability/indexer.js.map +1 -0
- package/dist/lib/observability/indexer.test.d.ts.map +1 -0
- package/dist/lib/{indexer.test.js → observability/indexer.test.js} +94 -77
- package/dist/lib/observability/indexer.test.js.map +1 -0
- package/dist/lib/observability/instrumentation-eval.test.d.ts +5 -0
- package/dist/lib/observability/instrumentation-eval.test.d.ts.map +1 -0
- package/dist/lib/observability/instrumentation-eval.test.js +63 -0
- package/dist/lib/observability/instrumentation-eval.test.js.map +1 -0
- package/dist/lib/observability/instrumentation-init-errors.test.d.ts +13 -0
- package/dist/lib/observability/instrumentation-init-errors.test.d.ts.map +1 -0
- package/dist/lib/observability/instrumentation-init-errors.test.js +194 -0
- package/dist/lib/observability/instrumentation-init-errors.test.js.map +1 -0
- package/dist/lib/observability/instrumentation-retry-timeout.test.d.ts +15 -0
- package/dist/lib/observability/instrumentation-retry-timeout.test.d.ts.map +1 -0
- package/dist/lib/observability/instrumentation-retry-timeout.test.js +188 -0
- package/dist/lib/observability/instrumentation-retry-timeout.test.js.map +1 -0
- package/dist/lib/observability/instrumentation-set-otel.test.d.ts +5 -0
- package/dist/lib/observability/instrumentation-set-otel.test.d.ts.map +1 -0
- package/dist/lib/observability/instrumentation-set-otel.test.js +59 -0
- package/dist/lib/observability/instrumentation-set-otel.test.js.map +1 -0
- package/dist/lib/observability/instrumentation.d.ts +158 -0
- package/dist/lib/observability/instrumentation.d.ts.map +1 -0
- package/dist/lib/observability/instrumentation.integration.test.d.ts +2 -0
- package/dist/lib/observability/instrumentation.integration.test.d.ts.map +1 -0
- package/dist/lib/observability/instrumentation.integration.test.js +590 -0
- package/dist/lib/observability/instrumentation.integration.test.js.map +1 -0
- package/dist/lib/observability/instrumentation.js +512 -0
- package/dist/lib/observability/instrumentation.js.map +1 -0
- package/dist/lib/observability/instrumentation.test.d.ts +2 -0
- package/dist/lib/observability/instrumentation.test.d.ts.map +1 -0
- package/dist/lib/observability/instrumentation.test.js +822 -0
- package/dist/lib/observability/instrumentation.test.js.map +1 -0
- package/dist/lib/observability/mcp-semconv-constants.d.ts +98 -0
- package/dist/lib/observability/mcp-semconv-constants.d.ts.map +1 -0
- package/dist/lib/observability/mcp-semconv-constants.js +102 -0
- package/dist/lib/observability/mcp-semconv-constants.js.map +1 -0
- package/dist/lib/observability/mcp-semconv.d.ts +37 -0
- package/dist/lib/observability/mcp-semconv.d.ts.map +1 -0
- package/dist/lib/observability/mcp-semconv.js +87 -0
- package/dist/lib/observability/mcp-semconv.js.map +1 -0
- package/dist/lib/observability/mcp-semconv.test.d.ts +2 -0
- package/dist/lib/observability/mcp-semconv.test.d.ts.map +1 -0
- package/dist/lib/observability/mcp-semconv.test.js +168 -0
- package/dist/lib/observability/mcp-semconv.test.js.map +1 -0
- package/dist/lib/observability/metrics.d.ts +100 -0
- package/dist/lib/observability/metrics.d.ts.map +1 -0
- package/dist/lib/observability/metrics.js +429 -0
- package/dist/lib/observability/metrics.js.map +1 -0
- package/dist/lib/observability/metrics.test.d.ts +5 -0
- package/dist/lib/observability/metrics.test.d.ts.map +1 -0
- package/dist/lib/observability/metrics.test.js +191 -0
- package/dist/lib/observability/metrics.test.js.map +1 -0
- package/dist/lib/observability/observability-test-constants.d.ts +34 -0
- package/dist/lib/observability/observability-test-constants.d.ts.map +1 -0
- package/dist/lib/observability/observability-test-constants.js +55 -0
- package/dist/lib/observability/observability-test-constants.js.map +1 -0
- package/dist/lib/observability/opentelemetry-resources.test.d.ts +2 -0
- package/dist/lib/observability/opentelemetry-resources.test.d.ts.map +1 -0
- package/dist/lib/observability/opentelemetry-resources.test.js +19 -0
- package/dist/lib/observability/opentelemetry-resources.test.js.map +1 -0
- package/dist/lib/observability/parse-stats.d.ts +119 -0
- package/dist/lib/observability/parse-stats.d.ts.map +1 -0
- package/dist/lib/observability/parse-stats.js +207 -0
- package/dist/lib/observability/parse-stats.js.map +1 -0
- package/dist/lib/observability/parse-stats.test.d.ts +5 -0
- package/dist/lib/observability/parse-stats.test.d.ts.map +1 -0
- package/dist/lib/observability/parse-stats.test.js +287 -0
- package/dist/lib/observability/parse-stats.test.js.map +1 -0
- package/dist/lib/observability/render-trace-tree.d.ts +31 -0
- package/dist/lib/observability/render-trace-tree.d.ts.map +1 -0
- package/dist/lib/observability/render-trace-tree.js +95 -0
- package/dist/lib/observability/render-trace-tree.js.map +1 -0
- package/dist/lib/observability/render-trace-tree.test.d.ts +5 -0
- package/dist/lib/observability/render-trace-tree.test.d.ts.map +1 -0
- package/dist/lib/observability/render-trace-tree.test.js +97 -0
- package/dist/lib/observability/render-trace-tree.test.js.map +1 -0
- package/dist/lib/observability/span-attributes.d.ts +27 -0
- package/dist/lib/observability/span-attributes.d.ts.map +1 -0
- package/dist/lib/observability/span-attributes.js +85 -0
- package/dist/lib/observability/span-attributes.js.map +1 -0
- package/dist/lib/observability/trace-anomaly-detector.d.ts +23 -0
- package/dist/lib/observability/trace-anomaly-detector.d.ts.map +1 -0
- package/dist/lib/observability/trace-anomaly-detector.js +211 -0
- package/dist/lib/observability/trace-anomaly-detector.js.map +1 -0
- package/dist/lib/observability/trace-anomaly-detector.test.d.ts +5 -0
- package/dist/lib/observability/trace-anomaly-detector.test.d.ts.map +1 -0
- package/dist/lib/observability/trace-anomaly-detector.test.js +224 -0
- package/dist/lib/observability/trace-anomaly-detector.test.js.map +1 -0
- package/dist/lib/observability/trace-anomaly-schemas.d.ts +189 -0
- package/dist/lib/observability/trace-anomaly-schemas.d.ts.map +1 -0
- package/dist/lib/observability/trace-anomaly-schemas.js +167 -0
- package/dist/lib/observability/trace-anomaly-schemas.js.map +1 -0
- package/dist/lib/privacy/content-redaction.d.ts +141 -0
- package/dist/lib/privacy/content-redaction.d.ts.map +1 -0
- package/dist/lib/privacy/content-redaction.js +210 -0
- package/dist/lib/privacy/content-redaction.js.map +1 -0
- package/dist/lib/privacy/content-redaction.test.d.ts +2 -0
- package/dist/lib/privacy/content-redaction.test.d.ts.map +1 -0
- package/dist/lib/privacy/content-redaction.test.js +302 -0
- package/dist/lib/privacy/content-redaction.test.js.map +1 -0
- package/dist/lib/quality/bucket-utils.d.ts +17 -0
- package/dist/lib/quality/bucket-utils.d.ts.map +1 -0
- package/dist/lib/quality/bucket-utils.js +31 -0
- package/dist/lib/quality/bucket-utils.js.map +1 -0
- package/dist/lib/quality/bucket-utils.test.d.ts +2 -0
- package/dist/lib/quality/bucket-utils.test.d.ts.map +1 -0
- package/dist/lib/quality/bucket-utils.test.js +42 -0
- package/dist/lib/quality/bucket-utils.test.js.map +1 -0
- package/dist/lib/quality/qfe-backtest-detail.test.d.ts +5 -0
- package/dist/lib/quality/qfe-backtest-detail.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-backtest-detail.test.js +179 -0
- package/dist/lib/quality/qfe-backtest-detail.test.js.map +1 -0
- package/dist/lib/quality/qfe-calibration-paths.test.d.ts +5 -0
- package/dist/lib/quality/qfe-calibration-paths.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-calibration-paths.test.js +203 -0
- package/dist/lib/quality/qfe-calibration-paths.test.js.map +1 -0
- package/dist/lib/quality/qfe-correlation-helpers.test.d.ts +6 -0
- package/dist/lib/quality/qfe-correlation-helpers.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-correlation-helpers.test.js +143 -0
- package/dist/lib/quality/qfe-correlation-helpers.test.js.map +1 -0
- package/dist/lib/quality/qfe-cqi-paths.test.d.ts +6 -0
- package/dist/lib/quality/qfe-cqi-paths.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-cqi-paths.test.js +231 -0
- package/dist/lib/quality/qfe-cqi-paths.test.js.map +1 -0
- package/dist/lib/quality/qfe-critic-internals.test.d.ts +6 -0
- package/dist/lib/quality/qfe-critic-internals.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-critic-internals.test.js +191 -0
- package/dist/lib/quality/qfe-critic-internals.test.js.map +1 -0
- package/dist/lib/quality/qfe-derived-paths.test.d.ts +2 -0
- package/dist/lib/quality/qfe-derived-paths.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-derived-paths.test.js +372 -0
- package/dist/lib/quality/qfe-derived-paths.test.js.map +1 -0
- package/dist/lib/quality/qfe-dynamics-paths.test.d.ts +8 -0
- package/dist/lib/quality/qfe-dynamics-paths.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-dynamics-paths.test.js +223 -0
- package/dist/lib/quality/qfe-dynamics-paths.test.js.map +1 -0
- package/dist/lib/quality/qfe-granger-internals.test.d.ts +6 -0
- package/dist/lib/quality/qfe-granger-internals.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-granger-internals.test.js +158 -0
- package/dist/lib/quality/qfe-granger-internals.test.js.map +1 -0
- package/dist/lib/quality/qfe-label-normalize.test.d.ts +7 -0
- package/dist/lib/quality/qfe-label-normalize.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-label-normalize.test.js +332 -0
- package/dist/lib/quality/qfe-label-normalize.test.js.map +1 -0
- package/dist/lib/quality/qfe-ordinal-edge.test.d.ts +6 -0
- package/dist/lib/quality/qfe-ordinal-edge.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-ordinal-edge.test.js +98 -0
- package/dist/lib/quality/qfe-ordinal-edge.test.js.map +1 -0
- package/dist/lib/quality/qfe-roles-detail.test.d.ts +5 -0
- package/dist/lib/quality/qfe-roles-detail.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-roles-detail.test.js +115 -0
- package/dist/lib/quality/qfe-roles-detail.test.js.map +1 -0
- package/dist/lib/quality/qfe-rolling-detail.test.d.ts +7 -0
- package/dist/lib/quality/qfe-rolling-detail.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-rolling-detail.test.js +249 -0
- package/dist/lib/quality/qfe-rolling-detail.test.js.map +1 -0
- package/dist/lib/quality/qfe-stats-internals.test.d.ts +7 -0
- package/dist/lib/quality/qfe-stats-internals.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-stats-internals.test.js +143 -0
- package/dist/lib/quality/qfe-stats-internals.test.js.map +1 -0
- package/dist/lib/quality/qfe-streaming.test.d.ts +5 -0
- package/dist/lib/quality/qfe-streaming.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-streaming.test.js +239 -0
- package/dist/lib/quality/qfe-streaming.test.js.map +1 -0
- package/dist/lib/quality/qfe-sweep-detail.test.d.ts +6 -0
- package/dist/lib/quality/qfe-sweep-detail.test.d.ts.map +1 -0
- package/dist/lib/quality/qfe-sweep-detail.test.js +291 -0
- package/dist/lib/quality/qfe-sweep-detail.test.js.map +1 -0
- package/dist/lib/quality/quality-alerts.d.ts +23 -0
- package/dist/lib/quality/quality-alerts.d.ts.map +1 -0
- package/dist/lib/quality/quality-alerts.js +89 -0
- package/dist/lib/quality/quality-alerts.js.map +1 -0
- package/dist/lib/quality/quality-alerts.test.d.ts +2 -0
- package/dist/lib/quality/quality-alerts.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-alerts.test.js +86 -0
- package/dist/lib/quality/quality-alerts.test.js.map +1 -0
- package/dist/lib/quality/quality-constants.d.ts +294 -0
- package/dist/lib/quality/quality-constants.d.ts.map +1 -0
- package/dist/lib/quality/quality-constants.js +335 -0
- package/dist/lib/quality/quality-constants.js.map +1 -0
- package/dist/lib/quality/quality-feature-engineering.d.ts +1071 -0
- package/dist/lib/quality/quality-feature-engineering.d.ts.map +1 -0
- package/dist/lib/quality/quality-feature-engineering.js +2076 -0
- package/dist/lib/quality/quality-feature-engineering.js.map +1 -0
- package/dist/lib/quality/quality-feature-engineering.test.d.ts +5 -0
- package/dist/lib/quality/quality-feature-engineering.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-feature-engineering.test.js +2908 -0
- package/dist/lib/quality/quality-feature-engineering.test.js.map +1 -0
- package/dist/lib/quality/quality-metrics.d.ts +943 -0
- package/dist/lib/quality/quality-metrics.d.ts.map +1 -0
- package/dist/lib/quality/quality-metrics.js +1151 -0
- package/dist/lib/quality/quality-metrics.js.map +1 -0
- package/dist/lib/quality/quality-metrics.test.d.ts +5 -0
- package/dist/lib/quality/quality-metrics.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-metrics.test.js +2766 -0
- package/dist/lib/quality/quality-metrics.test.js.map +1 -0
- package/dist/lib/quality/quality-multi-agent.d.ts +106 -0
- package/dist/lib/quality/quality-multi-agent.d.ts.map +1 -0
- package/dist/lib/quality/quality-multi-agent.js +124 -0
- package/dist/lib/quality/quality-multi-agent.js.map +1 -0
- package/dist/lib/quality/quality-multi-agent.test.d.ts +6 -0
- package/dist/lib/quality/quality-multi-agent.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-multi-agent.test.js +163 -0
- package/dist/lib/quality/quality-multi-agent.test.js.map +1 -0
- package/dist/lib/quality/quality-sla.d.ts +35 -0
- package/dist/lib/quality/quality-sla.d.ts.map +1 -0
- package/dist/lib/quality/quality-sla.js +62 -0
- package/dist/lib/quality/quality-sla.js.map +1 -0
- package/dist/lib/quality/quality-sla.test.d.ts +5 -0
- package/dist/lib/quality/quality-sla.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-sla.test.js +144 -0
- package/dist/lib/quality/quality-sla.test.js.map +1 -0
- package/dist/lib/quality/quality-test-constants.d.ts +23 -0
- package/dist/lib/quality/quality-test-constants.d.ts.map +1 -0
- package/dist/lib/quality/quality-test-constants.js +25 -0
- package/dist/lib/quality/quality-test-constants.js.map +1 -0
- package/dist/lib/quality/quality-trends.d.ts +101 -0
- package/dist/lib/quality/quality-trends.d.ts.map +1 -0
- package/dist/lib/quality/quality-trends.js +299 -0
- package/dist/lib/quality/quality-trends.js.map +1 -0
- package/dist/lib/quality/quality-trends.test.d.ts +6 -0
- package/dist/lib/quality/quality-trends.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-trends.test.js +377 -0
- package/dist/lib/quality/quality-trends.test.js.map +1 -0
- package/dist/lib/quality/quality-views.d.ts +966 -0
- package/dist/lib/quality/quality-views.d.ts.map +1 -0
- package/dist/lib/quality/quality-views.js +367 -0
- package/dist/lib/quality/quality-views.js.map +1 -0
- package/dist/lib/quality/quality-views.test.d.ts +6 -0
- package/dist/lib/quality/quality-views.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-views.test.js +262 -0
- package/dist/lib/quality/quality-views.test.js.map +1 -0
- package/dist/lib/quality/quality-visualization.d.ts +112 -0
- package/dist/lib/quality/quality-visualization.d.ts.map +1 -0
- package/dist/lib/quality/quality-visualization.js +136 -0
- package/dist/lib/quality/quality-visualization.js.map +1 -0
- package/dist/lib/quality/quality-visualization.test.d.ts +5 -0
- package/dist/lib/quality/quality-visualization.test.d.ts.map +1 -0
- package/dist/lib/quality/quality-visualization.test.js +189 -0
- package/dist/lib/quality/quality-visualization.test.js.map +1 -0
- package/dist/lib/resilience/cache.d.ts +56 -0
- package/dist/lib/resilience/cache.d.ts.map +1 -0
- package/dist/lib/resilience/cache.js +96 -0
- package/dist/lib/resilience/cache.js.map +1 -0
- package/dist/lib/resilience/cache.test.d.ts.map +1 -0
- package/dist/lib/{cache.test.js → resilience/cache.test.js} +21 -20
- package/dist/lib/resilience/cache.test.js.map +1 -0
- package/dist/lib/resilience/circuit-breaker.d.ts +147 -0
- package/dist/lib/resilience/circuit-breaker.d.ts.map +1 -0
- package/dist/lib/resilience/circuit-breaker.js +251 -0
- package/dist/lib/resilience/circuit-breaker.js.map +1 -0
- package/dist/lib/resilience/circuit-breaker.test.d.ts.map +1 -0
- package/dist/lib/{circuit-breaker.test.js → resilience/circuit-breaker.test.js} +29 -26
- package/dist/lib/resilience/circuit-breaker.test.js.map +1 -0
- package/dist/lib/{toon-encoder.d.ts → resilience/toon-encoder.d.ts} +6 -1
- package/dist/lib/resilience/toon-encoder.d.ts.map +1 -0
- package/dist/lib/{toon-encoder.js → resilience/toon-encoder.js} +7 -2
- package/dist/lib/resilience/toon-encoder.js.map +1 -0
- package/dist/lib/resilience/toon-encoder.test.d.ts.map +1 -0
- package/dist/lib/{toon-encoder.test.js → resilience/toon-encoder.test.js} +7 -6
- package/dist/lib/resilience/toon-encoder.test.js.map +1 -0
- package/dist/lib/testing/mock-llm-builder.d.ts +139 -0
- package/dist/lib/testing/mock-llm-builder.d.ts.map +1 -0
- package/dist/lib/testing/mock-llm-builder.js +254 -0
- package/dist/lib/testing/mock-llm-builder.js.map +1 -0
- package/dist/lib/testing/mock-llm-builder.test.d.ts +5 -0
- package/dist/lib/testing/mock-llm-builder.test.d.ts.map +1 -0
- package/dist/lib/testing/mock-llm-builder.test.js +304 -0
- package/dist/lib/testing/mock-llm-builder.test.js.map +1 -0
- package/dist/lib/validation/api-schemas.d.ts +705 -0
- package/dist/lib/validation/api-schemas.d.ts.map +1 -0
- package/dist/lib/validation/api-schemas.js +351 -0
- package/dist/lib/validation/api-schemas.js.map +1 -0
- package/dist/lib/validation/api-schemas.test.d.ts +5 -0
- package/dist/lib/validation/api-schemas.test.d.ts.map +1 -0
- package/dist/lib/validation/api-schemas.test.js +427 -0
- package/dist/lib/validation/api-schemas.test.js.map +1 -0
- package/dist/lib/validation/dashboard-schemas.d.ts +203 -0
- package/dist/lib/validation/dashboard-schemas.d.ts.map +1 -0
- package/dist/lib/validation/dashboard-schemas.js +186 -0
- package/dist/lib/validation/dashboard-schemas.js.map +1 -0
- package/dist/lib/validation/dashboard-schemas.test.d.ts +5 -0
- package/dist/lib/validation/dashboard-schemas.test.d.ts.map +1 -0
- package/dist/lib/validation/dashboard-schemas.test.js +353 -0
- package/dist/lib/validation/dashboard-schemas.test.js.map +1 -0
- package/dist/server.d.ts +7 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +172 -102
- package/dist/server.js.map +1 -1
- package/dist/server.test.js +102 -95
- package/dist/server.test.js.map +1 -1
- package/dist/test-helpers/assertions.d.ts +6 -0
- package/dist/test-helpers/assertions.d.ts.map +1 -0
- package/dist/test-helpers/assertions.js +11 -0
- package/dist/test-helpers/assertions.js.map +1 -0
- package/dist/test-helpers/env-utils.d.ts +0 -64
- package/dist/test-helpers/env-utils.d.ts.map +1 -1
- package/dist/test-helpers/env-utils.js +0 -100
- package/dist/test-helpers/env-utils.js.map +1 -1
- package/dist/test-helpers/fuzz-generators.d.ts.map +1 -1
- package/dist/test-helpers/fuzz-generators.js +62 -22
- package/dist/test-helpers/fuzz-generators.js.map +1 -1
- package/dist/test-helpers/index.d.ts +3 -2
- package/dist/test-helpers/index.d.ts.map +1 -1
- package/dist/test-helpers/index.js +4 -2
- package/dist/test-helpers/index.js.map +1 -1
- package/dist/test-helpers/memfs-utils.test.js +81 -76
- package/dist/test-helpers/memfs-utils.test.js.map +1 -1
- package/dist/test-helpers/mock-backends.d.ts +19 -17
- package/dist/test-helpers/mock-backends.d.ts.map +1 -1
- package/dist/test-helpers/mock-backends.js +16 -4
- package/dist/test-helpers/mock-backends.js.map +1 -1
- package/dist/test-helpers/mock-backends.test.js +43 -112
- package/dist/test-helpers/mock-backends.test.js.map +1 -1
- package/dist/test-helpers/race-condition-helpers.d.ts.map +1 -1
- package/dist/test-helpers/race-condition-helpers.js +3 -2
- package/dist/test-helpers/race-condition-helpers.js.map +1 -1
- package/dist/test-helpers/schema-validators.d.ts +2 -2
- package/dist/test-helpers/schema-validators.d.ts.map +1 -1
- package/dist/test-helpers/schema-validators.js +35 -31
- package/dist/test-helpers/schema-validators.js.map +1 -1
- package/dist/test-helpers/test-constants.d.ts +74 -0
- package/dist/test-helpers/test-constants.d.ts.map +1 -0
- package/dist/test-helpers/test-constants.js +78 -0
- package/dist/test-helpers/test-constants.js.map +1 -0
- package/dist/test-helpers/test-data-builders.d.ts +25 -7
- package/dist/test-helpers/test-data-builders.d.ts.map +1 -1
- package/dist/test-helpers/test-data-builders.js +32 -9
- package/dist/test-helpers/test-data-builders.js.map +1 -1
- package/dist/test-helpers/test-data-builders.test.js +116 -107
- package/dist/test-helpers/test-data-builders.test.js.map +1 -1
- package/dist/test-helpers/tool-validators.d.ts +1 -1
- package/dist/test-helpers/tool-validators.d.ts.map +1 -1
- package/dist/test-helpers/tool-validators.js +10 -10
- package/dist/test-helpers/tool-validators.js.map +1 -1
- package/dist/tools/audit-trail.d.ts +170 -0
- package/dist/tools/audit-trail.d.ts.map +1 -0
- package/dist/tools/audit-trail.js +109 -0
- package/dist/tools/audit-trail.js.map +1 -0
- package/dist/tools/audit-trail.test.d.ts +5 -0
- package/dist/tools/audit-trail.test.d.ts.map +1 -0
- package/dist/tools/audit-trail.test.js +122 -0
- package/dist/tools/audit-trail.test.js.map +1 -0
- package/dist/tools/context-stats.d.ts +6 -20
- package/dist/tools/context-stats.d.ts.map +1 -1
- package/dist/tools/context-stats.js +106 -90
- package/dist/tools/context-stats.js.map +1 -1
- package/dist/tools/context-stats.test.js +109 -60
- package/dist/tools/context-stats.test.js.map +1 -1
- package/dist/tools/detect-trace-anomalies.d.ts +123 -0
- package/dist/tools/detect-trace-anomalies.d.ts.map +1 -0
- package/dist/tools/detect-trace-anomalies.js +66 -0
- package/dist/tools/detect-trace-anomalies.js.map +1 -0
- package/dist/tools/estimate-cost.d.ts +77 -0
- package/dist/tools/estimate-cost.d.ts.map +1 -0
- package/dist/tools/estimate-cost.js +104 -0
- package/dist/tools/estimate-cost.js.map +1 -0
- package/dist/tools/estimate-cost.test.d.ts +5 -0
- package/dist/tools/estimate-cost.test.d.ts.map +1 -0
- package/dist/tools/estimate-cost.test.js +343 -0
- package/dist/tools/estimate-cost.test.js.map +1 -0
- package/dist/tools/export-base.d.ts +77 -0
- package/dist/tools/export-base.d.ts.map +1 -0
- package/dist/tools/export-base.js +150 -0
- package/dist/tools/export-base.js.map +1 -0
- package/dist/tools/export-base.test.d.ts +18 -0
- package/dist/tools/export-base.test.d.ts.map +1 -0
- package/dist/tools/export-base.test.js +220 -0
- package/dist/tools/export-base.test.js.map +1 -0
- package/dist/tools/export-confident.d.ts +149 -0
- package/dist/tools/export-confident.d.ts.map +1 -0
- package/dist/tools/export-confident.js +36 -0
- package/dist/tools/export-confident.js.map +1 -0
- package/dist/tools/export-confident.test.d.ts +7 -0
- package/dist/tools/export-confident.test.d.ts.map +1 -0
- package/dist/tools/export-confident.test.js +336 -0
- package/dist/tools/export-confident.test.js.map +1 -0
- package/dist/tools/export-datadog.d.ts +121 -0
- package/dist/tools/export-datadog.d.ts.map +1 -0
- package/dist/tools/export-datadog.js +158 -0
- package/dist/tools/export-datadog.js.map +1 -0
- package/dist/tools/export-datadog.test.d.ts +8 -0
- package/dist/tools/export-datadog.test.d.ts.map +1 -0
- package/dist/tools/export-datadog.test.js +376 -0
- package/dist/tools/export-datadog.test.js.map +1 -0
- package/dist/tools/export-jaeger.d.ts +100 -0
- package/dist/tools/export-jaeger.d.ts.map +1 -0
- package/dist/tools/export-jaeger.js +154 -0
- package/dist/tools/export-jaeger.js.map +1 -0
- package/dist/tools/export-jaeger.test.d.ts +2 -0
- package/dist/tools/export-jaeger.test.d.ts.map +1 -0
- package/dist/tools/export-jaeger.test.js +113 -0
- package/dist/tools/export-jaeger.test.js.map +1 -0
- package/dist/tools/export-langfuse.d.ts +135 -0
- package/dist/tools/export-langfuse.d.ts.map +1 -0
- package/dist/tools/export-langfuse.js +33 -0
- package/dist/tools/export-langfuse.js.map +1 -0
- package/dist/tools/export-langfuse.test.d.ts +7 -0
- package/dist/tools/export-langfuse.test.d.ts.map +1 -0
- package/dist/tools/export-langfuse.test.js +292 -0
- package/dist/tools/export-langfuse.test.js.map +1 -0
- package/dist/tools/export-phoenix.d.ts +170 -0
- package/dist/tools/export-phoenix.d.ts.map +1 -0
- package/dist/tools/export-phoenix.js +47 -0
- package/dist/tools/export-phoenix.js.map +1 -0
- package/dist/tools/export-phoenix.test.d.ts +7 -0
- package/dist/tools/export-phoenix.test.d.ts.map +1 -0
- package/dist/tools/export-phoenix.test.js +317 -0
- package/dist/tools/export-phoenix.test.js.map +1 -0
- package/dist/tools/get-trace-url.d.ts +2 -10
- package/dist/tools/get-trace-url.d.ts.map +1 -1
- package/dist/tools/get-trace-url.js +5 -8
- package/dist/tools/get-trace-url.js.map +1 -1
- package/dist/tools/get-trace-url.test.js +81 -399
- package/dist/tools/get-trace-url.test.js.map +1 -1
- package/dist/tools/hallucination-detection.d.ts +203 -0
- package/dist/tools/hallucination-detection.d.ts.map +1 -0
- package/dist/tools/hallucination-detection.js +189 -0
- package/dist/tools/hallucination-detection.js.map +1 -0
- package/dist/tools/hallucination-detection.test.d.ts +5 -0
- package/dist/tools/hallucination-detection.test.d.ts.map +1 -0
- package/dist/tools/hallucination-detection.test.js +529 -0
- package/dist/tools/hallucination-detection.test.js.map +1 -0
- package/dist/tools/health-check.d.ts +35 -16
- package/dist/tools/health-check.d.ts.map +1 -1
- package/dist/tools/health-check.js +101 -85
- package/dist/tools/health-check.js.map +1 -1
- package/dist/tools/health-check.test.js +72 -165
- package/dist/tools/health-check.test.js.map +1 -1
- package/dist/tools/index.d.ts +19 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +19 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/ingest-constants.d.ts +8 -0
- package/dist/tools/ingest-constants.d.ts.map +1 -0
- package/dist/tools/ingest-constants.js +8 -0
- package/dist/tools/ingest-constants.js.map +1 -0
- package/dist/tools/ingest-spans.d.ts +45 -0
- package/dist/tools/ingest-spans.d.ts.map +1 -0
- package/dist/tools/ingest-spans.js +129 -0
- package/dist/tools/ingest-spans.js.map +1 -0
- package/dist/tools/ingest-spans.test.d.ts +5 -0
- package/dist/tools/ingest-spans.test.d.ts.map +1 -0
- package/dist/tools/ingest-spans.test.js +250 -0
- package/dist/tools/ingest-spans.test.js.map +1 -0
- package/dist/tools/ingest-traces.d.ts +76 -0
- package/dist/tools/ingest-traces.d.ts.map +1 -0
- package/dist/tools/ingest-traces.js +164 -0
- package/dist/tools/ingest-traces.js.map +1 -0
- package/dist/tools/ingest-traces.test.d.ts +5 -0
- package/dist/tools/ingest-traces.test.d.ts.map +1 -0
- package/dist/tools/ingest-traces.test.js +483 -0
- package/dist/tools/ingest-traces.test.js.map +1 -0
- package/dist/tools/inject-evaluations.d.ts +254 -0
- package/dist/tools/inject-evaluations.d.ts.map +1 -0
- package/dist/tools/inject-evaluations.js +133 -0
- package/dist/tools/inject-evaluations.js.map +1 -0
- package/dist/tools/inject-evaluations.test.d.ts +5 -0
- package/dist/tools/inject-evaluations.test.d.ts.map +1 -0
- package/dist/tools/inject-evaluations.test.js +371 -0
- package/dist/tools/inject-evaluations.test.js.map +1 -0
- package/dist/tools/manage-datasets.d.ts +850 -0
- package/dist/tools/manage-datasets.d.ts.map +1 -0
- package/dist/tools/manage-datasets.js +139 -0
- package/dist/tools/manage-datasets.js.map +1 -0
- package/dist/tools/manage-datasets.test.d.ts +5 -0
- package/dist/tools/manage-datasets.test.d.ts.map +1 -0
- package/dist/tools/manage-datasets.test.js +430 -0
- package/dist/tools/manage-datasets.test.js.map +1 -0
- package/dist/tools/multi-agent-coordination.d.ts +178 -0
- package/dist/tools/multi-agent-coordination.d.ts.map +1 -0
- package/dist/tools/multi-agent-coordination.js +270 -0
- package/dist/tools/multi-agent-coordination.js.map +1 -0
- package/dist/tools/multi-agent-coordination.test.d.ts +5 -0
- package/dist/tools/multi-agent-coordination.test.d.ts.map +1 -0
- package/dist/tools/multi-agent-coordination.test.js +530 -0
- package/dist/tools/multi-agent-coordination.test.js.map +1 -0
- package/dist/tools/query-evaluations.d.ts +154 -91
- package/dist/tools/query-evaluations.d.ts.map +1 -1
- package/dist/tools/query-evaluations.js +206 -169
- package/dist/tools/query-evaluations.js.map +1 -1
- package/dist/tools/query-evaluations.test.js +386 -391
- package/dist/tools/query-evaluations.test.js.map +1 -1
- package/dist/tools/query-llm-events.d.ts +100 -75
- package/dist/tools/query-llm-events.d.ts.map +1 -1
- package/dist/tools/query-llm-events.js +106 -80
- package/dist/tools/query-llm-events.js.map +1 -1
- package/dist/tools/query-llm-events.test.js +183 -346
- package/dist/tools/query-llm-events.test.js.map +1 -1
- package/dist/tools/query-logs.d.ts +45 -58
- package/dist/tools/query-logs.d.ts.map +1 -1
- package/dist/tools/query-logs.js +54 -101
- package/dist/tools/query-logs.js.map +1 -1
- package/dist/tools/query-logs.test.js +118 -314
- package/dist/tools/query-logs.test.js.map +1 -1
- package/dist/tools/query-metric-histograms.d.ts +112 -0
- package/dist/tools/query-metric-histograms.d.ts.map +1 -0
- package/dist/tools/query-metric-histograms.js +69 -0
- package/dist/tools/query-metric-histograms.js.map +1 -0
- package/dist/tools/query-metric-histograms.test.d.ts +5 -0
- package/dist/tools/query-metric-histograms.test.d.ts.map +1 -0
- package/dist/tools/query-metric-histograms.test.js +209 -0
- package/dist/tools/query-metric-histograms.test.js.map +1 -0
- package/dist/tools/query-metrics.d.ts +159 -60
- package/dist/tools/query-metrics.d.ts.map +1 -1
- package/dist/tools/query-metrics.js +133 -111
- package/dist/tools/query-metrics.js.map +1 -1
- package/dist/tools/query-metrics.test.js +314 -389
- package/dist/tools/query-metrics.test.js.map +1 -1
- package/dist/tools/query-regressions.d.ts +76 -0
- package/dist/tools/query-regressions.d.ts.map +1 -0
- package/dist/tools/query-regressions.js +122 -0
- package/dist/tools/query-regressions.js.map +1 -0
- package/dist/tools/query-regressions.test.d.ts +8 -0
- package/dist/tools/query-regressions.test.d.ts.map +1 -0
- package/dist/tools/query-regressions.test.js +129 -0
- package/dist/tools/query-regressions.test.js.map +1 -0
- package/dist/tools/query-traces.d.ts +103 -71
- package/dist/tools/query-traces.d.ts.map +1 -1
- package/dist/tools/query-traces.js +75 -106
- package/dist/tools/query-traces.js.map +1 -1
- package/dist/tools/query-traces.test.js +140 -846
- package/dist/tools/query-traces.test.js.map +1 -1
- package/dist/tools/query-verifications.d.ts +123 -0
- package/dist/tools/query-verifications.d.ts.map +1 -0
- package/dist/tools/query-verifications.js +102 -0
- package/dist/tools/query-verifications.js.map +1 -0
- package/dist/tools/query-verifications.test.d.ts +5 -0
- package/dist/tools/query-verifications.test.d.ts.map +1 -0
- package/dist/tools/query-verifications.test.js +163 -0
- package/dist/tools/query-verifications.test.js.map +1 -0
- package/dist/tools/routing-telemetry.d.ts +168 -0
- package/dist/tools/routing-telemetry.d.ts.map +1 -0
- package/dist/tools/routing-telemetry.js +267 -0
- package/dist/tools/routing-telemetry.js.map +1 -0
- package/dist/tools/routing-telemetry.test.d.ts +5 -0
- package/dist/tools/routing-telemetry.test.d.ts.map +1 -0
- package/dist/tools/routing-telemetry.test.js +747 -0
- package/dist/tools/routing-telemetry.test.js.map +1 -0
- package/dist/tools/setup-claudeignore.d.ts +4 -32
- package/dist/tools/setup-claudeignore.d.ts.map +1 -1
- package/dist/tools/setup-claudeignore.js +18 -22
- package/dist/tools/setup-claudeignore.js.map +1 -1
- package/dist/tools/setup-claudeignore.test.js +50 -49
- package/dist/tools/setup-claudeignore.test.js.map +1 -1
- package/dist/tools/token-budget.d.ts +170 -0
- package/dist/tools/token-budget.d.ts.map +1 -0
- package/dist/tools/token-budget.js +219 -0
- package/dist/tools/token-budget.js.map +1 -0
- package/dist/tools/token-budget.test.d.ts +5 -0
- package/dist/tools/token-budget.test.d.ts.map +1 -0
- package/dist/tools/token-budget.test.js +293 -0
- package/dist/tools/token-budget.test.js.map +1 -0
- package/package.json +76 -6
- package/dist/backends/local-jsonl.test.d.ts +0 -2
- package/dist/backends/local-jsonl.test.d.ts.map +0 -1
- package/dist/backends/local-jsonl.test.js +0 -4651
- package/dist/backends/local-jsonl.test.js.map +0 -1
- package/dist/backends/signoz-api-circuit-breaker.test.d.ts +0 -6
- package/dist/backends/signoz-api-circuit-breaker.test.d.ts.map +0 -1
- package/dist/backends/signoz-api-circuit-breaker.test.js +0 -548
- package/dist/backends/signoz-api-circuit-breaker.test.js.map +0 -1
- package/dist/backends/signoz-api-rate-limiter.test.d.ts +0 -6
- package/dist/backends/signoz-api-rate-limiter.test.d.ts.map +0 -1
- package/dist/backends/signoz-api-rate-limiter.test.js +0 -389
- package/dist/backends/signoz-api-rate-limiter.test.js.map +0 -1
- package/dist/backends/signoz-api-ssrf.test.d.ts +0 -6
- package/dist/backends/signoz-api-ssrf.test.d.ts.map +0 -1
- package/dist/backends/signoz-api-ssrf.test.js +0 -216
- package/dist/backends/signoz-api-ssrf.test.js.map +0 -1
- package/dist/backends/signoz-api-test-helpers.d.ts +0 -80
- package/dist/backends/signoz-api-test-helpers.d.ts.map +0 -1
- package/dist/backends/signoz-api-test-helpers.js +0 -79
- package/dist/backends/signoz-api-test-helpers.js.map +0 -1
- package/dist/backends/signoz-api.d.ts +0 -95
- package/dist/backends/signoz-api.d.ts.map +0 -1
- package/dist/backends/signoz-api.integration.test.d.ts +0 -8
- package/dist/backends/signoz-api.integration.test.d.ts.map +0 -1
- package/dist/backends/signoz-api.integration.test.js +0 -137
- package/dist/backends/signoz-api.integration.test.js.map +0 -1
- package/dist/backends/signoz-api.js +0 -1016
- package/dist/backends/signoz-api.js.map +0 -1
- package/dist/backends/signoz-api.test.d.ts +0 -11
- package/dist/backends/signoz-api.test.d.ts.map +0 -1
- package/dist/backends/signoz-api.test.js +0 -831
- package/dist/backends/signoz-api.test.js.map +0 -1
- package/dist/lib/cache.d.ts +0 -77
- package/dist/lib/cache.d.ts.map +0 -1
- package/dist/lib/cache.js +0 -119
- package/dist/lib/cache.js.map +0 -1
- package/dist/lib/cache.test.d.ts.map +0 -1
- package/dist/lib/cache.test.js.map +0 -1
- package/dist/lib/circuit-breaker.d.ts +0 -83
- package/dist/lib/circuit-breaker.d.ts.map +0 -1
- package/dist/lib/circuit-breaker.js +0 -125
- package/dist/lib/circuit-breaker.js.map +0 -1
- package/dist/lib/circuit-breaker.test.d.ts.map +0 -1
- package/dist/lib/circuit-breaker.test.js.map +0 -1
- package/dist/lib/constants-symlink.test.d.ts.map +0 -1
- package/dist/lib/constants-symlink.test.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -108
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/constants.js +0 -350
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/constants.test.d.ts.map +0 -1
- package/dist/lib/constants.test.js.map +0 -1
- package/dist/lib/edge-cases.test.d.ts.map +0 -1
- package/dist/lib/edge-cases.test.js.map +0 -1
- package/dist/lib/error-sanitizer.d.ts.map +0 -1
- package/dist/lib/error-sanitizer.js.map +0 -1
- package/dist/lib/error-sanitizer.test.d.ts.map +0 -1
- package/dist/lib/error-sanitizer.test.js.map +0 -1
- package/dist/lib/error-types.d.ts.map +0 -1
- package/dist/lib/error-types.js.map +0 -1
- package/dist/lib/error-types.test.d.ts.map +0 -1
- package/dist/lib/error-types.test.js.map +0 -1
- package/dist/lib/file-utils.d.ts.map +0 -1
- package/dist/lib/file-utils.js.map +0 -1
- package/dist/lib/file-utils.test.d.ts.map +0 -1
- package/dist/lib/file-utils.test.js.map +0 -1
- package/dist/lib/indexer.d.ts +0 -96
- package/dist/lib/indexer.d.ts.map +0 -1
- package/dist/lib/indexer.js.map +0 -1
- package/dist/lib/indexer.test.d.ts.map +0 -1
- package/dist/lib/indexer.test.js.map +0 -1
- package/dist/lib/input-validator.d.ts.map +0 -1
- package/dist/lib/input-validator.fuzz.test.d.ts.map +0 -1
- package/dist/lib/input-validator.fuzz.test.js.map +0 -1
- package/dist/lib/input-validator.js.map +0 -1
- package/dist/lib/input-validator.test.d.ts.map +0 -1
- package/dist/lib/input-validator.test.js.map +0 -1
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/logger.js +0 -81
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/logger.test.d.ts.map +0 -1
- package/dist/lib/logger.test.js.map +0 -1
- package/dist/lib/otlp-export.d.ts.map +0 -1
- package/dist/lib/otlp-export.js.map +0 -1
- package/dist/lib/query-sanitizer.d.ts.map +0 -1
- package/dist/lib/query-sanitizer.js.map +0 -1
- package/dist/lib/query-sanitizer.test.d.ts.map +0 -1
- package/dist/lib/query-sanitizer.test.js.map +0 -1
- package/dist/lib/server-utils.d.ts.map +0 -1
- package/dist/lib/server-utils.js.map +0 -1
- package/dist/lib/shared-schemas.d.ts +0 -81
- package/dist/lib/shared-schemas.d.ts.map +0 -1
- package/dist/lib/shared-schemas.js +0 -80
- package/dist/lib/shared-schemas.js.map +0 -1
- package/dist/lib/shared-schemas.test.d.ts.map +0 -1
- package/dist/lib/shared-schemas.test.js.map +0 -1
- package/dist/lib/toon-encoder.d.ts.map +0 -1
- package/dist/lib/toon-encoder.js.map +0 -1
- package/dist/lib/toon-encoder.test.d.ts.map +0 -1
- package/dist/lib/toon-encoder.test.js.map +0 -1
- package/dist/tools/signoz.integration.test.d.ts +0 -8
- package/dist/tools/signoz.integration.test.d.ts.map +0 -1
- package/dist/tools/signoz.integration.test.js +0 -141
- package/dist/tools/signoz.integration.test.js.map +0 -1
- /package/dist/lib/{constants-symlink.test.d.ts → core/constants-symlink.test.d.ts} +0 -0
- /package/dist/lib/{constants.test.d.ts → core/constants.test.d.ts} +0 -0
- /package/dist/lib/{edge-cases.test.d.ts → core/edge-cases.test.d.ts} +0 -0
- /package/dist/lib/{file-utils.test.d.ts → core/file-utils.test.d.ts} +0 -0
- /package/dist/lib/{input-validator.fuzz.test.d.ts → core/input-validator.fuzz.test.d.ts} +0 -0
- /package/dist/lib/{input-validator.test.d.ts → core/input-validator.test.d.ts} +0 -0
- /package/dist/lib/{logger.test.d.ts → core/logger.test.d.ts} +0 -0
- /package/dist/lib/{logger.test.js → core/logger.test.js} +0 -0
- /package/dist/lib/{shared-schemas.test.d.ts → core/shared-schemas.test.d.ts} +0 -0
- /package/dist/lib/{error-sanitizer.test.d.ts → errors/error-sanitizer.test.d.ts} +0 -0
- /package/dist/lib/{error-types.test.d.ts → errors/error-types.test.d.ts} +0 -0
- /package/dist/lib/{query-sanitizer.d.ts → errors/query-sanitizer.d.ts} +0 -0
- /package/dist/lib/{query-sanitizer.test.d.ts → errors/query-sanitizer.test.d.ts} +0 -0
- /package/dist/lib/{indexer.test.d.ts → observability/indexer.test.d.ts} +0 -0
- /package/dist/lib/{cache.test.d.ts → resilience/cache.test.d.ts} +0 -0
- /package/dist/lib/{circuit-breaker.test.d.ts → resilience/circuit-breaker.test.d.ts} +0 -0
- /package/dist/lib/{toon-encoder.test.d.ts → resilience/toon-encoder.test.d.ts} +0 -0
|
@@ -0,0 +1,1151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quality Metrics Dashboard Helpers
|
|
3
|
+
*
|
|
4
|
+
* Pre-defined evaluation metrics with alerting thresholds for LLM quality monitoring.
|
|
5
|
+
* Designed for dashboard integration with observability platforms (SigNoz, Grafana, etc.).
|
|
6
|
+
*
|
|
7
|
+
* @see BACKLOG.md Quality Metrics Dashboard section
|
|
8
|
+
* @see https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-events/
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { evaluationAggregationSchema, timeRangeSchema } from '../core/shared-schemas.js';
|
|
12
|
+
// Internal imports from submodules (used by computeQualityMetric / computeDashboardSummary)
|
|
13
|
+
import { computeTrend, computeConfidence } from './quality-trends.js';
|
|
14
|
+
import { evaluateSLAs } from './quality-sla.js';
|
|
15
|
+
import { computeNormalizedEntropy } from './quality-feature-engineering.js';
|
|
16
|
+
import { RELEVANCE_WARNING, RELEVANCE_CRITICAL, TASK_COMPLETION_WARNING, TASK_COMPLETION_CRITICAL, TOOL_CORRECTNESS_WARNING, TOOL_CORRECTNESS_CRITICAL, TOOL_CORRECTNESS_RELIABILITY_FLOOR, HALLUCINATION_WARNING, HALLUCINATION_CRITICAL, EVAL_LATENCY_WARNING_S, EVAL_LATENCY_CRITICAL_S, FAITHFULNESS_WARNING, FAITHFULNESS_CRITICAL, COHERENCE_WARNING, EXPLANATION_QUALITY_WARNING, EXPLANATION_QUALITY_CRITICAL, HANDOFF_CORRECTNESS_WARNING, HANDOFF_CORRECTNESS_CRITICAL, DIVERGENCE_ENTROPY_THRESHOLD, DEFAULT_BIN_COUNT, MIN_DIVERGENCE_SAMPLES, QUALITY_PERCENTILE_P50, QUALITY_PERCENTILE_P95, QUALITY_PERCENTILE_P99, QUALITY_PERCENT_SCALE, UNIT_RANGE, LATENCY_RANGE, ALERT_MESSAGES, REMEDIATION_HINTS, } from './quality-constants.js';
|
|
17
|
+
export { roleTypeSchema, qualityMetricNameSchema, cqiWeightsSchema, TREND_MIN_SAMPLE_SIZE, DEFAULT_BIN_COUNT, DEFAULT_ENTROPY_THRESHOLD } from './quality-constants.js';
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Constants (needed by schemas below)
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/** Recognized SLA window formats */
|
|
22
|
+
export const slaWindowFormatSchema = z.enum([
|
|
23
|
+
'7d rolling', '14d rolling', '30d rolling', '60d rolling', '90d rolling',
|
|
24
|
+
'calendar day', 'calendar week', 'calendar month', 'calendar quarter', 'calendar year',
|
|
25
|
+
]);
|
|
26
|
+
/** All possible SLA evaluation statuses */
|
|
27
|
+
export const slaStatusSchema = z.enum(['compliant', 'non_compliant', 'no_data', 'metric_not_found']);
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Pre-defined Quality Metrics (from BACKLOG.md)
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* Pre-defined quality metrics with recommended thresholds.
|
|
33
|
+
* Based on industry best practices for LLM evaluation.
|
|
34
|
+
*/
|
|
35
|
+
export const QUALITY_METRICS = {
|
|
36
|
+
// Response quality metric
|
|
37
|
+
relevance: {
|
|
38
|
+
name: 'relevance',
|
|
39
|
+
displayName: 'Response Relevance',
|
|
40
|
+
description: 'Measures how relevant LLM responses are to the input query',
|
|
41
|
+
aggregations: ['avg', 'p50', 'p95', 'min', 'count'],
|
|
42
|
+
alerts: [
|
|
43
|
+
{
|
|
44
|
+
aggregation: 'p50',
|
|
45
|
+
value: RELEVANCE_WARNING,
|
|
46
|
+
direction: 'below',
|
|
47
|
+
severity: 'warning',
|
|
48
|
+
message: ALERT_MESSAGES.relevance.warning,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
aggregation: 'p50',
|
|
52
|
+
value: RELEVANCE_CRITICAL,
|
|
53
|
+
direction: 'below',
|
|
54
|
+
severity: 'critical',
|
|
55
|
+
message: ALERT_MESSAGES.relevance.critical,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'divergence',
|
|
59
|
+
entropyThreshold: DIVERGENCE_ENTROPY_THRESHOLD,
|
|
60
|
+
bins: DEFAULT_BIN_COUNT,
|
|
61
|
+
severity: 'warning',
|
|
62
|
+
message: ALERT_MESSAGES.relevance.divergence,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
range: UNIT_RANGE,
|
|
66
|
+
unit: 'score',
|
|
67
|
+
remediationHints: [...REMEDIATION_HINTS.relevance],
|
|
68
|
+
},
|
|
69
|
+
// Agent effectiveness metric
|
|
70
|
+
task_completion: {
|
|
71
|
+
name: 'task_completion',
|
|
72
|
+
displayName: 'Task Completion Rate',
|
|
73
|
+
description: 'Rate at which agents successfully complete assigned tasks',
|
|
74
|
+
aggregations: ['avg', 'p50', 'count'],
|
|
75
|
+
alerts: [
|
|
76
|
+
{
|
|
77
|
+
aggregation: 'avg',
|
|
78
|
+
value: TASK_COMPLETION_WARNING,
|
|
79
|
+
direction: 'below',
|
|
80
|
+
severity: 'warning',
|
|
81
|
+
message: ALERT_MESSAGES.task_completion.warning,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
aggregation: 'avg',
|
|
85
|
+
value: TASK_COMPLETION_CRITICAL,
|
|
86
|
+
direction: 'below',
|
|
87
|
+
severity: 'critical',
|
|
88
|
+
message: ALERT_MESSAGES.task_completion.critical,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'divergence',
|
|
92
|
+
entropyThreshold: DIVERGENCE_ENTROPY_THRESHOLD,
|
|
93
|
+
bins: DEFAULT_BIN_COUNT,
|
|
94
|
+
severity: 'warning',
|
|
95
|
+
message: ALERT_MESSAGES.task_completion.divergence,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
range: UNIT_RANGE,
|
|
99
|
+
unit: 'rate',
|
|
100
|
+
remediationHints: [...REMEDIATION_HINTS.task_completion],
|
|
101
|
+
},
|
|
102
|
+
// Tool selection accuracy
|
|
103
|
+
tool_correctness: {
|
|
104
|
+
name: 'tool_correctness',
|
|
105
|
+
displayName: 'Tool Selection Accuracy',
|
|
106
|
+
description: 'Accuracy of tool selection in agent workflows',
|
|
107
|
+
aggregations: ['avg', 'p50', 'count'],
|
|
108
|
+
alerts: [
|
|
109
|
+
{
|
|
110
|
+
aggregation: 'avg',
|
|
111
|
+
value: TOOL_CORRECTNESS_WARNING,
|
|
112
|
+
direction: 'below',
|
|
113
|
+
severity: 'warning',
|
|
114
|
+
message: ALERT_MESSAGES.tool_correctness.warning,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
aggregation: 'avg',
|
|
118
|
+
value: TOOL_CORRECTNESS_CRITICAL,
|
|
119
|
+
direction: 'below',
|
|
120
|
+
severity: 'critical',
|
|
121
|
+
message: ALERT_MESSAGES.tool_correctness.critical,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
range: UNIT_RANGE,
|
|
125
|
+
unit: 'rate',
|
|
126
|
+
remediationHints: [...REMEDIATION_HINTS.tool_correctness],
|
|
127
|
+
},
|
|
128
|
+
// Factual accuracy metric
|
|
129
|
+
hallucination: {
|
|
130
|
+
name: 'hallucination',
|
|
131
|
+
displayName: 'Hallucination Rate',
|
|
132
|
+
description: 'Rate of factually incorrect or fabricated information in responses',
|
|
133
|
+
aggregations: ['avg', 'p95', 'max', 'count'],
|
|
134
|
+
alerts: [
|
|
135
|
+
{
|
|
136
|
+
aggregation: 'avg',
|
|
137
|
+
value: HALLUCINATION_WARNING,
|
|
138
|
+
direction: 'above',
|
|
139
|
+
severity: 'warning',
|
|
140
|
+
message: ALERT_MESSAGES.hallucination.warning,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
aggregation: 'avg',
|
|
144
|
+
value: HALLUCINATION_CRITICAL,
|
|
145
|
+
direction: 'above',
|
|
146
|
+
severity: 'critical',
|
|
147
|
+
message: ALERT_MESSAGES.hallucination.critical,
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
range: UNIT_RANGE,
|
|
151
|
+
unit: 'rate',
|
|
152
|
+
remediationHints: [...REMEDIATION_HINTS.hallucination],
|
|
153
|
+
},
|
|
154
|
+
// Evaluation latency metric
|
|
155
|
+
evaluation_latency: {
|
|
156
|
+
name: 'evaluation_latency',
|
|
157
|
+
displayName: 'Evaluation Latency',
|
|
158
|
+
description: 'Time taken to complete LLM-as-Judge evaluations',
|
|
159
|
+
aggregations: ['avg', 'p50', 'p95', 'p99', 'max', 'count'],
|
|
160
|
+
alerts: [
|
|
161
|
+
{
|
|
162
|
+
aggregation: 'p95',
|
|
163
|
+
value: EVAL_LATENCY_WARNING_S,
|
|
164
|
+
direction: 'above',
|
|
165
|
+
severity: 'warning',
|
|
166
|
+
message: ALERT_MESSAGES.evaluation_latency.warning,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
aggregation: 'p95',
|
|
170
|
+
value: EVAL_LATENCY_CRITICAL_S,
|
|
171
|
+
direction: 'above',
|
|
172
|
+
severity: 'critical',
|
|
173
|
+
message: ALERT_MESSAGES.evaluation_latency.critical,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
range: LATENCY_RANGE,
|
|
177
|
+
unit: 'seconds',
|
|
178
|
+
remediationHints: [...REMEDIATION_HINTS.evaluation_latency],
|
|
179
|
+
},
|
|
180
|
+
// Faithfulness metric (QAG)
|
|
181
|
+
faithfulness: {
|
|
182
|
+
name: 'faithfulness',
|
|
183
|
+
displayName: 'Response Faithfulness',
|
|
184
|
+
description: 'Measures if responses are grounded in provided context',
|
|
185
|
+
aggregations: ['avg', 'p50', 'p95', 'count'],
|
|
186
|
+
alerts: [
|
|
187
|
+
{
|
|
188
|
+
aggregation: 'p50',
|
|
189
|
+
value: FAITHFULNESS_WARNING,
|
|
190
|
+
direction: 'below',
|
|
191
|
+
severity: 'warning',
|
|
192
|
+
message: ALERT_MESSAGES.faithfulness.warning,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
aggregation: 'p50',
|
|
196
|
+
value: FAITHFULNESS_CRITICAL,
|
|
197
|
+
direction: 'below',
|
|
198
|
+
severity: 'critical',
|
|
199
|
+
message: ALERT_MESSAGES.faithfulness.critical,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
type: 'divergence',
|
|
203
|
+
entropyThreshold: DIVERGENCE_ENTROPY_THRESHOLD,
|
|
204
|
+
bins: DEFAULT_BIN_COUNT,
|
|
205
|
+
severity: 'warning',
|
|
206
|
+
message: ALERT_MESSAGES.faithfulness.divergence,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
range: UNIT_RANGE,
|
|
210
|
+
unit: 'score',
|
|
211
|
+
remediationHints: [...REMEDIATION_HINTS.faithfulness],
|
|
212
|
+
},
|
|
213
|
+
// Coherence metric
|
|
214
|
+
coherence: {
|
|
215
|
+
name: 'coherence',
|
|
216
|
+
displayName: 'Response Coherence',
|
|
217
|
+
description: 'Logical consistency and clarity of responses',
|
|
218
|
+
aggregations: ['avg', 'p50', 'p95', 'count'],
|
|
219
|
+
alerts: [
|
|
220
|
+
{
|
|
221
|
+
aggregation: 'p50',
|
|
222
|
+
value: COHERENCE_WARNING,
|
|
223
|
+
direction: 'below',
|
|
224
|
+
severity: 'warning',
|
|
225
|
+
message: ALERT_MESSAGES.coherence.warning,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
type: 'divergence',
|
|
229
|
+
entropyThreshold: DIVERGENCE_ENTROPY_THRESHOLD,
|
|
230
|
+
bins: DEFAULT_BIN_COUNT,
|
|
231
|
+
severity: 'warning',
|
|
232
|
+
message: ALERT_MESSAGES.coherence.divergence,
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
range: UNIT_RANGE,
|
|
236
|
+
unit: 'score',
|
|
237
|
+
remediationHints: [...REMEDIATION_HINTS.coherence],
|
|
238
|
+
},
|
|
239
|
+
// Meta-evaluation of judge explanation quality
|
|
240
|
+
explanation_quality: {
|
|
241
|
+
name: 'explanation_quality',
|
|
242
|
+
displayName: 'Explanation Quality',
|
|
243
|
+
description: 'Meta-evaluation of judge explanation specificity, evidence citation, and actionability',
|
|
244
|
+
aggregations: ['avg', 'p50', 'p95', 'count'],
|
|
245
|
+
alerts: [
|
|
246
|
+
{
|
|
247
|
+
aggregation: 'p50',
|
|
248
|
+
value: EXPLANATION_QUALITY_WARNING,
|
|
249
|
+
direction: 'below',
|
|
250
|
+
severity: 'warning',
|
|
251
|
+
message: ALERT_MESSAGES.explanation_quality.warning,
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
aggregation: 'p50',
|
|
255
|
+
value: EXPLANATION_QUALITY_CRITICAL,
|
|
256
|
+
direction: 'below',
|
|
257
|
+
severity: 'critical',
|
|
258
|
+
message: ALERT_MESSAGES.explanation_quality.critical,
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
range: UNIT_RANGE,
|
|
262
|
+
unit: 'score',
|
|
263
|
+
remediationHints: [...REMEDIATION_HINTS.explanation_quality],
|
|
264
|
+
},
|
|
265
|
+
// Multi-agent handoff accuracy
|
|
266
|
+
handoff_correctness: {
|
|
267
|
+
name: 'handoff_correctness',
|
|
268
|
+
displayName: 'Handoff Correctness',
|
|
269
|
+
description: 'Accuracy of agent-to-agent task handoffs in multi-agent workflows',
|
|
270
|
+
aggregations: ['avg', 'p50', 'count'],
|
|
271
|
+
alerts: [
|
|
272
|
+
{
|
|
273
|
+
aggregation: 'avg',
|
|
274
|
+
value: HANDOFF_CORRECTNESS_WARNING,
|
|
275
|
+
direction: 'below',
|
|
276
|
+
severity: 'warning',
|
|
277
|
+
message: ALERT_MESSAGES.handoff_correctness.warning,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
aggregation: 'avg',
|
|
281
|
+
value: HANDOFF_CORRECTNESS_CRITICAL,
|
|
282
|
+
direction: 'below',
|
|
283
|
+
severity: 'critical',
|
|
284
|
+
message: ALERT_MESSAGES.handoff_correctness.critical,
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
range: UNIT_RANGE,
|
|
288
|
+
unit: 'rate',
|
|
289
|
+
remediationHints: [...REMEDIATION_HINTS.handoff_correctness],
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
// ============================================================================
|
|
293
|
+
// Zod Schemas
|
|
294
|
+
// ============================================================================
|
|
295
|
+
const finiteNumber = z.number().finite({
|
|
296
|
+
error: 'Must be a finite number (no NaN/Infinity). Check alert threshold values and metric range min/max.'
|
|
297
|
+
});
|
|
298
|
+
const DECIMAL_BASE = 10;
|
|
299
|
+
const SCHEMA_LONG_TEXT_MULTIPLIER = 10;
|
|
300
|
+
const SCHEMA_MESSAGE_MAX_CHARS = 500;
|
|
301
|
+
const SCHEMA_DISPLAY_NAME_MAX_CHARS = 200;
|
|
302
|
+
const SCHEMA_CONDITIONS_MIN = 2;
|
|
303
|
+
const SCHEMA_CONDITIONS_MAX = 10;
|
|
304
|
+
const SCHEMA_MIN_DIVERGENCE_BINS = 2;
|
|
305
|
+
const SCHEMA_MAX_DIVERGENCE_BINS = 100;
|
|
306
|
+
const SCHEMA_MAX_SUSTAINED_PERIODS = 12;
|
|
307
|
+
const SCHEMA_MAX_REMEDIATION_HINTS = 10;
|
|
308
|
+
const SCHEMA_SHORT_TEXT_MAX = QUALITY_PERCENT_SCALE;
|
|
309
|
+
const SCHEMA_LONG_TEXT_MAX = QUALITY_PERCENT_SCALE * SCHEMA_LONG_TEXT_MULTIPLIER;
|
|
310
|
+
export const alertSeveritySchema = z.enum(['info', 'warning', 'critical']);
|
|
311
|
+
const thresholdDirectionSchema = z.enum(['above', 'below']);
|
|
312
|
+
export const healthStatusSchema = z.enum(['healthy', 'warning', 'critical', 'no_data']);
|
|
313
|
+
const valueAlertSchema = z.object({
|
|
314
|
+
aggregation: evaluationAggregationSchema,
|
|
315
|
+
value: finiteNumber,
|
|
316
|
+
direction: thresholdDirectionSchema,
|
|
317
|
+
severity: alertSeveritySchema,
|
|
318
|
+
message: z.string().max(SCHEMA_MESSAGE_MAX_CHARS),
|
|
319
|
+
});
|
|
320
|
+
const divergenceAlertSchema = z.object({
|
|
321
|
+
type: z.literal('divergence'),
|
|
322
|
+
entropyThreshold: finiteNumber.refine(v => v >= 0 && v <= 1, {
|
|
323
|
+
error: 'entropyThreshold must be between 0 and 1'
|
|
324
|
+
}),
|
|
325
|
+
bins: z.int().min(SCHEMA_MIN_DIVERGENCE_BINS).max(SCHEMA_MAX_DIVERGENCE_BINS),
|
|
326
|
+
severity: alertSeveritySchema,
|
|
327
|
+
message: z.string().max(SCHEMA_MESSAGE_MAX_CHARS),
|
|
328
|
+
});
|
|
329
|
+
// NOTE: divergenceAlertSchema must come first because valueAlertSchema has no type field.
|
|
330
|
+
// If AlertThreshold gains a `type` field in the future, switch to z.discriminatedUnion('type', [...]).
|
|
331
|
+
const alertThresholdUnionSchema = z.union([divergenceAlertSchema, valueAlertSchema]);
|
|
332
|
+
export const divergenceDetailsSchema = z.object({
|
|
333
|
+
entropy: finiteNumber,
|
|
334
|
+
entropyThreshold: finiteNumber,
|
|
335
|
+
bins: z.int().positive(),
|
|
336
|
+
histogram: z.array(z.int().nonnegative()),
|
|
337
|
+
});
|
|
338
|
+
export const severityContextSchema = z.object({
|
|
339
|
+
environment: z.string().optional(),
|
|
340
|
+
escalateWarnings: z.boolean().optional(),
|
|
341
|
+
suppressInfo: z.boolean().optional(),
|
|
342
|
+
minSampleCount: z.int().nonnegative().optional(),
|
|
343
|
+
});
|
|
344
|
+
export const metricTrendSchema = z.object({
|
|
345
|
+
direction: z.enum(['improving', 'degrading', 'stable']),
|
|
346
|
+
delta: finiteNumber,
|
|
347
|
+
percentChange: finiteNumber.nullable(),
|
|
348
|
+
previousValue: finiteNumber,
|
|
349
|
+
currentValue: finiteNumber,
|
|
350
|
+
aggregation: evaluationAggregationSchema,
|
|
351
|
+
lowSampleWarning: z.boolean().optional(),
|
|
352
|
+
});
|
|
353
|
+
export const confidenceIndicatorSchema = z.object({
|
|
354
|
+
level: z.enum(['low', 'medium', 'high']),
|
|
355
|
+
sampleCount: z.int().nonnegative(),
|
|
356
|
+
scoreStdDev: finiteNumber.nullable(),
|
|
357
|
+
evaluatorCount: z.int().nonnegative(),
|
|
358
|
+
evaluatorAgreement: finiteNumber.nullable(),
|
|
359
|
+
});
|
|
360
|
+
export const worstExplanationSchema = z.object({
|
|
361
|
+
score: finiteNumber,
|
|
362
|
+
explanation: z.string().optional(),
|
|
363
|
+
traceId: z.string().optional(),
|
|
364
|
+
timestamp: z.string().optional(),
|
|
365
|
+
});
|
|
366
|
+
export const triggeredAlertSchema = z.object({
|
|
367
|
+
severity: alertSeveritySchema,
|
|
368
|
+
message: z.string(),
|
|
369
|
+
aggregation: evaluationAggregationSchema,
|
|
370
|
+
threshold: finiteNumber,
|
|
371
|
+
actualValue: finiteNumber,
|
|
372
|
+
direction: thresholdDirectionSchema,
|
|
373
|
+
affectedCount: z.int().nonnegative().optional(),
|
|
374
|
+
remediationHints: z.array(z.string().max(SCHEMA_MESSAGE_MAX_CHARS)).max(SCHEMA_MAX_REMEDIATION_HINTS).optional(),
|
|
375
|
+
relatedMetrics: z.array(z.string()).optional(),
|
|
376
|
+
isCompound: z.boolean().optional(),
|
|
377
|
+
divergenceDetails: divergenceDetailsSchema.optional(),
|
|
378
|
+
});
|
|
379
|
+
export const qualityMetricResultSchema = z.object({
|
|
380
|
+
name: z.string().min(1),
|
|
381
|
+
displayName: z.string().min(1),
|
|
382
|
+
values: z.record(evaluationAggregationSchema, finiteNumber.nullable()),
|
|
383
|
+
sampleCount: z.int().nonnegative(),
|
|
384
|
+
alerts: z.array(triggeredAlertSchema),
|
|
385
|
+
status: healthStatusSchema,
|
|
386
|
+
period: timeRangeSchema.optional(),
|
|
387
|
+
worstExplanation: worstExplanationSchema.optional(),
|
|
388
|
+
trend: metricTrendSchema.optional(),
|
|
389
|
+
confidence: confidenceIndicatorSchema.optional(),
|
|
390
|
+
});
|
|
391
|
+
export const qualityMetricConfigSchema = z.object({
|
|
392
|
+
name: z.string().min(1).max(SCHEMA_SHORT_TEXT_MAX),
|
|
393
|
+
displayName: z.string().min(1).max(SCHEMA_DISPLAY_NAME_MAX_CHARS),
|
|
394
|
+
description: z.string().max(SCHEMA_LONG_TEXT_MAX),
|
|
395
|
+
aggregations: z.array(evaluationAggregationSchema).min(1),
|
|
396
|
+
alerts: z.array(alertThresholdUnionSchema),
|
|
397
|
+
range: z.object({
|
|
398
|
+
min: finiteNumber,
|
|
399
|
+
max: finiteNumber,
|
|
400
|
+
}),
|
|
401
|
+
unit: z.enum(['score', 'rate', 'seconds', 'percentage']),
|
|
402
|
+
remediationHints: z.array(z.string().max(SCHEMA_MESSAGE_MAX_CHARS)).max(SCHEMA_MAX_REMEDIATION_HINTS).optional(),
|
|
403
|
+
});
|
|
404
|
+
export const metricConditionSchema = z.object({
|
|
405
|
+
metric: z.string().min(1).max(SCHEMA_SHORT_TEXT_MAX),
|
|
406
|
+
aggregation: evaluationAggregationSchema,
|
|
407
|
+
value: finiteNumber,
|
|
408
|
+
direction: thresholdDirectionSchema,
|
|
409
|
+
window: slaWindowFormatSchema.optional(),
|
|
410
|
+
sustainedPeriods: z.int().min(1).max(SCHEMA_MAX_SUSTAINED_PERIODS).optional(),
|
|
411
|
+
});
|
|
412
|
+
export const metricCorrelationRuleSchema = z.object({
|
|
413
|
+
name: z.string().min(1).max(SCHEMA_SHORT_TEXT_MAX),
|
|
414
|
+
displayName: z.string().min(1).max(SCHEMA_DISPLAY_NAME_MAX_CHARS),
|
|
415
|
+
conditions: z.array(metricConditionSchema).min(SCHEMA_CONDITIONS_MIN).max(SCHEMA_CONDITIONS_MAX),
|
|
416
|
+
severity: alertSeveritySchema,
|
|
417
|
+
explanation: z.string().min(1).max(SCHEMA_LONG_TEXT_MAX),
|
|
418
|
+
});
|
|
419
|
+
export const slaDefinitionSchema = z.object({
|
|
420
|
+
metric: z.string().min(1).max(SCHEMA_SHORT_TEXT_MAX),
|
|
421
|
+
aggregation: evaluationAggregationSchema,
|
|
422
|
+
target: finiteNumber,
|
|
423
|
+
direction: thresholdDirectionSchema,
|
|
424
|
+
window: slaWindowFormatSchema.optional(),
|
|
425
|
+
});
|
|
426
|
+
export const slaComplianceResultSchema = z.object({
|
|
427
|
+
sla: slaDefinitionSchema,
|
|
428
|
+
compliant: z.boolean(),
|
|
429
|
+
status: slaStatusSchema,
|
|
430
|
+
actualValue: finiteNumber.nullable(),
|
|
431
|
+
gap: finiteNumber.nullable(),
|
|
432
|
+
marginPercent: finiteNumber.nullable(),
|
|
433
|
+
});
|
|
434
|
+
/** TriggeredAlert with its source metric name — used in dashboard alerts and view schemas. */
|
|
435
|
+
export const alertWithMetricSchema = triggeredAlertSchema.extend({ metricName: z.string() });
|
|
436
|
+
/** Per-metric count breakdown shown in ExecutiveView summary. */
|
|
437
|
+
export const dashboardSummaryStatsSchema = z.object({
|
|
438
|
+
totalMetrics: z.int().nonnegative(),
|
|
439
|
+
healthyMetrics: z.int().nonnegative(),
|
|
440
|
+
warningMetrics: z.int().nonnegative(),
|
|
441
|
+
criticalMetrics: z.int().nonnegative(),
|
|
442
|
+
noDataMetrics: z.int().nonnegative(),
|
|
443
|
+
});
|
|
444
|
+
export const qualityDashboardSummarySchema = z.object({
|
|
445
|
+
overallStatus: healthStatusSchema,
|
|
446
|
+
metrics: z.array(qualityMetricResultSchema),
|
|
447
|
+
alerts: z.array(alertWithMetricSchema),
|
|
448
|
+
summary: dashboardSummaryStatsSchema,
|
|
449
|
+
slaCompliance: z.array(slaComplianceResultSchema).optional(),
|
|
450
|
+
timestamp: z.string(),
|
|
451
|
+
});
|
|
452
|
+
// ============================================================================
|
|
453
|
+
// Shared Constants
|
|
454
|
+
// ============================================================================
|
|
455
|
+
/** Severity ordering for alert sorting (critical first). */
|
|
456
|
+
const SEVERITY_ORDER = { critical: 0, warning: 1, info: 2 };
|
|
457
|
+
/** @internal Decimal precision for score values (e.g., 0.8500) */
|
|
458
|
+
export const SCORE_PRECISION = 4;
|
|
459
|
+
/** @internal Decimal precision for percentage values (e.g., 12.50%) */
|
|
460
|
+
export const PERCENT_PRECISION = 2;
|
|
461
|
+
/** @internal Round a number to the given decimal places */
|
|
462
|
+
export function roundTo(value, decimals) {
|
|
463
|
+
const factor = DECIMAL_BASE ** decimals;
|
|
464
|
+
return Math.round(value * factor) / factor;
|
|
465
|
+
}
|
|
466
|
+
/** @internal Sort alerts by severity (critical first, then warning, then info). Returns new array. */
|
|
467
|
+
export function sortAlertsBySeverity(alerts) {
|
|
468
|
+
return [...alerts].sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity]);
|
|
469
|
+
}
|
|
470
|
+
// ============================================================================
|
|
471
|
+
// Computation Functions
|
|
472
|
+
// ============================================================================
|
|
473
|
+
/**
|
|
474
|
+
* Calculate percentile from a sorted array using R-7 linear interpolation.
|
|
475
|
+
* @param sorted - Pre-sorted ascending array of numbers
|
|
476
|
+
* @param percentile - Percentile (0-100)
|
|
477
|
+
*/
|
|
478
|
+
function calculatePercentile(sorted, percentile) {
|
|
479
|
+
if (sorted.length === 0)
|
|
480
|
+
return NaN;
|
|
481
|
+
if (percentile < 0 || percentile > QUALITY_PERCENT_SCALE)
|
|
482
|
+
return NaN;
|
|
483
|
+
if (sorted.length === 1)
|
|
484
|
+
return sorted[0];
|
|
485
|
+
const rank = (percentile / QUALITY_PERCENT_SCALE) * (sorted.length - 1);
|
|
486
|
+
const lower = Math.floor(rank);
|
|
487
|
+
const upper = Math.ceil(rank);
|
|
488
|
+
const weight = rank - lower;
|
|
489
|
+
if (lower === upper)
|
|
490
|
+
return sorted[lower];
|
|
491
|
+
return sorted[lower] * (1 - weight) + sorted[upper] * weight;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Compute aggregations for a set of evaluation scores.
|
|
495
|
+
* @param scores - Array of score values
|
|
496
|
+
* @param aggregations - Aggregations to compute
|
|
497
|
+
*/
|
|
498
|
+
export function computeAggregations(scores, aggregations) {
|
|
499
|
+
const result = {
|
|
500
|
+
avg: null,
|
|
501
|
+
min: null,
|
|
502
|
+
max: null,
|
|
503
|
+
count: null,
|
|
504
|
+
p50: null,
|
|
505
|
+
p95: null,
|
|
506
|
+
p99: null,
|
|
507
|
+
};
|
|
508
|
+
// Filter out NaN/Infinity before processing
|
|
509
|
+
const validScores = scores.filter((v) => Number.isFinite(v));
|
|
510
|
+
if (validScores.length === 0) {
|
|
511
|
+
return result;
|
|
512
|
+
}
|
|
513
|
+
// Always compute count (of valid scores)
|
|
514
|
+
result.count = validScores.length;
|
|
515
|
+
// Lazy sort: only copy+sort when aggregations need ordered data
|
|
516
|
+
const needsSort = aggregations.some(a => a === 'min' || a === 'max' || a === 'p50' || a === 'p95' || a === 'p99');
|
|
517
|
+
const sorted = needsSort ? [...validScores].sort((a, b) => a - b) : [];
|
|
518
|
+
for (const agg of aggregations) {
|
|
519
|
+
switch (agg) {
|
|
520
|
+
case 'avg':
|
|
521
|
+
result.avg = validScores.reduce((sum, v) => sum + v, 0) / validScores.length;
|
|
522
|
+
break;
|
|
523
|
+
case 'min':
|
|
524
|
+
result.min = sorted.length > 0 ? sorted[0] : null;
|
|
525
|
+
break;
|
|
526
|
+
case 'max':
|
|
527
|
+
result.max = sorted.length > 0 ? sorted[sorted.length - 1] : null;
|
|
528
|
+
break;
|
|
529
|
+
case 'count':
|
|
530
|
+
// Already computed
|
|
531
|
+
break;
|
|
532
|
+
case 'p50':
|
|
533
|
+
result.p50 = calculatePercentile(sorted, QUALITY_PERCENTILE_P50);
|
|
534
|
+
break;
|
|
535
|
+
case 'p95':
|
|
536
|
+
result.p95 = calculatePercentile(sorted, QUALITY_PERCENTILE_P95);
|
|
537
|
+
break;
|
|
538
|
+
case 'p99':
|
|
539
|
+
result.p99 = calculatePercentile(sorted, QUALITY_PERCENTILE_P99);
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
// Round to consistent score precision
|
|
544
|
+
for (const key of Object.keys(result)) {
|
|
545
|
+
const value = result[key];
|
|
546
|
+
if (value !== null && key !== 'count') {
|
|
547
|
+
result[key] = roundTo(value, SCORE_PRECISION);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return result;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Check a divergence alert threshold against raw scores.
|
|
554
|
+
* Returns a triggered alert if the score distribution entropy is below the threshold,
|
|
555
|
+
* or null if entropy is acceptable or there are insufficient samples.
|
|
556
|
+
*
|
|
557
|
+
* @param scores - Raw score values
|
|
558
|
+
* @param threshold - Divergence alert threshold configuration
|
|
559
|
+
*/
|
|
560
|
+
export function checkDivergenceAlert(scores, threshold) {
|
|
561
|
+
// Filter to finite scores in [0, 1] — public API must be self-defensive
|
|
562
|
+
const validScores = scores.filter(s => Number.isFinite(s) && s >= 0 && s <= 1);
|
|
563
|
+
if (validScores.length < MIN_DIVERGENCE_SAMPLES)
|
|
564
|
+
return null;
|
|
565
|
+
const histogram = new Array(threshold.bins).fill(0);
|
|
566
|
+
for (const s of validScores) {
|
|
567
|
+
const bin = Math.min(Math.floor(s * threshold.bins), threshold.bins - 1);
|
|
568
|
+
histogram[bin]++;
|
|
569
|
+
}
|
|
570
|
+
const entropy = computeNormalizedEntropy(histogram);
|
|
571
|
+
if (entropy >= threshold.entropyThreshold)
|
|
572
|
+
return null;
|
|
573
|
+
return {
|
|
574
|
+
severity: threshold.severity,
|
|
575
|
+
message: threshold.message.replace('{entropy}', entropy.toFixed(SCORE_PRECISION)),
|
|
576
|
+
aggregation: 'count',
|
|
577
|
+
threshold: threshold.entropyThreshold,
|
|
578
|
+
actualValue: entropy,
|
|
579
|
+
direction: 'below',
|
|
580
|
+
affectedCount: validScores.length,
|
|
581
|
+
divergenceDetails: {
|
|
582
|
+
entropy,
|
|
583
|
+
entropyThreshold: threshold.entropyThreshold,
|
|
584
|
+
bins: threshold.bins,
|
|
585
|
+
histogram,
|
|
586
|
+
},
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Check alert thresholds and return triggered alerts.
|
|
591
|
+
* Supports both value-based (AlertThreshold) and divergence-based (DivergenceAlertThreshold) alerts.
|
|
592
|
+
*
|
|
593
|
+
* @param values - Computed aggregation values
|
|
594
|
+
* @param thresholds - Alert thresholds to check (value and/or divergence)
|
|
595
|
+
* @param options - Optional enrichment data; `scores` required for divergence alerts
|
|
596
|
+
*/
|
|
597
|
+
export function checkAlertThresholds(values, thresholds, options) {
|
|
598
|
+
const triggered = [];
|
|
599
|
+
for (const threshold of thresholds) {
|
|
600
|
+
// Divergence alert — requires raw scores
|
|
601
|
+
if ('type' in threshold && threshold.type === 'divergence') {
|
|
602
|
+
if (options?.scores) {
|
|
603
|
+
const alert = checkDivergenceAlert(options.scores, threshold);
|
|
604
|
+
if (alert)
|
|
605
|
+
triggered.push(alert);
|
|
606
|
+
}
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
// Value alert (existing behavior) — narrowed from union after divergence guard
|
|
610
|
+
const vt = threshold;
|
|
611
|
+
const value = values[vt.aggregation];
|
|
612
|
+
if (value === null)
|
|
613
|
+
continue;
|
|
614
|
+
// Strict inequality (> / <) for alerts — SLA uses >= for boundary compliance.
|
|
615
|
+
// This is intentional: alerts fire when value crosses threshold, SLA checks if target is met.
|
|
616
|
+
const isTriggered = vt.direction === 'above'
|
|
617
|
+
? value > vt.value
|
|
618
|
+
: value < vt.value;
|
|
619
|
+
if (isTriggered) {
|
|
620
|
+
const count = options?.sampleCount ?? values.count;
|
|
621
|
+
const affectedCount = typeof count === 'number' ? count : undefined;
|
|
622
|
+
triggered.push({
|
|
623
|
+
severity: vt.severity,
|
|
624
|
+
message: vt.message.replace('{value}', value.toFixed(SCORE_PRECISION)) +
|
|
625
|
+
(affectedCount != null ? ` (n=${affectedCount} evaluations)` : ''),
|
|
626
|
+
aggregation: vt.aggregation,
|
|
627
|
+
threshold: vt.value,
|
|
628
|
+
actualValue: value,
|
|
629
|
+
direction: vt.direction,
|
|
630
|
+
affectedCount,
|
|
631
|
+
remediationHints: options?.remediationHints ? [...options.remediationHints] : undefined,
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
// Sort by severity (critical > warning > info)
|
|
636
|
+
return sortAlertsBySeverity(triggered);
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Determine overall health status from triggered alerts.
|
|
640
|
+
*/
|
|
641
|
+
export function determineHealthStatus(alerts, hasData) {
|
|
642
|
+
if (!hasData)
|
|
643
|
+
return 'no_data';
|
|
644
|
+
if (alerts.some(a => a.severity === 'critical'))
|
|
645
|
+
return 'critical';
|
|
646
|
+
if (alerts.some(a => a.severity === 'warning'))
|
|
647
|
+
return 'warning';
|
|
648
|
+
return 'healthy';
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Compute a single quality metric from evaluation results.
|
|
652
|
+
* @param evaluations - Evaluation results filtered by metric name
|
|
653
|
+
* @param config - Metric configuration
|
|
654
|
+
* @param period - Optional time period
|
|
655
|
+
* @param previousValues - Optional previous period aggregation values for trend computation
|
|
656
|
+
*/
|
|
657
|
+
export function computeQualityMetric(evaluations, config, period, previousValues) {
|
|
658
|
+
// Extract scored evaluations, filtering null/undefined and non-finite values (NaN, Infinity)
|
|
659
|
+
const scored = evaluations
|
|
660
|
+
.filter((e) => e.scoreValue !== undefined && e.scoreValue !== null);
|
|
661
|
+
const scores = scored.map(e => e.scoreValue).filter((v) => Number.isFinite(v));
|
|
662
|
+
// Compute aggregations
|
|
663
|
+
const values = computeAggregations(scores, config.aggregations);
|
|
664
|
+
// Check alerts (pass raw scores for divergence detection)
|
|
665
|
+
const alerts = checkAlertThresholds(values, config.alerts, {
|
|
666
|
+
sampleCount: scores.length,
|
|
667
|
+
remediationHints: config.remediationHints,
|
|
668
|
+
scores,
|
|
669
|
+
});
|
|
670
|
+
// Determine status
|
|
671
|
+
const status = determineHealthStatus(alerts, scores.length > 0);
|
|
672
|
+
// Find worst-performing evaluation for drill-down
|
|
673
|
+
let worstExplanation;
|
|
674
|
+
if (scored.length > 0) {
|
|
675
|
+
const worst = scored.reduce((min, e) => e.scoreValue < min.scoreValue ? e : min);
|
|
676
|
+
worstExplanation = {
|
|
677
|
+
score: worst.scoreValue,
|
|
678
|
+
explanation: worst.explanation,
|
|
679
|
+
traceId: worst.traceId,
|
|
680
|
+
timestamp: worst.timestamp,
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
// Compute trend if previous period data is available
|
|
684
|
+
const trend = previousValues ? computeTrend(values, previousValues, config) : undefined;
|
|
685
|
+
// Compute confidence indicator from evaluation data
|
|
686
|
+
const confidence = scored.length > 0 ? computeConfidence(evaluations, undefined, config.range) : undefined;
|
|
687
|
+
return {
|
|
688
|
+
name: config.name,
|
|
689
|
+
displayName: config.displayName,
|
|
690
|
+
values,
|
|
691
|
+
sampleCount: scores.length,
|
|
692
|
+
alerts,
|
|
693
|
+
status,
|
|
694
|
+
period,
|
|
695
|
+
worstExplanation,
|
|
696
|
+
trend,
|
|
697
|
+
confidence,
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Compute dashboard summary for all quality metrics.
|
|
702
|
+
* @param evaluationsByMetric - Map of metric name to evaluation results
|
|
703
|
+
* @param customMetrics - Optional custom metric configurations to include
|
|
704
|
+
* @param period - Optional time period
|
|
705
|
+
* @param slas - Optional SLA definitions to evaluate
|
|
706
|
+
* @param previousPeriodValues - Optional previous period aggregation values per metric for trend computation
|
|
707
|
+
*/
|
|
708
|
+
export function computeDashboardSummary(evaluationsByMetric, customMetrics, period, slas, previousPeriodValues) {
|
|
709
|
+
const allMetrics = { ...QUALITY_METRICS, ...customMetrics };
|
|
710
|
+
const results = [];
|
|
711
|
+
const allAlerts = [];
|
|
712
|
+
for (const [name, config] of Object.entries(allMetrics)) {
|
|
713
|
+
const evaluations = evaluationsByMetric.get(name) || [];
|
|
714
|
+
const prevValues = previousPeriodValues?.get(name);
|
|
715
|
+
const result = computeQualityMetric(evaluations, config, period, prevValues);
|
|
716
|
+
results.push(result);
|
|
717
|
+
// Collect alerts with metric name
|
|
718
|
+
for (const alert of result.alerts) {
|
|
719
|
+
allAlerts.push({ ...alert, metricName: name });
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
// Evaluate correlation rules for compound alerts
|
|
723
|
+
const correlationRules = getCorrelationRules();
|
|
724
|
+
const compoundAlerts = evaluateCorrelationRules(results, correlationRules);
|
|
725
|
+
allAlerts.push(...compoundAlerts);
|
|
726
|
+
// Post-process: populate relatedMetrics on single-metric alerts
|
|
727
|
+
const alertingMetrics = [...new Set(allAlerts.map(a => a.metricName))];
|
|
728
|
+
for (const alert of allAlerts) {
|
|
729
|
+
if (!alert.isCompound) {
|
|
730
|
+
alert.relatedMetrics = alertingMetrics.filter(m => m !== alert.metricName);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
// Compute summary counts (single pass instead of 4 filter passes)
|
|
734
|
+
const summary = { totalMetrics: results.length, healthyMetrics: 0, warningMetrics: 0, criticalMetrics: 0, noDataMetrics: 0 };
|
|
735
|
+
for (const r of results) {
|
|
736
|
+
if (r.status === 'healthy')
|
|
737
|
+
summary.healthyMetrics++;
|
|
738
|
+
else if (r.status === 'warning')
|
|
739
|
+
summary.warningMetrics++;
|
|
740
|
+
else if (r.status === 'critical')
|
|
741
|
+
summary.criticalMetrics++;
|
|
742
|
+
else if (r.status === 'no_data')
|
|
743
|
+
summary.noDataMetrics++;
|
|
744
|
+
else {
|
|
745
|
+
const _exhaustive = r.status;
|
|
746
|
+
throw new Error(`Unhandled status: ${_exhaustive}`);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
// Determine overall status (compound alerts can upgrade severity)
|
|
750
|
+
let overallStatus = 'healthy';
|
|
751
|
+
const hasCriticalCompound = compoundAlerts.some(a => a.severity === 'critical');
|
|
752
|
+
const hasWarningCompound = compoundAlerts.some(a => a.severity === 'warning');
|
|
753
|
+
if (summary.criticalMetrics > 0 || hasCriticalCompound) {
|
|
754
|
+
overallStatus = 'critical';
|
|
755
|
+
}
|
|
756
|
+
else if (summary.warningMetrics > 0 || hasWarningCompound) {
|
|
757
|
+
overallStatus = 'warning';
|
|
758
|
+
}
|
|
759
|
+
else if (summary.noDataMetrics === summary.totalMetrics) {
|
|
760
|
+
overallStatus = 'no_data';
|
|
761
|
+
}
|
|
762
|
+
// Evaluate SLAs if definitions provided
|
|
763
|
+
const slaEval = slas?.length ? evaluateSLAs(slas, results) : undefined;
|
|
764
|
+
const slaCompliance = slaEval?.results;
|
|
765
|
+
return {
|
|
766
|
+
overallStatus,
|
|
767
|
+
metrics: results,
|
|
768
|
+
alerts: allAlerts,
|
|
769
|
+
summary,
|
|
770
|
+
slaCompliance,
|
|
771
|
+
timestamp: new Date().toISOString(),
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
// ============================================================================
|
|
775
|
+
// Metric Registration
|
|
776
|
+
// ============================================================================
|
|
777
|
+
/**
|
|
778
|
+
* Registry for custom quality metrics.
|
|
779
|
+
*/
|
|
780
|
+
const customMetricRegistry = new Map();
|
|
781
|
+
/**
|
|
782
|
+
* Register a custom quality metric.
|
|
783
|
+
* @param config - Metric configuration
|
|
784
|
+
* @throws If metric with same name already exists
|
|
785
|
+
*/
|
|
786
|
+
export function registerQualityMetric(config) {
|
|
787
|
+
// Validate config
|
|
788
|
+
qualityMetricConfigSchema.parse(config);
|
|
789
|
+
if ((config.name in QUALITY_METRICS) || customMetricRegistry.has(config.name)) {
|
|
790
|
+
throw new Error(`Quality metric '${config.name}' already exists`);
|
|
791
|
+
}
|
|
792
|
+
customMetricRegistry.set(config.name, config);
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Check if a quality metric exists (built-in or custom).
|
|
796
|
+
* @param name - Metric name
|
|
797
|
+
* @returns true if metric exists
|
|
798
|
+
*/
|
|
799
|
+
export function hasQualityMetric(name) {
|
|
800
|
+
return name in QUALITY_METRICS || customMetricRegistry.has(name);
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Unregister a custom quality metric.
|
|
804
|
+
* @param name - Metric name
|
|
805
|
+
* @returns true if metric was removed
|
|
806
|
+
*/
|
|
807
|
+
export function unregisterQualityMetric(name) {
|
|
808
|
+
return customMetricRegistry.delete(name);
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Get all registered quality metrics (built-in + custom).
|
|
812
|
+
* @returns Combined record of built-in and custom metric configs
|
|
813
|
+
*/
|
|
814
|
+
export function getAllQualityMetrics() {
|
|
815
|
+
return {
|
|
816
|
+
...QUALITY_METRICS,
|
|
817
|
+
...Object.fromEntries(customMetricRegistry),
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Get a specific quality metric configuration.
|
|
822
|
+
* @param name - Metric name
|
|
823
|
+
* @returns Metric config if found, undefined otherwise
|
|
824
|
+
*/
|
|
825
|
+
export function getQualityMetric(name) {
|
|
826
|
+
return (name in QUALITY_METRICS ? QUALITY_METRICS[name] : undefined) || customMetricRegistry.get(name);
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Clear all custom metrics (for testing).
|
|
830
|
+
* @internal
|
|
831
|
+
*/
|
|
832
|
+
export function clearCustomMetrics() {
|
|
833
|
+
customMetricRegistry.clear();
|
|
834
|
+
}
|
|
835
|
+
// ============================================================================
|
|
836
|
+
// Correlation Rule Registry
|
|
837
|
+
// ============================================================================
|
|
838
|
+
const correlationRuleRegistry = new Map();
|
|
839
|
+
/**
|
|
840
|
+
* Default correlation rules matching the 3 patterns from the UX review.
|
|
841
|
+
*/
|
|
842
|
+
const _defaultRules = [
|
|
843
|
+
{
|
|
844
|
+
name: 'content_quality_crisis',
|
|
845
|
+
displayName: 'Content Quality Crisis',
|
|
846
|
+
conditions: [
|
|
847
|
+
{ metric: 'relevance', aggregation: 'p50', value: RELEVANCE_WARNING, direction: 'below' },
|
|
848
|
+
{ metric: 'hallucination', aggregation: 'avg', value: HALLUCINATION_WARNING, direction: 'above' },
|
|
849
|
+
],
|
|
850
|
+
severity: 'critical',
|
|
851
|
+
explanation: 'Low relevance combined with high hallucination indicates responses are both off-topic and factually unreliable. This combination warrants immediate investigation of prompt quality and grounding context.',
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
name: 'agent_reliability_failure',
|
|
855
|
+
displayName: 'Agent Reliability Failure',
|
|
856
|
+
conditions: [
|
|
857
|
+
{ metric: 'task_completion', aggregation: 'avg', value: TASK_COMPLETION_WARNING, direction: 'below' },
|
|
858
|
+
{ metric: 'tool_correctness', aggregation: 'avg', value: TOOL_CORRECTNESS_RELIABILITY_FLOOR, direction: 'below' },
|
|
859
|
+
],
|
|
860
|
+
severity: 'critical',
|
|
861
|
+
explanation: 'Low task completion with poor tool selection indicates the agent is both choosing wrong tools and failing to complete tasks. Check tool descriptions and agent planning prompts.',
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
name: 'response_degradation',
|
|
865
|
+
displayName: 'Response Degradation',
|
|
866
|
+
conditions: [
|
|
867
|
+
{ metric: 'faithfulness', aggregation: 'p50', value: FAITHFULNESS_WARNING, direction: 'below' },
|
|
868
|
+
{ metric: 'coherence', aggregation: 'p50', value: COHERENCE_WARNING, direction: 'below' },
|
|
869
|
+
],
|
|
870
|
+
severity: 'warning',
|
|
871
|
+
explanation: 'Below-threshold faithfulness and coherence together suggest responses are both ungrounded and poorly structured. Review context retrieval pipeline and response formatting.',
|
|
872
|
+
},
|
|
873
|
+
];
|
|
874
|
+
/** Immutable default correlation rules. */
|
|
875
|
+
export const DEFAULT_CORRELATION_RULES = Object.freeze(_defaultRules);
|
|
876
|
+
/**
|
|
877
|
+
* Register a correlation rule.
|
|
878
|
+
* @throws If rule with same name exists or validation fails
|
|
879
|
+
*/
|
|
880
|
+
export function registerCorrelationRule(rule) {
|
|
881
|
+
metricCorrelationRuleSchema.parse(rule);
|
|
882
|
+
if (correlationRuleRegistry.has(rule.name) ||
|
|
883
|
+
DEFAULT_CORRELATION_RULES.some(r => r.name === rule.name)) {
|
|
884
|
+
throw new Error(`Correlation rule '${rule.name}' already exists`);
|
|
885
|
+
}
|
|
886
|
+
correlationRuleRegistry.set(rule.name, rule);
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Unregister a custom correlation rule.
|
|
890
|
+
*/
|
|
891
|
+
export function unregisterCorrelationRule(name) {
|
|
892
|
+
return correlationRuleRegistry.delete(name);
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Get all correlation rules (defaults + custom).
|
|
896
|
+
*/
|
|
897
|
+
export function getCorrelationRules() {
|
|
898
|
+
return [...DEFAULT_CORRELATION_RULES, ...correlationRuleRegistry.values()];
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Clear all custom correlation rules (for testing).
|
|
902
|
+
* @internal
|
|
903
|
+
*/
|
|
904
|
+
export function clearCorrelationRules() {
|
|
905
|
+
correlationRuleRegistry.clear();
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Check whether a single condition is met against a set of metric results.
|
|
909
|
+
* @internal Extracted to avoid duplication between standard and temporal evaluation paths.
|
|
910
|
+
*/
|
|
911
|
+
function checkConditionValue(cond, resultsByName) {
|
|
912
|
+
const metricResult = resultsByName.get(cond.metric);
|
|
913
|
+
if (!metricResult)
|
|
914
|
+
return false;
|
|
915
|
+
const value = metricResult.values[cond.aggregation];
|
|
916
|
+
if (value == null || !Number.isFinite(value))
|
|
917
|
+
return false;
|
|
918
|
+
return cond.direction === 'above' ? value > cond.value : value < cond.value;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Format a single correlation condition for display in a compound alert message.
|
|
922
|
+
* Resolves the value from the temporal source (window or sustained) when applicable.
|
|
923
|
+
* @internal
|
|
924
|
+
*/
|
|
925
|
+
function formatConditionSummaryEntry(cond, resultsByName, previousByWindow) {
|
|
926
|
+
let source = resultsByName;
|
|
927
|
+
let suffix = '';
|
|
928
|
+
if (cond.sustainedPeriods !== undefined) {
|
|
929
|
+
suffix = `[sustained ${cond.sustainedPeriods}p]`;
|
|
930
|
+
}
|
|
931
|
+
else if (cond.window) {
|
|
932
|
+
const windowSource = previousByWindow.get(cond.window);
|
|
933
|
+
if (windowSource) {
|
|
934
|
+
source = windowSource;
|
|
935
|
+
suffix = `[${cond.window}]`;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
const value = source.get(cond.metric)?.values[cond.aggregation];
|
|
939
|
+
return `${cond.metric}.${cond.aggregation}${suffix}=${value?.toFixed(SCORE_PRECISION)}`;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Evaluate correlation rules against computed metric results.
|
|
943
|
+
* Returns compound alerts for rules where all conditions match.
|
|
944
|
+
*
|
|
945
|
+
* When `previousResults` is provided, conditions with temporal fields are evaluated:
|
|
946
|
+
* - `window`: condition checks the metric value from the previous-period result whose
|
|
947
|
+
* window label matches the condition's window (falls back to current results).
|
|
948
|
+
* - `sustainedPeriods`: condition must hold in N consecutive previous result sets
|
|
949
|
+
* (most recent first). If fewer than N periods are available, the condition is not met.
|
|
950
|
+
*
|
|
951
|
+
* @param results - Current period metric results
|
|
952
|
+
* @param rules - Correlation rules to evaluate
|
|
953
|
+
* @param previousResults - Optional ordered array of previous-period results (most recent first).
|
|
954
|
+
* Each entry is tagged with a `window` label indicating its time range.
|
|
955
|
+
*/
|
|
956
|
+
export function evaluateCorrelationRules(results, rules, previousResults) {
|
|
957
|
+
const compoundAlerts = [];
|
|
958
|
+
const resultsByName = new Map(results.map(r => [r.name, r]));
|
|
959
|
+
// Pre-index previous results by window label
|
|
960
|
+
const previousByWindow = new Map((previousResults ?? []).map(p => [p.window, new Map(p.results.map(r => [r.name, r]))]));
|
|
961
|
+
for (const rule of rules) {
|
|
962
|
+
const allMatch = rule.conditions.every(cond => {
|
|
963
|
+
// --- Sustained periods check (Zod enforces min(1); > 0 guard handles direct construction) ---
|
|
964
|
+
if (cond.sustainedPeriods !== undefined) {
|
|
965
|
+
if (!previousResults || previousResults.length < cond.sustainedPeriods)
|
|
966
|
+
return false;
|
|
967
|
+
// Current period must match
|
|
968
|
+
if (!checkConditionValue(cond, resultsByName))
|
|
969
|
+
return false;
|
|
970
|
+
// Check N most-recent previous periods
|
|
971
|
+
let sustained = 0;
|
|
972
|
+
for (const prev of previousResults) {
|
|
973
|
+
const prevByName = previousByWindow.get(prev.window);
|
|
974
|
+
if (!prevByName || !checkConditionValue(cond, prevByName))
|
|
975
|
+
break;
|
|
976
|
+
sustained++;
|
|
977
|
+
if (sustained >= cond.sustainedPeriods)
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
return sustained >= cond.sustainedPeriods;
|
|
981
|
+
}
|
|
982
|
+
// --- Window check ---
|
|
983
|
+
if (cond.window) {
|
|
984
|
+
const windowResults = previousByWindow.get(cond.window);
|
|
985
|
+
if (windowResults) {
|
|
986
|
+
return checkConditionValue(cond, windowResults);
|
|
987
|
+
}
|
|
988
|
+
// Fall back to current results if window not found
|
|
989
|
+
}
|
|
990
|
+
// --- Standard (non-temporal) check ---
|
|
991
|
+
return checkConditionValue(cond, resultsByName);
|
|
992
|
+
});
|
|
993
|
+
if (allMatch) {
|
|
994
|
+
const conditionSummary = rule.conditions
|
|
995
|
+
.map(c => formatConditionSummaryEntry(c, resultsByName, previousByWindow))
|
|
996
|
+
.join(', ');
|
|
997
|
+
// Compound alerts use the first condition's aggregation/direction for interface compliance.
|
|
998
|
+
// Actual condition details are in the message and relatedMetrics fields.
|
|
999
|
+
const firstCond = rule.conditions[0];
|
|
1000
|
+
const firstValue = resultsByName.get(firstCond.metric)?.values[firstCond.aggregation] ?? 0;
|
|
1001
|
+
compoundAlerts.push({
|
|
1002
|
+
severity: rule.severity,
|
|
1003
|
+
message: `${rule.displayName}: ${conditionSummary}`,
|
|
1004
|
+
aggregation: firstCond.aggregation,
|
|
1005
|
+
threshold: firstCond.value,
|
|
1006
|
+
actualValue: firstValue,
|
|
1007
|
+
direction: firstCond.direction,
|
|
1008
|
+
isCompound: true,
|
|
1009
|
+
remediationHints: [rule.explanation],
|
|
1010
|
+
relatedMetrics: rule.conditions.map(c => c.metric),
|
|
1011
|
+
metricName: rule.name,
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
return compoundAlerts;
|
|
1016
|
+
}
|
|
1017
|
+
// ============================================================================
|
|
1018
|
+
// Submodule Barrel Re-exports
|
|
1019
|
+
// ============================================================================
|
|
1020
|
+
export { evaluateHandoffs, computeTurnLevelResults, computeMultiAgentEvaluation } from './quality-multi-agent.js';
|
|
1021
|
+
export { computeRoleView, computeMetricDetail, toEvaluationDetail, scoreDistributionEntrySchema, evaluationSnapshotSchema, metricDetailFieldsSchema, evaluationDetailResultSchema, roleViewOptionsSchema } from './quality-views.js';
|
|
1022
|
+
export { applySeverityContext } from './quality-alerts.js';
|
|
1023
|
+
export { evaluateSLA, evaluateSLAs } from './quality-sla.js';
|
|
1024
|
+
export { computeConfidence, computeTrend } from './quality-trends.js';
|
|
1025
|
+
export { computePipelineView, computeCoverageHeatmap } from './quality-visualization.js';
|
|
1026
|
+
export { scoreColorBand, adaptiveScoreColorBand, empiricalCDF, inferScoreDirection, labelToOrdinal, ordinalToCategory, computeCQI, computeCQISensitivity, DEFAULT_CQI_WEIGHTS, computeMetricDynamics, computeCoverageWeightedConfidence, computeNormalizedEntropy, computeDegradationSignal, computeEWMA, computeMAD, detectEWMADrift, VARIANCE_INCREASE_THRESHOLD, EWMA_LAMBDA, computePearsonR, computeSpearmanR, computeCorrelationMatrix, pearsonPValue, benjaminiHochberg, getRoleFeatureConfig, roleFeatureConfigSchema, METRIC_SCALE_STRATEGY, } from './quality-feature-engineering.js';
|
|
1027
|
+
// ============================================================================
|
|
1028
|
+
// Utility Functions
|
|
1029
|
+
// ============================================================================
|
|
1030
|
+
/**
|
|
1031
|
+
* Format metric value for display.
|
|
1032
|
+
* @param value - Numeric value
|
|
1033
|
+
* @param unit - Unit type
|
|
1034
|
+
* @returns Formatted string (e.g., "85.0%", "1.23s", "0.8500")
|
|
1035
|
+
*/
|
|
1036
|
+
export function formatMetricValue(value, unit) {
|
|
1037
|
+
if (value === null)
|
|
1038
|
+
return 'N/A';
|
|
1039
|
+
switch (unit) {
|
|
1040
|
+
case 'percentage':
|
|
1041
|
+
case 'rate':
|
|
1042
|
+
return `${(value * QUALITY_PERCENT_SCALE).toFixed(1)}%`;
|
|
1043
|
+
case 'seconds':
|
|
1044
|
+
return `${value.toFixed(PERCENT_PRECISION)}s`;
|
|
1045
|
+
case 'score':
|
|
1046
|
+
default:
|
|
1047
|
+
return value.toFixed(SCORE_PRECISION);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Create a custom metric configuration builder.
|
|
1052
|
+
* @param name - Metric name
|
|
1053
|
+
* @returns Fluent builder for constructing QualityMetricConfig
|
|
1054
|
+
*/
|
|
1055
|
+
export function createMetricConfig(name) {
|
|
1056
|
+
return new MetricConfigBuilder(name);
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Fluent builder for QualityMetricConfig.
|
|
1060
|
+
*/
|
|
1061
|
+
export class MetricConfigBuilder {
|
|
1062
|
+
config;
|
|
1063
|
+
constructor(name) {
|
|
1064
|
+
this.config = {
|
|
1065
|
+
name,
|
|
1066
|
+
aggregations: ['avg', 'count'],
|
|
1067
|
+
alerts: [],
|
|
1068
|
+
range: UNIT_RANGE,
|
|
1069
|
+
unit: 'score',
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
displayName(name) {
|
|
1073
|
+
this.config.displayName = name;
|
|
1074
|
+
return this;
|
|
1075
|
+
}
|
|
1076
|
+
description(desc) {
|
|
1077
|
+
this.config.description = desc;
|
|
1078
|
+
return this;
|
|
1079
|
+
}
|
|
1080
|
+
aggregations(...aggs) {
|
|
1081
|
+
this.config.aggregations = aggs;
|
|
1082
|
+
return this;
|
|
1083
|
+
}
|
|
1084
|
+
range(min, max) {
|
|
1085
|
+
this.config.range = { min, max };
|
|
1086
|
+
return this;
|
|
1087
|
+
}
|
|
1088
|
+
unit(unit) {
|
|
1089
|
+
this.config.unit = unit;
|
|
1090
|
+
return this;
|
|
1091
|
+
}
|
|
1092
|
+
alertBelow(aggregation, value, severity, message) {
|
|
1093
|
+
(this.config.alerts ??= []).push({
|
|
1094
|
+
aggregation,
|
|
1095
|
+
value,
|
|
1096
|
+
direction: 'below',
|
|
1097
|
+
severity,
|
|
1098
|
+
message: message || `${this.config.name} ${aggregation} ({value}) below ${value} threshold`,
|
|
1099
|
+
});
|
|
1100
|
+
return this;
|
|
1101
|
+
}
|
|
1102
|
+
remediationHints(...hints) {
|
|
1103
|
+
this.config.remediationHints = hints;
|
|
1104
|
+
return this;
|
|
1105
|
+
}
|
|
1106
|
+
alertAbove(aggregation, value, severity, message) {
|
|
1107
|
+
(this.config.alerts ??= []).push({
|
|
1108
|
+
aggregation,
|
|
1109
|
+
value,
|
|
1110
|
+
direction: 'above',
|
|
1111
|
+
severity,
|
|
1112
|
+
message: message || `${this.config.name} ${aggregation} ({value}) above ${value} threshold`,
|
|
1113
|
+
});
|
|
1114
|
+
return this;
|
|
1115
|
+
}
|
|
1116
|
+
divergenceAlert(entropyThreshold, severity, message, bins = DEFAULT_BIN_COUNT) {
|
|
1117
|
+
(this.config.alerts ??= []).push({
|
|
1118
|
+
type: 'divergence',
|
|
1119
|
+
entropyThreshold,
|
|
1120
|
+
bins,
|
|
1121
|
+
severity,
|
|
1122
|
+
message: message || `${this.config.name} score distribution is bimodal (entropy {entropy})`,
|
|
1123
|
+
});
|
|
1124
|
+
return this;
|
|
1125
|
+
}
|
|
1126
|
+
sla(aggregation, target, direction = 'above', window) {
|
|
1127
|
+
if (!this.config.name) {
|
|
1128
|
+
throw new Error('MetricConfigBuilder: name is required before defining an SLA');
|
|
1129
|
+
}
|
|
1130
|
+
return {
|
|
1131
|
+
metric: this.config.name,
|
|
1132
|
+
aggregation,
|
|
1133
|
+
target,
|
|
1134
|
+
direction,
|
|
1135
|
+
window,
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
build() {
|
|
1139
|
+
if (!this.config.name)
|
|
1140
|
+
throw new Error('MetricConfigBuilder: name is required');
|
|
1141
|
+
if (!this.config.aggregations || this.config.aggregations.length === 0) {
|
|
1142
|
+
throw new Error('MetricConfigBuilder: at least one aggregation is required');
|
|
1143
|
+
}
|
|
1144
|
+
if (!this.config.range)
|
|
1145
|
+
throw new Error('MetricConfigBuilder: range is required');
|
|
1146
|
+
this.config.displayName ??= this.config.name;
|
|
1147
|
+
this.config.description ??= `Quality metric: ${this.config.name}`;
|
|
1148
|
+
return this.config;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
//# sourceMappingURL=quality-metrics.js.map
|