@absolutejs/voice 0.0.22-beta.23 → 0.0.22-beta.230

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.
Files changed (207) hide show
  1. package/README.md +3051 -239
  2. package/dist/agent.d.ts +62 -0
  3. package/dist/agentSquadContract.d.ts +69 -0
  4. package/dist/angular/index.d.ts +13 -0
  5. package/dist/angular/index.js +3154 -1110
  6. package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
  7. package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
  8. package/dist/angular/voice-controller.service.d.ts +1 -0
  9. package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
  10. package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
  11. package/dist/angular/voice-live-ops.service.d.ts +11 -0
  12. package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
  13. package/dist/angular/voice-ops-status.component.d.ts +15 -0
  14. package/dist/angular/voice-ops-status.service.d.ts +12 -0
  15. package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
  16. package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
  17. package/dist/angular/voice-routing-status.service.d.ts +11 -0
  18. package/dist/angular/voice-stream.service.d.ts +3 -0
  19. package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
  20. package/dist/angular/voice-turn-latency.service.d.ts +13 -0
  21. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  22. package/dist/angular/voice-workflow-status.service.d.ts +12 -0
  23. package/dist/audit.d.ts +128 -0
  24. package/dist/auditDeliveryRoutes.d.ts +85 -0
  25. package/dist/auditExport.d.ts +34 -0
  26. package/dist/auditRoutes.d.ts +66 -0
  27. package/dist/auditSinks.d.ts +151 -0
  28. package/dist/bargeInRoutes.d.ts +56 -0
  29. package/dist/campaign.d.ts +746 -0
  30. package/dist/campaignDialers.d.ts +90 -0
  31. package/dist/client/actions.d.ts +105 -0
  32. package/dist/client/agentSquadStatus.d.ts +37 -0
  33. package/dist/client/agentSquadStatusWidget.d.ts +24 -0
  34. package/dist/client/bargeInMonitor.d.ts +7 -0
  35. package/dist/client/campaignDialerProof.d.ts +23 -0
  36. package/dist/client/connection.d.ts +3 -0
  37. package/dist/client/deliveryRuntime.d.ts +34 -0
  38. package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
  39. package/dist/client/duplex.d.ts +1 -1
  40. package/dist/client/htmxBootstrap.js +747 -15
  41. package/dist/client/index.d.ts +62 -0
  42. package/dist/client/index.js +4407 -20
  43. package/dist/client/liveOps.d.ts +22 -0
  44. package/dist/client/liveOpsWidget.d.ts +23 -0
  45. package/dist/client/liveTurnLatency.d.ts +41 -0
  46. package/dist/client/opsActionCenter.d.ts +54 -0
  47. package/dist/client/opsActionCenterWidget.d.ts +29 -0
  48. package/dist/client/opsActionHistory.d.ts +19 -0
  49. package/dist/client/opsActionHistoryWidget.d.ts +11 -0
  50. package/dist/client/opsStatus.d.ts +19 -0
  51. package/dist/client/opsStatusWidget.d.ts +40 -0
  52. package/dist/client/providerCapabilities.d.ts +19 -0
  53. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  54. package/dist/client/providerContracts.d.ts +19 -0
  55. package/dist/client/providerContractsWidget.d.ts +37 -0
  56. package/dist/client/providerSimulationControls.d.ts +33 -0
  57. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  58. package/dist/client/providerStatusWidget.d.ts +32 -0
  59. package/dist/client/routingStatus.d.ts +19 -0
  60. package/dist/client/routingStatusWidget.d.ts +28 -0
  61. package/dist/client/traceTimeline.d.ts +19 -0
  62. package/dist/client/traceTimelineWidget.d.ts +36 -0
  63. package/dist/client/turnLatency.d.ts +22 -0
  64. package/dist/client/turnLatencyWidget.d.ts +33 -0
  65. package/dist/client/turnQuality.d.ts +19 -0
  66. package/dist/client/turnQualityWidget.d.ts +32 -0
  67. package/dist/client/workflowStatus.d.ts +19 -0
  68. package/dist/dataControl.d.ts +140 -0
  69. package/dist/deliveryRuntime.d.ts +158 -0
  70. package/dist/deliverySinkRoutes.d.ts +117 -0
  71. package/dist/demoReadyRoutes.d.ts +98 -0
  72. package/dist/diagnosticsRoutes.d.ts +44 -0
  73. package/dist/evalRoutes.d.ts +219 -0
  74. package/dist/fileStore.d.ts +14 -2
  75. package/dist/handoff.d.ts +54 -0
  76. package/dist/handoffHealth.d.ts +94 -0
  77. package/dist/incidentBundle.d.ts +116 -0
  78. package/dist/index.d.ts +126 -13
  79. package/dist/index.js +22717 -4796
  80. package/dist/latencySlo.d.ts +56 -0
  81. package/dist/liveLatency.d.ts +78 -0
  82. package/dist/liveOps.d.ts +122 -0
  83. package/dist/modelAdapters.d.ts +23 -2
  84. package/dist/observabilityExport.d.ts +297 -0
  85. package/dist/openaiRealtime.d.ts +27 -0
  86. package/dist/openaiTTS.d.ts +18 -0
  87. package/dist/operationsRecord.d.ts +158 -0
  88. package/dist/opsActionAuditRoutes.d.ts +99 -0
  89. package/dist/opsConsoleRoutes.d.ts +80 -0
  90. package/dist/opsRecovery.d.ts +137 -0
  91. package/dist/opsStatus.d.ts +76 -0
  92. package/dist/opsStatusRoutes.d.ts +33 -0
  93. package/dist/opsWebhook.d.ts +126 -0
  94. package/dist/outcomeContract.d.ts +115 -0
  95. package/dist/phoneAgent.d.ts +76 -0
  96. package/dist/phoneAgentProductionSmoke.d.ts +115 -0
  97. package/dist/postgresStore.d.ts +13 -2
  98. package/dist/productionReadiness.d.ts +453 -0
  99. package/dist/providerAdapters.d.ts +48 -0
  100. package/dist/providerCapabilities.d.ts +92 -0
  101. package/dist/providerHealth.d.ts +1 -0
  102. package/dist/providerRoutingContract.d.ts +38 -0
  103. package/dist/providerSlo.d.ts +114 -0
  104. package/dist/providerStackRecommendations.d.ts +145 -0
  105. package/dist/qualityRoutes.d.ts +76 -0
  106. package/dist/queue.d.ts +61 -0
  107. package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
  108. package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
  109. package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
  110. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  111. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  112. package/dist/react/VoiceProviderContracts.d.ts +6 -0
  113. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  114. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  115. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  116. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  117. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  118. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  119. package/dist/react/index.d.ts +26 -0
  120. package/dist/react/index.js +4074 -33
  121. package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
  122. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  123. package/dist/react/useVoiceController.d.ts +3 -0
  124. package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
  125. package/dist/react/useVoiceLiveOps.d.ts +9 -0
  126. package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
  127. package/dist/react/useVoiceOpsStatus.d.ts +8 -0
  128. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  129. package/dist/react/useVoiceProviderContracts.d.ts +8 -0
  130. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  131. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  132. package/dist/react/useVoiceStream.d.ts +3 -0
  133. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  134. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  135. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  136. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  137. package/dist/readinessProfiles.d.ts +37 -0
  138. package/dist/reconnectContract.d.ts +87 -0
  139. package/dist/resilienceRoutes.d.ts +143 -0
  140. package/dist/sessionReplay.d.ts +12 -0
  141. package/dist/simulationSuite.d.ts +121 -0
  142. package/dist/sqliteStore.d.ts +13 -2
  143. package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
  144. package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
  145. package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
  146. package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
  147. package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
  148. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  149. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  150. package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
  151. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  152. package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
  153. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  154. package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
  155. package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
  156. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  157. package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
  158. package/dist/svelte/index.d.ts +14 -0
  159. package/dist/svelte/index.js +4574 -439
  160. package/dist/telephony/contract.d.ts +61 -0
  161. package/dist/telephony/matrix.d.ts +97 -0
  162. package/dist/telephony/plivo.d.ts +254 -0
  163. package/dist/telephony/telnyx.d.ts +247 -0
  164. package/dist/telephony/twilio.d.ts +135 -2
  165. package/dist/telephonyOutcome.d.ts +201 -0
  166. package/dist/testing/index.d.ts +1 -0
  167. package/dist/testing/index.js +2024 -69
  168. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  169. package/dist/toolContract.d.ts +133 -0
  170. package/dist/toolRuntime.d.ts +50 -0
  171. package/dist/trace.d.ts +19 -1
  172. package/dist/traceDeliveryRoutes.d.ts +86 -0
  173. package/dist/traceTimeline.d.ts +97 -0
  174. package/dist/turnLatency.d.ts +95 -0
  175. package/dist/turnQuality.d.ts +94 -0
  176. package/dist/types.d.ts +180 -4
  177. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  178. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  179. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  180. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  181. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  182. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  183. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  184. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  185. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  186. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  187. package/dist/vue/index.d.ts +24 -0
  188. package/dist/vue/index.js +3852 -57
  189. package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
  190. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  191. package/dist/vue/useVoiceController.d.ts +2 -1
  192. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  193. package/dist/vue/useVoiceLiveOps.d.ts +9 -0
  194. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  195. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  196. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  197. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  198. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  199. package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
  200. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  201. package/dist/vue/useVoiceStream.d.ts +4 -1
  202. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  203. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  204. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  205. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  206. package/dist/workflowContract.d.ts +91 -0
  207. package/package.json +1 -1
