@absolutejs/voice 0.0.22-beta.9 → 0.0.22-beta.90

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 (114) hide show
  1. package/README.md +205 -0
  2. package/dist/agent.d.ts +2 -0
  3. package/dist/angular/index.d.ts +6 -0
  4. package/dist/angular/index.js +833 -43
  5. package/dist/angular/voice-app-kit-status.service.d.ts +12 -0
  6. package/dist/angular/voice-ops-status.component.d.ts +15 -0
  7. package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
  8. package/dist/angular/voice-provider-status.service.d.ts +12 -0
  9. package/dist/angular/voice-routing-status.service.d.ts +11 -0
  10. package/dist/angular/voice-stream.service.d.ts +2 -0
  11. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  12. package/dist/angular/voice-workflow-status.service.d.ts +12 -0
  13. package/dist/appKit.d.ts +98 -0
  14. package/dist/assistantHealth.d.ts +81 -0
  15. package/dist/client/actions.d.ts +22 -0
  16. package/dist/client/appKitStatus.d.ts +19 -0
  17. package/dist/client/connection.d.ts +3 -0
  18. package/dist/client/htmxBootstrap.js +44 -2
  19. package/dist/client/index.d.ts +26 -0
  20. package/dist/client/index.js +1290 -2
  21. package/dist/client/opsStatusWidget.d.ts +40 -0
  22. package/dist/client/providerCapabilities.d.ts +19 -0
  23. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  24. package/dist/client/providerSimulationControls.d.ts +33 -0
  25. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  26. package/dist/client/providerStatus.d.ts +19 -0
  27. package/dist/client/providerStatusWidget.d.ts +32 -0
  28. package/dist/client/routingStatus.d.ts +19 -0
  29. package/dist/client/routingStatusWidget.d.ts +28 -0
  30. package/dist/client/turnQuality.d.ts +19 -0
  31. package/dist/client/turnQualityWidget.d.ts +32 -0
  32. package/dist/client/workflowStatus.d.ts +19 -0
  33. package/dist/diagnosticsRoutes.d.ts +44 -0
  34. package/dist/evalRoutes.d.ts +213 -0
  35. package/dist/handoff.d.ts +54 -0
  36. package/dist/handoffHealth.d.ts +94 -0
  37. package/dist/index.d.ts +62 -7
  38. package/dist/index.js +10382 -2574
  39. package/dist/modelAdapters.d.ts +75 -0
  40. package/dist/openaiTTS.d.ts +18 -0
  41. package/dist/opsConsoleRoutes.d.ts +77 -0
  42. package/dist/opsWebhook.d.ts +126 -0
  43. package/dist/outcomeContract.d.ts +112 -0
  44. package/dist/postgresStore.d.ts +2 -0
  45. package/dist/productionReadiness.d.ts +111 -0
  46. package/dist/providerAdapters.d.ts +48 -0
  47. package/dist/providerCapabilities.d.ts +92 -0
  48. package/dist/providerHealth.d.ts +79 -0
  49. package/dist/qualityRoutes.d.ts +76 -0
  50. package/dist/queue.d.ts +61 -0
  51. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  52. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  53. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  54. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  55. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  56. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  57. package/dist/react/index.d.ts +13 -0
  58. package/dist/react/index.js +1884 -11
  59. package/dist/react/useVoiceAppKitStatus.d.ts +8 -0
  60. package/dist/react/useVoiceController.d.ts +2 -0
  61. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  62. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  63. package/dist/react/useVoiceProviderStatus.d.ts +8 -0
  64. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  65. package/dist/react/useVoiceStream.d.ts +2 -0
  66. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  67. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  68. package/dist/resilienceRoutes.d.ts +142 -0
  69. package/dist/sessionReplay.d.ts +175 -0
  70. package/dist/sqliteStore.d.ts +2 -0
  71. package/dist/svelte/createVoiceAppKitStatus.d.ts +8 -0
  72. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  73. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  74. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  75. package/dist/svelte/createVoiceProviderStatus.d.ts +10 -0
  76. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  77. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  78. package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
  79. package/dist/svelte/index.d.ts +8 -0
  80. package/dist/svelte/index.js +1330 -3
  81. package/dist/telephony/contract.d.ts +61 -0
  82. package/dist/telephony/matrix.d.ts +97 -0
  83. package/dist/telephony/plivo.d.ts +254 -0
  84. package/dist/telephony/telnyx.d.ts +247 -0
  85. package/dist/telephony/twilio.d.ts +132 -0
  86. package/dist/telephonyOutcome.d.ts +201 -0
  87. package/dist/testing/index.d.ts +2 -0
  88. package/dist/testing/index.js +2543 -14
  89. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  90. package/dist/testing/providerSimulator.d.ts +44 -0
  91. package/dist/toolContract.d.ts +130 -0
  92. package/dist/toolRuntime.d.ts +50 -0
  93. package/dist/trace.d.ts +1 -1
  94. package/dist/traceTimeline.d.ts +93 -0
  95. package/dist/turnQuality.d.ts +94 -0
  96. package/dist/types.d.ts +84 -2
  97. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  98. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  99. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  100. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  101. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  102. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  103. package/dist/vue/index.d.ts +13 -0
  104. package/dist/vue/index.js +1934 -25
  105. package/dist/vue/useVoiceAppKitStatus.d.ts +9 -0
  106. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  107. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  108. package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
  109. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  110. package/dist/vue/useVoiceStream.d.ts +2 -0
  111. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  112. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  113. package/dist/workflowContract.d.ts +91 -0
  114. package/package.json +1 -1
