@absolutejs/voice 0.0.22-beta.251 → 0.0.22-beta.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +78 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +223 -0
- package/dist/observabilityExport.d.ts +53 -0
- package/dist/proofTrends.d.ts +25 -0
- package/dist/react/index.js +78 -0
- package/dist/vue/index.js +78 -0
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -3000,6 +3000,84 @@ var readVoiceProofTrendReportFile = async (path, options = {}) => {
|
|
|
3000
3000
|
});
|
|
3001
3001
|
}
|
|
3002
3002
|
};
|
|
3003
|
+
var maxNumber = (values) => {
|
|
3004
|
+
const finite = values.filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
3005
|
+
return finite.length > 0 ? Math.max(...finite) : undefined;
|
|
3006
|
+
};
|
|
3007
|
+
var readProofTrendMaxLiveP95 = (report) => report.summary.maxLiveP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.liveLatency?.p95Ms));
|
|
3008
|
+
var readProofTrendMaxProviderP95 = (report) => report.summary.maxProviderP95Ms;
|
|
3009
|
+
var readProofTrendMaxTurnP95 = (report) => report.summary.maxTurnP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.turnLatency?.p95Ms));
|
|
3010
|
+
var evaluateVoiceProofTrendEvidence = (report, input = {}) => {
|
|
3011
|
+
const issues = [];
|
|
3012
|
+
const requiredStatus = input.requireStatus ?? "pass";
|
|
3013
|
+
const minCycles = input.minCycles ?? 1;
|
|
3014
|
+
const requireAllCyclesOk = input.requireAllCyclesOk ?? true;
|
|
3015
|
+
const cycles = report.summary.cycles ?? report.cycles.length;
|
|
3016
|
+
const failedCycles = report.cycles.filter((cycle) => cycle.ok !== true).length;
|
|
3017
|
+
const maxLiveP95Ms = readProofTrendMaxLiveP95(report);
|
|
3018
|
+
const maxProviderP95Ms = readProofTrendMaxProviderP95(report);
|
|
3019
|
+
const maxTurnP95Ms = readProofTrendMaxTurnP95(report);
|
|
3020
|
+
if (report.status !== requiredStatus) {
|
|
3021
|
+
issues.push(`Expected proof trends status ${requiredStatus}, found ${report.status}.`);
|
|
3022
|
+
}
|
|
3023
|
+
if (report.ok !== true) {
|
|
3024
|
+
issues.push("Expected proof trends ok to be true.");
|
|
3025
|
+
}
|
|
3026
|
+
if (cycles < minCycles) {
|
|
3027
|
+
issues.push(`Expected at least ${String(minCycles)} proof trend cycle(s), found ${String(cycles)}.`);
|
|
3028
|
+
}
|
|
3029
|
+
if (requireAllCyclesOk && failedCycles > 0) {
|
|
3030
|
+
issues.push(`Expected all proof trend cycles to pass, found ${String(failedCycles)} failing cycle(s).`);
|
|
3031
|
+
}
|
|
3032
|
+
if (input.maxAgeMs !== undefined && (report.ageMs === undefined || report.ageMs > input.maxAgeMs)) {
|
|
3033
|
+
issues.push(report.ageMs === undefined ? "Missing proof trends artifact age." : `Expected proof trends age at most ${String(input.maxAgeMs)}ms, found ${String(report.ageMs)}ms.`);
|
|
3034
|
+
}
|
|
3035
|
+
if (input.maxLiveP95Ms !== undefined && (maxLiveP95Ms === undefined || maxLiveP95Ms > input.maxLiveP95Ms)) {
|
|
3036
|
+
issues.push(maxLiveP95Ms === undefined ? "Missing proof trends live latency p95." : `Expected proof trends live latency p95 at most ${String(input.maxLiveP95Ms)}ms, found ${String(maxLiveP95Ms)}ms.`);
|
|
3037
|
+
}
|
|
3038
|
+
if (input.maxProviderP95Ms !== undefined && (maxProviderP95Ms === undefined || maxProviderP95Ms > input.maxProviderP95Ms)) {
|
|
3039
|
+
issues.push(maxProviderP95Ms === undefined ? "Missing proof trends provider p95." : `Expected proof trends provider p95 at most ${String(input.maxProviderP95Ms)}ms, found ${String(maxProviderP95Ms)}ms.`);
|
|
3040
|
+
}
|
|
3041
|
+
if (input.maxTurnP95Ms !== undefined && (maxTurnP95Ms === undefined || maxTurnP95Ms > input.maxTurnP95Ms)) {
|
|
3042
|
+
issues.push(maxTurnP95Ms === undefined ? "Missing proof trends turn latency p95." : `Expected proof trends turn latency p95 at most ${String(input.maxTurnP95Ms)}ms, found ${String(maxTurnP95Ms)}ms.`);
|
|
3043
|
+
}
|
|
3044
|
+
if (input.minLiveLatencySamples !== undefined) {
|
|
3045
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.liveLatency?.samples ?? 0) < input.minLiveLatencySamples).length;
|
|
3046
|
+
if (lowSamples > 0) {
|
|
3047
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minLiveLatencySamples)} live latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
if (input.minProviderSloEventsWithLatency !== undefined) {
|
|
3051
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.providerSlo?.eventsWithLatency ?? 0) < input.minProviderSloEventsWithLatency).length;
|
|
3052
|
+
if (lowSamples > 0) {
|
|
3053
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minProviderSloEventsWithLatency)} provider latency event(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
if (input.minTurnLatencySamples !== undefined) {
|
|
3057
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.turnLatency?.samples ?? 0) < input.minTurnLatencySamples).length;
|
|
3058
|
+
if (lowSamples > 0) {
|
|
3059
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minTurnLatencySamples)} turn latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
return {
|
|
3063
|
+
ageMs: report.ageMs,
|
|
3064
|
+
cycles,
|
|
3065
|
+
failedCycles,
|
|
3066
|
+
issues,
|
|
3067
|
+
maxLiveP95Ms,
|
|
3068
|
+
maxProviderP95Ms,
|
|
3069
|
+
maxTurnP95Ms,
|
|
3070
|
+
ok: issues.length === 0,
|
|
3071
|
+
status: report.status
|
|
3072
|
+
};
|
|
3073
|
+
};
|
|
3074
|
+
var assertVoiceProofTrendEvidence = (report, input = {}) => {
|
|
3075
|
+
const assertion = evaluateVoiceProofTrendEvidence(report, input);
|
|
3076
|
+
if (!assertion.ok) {
|
|
3077
|
+
throw new Error(`Voice proof trends assertion failed: ${assertion.issues.join(" ")}`);
|
|
3078
|
+
}
|
|
3079
|
+
return assertion;
|
|
3080
|
+
};
|
|
3003
3081
|
var createVoiceProofTrendRoutes = (options) => {
|
|
3004
3082
|
const path = options.path ?? "/api/voice/proof-trends";
|
|
3005
3083
|
const routes = new Elysia({
|
package/dist/index.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export { buildVoiceDeliverySinkReport, createVoiceDeliverySinkDescriptor, create
|
|
|
16
16
|
export { buildVoiceOpsActionHistoryReport, createVoiceOpsActionAuditRoutes, recordVoiceOpsActionAudit, renderVoiceOpsActionHistoryHTML } from './opsActionAuditRoutes';
|
|
17
17
|
export { assertVoicePlatformCoverage, buildVoicePlatformCoverageSummary, createVoicePlatformCoverageRoutes, evaluateVoicePlatformCoverage } from './platformCoverage';
|
|
18
18
|
export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
|
|
19
|
-
export { buildEmptyVoiceProofTrendReport, buildVoiceProofTrendReport, createVoiceProofTrendRoutes, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile } from './proofTrends';
|
|
20
|
-
export type { VoiceProofTrendCycle, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendStatus, VoiceProofTrendSummary } from './proofTrends';
|
|
19
|
+
export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendReport, createVoiceProofTrendRoutes, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile } from './proofTrends';
|
|
20
|
+
export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendStatus, VoiceProofTrendSummary } from './proofTrends';
|
|
21
21
|
export { buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
|
|
22
22
|
export type { VoiceLiveOpsAction, VoiceLiveOpsActionInput, VoiceLiveOpsActionResult, VoiceLiveOpsControllerOptions, VoiceLiveOpsControlState, VoiceLiveOpsControlStatus, VoiceLiveOpsControlStore, VoiceLiveOpsRoutesOptions } from './liveOps';
|
|
23
23
|
export { buildVoiceDeliveryRuntimeReport, createVoiceDeliveryRuntime, createVoiceDeliveryRuntimePresetConfig, createVoiceDeliveryRuntimeRoutes, renderVoiceDeliveryRuntimeHTML } from './deliveryRuntime';
|
|
@@ -57,7 +57,7 @@ export { createVoiceReadinessProfile, recommendVoiceReadinessProfile } from './r
|
|
|
57
57
|
export { buildVoiceProviderContractMatrix, createVoiceProviderContractMatrixHTMLHandler, createVoiceProviderContractMatrixJSONHandler, createVoiceProviderContractMatrixPreset, createVoiceProviderContractMatrixRoutes, evaluateVoiceProviderStackGaps, renderVoiceProviderContractMatrixHTML, recommendVoiceProviderStack } from './providerStackRecommendations';
|
|
58
58
|
export { buildVoiceOpsConsoleReport, createVoiceOpsConsoleRoutes, renderVoiceOpsConsoleHTML } from './opsConsoleRoutes';
|
|
59
59
|
export { assertVoiceOperationsRecordGuardrails, buildVoiceOperationsRecord, createVoiceOperationsRecordRoutes, evaluateVoiceOperationsRecordGuardrails, renderVoiceOperationsRecordGuardrailMarkdown, renderVoiceOperationsRecordHTML, renderVoiceOperationsRecordIncidentMarkdown } from './operationsRecord';
|
|
60
|
-
export { assertVoiceObservabilityExportRecord, buildVoiceObservabilityArtifactIndex, buildVoiceObservabilityExportDeliveryHistory, buildVoiceObservabilityExportReplayReport, buildVoiceObservabilityExport, assertVoiceObservabilityExportSchema, createVoiceObservabilityExportSchema, createVoiceFileObservabilityExportDeliveryReceiptStore, createVoiceMemoryObservabilityExportDeliveryReceiptStore, createVoiceObservabilityExportRoutes, createVoiceObservabilityExportReplayRoutes, deliverVoiceObservabilityExport, loadVoiceObservabilityExportReplaySource, replayVoiceObservabilityExport, renderVoiceObservabilityExportReplayHTML, renderVoiceObservabilityExportMarkdown, validateVoiceObservabilityExportRecord, voiceObservabilityExportSchemaId, voiceObservabilityExportSchemaVersion } from './observabilityExport';
|
|
60
|
+
export { assertVoiceObservabilityExportDeliveryEvidence, assertVoiceObservabilityExportRecord, assertVoiceObservabilityExportReplayEvidence, buildVoiceObservabilityArtifactIndex, buildVoiceObservabilityExportDeliveryHistory, buildVoiceObservabilityExportReplayReport, buildVoiceObservabilityExport, assertVoiceObservabilityExportSchema, createVoiceObservabilityExportSchema, createVoiceFileObservabilityExportDeliveryReceiptStore, createVoiceMemoryObservabilityExportDeliveryReceiptStore, createVoiceObservabilityExportRoutes, createVoiceObservabilityExportReplayRoutes, deliverVoiceObservabilityExport, evaluateVoiceObservabilityExportDeliveryEvidence, evaluateVoiceObservabilityExportReplayEvidence, loadVoiceObservabilityExportReplaySource, replayVoiceObservabilityExport, renderVoiceObservabilityExportReplayHTML, renderVoiceObservabilityExportMarkdown, validateVoiceObservabilityExportRecord, voiceObservabilityExportSchemaId, voiceObservabilityExportSchemaVersion } from './observabilityExport';
|
|
61
61
|
export { buildVoiceOpsRecoveryReadinessCheck, buildVoiceOpsRecoveryReport, createVoiceOpsRecoveryRoutes, renderVoiceOpsRecoveryHTML, renderVoiceOpsRecoveryMarkdown } from './opsRecovery';
|
|
62
62
|
export { buildVoiceIncidentBundle, createStoredVoiceIncidentBundleArtifact, createVoiceIncidentBundleRoutes, createVoiceMemoryIncidentBundleStore, pruneVoiceIncidentBundleArtifacts, saveVoiceIncidentBundleArtifact } from './incidentBundle';
|
|
63
63
|
export { summarizeVoiceOpsStatus } from './opsStatus';
|
|
@@ -124,7 +124,7 @@ export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptio
|
|
|
124
124
|
export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRecommendation, VoiceReadinessProfileRecommendationScore, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
|
|
125
125
|
export type { VoiceProviderStackChoice, VoiceProviderStackCapabilities, VoiceProviderStackCapabilityGap, VoiceProviderStackCapabilityGapInput, VoiceProviderStackCapabilityGapReport, VoiceProviderContractCheck, VoiceProviderContractCheckStatus, VoiceProviderContractDefinition, VoiceProviderContractMatrixHandlerOptions, VoiceProviderContractMatrixHTMLHandlerOptions, VoiceProviderContractMatrixInput, VoiceProviderContractMatrixPresetOptions, VoiceProviderContractMatrixReport, VoiceProviderContractMatrixRoutesOptions, VoiceProviderContractMatrixRow, VoiceProviderStackInput, VoiceProviderStackKind, VoiceProviderStackRecommendation } from './providerStackRecommendations';
|
|
126
126
|
export type { VoiceOperationsRecord, VoiceOperationsRecordAgentHandoff, VoiceOperationsRecordAuditSummary, VoiceOperationsRecordGuardrailAssertionInput, VoiceOperationsRecordGuardrailAssertionReport, VoiceOperationsRecordGuardrailDecision, VoiceOperationsRecordGuardrailFinding, VoiceOperationsRecordGuardrailSummary, VoiceOperationsRecordIntegrationEventSummary, VoiceOperationsRecordOptions, VoiceOperationsRecordOutcome, VoiceOperationsRecordProviderDecision, VoiceOperationsRecordReviewSummary, VoiceOperationsRecordRoutesOptions, VoiceOperationsRecordStatus, VoiceOperationsRecordTaskSummary, VoiceOperationsRecordTranscriptTurn, VoiceOperationsRecordTool } from './operationsRecord';
|
|
127
|
-
export type { VoiceObservabilityExportArtifact, VoiceObservabilityExportArtifactChecksum, VoiceObservabilityExportArtifactFreshness, VoiceObservabilityExportArtifactIndex, VoiceObservabilityExportArtifactIndexItem, VoiceObservabilityExportArtifactKind, VoiceObservabilityExportDeliverySummary, VoiceObservabilityExportDeliveryDestination, VoiceObservabilityExportDeliveryDestinationResult, VoiceObservabilityExportDeliveryHistory, VoiceObservabilityExportDeliveryOptions, VoiceObservabilityExportDeliveryReceipt, VoiceObservabilityExportDeliveryReceiptStore, VoiceObservabilityExportDeliveryReport, VoiceObservabilityExportEnvelope, VoiceObservabilityExportIssue, VoiceObservabilityExportIssueCode, VoiceObservabilityExportOptions, VoiceObservabilityExportIngestedRecordKind, VoiceObservabilityExportRedactionSummary, VoiceObservabilityExportRecordValidationOptions, VoiceObservabilityExportReplayIssue, VoiceObservabilityExportReplayIssueCode, VoiceObservabilityExportReplayRecords, VoiceObservabilityExportReplayReport, VoiceObservabilityExportReplayRoutesOptions, VoiceObservabilityExportReplaySource, VoiceObservabilityExportReport, VoiceObservabilityExportRoutesOptions, VoiceObservabilityExportSchema, VoiceObservabilityExportStatus, VoiceObservabilityExportValidationIssue, VoiceObservabilityExportValidationResult } from './observabilityExport';
|
|
127
|
+
export type { VoiceObservabilityExportArtifact, VoiceObservabilityExportArtifactChecksum, VoiceObservabilityExportArtifactFreshness, VoiceObservabilityExportArtifactIndex, VoiceObservabilityExportArtifactIndexItem, VoiceObservabilityExportArtifactKind, VoiceObservabilityExportDeliveryAssertionInput, VoiceObservabilityExportDeliveryAssertionReport, VoiceObservabilityExportDeliverySummary, VoiceObservabilityExportDeliveryDestination, VoiceObservabilityExportDeliveryDestinationResult, VoiceObservabilityExportDeliveryHistory, VoiceObservabilityExportDeliveryOptions, VoiceObservabilityExportDeliveryReceipt, VoiceObservabilityExportDeliveryReceiptStore, VoiceObservabilityExportDeliveryReport, VoiceObservabilityExportEnvelope, VoiceObservabilityExportIssue, VoiceObservabilityExportIssueCode, VoiceObservabilityExportOptions, VoiceObservabilityExportIngestedRecordKind, VoiceObservabilityExportRedactionSummary, VoiceObservabilityExportRecordValidationOptions, VoiceObservabilityExportReplayIssue, VoiceObservabilityExportReplayIssueCode, VoiceObservabilityExportReplayAssertionInput, VoiceObservabilityExportReplayAssertionReport, VoiceObservabilityExportReplayRecords, VoiceObservabilityExportReplayReport, VoiceObservabilityExportReplayRoutesOptions, VoiceObservabilityExportReplaySource, VoiceObservabilityExportReport, VoiceObservabilityExportRoutesOptions, VoiceObservabilityExportSchema, VoiceObservabilityExportStatus, VoiceObservabilityExportValidationIssue, VoiceObservabilityExportValidationResult } from './observabilityExport';
|
|
128
128
|
export type { VoiceOpsRecoveryFailedSession, VoiceOpsRecoveryInterventionSummary, VoiceOpsRecoveryIssue, VoiceOpsRecoveryIssueCode, VoiceOpsRecoveryLinks, VoiceOpsRecoveryProviderSummary, VoiceOpsRecoveryReport, VoiceOpsRecoveryReportOptions, VoiceOpsRecoveryRoutesOptions, VoiceOpsRecoveryStatus } from './opsRecovery';
|
|
129
129
|
export type { StoredVoiceIncidentBundleArtifact, VoiceIncidentBundle, VoiceIncidentBundleArtifactOptions, VoiceIncidentBundleFormat, VoiceIncidentBundleOptions, VoiceIncidentBundleRetentionOptions, VoiceIncidentBundleRetentionReport, VoiceIncidentBundleRoutesOptions, VoiceIncidentBundleStore, VoiceIncidentBundleStoreFilter, VoiceIncidentBundleSummary } from './incidentBundle';
|
|
130
130
|
export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQualityRoutesOptions, VoiceQualityStatus, VoiceQualityThresholds } from './qualityRoutes';
|
package/dist/index.js
CHANGED
|
@@ -12405,6 +12405,84 @@ var readVoiceProofTrendReportFile = async (path, options = {}) => {
|
|
|
12405
12405
|
});
|
|
12406
12406
|
}
|
|
12407
12407
|
};
|
|
12408
|
+
var maxNumber = (values) => {
|
|
12409
|
+
const finite = values.filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
12410
|
+
return finite.length > 0 ? Math.max(...finite) : undefined;
|
|
12411
|
+
};
|
|
12412
|
+
var readProofTrendMaxLiveP95 = (report) => report.summary.maxLiveP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.liveLatency?.p95Ms));
|
|
12413
|
+
var readProofTrendMaxProviderP95 = (report) => report.summary.maxProviderP95Ms;
|
|
12414
|
+
var readProofTrendMaxTurnP95 = (report) => report.summary.maxTurnP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.turnLatency?.p95Ms));
|
|
12415
|
+
var evaluateVoiceProofTrendEvidence = (report, input = {}) => {
|
|
12416
|
+
const issues = [];
|
|
12417
|
+
const requiredStatus = input.requireStatus ?? "pass";
|
|
12418
|
+
const minCycles = input.minCycles ?? 1;
|
|
12419
|
+
const requireAllCyclesOk = input.requireAllCyclesOk ?? true;
|
|
12420
|
+
const cycles = report.summary.cycles ?? report.cycles.length;
|
|
12421
|
+
const failedCycles = report.cycles.filter((cycle) => cycle.ok !== true).length;
|
|
12422
|
+
const maxLiveP95Ms = readProofTrendMaxLiveP95(report);
|
|
12423
|
+
const maxProviderP95Ms = readProofTrendMaxProviderP95(report);
|
|
12424
|
+
const maxTurnP95Ms = readProofTrendMaxTurnP95(report);
|
|
12425
|
+
if (report.status !== requiredStatus) {
|
|
12426
|
+
issues.push(`Expected proof trends status ${requiredStatus}, found ${report.status}.`);
|
|
12427
|
+
}
|
|
12428
|
+
if (report.ok !== true) {
|
|
12429
|
+
issues.push("Expected proof trends ok to be true.");
|
|
12430
|
+
}
|
|
12431
|
+
if (cycles < minCycles) {
|
|
12432
|
+
issues.push(`Expected at least ${String(minCycles)} proof trend cycle(s), found ${String(cycles)}.`);
|
|
12433
|
+
}
|
|
12434
|
+
if (requireAllCyclesOk && failedCycles > 0) {
|
|
12435
|
+
issues.push(`Expected all proof trend cycles to pass, found ${String(failedCycles)} failing cycle(s).`);
|
|
12436
|
+
}
|
|
12437
|
+
if (input.maxAgeMs !== undefined && (report.ageMs === undefined || report.ageMs > input.maxAgeMs)) {
|
|
12438
|
+
issues.push(report.ageMs === undefined ? "Missing proof trends artifact age." : `Expected proof trends age at most ${String(input.maxAgeMs)}ms, found ${String(report.ageMs)}ms.`);
|
|
12439
|
+
}
|
|
12440
|
+
if (input.maxLiveP95Ms !== undefined && (maxLiveP95Ms === undefined || maxLiveP95Ms > input.maxLiveP95Ms)) {
|
|
12441
|
+
issues.push(maxLiveP95Ms === undefined ? "Missing proof trends live latency p95." : `Expected proof trends live latency p95 at most ${String(input.maxLiveP95Ms)}ms, found ${String(maxLiveP95Ms)}ms.`);
|
|
12442
|
+
}
|
|
12443
|
+
if (input.maxProviderP95Ms !== undefined && (maxProviderP95Ms === undefined || maxProviderP95Ms > input.maxProviderP95Ms)) {
|
|
12444
|
+
issues.push(maxProviderP95Ms === undefined ? "Missing proof trends provider p95." : `Expected proof trends provider p95 at most ${String(input.maxProviderP95Ms)}ms, found ${String(maxProviderP95Ms)}ms.`);
|
|
12445
|
+
}
|
|
12446
|
+
if (input.maxTurnP95Ms !== undefined && (maxTurnP95Ms === undefined || maxTurnP95Ms > input.maxTurnP95Ms)) {
|
|
12447
|
+
issues.push(maxTurnP95Ms === undefined ? "Missing proof trends turn latency p95." : `Expected proof trends turn latency p95 at most ${String(input.maxTurnP95Ms)}ms, found ${String(maxTurnP95Ms)}ms.`);
|
|
12448
|
+
}
|
|
12449
|
+
if (input.minLiveLatencySamples !== undefined) {
|
|
12450
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.liveLatency?.samples ?? 0) < input.minLiveLatencySamples).length;
|
|
12451
|
+
if (lowSamples > 0) {
|
|
12452
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minLiveLatencySamples)} live latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
12453
|
+
}
|
|
12454
|
+
}
|
|
12455
|
+
if (input.minProviderSloEventsWithLatency !== undefined) {
|
|
12456
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.providerSlo?.eventsWithLatency ?? 0) < input.minProviderSloEventsWithLatency).length;
|
|
12457
|
+
if (lowSamples > 0) {
|
|
12458
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minProviderSloEventsWithLatency)} provider latency event(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
12459
|
+
}
|
|
12460
|
+
}
|
|
12461
|
+
if (input.minTurnLatencySamples !== undefined) {
|
|
12462
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.turnLatency?.samples ?? 0) < input.minTurnLatencySamples).length;
|
|
12463
|
+
if (lowSamples > 0) {
|
|
12464
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minTurnLatencySamples)} turn latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
12465
|
+
}
|
|
12466
|
+
}
|
|
12467
|
+
return {
|
|
12468
|
+
ageMs: report.ageMs,
|
|
12469
|
+
cycles,
|
|
12470
|
+
failedCycles,
|
|
12471
|
+
issues,
|
|
12472
|
+
maxLiveP95Ms,
|
|
12473
|
+
maxProviderP95Ms,
|
|
12474
|
+
maxTurnP95Ms,
|
|
12475
|
+
ok: issues.length === 0,
|
|
12476
|
+
status: report.status
|
|
12477
|
+
};
|
|
12478
|
+
};
|
|
12479
|
+
var assertVoiceProofTrendEvidence = (report, input = {}) => {
|
|
12480
|
+
const assertion = evaluateVoiceProofTrendEvidence(report, input);
|
|
12481
|
+
if (!assertion.ok) {
|
|
12482
|
+
throw new Error(`Voice proof trends assertion failed: ${assertion.issues.join(" ")}`);
|
|
12483
|
+
}
|
|
12484
|
+
return assertion;
|
|
12485
|
+
};
|
|
12408
12486
|
var createVoiceProofTrendRoutes = (options) => {
|
|
12409
12487
|
const path = options.path ?? "/api/voice/proof-trends";
|
|
12410
12488
|
const routes = new Elysia14({
|
|
@@ -23851,6 +23929,62 @@ var buildVoiceObservabilityExportReplayReport = (records) => {
|
|
|
23851
23929
|
}
|
|
23852
23930
|
};
|
|
23853
23931
|
};
|
|
23932
|
+
var evaluateVoiceObservabilityExportReplayEvidence = (report, input = {}) => {
|
|
23933
|
+
const issues = [];
|
|
23934
|
+
const requiredStatus = input.requireStatus ?? "pass";
|
|
23935
|
+
const maxIssues = input.maxIssues ?? 0;
|
|
23936
|
+
const maxValidationIssues = input.maxValidationIssues ?? 0;
|
|
23937
|
+
const maxFailedArtifacts = input.maxFailedArtifacts ?? 0;
|
|
23938
|
+
const maxFailedDeliveryDestinations = input.maxFailedDeliveryDestinations ?? 0;
|
|
23939
|
+
const minArtifacts = input.minArtifacts ?? 1;
|
|
23940
|
+
const minDeliveryDestinations = input.minDeliveryDestinations;
|
|
23941
|
+
const recordKinds = Object.values(report.records).map((record) => record?.kind).filter((kind) => Boolean(kind)).sort();
|
|
23942
|
+
if (report.status !== requiredStatus) {
|
|
23943
|
+
issues.push(`Expected observability export replay status ${requiredStatus}, found ${report.status}.`);
|
|
23944
|
+
}
|
|
23945
|
+
if (report.issues.length > maxIssues) {
|
|
23946
|
+
issues.push(`Expected at most ${String(maxIssues)} observability export replay issue(s), found ${String(report.issues.length)}.`);
|
|
23947
|
+
}
|
|
23948
|
+
if (report.summary.validationIssues > maxValidationIssues) {
|
|
23949
|
+
issues.push(`Expected at most ${String(maxValidationIssues)} observability export replay validation issue(s), found ${String(report.summary.validationIssues)}.`);
|
|
23950
|
+
}
|
|
23951
|
+
if (report.summary.failedArtifacts > maxFailedArtifacts) {
|
|
23952
|
+
issues.push(`Expected at most ${String(maxFailedArtifacts)} failed observability export artifact(s), found ${String(report.summary.failedArtifacts)}.`);
|
|
23953
|
+
}
|
|
23954
|
+
if (report.summary.failedDeliveryDestinations > maxFailedDeliveryDestinations) {
|
|
23955
|
+
issues.push(`Expected at most ${String(maxFailedDeliveryDestinations)} failed observability export delivery destination(s), found ${String(report.summary.failedDeliveryDestinations)}.`);
|
|
23956
|
+
}
|
|
23957
|
+
if (report.summary.artifacts < minArtifacts) {
|
|
23958
|
+
issues.push(`Expected at least ${String(minArtifacts)} replayed observability export artifact(s), found ${String(report.summary.artifacts)}.`);
|
|
23959
|
+
}
|
|
23960
|
+
if (minDeliveryDestinations !== undefined && report.summary.deliveryDestinations < minDeliveryDestinations) {
|
|
23961
|
+
issues.push(`Expected at least ${String(minDeliveryDestinations)} replayed observability export delivery destination(s), found ${String(report.summary.deliveryDestinations)}.`);
|
|
23962
|
+
}
|
|
23963
|
+
for (const recordKind of input.requiredRecordKinds ?? []) {
|
|
23964
|
+
if (!recordKinds.includes(recordKind)) {
|
|
23965
|
+
issues.push(`Missing observability export replay record kind: ${recordKind}.`);
|
|
23966
|
+
}
|
|
23967
|
+
}
|
|
23968
|
+
return {
|
|
23969
|
+
artifacts: report.summary.artifacts,
|
|
23970
|
+
deliveryDestinations: report.summary.deliveryDestinations,
|
|
23971
|
+
failedArtifacts: report.summary.failedArtifacts,
|
|
23972
|
+
failedDeliveryDestinations: report.summary.failedDeliveryDestinations,
|
|
23973
|
+
issues,
|
|
23974
|
+
ok: issues.length === 0,
|
|
23975
|
+
recordKinds,
|
|
23976
|
+
replayIssues: report.issues.length,
|
|
23977
|
+
status: report.status,
|
|
23978
|
+
validationIssues: report.summary.validationIssues
|
|
23979
|
+
};
|
|
23980
|
+
};
|
|
23981
|
+
var assertVoiceObservabilityExportReplayEvidence = (report, input = {}) => {
|
|
23982
|
+
const assertion = evaluateVoiceObservabilityExportReplayEvidence(report, input);
|
|
23983
|
+
if (!assertion.ok) {
|
|
23984
|
+
throw new Error(`Voice observability export replay assertion failed: ${assertion.issues.join(" ")}`);
|
|
23985
|
+
}
|
|
23986
|
+
return assertion;
|
|
23987
|
+
};
|
|
23854
23988
|
var loadVoiceObservabilityExportReplaySource = async (source) => {
|
|
23855
23989
|
if (source.kind === "records") {
|
|
23856
23990
|
return source;
|
|
@@ -24121,6 +24255,89 @@ var buildVoiceObservabilityExportDeliveryHistory = async (store) => {
|
|
|
24121
24255
|
}
|
|
24122
24256
|
};
|
|
24123
24257
|
};
|
|
24258
|
+
var getSuccessfulObservabilityExportReceipts = (history) => history.receipts.filter((receipt) => receipt.status === "pass" && receipt.exportStatus === "pass" && receipt.summary.delivered > 0 && receipt.summary.failed === 0);
|
|
24259
|
+
var getLatestSuccessfulObservabilityExportReceipt = (history) => getSuccessfulObservabilityExportReceipts(history).sort((left, right) => right.checkedAt - left.checkedAt)[0];
|
|
24260
|
+
var evaluateVoiceObservabilityExportDeliveryEvidence = (history, input = {}) => {
|
|
24261
|
+
const issues = [];
|
|
24262
|
+
const requiredStatus = input.requireStatus ?? "pass";
|
|
24263
|
+
const maxFailed = input.maxFailed ?? 0;
|
|
24264
|
+
const maxFailedReceipts = input.maxFailedReceipts ?? 0;
|
|
24265
|
+
const maxFailedExportReceipts = input.maxFailedExportReceipts ?? 0;
|
|
24266
|
+
const minDelivered = input.minDelivered ?? 1;
|
|
24267
|
+
const minReceipts = input.minReceipts ?? 1;
|
|
24268
|
+
const minTotalDestinations = input.minTotalDestinations ?? 1;
|
|
24269
|
+
const now = input.now ?? Date.now();
|
|
24270
|
+
const failedReceipts = history.receipts.filter((receipt) => receipt.status === "fail").length;
|
|
24271
|
+
const failedExportReceipts = history.receipts.filter((receipt) => receipt.exportStatus === "fail").length;
|
|
24272
|
+
const latestSuccess = getLatestSuccessfulObservabilityExportReceipt(history);
|
|
24273
|
+
const latestSuccessAgeMs = latestSuccess ? Math.max(0, now - latestSuccess.checkedAt) : undefined;
|
|
24274
|
+
const destinations = history.receipts.flatMap((receipt) => receipt.destinations);
|
|
24275
|
+
const destinationIds = [
|
|
24276
|
+
...new Set(destinations.map((destination) => destination.destinationId))
|
|
24277
|
+
].sort();
|
|
24278
|
+
const destinationKinds = [
|
|
24279
|
+
...new Set(destinations.map((destination) => destination.destinationKind))
|
|
24280
|
+
].sort();
|
|
24281
|
+
if (history.status !== requiredStatus) {
|
|
24282
|
+
issues.push(`Expected observability export delivery status ${requiredStatus}, found ${history.status}.`);
|
|
24283
|
+
}
|
|
24284
|
+
if (history.summary.failed > maxFailed) {
|
|
24285
|
+
issues.push(`Expected at most ${String(maxFailed)} failed observability export delivery destination(s), found ${String(history.summary.failed)}.`);
|
|
24286
|
+
}
|
|
24287
|
+
if (failedReceipts > maxFailedReceipts) {
|
|
24288
|
+
issues.push(`Expected at most ${String(maxFailedReceipts)} failed observability export delivery receipt(s), found ${String(failedReceipts)}.`);
|
|
24289
|
+
}
|
|
24290
|
+
if (failedExportReceipts > maxFailedExportReceipts) {
|
|
24291
|
+
issues.push(`Expected at most ${String(maxFailedExportReceipts)} failed observability export receipt manifest(s), found ${String(failedExportReceipts)}.`);
|
|
24292
|
+
}
|
|
24293
|
+
if (history.summary.delivered < minDelivered) {
|
|
24294
|
+
issues.push(`Expected at least ${String(minDelivered)} delivered observability export destination(s), found ${String(history.summary.delivered)}.`);
|
|
24295
|
+
}
|
|
24296
|
+
if (history.summary.receipts < minReceipts) {
|
|
24297
|
+
issues.push(`Expected at least ${String(minReceipts)} observability export delivery receipt(s), found ${String(history.summary.receipts)}.`);
|
|
24298
|
+
}
|
|
24299
|
+
if (history.summary.totalDestinations < minTotalDestinations) {
|
|
24300
|
+
issues.push(`Expected at least ${String(minTotalDestinations)} observability export destination(s), found ${String(history.summary.totalDestinations)}.`);
|
|
24301
|
+
}
|
|
24302
|
+
if (input.maxLatestSuccessAgeMs !== undefined) {
|
|
24303
|
+
if (latestSuccessAgeMs === undefined) {
|
|
24304
|
+
issues.push("Missing successful observability export delivery receipt.");
|
|
24305
|
+
} else if (latestSuccessAgeMs > input.maxLatestSuccessAgeMs) {
|
|
24306
|
+
issues.push(`Expected latest successful observability export delivery age at most ${String(input.maxLatestSuccessAgeMs)}ms, found ${String(latestSuccessAgeMs)}ms.`);
|
|
24307
|
+
}
|
|
24308
|
+
}
|
|
24309
|
+
for (const destinationId of input.requiredDestinationIds ?? []) {
|
|
24310
|
+
if (!destinationIds.includes(destinationId)) {
|
|
24311
|
+
issues.push(`Missing observability export delivery destination: ${destinationId}.`);
|
|
24312
|
+
}
|
|
24313
|
+
}
|
|
24314
|
+
for (const destinationKind of input.requiredDestinationKinds ?? []) {
|
|
24315
|
+
if (!destinationKinds.includes(destinationKind)) {
|
|
24316
|
+
issues.push(`Missing observability export delivery destination kind: ${destinationKind}.`);
|
|
24317
|
+
}
|
|
24318
|
+
}
|
|
24319
|
+
return {
|
|
24320
|
+
delivered: history.summary.delivered,
|
|
24321
|
+
destinationIds,
|
|
24322
|
+
destinationKinds,
|
|
24323
|
+
failed: history.summary.failed,
|
|
24324
|
+
failedExportReceipts,
|
|
24325
|
+
failedReceipts,
|
|
24326
|
+
issues,
|
|
24327
|
+
latestSuccessAgeMs,
|
|
24328
|
+
ok: issues.length === 0,
|
|
24329
|
+
receipts: history.summary.receipts,
|
|
24330
|
+
status: history.status,
|
|
24331
|
+
totalDestinations: history.summary.totalDestinations
|
|
24332
|
+
};
|
|
24333
|
+
};
|
|
24334
|
+
var assertVoiceObservabilityExportDeliveryEvidence = (history, input = {}) => {
|
|
24335
|
+
const assertion = evaluateVoiceObservabilityExportDeliveryEvidence(history, input);
|
|
24336
|
+
if (!assertion.ok) {
|
|
24337
|
+
throw new Error(`Voice observability export delivery assertion failed: ${assertion.issues.join(" ")}`);
|
|
24338
|
+
}
|
|
24339
|
+
return assertion;
|
|
24340
|
+
};
|
|
24124
24341
|
var inferContentType = (artifact) => {
|
|
24125
24342
|
if (artifact.contentType) {
|
|
24126
24343
|
return artifact.contentType;
|
|
@@ -30158,9 +30375,12 @@ export {
|
|
|
30158
30375
|
evaluateVoiceQuality,
|
|
30159
30376
|
evaluateVoiceProviderStackGaps,
|
|
30160
30377
|
evaluateVoiceProviderSloEvidence,
|
|
30378
|
+
evaluateVoiceProofTrendEvidence,
|
|
30161
30379
|
evaluateVoiceProductionReadinessEvidence,
|
|
30162
30380
|
evaluateVoicePlatformCoverage,
|
|
30163
30381
|
evaluateVoiceOperationsRecordGuardrails,
|
|
30382
|
+
evaluateVoiceObservabilityExportReplayEvidence,
|
|
30383
|
+
evaluateVoiceObservabilityExportDeliveryEvidence,
|
|
30164
30384
|
evaluateVoiceGuardrailPolicy,
|
|
30165
30385
|
encodeTwilioMulawBase64,
|
|
30166
30386
|
deliverVoiceTraceEventsToSinks,
|
|
@@ -30475,11 +30695,14 @@ export {
|
|
|
30475
30695
|
assignVoiceOpsTask,
|
|
30476
30696
|
assertVoiceProviderSloEvidence,
|
|
30477
30697
|
assertVoiceProviderRoutingContract,
|
|
30698
|
+
assertVoiceProofTrendEvidence,
|
|
30478
30699
|
assertVoiceProductionReadinessEvidence,
|
|
30479
30700
|
assertVoicePlatformCoverage,
|
|
30480
30701
|
assertVoiceOperationsRecordGuardrails,
|
|
30481
30702
|
assertVoiceObservabilityExportSchema,
|
|
30703
|
+
assertVoiceObservabilityExportReplayEvidence,
|
|
30482
30704
|
assertVoiceObservabilityExportRecord,
|
|
30705
|
+
assertVoiceObservabilityExportDeliveryEvidence,
|
|
30483
30706
|
assertVoiceLatencySLOGate,
|
|
30484
30707
|
assertVoiceAgentSquadContract,
|
|
30485
30708
|
applyVoiceTelephonyOutcome,
|
|
@@ -269,6 +269,55 @@ export type VoiceObservabilityExportReplayReport = {
|
|
|
269
269
|
validationIssues: number;
|
|
270
270
|
};
|
|
271
271
|
};
|
|
272
|
+
export type VoiceObservabilityExportDeliveryAssertionInput = {
|
|
273
|
+
maxFailed?: number;
|
|
274
|
+
maxFailedExportReceipts?: number;
|
|
275
|
+
maxFailedReceipts?: number;
|
|
276
|
+
maxLatestSuccessAgeMs?: number;
|
|
277
|
+
minDelivered?: number;
|
|
278
|
+
minReceipts?: number;
|
|
279
|
+
minTotalDestinations?: number;
|
|
280
|
+
now?: number;
|
|
281
|
+
requireStatus?: VoiceObservabilityExportStatus;
|
|
282
|
+
requiredDestinationIds?: string[];
|
|
283
|
+
requiredDestinationKinds?: VoiceObservabilityExportDeliveryDestination['kind'][];
|
|
284
|
+
};
|
|
285
|
+
export type VoiceObservabilityExportDeliveryAssertionReport = {
|
|
286
|
+
delivered: number;
|
|
287
|
+
destinationIds: string[];
|
|
288
|
+
destinationKinds: VoiceObservabilityExportDeliveryDestination['kind'][];
|
|
289
|
+
failed: number;
|
|
290
|
+
failedExportReceipts: number;
|
|
291
|
+
failedReceipts: number;
|
|
292
|
+
issues: string[];
|
|
293
|
+
latestSuccessAgeMs?: number;
|
|
294
|
+
ok: boolean;
|
|
295
|
+
receipts: number;
|
|
296
|
+
status: VoiceObservabilityExportStatus;
|
|
297
|
+
totalDestinations: number;
|
|
298
|
+
};
|
|
299
|
+
export type VoiceObservabilityExportReplayAssertionInput = {
|
|
300
|
+
maxFailedArtifacts?: number;
|
|
301
|
+
maxFailedDeliveryDestinations?: number;
|
|
302
|
+
maxIssues?: number;
|
|
303
|
+
maxValidationIssues?: number;
|
|
304
|
+
minArtifacts?: number;
|
|
305
|
+
minDeliveryDestinations?: number;
|
|
306
|
+
requireStatus?: VoiceObservabilityExportStatus;
|
|
307
|
+
requiredRecordKinds?: VoiceObservabilityExportIngestedRecordKind[];
|
|
308
|
+
};
|
|
309
|
+
export type VoiceObservabilityExportReplayAssertionReport = {
|
|
310
|
+
artifacts: number;
|
|
311
|
+
deliveryDestinations: number;
|
|
312
|
+
failedArtifacts: number;
|
|
313
|
+
failedDeliveryDestinations: number;
|
|
314
|
+
issues: string[];
|
|
315
|
+
ok: boolean;
|
|
316
|
+
recordKinds: VoiceObservabilityExportIngestedRecordKind[];
|
|
317
|
+
replayIssues: number;
|
|
318
|
+
status: VoiceObservabilityExportStatus;
|
|
319
|
+
validationIssues: number;
|
|
320
|
+
};
|
|
272
321
|
export type VoiceObservabilityExportReplaySource = {
|
|
273
322
|
artifactIndex?: unknown;
|
|
274
323
|
databaseRecord?: unknown;
|
|
@@ -354,6 +403,8 @@ export type VoiceObservabilityExportRoutesOptions = VoiceObservabilityExportOpti
|
|
|
354
403
|
title?: string;
|
|
355
404
|
};
|
|
356
405
|
export declare const buildVoiceObservabilityExportReplayReport: (records: VoiceObservabilityExportReplayRecords) => VoiceObservabilityExportReplayReport;
|
|
406
|
+
export declare const evaluateVoiceObservabilityExportReplayEvidence: (report: VoiceObservabilityExportReplayReport, input?: VoiceObservabilityExportReplayAssertionInput) => VoiceObservabilityExportReplayAssertionReport;
|
|
407
|
+
export declare const assertVoiceObservabilityExportReplayEvidence: (report: VoiceObservabilityExportReplayReport, input?: VoiceObservabilityExportReplayAssertionInput) => VoiceObservabilityExportReplayAssertionReport;
|
|
357
408
|
export declare const loadVoiceObservabilityExportReplaySource: (source: VoiceObservabilityExportReplaySource) => Promise<VoiceObservabilityExportReplayRecords>;
|
|
358
409
|
export declare const replayVoiceObservabilityExport: (source: VoiceObservabilityExportReplaySource) => Promise<VoiceObservabilityExportReplayReport>;
|
|
359
410
|
export declare const renderVoiceObservabilityExportReplayHTML: (report: VoiceObservabilityExportReplayReport, options?: {
|
|
@@ -392,6 +443,8 @@ export declare const createVoiceFileObservabilityExportDeliveryReceiptStore: (op
|
|
|
392
443
|
directory: string;
|
|
393
444
|
}) => VoiceObservabilityExportDeliveryReceiptStore;
|
|
394
445
|
export declare const buildVoiceObservabilityExportDeliveryHistory: (store: VoiceObservabilityExportDeliveryReceiptStore) => Promise<VoiceObservabilityExportDeliveryHistory>;
|
|
446
|
+
export declare const evaluateVoiceObservabilityExportDeliveryEvidence: (history: VoiceObservabilityExportDeliveryHistory, input?: VoiceObservabilityExportDeliveryAssertionInput) => VoiceObservabilityExportDeliveryAssertionReport;
|
|
447
|
+
export declare const assertVoiceObservabilityExportDeliveryEvidence: (history: VoiceObservabilityExportDeliveryHistory, input?: VoiceObservabilityExportDeliveryAssertionInput) => VoiceObservabilityExportDeliveryAssertionReport;
|
|
395
448
|
export declare const buildVoiceObservabilityExport: (options?: VoiceObservabilityExportOptions) => Promise<VoiceObservabilityExportReport>;
|
|
396
449
|
export declare const renderVoiceObservabilityExportMarkdown: (report: VoiceObservabilityExportReport, options?: {
|
|
397
450
|
title?: string;
|
package/dist/proofTrends.d.ts
CHANGED
|
@@ -59,6 +59,29 @@ export type VoiceProofTrendReport = {
|
|
|
59
59
|
status: VoiceProofTrendStatus;
|
|
60
60
|
summary: VoiceProofTrendSummary;
|
|
61
61
|
};
|
|
62
|
+
export type VoiceProofTrendAssertionInput = {
|
|
63
|
+
maxAgeMs?: number;
|
|
64
|
+
maxLiveP95Ms?: number;
|
|
65
|
+
maxProviderP95Ms?: number;
|
|
66
|
+
maxTurnP95Ms?: number;
|
|
67
|
+
minCycles?: number;
|
|
68
|
+
minLiveLatencySamples?: number;
|
|
69
|
+
minProviderSloEventsWithLatency?: number;
|
|
70
|
+
minTurnLatencySamples?: number;
|
|
71
|
+
requireAllCyclesOk?: boolean;
|
|
72
|
+
requireStatus?: VoiceProofTrendStatus;
|
|
73
|
+
};
|
|
74
|
+
export type VoiceProofTrendAssertionReport = {
|
|
75
|
+
ageMs?: number;
|
|
76
|
+
cycles: number;
|
|
77
|
+
failedCycles: number;
|
|
78
|
+
issues: string[];
|
|
79
|
+
maxLiveP95Ms?: number;
|
|
80
|
+
maxProviderP95Ms?: number;
|
|
81
|
+
maxTurnP95Ms?: number;
|
|
82
|
+
ok: boolean;
|
|
83
|
+
status: VoiceProofTrendStatus;
|
|
84
|
+
};
|
|
62
85
|
export type VoiceProofTrendRoutesOptions = {
|
|
63
86
|
headers?: HeadersInit;
|
|
64
87
|
jsonPath?: string;
|
|
@@ -77,6 +100,8 @@ export declare const normalizeVoiceProofTrendReport: (value: VoiceProofTrendRepo
|
|
|
77
100
|
export declare const readVoiceProofTrendReportFile: (path: string, options?: {
|
|
78
101
|
maxAgeMs?: number;
|
|
79
102
|
}) => Promise<VoiceProofTrendReport>;
|
|
103
|
+
export declare const evaluateVoiceProofTrendEvidence: (report: VoiceProofTrendReport, input?: VoiceProofTrendAssertionInput) => VoiceProofTrendAssertionReport;
|
|
104
|
+
export declare const assertVoiceProofTrendEvidence: (report: VoiceProofTrendReport, input?: VoiceProofTrendAssertionInput) => VoiceProofTrendAssertionReport;
|
|
80
105
|
export declare const createVoiceProofTrendRoutes: (options: VoiceProofTrendRoutesOptions) => Elysia<"", {
|
|
81
106
|
decorator: {};
|
|
82
107
|
store: {};
|
package/dist/react/index.js
CHANGED
|
@@ -1564,6 +1564,84 @@ var readVoiceProofTrendReportFile = async (path, options = {}) => {
|
|
|
1564
1564
|
});
|
|
1565
1565
|
}
|
|
1566
1566
|
};
|
|
1567
|
+
var maxNumber = (values) => {
|
|
1568
|
+
const finite = values.filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
1569
|
+
return finite.length > 0 ? Math.max(...finite) : undefined;
|
|
1570
|
+
};
|
|
1571
|
+
var readProofTrendMaxLiveP95 = (report) => report.summary.maxLiveP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.liveLatency?.p95Ms));
|
|
1572
|
+
var readProofTrendMaxProviderP95 = (report) => report.summary.maxProviderP95Ms;
|
|
1573
|
+
var readProofTrendMaxTurnP95 = (report) => report.summary.maxTurnP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.turnLatency?.p95Ms));
|
|
1574
|
+
var evaluateVoiceProofTrendEvidence = (report, input = {}) => {
|
|
1575
|
+
const issues = [];
|
|
1576
|
+
const requiredStatus = input.requireStatus ?? "pass";
|
|
1577
|
+
const minCycles = input.minCycles ?? 1;
|
|
1578
|
+
const requireAllCyclesOk = input.requireAllCyclesOk ?? true;
|
|
1579
|
+
const cycles = report.summary.cycles ?? report.cycles.length;
|
|
1580
|
+
const failedCycles = report.cycles.filter((cycle) => cycle.ok !== true).length;
|
|
1581
|
+
const maxLiveP95Ms = readProofTrendMaxLiveP95(report);
|
|
1582
|
+
const maxProviderP95Ms = readProofTrendMaxProviderP95(report);
|
|
1583
|
+
const maxTurnP95Ms = readProofTrendMaxTurnP95(report);
|
|
1584
|
+
if (report.status !== requiredStatus) {
|
|
1585
|
+
issues.push(`Expected proof trends status ${requiredStatus}, found ${report.status}.`);
|
|
1586
|
+
}
|
|
1587
|
+
if (report.ok !== true) {
|
|
1588
|
+
issues.push("Expected proof trends ok to be true.");
|
|
1589
|
+
}
|
|
1590
|
+
if (cycles < minCycles) {
|
|
1591
|
+
issues.push(`Expected at least ${String(minCycles)} proof trend cycle(s), found ${String(cycles)}.`);
|
|
1592
|
+
}
|
|
1593
|
+
if (requireAllCyclesOk && failedCycles > 0) {
|
|
1594
|
+
issues.push(`Expected all proof trend cycles to pass, found ${String(failedCycles)} failing cycle(s).`);
|
|
1595
|
+
}
|
|
1596
|
+
if (input.maxAgeMs !== undefined && (report.ageMs === undefined || report.ageMs > input.maxAgeMs)) {
|
|
1597
|
+
issues.push(report.ageMs === undefined ? "Missing proof trends artifact age." : `Expected proof trends age at most ${String(input.maxAgeMs)}ms, found ${String(report.ageMs)}ms.`);
|
|
1598
|
+
}
|
|
1599
|
+
if (input.maxLiveP95Ms !== undefined && (maxLiveP95Ms === undefined || maxLiveP95Ms > input.maxLiveP95Ms)) {
|
|
1600
|
+
issues.push(maxLiveP95Ms === undefined ? "Missing proof trends live latency p95." : `Expected proof trends live latency p95 at most ${String(input.maxLiveP95Ms)}ms, found ${String(maxLiveP95Ms)}ms.`);
|
|
1601
|
+
}
|
|
1602
|
+
if (input.maxProviderP95Ms !== undefined && (maxProviderP95Ms === undefined || maxProviderP95Ms > input.maxProviderP95Ms)) {
|
|
1603
|
+
issues.push(maxProviderP95Ms === undefined ? "Missing proof trends provider p95." : `Expected proof trends provider p95 at most ${String(input.maxProviderP95Ms)}ms, found ${String(maxProviderP95Ms)}ms.`);
|
|
1604
|
+
}
|
|
1605
|
+
if (input.maxTurnP95Ms !== undefined && (maxTurnP95Ms === undefined || maxTurnP95Ms > input.maxTurnP95Ms)) {
|
|
1606
|
+
issues.push(maxTurnP95Ms === undefined ? "Missing proof trends turn latency p95." : `Expected proof trends turn latency p95 at most ${String(input.maxTurnP95Ms)}ms, found ${String(maxTurnP95Ms)}ms.`);
|
|
1607
|
+
}
|
|
1608
|
+
if (input.minLiveLatencySamples !== undefined) {
|
|
1609
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.liveLatency?.samples ?? 0) < input.minLiveLatencySamples).length;
|
|
1610
|
+
if (lowSamples > 0) {
|
|
1611
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minLiveLatencySamples)} live latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
if (input.minProviderSloEventsWithLatency !== undefined) {
|
|
1615
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.providerSlo?.eventsWithLatency ?? 0) < input.minProviderSloEventsWithLatency).length;
|
|
1616
|
+
if (lowSamples > 0) {
|
|
1617
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minProviderSloEventsWithLatency)} provider latency event(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (input.minTurnLatencySamples !== undefined) {
|
|
1621
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.turnLatency?.samples ?? 0) < input.minTurnLatencySamples).length;
|
|
1622
|
+
if (lowSamples > 0) {
|
|
1623
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minTurnLatencySamples)} turn latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
return {
|
|
1627
|
+
ageMs: report.ageMs,
|
|
1628
|
+
cycles,
|
|
1629
|
+
failedCycles,
|
|
1630
|
+
issues,
|
|
1631
|
+
maxLiveP95Ms,
|
|
1632
|
+
maxProviderP95Ms,
|
|
1633
|
+
maxTurnP95Ms,
|
|
1634
|
+
ok: issues.length === 0,
|
|
1635
|
+
status: report.status
|
|
1636
|
+
};
|
|
1637
|
+
};
|
|
1638
|
+
var assertVoiceProofTrendEvidence = (report, input = {}) => {
|
|
1639
|
+
const assertion = evaluateVoiceProofTrendEvidence(report, input);
|
|
1640
|
+
if (!assertion.ok) {
|
|
1641
|
+
throw new Error(`Voice proof trends assertion failed: ${assertion.issues.join(" ")}`);
|
|
1642
|
+
}
|
|
1643
|
+
return assertion;
|
|
1644
|
+
};
|
|
1567
1645
|
var createVoiceProofTrendRoutes = (options) => {
|
|
1568
1646
|
const path = options.path ?? "/api/voice/proof-trends";
|
|
1569
1647
|
const routes = new Elysia({
|
package/dist/vue/index.js
CHANGED
|
@@ -1485,6 +1485,84 @@ var readVoiceProofTrendReportFile = async (path, options = {}) => {
|
|
|
1485
1485
|
});
|
|
1486
1486
|
}
|
|
1487
1487
|
};
|
|
1488
|
+
var maxNumber = (values) => {
|
|
1489
|
+
const finite = values.filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
1490
|
+
return finite.length > 0 ? Math.max(...finite) : undefined;
|
|
1491
|
+
};
|
|
1492
|
+
var readProofTrendMaxLiveP95 = (report) => report.summary.maxLiveP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.liveLatency?.p95Ms));
|
|
1493
|
+
var readProofTrendMaxProviderP95 = (report) => report.summary.maxProviderP95Ms;
|
|
1494
|
+
var readProofTrendMaxTurnP95 = (report) => report.summary.maxTurnP95Ms ?? maxNumber(report.cycles.map((cycle) => cycle.turnLatency?.p95Ms));
|
|
1495
|
+
var evaluateVoiceProofTrendEvidence = (report, input = {}) => {
|
|
1496
|
+
const issues = [];
|
|
1497
|
+
const requiredStatus = input.requireStatus ?? "pass";
|
|
1498
|
+
const minCycles = input.minCycles ?? 1;
|
|
1499
|
+
const requireAllCyclesOk = input.requireAllCyclesOk ?? true;
|
|
1500
|
+
const cycles = report.summary.cycles ?? report.cycles.length;
|
|
1501
|
+
const failedCycles = report.cycles.filter((cycle) => cycle.ok !== true).length;
|
|
1502
|
+
const maxLiveP95Ms = readProofTrendMaxLiveP95(report);
|
|
1503
|
+
const maxProviderP95Ms = readProofTrendMaxProviderP95(report);
|
|
1504
|
+
const maxTurnP95Ms = readProofTrendMaxTurnP95(report);
|
|
1505
|
+
if (report.status !== requiredStatus) {
|
|
1506
|
+
issues.push(`Expected proof trends status ${requiredStatus}, found ${report.status}.`);
|
|
1507
|
+
}
|
|
1508
|
+
if (report.ok !== true) {
|
|
1509
|
+
issues.push("Expected proof trends ok to be true.");
|
|
1510
|
+
}
|
|
1511
|
+
if (cycles < minCycles) {
|
|
1512
|
+
issues.push(`Expected at least ${String(minCycles)} proof trend cycle(s), found ${String(cycles)}.`);
|
|
1513
|
+
}
|
|
1514
|
+
if (requireAllCyclesOk && failedCycles > 0) {
|
|
1515
|
+
issues.push(`Expected all proof trend cycles to pass, found ${String(failedCycles)} failing cycle(s).`);
|
|
1516
|
+
}
|
|
1517
|
+
if (input.maxAgeMs !== undefined && (report.ageMs === undefined || report.ageMs > input.maxAgeMs)) {
|
|
1518
|
+
issues.push(report.ageMs === undefined ? "Missing proof trends artifact age." : `Expected proof trends age at most ${String(input.maxAgeMs)}ms, found ${String(report.ageMs)}ms.`);
|
|
1519
|
+
}
|
|
1520
|
+
if (input.maxLiveP95Ms !== undefined && (maxLiveP95Ms === undefined || maxLiveP95Ms > input.maxLiveP95Ms)) {
|
|
1521
|
+
issues.push(maxLiveP95Ms === undefined ? "Missing proof trends live latency p95." : `Expected proof trends live latency p95 at most ${String(input.maxLiveP95Ms)}ms, found ${String(maxLiveP95Ms)}ms.`);
|
|
1522
|
+
}
|
|
1523
|
+
if (input.maxProviderP95Ms !== undefined && (maxProviderP95Ms === undefined || maxProviderP95Ms > input.maxProviderP95Ms)) {
|
|
1524
|
+
issues.push(maxProviderP95Ms === undefined ? "Missing proof trends provider p95." : `Expected proof trends provider p95 at most ${String(input.maxProviderP95Ms)}ms, found ${String(maxProviderP95Ms)}ms.`);
|
|
1525
|
+
}
|
|
1526
|
+
if (input.maxTurnP95Ms !== undefined && (maxTurnP95Ms === undefined || maxTurnP95Ms > input.maxTurnP95Ms)) {
|
|
1527
|
+
issues.push(maxTurnP95Ms === undefined ? "Missing proof trends turn latency p95." : `Expected proof trends turn latency p95 at most ${String(input.maxTurnP95Ms)}ms, found ${String(maxTurnP95Ms)}ms.`);
|
|
1528
|
+
}
|
|
1529
|
+
if (input.minLiveLatencySamples !== undefined) {
|
|
1530
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.liveLatency?.samples ?? 0) < input.minLiveLatencySamples).length;
|
|
1531
|
+
if (lowSamples > 0) {
|
|
1532
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minLiveLatencySamples)} live latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
if (input.minProviderSloEventsWithLatency !== undefined) {
|
|
1536
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.providerSlo?.eventsWithLatency ?? 0) < input.minProviderSloEventsWithLatency).length;
|
|
1537
|
+
if (lowSamples > 0) {
|
|
1538
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minProviderSloEventsWithLatency)} provider latency event(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
if (input.minTurnLatencySamples !== undefined) {
|
|
1542
|
+
const lowSamples = report.cycles.filter((cycle) => (cycle.turnLatency?.samples ?? 0) < input.minTurnLatencySamples).length;
|
|
1543
|
+
if (lowSamples > 0) {
|
|
1544
|
+
issues.push(`Expected every proof trend cycle to have at least ${String(input.minTurnLatencySamples)} turn latency sample(s), found ${String(lowSamples)} low-sample cycle(s).`);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
return {
|
|
1548
|
+
ageMs: report.ageMs,
|
|
1549
|
+
cycles,
|
|
1550
|
+
failedCycles,
|
|
1551
|
+
issues,
|
|
1552
|
+
maxLiveP95Ms,
|
|
1553
|
+
maxProviderP95Ms,
|
|
1554
|
+
maxTurnP95Ms,
|
|
1555
|
+
ok: issues.length === 0,
|
|
1556
|
+
status: report.status
|
|
1557
|
+
};
|
|
1558
|
+
};
|
|
1559
|
+
var assertVoiceProofTrendEvidence = (report, input = {}) => {
|
|
1560
|
+
const assertion = evaluateVoiceProofTrendEvidence(report, input);
|
|
1561
|
+
if (!assertion.ok) {
|
|
1562
|
+
throw new Error(`Voice proof trends assertion failed: ${assertion.issues.join(" ")}`);
|
|
1563
|
+
}
|
|
1564
|
+
return assertion;
|
|
1565
|
+
};
|
|
1488
1566
|
var createVoiceProofTrendRoutes = (options) => {
|
|
1489
1567
|
const path = options.path ?? "/api/voice/proof-trends";
|
|
1490
1568
|
const routes = new Elysia({
|