@@ -0,0 +1,56 @@
1
+ import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
2
+ export type VoiceLatencySLOStatus = 'empty' | 'fail' | 'pass' | 'warn';
3
+ export type VoiceLatencySLOStage = 'assistant_text_to_tts_send' | 'barge_in_stop' | 'commit_to_assistant_text' | 'final_to_commit' | 'live_latency' | 'provider_llm' | 'provider_stt' | 'provider_tts' | 'speech_to_commit' | 'tts_send_duration' | 'tts_to_first_audio';
4
+ export type VoiceLatencySLOBudget = {
5
+ failAfterMs: number;
6
+ warnAfterMs?: number;
7
+ };
8
+ export type VoiceLatencySLOMeasurement = {
9
+ at: number;
10
+ latencyMs: number;
11
+ label: string;
12
+ provider?: string;
13
+ sessionId: string;
14
+ stage: VoiceLatencySLOStage;
15
+ status: Exclude<VoiceLatencySLOStatus, 'empty'>;
16
+ turnId?: string;
17
+ };
18
+ export type VoiceLatencySLOStageSummary = {
19
+ averageMs?: number;
20
+ budget: VoiceLatencySLOBudget;
21
+ failed: number;
22
+ label: string;
23
+ maxMs?: number;
24
+ measurements: VoiceLatencySLOMeasurement[];
25
+ p50Ms?: number;
26
+ p95Ms?: number;
27
+ stage: VoiceLatencySLOStage;
28
+ status: VoiceLatencySLOStatus;
29
+ total: number;
30
+ warnings: number;
31
+ };
32
+ export type VoiceLatencySLOGateReport = {
33
+ checkedAt: number;
34
+ failed: number;
35
+ measurements: VoiceLatencySLOMeasurement[];
36
+ stages: VoiceLatencySLOStageSummary[];
37
+ status: VoiceLatencySLOStatus;
38
+ total: number;
39
+ warnings: number;
40
+ };
41
+ export type VoiceLatencySLOGateOptions = {
42
+ budgets?: Partial<Record<VoiceLatencySLOStage, VoiceLatencySLOBudget>>;
43
+ events?: StoredVoiceTraceEvent[];
44
+ failAfterMs?: number;
45
+ limit?: number;
46
+ store?: VoiceTraceEventStore;
47
+ warnAfterMs?: number;
48
+ };
49
+ export type VoiceLatencySLOGateError = Error & {
50
+ report: VoiceLatencySLOGateReport;
51
+ };
52
+ export declare const buildVoiceLatencySLOGate: (options: VoiceLatencySLOGateOptions) => Promise<VoiceLatencySLOGateReport>;
53
+ export declare const assertVoiceLatencySLOGate: (options: VoiceLatencySLOGateOptions) => Promise<VoiceLatencySLOGateReport>;
54
+ export declare const renderVoiceLatencySLOMarkdown: (report: VoiceLatencySLOGateReport, options?: {
55
+ title?: string;
56
+ }) => string;
@@ -0,0 +1,78 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceTraceEventStore } from './trace';
3
+ export type VoiceLiveLatencyStatus = 'empty' | 'fail' | 'pass' | 'warn';
4
+ export type VoiceLiveLatencySample = {
5
+ at: number;
6
+ latencyMs: number;
7
+ sessionId: string;
8
+ status?: string;
9
+ traceId?: string;
10
+ };
11
+ export type VoiceLiveLatencyReport = {
12
+ averageLatencyMs?: number;
13
+ checkedAt: number;
14
+ failed: number;
15
+ p50LatencyMs?: number;
16
+ p95LatencyMs?: number;
17
+ recent: VoiceLiveLatencySample[];
18
+ status: VoiceLiveLatencyStatus;
19
+ total: number;
20
+ warnings: number;
21
+ };
22
+ export type VoiceLiveLatencyOptions = {
23
+ failAfterMs?: number;
24
+ limit?: number;
25
+ store: VoiceTraceEventStore;
26
+ warnAfterMs?: number;
27
+ };
28
+ export type VoiceLiveLatencyRoutesOptions = VoiceLiveLatencyOptions & {
29
+ headers?: HeadersInit;
30
+ htmlPath?: false | string;
31
+ name?: string;
32
+ path?: string;
33
+ title?: string;
34
+ };
35
+ export declare const summarizeVoiceLiveLatency: (options: VoiceLiveLatencyOptions) => Promise<VoiceLiveLatencyReport>;
36
+ export declare const renderVoiceLiveLatencyHTML: (report: VoiceLiveLatencyReport, options?: {
37
+ title?: string;
38
+ }) => string;
39
+ export declare const createVoiceLiveLatencyRoutes: (options: VoiceLiveLatencyRoutesOptions) => Elysia<"", {
40
+ decorator: {};
41
+ store: {};
42
+ derive: {};
43
+ resolve: {};
44
+ }, {
45
+ typebox: {};
46
+ error: {};
47
+ }, {
48
+ schema: {};
49
+ standaloneSchema: {};
50
+ macro: {};
51
+ macroFn: {};
52
+ parser: {};
53
+ response: {};
54
+ }, {
55
+ [x: string]: {
56
+ get: {
57
+ body: unknown;
58
+ params: {};
59
+ query: unknown;
60
+ headers: unknown;
61
+ response: {
62
+ 200: VoiceLiveLatencyReport;
63
+ };
64
+ };
65
+ };
66
+ }, {
67
+ derive: {};
68
+ resolve: {};
69
+ schema: {};
70
+ standaloneSchema: {};
71
+ response: {};
72
+ }, {
73
+ derive: {};
74
+ resolve: {};
75
+ schema: {};
76
+ standaloneSchema: {};
77
+ response: {};
78
+ }>;
@@ -0,0 +1,122 @@
1
+ import { Elysia } from 'elysia';
2
+ import { type VoiceAuditEventStore } from './audit';
3
+ import { type VoiceTraceEventStore } from './trace';
4
+ export declare const VOICE_LIVE_OPS_ACTIONS: readonly ["assign", "create-task", "escalate", "force-handoff", "inject-instruction", "operator-takeover", "pause-assistant", "resume-assistant", "tag"];
5
+ export type VoiceLiveOpsAction = (typeof VOICE_LIVE_OPS_ACTIONS)[number];
6
+ export type VoiceLiveOpsControlStatus = 'assistant-paused' | 'assistant-resumed' | 'handoff-forced' | 'instruction-injected' | 'operator-takeover' | 'recorded';
7
+ export type VoiceLiveOpsControlState = {
8
+ assistantPaused: boolean;
9
+ handoffTarget?: string;
10
+ injectedInstruction?: string;
11
+ lastAction: VoiceLiveOpsAction;
12
+ lastUpdatedAt: number;
13
+ operator?: string;
14
+ operatorTakeover: boolean;
15
+ status: VoiceLiveOpsControlStatus;
16
+ tag?: string;
17
+ };
18
+ export type VoiceLiveOpsActionInput = {
19
+ action: VoiceLiveOpsAction;
20
+ assignee?: string;
21
+ detail?: string;
22
+ sessionId: string;
23
+ tag?: string;
24
+ };
25
+ export type VoiceLiveOpsActionResult = {
26
+ action: VoiceLiveOpsAction;
27
+ control: VoiceLiveOpsControlState;
28
+ ok: true;
29
+ sessionId: string;
30
+ };
31
+ export type VoiceLiveOpsControlStore = {
32
+ get: (sessionId: string) => Promise<VoiceLiveOpsControlState | undefined> | VoiceLiveOpsControlState | undefined;
33
+ set: (sessionId: string, state: VoiceLiveOpsControlState) => Promise<void> | void;
34
+ };
35
+ export type VoiceLiveOpsControllerOptions = {
36
+ audit?: VoiceAuditEventStore;
37
+ defaultAssignee?: string;
38
+ defaultDetail?: string;
39
+ defaultTag?: string;
40
+ onAction?: (result: VoiceLiveOpsActionResult & {
41
+ assignee: string;
42
+ detail: string;
43
+ tag: string;
44
+ }) => Promise<void> | void;
45
+ store?: VoiceLiveOpsControlStore;
46
+ trace?: VoiceTraceEventStore;
47
+ };
48
+ export type VoiceLiveOpsRoutesOptions = VoiceLiveOpsControllerOptions & {
49
+ controlPath?: string;
50
+ name?: string;
51
+ path?: string;
52
+ };
53
+ export declare const createVoiceMemoryLiveOpsControlStore: () => VoiceLiveOpsControlStore;
54
+ export declare const getVoiceLiveOpsControlStatus: (action: VoiceLiveOpsAction) => VoiceLiveOpsControlStatus;
55
+ export declare const buildVoiceLiveOpsControlState: (input: VoiceLiveOpsActionInput & {
56
+ at?: number;
57
+ previous?: VoiceLiveOpsControlState;
58
+ }) => VoiceLiveOpsControlState;
59
+ export declare const createVoiceLiveOpsController: (options?: VoiceLiveOpsControllerOptions) => {
60
+ get: (sessionId: string) => VoiceLiveOpsControlState | Promise<VoiceLiveOpsControlState | undefined> | undefined;
61
+ perform: (input: VoiceLiveOpsActionInput) => Promise<VoiceLiveOpsActionResult>;
62
+ store: VoiceLiveOpsControlStore;
63
+ };
64
+ export declare const createVoiceLiveOpsRoutes: (options?: VoiceLiveOpsRoutesOptions) => Elysia<"", {
65
+ decorator: {};
66
+ store: {};
67
+ derive: {};
68
+ resolve: {};
69
+ }, {
70
+ typebox: {};
71
+ error: {};
72
+ }, {
73
+ schema: {};
74
+ standaloneSchema: {};
75
+ macro: {};
76
+ macroFn: {};
77
+ parser: {};
78
+ response: {};
79
+ }, {
80
+ [x: string]: {
81
+ post: {
82
+ body: unknown;
83
+ params: {};
84
+ query: unknown;
85
+ headers: unknown;
86
+ response: {
87
+ 200: VoiceLiveOpsActionResult | {
88
+ error: string;
89
+ ok: boolean;
90
+ };
91
+ };
92
+ };
93
+ };
94
+ } & {
95
+ [x: string]: {
96
+ get: {
97
+ body: unknown;
98
+ params: {};
99
+ query: unknown;
100
+ headers: unknown;
101
+ response: {
102
+ 200: {
103
+ control: VoiceLiveOpsControlState | undefined;
104
+ ok: boolean;
105
+ sessionId: string;
106
+ };
107
+ };
108
+ };
109
+ };
110
+ }, {
111
+ derive: {};
112
+ resolve: {};
113
+ schema: {};
114
+ standaloneSchema: {};
115
+ response: {};
116
+ }, {
117
+ derive: {};
118
+ resolve: {};
119
+ schema: {};
120
+ standaloneSchema: {};
121
+ response: {};
122
+ }>;
@@ -36,9 +36,11 @@ export type GeminiVoiceAssistantModelOptions = {
36
36
  };
