@absolutejs/voice 0.0.22-beta.148 → 0.0.22-beta.149
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.js +72 -0
- package/dist/productionReadiness.d.ts +28 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19889,6 +19889,14 @@ var resolveProofSources = async (options, input) => {
|
|
|
19889
19889
|
}
|
|
19890
19890
|
return typeof options.proofSources === "function" ? await options.proofSources(input) : options.proofSources;
|
|
19891
19891
|
};
|
|
19892
|
+
var isVoiceDeliveryRuntime = (value) => typeof value.summarize === "function";
|
|
19893
|
+
var resolveDeliveryRuntime = async (options, input) => {
|
|
19894
|
+
if (options.deliveryRuntime === false || options.deliveryRuntime === undefined) {
|
|
19895
|
+
return;
|
|
19896
|
+
}
|
|
19897
|
+
const runtime = typeof options.deliveryRuntime === "function" ? await options.deliveryRuntime(input) : options.deliveryRuntime;
|
|
19898
|
+
return isVoiceDeliveryRuntime(runtime) ? await runtime.summarize() : runtime;
|
|
19899
|
+
};
|
|
19892
19900
|
var defaultAuditRequirements = [
|
|
19893
19901
|
{
|
|
19894
19902
|
label: "Provider-call audit",
|
|
@@ -20013,6 +20021,48 @@ var summarizeTraceDeliveries = async (options) => {
|
|
|
20013
20021
|
warnPendingAfterMs
|
|
20014
20022
|
};
|
|
20015
20023
|
};
|
|
20024
|
+
var summarizeDeliveryRuntime = (summary) => {
|
|
20025
|
+
if (!summary) {
|
|
20026
|
+
return;
|
|
20027
|
+
}
|
|
20028
|
+
const audit = summary.audit ? {
|
|
20029
|
+
deadLettered: summary.audit.deadLettered,
|
|
20030
|
+
delivered: summary.audit.delivered,
|
|
20031
|
+
failed: summary.audit.failed,
|
|
20032
|
+
pending: summary.audit.pending,
|
|
20033
|
+
retryEligible: summary.audit.retryEligible,
|
|
20034
|
+
skipped: summary.audit.skipped,
|
|
20035
|
+
total: summary.audit.total
|
|
20036
|
+
} : undefined;
|
|
20037
|
+
const trace = summary.trace ? {
|
|
20038
|
+
deadLettered: summary.trace.deadLettered,
|
|
20039
|
+
delivered: summary.trace.delivered,
|
|
20040
|
+
failed: summary.trace.failed,
|
|
20041
|
+
pending: summary.trace.pending,
|
|
20042
|
+
retryEligible: summary.trace.retryEligible,
|
|
20043
|
+
skipped: summary.trace.skipped,
|
|
20044
|
+
total: summary.trace.total
|
|
20045
|
+
} : undefined;
|
|
20046
|
+
const queues = [audit, trace].filter((queue) => Boolean(queue));
|
|
20047
|
+
const total = queues.reduce((sum, queue) => sum + queue.total, 0);
|
|
20048
|
+
const failed = queues.reduce((sum, queue) => sum + queue.failed, 0);
|
|
20049
|
+
const deadLettered = queues.reduce((sum, queue) => sum + queue.deadLettered, 0);
|
|
20050
|
+
const pending = queues.reduce((sum, queue) => sum + queue.pending, 0);
|
|
20051
|
+
const retryEligible = queues.reduce((sum, queue) => sum + queue.retryEligible, 0);
|
|
20052
|
+
const status = failed > 0 || deadLettered > 0 ? "fail" : pending > 0 || retryEligible > 0 ? "warn" : "pass";
|
|
20053
|
+
return {
|
|
20054
|
+
audit,
|
|
20055
|
+
deadLettered,
|
|
20056
|
+
delivered: queues.reduce((sum, queue) => sum + queue.delivered, 0),
|
|
20057
|
+
failed,
|
|
20058
|
+
pending,
|
|
20059
|
+
retryEligible,
|
|
20060
|
+
skipped: queues.reduce((sum, queue) => sum + queue.skipped, 0),
|
|
20061
|
+
status,
|
|
20062
|
+
total,
|
|
20063
|
+
trace
|
|
20064
|
+
};
|
|
20065
|
+
};
|
|
20016
20066
|
var summarizeLiveLatency = (events, options) => {
|
|
20017
20067
|
const warnAfterMs = options.liveLatencyWarnAfterMs ?? 1800;
|
|
20018
20068
|
const failAfterMs = options.liveLatencyFailAfterMs ?? 3200;
|
|
@@ -20044,6 +20094,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
|
|
|
20044
20094
|
audit,
|
|
20045
20095
|
auditDeliveries,
|
|
20046
20096
|
traceDeliveries,
|
|
20097
|
+
deliveryRuntimeSummary,
|
|
20047
20098
|
carriers,
|
|
20048
20099
|
agentSquadContracts,
|
|
20049
20100
|
providerRoutingContracts,
|
|
@@ -20072,6 +20123,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
|
|
|
20072
20123
|
summarizeAuditEvidence(options),
|
|
20073
20124
|
summarizeAuditDeliveries(options),
|
|
20074
20125
|
summarizeTraceDeliveries(options),
|
|
20126
|
+
resolveDeliveryRuntime(options, { query, request }),
|
|
20075
20127
|
resolveCarriers(options, { query, request }),
|
|
20076
20128
|
resolveAgentSquadContracts(options, { query, request }),
|
|
20077
20129
|
resolveProviderRoutingContracts(options, { query, request }),
|
|
@@ -20080,6 +20132,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
|
|
|
20080
20132
|
resolveBargeInReports(options, { query, request }),
|
|
20081
20133
|
resolveProofSources(options, { query, request })
|
|
20082
20134
|
]);
|
|
20135
|
+
const deliveryRuntime = summarizeDeliveryRuntime(deliveryRuntimeSummary);
|
|
20083
20136
|
const degradedProviders = providers.filter((provider) => provider.status === "degraded" || provider.status === "rate-limited" || provider.status === "suppressed").length;
|
|
20084
20137
|
const failedSessions = sessions.filter((session) => session.status === "failed").length;
|
|
20085
20138
|
const checks = [
|
|
@@ -20368,6 +20421,23 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
|
|
|
20368
20421
|
]
|
|
20369
20422
|
});
|
|
20370
20423
|
}
|
|
20424
|
+
if (deliveryRuntime) {
|
|
20425
|
+
checks.push({
|
|
20426
|
+
detail: deliveryRuntime.status === "pass" ? "Delivery runtime queues are clear." : deliveryRuntime.failed > 0 || deliveryRuntime.deadLettered > 0 ? `${deliveryRuntime.failed} failed and ${deliveryRuntime.deadLettered} dead-lettered runtime delivery item(s).` : `${deliveryRuntime.pending} runtime delivery item(s) are pending.`,
|
|
20427
|
+
href: options.links?.deliveryRuntime ?? "/delivery-runtime",
|
|
20428
|
+
label: "Delivery runtime",
|
|
20429
|
+
proofSource: proofSource("deliveryRuntime"),
|
|
20430
|
+
status: deliveryRuntime.status,
|
|
20431
|
+
value: `${deliveryRuntime.delivered + deliveryRuntime.skipped}/${deliveryRuntime.total}`,
|
|
20432
|
+
actions: deliveryRuntime.status === "pass" ? [] : [
|
|
20433
|
+
{
|
|
20434
|
+
description: "Open the delivery runtime control plane to inspect queues or manually tick workers.",
|
|
20435
|
+
href: options.links?.deliveryRuntime ?? "/delivery-runtime",
|
|
20436
|
+
label: "Open delivery runtime"
|
|
20437
|
+
}
|
|
20438
|
+
]
|
|
20439
|
+
});
|
|
20440
|
+
}
|
|
20371
20441
|
if (carriers && carrierSummary) {
|
|
20372
20442
|
checks.push({
|
|
20373
20443
|
detail: carrierSummary.status === "pass" ? "Configured carrier setup and contract checks are passing." : `${carrierSummary.failing} carrier(s) failing, ${carrierSummary.warnings} warning(s).`,
|
|
@@ -20393,6 +20463,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
|
|
|
20393
20463
|
auditDeliveries: "/audit",
|
|
20394
20464
|
bargeIn: "/barge-in",
|
|
20395
20465
|
carriers: "/carriers",
|
|
20466
|
+
deliveryRuntime: "/delivery-runtime",
|
|
20396
20467
|
handoffs: "/handoffs",
|
|
20397
20468
|
handoffRetry: "/api/voice-handoffs/retry",
|
|
20398
20469
|
liveLatency: "/traces",
|
|
@@ -20413,6 +20484,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
|
|
|
20413
20484
|
auditDeliveries,
|
|
20414
20485
|
bargeIn: bargeInSummary,
|
|
20415
20486
|
carriers: carrierSummary,
|
|
20487
|
+
deliveryRuntime,
|
|
20416
20488
|
handoffs: {
|
|
20417
20489
|
failed: handoffs.failed,
|
|
20418
20490
|
total: handoffs.total
|
|
@@ -5,6 +5,7 @@ import type { VoiceTraceEventStore } from './trace';
|
|
|
5
5
|
import type { VoiceTraceSinkDeliveryStore } from './trace';
|
|
6
6
|
import type { VoiceAgentSquadContractReport } from './agentSquadContract';
|
|
7
7
|
import type { VoiceBargeInReport } from './bargeInRoutes';
|
|
8
|
+
import type { VoiceDeliveryRuntime, VoiceDeliveryRuntimeSummary } from './deliveryRuntime';
|
|
8
9
|
import type { VoiceProviderRoutingContractReport } from './providerRoutingContract';
|
|
9
10
|
import type { VoicePhoneAgentProductionSmokeReport } from './phoneAgentProductionSmoke';
|
|
10
11
|
import type { VoiceReconnectContractReport } from './reconnectContract';
|
|
@@ -42,6 +43,7 @@ export type VoiceProductionReadinessReport = {
|
|
|
42
43
|
auditDeliveries?: string;
|
|
43
44
|
bargeIn?: string;
|
|
44
45
|
carriers?: string;
|
|
46
|
+
deliveryRuntime?: string;
|
|
45
47
|
handoffs?: string;
|
|
46
48
|
handoffRetry?: string;
|
|
47
49
|
liveLatency?: string;
|
|
@@ -78,6 +80,7 @@ export type VoiceProductionReadinessReport = {
|
|
|
78
80
|
status: VoiceProductionReadinessStatus;
|
|
79
81
|
warnings: number;
|
|
80
82
|
};
|
|
83
|
+
deliveryRuntime?: VoiceProductionReadinessDeliveryRuntimeSummary;
|
|
81
84
|
handoffs: {
|
|
82
85
|
failed: number;
|
|
83
86
|
total: number;
|
|
@@ -168,6 +171,27 @@ export type VoiceProductionReadinessTraceDeliverySummary = {
|
|
|
168
171
|
total: number;
|
|
169
172
|
warnPendingAfterMs: number;
|
|
170
173
|
};
|
|
174
|
+
export type VoiceProductionReadinessDeliveryRuntimeSummary = {
|
|
175
|
+
audit?: VoiceProductionReadinessDeliveryRuntimeQueueSummary;
|
|
176
|
+
deadLettered: number;
|
|
177
|
+
delivered: number;
|
|
178
|
+
failed: number;
|
|
179
|
+
pending: number;
|
|
180
|
+
retryEligible: number;
|
|
181
|
+
skipped: number;
|
|
182
|
+
status: VoiceProductionReadinessStatus;
|
|
183
|
+
total: number;
|
|
184
|
+
trace?: VoiceProductionReadinessDeliveryRuntimeQueueSummary;
|
|
185
|
+
};
|
|
186
|
+
export type VoiceProductionReadinessDeliveryRuntimeQueueSummary = {
|
|
187
|
+
deadLettered: number;
|
|
188
|
+
delivered: number;
|
|
189
|
+
failed: number;
|
|
190
|
+
pending: number;
|
|
191
|
+
retryEligible: number;
|
|
192
|
+
skipped: number;
|
|
193
|
+
total: number;
|
|
194
|
+
};
|
|
171
195
|
export type VoiceProductionReadinessAuditOptions = VoiceAuditEventStore | {
|
|
172
196
|
require?: readonly (VoiceAuditEventType | VoiceProductionReadinessAuditRequirement)[];
|
|
173
197
|
store: VoiceAuditEventStore;
|
|
@@ -199,6 +223,10 @@ export type VoiceProductionReadinessRoutesOptions = {
|
|
|
199
223
|
query: Record<string, unknown>;
|
|
200
224
|
request: Request;
|
|
201
225
|
}) => Promise<readonly VoiceTelephonyCarrierMatrixInput[]> | readonly VoiceTelephonyCarrierMatrixInput[]);
|
|
226
|
+
deliveryRuntime?: false | VoiceDeliveryRuntime | VoiceDeliveryRuntimeSummary | ((input: {
|
|
227
|
+
query: Record<string, unknown>;
|
|
228
|
+
request: Request;
|
|
229
|
+
}) => Promise<VoiceDeliveryRuntime | VoiceDeliveryRuntimeSummary> | VoiceDeliveryRuntime | VoiceDeliveryRuntimeSummary);
|
|
202
230
|
headers?: HeadersInit;
|
|
203
231
|
htmlPath?: false | string;
|
|
204
232
|
links?: VoiceProductionReadinessReport['links'];
|