@absolutejs/voice 0.0.22-beta.281 → 0.0.22-beta.283

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
@@ -18,8 +18,8 @@ export { assertVoicePlatformCoverage, buildVoicePlatformCoverageSummary, createV
18
18
  export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
19
19
  export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendReport, createVoiceProofTrendRoutes, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile } from './proofTrends';
20
20
  export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendStatus, VoiceProofTrendSummary } from './proofTrends';
21
- export { assertVoiceSloCalibration, buildVoiceSloCalibrationReport, createVoiceSloCalibrationRoutes, renderVoiceSloCalibrationMarkdown } from './sloCalibration';
22
- export type { VoiceSloCalibrationMetricKey, VoiceSloCalibrationOptions, VoiceSloCalibrationReport, VoiceSloCalibrationRoutesOptions, VoiceSloCalibrationSample, VoiceSloCalibrationStatus, VoiceSloCalibrationThreshold, VoiceSloCalibrationThresholds } from './sloCalibration';
21
+ export { assertVoiceSloCalibration, buildVoiceSloCalibrationReport, createVoiceSloThresholdProfile, createVoiceSloCalibrationRoutes, renderVoiceSloCalibrationMarkdown } from './sloCalibration';
22
+ export type { VoiceSloCalibrationMetricKey, VoiceSloCalibrationOptions, VoiceSloCalibrationReport, VoiceSloCalibrationRoutesOptions, VoiceSloCalibrationSample, VoiceSloCalibrationStatus, VoiceSloCalibrationThreshold, VoiceSloCalibrationThresholds, VoiceSloThresholdProfile } from './sloCalibration';
23
23
  export { assertVoiceLiveOpsControlEvidence, assertVoiceLiveOpsEvidence, buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, evaluateVoiceLiveOpsControlEvidence, evaluateVoiceLiveOpsEvidence, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
24
24
  export type { VoiceLiveOpsAction, VoiceLiveOpsActionInput, VoiceLiveOpsActionResult, VoiceLiveOpsControllerOptions, VoiceLiveOpsControlState, VoiceLiveOpsControlStatus, VoiceLiveOpsControlStore, VoiceLiveOpsControlEvidenceInput, VoiceLiveOpsControlEvidenceReport, VoiceLiveOpsEvidenceInput, VoiceLiveOpsEvidenceReport, VoiceLiveOpsRoutesOptions } from './liveOps';
25
25
  export { buildVoiceDeliveryRuntimeReport, createVoiceDeliveryRuntime, createVoiceDeliveryRuntimePresetConfig, createVoiceDeliveryRuntimeRoutes, renderVoiceDeliveryRuntimeHTML } from './deliveryRuntime';
@@ -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
@@ -12751,6 +12751,31 @@ var assertVoiceSloCalibration = (input, options = {}) => {
12751
12751
  }
12752
12752
  return report;
12753
12753
  };
12754
+ var thresholdValue = (threshold) => threshold.recommendedMs ?? threshold.failAfterMs;
12755
+ var createVoiceSloThresholdProfile = (input, options = {}) => {
12756
+ const report = Array.isArray(input) ? buildVoiceSloCalibrationReport(input, options) : input;
12757
+ const liveLatencyFailAfterMs = thresholdValue(report.thresholds.liveLatency);
12758
+ const interruptionFailAfterMs = thresholdValue(report.thresholds.interruption);
12759
+ return {
12760
+ bargeIn: {
12761
+ thresholdMs: interruptionFailAfterMs
12762
+ },
12763
+ issues: report.issues,
12764
+ liveLatency: {
12765
+ failAfterMs: liveLatencyFailAfterMs,
12766
+ warnAfterMs: report.thresholds.liveLatency.warnAfterMs
12767
+ },
12768
+ monitoring: {
12769
+ monitorRunFailAfterMs: thresholdValue(report.thresholds.monitorRun),
12770
+ notifierDeliveryFailAfterMs: thresholdValue(report.thresholds.notifierDelivery)
12771
+ },
12772
+ providerSlo: report.recommendedProviderSloThresholds,
12773
+ reconnect: {
12774
+ failAfterMs: thresholdValue(report.thresholds.reconnect)
12775
+ },
12776
+ status: report.status
12777
+ };
12778
+ };
12754
12779
  var escapeMarkdown = (value) => value.replaceAll("|", "\\|");
