@absolutejs/voice 0.0.22-beta.252 → 0.0.22-beta.254
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 +219 -0
- package/dist/proofTrends.d.ts +25 -0
- package/dist/providerStackRecommendations.d.ts +42 -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';
|
|
@@ -54,7 +54,7 @@ export { assertVoiceProviderSloEvidence, buildVoiceProviderSloReport, createVoic
|
|
|
54
54
|
export { createVoicePhoneAgentProductionSmokeHTMLHandler, createVoicePhoneAgentProductionSmokeJSONHandler, createVoicePhoneAgentProductionSmokeRoutes, renderVoicePhoneAgentProductionSmokeHTML, runVoicePhoneAgentProductionSmokeContract } from './phoneAgentProductionSmoke';
|
|
55
55
|
export { assertVoiceProductionReadinessEvidence, buildVoiceProductionReadinessGate, buildVoiceProductionReadinessReport, createVoiceProductionReadinessRoutes, evaluateVoiceProductionReadinessEvidence, renderVoiceProductionReadinessHTML, summarizeVoiceProductionReadinessGate } from './productionReadiness';
|
|
56
56
|
export { createVoiceReadinessProfile, recommendVoiceReadinessProfile } from './readinessProfiles';
|
|
57
|
-
export { buildVoiceProviderContractMatrix, createVoiceProviderContractMatrixHTMLHandler, createVoiceProviderContractMatrixJSONHandler, createVoiceProviderContractMatrixPreset, createVoiceProviderContractMatrixRoutes, evaluateVoiceProviderStackGaps, renderVoiceProviderContractMatrixHTML, recommendVoiceProviderStack } from './providerStackRecommendations';
|
|
57
|
+
export { assertVoiceProviderContractMatrixEvidence, assertVoiceProviderStackEvidence, buildVoiceProviderContractMatrix, createVoiceProviderContractMatrixHTMLHandler, createVoiceProviderContractMatrixJSONHandler, createVoiceProviderContractMatrixPreset, createVoiceProviderContractMatrixRoutes, evaluateVoiceProviderContractMatrixEvidence, evaluateVoiceProviderStackEvidence, 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
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';
|
|
@@ -122,7 +122,7 @@ export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesO
|
|
|
122
122
|
export type { VoiceOpsStatus, VoiceOpsStatusLink, VoiceOpsStatusOptions, VoiceOpsStatusReport, VoiceOpsStatusRoutesOptions } from './opsStatus';
|
|
123
123
|
export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessAssertionInput, VoiceProductionReadinessAssertionReport, VoiceProductionReadinessCheck, VoiceProductionReadinessGateIssue, VoiceProductionReadinessGateOptions, VoiceProductionReadinessGateProfile, VoiceProductionReadinessGateProfileSurface, VoiceProductionReadinessGateReport, VoiceProductionReadinessOpsActionHistoryOptions, VoiceProductionReadinessOpsActionHistorySummary, VoiceProductionReadinessOperationsRecordLink, VoiceProductionReadinessOperationsRecordLinks, VoiceProductionReadinessProfileExplanation, VoiceProductionReadinessProfileSurface, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
|
|
124
124
|
export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRecommendation, VoiceReadinessProfileRecommendationScore, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
|
|
125
|
-
export type { VoiceProviderStackChoice, VoiceProviderStackCapabilities, VoiceProviderStackCapabilityGap, VoiceProviderStackCapabilityGapInput, VoiceProviderStackCapabilityGapReport, VoiceProviderContractCheck, VoiceProviderContractCheckStatus, VoiceProviderContractDefinition, VoiceProviderContractMatrixHandlerOptions, VoiceProviderContractMatrixHTMLHandlerOptions, VoiceProviderContractMatrixInput, VoiceProviderContractMatrixPresetOptions, VoiceProviderContractMatrixReport, VoiceProviderContractMatrixRoutesOptions, VoiceProviderContractMatrixRow, VoiceProviderStackInput, VoiceProviderStackKind, VoiceProviderStackRecommendation } from './providerStackRecommendations';
|
|
125
|
+
export type { VoiceProviderStackChoice, VoiceProviderStackCapabilities, VoiceProviderStackCapabilityGap, VoiceProviderStackCapabilityGapInput, VoiceProviderStackCapabilityGapReport, VoiceProviderContractCheck, VoiceProviderContractCheckStatus, VoiceProviderContractDefinition, VoiceProviderContractMatrixAssertionInput, VoiceProviderContractMatrixAssertionReport, VoiceProviderContractMatrixHandlerOptions, VoiceProviderContractMatrixHTMLHandlerOptions, VoiceProviderContractMatrixInput, VoiceProviderContractMatrixPresetOptions, VoiceProviderContractMatrixReport, VoiceProviderContractMatrixRoutesOptions, VoiceProviderContractMatrixRow, VoiceProviderStackAssertionInput, VoiceProviderStackAssertionReport, 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
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';
|
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({
|
|
@@ -26652,6 +26730,12 @@ var recommendVoiceProviderStack = (input) => {
|
|
|
26652
26730
|
};
|
|
26653
26731
|
};
|
|
26654
26732
|
var rollupContractStatus = (checks) => checks.some((check) => check.status === "fail") ? "fail" : checks.some((check) => check.status === "warn") ? "warn" : "pass";
|
|
26733
|
+
var statusRank2 = {
|
|
26734
|
+
pass: 0,
|
|
26735
|
+
warn: 1,
|
|
26736
|
+
fail: 2
|
|
26737
|
+
};
|
|
26738
|
+
var statusExceeds = (actual, max) => statusRank2[actual] > statusRank2[max];
|
|
26655
26739
|
var buildVoiceProviderContractMatrix = (input) => {
|
|
26656
26740
|
const rows = input.contracts.map((contract) => {
|
|
26657
26741
|
const configured = contract.configured !== false;
|
|
@@ -26752,6 +26836,76 @@ var buildVoiceProviderContractMatrix = (input) => {
|
|
|
26752
26836
|
warned
|
|
26753
26837
|
};
|
|
26754
26838
|
};
|
|
26839
|
+
var evaluateVoiceProviderContractMatrixEvidence = (report, input = {}) => {
|
|
26840
|
+
const issues = [];
|
|
26841
|
+
const maxStatus = input.maxStatus ?? "pass";
|
|
26842
|
+
const maxFailed = input.maxFailed ?? 0;
|
|
26843
|
+
const maxWarned = input.maxWarned ?? 0;
|
|
26844
|
+
const minRows = input.minRows ?? 1;
|
|
26845
|
+
const requireAllSelected = input.requireAllSelected ?? false;
|
|
26846
|
+
const kinds = [...new Set(report.rows.map((row) => row.kind))].sort();
|
|
26847
|
+
const providers = [...new Set(report.rows.map((row) => row.provider))].sort();
|
|
26848
|
+
const selectedKinds = [
|
|
26849
|
+
...new Set(report.rows.filter((row) => row.selected).map((row) => row.kind))
|
|
26850
|
+
].sort();
|
|
26851
|
+
if (statusExceeds(report.status, maxStatus)) {
|
|
26852
|
+
issues.push(`Expected provider contract matrix status at most ${maxStatus}, found ${report.status}.`);
|
|
26853
|
+
}
|
|
26854
|
+
if (report.failed > maxFailed) {
|
|
26855
|
+
issues.push(`Expected at most ${String(maxFailed)} failing provider contract row(s), found ${String(report.failed)}.`);
|
|
26856
|
+
}
|
|
26857
|
+
if (report.warned > maxWarned) {
|
|
26858
|
+
issues.push(`Expected at most ${String(maxWarned)} warning provider contract row(s), found ${String(report.warned)}.`);
|
|
26859
|
+
}
|
|
26860
|
+
if (report.total < minRows) {
|
|
26861
|
+
issues.push(`Expected at least ${String(minRows)} provider contract row(s), found ${String(report.total)}.`);
|
|
26862
|
+
}
|
|
26863
|
+
for (const kind of input.requiredKinds ?? []) {
|
|
26864
|
+
if (!kinds.includes(kind)) {
|
|
26865
|
+
issues.push(`Missing provider contract kind: ${kind}.`);
|
|
26866
|
+
}
|
|
26867
|
+
}
|
|
26868
|
+
for (const provider of input.requiredProviders ?? []) {
|
|
26869
|
+
if (!providers.includes(provider)) {
|
|
26870
|
+
issues.push(`Missing provider contract provider: ${provider}.`);
|
|
26871
|
+
}
|
|
26872
|
+
}
|
|
26873
|
+
for (const kind of input.selectedKinds ?? []) {
|
|
26874
|
+
if (!selectedKinds.includes(kind)) {
|
|
26875
|
+
issues.push(`Missing selected provider contract kind: ${kind}.`);
|
|
26876
|
+
}
|
|
26877
|
+
}
|
|
26878
|
+
for (const key of input.requiredCheckKeys ?? []) {
|
|
26879
|
+
const missingRows = report.rows.filter((row) => !row.checks.some((check) => check.key === key)).length;
|
|
26880
|
+
if (missingRows > 0) {
|
|
26881
|
+
issues.push(`Provider contract check ${key} is missing from ${String(missingRows)} row(s).`);
|
|
26882
|
+
}
|
|
26883
|
+
}
|
|
26884
|
+
if (requireAllSelected) {
|
|
26885
|
+
const unselected = report.rows.filter((row) => !row.selected).length;
|
|
26886
|
+
if (unselected > 0) {
|
|
26887
|
+
issues.push(`Expected every provider contract row to be selected, found ${String(unselected)} unselected row(s).`);
|
|
26888
|
+
}
|
|
26889
|
+
}
|
|
26890
|
+
return {
|
|
26891
|
+
failed: report.failed,
|
|
26892
|
+
issues,
|
|
26893
|
+
kinds,
|
|
26894
|
+
ok: issues.length === 0,
|
|
26895
|
+
providers,
|
|
26896
|
+
selectedKinds,
|
|
26897
|
+
status: report.status,
|
|
26898
|
+
total: report.total,
|
|
26899
|
+
warned: report.warned
|
|
26900
|
+
};
|
|
26901
|
+
};
|
|
26902
|
+
var assertVoiceProviderContractMatrixEvidence = (report, input = {}) => {
|
|
26903
|
+
const assertion = evaluateVoiceProviderContractMatrixEvidence(report, input);
|
|
26904
|
+
if (!assertion.ok) {
|
|
26905
|
+
throw new Error(`Voice provider contract matrix assertion failed: ${assertion.issues.join(" ")}`);
|
|
26906
|
+
}
|
|
26907
|
+
return assertion;
|
|
26908
|
+
};
|
|
26755
26909
|
var createVoiceProviderContractMatrixPreset = (profile, options) => {
|
|
26756
26910
|
const contracts = ["llm", "stt", "tts"].flatMap((kind) => {
|
|
26757
26911
|
const providers = options.providers[kind] ?? [];
|
|
@@ -26887,6 +27041,65 @@ var evaluateVoiceProviderStackGaps = (input) => {
|
|
|
26887
27041
|
status: gaps.some((gap) => gap.status === "fail") ? "fail" : gaps.some((gap) => gap.status === "warn") ? "warn" : "pass"
|
|
26888
27042
|
};
|
|
26889
27043
|
};
|
|
27044
|
+
var evaluateVoiceProviderStackEvidence = (report, input = {}) => {
|
|
27045
|
+
const issues = [];
|
|
27046
|
+
const maxStatus = input.maxStatus ?? "pass";
|
|
27047
|
+
const maxMissing = input.maxMissing ?? 0;
|
|
27048
|
+
const requireProviders = input.requireProviders ?? true;
|
|
27049
|
+
const kinds = [...new Set(report.gaps.map((gap) => gap.kind))].sort();
|
|
27050
|
+
const providers = [
|
|
27051
|
+
...new Set(report.gaps.map((gap) => gap.provider).filter((provider) => provider !== undefined))
|
|
27052
|
+
].sort();
|
|
27053
|
+
if (statusExceeds(report.status, maxStatus)) {
|
|
27054
|
+
issues.push(`Expected provider stack status at most ${maxStatus}, found ${report.status}.`);
|
|
27055
|
+
}
|
|
27056
|
+
if (report.missing > maxMissing) {
|
|
27057
|
+
issues.push(`Expected at most ${String(maxMissing)} missing provider stack capability/capabilities, found ${String(report.missing)}.`);
|
|
27058
|
+
}
|
|
27059
|
+
for (const kind of input.requiredKinds ?? []) {
|
|
27060
|
+
if (!kinds.includes(kind)) {
|
|
27061
|
+
issues.push(`Missing provider stack kind: ${kind}.`);
|
|
27062
|
+
}
|
|
27063
|
+
}
|
|
27064
|
+
for (const provider of input.requiredProviders ?? []) {
|
|
27065
|
+
if (!providers.includes(provider)) {
|
|
27066
|
+
issues.push(`Missing provider stack provider: ${provider}.`);
|
|
27067
|
+
}
|
|
27068
|
+
}
|
|
27069
|
+
for (const [kind, capabilities] of Object.entries(input.requiredCapabilities ?? {})) {
|
|
27070
|
+
const gap = report.gaps.find((entry) => entry.kind === kind);
|
|
27071
|
+
if (!gap) {
|
|
27072
|
+
issues.push(`Missing provider stack kind: ${kind}.`);
|
|
27073
|
+
continue;
|
|
27074
|
+
}
|
|
27075
|
+
for (const capability of capabilities) {
|
|
27076
|
+
if (!includesCapability(gap.present, capability)) {
|
|
27077
|
+
issues.push(`Missing provider stack capability for ${kind}: ${capability}.`);
|
|
27078
|
+
}
|
|
27079
|
+
}
|
|
27080
|
+
}
|
|
27081
|
+
if (requireProviders) {
|
|
27082
|
+
const missingProviders = report.gaps.filter((gap) => !gap.provider).map((gap) => gap.kind);
|
|
27083
|
+
if (missingProviders.length > 0) {
|
|
27084
|
+
issues.push(`Missing provider stack provider for kind(s): ${missingProviders.join(", ")}.`);
|
|
27085
|
+
}
|
|
27086
|
+
}
|
|
27087
|
+
return {
|
|
27088
|
+
issues,
|
|
27089
|
+
kinds,
|
|
27090
|
+
missing: report.missing,
|
|
27091
|
+
ok: issues.length === 0,
|
|
27092
|
+
providers,
|
|
27093
|
+
status: report.status
|
|
27094
|
+
};
|
|
27095
|
+
};
|
|
27096
|
+
var assertVoiceProviderStackEvidence = (report, input = {}) => {
|
|
27097
|
+
const assertion = evaluateVoiceProviderStackEvidence(report, input);
|
|
27098
|
+
if (!assertion.ok) {
|
|
27099
|
+
throw new Error(`Voice provider stack assertion failed: ${assertion.issues.join(" ")}`);
|
|
27100
|
+
}
|
|
27101
|
+
return assertion;
|
|
27102
|
+
};
|
|
26890
27103
|
// src/opsConsoleRoutes.ts
|
|
26891
27104
|
import { Elysia as Elysia44 } from "elysia";
|
|
26892
27105
|
var DEFAULT_LINKS = [
|
|
@@ -30296,7 +30509,10 @@ export {
|
|
|
30296
30509
|
evaluateVoiceTelephonyContract,
|
|
30297
30510
|
evaluateVoiceQuality,
|
|
30298
30511
|
evaluateVoiceProviderStackGaps,
|
|
30512
|
+
evaluateVoiceProviderStackEvidence,
|
|
30299
30513
|
evaluateVoiceProviderSloEvidence,
|
|
30514
|
+
evaluateVoiceProviderContractMatrixEvidence,
|
|
30515
|
+
evaluateVoiceProofTrendEvidence,
|
|
30300
30516
|
evaluateVoiceProductionReadinessEvidence,
|
|
30301
30517
|
evaluateVoicePlatformCoverage,
|
|
30302
30518
|
evaluateVoiceOperationsRecordGuardrails,
|
|
@@ -30614,8 +30830,11 @@ export {
|
|
|
30614
30830
|
buildVoiceAuditDeliveryReport,
|
|
30615
30831
|
buildEmptyVoiceProofTrendReport,
|
|
30616
30832
|
assignVoiceOpsTask,
|
|
30833
|
+
assertVoiceProviderStackEvidence,
|
|
30617
30834
|
assertVoiceProviderSloEvidence,
|
|
30618
30835
|
assertVoiceProviderRoutingContract,
|
|
30836
|
+
assertVoiceProviderContractMatrixEvidence,
|
|
30837
|
+
assertVoiceProofTrendEvidence,
|
|
30619
30838
|
assertVoiceProductionReadinessEvidence,
|
|
30620
30839
|
assertVoicePlatformCoverage,
|
|
30621
30840
|
assertVoiceOperationsRecordGuardrails,
|
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: {};
|
|
@@ -31,6 +31,22 @@ export type VoiceProviderStackCapabilityGapReport<TProvider extends string = str
|
|
|
31
31
|
profile: VoiceReadinessProfileName;
|
|
32
32
|
status: 'fail' | 'pass' | 'warn';
|
|
33
33
|
};
|
|
34
|
+
export type VoiceProviderStackAssertionInput<TProvider extends string = string> = {
|
|
35
|
+
maxMissing?: number;
|
|
36
|
+
maxStatus?: VoiceProviderContractCheckStatus;
|
|
37
|
+
requireProviders?: boolean;
|
|
38
|
+
requiredKinds?: VoiceProviderStackKind[];
|
|
39
|
+
requiredProviders?: TProvider[];
|
|
40
|
+
requiredCapabilities?: Partial<Record<VoiceProviderStackKind, readonly string[]>>;
|
|
41
|
+
};
|
|
42
|
+
export type VoiceProviderStackAssertionReport<TProvider extends string = string> = {
|
|
43
|
+
issues: string[];
|
|
44
|
+
kinds: VoiceProviderStackKind[];
|
|
45
|
+
missing: number;
|
|
46
|
+
ok: boolean;
|
|
47
|
+
providers: TProvider[];
|
|
48
|
+
status: VoiceProviderContractCheckStatus;
|
|
49
|
+
};
|
|
34
50
|
export type VoiceProviderStackCapabilityGapInput<TProvider extends string = string> = VoiceProviderStackInput<TProvider> & {
|
|
35
51
|
capabilities?: VoiceProviderStackCapabilities<TProvider>;
|
|
36
52
|
recommendation?: VoiceProviderStackRecommendation<TProvider>;
|
|
@@ -106,8 +122,32 @@ export type VoiceProviderContractMatrixReport<TProvider extends string = string>
|
|
|
106
122
|
total: number;
|
|
107
123
|
warned: number;
|
|
108
124
|
};
|
|
125
|
+
export type VoiceProviderContractMatrixAssertionInput<TProvider extends string = string> = {
|
|
126
|
+
maxFailed?: number;
|
|
127
|
+
maxStatus?: VoiceProviderContractCheckStatus;
|
|
128
|
+
maxWarned?: number;
|
|
129
|
+
minRows?: number;
|
|
130
|
+
requireAllSelected?: boolean;
|
|
131
|
+
requiredCheckKeys?: string[];
|
|
132
|
+
requiredKinds?: VoiceProviderStackKind[];
|
|
133
|
+
requiredProviders?: TProvider[];
|
|
134
|
+
selectedKinds?: VoiceProviderStackKind[];
|
|
135
|
+
};
|
|
136
|
+
export type VoiceProviderContractMatrixAssertionReport<TProvider extends string = string> = {
|
|
137
|
+
failed: number;
|
|
138
|
+
issues: string[];
|
|
139
|
+
kinds: VoiceProviderStackKind[];
|
|
140
|
+
ok: boolean;
|
|
141
|
+
providers: TProvider[];
|
|
142
|
+
selectedKinds: VoiceProviderStackKind[];
|
|
143
|
+
status: VoiceProviderContractCheckStatus;
|
|
144
|
+
total: number;
|
|
145
|
+
warned: number;
|
|
146
|
+
};
|
|
109
147
|
export declare const recommendVoiceProviderStack: <TProvider extends string = string>(input: VoiceProviderStackInput<TProvider>) => VoiceProviderStackRecommendation<TProvider>;
|
|
110
148
|
export declare const buildVoiceProviderContractMatrix: <TProvider extends string = string>(input: VoiceProviderContractMatrixInput<TProvider>) => VoiceProviderContractMatrixReport<TProvider>;
|
|
149
|
+
export declare const evaluateVoiceProviderContractMatrixEvidence: <TProvider extends string = string>(report: VoiceProviderContractMatrixReport<TProvider>, input?: VoiceProviderContractMatrixAssertionInput<TProvider>) => VoiceProviderContractMatrixAssertionReport<TProvider>;
|
|
150
|
+
export declare const assertVoiceProviderContractMatrixEvidence: <TProvider extends string = string>(report: VoiceProviderContractMatrixReport<TProvider>, input?: VoiceProviderContractMatrixAssertionInput<TProvider>) => VoiceProviderContractMatrixAssertionReport<TProvider>;
|
|
111
151
|
export declare const createVoiceProviderContractMatrixPreset: <TProvider extends string = string>(profile: VoiceReadinessProfileName, options: VoiceProviderContractMatrixPresetOptions<TProvider>) => VoiceProviderContractMatrixInput<TProvider>;
|
|
112
152
|
export declare const renderVoiceProviderContractMatrixHTML: <TProvider extends string = string>(report: VoiceProviderContractMatrixReport<TProvider>, options?: {
|
|
113
153
|
title?: string;
|
|
@@ -143,3 +183,5 @@ export declare const createVoiceProviderContractMatrixRoutes: <TProvider extends
|
|
|
143
183
|
response: {};
|
|
144
184
|
}>;
|
|
145
185
|
export declare const evaluateVoiceProviderStackGaps: <TProvider extends string = string>(input: VoiceProviderStackCapabilityGapInput<TProvider>) => VoiceProviderStackCapabilityGapReport<TProvider>;
|
|
186
|
+
export declare const evaluateVoiceProviderStackEvidence: <TProvider extends string = string>(report: VoiceProviderStackCapabilityGapReport<TProvider>, input?: VoiceProviderStackAssertionInput<TProvider>) => VoiceProviderStackAssertionReport<TProvider>;
|
|
187
|
+
export declare const assertVoiceProviderStackEvidence: <TProvider extends string = string>(report: VoiceProviderStackCapabilityGapReport<TProvider>, input?: VoiceProviderStackAssertionInput<TProvider>) => VoiceProviderStackAssertionReport<TProvider>;
|
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({
|