@absolutejs/voice 0.0.22-beta.161 → 0.0.22-beta.163

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
@@ -45,7 +45,7 @@ export { createVoiceProviderCapabilityHTMLHandler, createVoiceProviderCapability
45
45
  export { assertVoiceProviderRoutingContract, runVoiceProviderRoutingContract } from './providerRoutingContract';
46
46
  export { createVoicePhoneAgentProductionSmokeHTMLHandler, createVoicePhoneAgentProductionSmokeJSONHandler, createVoicePhoneAgentProductionSmokeRoutes, renderVoicePhoneAgentProductionSmokeHTML, runVoicePhoneAgentProductionSmokeContract } from './phoneAgentProductionSmoke';
47
47
  export { buildVoiceProductionReadinessGate, buildVoiceProductionReadinessReport, createVoiceProductionReadinessRoutes, renderVoiceProductionReadinessHTML, summarizeVoiceProductionReadinessGate } from './productionReadiness';
48
- export { createVoiceReadinessProfile } from './readinessProfiles';
48
+ export { createVoiceReadinessProfile, recommendVoiceReadinessProfile } from './readinessProfiles';
49
49
  export { buildVoiceOpsConsoleReport, createVoiceOpsConsoleRoutes, renderVoiceOpsConsoleHTML } from './opsConsoleRoutes';
50
50
  export { summarizeVoiceOpsStatus } from './opsStatus';
51
51
  export { createVoiceOpsStatusRoutes, renderVoiceOpsStatusHTML } from './opsStatusRoutes';
@@ -103,8 +103,8 @@ export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneA
103
103
  export type { VoicePhoneAgentProductionSmokeIssue, VoicePhoneAgentProductionSmokeHandlerOptions, VoicePhoneAgentProductionSmokeHTMLHandlerOptions, VoicePhoneAgentProductionSmokeOptions, VoicePhoneAgentProductionSmokeReport, VoicePhoneAgentProductionSmokeRoutesOptions, VoicePhoneAgentProductionSmokeRequirement } from './phoneAgentProductionSmoke';
104
104
  export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesOptions } from './opsConsoleRoutes';
105
105
  export type { VoiceOpsStatus, VoiceOpsStatusLink, VoiceOpsStatusOptions, VoiceOpsStatusReport, VoiceOpsStatusRoutesOptions } from './opsStatus';
106
- export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessCheck, VoiceProductionReadinessGateIssue, VoiceProductionReadinessGateOptions, VoiceProductionReadinessGateReport, VoiceProductionReadinessOpsActionHistoryOptions, VoiceProductionReadinessOpsActionHistorySummary, VoiceProductionReadinessProfileExplanation, VoiceProductionReadinessProfileSurface, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
107
- export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
106
+ 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';
107
+ export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRecommendation, VoiceReadinessProfileRecommendationScore, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
108
108
  export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQualityRoutesOptions, VoiceQualityStatus, VoiceQualityThresholds } from './qualityRoutes';
109
109
  export type { VoiceResilienceIOSimulator, VoiceResilienceLink, VoiceResiliencePageData, VoiceResilienceRoutesOptions, VoiceResilienceSimulationProvider, VoiceRoutingKindSummary, VoiceRoutingDecisionSummary, VoiceRoutingDecisionSummaryOptions, VoiceRoutingEvent, VoiceRoutingEventKind, VoiceRoutingSessionSummary, VoiceRoutingSessionSummaryOptions } from './resilienceRoutes';
110
110
  export type { VoiceIOProviderRouterEvent, VoiceIOProviderRouterOptions, VoiceIOProviderRouterPolicy, VoiceIOProviderRouterPolicyConfig, VoiceSTTProviderRouterOptions, VoiceTTSProviderRouterOptions } from './providerAdapters';
package/dist/index.js CHANGED
@@ -20149,6 +20149,27 @@ var readinessGateCodes = {
20149
20149
  "Trace sink delivery": "voice.readiness.trace_sink_delivery"
20150
20150
  };
20151
20151
  var readinessGateCodeForCheck = (check) => readinessGateCodes[check.label] ?? `voice.readiness.${check.label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "")}`;
