@absolutejs/voice 0.0.22-beta.165 → 0.0.22-beta.166

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
@@ -46,7 +46,7 @@ export { assertVoiceProviderRoutingContract, runVoiceProviderRoutingContract } f
46
46
  export { createVoicePhoneAgentProductionSmokeHTMLHandler, createVoicePhoneAgentProductionSmokeJSONHandler, createVoicePhoneAgentProductionSmokeRoutes, renderVoicePhoneAgentProductionSmokeHTML, runVoicePhoneAgentProductionSmokeContract } from './phoneAgentProductionSmoke';
47
47
  export { buildVoiceProductionReadinessGate, buildVoiceProductionReadinessReport, createVoiceProductionReadinessRoutes, renderVoiceProductionReadinessHTML, summarizeVoiceProductionReadinessGate } from './productionReadiness';
48
48
  export { createVoiceReadinessProfile, recommendVoiceReadinessProfile } from './readinessProfiles';
49
- export { evaluateVoiceProviderStackGaps, recommendVoiceProviderStack } from './providerStackRecommendations';
49
+ export { buildVoiceProviderContractMatrix, evaluateVoiceProviderStackGaps, recommendVoiceProviderStack } from './providerStackRecommendations';
50
50
  export { buildVoiceOpsConsoleReport, createVoiceOpsConsoleRoutes, renderVoiceOpsConsoleHTML } from './opsConsoleRoutes';
51
51
  export { summarizeVoiceOpsStatus } from './opsStatus';
52
52
  export { createVoiceOpsStatusRoutes, renderVoiceOpsStatusHTML } from './opsStatusRoutes';
@@ -106,7 +106,7 @@ export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesO
106
106
  export type { VoiceOpsStatus, VoiceOpsStatusLink, VoiceOpsStatusOptions, VoiceOpsStatusReport, VoiceOpsStatusRoutesOptions } from './opsStatus';
107
107
  export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessCheck, VoiceProductionReadinessGateIssue, VoiceProductionReadinessGateOptions, VoiceProductionReadinessGateProfile, VoiceProductionReadinessGateProfileSurface, VoiceProductionReadinessGateReport, VoiceProductionReadinessOpsActionHistoryOptions, VoiceProductionReadinessOpsActionHistorySummary, VoiceProductionReadinessProfileExplanation, VoiceProductionReadinessProfileSurface, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
108
108
  export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRecommendation, VoiceReadinessProfileRecommendationScore, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
109
- export type { VoiceProviderStackChoice, VoiceProviderStackCapabilities, VoiceProviderStackCapabilityGap, VoiceProviderStackCapabilityGapInput, VoiceProviderStackCapabilityGapReport, VoiceProviderStackInput, VoiceProviderStackKind, VoiceProviderStackRecommendation } from './providerStackRecommendations';
109
+ export type { VoiceProviderStackChoice, VoiceProviderStackCapabilities, VoiceProviderStackCapabilityGap, VoiceProviderStackCapabilityGapInput, VoiceProviderStackCapabilityGapReport, VoiceProviderContractCheck, VoiceProviderContractCheckStatus, VoiceProviderContractDefinition, VoiceProviderContractMatrixInput, VoiceProviderContractMatrixReport, VoiceProviderContractMatrixRow, VoiceProviderStackInput, VoiceProviderStackKind, VoiceProviderStackRecommendation } from './providerStackRecommendations';
110
110
  export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQualityRoutesOptions, VoiceQualityStatus, VoiceQualityThresholds } from './qualityRoutes';
111
111
  export type { VoiceResilienceIOSimulator, VoiceResilienceLink, VoiceResiliencePageData, VoiceResilienceRoutesOptions, VoiceResilienceSimulationProvider, VoiceRoutingKindSummary, VoiceRoutingDecisionSummary, VoiceRoutingDecisionSummaryOptions, VoiceRoutingEvent, VoiceRoutingEventKind, VoiceRoutingSessionSummary, VoiceRoutingSessionSummaryOptions } from './resilienceRoutes';
112
112
  export type { VoiceIOProviderRouterEvent, VoiceIOProviderRouterOptions, VoiceIOProviderRouterPolicy, VoiceIOProviderRouterPolicyConfig, VoiceSTTProviderRouterOptions, VoiceTTSProviderRouterOptions } from './providerAdapters';
