@absolutejs/voice 0.0.22-beta.240 → 0.0.22-beta.241

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/index.d.ts CHANGED
@@ -16,6 +16,8 @@ export { buildVoiceDeliverySinkReport, createVoiceDeliverySinkDescriptor, create
16
16
  export { buildVoiceOpsActionHistoryReport, createVoiceOpsActionAuditRoutes, recordVoiceOpsActionAudit, renderVoiceOpsActionHistoryHTML } from './opsActionAuditRoutes';
17
17
  export { buildVoicePlatformCoverageSummary, createVoicePlatformCoverageRoutes } from './platformCoverage';
18
18
  export type { VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
19
+ export { buildEmptyVoiceProofTrendReport, buildVoiceProofTrendReport, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, formatVoiceProofTrendAge } from './proofTrends';
20
+ export type { VoiceProofTrendCycle, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendStatus, VoiceProofTrendSummary } from './proofTrends';
19
21
  export { buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
20
22
  export type { VoiceLiveOpsAction, VoiceLiveOpsActionInput, VoiceLiveOpsActionResult, VoiceLiveOpsControllerOptions, VoiceLiveOpsControlState, VoiceLiveOpsControlStatus, VoiceLiveOpsControlStore, VoiceLiveOpsRoutesOptions } from './liveOps';
21
23
  export { buildVoiceDeliveryRuntimeReport, createVoiceDeliveryRuntime, createVoiceDeliveryRuntimePresetConfig, createVoiceDeliveryRuntimeRoutes, renderVoiceDeliveryRuntimeHTML } from './deliveryRuntime';
package/dist/index.js CHANGED
@@ -12291,6 +12291,67 @@ var createVoicePlatformCoverageRoutes = (options) => {
12291
12291
  });
12292
12292
  return routes;
12293
12293
  };
12294
+ // src/proofTrends.ts
12295
+ var DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS = 24 * 60 * 60 * 1000;
12296
+ var normalizeMaxAgeMs = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS;
12297
+ var toTimeMs = (value) => {
12298
+ if (value instanceof Date) {
12299
+ return value.getTime();
12300
+ }
12301
+ if (typeof value === "number") {
12302
+ return value;
12303
+ }
12304
+ if (typeof value === "string") {
12305
+ return Date.parse(value);
12306
+ }
12307
+ return Date.now();
12308
+ };
12309
+ var buildVoiceProofTrendReport = (input = {}) => {
12310
+ const maxAgeMs = normalizeMaxAgeMs(input.maxAgeMs);
12311
+ const nowMs = toTimeMs(input.now);
12312
+ const generatedAtMs = typeof input.generatedAt === "string" ? Date.parse(input.generatedAt) : Number.NaN;
12313
+ const ageMs = Number.isFinite(generatedAtMs) && Number.isFinite(nowMs) ? Math.max(0, nowMs - generatedAtMs) : undefined;
12314
+ const freshUntil = Number.isFinite(generatedAtMs) && Number.isFinite(maxAgeMs) ? new Date(generatedAtMs + maxAgeMs).toISOString() : undefined;
12315
+ const isFresh = ageMs !== undefined && ageMs <= maxAgeMs;
12316
+ const status = input.status === "empty" ? "empty" : !isFresh ? "stale" : input.ok === true ? "pass" : "fail";
12317
+ return {
12318
+ ageMs,
12319
+ baseUrl: input.baseUrl,
12320
+ cycles: input.cycles ?? [],
12321
+ freshUntil,
12322
+ generatedAt: input.generatedAt,
12323
+ maxAgeMs,
12324
+ ok: input.ok === true && status === "pass",
12325
+ outputDir: input.outputDir,
12326
+ runId: input.runId,
12327
+ source: input.source ?? "",
12328
+ status,
12329
+ summary: input.summary ?? {}
12330
+ };
12331
+ };
12332
+ var buildEmptyVoiceProofTrendReport = (source = "", maxAgeMs) => buildVoiceProofTrendReport({
12333
+ maxAgeMs,
12334
+ source,
12335
+ status: "empty"
12336
+ });
12337
+ var formatVoiceProofTrendAge = (ageMs) => {
12338
+ if (typeof ageMs !== "number" || !Number.isFinite(ageMs)) {
12339
+ return "unknown";
12340
+ }
12341
+ const minutes = Math.floor(ageMs / 60000);
12342
+ if (minutes < 1) {
12343
+ return "less than 1m";
12344
+ }
12345
+ if (minutes < 60) {
12346
+ return `${minutes}m`;
12347
+ }
12348
+ const hours = Math.floor(minutes / 60);
12349
+ if (hours < 48) {
12350
+ return `${hours}h ${minutes % 60}m`;
12351
+ }
12352
+ const days = Math.floor(hours / 24);
12353
+ return `${days}d ${hours % 24}h`;
12354
+ };
12294
12355
  // src/liveOps.ts
12295
12356
  import { Elysia as Elysia14 } from "elysia";
12296
12357
  var VOICE_LIVE_OPS_ACTIONS = [
@@ -29174,6 +29235,7 @@ export {
29174
29235
  hasVoiceOpsTaskSLABreach,
29175
29236
  getVoiceLiveOpsControlStatus,
29176
29237
  getVoiceCampaignDialerProofStatus,
29238
+ formatVoiceProofTrendAge,
29177
29239
  filterVoiceTraceEvents,
29178
29240
  filterVoiceAuditEvents,
29179
29241
  failVoiceOpsTask,
@@ -29457,6 +29519,7 @@ export {
29457
29519
  buildVoiceTraceDeliveryReport,
29458
29520
  buildVoiceProviderSloReport,
29459
29521
  buildVoiceProviderContractMatrix,
29522
+ buildVoiceProofTrendReport,
29460
29523
  buildVoiceProductionReadinessReport,
29461
29524
  buildVoiceProductionReadinessGate,
29462
29525
  buildVoicePlatformCoverageSummary,
@@ -29484,6 +29547,7 @@ export {
29484
29547
  buildVoiceAuditTrailReport,
29485
29548
  buildVoiceAuditExport,
29486
29549
  buildVoiceAuditDeliveryReport,
29550
+ buildEmptyVoiceProofTrendReport,
29487
29551
  assignVoiceOpsTask,
29488
29552
  assertVoiceProviderRoutingContract,
29489
29553
  assertVoiceObservabilityExportSchema,
@@ -29499,5 +29563,6 @@ export {
29499
29563
  applyRiskTieredPhraseHintCorrections,
29500
29564
  applyPhraseHintCorrections,
29501
29565
  VOICE_LIVE_OPS_ACTIONS,
29502
- TURN_PROFILE_DEFAULTS
29566
+ TURN_PROFILE_DEFAULTS,
29567
+ DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS
29503
29568
  };
@@ -0,0 +1,64 @@
1
+ export type VoiceProofTrendStatus = 'empty' | 'fail' | 'pass' | 'stale';
2
+ export type VoiceProofTrendSummary = {
3
+ cycles?: number;
4
+ maxLiveP95Ms?: number;
5
+ maxProviderP95Ms?: number;
6
+ maxTurnP95Ms?: number;
7
+ };
8
+ export type VoiceProofTrendCycle = {
9
+ at?: string;
10
+ cycle?: number;
11
+ liveLatency?: {
12
+ p95Ms?: number;
13
+ samples?: number;
14
+ };
15
+ ok?: boolean;
16
+ opsRecovery?: {
17
+ issues?: number;
18
+ status?: string;
19
+ };
20
+ productionReadiness?: {
21
+ status?: string;
22
+ };
23
+ providerSlo?: {
24
+ events?: number;
25
+ eventsWithLatency?: number;
26
+ status?: string;
27
+ };
28
+ turnLatency?: {
29
+ p95Ms?: number;
30
+ samples?: number;
31
+ status?: string;
32
+ };
33
+ };
34
+ export type VoiceProofTrendReportInput = {
35
+ baseUrl?: string;
36
+ cycles?: VoiceProofTrendCycle[];
37
+ generatedAt?: string;
38
+ maxAgeMs?: number;
39
+ now?: Date | number | string;
40
+ ok?: boolean;
41
+ outputDir?: string;
42
+ runId?: string;
43
+ source?: string;
44
+ status?: VoiceProofTrendStatus;
45
+ summary?: VoiceProofTrendSummary;
46
+ };
47
+ export type VoiceProofTrendReport = {
48
+ ageMs?: number;
49
+ baseUrl?: string;
50
+ cycles: VoiceProofTrendCycle[];
51
+ freshUntil?: string;
52
+ generatedAt?: string;
53
+ maxAgeMs: number;
54
+ ok: boolean;
55
+ outputDir?: string;
56
+ runId?: string;
57
+ source: string;
58
+ status: VoiceProofTrendStatus;
59
+ summary: VoiceProofTrendSummary;
60
+ };
61
+ export declare const DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS: number;
62
+ export declare const buildVoiceProofTrendReport: (input?: VoiceProofTrendReportInput) => VoiceProofTrendReport;
63
+ export declare const buildEmptyVoiceProofTrendReport: (source?: string, maxAgeMs?: number) => VoiceProofTrendReport;
64
+ export declare const formatVoiceProofTrendAge: (ageMs: unknown) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.240",
3
+ "version": "0.0.22-beta.241",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",