@absolutejs/voice 0.0.22-beta.156 → 0.0.22-beta.158

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
@@ -44,7 +44,7 @@ export { createVoiceProviderHealthHTMLHandler, createVoiceProviderHealthJSONHand
44
44
  export { createVoiceProviderCapabilityHTMLHandler, createVoiceProviderCapabilityJSONHandler, createVoiceProviderCapabilityRoutes, renderVoiceProviderCapabilityHTML, summarizeVoiceProviderCapabilities } from './providerCapabilities';
45
45
  export { assertVoiceProviderRoutingContract, runVoiceProviderRoutingContract } from './providerRoutingContract';
46
46
  export { createVoicePhoneAgentProductionSmokeHTMLHandler, createVoicePhoneAgentProductionSmokeJSONHandler, createVoicePhoneAgentProductionSmokeRoutes, renderVoicePhoneAgentProductionSmokeHTML, runVoicePhoneAgentProductionSmokeContract } from './phoneAgentProductionSmoke';
47
- export { buildVoiceProductionReadinessReport, createVoiceProductionReadinessRoutes, renderVoiceProductionReadinessHTML } from './productionReadiness';
47
+ export { buildVoiceProductionReadinessGate, buildVoiceProductionReadinessReport, createVoiceProductionReadinessRoutes, renderVoiceProductionReadinessHTML, summarizeVoiceProductionReadinessGate } from './productionReadiness';
48
48
  export { buildVoiceOpsConsoleReport, createVoiceOpsConsoleRoutes, renderVoiceOpsConsoleHTML } from './opsConsoleRoutes';
49
49
  export { summarizeVoiceOpsStatus } from './opsStatus';
50
50
  export { createVoiceOpsStatusRoutes, renderVoiceOpsStatusHTML } from './opsStatusRoutes';
@@ -102,7 +102,7 @@ export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneA
102
102
  export type { VoicePhoneAgentProductionSmokeIssue, VoicePhoneAgentProductionSmokeHandlerOptions, VoicePhoneAgentProductionSmokeHTMLHandlerOptions, VoicePhoneAgentProductionSmokeOptions, VoicePhoneAgentProductionSmokeReport, VoicePhoneAgentProductionSmokeRoutesOptions, VoicePhoneAgentProductionSmokeRequirement } from './phoneAgentProductionSmoke';
103
103
  export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesOptions } from './opsConsoleRoutes';
104
104
  export type { VoiceOpsStatus, VoiceOpsStatusLink, VoiceOpsStatusOptions, VoiceOpsStatusReport, VoiceOpsStatusRoutesOptions } from './opsStatus';
105
- export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessCheck, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
105
+ export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessCheck, VoiceProductionReadinessGateIssue, VoiceProductionReadinessGateOptions, VoiceProductionReadinessGateReport, VoiceProductionReadinessOpsActionHistoryOptions, VoiceProductionReadinessOpsActionHistorySummary, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
106
106
  export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQualityRoutesOptions, VoiceQualityStatus, VoiceQualityThresholds } from './qualityRoutes';
107
107
  export type { VoiceResilienceIOSimulator, VoiceResilienceLink, VoiceResiliencePageData, VoiceResilienceRoutesOptions, VoiceResilienceSimulationProvider, VoiceRoutingKindSummary, VoiceRoutingDecisionSummary, VoiceRoutingDecisionSummaryOptions, VoiceRoutingEvent, VoiceRoutingEventKind, VoiceRoutingSessionSummary, VoiceRoutingSessionSummaryOptions } from './resilienceRoutes';
108
108
  export type { VoiceIOProviderRouterEvent, VoiceIOProviderRouterOptions, VoiceIOProviderRouterPolicy, VoiceIOProviderRouterPolicyConfig, VoiceSTTProviderRouterOptions, VoiceTTSProviderRouterOptions } from './providerAdapters';