12755
12780
  var renderVoiceSloCalibrationMarkdown = (report, options = {}) => {
12756
12781
  const rows = Object.values(report.thresholds).map((threshold) => `| ${escapeMarkdown(threshold.metric)} | ${threshold.status} | ${threshold.samples} | ${threshold.baselineP95Ms ?? "n/a"} | ${threshold.warnAfterMs ?? "n/a"} | ${threshold.failAfterMs ?? "n/a"} |`).join(`
@@ -28709,17 +28734,27 @@ var createVoiceProductionReadinessRoutes = (options) => {
28709
28734
  const routes = new Elysia44({
28710
28735
  name: options.name ?? "absolutejs-voice-production-readiness"
28711
28736
  });
28712
- routes.get(path, async ({ query, request }) => buildVoiceProductionReadinessReport(options, { query, request }));
28737
+ const resolveOptions = async (input) => {
28738
+ if (!options.resolveOptions) {
28739
+ return options;
28740
+ }
28741
+ return {
28742
+ ...options,
28743
+ ...await options.resolveOptions(input)
28744
+ };
28745
+ };
28746
+ routes.get(path, async ({ query, request }) => buildVoiceProductionReadinessReport(await resolveOptions({ query, request }), { query, request }));
28713
28747
  if (gatePath !== false) {
28714
28748
  routes.get(gatePath, async ({ query, request }) => {
28715
- const gate = await buildVoiceProductionReadinessGate(options, {
28749
+ const resolvedOptions = await resolveOptions({ query, request });
28750
+ const gate = await buildVoiceProductionReadinessGate(resolvedOptions, {
28716
28751
  query,
28717
28752
  request
28718
28753
  });
28719
28754
  return new Response(JSON.stringify(gate), {
28720
28755
  headers: {
28721
28756
  "Content-Type": "application/json; charset=utf-8",
28722
- ...options.headers
28757
+ ...resolvedOptions.headers
28723
28758
  },
28724
28759
  status: gate.ok ? 200 : 503
28725
28760
  });
@@ -28727,15 +28762,16 @@ var createVoiceProductionReadinessRoutes = (options) => {
28727
28762
  }
28728
28763
  if (htmlPath !== false) {
28729
28764
  routes.get(htmlPath, async ({ query, request }) => {
28730
- const report = await buildVoiceProductionReadinessReport(options, {
28765
+ const resolvedOptions = await resolveOptions({ query, request });
28766
+ const report = await buildVoiceProductionReadinessReport(resolvedOptions, {
28731
28767
  query,
28732
28768
  request
28733
28769
  });
28734
- const body = await (options.render ?? renderVoiceProductionReadinessHTML)(report);
28770
+ const body = await (resolvedOptions.render ?? renderVoiceProductionReadinessHTML)(report);
28735
28771
  return new Response(body, {
28736
28772
  headers: {
28737
28773
  "Content-Type": "text/html; charset=utf-8",
28738
- ...options.headers
28774
+ ...resolvedOptions.headers
28739
28775
  }
28740
28776
  });
28741
28777
  });
@@ -32905,6 +32941,7 @@ export {
32905
32941
  createVoiceTaskSLABreachedEvent,
32906
32942
  createVoiceTaskCreatedEvent,
32907
32943
  createVoiceTTSProviderRouter,
32944
+ createVoiceSloThresholdProfile,
32908
32945
  createVoiceSloCalibrationRoutes,
32909
32946
  createVoiceSimulationSuiteRoutes,
32910
32947
  createVoiceSessionsJSONHandler,
@@ -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;
@@ -49,6 +49,25 @@ export type VoiceSloCalibrationReport = {
49
49
  status: VoiceSloCalibrationStatus;
50
50
  thresholds: VoiceSloCalibrationThresholds;
51
51
  };
52
+ export type VoiceSloThresholdProfile = {
53
+ bargeIn: {
54
+ thresholdMs?: number;
55
+ };
56
+ issues: string[];
57
+ liveLatency: {
58
+ failAfterMs?: number;
59
+ warnAfterMs?: number;
60
+ };
61
+ monitoring: {
62
+ monitorRunFailAfterMs?: number;
63
+ notifierDeliveryFailAfterMs?: number;
64
+ };
65
+ providerSlo: VoiceProviderSloThresholdConfig;
66
+ reconnect: {
67
+ failAfterMs?: number;
68
+ };
69
+ status: VoiceSloCalibrationStatus;
70
+ };
52
71
  export type VoiceSloCalibrationOptions = {
53
72
  headroomMultiplier?: number;
54
73
  liveLatencyMinimumMs?: number;
@@ -71,6 +90,7 @@ export type VoiceSloCalibrationRoutesOptions = VoiceSloCalibrationOptions & {
71
90
  };
72
91
  export declare const buildVoiceSloCalibrationReport: (input: Array<VoiceProofTrendReport | VoiceSloCalibrationSample>, options?: VoiceSloCalibrationOptions) => VoiceSloCalibrationReport;
73
92
  export declare const assertVoiceSloCalibration: (input: Array<VoiceProofTrendReport | VoiceSloCalibrationSample>, options?: VoiceSloCalibrationOptions) => VoiceSloCalibrationReport;
93
+ export declare const createVoiceSloThresholdProfile: (input: VoiceSloCalibrationReport | Array<VoiceProofTrendReport | VoiceSloCalibrationSample>, options?: VoiceSloCalibrationOptions) => VoiceSloThresholdProfile;
74
94
  export declare const renderVoiceSloCalibrationMarkdown: (report: VoiceSloCalibrationReport, options?: {
75
95
  title?: string;
76
96
  }) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.281",
3
+ "version": "0.0.22-beta.283",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",