package/README.md CHANGED
@@ -73,6 +73,115 @@ const app = new Elysia()
73
73
 
74
74
  `createVoiceMemoryStore()` is dev-only. Real deployments should provide a shared store backed by Redis, Postgres, or equivalent.
75
75
 
76
+ ## App Kit And Status Widgets
77
+
78
+ Use `createVoiceAppKitRoutes(...)` when you want a self-hosted operations surface without hand-wiring every dashboard route. It adds the ops console, quality gates, eval routes, provider health, session replay, handoff health, diagnostics, and `GET /app-kit/status`.
79
+
80
+ ```ts
81
+ import { createVoiceAppKitRoutes, createVoiceFileRuntimeStorage } from '@absolutejs/voice';
82
+
83
+ const runtime = createVoiceFileRuntimeStorage({ directory: '.voice-runtime/support' });
84
+
85
+ app.use(
86
+ createVoiceAppKitRoutes({
87
+ store: runtime.traces,
88
+ llmProviders: ['openai', 'anthropic', 'gemini'],
89
+ sttProviders: ['deepgram', 'assemblyai']
90
+ }).routes
91
+ );
92
+ ```
93
+
94
+ The status endpoint is intentionally small enough for customer-facing demos. It can report fixture-backed workflow readiness while leaving deeper live quality/session failures visible on the ops pages.
95
+
96
+ ```ts
97
+ app.use(
98
+ createVoiceAppKitRoutes({
99
+ appStatus: {
100
+ include: { quality: false, sessions: false },
101
+ preferFixtureWorkflows: true
102
+ },
103
+ evals: { fixtures: certificationFixtures, scenarios: workflowScenarios },
104
+ store: runtime.traces
105
+ }).routes
106
+ );
107
+ ```
108
+
109
+ ### React Status Widget
110
+
111
+ ```tsx
112
+ import { VoiceOpsStatus } from '@absolutejs/voice/react';
113
+
114
+ export function OpsBadge() {
115
+ return <VoiceOpsStatus intervalMs={5000} />;
116
+ }
117
+ ```
118
+
119
+ ### Vue Status Widget
120
+
121
+ ```vue
122
+ <script setup lang="ts">
123
+ import { VoiceOpsStatus } from '@absolutejs/voice/vue';
124
+ </script>
125
+
126
+ <template>
127
+ <VoiceOpsStatus :interval-ms="5000" />
128
+ </template>
129
+ ```
130
+
131
+ ### Svelte Status Widget
132
+
133
+ ```svelte
134
+ <script lang="ts">
135
+ import { onDestroy, onMount } from 'svelte';
136
+ import { createVoiceOpsStatus } from '@absolutejs/voice/svelte';
137
+
138
+ const status = createVoiceOpsStatus('/app-kit/status', { intervalMs: 5000 });
139
+ let html = '';
140
+ onMount(() => status.subscribe(() => (html = status.getHTML())));
141
+ onDestroy(() => status.close());
142
+ </script>
143
+
144
+ {@html html}
145
+ ```
146
+
147
+ ### Angular Status Widget
148
+
149
+ ```ts
150
+ import { VoiceAppKitStatusService } from '@absolutejs/voice/angular';
151
+
152
+ status = inject(VoiceAppKitStatusService).connect('/app-kit/status', {
153
+ intervalMs: 5000
154
+ });
155
+ ```
156
+
157
+ ```html
158
+ <h2>{{ status.report()?.status === 'pass' ? 'Passing' : 'Needs attention' }}</h2>
159
+ <p>{{ status.report()?.passed ?? 0 }} passing checks</p>
160
+ ```
161
+
162
+ ### HTML Or HTMX Status Widget
163
+
164
+ ```html
165
+ <div id="voice-ops-status"></div>
166
+ <script type="module">
167
+ import { mountVoiceOpsStatus } from '@absolutejs/voice/client';
168
+
169
+ mountVoiceOpsStatus(document.querySelector('#voice-ops-status'), '/app-kit/status', {
170
+ intervalMs: 5000
171
+ });
172
+ </script>
173
+ ```
174
+
175
+ For custom elements:
176
+
177
+ ```html
178
+ <absolute-voice-ops-status interval-ms="5000"></absolute-voice-ops-status>
179
+ <script type="module">
180
+ import { defineVoiceOpsStatusElement } from '@absolutejs/voice/client';
181
+ defineVoiceOpsStatusElement();
182
+ </script>
183
+ ```
184
+
76
185
  ## Voice Assistants