package/dist/index.js CHANGED
@@ -20128,6 +20128,47 @@ var assertVoiceProviderRoutingContract = async (options) => {
20128
20128
  import { Elysia as Elysia33 } from "elysia";
20129
20129
  var escapeHtml35 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
20130
20130
  var rollupStatus2 = (checks) => checks.some((check) => check.status === "fail") ? "fail" : checks.some((check) => check.status === "warn") ? "warn" : "pass";
20131
+ var readinessGateCodes = {
20132
+ "Agent squad contracts": "voice.readiness.agent_squad_contracts",
20133
+ "Audit evidence": "voice.readiness.audit_evidence",
20134
+ "Audit sink delivery": "voice.readiness.audit_sink_delivery",
20135
+ "Barge-in interruption proof": "voice.readiness.barge_in_interruption",
20136
+ "Carrier readiness": "voice.readiness.carrier_readiness",
20137
+ "Delivery runtime": "voice.readiness.delivery_runtime",
20138
+ "Handoff delivery": "voice.readiness.handoff_delivery",
20139
+ "Live latency proof": "voice.readiness.live_latency",
20140
+ "Operator action history": "voice.readiness.operator_action_history",
20141
+ "Phone agent production smoke": "voice.readiness.phone_agent_smoke",
20142
+ "Provider fallback recovery": "voice.readiness.provider_fallback_recovery",
20143
+ "Provider health": "voice.readiness.provider_health",
20144
+ "Provider routing contracts": "voice.readiness.provider_routing_contracts",
20145
+ "Quality gates": "voice.readiness.quality_gates",
20146
+ "Reconnect recovery contracts": "voice.readiness.reconnect_contracts",
20147
+ "Routing evidence": "voice.readiness.routing_evidence",
20148
+ "Session health": "voice.readiness.session_health",
20149
+ "Trace sink delivery": "voice.readiness.trace_sink_delivery"
20150
+ };
20151
+ var readinessGateCodeForCheck = (check) => readinessGateCodes[check.label] ?? `voice.readiness.${check.label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "")}`;
20152
+ var summarizeVoiceProductionReadinessGate = (report, options = {}) => {
20153
+ const issues = report.checks.filter((check) => check.status !== "pass").map((check) => ({
20154
+ code: readinessGateCodeForCheck(check),
20155
+ detail: check.detail,
20156
+ href: check.href,
20157
+ label: check.label,
20158
+ status: check.status,
20159
+ value: check.value
20160
+ }));
20161
+ const failures = issues.filter((issue) => issue.status === "fail");
20162
+ const warnings = issues.filter((issue) => issue.status === "warn");
20163
+ const ok = failures.length === 0 && (options.failOnWarnings ? warnings.length === 0 : true);
20164
+ return {
20165
+ checkedAt: report.checkedAt,
20166
+ failures,
20167
+ ok,
20168
+ status: ok ? report.status : "fail",
20169
+ warnings
20170
+ };
20171
+ };
20131
20172
  var carrierStatus = (matrix) => matrix.summary.failing > 0 ? "fail" : matrix.summary.warnings > 0 || matrix.summary.ready < matrix.summary.providers ? "warn" : "pass";
20132
20173
  var resolveCarriers = async (options, input) => {
20133
20174
  if (options.carriers === false || options.carriers === undefined) {
@@ -20274,6 +20315,31 @@ var summarizeAuditDeliveries = async (options) => {
20274
20315
  warnPendingAfterMs
20275
20316
  };
20276
20317
  };
20318
+ var summarizeOpsActionHistory = async (options) => {
20319
+ if (!options.opsActionHistory) {
20320
+ return;
20321
+ }
20322
+ const opsActionHistory = "list" in options.opsActionHistory ? {
20323
+ failOnFailedActions: true,
20324
+ store: options.opsActionHistory,
20325
+ warnWhenEmpty: false
20326
+ } : {
20327
+ failOnFailedActions: options.opsActionHistory.failOnFailedActions ?? true,
20328
+ store: options.opsActionHistory.store,
20329
+ warnWhenEmpty: options.opsActionHistory.warnWhenEmpty ?? false
20330
+ };
20331
+ const report = await buildVoiceOpsActionHistoryReport({
20332
+ audit: opsActionHistory.store
20333
+ });
20334
+ const status = report.failed > 0 ? opsActionHistory.failOnFailedActions ? "fail" : "warn" : report.total === 0 && opsActionHistory.warnWhenEmpty ? "warn" : "pass";
20335
+ return {
20336
+ failed: report.failed,
20337
+ passed: report.passed,
20338
+ status,
20339
+ total: report.total,
20340
+ warnWhenEmpty: opsActionHistory.warnWhenEmpty
20341
+ };
20342
+ };
20277
20343
  var summarizeTraceDeliveries = async (options) => {
20278
20344
  if (!options.traceDeliveries) {
20279
20345
  return;
@@ -20378,6 +20444,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20378
20444
  handoffs,
20379
20445
  audit,
20380
20446
  auditDeliveries,
20447
+ opsActionHistory,
20381
20448
  traceDeliveries,
20382
20449
  deliveryRuntimeSummary,
20383
20450
  carriers,
@@ -20407,6 +20474,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20407
20474
  summarizeVoiceHandoffHealth({ events }),
20408
20475
  summarizeAuditEvidence(options),
20409
20476
  summarizeAuditDeliveries(options),
20477
+ summarizeOpsActionHistory(options),
20410
20478
  summarizeTraceDeliveries(options),
20411
20479
  resolveDeliveryRuntime(options, { query, request }),
20412
20480
  resolveCarriers(options, { query, request }),
@@ -20689,6 +20757,23 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20689
20757
  ]
20690
20758
  });
20691
20759
  }
