@absolutejs/voice 0.0.22-beta.12 → 0.0.22-beta.120

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 (146) hide show
  1. package/README.md +411 -3
  2. package/dist/agent.d.ts +2 -0
  3. package/dist/angular/index.d.ts +9 -0
  4. package/dist/angular/index.js +1278 -44
  5. package/dist/angular/voice-app-kit-status.service.d.ts +12 -0
  6. package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
  7. package/dist/angular/voice-ops-status.component.d.ts +15 -0
  8. package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
  9. package/dist/angular/voice-provider-status.service.d.ts +12 -0
  10. package/dist/angular/voice-routing-status.service.d.ts +11 -0
  11. package/dist/angular/voice-stream.service.d.ts +2 -0
  12. package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
  13. package/dist/angular/voice-turn-latency.service.d.ts +13 -0
  14. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  15. package/dist/angular/voice-workflow-status.service.d.ts +12 -0
  16. package/dist/appKit.d.ts +100 -0
  17. package/dist/assistantHealth.d.ts +81 -0
  18. package/dist/bargeInRoutes.d.ts +56 -0
  19. package/dist/campaign.d.ts +610 -0
  20. package/dist/campaignDialers.d.ts +90 -0
  21. package/dist/client/actions.d.ts +22 -0
  22. package/dist/client/appKitStatus.d.ts +19 -0
  23. package/dist/client/bargeInMonitor.d.ts +7 -0
  24. package/dist/client/campaignDialerProof.d.ts +23 -0
  25. package/dist/client/connection.d.ts +3 -0
  26. package/dist/client/duplex.d.ts +1 -1
  27. package/dist/client/htmxBootstrap.js +587 -13
  28. package/dist/client/index.d.ts +40 -0
  29. package/dist/client/index.js +2028 -8
  30. package/dist/client/liveTurnLatency.d.ts +41 -0
  31. package/dist/client/opsStatusWidget.d.ts +40 -0
  32. package/dist/client/providerCapabilities.d.ts +19 -0
  33. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  34. package/dist/client/providerSimulationControls.d.ts +33 -0
  35. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  36. package/dist/client/providerStatus.d.ts +19 -0
  37. package/dist/client/providerStatusWidget.d.ts +32 -0
  38. package/dist/client/routingStatus.d.ts +19 -0
  39. package/dist/client/routingStatusWidget.d.ts +28 -0
  40. package/dist/client/traceTimeline.d.ts +19 -0
  41. package/dist/client/traceTimelineWidget.d.ts +32 -0
  42. package/dist/client/turnLatency.d.ts +22 -0
  43. package/dist/client/turnLatencyWidget.d.ts +33 -0
  44. package/dist/client/turnQuality.d.ts +19 -0
  45. package/dist/client/turnQualityWidget.d.ts +32 -0
  46. package/dist/client/workflowStatus.d.ts +19 -0
  47. package/dist/diagnosticsRoutes.d.ts +44 -0
  48. package/dist/evalRoutes.d.ts +213 -0
  49. package/dist/fileStore.d.ts +3 -0
  50. package/dist/handoff.d.ts +54 -0
  51. package/dist/handoffHealth.d.ts +94 -0
  52. package/dist/index.d.ts +77 -8
  53. package/dist/index.js +12645 -3061
  54. package/dist/liveLatency.d.ts +78 -0
  55. package/dist/modelAdapters.d.ts +41 -2
  56. package/dist/openaiTTS.d.ts +18 -0
  57. package/dist/opsConsoleRoutes.d.ts +77 -0
  58. package/dist/opsWebhook.d.ts +126 -0
  59. package/dist/outcomeContract.d.ts +112 -0
  60. package/dist/phoneAgent.d.ts +58 -0
  61. package/dist/postgresStore.d.ts +5 -0
  62. package/dist/productionReadiness.d.ts +121 -0
  63. package/dist/providerAdapters.d.ts +48 -0
  64. package/dist/providerCapabilities.d.ts +92 -0
  65. package/dist/providerHealth.d.ts +79 -0
  66. package/dist/qualityRoutes.d.ts +76 -0
  67. package/dist/queue.d.ts +61 -0
  68. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  69. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  70. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  71. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  72. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  73. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  74. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  75. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  76. package/dist/react/index.d.ts +18 -0
  77. package/dist/react/index.js +2606 -12
  78. package/dist/react/useVoiceAppKitStatus.d.ts +8 -0
  79. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  80. package/dist/react/useVoiceController.d.ts +2 -0
  81. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  82. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  83. package/dist/react/useVoiceProviderStatus.d.ts +8 -0
  84. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  85. package/dist/react/useVoiceStream.d.ts +2 -0
  86. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  87. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  88. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  89. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  90. package/dist/resilienceRoutes.d.ts +142 -0
  91. package/dist/sessionReplay.d.ts +175 -0
  92. package/dist/simulationSuite.d.ts +120 -0
  93. package/dist/sqliteStore.d.ts +5 -0
  94. package/dist/svelte/createVoiceAppKitStatus.d.ts +8 -0
  95. package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
  96. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  97. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  98. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  99. package/dist/svelte/createVoiceProviderStatus.d.ts +10 -0
  100. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  101. package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
  102. package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
  103. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  104. package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
  105. package/dist/svelte/index.d.ts +11 -0
  106. package/dist/svelte/index.js +1849 -4
  107. package/dist/telephony/contract.d.ts +61 -0
  108. package/dist/telephony/matrix.d.ts +97 -0
  109. package/dist/telephony/plivo.d.ts +254 -0
  110. package/dist/telephony/telnyx.d.ts +247 -0
  111. package/dist/telephony/twilio.d.ts +132 -0
  112. package/dist/telephonyOutcome.d.ts +201 -0
  113. package/dist/testing/index.d.ts +2 -0
  114. package/dist/testing/index.js +2640 -21
  115. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  116. package/dist/testing/providerSimulator.d.ts +44 -0
  117. package/dist/toolContract.d.ts +130 -0
  118. package/dist/toolRuntime.d.ts +50 -0
  119. package/dist/trace.d.ts +1 -1
  120. package/dist/traceTimeline.d.ts +93 -0
  121. package/dist/turnLatency.d.ts +95 -0
  122. package/dist/turnQuality.d.ts +94 -0
  123. package/dist/types.d.ts +125 -2
  124. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  125. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  126. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  127. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  128. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  129. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  130. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  131. package/dist/vue/index.d.ts +17 -0
  132. package/dist/vue/index.js +2520 -29
  133. package/dist/vue/useVoiceAppKitStatus.d.ts +9 -0
  134. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  135. package/dist/vue/useVoiceController.d.ts +1 -1
  136. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  137. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  138. package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
  139. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  140. package/dist/vue/useVoiceStream.d.ts +3 -1
  141. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  142. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  143. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  144. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  145. package/dist/workflowContract.d.ts +91 -0
  146. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ import type { VoiceIOProviderRouterEvent } from '../providerAdapters';
