@absolutejs/voice 0.0.22-beta.282 → 0.0.22-beta.284

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
@@ -123,7 +123,7 @@ export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneA
123
123
  export type { VoicePhoneAgentProductionSmokeIssue, VoicePhoneAgentProductionSmokeHandlerOptions, VoicePhoneAgentProductionSmokeHTMLHandlerOptions, VoicePhoneAgentProductionSmokeOptions, VoicePhoneAgentProductionSmokeReport, VoicePhoneAgentProductionSmokeRoutesOptions, VoicePhoneAgentProductionSmokeRequirement } from './phoneAgentProductionSmoke';
124
124
  export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesOptions } from './opsConsoleRoutes';
125
125
  export type { VoiceOpsStatus, VoiceOpsStatusLink, VoiceOpsStatusOptions, VoiceOpsStatusReport, VoiceOpsStatusRoutesOptions } from './opsStatus';
126
- 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';
126
+ export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessAssertionInput, VoiceProductionReadinessAssertionReport, VoiceProductionReadinessCheck, VoiceProductionReadinessGateIssue, VoiceProductionReadinessGateOptions, VoiceProductionReadinessGateProfile, VoiceProductionReadinessGateProfileSurface, VoiceProductionReadinessGateReport, VoiceProductionReadinessOpsActionHistoryOptions, VoiceProductionReadinessOpsActionHistorySummary, VoiceProductionReadinessOperationsRecordLink, VoiceProductionReadinessOperationsRecordLinks, VoiceProductionReadinessProfileExplanation, VoiceProductionReadinessProfileSurface, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRouteInput, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
127
127
  export type { VoiceMonitorDefinition, VoiceMonitorEvaluation, VoiceMonitorEvaluationInput, VoiceMonitorIssue, VoiceMonitorIssueStatus, VoiceMonitorIssueStore, VoiceMonitorNotifier, VoiceMonitorNotifierDeliveryInput, VoiceMonitorNotifierDeliveryOptions, VoiceMonitorNotifierDeliveryReceipt, VoiceMonitorNotifierDeliveryReceiptStore, VoiceMonitorNotifierDeliveryReport, VoiceMonitorNotifierDeliveryResult, VoiceMonitorRoutesOptions, VoiceMonitorRun, VoiceMonitorRunOptions, VoiceMonitorRunReport, VoiceMonitorRunner, VoiceMonitorRunnerOptions, VoiceMonitorRunnerRoutesOptions, VoiceMonitorRunnerTickResult, VoiceMonitorSeverity, VoiceMonitorStatus, VoiceMonitorWebhookNotifierOptions } from './voiceMonitoring';
128
128
  export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRecommendation, VoiceReadinessProfileRecommendationScore, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
129
129
  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';