package/dist/index.js CHANGED
@@ -20139,6 +20139,7 @@ var readinessGateCodes = {
20139
20139
  "Live latency proof": "voice.readiness.live_latency",
20140
20140
  "Operator action history": "voice.readiness.operator_action_history",
20141
20141
  "Phone agent production smoke": "voice.readiness.phone_agent_smoke",
20142
+ "Provider contract matrix": "voice.readiness.provider_contract_matrix",
20142
20143
  "Provider fallback recovery": "voice.readiness.provider_fallback_recovery",
20143
20144
  "Provider health": "voice.readiness.provider_health",
20144
20145
  "Provider routing contracts": "voice.readiness.provider_routing_contracts",
@@ -20220,6 +20221,12 @@ var resolveProviderStack = async (options, input) => {
20220
20221
  }
20221
20222
  return typeof options.providerStack === "function" ? await options.providerStack(input) : options.providerStack;
20222
20223
  };
20224
+ var resolveProviderContractMatrix = async (options, input) => {
20225
+ if (options.providerContractMatrix === false || options.providerContractMatrix === undefined) {
20226
+ return;
20227
+ }
20228
+ return typeof options.providerContractMatrix === "function" ? await options.providerContractMatrix(input) : options.providerContractMatrix;
20229
+ };
20223
20230
  var resolvePhoneAgentSmokes = async (options, input) => {
20224
20231
  if (options.phoneAgentSmokes === false || options.phoneAgentSmokes === undefined) {
20225
20232
  return;
@@ -20480,6 +20487,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20480
20487
  agentSquadContracts,
20481
20488
  providerRoutingContracts,
20482
20489
  providerStack,
20490
+ providerContractMatrix,
20483
20491
  phoneAgentSmokes,
20484
20492
  reconnectContracts,
20485
20493
  bargeInReports,
@@ -20511,6 +20519,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20511
20519
  resolveAgentSquadContracts(options, { query, request }),
20512
20520
  resolveProviderRoutingContracts(options, { query, request }),
20513
20521
  resolveProviderStack(options, { query, request }),
20522
+ resolveProviderContractMatrix(options, { query, request }),
20514
20523
  resolvePhoneAgentSmokes(options, { query, request }),
20515
20524
  resolveReconnectContracts(options, { query, request }),
20516
20525
  resolveBargeInReports(options, { query, request }),
@@ -20721,6 +20730,26 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20721
20730
  ]
20722
20731
  });
20723
20732
  }