77
186
 
78
187
  Use `createVoiceAssistant(...)` when you want one product-level surface for a voice agent instead of wiring tools, guardrails, experiments, traces, and ops recipes separately. It returns a standard `onTurn` handler, plus an `ops` object you can pass to `voice(...)`.
@@ -1069,6 +1178,102 @@ app.use(
1069
1178
  - `benchmark-results/sessions-cheap-stt-runs-3.json`
1070
1179
  - `benchmark-results/stt-routing-run-manifest.json`
1071
1180
 
1181
+ ## LLM Provider Routing
1182
+
1183
+ Use `createVoiceProviderRouter(...)` when your assistant can run on more than one LLM provider. The router keeps provider choice inside your app: you define the available model adapters, profile each provider, and choose a policy.
1184
+
1185
+ ```ts
1186
+ import {
1187
+ createAnthropicVoiceAssistantModel,
1188
+ createGeminiVoiceAssistantModel,
1189
+ createOpenAIVoiceAssistantModel,
1190
+ createVoiceProviderRouter,
1191
+ resolveVoiceProviderRoutingPolicyPreset
1192
+ } from '@absolutejs/voice';
1193
+
1194
+ const model = createVoiceProviderRouter({
1195
+ providers: {
1196
+ openai: createOpenAIVoiceAssistantModel({ apiKey: process.env.OPENAI_API_KEY! }),
1197
+ anthropic: createAnthropicVoiceAssistantModel({ apiKey: process.env.ANTHROPIC_API_KEY! }),
1198
+ gemini: createGeminiVoiceAssistantModel({ apiKey: process.env.GEMINI_API_KEY! })
1199
+ },
1200
+ providerHealth: {
1201
+ failureThreshold: 1,
1202
+ cooldownMs: 30_000,
1203
+ rateLimitCooldownMs: 120_000
1204
+ },
1205
+ providerProfiles: {
1206
+ openai: { cost: 6, latencyMs: 650, quality: 0.92, timeoutMs: 3500 },
1207
+ anthropic: { cost: 7, latencyMs: 850, quality: 0.95, timeoutMs: 4500 },
1208
+ gemini: { cost: 2, latencyMs: 700, quality: 0.86, timeoutMs: 3500 }
1209
+ },
1210
+ policy: resolveVoiceProviderRoutingPolicyPreset('balanced')
1211
+ });
1212
+ ```
1213
+
1214
+ Built-in policy presets:
1215
+
1216
+ - `quality-first`: rank by `providerProfiles[provider].quality`, then priority, latency, and cost.
1217
+ - `latency-first`: rank by expected latency.
1218
+ - `cost-first`: rank by expected cost.
1219
+ - `cost-cap`: rank by cost and reject providers above `maxCost`.
1220
+ - `balanced`: weighted score using cost, latency, quality, and priority.
1221
+
1222
+ Budget filters are strict. If you pass `maxCost`, `maxLatencyMs`, or `minQuality`, providers outside those limits are removed before ranking, even if they were selected by the request.
1223
+
1224
+ ```ts
1225
+ const policy = resolveVoiceProviderRoutingPolicyPreset('cost-cap', {
1226
+ maxCost: 3,
1227
+ minQuality: 0.82
1228
+ });
1229
+ ```
1230
+
1231
+ For full control, pass an object policy:
1232
+
1233
+ ```ts
1234
+ const model = createVoiceProviderRouter({
1235
+ providers,
1236
+ providerProfiles,
1237
+ policy: {
1238
+ strategy: 'balanced',
1239
+ maxLatencyMs: 1000,
1240
+ weights: { cost: 1, latencyMs: 0.004, quality: 12 }
1241
+ }
1242
+ });
1243
+ ```
1244
+
1245
+ The same profile and policy shape also works for STT and TTS provider routers, so a self-hosted app can choose the fastest provider for live calls, cap cost for background work, or require a minimum quality score without hard-coding provider branches.
1246
+
1247
+ ```ts
1248
+ const stt = createVoiceSTTProviderRouter({
1249
+ adapters: {
1250
+ deepgram,
1251
+ assemblyai
1252
+ },
1253
+ providerHealth: { cooldownMs: 30_000 },
1254
+ providerProfiles: {
1255
+ deepgram: { cost: 4, latencyMs: 180, quality: 0.93, timeoutMs: 1500 },
1256
+ assemblyai: { cost: 2, latencyMs: 650, quality: 0.88, timeoutMs: 3000 }
1257
+ },
1258
+ policy: resolveVoiceProviderRoutingPolicyPreset('latency-first')
1259
+ });
1260
+
1261
+ const tts = createVoiceTTSProviderRouter({
1262
+ adapters: {
1263
+ elevenlabs,
1264
+ openai
1265
+ },
1266
+ providerProfiles: {
1267
+ elevenlabs: { cost: 5, latencyMs: 220, quality: 0.94 },
1268
+ openai: { cost: 2, latencyMs: 320, quality: 0.87 }
1269
+ },
1270
+ policy: resolveVoiceProviderRoutingPolicyPreset('cost-cap', {
1271
+ maxCost: 3,
1272
+ minQuality: 0.85
1273
+ })
1274
+ });
1275
+ ```
1276
+
1072
1277
  ## Presets
1073
1278
 
1074
1279
  Voice now ships named runtime presets so apps can start from a useful baseline instead of hand-tuning silence and capture settings every time.
package/dist/agent.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { VoiceOnTurnObjectHandler, VoiceRouteResult, VoiceSessionHandle, VoiceSessionRecord, VoiceTurnRecord } from './types';
2
2
  import type { VoiceTraceEventStore } from './trace';
3
+ import type { VoiceToolRuntime } from './toolRuntime';
3
4
  export type VoiceAgentMessageRole = 'assistant' | 'system' | 'tool' | 'user';
4
5
  export type VoiceAgentMessage = {
5
6
  content: string;
@@ -86,6 +87,7 @@ export type VoiceAgentOptions<TContext = unknown, TSession extends VoiceSessionR
86
87
  turn: VoiceTurnRecord;
87
88
  }) => Promise<string | undefined> | string | undefined);
88
89
  trace?: VoiceTraceEventStore;
90
+ toolRuntime?: VoiceToolRuntime<TContext, TSession, TResult>;
89
91
  tools?: Array<VoiceAgentTool<TContext, TSession, Record<string, unknown>, unknown, TResult>>;
90
92
  };
91
93
  export type VoiceAgentSquadOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
@@ -1,2 +1,8 @@
1
+ export { VoiceAppKitStatusService } from './voice-app-kit-status.service';
1
2
  export { VoiceStreamService } from './voice-stream.service';
2
3
  export { VoiceControllerService } from './voice-controller.service';
4
+ export { VoiceProviderCapabilitiesService } from './voice-provider-capabilities.service';
5
+ export { VoiceProviderStatusService } from './voice-provider-status.service';
6
+ export { VoiceRoutingStatusService } from './voice-routing-status.service';
7
+ export { VoiceTurnQualityService } from './voice-turn-quality.service';
8
+ export { VoiceWorkflowStatusService } from './voice-workflow-status.service';