20152
+ var normalizeReadinessLabel = (value) => value.toLowerCase().replace(/[^a-z0-9]+/g, "");
20153
+ var issueMatchesProfileSurface = (issue, surface) => normalizeReadinessLabel(issue.label) === normalizeReadinessLabel(surface.label) || issue.code.includes(surface.key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().replace(/[^a-z0-9]+/g, "_"));
20154
+ var summarizeProfileSurfaceStatus = (issues) => issues.some((issue) => issue.status === "fail") ? "fail" : issues.some((issue) => issue.status === "warn") ? "warn" : "pass";
20155
+ var summarizeVoiceProductionReadinessGateProfile = (report, issues) => {
20156
+ if (!report.profile) {
20157
+ return;
20158
+ }
20159
+ return {
20160
+ description: report.profile.description,
20161
+ name: report.profile.name,
20162
+ purpose: report.profile.purpose,
20163
+ surfaces: report.profile.surfaces.map((surface) => {
20164
+ const surfaceIssues = issues.filter((issue) => issueMatchesProfileSurface(issue, surface));
20165
+ return {
20166
+ ...surface,
20167
+ issues: surfaceIssues,
20168
+ status: summarizeProfileSurfaceStatus(surfaceIssues)
20169
+ };
20170
+ })
20171
+ };
20172
+ };
20152
20173
  var summarizeVoiceProductionReadinessGate = (report, options = {}) => {
20153
20174
  const issues = report.checks.filter((check) => check.status !== "pass").map((check) => ({
20154
20175
  code: readinessGateCodeForCheck(check),
@@ -20165,6 +20186,7 @@ var summarizeVoiceProductionReadinessGate = (report, options = {}) => {
20165
20186
  checkedAt: report.checkedAt,
20166
20187
  failures,
20167
20188
  ok,
20189
+ profile: summarizeVoiceProductionReadinessGateProfile(report, issues),
20168
20190
  status: ok ? report.status : "fail",
20169
20191
  warnings
20170
20192
  };
@@ -20947,6 +20969,73 @@ var createVoiceProductionReadinessRoutes = (options) => {
20947
20969
  return routes;
20948
20970
  };
20949
20971
  // src/readinessProfiles.ts
20972
+ var profileSurfaceLabels = {
20973
+ "meeting-recorder": {
20974
+ bargeInReports: "barge-in proof configured",
20975
+ providerRoutingContracts: "provider routing contracts configured",
20976
+ reconnectContracts: "reconnect contracts configured"
20977
+ },
20978
+ "ops-heavy": {
20979
+ audit: "audit evidence configured",
20980
+ auditDeliveries: "audit delivery queue configured",
20981
+ deliveryRuntime: "delivery runtime configured",
20982
+ opsActionHistory: "operator action history configured",
20983
+ traceDeliveries: "trace delivery queue configured"
20984
+ },
20985
+ "phone-agent": {
20986
+ auditDeliveries: "audit delivery queue configured",
20987
+ carriers: "carrier readiness configured",
20988
+ deliveryRuntime: "delivery runtime configured",
20989
+ phoneAgentSmokes: "phone-agent smoke proof configured",
20990
+ providerRoutingContracts: "provider routing contracts configured",
20991
+ traceDeliveries: "trace delivery queue configured"
20992
+ }
20993
+ };
20994
+ var profileRequiredKeys = {
20995
+ "meeting-recorder": [
20996
+ "bargeInReports",
20997
+ "providerRoutingContracts",
20998
+ "reconnectContracts"
20999
+ ],
21000
+ "ops-heavy": [
21001
+ "audit",
21002
+ "opsActionHistory",
21003
+ "auditDeliveries",
21004
+ "traceDeliveries",
21005
+ "deliveryRuntime"
21006
+ ],
21007
+ "phone-agent": [
21008
+ "carriers",
21009
+ "phoneAgentSmokes",
21010
+ "providerRoutingContracts",
21011
+ "auditDeliveries",
21012
+ "traceDeliveries",
21013
+ "deliveryRuntime"
21014
+ ]
21015
+ };
21016
+ var configuredProfileKeys = (options) => {
21017
+ const configured = new Set;
21018
+ for (const key of [
21019
+ "audit",
21020
+ "auditDeliveries",
21021
+ "bargeInReports",
21022
+ "carriers",
21023
+ "deliveryRuntime",
21024
+ "opsActionHistory",
21025
+ "phoneAgentSmokes",
21026
+ "providerRoutingContracts",
21027
+ "reconnectContracts",
21028
+ "traceDeliveries"
21029
+ ]) {
21030
+ if (isConfigured(options[key])) {
21031
+ configured.add(key);
21032
+ }
21033
+ }
21034
+ if (configured.has("audit")) {
21035
+ configured.add("opsActionHistory");
21036
+ }
21037
+ return configured;
21038
+ };
20950
21039
  var auditStoreFromOptions = (audit) => {
20951
21040
  if (!audit) {
20952
21041
  return;
@@ -21163,6 +21252,38 @@ var createVoiceReadinessProfile = (profile, options = {}) => {
21163
21252
  traceDeliveries: options.traceDeliveries
21164
21253
  });
21165
21254
  };
21255
+ var recommendVoiceReadinessProfile = (options) => {
21256
+ const configured = configuredProfileKeys(options);
21257
+ const scores = ["phone-agent", "meeting-recorder", "ops-heavy"].map((profile) => {
21258
+ const required = profileRequiredKeys[profile];
21259
+ const configuredKeys = required.filter((key) => configured.has(key));
21260
+ const missing = required.filter((key) => !configured.has(key));
21261
+ const reasons = configuredKeys.map((key) => profileSurfaceLabels[profile][key] ?? `${key} configured`);
21262
+ return {
21263
+ configured: configuredKeys,
21264
+ confidence: required.length === 0 ? 0 : Math.round(configuredKeys.length / required.length * 100) / 100,
21265
+ missing,
21266
+ profile,
21267
+ reasons
21268
+ };
21269
+ });
21270
+ const [best] = scores.toSorted((left, right) => {
21271
+ if (right.confidence !== left.confidence) {
21272
+ return right.confidence - left.confidence;
21273
+ }
21274
+ return right.configured.length - left.configured.length;
21275
+ });
21276
+ if (!best) {
21277
+ throw new Error("No voice readiness profiles are available.");
21278
+ }
21279
+ return {
21280
+ confidence: best.confidence,
21281
+ missing: best.missing,
21282
+ profile: best.profile,
21283
+ reasons: best.reasons,
21284
+ scores
21285
+ };
21286
+ };
21166
21287
  // src/opsConsoleRoutes.ts
21167
21288
  import { Elysia as Elysia34 } from "elysia";
21168
21289
  var DEFAULT_LINKS = [
@@ -23978,6 +24099,7 @@ export {
23978
24099
  recordVoiceOperatorAuditEvent,
23979
24100
  recordVoiceHandoffAuditEvent,
23980
24101
  recordVoiceAuditEvent,
24102
+ recommendVoiceReadinessProfile,
23981
24103
  pruneVoiceTraceEvents,
23982
24104
  parseVoiceTelephonyWebhookEvent,
23983
24105
  matchesVoiceOpsTaskAssignmentRule,
@@ -42,6 +42,7 @@ export type VoiceProductionReadinessGateReport = {
42
42
  checkedAt: number;
43
43
  failures: VoiceProductionReadinessGateIssue[];
44
44
  ok: boolean;
45
+ profile?: VoiceProductionReadinessGateProfile;
45
46
  status: VoiceProductionReadinessStatus;
46
47
  warnings: VoiceProductionReadinessGateIssue[];
47
48
  };
@@ -64,6 +65,13 @@ export type VoiceProductionReadinessProfileExplanation = {
64
65
  purpose: string;
65
66
  surfaces: VoiceProductionReadinessProfileSurface[];
66
67
  };
68
+ export type VoiceProductionReadinessGateProfileSurface = VoiceProductionReadinessProfileSurface & {
69
+ issues: VoiceProductionReadinessGateIssue[];
70
+ status: VoiceProductionReadinessStatus;
71
+ };
72
+ export type VoiceProductionReadinessGateProfile = Omit<VoiceProductionReadinessProfileExplanation, 'surfaces'> & {
73
+ surfaces: VoiceProductionReadinessGateProfileSurface[];
74
+ };
67
75
  export type VoiceProductionReadinessReport = {
68
76
  checkedAt: number;
69
77
  checks: VoiceProductionReadinessCheck[];
@@ -17,4 +17,19 @@ export type VoiceReadinessProfileOptions = {
17
17
  traceDeliveries?: VoiceProductionReadinessTraceDeliveryOptions;
18
18
  };
19
19
  export type VoiceReadinessProfileRoutesOptions = Partial<Omit<VoiceProductionReadinessRoutesOptions, 'store'>>;
20
+ export type VoiceReadinessProfileRecommendationScore = {
21
+ configured: string[];
22
+ confidence: number;
23
+ missing: string[];
24
+ profile: VoiceReadinessProfileName;
25
+ reasons: string[];
26
+ };
27
+ export type VoiceReadinessProfileRecommendation = {
28
+ confidence: number;
29
+ missing: string[];
30
+ profile: VoiceReadinessProfileName;
31
+ reasons: string[];
32
+ scores: VoiceReadinessProfileRecommendationScore[];
33
+ };
20
34
  export declare const createVoiceReadinessProfile: (profile: VoiceReadinessProfileName, options?: VoiceReadinessProfileOptions) => VoiceReadinessProfileRoutesOptions;
35
+ export declare const recommendVoiceReadinessProfile: (options: VoiceReadinessProfileOptions) => VoiceReadinessProfileRecommendation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.161",
3
+ "version": "0.0.22-beta.163",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",