20733
+ if (providerContractMatrix) {
20734
+ const blocked = providerContractMatrix.rows.filter((row) => row.status !== "pass");
20735
+ checks.push({
20736
+ detail: providerContractMatrix.status === "pass" ? `${providerContractMatrix.passed} provider contract row(s) are production-ready.` : blocked.length > 0 ? blocked.map((row) => {
20737
+ const issues = row.checks.filter((check) => check.status !== "pass").map((check) => check.label).join(", ");
20738
+ return `${row.kind.toUpperCase()} ${row.provider}: ${issues}`;
20739
+ }).join("; ") + "." : "Provider contract matrix needs review.",
20740
+ href: options.links?.providerRoutingContracts ?? options.links?.resilience ?? "/resilience",
20741
+ label: "Provider contract matrix",
20742
+ status: providerContractMatrix.status,
20743
+ value: `${providerContractMatrix.passed}/${providerContractMatrix.total}`,
20744
+ actions: providerContractMatrix.status === "pass" ? [] : [
20745
+ {
20746
+ description: "Open provider capabilities and inspect missing env, fallback, streaming, latency, or capability contracts.",
20747
+ href: options.links?.providerRoutingContracts ?? options.links?.resilience ?? "/resilience",
20748
+ label: "Open provider matrix"
20749
+ }
20750
+ ]
20751
+ });
20752
+ }
20724
20753
  if (phoneAgentSmokeSummary) {
20725
20754
  checks.push({
20726
20755
  detail: phoneAgentSmokeSummary.status === "pass" ? `${phoneAgentSmokeSummary.passed} phone-agent smoke contract(s) are passing.` : phoneAgentSmokeSummary.total === 0 ? "No phone-agent production smoke contracts are configured." : `${phoneAgentSmokeSummary.failed} phone-agent production smoke contract(s) failed.`,
@@ -20916,6 +20945,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
20916
20945
  total: providers.length
20917
20946
  },
20918
20947
  providerStack,
20948
+ providerContractMatrix,
20919
20949
  providerRecovery,
20920
20950
  phoneAgentSmokes: phoneAgentSmokeSummary,
20921
20951
  providerRoutingContracts: providerRoutingContractSummary,
@@ -21394,6 +21424,71 @@ var recommendVoiceProviderStack = (input) => {
21394
21424
  stacks
21395
21425
  };
21396
21426
  };
21427
+ var rollupContractStatus = (checks) => checks.some((check) => check.status === "fail") ? "fail" : checks.some((check) => check.status === "warn") ? "warn" : "pass";
21428
+ var buildVoiceProviderContractMatrix = (input) => {
21429
+ const rows = input.contracts.map((contract) => {
21430
+ const configured = contract.configured !== false;
21431
+ const missingEnv = (contract.requiredEnv ?? []).filter((name) => !contract.env?.[name]);
21432
+ const missingCapabilities = (contract.requiredCapabilities ?? []).filter((capability) => !includesCapability(contract.capabilities ?? [], capability));
21433
+ const checks = [
21434
+ {
21435
+ detail: configured ? "Provider is configured for this deployment." : "Provider is declared but not configured.",
21436
+ key: "configured",
21437
+ label: "Configured",
21438
+ status: configured ? "pass" : "fail"
21439
+ },
21440
+ {
21441
+ detail: missingEnv.length === 0 ? "Required environment is present." : `Missing env: ${missingEnv.join(", ")}.`,
21442
+ key: "env",
21443
+ label: "Required env",
21444
+ status: missingEnv.length === 0 ? "pass" : "fail"
21445
+ },
21446
+ {
21447
+ detail: contract.latencyBudgetMs !== undefined ? `Latency budget is ${contract.latencyBudgetMs}ms.` : "No latency budget declared.",
21448
+ key: "latencyBudget",
21449
+ label: "Latency budget",
21450
+ status: contract.latencyBudgetMs !== undefined ? "pass" : "warn"
21451
+ },
21452
+ {
21453
+ detail: (contract.fallbackProviders ?? []).length > 0 ? `Fallback providers: ${contract.fallbackProviders?.join(", ")}.` : "No fallback provider declared.",
21454
+ key: "fallback",
21455
+ label: "Fallback",
21456
+ status: (contract.fallbackProviders ?? []).length > 0 ? "pass" : "warn"
21457
+ },
21458
+ {
21459
+ detail: contract.streaming ? "Streaming is supported." : "Streaming support is not declared.",
21460
+ key: "streaming",
21461
+ label: "Streaming",
21462
+ status: contract.streaming ? "pass" : "warn"
21463
+ },
21464
+ {
21465
+ detail: missingCapabilities.length === 0 ? "Required capabilities are declared." : `Missing capabilities: ${missingCapabilities.join(", ")}.`,
21466
+ key: "capabilities",
21467
+ label: "Capabilities",
21468
+ status: missingCapabilities.length === 0 ? "pass" : "warn"
21469
+ }
21470
+ ];
21471
+ const status = rollupContractStatus(checks);
21472
+ return {
21473
+ checks,
21474
+ configured,
21475
+ kind: contract.kind,
21476
+ provider: contract.provider,
21477
+ selected: contract.selected === true,
21478
+ status
21479
+ };
21480
+ });
21481
+ const failed = rows.filter((row) => row.status === "fail").length;
21482
+ const warned = rows.filter((row) => row.status === "warn").length;
21483
+ return {
21484
+ failed,
21485
+ passed: rows.filter((row) => row.status === "pass").length,
21486
+ rows,
21487
+ status: failed > 0 ? "fail" : warned > 0 ? "warn" : "pass",
21488
+ total: rows.length,
21489
+ warned
21490
+ };
21491
+ };
21397
21492
  var normalizeCapability = (value) => value.toLowerCase().replace(/[^a-z0-9]+/g, "");
21398
21493
  var includesCapability = (capabilities, required) => {
21399
21494
  const normalizedRequired = normalizeCapability(required);
@@ -24511,6 +24606,7 @@ export {
24511
24606
  claimVoiceOpsTask,
24512
24607
  buildVoiceTraceReplay,
24513
24608
  buildVoiceTraceDeliveryReport,
24609
+ buildVoiceProviderContractMatrix,
24514
24610
  buildVoiceProductionReadinessReport,
24515
24611
  buildVoiceProductionReadinessGate,
24516
24612
  buildVoiceOpsTaskFromSLABreach,
@@ -11,7 +11,7 @@ import type { VoicePhoneAgentProductionSmokeReport } from './phoneAgentProductio
11
11
  import type { VoiceReconnectContractReport } from './reconnectContract';
12
12
  import type { VoiceAuditEventStore, VoiceAuditEventType, VoiceAuditOutcome } from './audit';
13
13
  import { type VoiceAuditSinkDeliveryStore } from './auditSinks';
14
- import type { VoiceProviderStackCapabilityGapReport } from './providerStackRecommendations';
14
+ import type { VoiceProviderContractMatrixReport, VoiceProviderStackCapabilityGapReport } from './providerStackRecommendations';
15
15
  export type VoiceProductionReadinessStatus = 'fail' | 'pass' | 'warn';
16
16
  export type VoiceProductionReadinessAction = {
17
17
  description?: string;
@@ -139,6 +139,7 @@ export type VoiceProductionReadinessReport = {
139
139
  total: number;
140
140
  };
141
141
  providerStack?: VoiceProviderStackCapabilityGapReport;
142
+ providerContractMatrix?: VoiceProviderContractMatrixReport;
142
143
  providerRecovery: VoiceProviderFallbackRecoverySummary;
143
144
  phoneAgentSmokes?: {
144
145
  failed: number;
@@ -303,6 +304,10 @@ export type VoiceProductionReadinessRoutesOptions = {
303
304
  query: Record<string, unknown>;
304
305
  request: Request;
305
306
  }) => Promise<VoiceProviderStackCapabilityGapReport> | VoiceProviderStackCapabilityGapReport);
307
+ providerContractMatrix?: false | VoiceProviderContractMatrixReport | ((input: {
308
+ query: Record<string, unknown>;
309
+ request: Request;
310
+ }) => Promise<VoiceProviderContractMatrixReport> | VoiceProviderContractMatrixReport);
306
311
  reconnectContracts?: false | readonly VoiceReconnectContractReport[] | ((input: {
307
312
  query: Record<string, unknown>;
308
313
  request: Request;
@@ -35,5 +35,45 @@ export type VoiceProviderStackCapabilityGapInput<TProvider extends string = stri
35
35
  recommendation?: VoiceProviderStackRecommendation<TProvider>;
36
36
  required?: Partial<Record<VoiceProviderStackKind, readonly string[]>>;
37
37
  };
38
+ export type VoiceProviderContractCheckStatus = 'fail' | 'pass' | 'warn';
39
+ export type VoiceProviderContractCheck = {
40
+ detail?: string;
41
+ key: string;
42
+ label: string;
43
+ status: VoiceProviderContractCheckStatus;
44
+ };
45
+ export type VoiceProviderContractDefinition<TProvider extends string = string> = {
46
+ capabilities?: readonly string[];
47
+ configured?: boolean;
48
+ env?: Record<string, string | undefined>;
49
+ fallbackProviders?: readonly TProvider[];
50
+ kind: VoiceProviderStackKind;
51
+ latencyBudgetMs?: number;
52
+ provider: TProvider;
53
+ requiredCapabilities?: readonly string[];
54
+ requiredEnv?: readonly string[];
55
+ selected?: boolean;
56
+ streaming?: boolean;
57
+ };
58
+ export type VoiceProviderContractMatrixInput<TProvider extends string = string> = {
59
+ contracts: readonly VoiceProviderContractDefinition<TProvider>[];
60
+ };
61
+ export type VoiceProviderContractMatrixRow<TProvider extends string = string> = {
62
+ checks: VoiceProviderContractCheck[];
63
+ configured: boolean;
64
+ kind: VoiceProviderStackKind;
65
+ provider: TProvider;
66
+ selected: boolean;
67
+ status: VoiceProviderContractCheckStatus;
68
+ };
69
+ export type VoiceProviderContractMatrixReport<TProvider extends string = string> = {
70
+ failed: number;
71
+ passed: number;
72
+ rows: VoiceProviderContractMatrixRow<TProvider>[];
73
+ status: VoiceProviderContractCheckStatus;
74
+ total: number;
75
+ warned: number;
76
+ };
38
77
  export declare const recommendVoiceProviderStack: <TProvider extends string = string>(input: VoiceProviderStackInput<TProvider>) => VoiceProviderStackRecommendation<TProvider>;
78
+ export declare const buildVoiceProviderContractMatrix: <TProvider extends string = string>(input: VoiceProviderContractMatrixInput<TProvider>) => VoiceProviderContractMatrixReport<TProvider>;
39
79
  export declare const evaluateVoiceProviderStackGaps: <TProvider extends string = string>(input: VoiceProviderStackCapabilityGapInput<TProvider>) => VoiceProviderStackCapabilityGapReport<TProvider>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.165",
3
+ "version": "0.0.22-beta.166",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",