20760
+ if (opsActionHistory) {
20761
+ checks.push({
20762
+ detail: opsActionHistory.status === "pass" ? opsActionHistory.total > 0 ? `${opsActionHistory.passed} operator action(s) completed successfully.` : "No operator action failures are recorded." : opsActionHistory.failed > 0 ? `${opsActionHistory.failed} operator action(s) failed and need review.` : "No operator action history is recorded yet.",
20763
+ href: options.links?.opsActions ?? "/voice/ops-actions",
20764
+ label: "Operator action history",
20765
+ proofSource: proofSource("opsActions", "operatorActions"),
20766
+ status: opsActionHistory.status,
20767
+ value: `${opsActionHistory.passed}/${opsActionHistory.total}`,
20768
+ actions: opsActionHistory.status === "pass" ? [] : [
20769
+ {
20770
+ description: "Open operator action history and inspect failed control-plane actions.",
20771
+ href: options.links?.opsActions ?? "/voice/ops-actions",
20772
+ label: "Open action history"
20773
+ }
20774
+ ]
20775
+ });
20776
+ }
20692
20777
  if (traceDeliveries) {
20693
20778
  checks.push({
20694
20779
  detail: traceDeliveries.status === "pass" ? "Trace sink deliveries are clear." : traceDeliveries.staleFailing > 0 ? `${traceDeliveries.staleFailing} trace delivery item(s) are stale past ${Math.round(traceDeliveries.failPendingAfterMs / 1000)}s.` : traceDeliveries.failed > 0 || traceDeliveries.deadLettered > 0 ? `${traceDeliveries.failed} failed and ${traceDeliveries.deadLettered} dead-lettered trace delivery item(s).` : `${traceDeliveries.pending} trace delivery item(s) are pending.`,
@@ -20752,6 +20837,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20752
20837
  handoffs: "/handoffs",
20753
20838
  handoffRetry: "/api/voice-handoffs/retry",
20754
20839
  liveLatency: "/traces",
20840
+ opsActions: "/voice/ops-actions",
20755
20841
  phoneAgentSmoke: "/sessions",
20756
20842
  providerRoutingContracts: "/resilience",
20757
20843
  quality: "/quality",
@@ -20775,6 +20861,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20775
20861
  total: handoffs.total
20776
20862
  },
20777
20863
  liveLatency,
20864
+ opsActionHistory,
20778
20865
  providers: {
20779
20866
  degraded: degradedProviders,
20780
20867
  total: providers.length
@@ -20798,6 +20885,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20798
20885
  }
20799
20886
  };
20800
20887
  };
