@absolutejs/voice 0.0.22-beta.213 → 0.0.22-beta.215

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.
@@ -12,6 +12,7 @@ import type { VoiceReconnectContractReport } from './reconnectContract';
12
12
  import type { VoiceAuditEventStore, VoiceAuditEventType, VoiceAuditOutcome } from './audit';
13
13
  import { type VoiceAuditSinkDeliveryStore } from './auditSinks';
14
14
  import type { VoiceProviderContractMatrixReport, VoiceProviderStackCapabilityGapReport } from './providerStackRecommendations';
15
+ import { type VoiceProviderSloReport, type VoiceProviderSloReportOptions } from './providerSlo';
15
16
  import type { VoiceCampaignReadinessProofReport } from './campaign';
16
17
  import { type VoiceOpsRecoveryReport } from './opsRecovery';
17
18
  export type VoiceProductionReadinessStatus = 'fail' | 'pass' | 'warn';
@@ -95,6 +96,7 @@ export type VoiceProductionReadinessReport = {
95
96
  phoneAgentSmoke?: string;
96
97
  providerContracts?: string;
97
98
  providerRoutingContracts?: string;
99
+ providerSlo?: string;
98
100
  quality?: string;
99
101
  reconnectContracts?: string;
100
102
  resilience?: string;
@@ -172,6 +174,12 @@ export type VoiceProductionReadinessReport = {
172
174
  status: VoiceProductionReadinessStatus;
173
175
  total: number;
174
176
  };
177
+ providerSlo?: {
178
+ events: number;
179
+ eventsWithLatency: number;
180
+ issues: number;
181
+ status: VoiceProductionReadinessStatus;
182
+ };
175
183
  reconnectContracts?: {
176
184
  failed: number;
177
185
  passed: number;
@@ -339,6 +347,10 @@ export type VoiceProductionReadinessRoutesOptions = {
339
347
  query: Record<string, unknown>;
340
348
  request: Request;
341
349
  }) => Promise<readonly VoiceProviderRoutingContractReport[]> | readonly VoiceProviderRoutingContractReport[]);
350
+ providerSlo?: false | VoiceProviderSloReport | VoiceProviderSloReportOptions | ((input: {
351
+ query: Record<string, unknown>;
352
+ request: Request;
353
+ }) => Promise<VoiceProviderSloReport | VoiceProviderSloReportOptions> | VoiceProviderSloReport | VoiceProviderSloReportOptions);
342
354
  providerStack?: false | VoiceProviderStackCapabilityGapReport | ((input: {
343
355
  query: Record<string, unknown>;
344
356
  request: Request;
@@ -0,0 +1,110 @@
1
+ import { Elysia } from 'elysia';
2
+ import { type VoiceRoutingEvent, type VoiceRoutingEventKind } from './resilienceRoutes';
3
+ import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
4
+ export type VoiceProviderSloStatus = 'fail' | 'pass' | 'warn';
5
+ export type VoiceProviderSloThresholds = {
6
+ maxAverageElapsedMs?: number;
7
+ maxErrorRate?: number;
8
+ maxFallbackRate?: number;
9
+ maxP95ElapsedMs?: number;
10
+ maxTimeoutRate?: number;
11
+ minSamples?: number;
12
+ };
13
+ export type VoiceProviderSloThresholdConfig = Partial<Record<VoiceRoutingEventKind, VoiceProviderSloThresholds>>;
14
+ export type VoiceProviderSloMetric = {
15
+ actual: number;
16
+ label: string;
17
+ pass: boolean;
18
+ threshold: number;
19
+ unit: 'count' | 'ms' | 'rate';
20
+ };
21
+ export type VoiceProviderSloIssue = {
22
+ code: string;
23
+ detail?: string;
24
+ kind?: VoiceRoutingEventKind;
25
+ label: string;
26
+ sessionId?: string;
27
+ status: Exclude<VoiceProviderSloStatus, 'pass'>;
28
+ value?: number | string;
29
+ };
30
+ export type VoiceProviderSloKindReport = {
31
+ events: number;
32
+ eventsWithLatency: number;
33
+ fallbacks: number;
34
+ issues: VoiceProviderSloIssue[];
35
+ kind: VoiceRoutingEventKind;
36
+ metrics: Record<string, VoiceProviderSloMetric>;
37
+ providers: string[];
38
+ status: VoiceProviderSloStatus;
39
+ thresholds: Required<VoiceProviderSloThresholds>;
40
+ timeouts: number;
41
+ unresolvedErrors: number;
42
+ };
43
+ export type VoiceProviderSloSessionReport = {
44
+ errorCount: number;
45
+ fallbackCount: number;
46
+ kinds: VoiceRoutingEventKind[];
47
+ lastEventAt: number;
48
+ maxElapsedMs?: number;
49
+ sessionId: string;
50
+ status: VoiceProviderSloStatus;
51
+ timeoutCount: number;
52
+ };
53
+ export type VoiceProviderSloReport = {
54
+ checkedAt: number;
55
+ events: number;
56
+ eventsWithLatency: number;
57
+ issues: VoiceProviderSloIssue[];
58
+ kinds: Record<VoiceRoutingEventKind, VoiceProviderSloKindReport>;
59
+ sessions: VoiceProviderSloSessionReport[];
60
+ status: VoiceProviderSloStatus;
61
+ thresholds: Record<VoiceRoutingEventKind, Required<VoiceProviderSloThresholds>>;
62
+ };
63
+ export type VoiceProviderSloReportOptions = {
64
+ events?: StoredVoiceTraceEvent[] | VoiceRoutingEvent[];
65
+ requiredKinds?: readonly VoiceRoutingEventKind[];
66
+ store?: VoiceTraceEventStore;
67
+ thresholds?: VoiceProviderSloThresholdConfig;
68
+ };
69
+ export type VoiceProviderSloRoutesOptions = VoiceProviderSloReportOptions & {
70
+ headers?: HeadersInit;
71
+ htmlPath?: false | string;
72
+ markdownPath?: false | string;
73
+ name?: string;
74
+ path?: string;
75
+ render?: (report: VoiceProviderSloReport) => string | Promise<string>;
76
+ title?: string;
77
+ };
78
+ export declare const buildVoiceProviderSloReport: (options?: VoiceProviderSloReportOptions) => Promise<VoiceProviderSloReport>;
79
+ export declare const renderVoiceProviderSloMarkdown: (report: VoiceProviderSloReport) => string;
80
+ export declare const renderVoiceProviderSloHTML: (report: VoiceProviderSloReport, options?: {
81
+ title?: string;
82
+ }) => string;
83
+ export declare const createVoiceProviderSloRoutes: (options: VoiceProviderSloRoutesOptions) => Elysia<"", {
84
+ decorator: {};
85
+ store: {};
86
+ derive: {};
87
+ resolve: {};
88
+ }, {
89
+ typebox: {};
90
+ error: {};
91
+ }, {
92
+ schema: {};
93
+ standaloneSchema: {};
94
+ macro: {};
95
+ macroFn: {};
96
+ parser: {};
97
+ response: {};
98
+ }, {}, {
99
+ derive: {};
100
+ resolve: {};
101
+ schema: {};
102
+ standaloneSchema: {};
103
+ response: {};
104
+ }, {
105
+ derive: {};
106
+ resolve: {};
107
+ schema: {};
108
+ standaloneSchema: {};
109
+ response: {};
110
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.213",
3
+ "version": "0.0.22-beta.215",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",