@absolutejs/voice 0.0.22-beta.9 → 0.0.22-beta.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -0
- package/dist/agent.d.ts +2 -0
- package/dist/angular/index.d.ts +7 -0
- package/dist/angular/index.js +957 -43
- package/dist/angular/voice-app-kit-status.service.d.ts +12 -0
- package/dist/angular/voice-ops-status.component.d.ts +15 -0
- package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
- package/dist/angular/voice-provider-status.service.d.ts +12 -0
- package/dist/angular/voice-routing-status.service.d.ts +11 -0
- package/dist/angular/voice-stream.service.d.ts +2 -0
- package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
- package/dist/angular/voice-turn-quality.service.d.ts +12 -0
- package/dist/angular/voice-workflow-status.service.d.ts +12 -0
- package/dist/appKit.d.ts +98 -0
- package/dist/assistantHealth.d.ts +81 -0
- package/dist/client/actions.d.ts +22 -0
- package/dist/client/appKitStatus.d.ts +19 -0
- package/dist/client/connection.d.ts +3 -0
- package/dist/client/htmxBootstrap.js +44 -2
- package/dist/client/index.d.ts +30 -0
- package/dist/client/index.js +1463 -2
- package/dist/client/opsStatusWidget.d.ts +40 -0
- package/dist/client/providerCapabilities.d.ts +19 -0
- package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
- package/dist/client/providerSimulationControls.d.ts +33 -0
- package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
- package/dist/client/providerStatus.d.ts +19 -0
- package/dist/client/providerStatusWidget.d.ts +32 -0
- package/dist/client/routingStatus.d.ts +19 -0
- package/dist/client/routingStatusWidget.d.ts +28 -0
- package/dist/client/traceTimeline.d.ts +19 -0
- package/dist/client/traceTimelineWidget.d.ts +32 -0
- package/dist/client/turnQuality.d.ts +19 -0
- package/dist/client/turnQualityWidget.d.ts +32 -0
- package/dist/client/workflowStatus.d.ts +19 -0
- package/dist/diagnosticsRoutes.d.ts +44 -0
- package/dist/evalRoutes.d.ts +213 -0
- package/dist/handoff.d.ts +54 -0
- package/dist/handoffHealth.d.ts +94 -0
- package/dist/index.d.ts +62 -7
- package/dist/index.js +10382 -2574
- package/dist/modelAdapters.d.ts +75 -0
- package/dist/openaiTTS.d.ts +18 -0
- package/dist/opsConsoleRoutes.d.ts +77 -0
- package/dist/opsWebhook.d.ts +126 -0
- package/dist/outcomeContract.d.ts +112 -0
- package/dist/postgresStore.d.ts +2 -0
- package/dist/productionReadiness.d.ts +111 -0
- package/dist/providerAdapters.d.ts +48 -0
- package/dist/providerCapabilities.d.ts +92 -0
- package/dist/providerHealth.d.ts +79 -0
- package/dist/qualityRoutes.d.ts +76 -0
- package/dist/queue.d.ts +61 -0
- package/dist/react/VoiceOpsStatus.d.ts +6 -0
- package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
- package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
- package/dist/react/VoiceProviderStatus.d.ts +6 -0
- package/dist/react/VoiceRoutingStatus.d.ts +6 -0
- package/dist/react/VoiceTraceTimeline.d.ts +6 -0
- package/dist/react/VoiceTurnQuality.d.ts +6 -0
- package/dist/react/index.d.ts +15 -0
- package/dist/react/index.js +2150 -11
- package/dist/react/useVoiceAppKitStatus.d.ts +8 -0
- package/dist/react/useVoiceController.d.ts +2 -0
- package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
- package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
- package/dist/react/useVoiceProviderStatus.d.ts +8 -0
- package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/react/useVoiceStream.d.ts +2 -0
- package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
- package/dist/react/useVoiceTurnQuality.d.ts +8 -0
- package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
- package/dist/resilienceRoutes.d.ts +142 -0
- package/dist/sessionReplay.d.ts +175 -0
- package/dist/sqliteStore.d.ts +2 -0
- package/dist/svelte/createVoiceAppKitStatus.d.ts +8 -0
- package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
- package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
- package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +10 -0
- package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
- package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
- package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +9 -0
- package/dist/svelte/index.js +1508 -3
- package/dist/telephony/contract.d.ts +61 -0
- package/dist/telephony/matrix.d.ts +97 -0
- package/dist/telephony/plivo.d.ts +254 -0
- package/dist/telephony/telnyx.d.ts +247 -0
- package/dist/telephony/twilio.d.ts +132 -0
- package/dist/telephonyOutcome.d.ts +201 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +2543 -14
- package/dist/testing/ioProviderSimulator.d.ts +41 -0
- package/dist/testing/providerSimulator.d.ts +44 -0
- package/dist/toolContract.d.ts +130 -0
- package/dist/toolRuntime.d.ts +50 -0
- package/dist/trace.d.ts +1 -1
- package/dist/traceTimeline.d.ts +93 -0
- package/dist/turnQuality.d.ts +94 -0
- package/dist/types.d.ts +84 -2
- package/dist/vue/VoiceOpsStatus.d.ts +30 -0
- package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
- package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
- package/dist/vue/VoiceProviderStatus.d.ts +51 -0
- package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
- package/dist/vue/VoiceTurnQuality.d.ts +51 -0
- package/dist/vue/index.d.ts +14 -0
- package/dist/vue/index.js +2047 -25
- package/dist/vue/useVoiceAppKitStatus.d.ts +9 -0
- package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
- package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
- package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/vue/useVoiceStream.d.ts +2 -0
- package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
- package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
- package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
- package/dist/workflowContract.d.ts +91 -0
- 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> = {
|
package/dist/angular/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
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 { VoiceTraceTimelineService } from './voice-trace-timeline.service';
|
|
8
|
+
export { VoiceTurnQualityService } from './voice-turn-quality.service';
|
|
9
|
+
export { VoiceWorkflowStatusService } from './voice-workflow-status.service';
|