20888
+ var buildVoiceProductionReadinessGate = async (options, input = {}) => summarizeVoiceProductionReadinessGate(await buildVoiceProductionReadinessReport(options, input), options.gate || undefined);
20801
20889
  var renderVoiceProductionReadinessHTML = (report, options = {}) => {
20802
20890
  const title = options.title ?? "AbsoluteJS Voice Production Readiness";
20803
20891
  const checks = report.checks.map((check, index) => {
@@ -20818,11 +20906,27 @@ var renderVoiceProductionReadinessHTML = (report, options = {}) => {
20818
20906
  };
20819
20907
  var createVoiceProductionReadinessRoutes = (options) => {
20820
20908
  const path = options.path ?? "/api/production-readiness";
20909
+ const gatePath = options.gatePath === undefined ? "/api/production-readiness/gate" : options.gatePath;
20821
20910
  const htmlPath = options.htmlPath ?? "/production-readiness";
20822
20911
  const routes = new Elysia33({
20823
20912
  name: options.name ?? "absolutejs-voice-production-readiness"
20824
20913
  });
20825
20914
  routes.get(path, async ({ query, request }) => buildVoiceProductionReadinessReport(options, { query, request }));
20915
+ if (gatePath !== false) {
20916
+ routes.get(gatePath, async ({ query, request }) => {
20917
+ const gate = await buildVoiceProductionReadinessGate(options, {
20918
+ query,
20919
+ request
20920
+ });
20921
+ return new Response(JSON.stringify(gate), {
20922
+ headers: {
20923
+ "Content-Type": "application/json; charset=utf-8",
20924
+ ...options.headers
20925
+ },
20926
+ status: gate.ok ? 200 : 503
20927
+ });
20928
+ });
20929
+ }
20826
20930
  if (htmlPath !== false) {
20827
20931
  routes.get(htmlPath, async ({ query, request }) => {
20828
20932
  const report = await buildVoiceProductionReadinessReport(options, {
@@ -23548,6 +23652,7 @@ export {
23548
23652
  summarizeVoiceProviderHealth,
23549
23653
  summarizeVoiceProviderFallbackRecovery,
23550
23654
  summarizeVoiceProviderCapabilities,
23655
+ summarizeVoiceProductionReadinessGate,
23551
23656
  summarizeVoiceOpsTasks,
23552
23657
  summarizeVoiceOpsTaskQueue,
23553
23658
  summarizeVoiceOpsTaskAnalytics,
@@ -23921,6 +24026,7 @@ export {
23921
24026
  buildVoiceTraceReplay,
23922
24027
  buildVoiceTraceDeliveryReport,
23923
24028
  buildVoiceProductionReadinessReport,
24029
+ buildVoiceProductionReadinessGate,
23924
24030
  buildVoiceOpsTaskFromSLABreach,
23925
24031
  buildVoiceOpsTaskFromReview,
23926
24032
  buildVoiceOpsConsoleReport,
@@ -27,6 +27,24 @@ export type VoiceProductionReadinessCheck = {
27
27
  status: VoiceProductionReadinessStatus;
28
28
  value?: number | string;
29
29
  };
30
+ export type VoiceProductionReadinessGateIssue = {
31
+ code: string;
32
+ detail?: string;
33
+ href?: string;
34
+ label: string;
35
+ status: Exclude<VoiceProductionReadinessStatus, 'pass'>;
36
+ value?: number | string;
37
+ };
38
+ export type VoiceProductionReadinessGateOptions = {
39
+ failOnWarnings?: boolean;
40
+ };
41
+ export type VoiceProductionReadinessGateReport = {
42
+ checkedAt: number;
43
+ failures: VoiceProductionReadinessGateIssue[];
44
+ ok: boolean;
45
+ status: VoiceProductionReadinessStatus;
46
+ warnings: VoiceProductionReadinessGateIssue[];
47
+ };
30
48
  export type VoiceProductionReadinessProofSource = {
31
49
  detail?: string;
32
50
  href?: string;
@@ -47,6 +65,7 @@ export type VoiceProductionReadinessReport = {
47
65
  handoffs?: string;
48
66
  handoffRetry?: string;
49
67
  liveLatency?: string;
68
+ opsActions?: string;
50
69
  phoneAgentSmoke?: string;
51
70
  providerRoutingContracts?: string;
52
71
  quality?: string;
@@ -92,6 +111,7 @@ export type VoiceProductionReadinessReport = {
92
111
  total: number;
93
112
  warnings: number;
94
113
  };
114
+ opsActionHistory?: VoiceProductionReadinessOpsActionHistorySummary;
95
115
  providers: {
96
116
  degraded: number;
97
117
  total: number;
@@ -171,6 +191,13 @@ export type VoiceProductionReadinessTraceDeliverySummary = {
171
191
  total: number;
172
192
  warnPendingAfterMs: number;
173
193
  };
194
+ export type VoiceProductionReadinessOpsActionHistorySummary = {
195
+ failed: number;
196
+ passed: number;
197
+ status: VoiceProductionReadinessStatus;
198
+ total: number;
199
+ warnWhenEmpty: boolean;
200
+ };
174
201
  export type VoiceProductionReadinessDeliveryRuntimeSummary = {
175
202
  audit?: VoiceProductionReadinessDeliveryRuntimeQueueSummary;
176
203
  deadLettered: number;
@@ -208,6 +235,11 @@ export type VoiceProductionReadinessTraceDeliveryOptions = VoiceTraceSinkDeliver
208
235
  store: VoiceTraceSinkDeliveryStore;
209
236
  warnPendingAfterMs?: number;
210
237
  };
238
+ export type VoiceProductionReadinessOpsActionHistoryOptions = VoiceAuditEventStore | {
239
+ failOnFailedActions?: boolean;
240
+ store: VoiceAuditEventStore;
241
+ warnWhenEmpty?: boolean;
242
+ };
211
243
  export type VoiceProductionReadinessRoutesOptions = {
212
244
  agentSquadContracts?: false | readonly VoiceAgentSquadContractReport[] | ((input: {
213
245
  query: Record<string, unknown>;
@@ -228,10 +260,13 @@ export type VoiceProductionReadinessRoutesOptions = {
228
260
  request: Request;
229
261
  }) => Promise<VoiceDeliveryRuntime | VoiceDeliveryRuntimeSummary> | VoiceDeliveryRuntime | VoiceDeliveryRuntimeSummary);
230
262
  headers?: HeadersInit;
263
+ gate?: false | VoiceProductionReadinessGateOptions;
264
+ gatePath?: false | string;
231
265
  htmlPath?: false | string;
232
266
  links?: VoiceProductionReadinessReport['links'];
233
267
  llmProviders?: readonly string[];
234
268
  name?: string;
269
+ opsActionHistory?: false | VoiceProductionReadinessOpsActionHistoryOptions;
235
270
  path?: string;
236
271
  phoneAgentSmokes?: false | readonly VoicePhoneAgentProductionSmokeReport[] | ((input: {
237
272
  query: Record<string, unknown>;
@@ -258,10 +293,15 @@ export type VoiceProductionReadinessRoutesOptions = {
258
293
  liveLatencyWarnAfterMs?: number;
259
294
  liveLatencyFailAfterMs?: number;
260
295
  };
296
+ export declare const summarizeVoiceProductionReadinessGate: (report: VoiceProductionReadinessReport, options?: VoiceProductionReadinessGateOptions) => VoiceProductionReadinessGateReport;
261
297
  export declare const buildVoiceProductionReadinessReport: (options: VoiceProductionReadinessRoutesOptions, input?: {
262
298
  query?: Record<string, unknown>;
263
299
  request?: Request;
264
300
  }) => Promise<VoiceProductionReadinessReport>;
301
+ export declare const buildVoiceProductionReadinessGate: (options: VoiceProductionReadinessRoutesOptions, input?: {
302
+ query?: Record<string, unknown>;
303
+ request?: Request;
304
+ }) => Promise<VoiceProductionReadinessGateReport>;
265
305
  export declare const renderVoiceProductionReadinessHTML: (report: VoiceProductionReadinessReport, options?: {
266
306
  title?: string;
267
307
  }) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.156",
3
+ "version": "0.0.22-beta.158",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",