37
37
  export type VoiceProviderRouterEvent<TProvider extends string = string> = {
38
38
  at: number;
39
+ attempt: number;
39
40
  elapsedMs: number;
40
41
  error?: string;
41
42
  fallbackProvider?: TProvider;
43
+ latencyBudgetMs?: number;
42
44
  provider: TProvider;
43
45
  providerHealth?: VoiceProviderRouterProviderHealth<TProvider>;
44
46
  rateLimited?: boolean;
@@ -47,18 +49,35 @@ export type VoiceProviderRouterEvent<TProvider extends string = string> = {
47
49
  suppressionRemainingMs?: number;
48
50
  suppressedUntil?: number;
49
51
  status: 'error' | 'fallback' | 'success';
52
+ timedOut?: boolean;
50
53
  };
51
54
  export type VoiceProviderRouterFallbackMode = 'never' | 'provider-error' | 'rate-limit';
52
- export type VoiceProviderRouterPolicy<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string> = 'ordered' | 'prefer-cheapest' | 'prefer-fastest' | 'prefer-selected' | {
55
+ export type VoiceProviderRouterStrategy = 'balanced' | 'ordered' | 'prefer-cheapest' | 'prefer-fastest' | 'prefer-selected' | 'quality-first';
56
+ export type VoiceProviderRouterPolicyPreset = 'balanced' | 'cost-cap' | 'cost-first' | 'latency-first' | 'quality-first';
57
+ export type VoiceProviderRouterPolicyWeights = {
58
+ cost?: number;
59
+ latencyMs?: number;
60
+ priority?: number;
61
+ quality?: number;
62
+ };
63
+ export type VoiceProviderRouterPolicy<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string> = VoiceProviderRouterStrategy | VoiceProviderRouterPolicyPreset | {
53
64
  allowProviders?: readonly TProvider[] | ((input: VoiceAgentModelInput<TContext, TSession>) => readonly TProvider[] | Promise<readonly TProvider[]>);
54
65
  fallbackMode?: VoiceProviderRouterFallbackMode;
55
- strategy?: 'ordered' | 'prefer-cheapest' | 'prefer-fastest' | 'prefer-selected';
66
+ maxCost?: number;
67
+ maxLatencyMs?: number;
68
+ minQuality?: number;
69
+ scoreProvider?: (provider: TProvider, profile: VoiceProviderRouterProviderProfile | undefined) => number;
70
+ strategy?: VoiceProviderRouterStrategy;
71
+ weights?: VoiceProviderRouterPolicyWeights;
56
72
  };
57
73
  export type VoiceProviderRouterProviderProfile = {
58
74
  cost?: number;
59
75
  latencyMs?: number;
60
76
  priority?: number;
77
+ quality?: number;
78
+ timeoutMs?: number;
61
79
  };
80
+ export declare const resolveVoiceProviderRoutingPolicyPreset: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string>(preset: VoiceProviderRouterPolicyPreset, options?: Omit<Extract<VoiceProviderRouterPolicy<TContext, TSession, TProvider>, Record<string, unknown>>, "strategy">) => Extract<VoiceProviderRouterPolicy<TContext, TSession, TProvider>, Record<string, unknown>>;
62
81
  export type VoiceProviderRouterHealthOptions = {
63
82
  cooldownMs?: number;
64
83
  failureThreshold?: number;
@@ -79,10 +98,12 @@ export type VoiceProviderRouterOptions<TContext = unknown, TSession extends Voic
79
98
  fallbackMode?: VoiceProviderRouterFallbackMode;
80
99
  isProviderError?: (error: unknown, provider: TProvider) => boolean;
81
100
  isRateLimitError?: (error: unknown, provider: TProvider) => boolean;
101
+ isTimeoutError?: (error: unknown, provider: TProvider) => boolean;
82
102
  onProviderEvent?: (event: VoiceProviderRouterEvent<TProvider>, input: VoiceAgentModelInput<TContext, TSession>) => Promise<void> | void;
83
103
  policy?: VoiceProviderRouterPolicy<TContext, TSession, TProvider>;
84
104
  providerHealth?: boolean | VoiceProviderRouterHealthOptions;
85
105
  providerProfiles?: Partial<Record<TProvider, VoiceProviderRouterProviderProfile>>;
106
+ timeoutMs?: number;
86
107
  providers: Partial<Record<TProvider, VoiceAgentModel<TContext, TSession, TResult>>>;
87
108
  selectProvider?: (input: VoiceAgentModelInput<TContext, TSession>) => TProvider | undefined | Promise<TProvider | undefined>;
88
109
  };
@@ -0,0 +1,297 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { S3Client, S3Options } from 'bun';
3
+ import { Database } from 'bun:sqlite';
4
+ import { type VoiceAuditSinkDeliveryQueueSummary, type VoiceAuditSinkDeliveryRecord, type VoiceAuditSinkDeliveryStore } from './auditSinks';
5
+ import type { VoiceAuditEventStore, VoiceAuditEventType } from './audit';
6
+ import { type VoiceOperationsRecord } from './operationsRecord';
7
+ import { type VoiceTraceSinkDeliveryQueueSummary } from './queue';
8
+ import { type StoredVoiceTraceEvent, type VoiceTraceEventStore, type VoiceTraceEventType, type VoiceTraceRedactionConfig, type VoiceTraceSinkDeliveryRecord, type VoiceTraceSinkDeliveryStore, type VoiceTraceSummary } from './trace';
9
+ import type { VoicePostgresClient } from './postgresStore';
10
+ export type VoiceObservabilityExportStatus = 'fail' | 'pass' | 'warn';
11
+ export declare const voiceObservabilityExportSchemaVersion = "1.0.0";
12
+ export declare const voiceObservabilityExportSchemaId = "com.absolutejs.voice.observability-export";
13
+ export type VoiceObservabilityExportSchema = {
14
+ id: typeof voiceObservabilityExportSchemaId;
15
+ version: typeof voiceObservabilityExportSchemaVersion;
16
+ };
17
+ export declare const createVoiceObservabilityExportSchema: () => VoiceObservabilityExportSchema;
18
+ export declare const assertVoiceObservabilityExportSchema: (input: {
19
+ schema?: {
20
+ id?: string;
21
+ version?: string;
22
+ };
23
+ }) => void;
24
+ export type VoiceObservabilityExportArtifactKind = 'incident' | 'markdown' | 'operations-record' | 'proof-pack' | 'readiness' | 'screenshot' | 'slo' | 'trace' | 'audit' | 'custom';
25
+ export type VoiceObservabilityExportArtifactChecksum = {
26
+ algorithm: 'sha256';
27
+ value: string;
28
+ };
29
+ export type VoiceObservabilityExportArtifactFreshness = {
30
+ ageMs?: number;
31
+ checkedAt: number;
32
+ generatedAt?: number | string;
33
+ maxAgeMs?: number;
34
+ status: VoiceObservabilityExportStatus;
35
+ };
36
+ export type VoiceObservabilityExportArtifact = {
37
+ bytes?: number;
38
+ checksum?: VoiceObservabilityExportArtifactChecksum;
39
+ contentType?: string;
40
+ downloadHref?: string;
41
+ freshness?: VoiceObservabilityExportArtifactFreshness;
42
+ generatedAt?: number | string;
43
+ href?: string;
44
+ id: string;
45
+ kind: VoiceObservabilityExportArtifactKind;
46
+ label: string;
47
+ maxAgeMs?: number;
48
+ path?: string;
49
+ required?: boolean;
50
+ sessionId?: string;
51
+ status?: VoiceObservabilityExportStatus;
52
+ };
53
+ export type VoiceObservabilityExportEnvelope = {
54
+ at: number;
55
+ eventId: string;
56
+ eventType: VoiceTraceEventType | VoiceAuditEventType;
57
+ kind: 'audit' | 'trace';
58
+ operationsRecordHref?: string;
59
+ provider?: string;
60
+ providerKind?: string;
61
+ scenarioId?: string;
62
+ sessionId?: string;
63
+ severity: VoiceObservabilityExportStatus;
64
+ traceId?: string;
65
+ };
66
+ export type VoiceObservabilityExportIssueCode = 'voice.observability.no_evidence' | 'voice.observability.operation_failed' | 'voice.observability.artifact_missing' | 'voice.observability.artifact_stale' | 'voice.observability.audit_delivery_failed' | 'voice.observability.audit_delivery_pending' | 'voice.observability.trace_delivery_failed' | 'voice.observability.trace_delivery_pending';
67
+ export type VoiceObservabilityExportIssue = {
68
+ code: VoiceObservabilityExportIssueCode;
69
+ detail?: string;
70
+ label: string;
71
+ severity: Exclude<VoiceObservabilityExportStatus, 'pass'>;
72
+ value?: number | string;
73
+ };
74
+ export type VoiceObservabilityExportDeliverySummary = {
75
+ audit?: VoiceAuditSinkDeliveryQueueSummary;
76
+ trace?: VoiceTraceSinkDeliveryQueueSummary;
77
+ };
78
+ export type VoiceObservabilityExportRedactionSummary = {
79
+ enabled: boolean;
80
+ mode: 'none' | 'redacted';
81
+ };
82
+ export type VoiceObservabilityExportReport = {
83
+ artifacts: VoiceObservabilityExportArtifact[];
84
+ checkedAt: number;
85
+ deliveries: VoiceObservabilityExportDeliverySummary;
86
+ envelopes: VoiceObservabilityExportEnvelope[];
87
+ issues: VoiceObservabilityExportIssue[];
88
+ operationsRecords: VoiceOperationsRecord[];
89
+ redaction: VoiceObservabilityExportRedactionSummary;
90
+ schema: VoiceObservabilityExportSchema;
91
+ sessionIds: string[];
92
+ status: VoiceObservabilityExportStatus;
93
+ summary: {
94
+ auditEvents: number;
95
+ events: number;
96
+ failedOperationsRecords: number;
97
+ trace: VoiceTraceSummary;
98
+ traceEvents: number;
99
+ };
100
+ };
101
+ export type VoiceObservabilityExportArtifactIndexItem = {
102
+ bytes?: number;
103
+ checksum?: VoiceObservabilityExportArtifactChecksum;
104
+ contentType?: string;
105
+ downloadHref?: string;
106
+ freshness?: VoiceObservabilityExportArtifactFreshness;
107
+ href?: string;
108
+ id: string;
109
+ kind: VoiceObservabilityExportArtifactKind;
110
+ label: string;
111
+ required?: boolean;
112
+ sessionId?: string;
113
+ status?: VoiceObservabilityExportStatus;
114
+ };
115
+ export type VoiceObservabilityExportArtifactIndex = {
116
+ artifacts: VoiceObservabilityExportArtifactIndexItem[];
117
+ checkedAt: number;
118
+ schema: VoiceObservabilityExportSchema;
119
+ status: VoiceObservabilityExportStatus;
120
+ summary: {
121
+ downloadable: number;
122
+ failed: number;
123
+ required: number;
124
+ total: number;
125
+ warn: number;
126
+ };
127
+ };
128
+ export type VoiceObservabilityExportDeliveryDestination = {
129
+ directory: string;
130
+ id?: string;
131
+ includeArtifacts?: boolean;
132
+ kind: 'file';
133
+ label?: string;
134
+ } | (S3Options & {
135
+ bucket?: string;
136
+ client?: Pick<S3Client, 'file'>;
137
+ id?: string;
138
+ includeArtifacts?: boolean;
139
+ keyPrefix?: string;
140
+ kind: 's3';
141
+ label?: string;
142
+ }) | {
143
+ database?: Database;
144
+ id?: string;
145
+ kind: 'sqlite';
146
+ label?: string;
147
+ path?: string;
148
+ tableName?: string;
149
+ } | {
150
+ connectionString?: string;
151
+ id?: string;
152
+ kind: 'postgres';
153
+ label?: string;
154
+ schemaName?: string;
155
+ sql?: VoicePostgresClient;
156
+ tableName?: string;
157
+ } | {
158
+ fetch?: typeof fetch;
159
+ headers?: Record<string, string>;
160
+ id?: string;
161
+ includeArtifacts?: boolean;
162
+ kind: 'webhook';
163
+ label?: string;
164
+ timeoutMs?: number;
165
+ url: string;
166
+ };
167
+ export type VoiceObservabilityExportDeliveryDestinationResult = {
168
+ artifactCount: number;
169
+ deliveredAt: number;
170
+ destinationId: string;
171
+ destinationKind: VoiceObservabilityExportDeliveryDestination['kind'];
172
+ error?: string;
173
+ label: string;
174
+ manifestBytes: number;
175
+ schema: VoiceObservabilityExportSchema;
176
+ status: 'delivered' | 'failed';
177
+ target: string;
178
+ };
179
+ export type VoiceObservabilityExportDeliveryReport = {
180
+ checkedAt: number;
181
+ destinations: VoiceObservabilityExportDeliveryDestinationResult[];
182
+ exportStatus: VoiceObservabilityExportStatus;
183
+ status: VoiceObservabilityExportStatus;
184
+ summary: {
185
+ delivered: number;
186
+ failed: number;
187
+ total: number;
188
+ };
189
+ };
190
+ export type VoiceObservabilityExportDeliveryReceipt = {
191
+ checkedAt: number;
192
+ destinations: VoiceObservabilityExportDeliveryDestinationResult[];
193
+ exportStatus: VoiceObservabilityExportStatus;
194
+ id: string;
195
+ runId: string;
196
+ status: VoiceObservabilityExportStatus;
197
+ summary: VoiceObservabilityExportDeliveryReport['summary'];
198
+ };
199
+ export type VoiceObservabilityExportDeliveryReceiptStore = {
200
+ get: (id: string) => Promise<VoiceObservabilityExportDeliveryReceipt | undefined> | VoiceObservabilityExportDeliveryReceipt | undefined;
201
+ list: () => Promise<VoiceObservabilityExportDeliveryReceipt[]> | VoiceObservabilityExportDeliveryReceipt[];
202
+ remove: (id: string) => Promise<void> | void;
203
+ set: (id: string, receipt: VoiceObservabilityExportDeliveryReceipt) => Promise<void> | void;
204
+ };
205
+ export type VoiceObservabilityExportDeliveryHistory = {
206
+ checkedAt: number;
207
+ receipts: VoiceObservabilityExportDeliveryReceipt[];
208
+ status: VoiceObservabilityExportStatus;
209
+ summary: {
210
+ delivered: number;
211
+ failed: number;
212
+ receipts: number;
213
+ totalDestinations: number;
214
+ };
215
+ };
216
+ export type VoiceObservabilityExportDeliveryOptions = {
217
+ destinations: VoiceObservabilityExportDeliveryDestination[];
218
+ report: VoiceObservabilityExportReport;
219
+ receipts?: VoiceObservabilityExportDeliveryReceiptStore;
220
+ runId?: string;
221
+ };
222
+ export type VoiceObservabilityExportOptions = {
223
+ artifacts?: VoiceObservabilityExportArtifact[];
224
+ artifactIntegrity?: {
225
+ checksum?: false | 'sha256';
226
+ maxAgeMs?: number;
227
+ missingSeverity?: Exclude<VoiceObservabilityExportStatus, 'pass'>;
228
+ now?: number;
229
+ staleSeverity?: Exclude<VoiceObservabilityExportStatus, 'pass'>;
230
+ };
231
+ audit?: VoiceAuditEventStore;
232
+ auditDeliveries?: VoiceAuditSinkDeliveryRecord[] | VoiceAuditSinkDeliveryStore;
233
+ events?: StoredVoiceTraceEvent[];
234
+ includeOperationsRecords?: boolean;
235
+ links?: {
236
+ artifactDownload?: (artifact: VoiceObservabilityExportArtifact) => string;
237
+ operationsRecord?: (sessionId: string) => string;
238
+ };
239
+ operationsRecords?: VoiceOperationsRecord[];
240
+ redact?: VoiceTraceRedactionConfig;
241
+ sessionIds?: string[];
242
+ store?: VoiceTraceEventStore;
243
+ traceDeliveries?: VoiceTraceSinkDeliveryRecord[] | VoiceTraceSinkDeliveryStore;
244
+ };
245
+ export type VoiceObservabilityExportRoutesOptions = VoiceObservabilityExportOptions & {
246
+ headers?: HeadersInit;
247
+ artifactDownloadPath?: false | string;
248
+ artifactIndexPath?: false | string;
249
+ deliveryDestinations?: VoiceObservabilityExportDeliveryDestination[];
250
+ deliveryPath?: false | string;
251
+ deliveryReceipts?: VoiceObservabilityExportDeliveryReceiptStore;
252
+ htmlPath?: false | string;
253
+ markdownPath?: false | string;
254
+ name?: string;
255
+ path?: string;
256
+ render?: (report: VoiceObservabilityExportReport) => string | Promise<string>;
257
+ title?: string;
258
+ };
259
+ export declare const createVoiceMemoryObservabilityExportDeliveryReceiptStore: () => VoiceObservabilityExportDeliveryReceiptStore;
260
+ export declare const createVoiceFileObservabilityExportDeliveryReceiptStore: (options: {
261
+ directory: string;
262
+ }) => VoiceObservabilityExportDeliveryReceiptStore;
263
+ export declare const buildVoiceObservabilityExportDeliveryHistory: (store: VoiceObservabilityExportDeliveryReceiptStore) => Promise<VoiceObservabilityExportDeliveryHistory>;
264
+ export declare const buildVoiceObservabilityExport: (options?: VoiceObservabilityExportOptions) => Promise<VoiceObservabilityExportReport>;
265
+ export declare const renderVoiceObservabilityExportMarkdown: (report: VoiceObservabilityExportReport, options?: {
266
+ title?: string;
267
+ }) => string;
268
+ export declare const buildVoiceObservabilityArtifactIndex: (report: VoiceObservabilityExportReport) => VoiceObservabilityExportArtifactIndex;
269
+ export declare const deliverVoiceObservabilityExport: (options: VoiceObservabilityExportDeliveryOptions) => Promise<VoiceObservabilityExportDeliveryReport>;
270
+ export declare const createVoiceObservabilityExportRoutes: (options?: VoiceObservabilityExportRoutesOptions) => Elysia<"", {
271
+ decorator: {};
272
+ store: {};
273
+ derive: {};
274
+ resolve: {};
275
+ }, {
276
+ typebox: {};
277
+ error: {};
278
+ }, {
279
+ schema: {};
280
+ standaloneSchema: {};
281
+ macro: {};
282
+ macroFn: {};
283
+ parser: {};
284
+ response: {};
285
+ }, {}, {
286
+ derive: {};
287
+ resolve: {};
288
+ schema: {};
289
+ standaloneSchema: {};
290
+ response: {};
291
+ }, {
292
+ derive: {};
293
+ resolve: {};
294
+ schema: {};
295
+ standaloneSchema: {};
296
+ response: {};
297
+ }>;
@@ -0,0 +1,27 @@
1
+ import type { RealtimeAdapter } from './types';
2
+ export type OpenAIRealtimeModel = 'gpt-realtime' | 'gpt-realtime-mini' | 'gpt-4o-realtime-preview' | 'gpt-4o-mini-realtime-preview' | (string & {});
3
+ export type OpenAIRealtimeVoice = 'alloy' | 'ash' | 'ballad' | 'cedar' | 'coral' | 'echo' | 'marin' | 'sage' | 'shimmer' | 'verse' | {
4
+ id: string;
5
+ } | (string & {});
6
+ export type OpenAIRealtimeTranscriptionModel = 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | 'whisper-1' | (string & {});
7
+ export type OpenAIRealtimeNoiseReduction = 'near_field' | 'far_field';
8
+ export type OpenAIRealtimeResponseMode = 'audio' | 'text';
9
+ export type OpenAIRealtimeAdapterOptions = {
10
+ apiKey: string;
11
+ autoCommitSilenceMs?: number;
12
+ baseUrl?: string;
13
+ emitResponseTranscripts?: boolean;
14
+ inputTranscriptionLanguage?: string;
15
+ inputTranscriptionModel?: OpenAIRealtimeTranscriptionModel | null;
16
+ inputTranscriptionPrompt?: string;
17
+ instructions?: string;
18
+ maxOutputTokens?: number | 'inf';
19
+ model?: OpenAIRealtimeModel;
20
+ noiseReduction?: OpenAIRealtimeNoiseReduction;
21
+ responseMode?: OpenAIRealtimeResponseMode;
22
+ speed?: number;
23
+ temperature?: number;
24
+ voice?: OpenAIRealtimeVoice;
25
+ webSocket?: typeof WebSocket;
26
+ };
27
+ export declare const createOpenAIRealtimeAdapter: (options: OpenAIRealtimeAdapterOptions) => RealtimeAdapter;
@@ -0,0 +1,18 @@
1
+ import type { TTSAdapter, TTSAdapterOpenOptions, VoiceLexiconEntry } from './types';
2
+ export type OpenAIVoiceTTSVoice = 'alloy' | 'ash' | 'ballad' | 'cedar' | 'coral' | 'echo' | 'fable' | 'marin' | 'nova' | 'onyx' | 'sage' | 'shimmer' | 'verse' | (string & {});
3
+ export type OpenAIVoiceTTSOptions = {
4
+ apiKey: string;
5
+ baseUrl?: string;
6
+ fetch?: typeof fetch;
7
+ instructions?: string | ((input: {
8
+ lexicon?: VoiceLexiconEntry[];
9
+ sessionId: string;
10
+ text: string;
11
+ }) => Promise<string | undefined> | string | undefined);
12
+ model?: 'gpt-4o-mini-tts' | 'tts-1' | 'tts-1-hd' | (string & {});
13
+ speed?: number;
14
+ voice?: OpenAIVoiceTTSVoice | {
15
+ id: string;
16
+ };
17
+ };
18
+ export declare const createOpenAIVoiceTTS: (options: OpenAIVoiceTTSOptions) => TTSAdapter<TTSAdapterOpenOptions>;