package/dist/index.js CHANGED
@@ -27833,7 +27833,8 @@ var summarizeDeliveryRuntime = (summary) => {
27833
27833
  var summarizeLiveLatency = (events, options) => {
27834
27834
  const warnAfterMs = options.liveLatencyWarnAfterMs ?? 1800;
27835
27835
  const failAfterMs = options.liveLatencyFailAfterMs ?? 3200;
27836
- const latencies = events.filter((event) => event.type === "client.live_latency").map((event) => typeof event.payload.latencyMs === "number" ? event.payload.latencyMs : typeof event.payload.elapsedMs === "number" ? event.payload.elapsedMs : undefined).filter((value) => typeof value === "number");
27836
+ const minAt = typeof options.liveLatencyMaxAgeMs === "number" && Number.isFinite(options.liveLatencyMaxAgeMs) && options.liveLatencyMaxAgeMs > 0 ? Date.now() - options.liveLatencyMaxAgeMs : undefined;
27837
+ const latencies = events.filter((event) => event.type === "client.live_latency" && (minAt === undefined || event.at >= minAt)).map((event) => typeof event.payload.latencyMs === "number" ? event.payload.latencyMs : typeof event.payload.elapsedMs === "number" ? event.payload.elapsedMs : undefined).filter((value) => typeof value === "number");
27837
27838
  const failed = latencies.filter((value) => value > failAfterMs).length;
27838
27839
  const warnings = latencies.filter((value) => value > warnAfterMs && value <= failAfterMs).length;
27839
27840
  const averageLatencyMs = latencies.length > 0 ? Math.round(latencies.reduce((total, value) => total + value, 0) / latencies.length) : undefined;
@@ -28734,17 +28735,27 @@ var createVoiceProductionReadinessRoutes = (options) => {
28734
28735
  const routes = new Elysia44({
28735
28736
  name: options.name ?? "absolutejs-voice-production-readiness"
28736
28737
  });
28737
- routes.get(path, async ({ query, request }) => buildVoiceProductionReadinessReport(options, { query, request }));
28738
+ const resolveOptions = async (input) => {
28739
+ if (!options.resolveOptions) {
28740
+ return options;
28741
+ }
28742
+ return {
28743
+ ...options,
28744
+ ...await options.resolveOptions(input)
28745
+ };
28746
+ };
28747
+ routes.get(path, async ({ query, request }) => buildVoiceProductionReadinessReport(await resolveOptions({ query, request }), { query, request }));
28738
28748
  if (gatePath !== false) {
28739
28749
  routes.get(gatePath, async ({ query, request }) => {
28740
- const gate = await buildVoiceProductionReadinessGate(options, {
28750
+ const resolvedOptions = await resolveOptions({ query, request });
28751
+ const gate = await buildVoiceProductionReadinessGate(resolvedOptions, {
28741
28752
  query,
28742
28753
  request
28743
28754
  });
28744
28755
  return new Response(JSON.stringify(gate), {
28745
28756
  headers: {
28746
28757
  "Content-Type": "application/json; charset=utf-8",
28747
- ...options.headers
28758
+ ...resolvedOptions.headers
28748
28759
  },
28749
28760
  status: gate.ok ? 200 : 503
28750
28761
  });
@@ -28752,15 +28763,16 @@ var createVoiceProductionReadinessRoutes = (options) => {
28752
28763
  }
28753
28764
  if (htmlPath !== false) {
28754
28765
  routes.get(htmlPath, async ({ query, request }) => {
28755
- const report = await buildVoiceProductionReadinessReport(options, {
28766
+ const resolvedOptions = await resolveOptions({ query, request });
28767
+ const report = await buildVoiceProductionReadinessReport(resolvedOptions, {
28756
28768
  query,
28757
28769
  request
28758
28770
  });
28759
- const body = await (options.render ?? renderVoiceProductionReadinessHTML)(report);
28771
+ const body = await (resolvedOptions.render ?? renderVoiceProductionReadinessHTML)(report);
28760
28772
  return new Response(body, {
28761
28773
  headers: {
28762
28774
  "Content-Type": "text/html; charset=utf-8",
28763
- ...options.headers
28775
+ ...resolvedOptions.headers
28764
28776
  }
28765
28777
  });
28766
28778
  });
@@ -379,6 +379,10 @@ export type VoiceProductionReadinessOpsActionHistoryOptions = VoiceAuditEventSto
379
379
  store: VoiceAuditEventStore;
380
380
  warnWhenEmpty?: boolean;
381
381
  };
382
+ export type VoiceProductionReadinessRouteInput = {
383
+ query: Record<string, unknown>;
384
+ request: Request;
385
+ };
382
386
  export type VoiceProductionReadinessRoutesOptions = {
383
387
  agentSquadContracts?: false | readonly VoiceAgentSquadContractReport[] | ((input: {
384
388
  query: Record<string, unknown>;
@@ -469,6 +473,7 @@ export type VoiceProductionReadinessRoutesOptions = {
469
473
  }) => Promise<Record<string, VoiceProductionReadinessProofSource>> | Record<string, VoiceProductionReadinessProofSource>);
470
474
  profile?: false | VoiceProductionReadinessProfileExplanation;
471
475
  render?: (report: VoiceProductionReadinessReport) => string | Promise<string>;
476
+ resolveOptions?: (input: VoiceProductionReadinessRouteInput) => Promise<Partial<Omit<VoiceProductionReadinessRoutesOptions, 'resolveOptions'>>> | Partial<Omit<VoiceProductionReadinessRoutesOptions, 'resolveOptions'>>;
472
477
  store: VoiceTraceEventStore;
473
478
  sttProviders?: readonly string[];
474
479
  title?: string;
@@ -476,6 +481,7 @@ export type VoiceProductionReadinessRoutesOptions = {
476
481
  ttsProviders?: readonly string[];
477
482
  liveLatencyWarnAfterMs?: number;
478
483
  liveLatencyFailAfterMs?: number;
484
+ liveLatencyMaxAgeMs?: number;
479
485
  };
480
486
  export declare const summarizeVoiceProductionReadinessGate: (report: VoiceProductionReadinessReport, options?: VoiceProductionReadinessGateOptions) => VoiceProductionReadinessGateReport;
481
487
  export declare const evaluateVoiceProductionReadinessEvidence: (report: VoiceProductionReadinessReport, input?: VoiceProductionReadinessAssertionInput) => VoiceProductionReadinessAssertionReport;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.282",
3
+ "version": "0.0.22-beta.284",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",