2
+ export type VoiceIOProviderFailureSimulationMode = 'failure' | 'recovery';
3
+ export type VoiceIOProviderFailureSimulationKind = 'stt' | 'tts';
4
+ export type VoiceIOProviderFailureSimulationOperation = 'open' | 'send';
5
+ export type VoiceIOProviderFailureSimulationResult<TProvider extends string = string> = {
6
+ fallbackProvider?: TProvider;
7
+ mode: VoiceIOProviderFailureSimulationMode;
8
+ provider: TProvider;
9
+ sessionId: string;
10
+ status: 'simulated';
11
+ suppressedUntil?: number;
12
+ };
13
+ export type VoiceIOProviderFailureSimulatorOptions<TProvider extends string = string> = {
14
+ cooldownMs?: number;
15
+ fallback?: readonly TProvider[] | ((provider: TProvider) => readonly TProvider[] | Promise<readonly TProvider[]>);
16
+ failureElapsedMs?: number;
17
+ failureMessage?: (input: {
18
+ kind: VoiceIOProviderFailureSimulationKind;
19
+ operation: VoiceIOProviderFailureSimulationOperation;
20
+ provider: TProvider;
21
+ }) => string;
22
+ kind: VoiceIOProviderFailureSimulationKind;
23
+ latencyBudgets?: Partial<Record<TProvider, number>>;
24
+ now?: () => number;
25
+ onProviderEvent?: (event: VoiceIOProviderRouterEvent<TProvider>, input: {
26
+ mode: VoiceIOProviderFailureSimulationMode;
27
+ provider: TProvider;
28
+ sessionId: string;
29
+ }) => Promise<void> | void;
30
+ operation?: VoiceIOProviderFailureSimulationOperation;
31
+ providers: readonly TProvider[];
32
+ recoveryElapsedMs?: number | Partial<Record<TProvider, number>>;
33
+ sessionId?: (input: {
34
+ mode: VoiceIOProviderFailureSimulationMode;
35
+ now: number;
36
+ provider: TProvider;
37
+ }) => string;
38
+ };
39
+ export declare const createVoiceIOProviderFailureSimulator: <TProvider extends string>(options: VoiceIOProviderFailureSimulatorOptions<TProvider>) => {
40
+ run: (provider: TProvider, mode: VoiceIOProviderFailureSimulationMode) => Promise<VoiceIOProviderFailureSimulationResult<TProvider>>;
41
+ };
@@ -0,0 +1,44 @@
1
+ import type { VoiceAgentModelInput, VoiceAgentModelOutput } from '../agent';
2
+ import type { VoiceSessionRecord } from '../types';
3
+ import type { VoiceProviderRouterEvent, VoiceProviderRouterHealthOptions } from '../modelAdapters';
4
+ export type VoiceProviderFailureSimulationMode = 'failure' | 'recovery';
5
+ export type VoiceProviderFailureSimulationContext<TProvider extends string = string> = {
6
+ query: {
7
+ provider: TProvider;
8
+ recoverProvider?: TProvider;
9
+ simulateFailureProvider?: TProvider;
10
+ };
11
+ };
12
+ export type VoiceProviderFailureSimulationResult<TProvider extends string = string, TResult = unknown> = {
13
+ mode: VoiceProviderFailureSimulationMode;
14
+ provider: TProvider;
15
+ replayHref?: string;
16
+ result: VoiceAgentModelOutput<TResult>;
17
+ sessionId: string;
18
+ status: 'simulated';
19
+ turnId: string;
20
+ };
21
+ type ProviderListResolver<TContext, TSession extends VoiceSessionRecord, TProvider extends string> = readonly TProvider[] | ((input: VoiceAgentModelInput<TContext, TSession>) => readonly TProvider[] | Promise<readonly TProvider[]>);
22
+ export type VoiceProviderFailureSimulatorOptions<TContext extends VoiceProviderFailureSimulationContext<TProvider>, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown, TProvider extends string = string> = {
23
+ allowProviders?: ProviderListResolver<TContext, TSession, TProvider>;
24
+ fallback?: readonly TProvider[] | ((provider: TProvider, input: VoiceAgentModelInput<TContext, TSession>) => readonly TProvider[] | Promise<readonly TProvider[]>);
25
+ isProviderError?: (error: unknown, provider: TProvider) => boolean;
26
+ isRateLimitError?: (error: unknown, provider: TProvider) => boolean;
27
+ onProviderEvent?: (event: VoiceProviderRouterEvent<TProvider>, input: VoiceAgentModelInput<TContext, TSession>) => Promise<void> | void;
28
+ providerHealth?: boolean | VoiceProviderRouterHealthOptions;
29
+ providerLabel?: (provider: TProvider) => string;
30
+ providers: readonly TProvider[];
31
+ replayHref?: false | string | ((input: {
32
+ provider: TProvider;
33
+ sessionId: string;
34
+ turnId: string;
35
+ }) => string);
36
+ response?: (input: {
37
+ mode: VoiceProviderFailureSimulationMode;
38
+ provider: TProvider;
39
+ } & VoiceAgentModelInput<TContext, TSession>) => VoiceAgentModelOutput<TResult> | Promise<VoiceAgentModelOutput<TResult>>;
40
+ };
41
+ export declare const createVoiceProviderFailureSimulator: <TProvider extends string, TResult = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TContext extends VoiceProviderFailureSimulationContext<TProvider> = VoiceProviderFailureSimulationContext<TProvider>>(options: VoiceProviderFailureSimulatorOptions<TContext, TSession, TResult, TProvider>) => {
42
+ run: (provider: TProvider, mode: VoiceProviderFailureSimulationMode) => Promise<VoiceProviderFailureSimulationResult<TProvider, TResult>>;
43
+ };
44
+ export {};
@@ -0,0 +1,130 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceAgentTool } from './agent';
3
+ import { type VoiceToolRuntimeOptions } from './toolRuntime';
4
+ import type { VoiceSessionRecord, VoiceTurnRecord } from './types';
5
+ export type VoiceToolContractExpectation = {
6
+ expectedAttempts?: number;
7
+ expectedErrorIncludes?: string;
8
+ expectedResult?: unknown;
9
+ expectIdempotent?: boolean;
10
+ expectStatus?: 'error' | 'ok';
11
+ expectTimedOut?: boolean;
12
+ maxElapsedMs?: number;
13
+ };
14
+ export type VoiceToolContractCase<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown> = {
15
+ args: TArgs;
16
+ context?: TContext;
17
+ expect?: VoiceToolContractExpectation;
18
+ id: string;
19
+ label?: string;
20
+ runtime?: VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>;
21
+ session?: TSession;
22
+ toolCallId?: string;
23
+ turn?: VoiceTurnRecord;
24
+ };
25
+ export type VoiceToolContractDefinition<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown> = {
26
+ cases: Array<VoiceToolContractCase<TContext, TSession, TArgs, TToolResult, TRouteResult>>;
27
+ defaultRuntime?: VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>;
28
+ description?: string;
29
+ id: string;
30
+ label?: string;
31
+ tool: VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>;
32
+ };
33
+ export type VoiceToolContractIssue = {
34
+ caseId: string;
35
+ code: string;
36
+ message: string;
37
+ };
38
+ export type VoiceToolContractCaseReport = {
39
+ attempts: number;
40
+ caseId: string;
41
+ elapsedMs: number;
42
+ error?: string;
43
+ issues: VoiceToolContractIssue[];
44
+ label?: string;
45
+ pass: boolean;
46
+ status: 'error' | 'ok';
47
+ timedOut: boolean;
48
+ };
49
+ export type VoiceToolContractReport = {
50
+ cases: VoiceToolContractCaseReport[];
51
+ contractId: string;
52
+ label?: string;
53
+ issues: VoiceToolContractIssue[];
54
+ pass: boolean;
55
+ toolName: string;
56
+ };
57
+ export type VoiceToolContractSuiteReport = {
58
+ checkedAt: number;
59
+ contracts: VoiceToolContractReport[];
60
+ failed: number;
61
+ passed: number;
62
+ status: 'fail' | 'pass';
63
+ total: number;
64
+ };
65
+ export type VoiceToolContractHandlerOptions = {
66
+ contracts: VoiceToolContractDefinition[];
67
+ };
68
+ export type VoiceToolContractHTMLHandlerOptions = VoiceToolContractHandlerOptions & {
69
+ headers?: HeadersInit;
70
+ render?: (report: VoiceToolContractSuiteReport) => string | Promise<string>;
71
+ title?: string;
72
+ };
73
+ export type VoiceToolContractRoutesOptions = VoiceToolContractHTMLHandlerOptions & {
74
+ htmlPath?: false | string;
75
+ name?: string;
76
+ path?: string;
77
+ };
78
+ export declare const runVoiceToolContract: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown>(definition: VoiceToolContractDefinition<TContext, TSession, TArgs, TToolResult, TRouteResult>) => Promise<VoiceToolContractReport>;
79
+ export declare const createVoiceToolContract: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown>(definition: VoiceToolContractDefinition<TContext, TSession, TArgs, TToolResult, TRouteResult>) => {
80
+ assert: () => Promise<VoiceToolContractReport>;
81
+ definition: VoiceToolContractDefinition<TContext, TSession, TArgs, TToolResult, TRouteResult>;
82
+ run: () => Promise<VoiceToolContractReport>;
83
+ };
84
+ export declare const createVoiceToolRuntimeContractDefaults: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown>() => VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>;
85
+ export declare const runVoiceToolContractSuite: (options: VoiceToolContractHandlerOptions) => Promise<VoiceToolContractSuiteReport>;
86
+ export declare const renderVoiceToolContractHTML: (report: VoiceToolContractSuiteReport, options?: {
87
+ title?: string;
88
+ }) => string;
89
+ export declare const createVoiceToolContractJSONHandler: (options: VoiceToolContractHandlerOptions) => () => Promise<VoiceToolContractSuiteReport>;
90
+ export declare const createVoiceToolContractHTMLHandler: (options: VoiceToolContractHTMLHandlerOptions) => () => Promise<Response>;
91
+ export declare const createVoiceToolContractRoutes: (options: VoiceToolContractRoutesOptions) => Elysia<"", {
92
+ decorator: {};
93
+ store: {};
94
+ derive: {};
95
+ resolve: {};
96
+ }, {
97
+ typebox: {};
98
+ error: {};
99
+ }, {
100
+ schema: {};
101
+ standaloneSchema: {};
102
+ macro: {};
103
+ macroFn: {};
104
+ parser: {};
105
+ response: {};
106
+ }, {
107
+ [x: string]: {
108
+ get: {
109
+ body: unknown;
110
+ params: {};
111
+ query: unknown;
112
+ headers: unknown;
113
+ response: {
114
+ 200: VoiceToolContractSuiteReport;
115
+ };
116
+ };
117
+ };
118
+ }, {
119
+ derive: {};
120
+ resolve: {};
121
+ schema: {};
122
+ standaloneSchema: {};
123
+ response: {};
124
+ }, {
125
+ derive: {};
126
+ resolve: {};
127
+ schema: {};
128
+ standaloneSchema: {};
129
+ response: {};
130
+ }>;
@@ -0,0 +1,50 @@
1
+ import type { VoiceAgentTool, VoiceAgentToolResult } from './agent';
2
+ import type { VoiceSessionHandle, VoiceSessionRecord, VoiceTurnRecord } from './types';
3
+ import type { VoiceTraceEventStore } from './trace';
4
+ export type VoiceToolRetryDelay = number | ((input: {
5
+ attempt: number;
6
+ error: unknown;
7
+ toolName: string;
8
+ }) => number);
9
+ export type VoiceToolRuntimeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown> = {
10
+ idempotencyKey?: (input: {
11
+ args: unknown;
12
+ context: TContext;
13
+ session: TSession;
14
+ toolCallId?: string;
15
+ toolName: string;
16
+ turn: VoiceTurnRecord;
17
+ }) => string | undefined;
18
+ idempotencyTtlMs?: number;
19
+ maxRetries?: number;
20
+ retryDelayMs?: VoiceToolRetryDelay;
21
+ timeoutMs?: number;
22
+ trace?: VoiceTraceEventStore;
23
+ };
24
+ export type VoiceToolRuntimeExecuteInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown> = {
25
+ api: VoiceSessionHandle<TContext, TSession, TRouteResult>;
26
+ args: TArgs;
27
+ context: TContext;
28
+ session: TSession;
29
+ tool: VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>;
30
+ toolCallId?: string;
31
+ turn: VoiceTurnRecord;
32
+ };
33
+ export type VoiceToolRuntimeResult<TToolResult = unknown> = VoiceAgentToolResult<TToolResult> & {
34
+ attempts: number;
35
+ elapsedMs: number;
36
+ idempotencyKey?: string;
37
+ timedOut: boolean;
38
+ };
39
+ export type VoiceToolRuntime<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown> = {
40
+ execute: <TArgs = Record<string, unknown>, TToolResult = unknown>(input: VoiceToolRuntimeExecuteInput<TContext, TSession, TArgs, TToolResult, TRouteResult>) => Promise<VoiceToolRuntimeResult<TToolResult>>;
41
+ wrapTool: <TArgs = Record<string, unknown>, TToolResult = unknown>(tool: VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>) => VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>;
42
+ };
43
+ export declare const createVoiceToolRuntime: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown>(options?: VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>) => VoiceToolRuntime<TContext, TSession, TRouteResult>;
44
+ export declare const createVoiceToolIdempotencyKey: (input: {
45
+ args: unknown;
46
+ sessionId: string;
47
+ toolCallId?: string;
48
+ toolName: string;
49
+ turnId: string;
50
+ }) => string;
package/dist/trace.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type VoiceTraceEventType = 'assistant.guardrail' | 'assistant.memory' | 'assistant.run' | 'agent.handoff' | 'agent.model' | 'agent.result' | 'agent.tool' | 'call.lifecycle' | 'session.error' | 'turn.assistant' | 'turn.committed' | 'turn.cost' | 'turn.transcript';
1
+ export type VoiceTraceEventType = 'assistant.guardrail' | 'assistant.memory' | 'assistant.run' | 'agent.handoff' | 'agent.model' | 'agent.result' | 'agent.tool' | 'call.handoff' | 'call.lifecycle' | 'client.barge_in' | 'client.live_latency' | 'session.error' | 'turn.assistant' | 'turn.committed' | 'turn.cost' | 'turn_latency.stage' | 'turn.transcript' | 'workflow.contract';
2
2
  export type VoiceTraceEvent<TPayload extends Record<string, unknown> = Record<string, unknown>> = {
3
3
  at: number;
4
4
  id?: string;
@@ -0,0 +1,93 @@
1
+ import { Elysia } from 'elysia';
2
+ import { evaluateVoiceTrace, type StoredVoiceTraceEvent, type VoiceTraceEvaluationOptions, type VoiceTraceEventStore, type VoiceTraceRedactionConfig, type VoiceTraceSummary } from './trace';
3
+ export type VoiceTraceTimelineEvent = {
4
+ at: number;
5
+ elapsedMs?: number;
6
+ id: string;
7
+ label: string;
8
+ offsetMs: number;
9
+ provider?: string;
10
+ status?: string;
11
+ turnId?: string;
12
+ type: StoredVoiceTraceEvent['type'];
13
+ };
14
+ export type VoiceTraceTimelineProviderSummary = {
15
+ averageElapsedMs?: number;
16
+ errorCount: number;
17
+ eventCount: number;
18
+ fallbackCount: number;
19
+ maxElapsedMs?: number;
20
+ provider: string;
21
+ successCount: number;
22
+ timeoutCount: number;
23
+ };
24
+ export type VoiceTraceTimelineSession = {
25
+ endedAt?: number;
26
+ evaluation: ReturnType<typeof evaluateVoiceTrace>;
27
+ events: VoiceTraceTimelineEvent[];
28
+ lastEventAt?: number;
29
+ providers: VoiceTraceTimelineProviderSummary[];
30
+ sessionId: string;
31
+ startedAt?: number;
32
+ status: 'failed' | 'healthy' | 'warning';
33
+ summary: VoiceTraceSummary;
34
+ };
35
+ export type VoiceTraceTimelineReport = {
36
+ checkedAt: number;
37
+ failed: number;
38
+ sessions: VoiceTraceTimelineSession[];
39
+ total: number;
40
+ warnings: number;
41
+ };
42
+ export type VoiceTraceTimelineRoutesOptions = {
43
+ evaluation?: VoiceTraceEvaluationOptions;
44
+ headers?: HeadersInit;
45
+ htmlPath?: string;
46
+ limit?: number;
47
+ name?: string;
48
+ path?: string;
49
+ redact?: VoiceTraceRedactionConfig;
50
+ render?: (report: VoiceTraceTimelineReport) => string | Promise<string>;
51
+ renderSession?: (session: VoiceTraceTimelineSession) => string | Promise<string>;
52
+ store: VoiceTraceEventStore;
53
+ title?: string;
54
+ };
55
+ export declare const summarizeVoiceTraceTimeline: (events: StoredVoiceTraceEvent[], options?: {
56
+ evaluation?: VoiceTraceEvaluationOptions;
57
+ limit?: number;
58
+ redact?: VoiceTraceRedactionConfig;
59
+ }) => VoiceTraceTimelineReport;
60
+ export declare const renderVoiceTraceTimelineSessionHTML: (session: VoiceTraceTimelineSession, options?: {
61
+ title?: string;
62
+ }) => string;
63
+ export declare const renderVoiceTraceTimelineHTML: (report: VoiceTraceTimelineReport, options?: {
64
+ title?: string;
65
+ }) => string;
66
+ export declare const createVoiceTraceTimelineRoutes: (options: VoiceTraceTimelineRoutesOptions) => Elysia<"", {
67
+ decorator: {};
68
+ store: {};
69
+ derive: {};
70
+ resolve: {};
71
+ }, {
72
+ typebox: {};
73
+ error: {};
74
+ }, {
75
+ schema: {};
76
+ standaloneSchema: {};
77
+ macro: {};
78
+ macroFn: {};
79
+ parser: {};
80
+ response: {};
81
+ }, {}, {
82
+ derive: {};
83
+ resolve: {};
84
+ schema: {};
85
+ standaloneSchema: {};
86
+ response: {};
87
+ }, {
88
+ derive: {};
89
+ resolve: {};
90
+ schema: {};
91
+ standaloneSchema: {};
92
+ response: {};
93
+ }>;
@@ -0,0 +1,95 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceTraceEventStore } from './trace';
3
+ import type { VoiceSessionRecord, VoiceSessionStore } from './types';
4
+ export type VoiceTurnLatencyStatus = 'pass' | 'warn' | 'fail' | 'empty';
5
+ export type VoiceTurnLatencyStage = {
6
+ label: string;
7
+ valueMs?: number;
8
+ };
9
+ export type VoiceTurnLatencyItem = {
10
+ assistantTextStartedAt?: number;
11
+ committedAt: number;
12
+ finalTranscriptAt?: number;
13
+ firstTranscriptAt?: number;
14
+ sessionId: string;
15
+ stages: VoiceTurnLatencyStage[];
16
+ status: VoiceTurnLatencyStatus;
17
+ text: string;
18
+ totalMs?: number;
19
+ turnId: string;
20
+ };
21
+ export type VoiceTurnLatencyReport = {
22
+ averageTotalMs?: number;
23
+ checkedAt: number;
24
+ failed: number;
25
+ sessions: number;
26
+ status: VoiceTurnLatencyStatus;
27
+ total: number;
28
+ turns: VoiceTurnLatencyItem[];
29
+ warnings: number;
30
+ };
31
+ export type VoiceTurnLatencyOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
32
+ limit?: number;
33
+ sessionIds?: string[];
34
+ sessions?: TSession[];
35
+ store?: VoiceSessionStore<TSession>;
36
+ traceStore?: VoiceTraceEventStore;
37
+ warnAfterMs?: number;
38
+ failAfterMs?: number;
39
+ };
40
+ export type VoiceTurnLatencyHTMLHandlerOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnLatencyOptions<TSession> & {
41
+ headers?: HeadersInit;
42
+ render?: (report: VoiceTurnLatencyReport) => string | Promise<string>;
43
+ title?: string;
44
+ };
45
+ export type VoiceTurnLatencyRoutesOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnLatencyHTMLHandlerOptions<TSession> & {
46
+ htmlPath?: false | string;
47
+ name?: string;
48
+ path?: string;
49
+ };
50
+ export declare const summarizeVoiceTurnLatency: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyOptions<TSession>) => Promise<VoiceTurnLatencyReport>;
51
+ export declare const renderVoiceTurnLatencyHTML: (report: VoiceTurnLatencyReport, options?: {
52
+ title?: string;
53
+ }) => string;
54
+ export declare const createVoiceTurnLatencyJSONHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyOptions<TSession>) => () => Promise<VoiceTurnLatencyReport>;
55
+ export declare const createVoiceTurnLatencyHTMLHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyHTMLHandlerOptions<TSession>) => () => Promise<Response>;
56
+ export declare const createVoiceTurnLatencyRoutes: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyRoutesOptions<TSession>) => Elysia<"", {
57
+ decorator: {};
58
+ store: {};
59
+ derive: {};
60
+ resolve: {};
61
+ }, {
62
+ typebox: {};
63
+ error: {};
64
+ }, {
65
+ schema: {};
66
+ standaloneSchema: {};
67
+ macro: {};
68
+ macroFn: {};
69
+ parser: {};
70
+ response: {};
71
+ }, {
72
+ [x: string]: {
73
+ get: {
74
+ body: unknown;
75
+ params: {};
76
+ query: unknown;
77
+ headers: unknown;
78
+ response: {
79
+ 200: VoiceTurnLatencyReport;
80
+ };
81
+ };
82
+ };
83
+ }, {
84
+ derive: {};
85
+ resolve: {};
86
+ schema: {};
87
+ standaloneSchema: {};
88
+ response: {};
89
+ }, {
90
+ derive: {};
91
+ resolve: {};
92
+ schema: {};
93
+ standaloneSchema: {};
94
+ response: {};
95
+ }>;
@@ -0,0 +1,94 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceSessionRecord, VoiceSessionStore, VoiceTranscriptQuality } from './types';
3
+ export type VoiceTurnQualityStatus = 'pass' | 'warn' | 'fail' | 'unknown';
4
+ export type VoiceTurnQualityItem = {
5
+ averageConfidence?: number;
6
+ committedAt: number;
7
+ correctionChanged: boolean;
8
+ correctionProvider?: string;
9
+ correctionReason?: string;
10
+ costUnits?: number;
11
+ fallbackSelectionReason?: string;
12
+ fallbackUsed: boolean;
13
+ finalTranscriptCount: number;
14
+ latencyMs?: number;
15
+ partialTranscriptCount: number;
16
+ selectedTranscriptCount: number;
17
+ sessionId: string;
18
+ source?: VoiceTranscriptQuality['source'];
19
+ status: VoiceTurnQualityStatus;
20
+ text: string;
21
+ turnId: string;
22
+ };
23
+ export type VoiceTurnQualityReport = {
24
+ checkedAt: number;
25
+ failed: number;
26
+ sessions: number;
27
+ status: VoiceTurnQualityStatus;
28
+ total: number;
29
+ turns: VoiceTurnQualityItem[];
30
+ warnings: number;
31
+ };
32
+ export type VoiceTurnQualityOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
33
+ confidenceWarnThreshold?: number;
34
+ limit?: number;
35
+ sessionIds?: string[];
36
+ sessions?: TSession[];
37
+ store?: VoiceSessionStore<TSession>;
38
+ };
39
+ export type VoiceTurnQualityHTMLHandlerOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnQualityOptions<TSession> & {
40
+ headers?: HeadersInit;
41
+ render?: (report: VoiceTurnQualityReport) => string | Promise<string>;
42
+ title?: string;
43
+ };
44
+ export type VoiceTurnQualityRoutesOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnQualityHTMLHandlerOptions<TSession> & {
45
+ htmlPath?: false | string;
46
+ name?: string;
47
+ path?: string;
48
+ };
49
+ export declare const summarizeVoiceTurnQuality: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityOptions<TSession>) => Promise<VoiceTurnQualityReport>;
50
+ export declare const renderVoiceTurnQualityHTML: (report: VoiceTurnQualityReport, options?: {
51
+ title?: string;
52
+ }) => string;
53
+ export declare const createVoiceTurnQualityJSONHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityOptions<TSession>) => () => Promise<VoiceTurnQualityReport>;
54
+ export declare const createVoiceTurnQualityHTMLHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityHTMLHandlerOptions<TSession>) => () => Promise<Response>;
55
+ export declare const createVoiceTurnQualityRoutes: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityRoutesOptions<TSession>) => Elysia<"", {
56
+ decorator: {};
57
+ store: {};
58
+ derive: {};
59
+ resolve: {};
60
+ }, {
61
+ typebox: {};
62
+ error: {};
63
+ }, {
64
+ schema: {};
65
+ standaloneSchema: {};
66
+ macro: {};
67
+ macroFn: {};
68
+ parser: {};
69
+ response: {};
70
+ }, {
71
+ [x: string]: {
72
+ get: {
73
+ body: unknown;
74
+ params: {};
75
+ query: unknown;
76
+ headers: unknown;
77
+ response: {
78
+ 200: VoiceTurnQualityReport;
79
+ };
80
+ };
81
+ };
82
+ }, {
83
+ derive: {};
84
+ resolve: {};
85
+ schema: {};
86
+ standaloneSchema: {};
87
+ response: {};
88
+ }, {
89
+ derive: {};
90
+ resolve: {};
91
+ schema: {};
92
+ standaloneSchema: {};
93
+ response: {};
94
+ }>;