@absolutejs/voice 0.0.22-beta.103 → 0.0.22-beta.105
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 +171 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5371 -5268
- package/dist/phoneAgent.d.ts +41 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,48 @@
|
|
|
1
1
|
# `@absolutejs/voice`
|
|
2
2
|
|
|
3
|
-
`@absolutejs/voice` is the voice
|
|
3
|
+
`@absolutejs/voice` is the self-hosted voice operations layer for AbsoluteJS.
|
|
4
|
+
|
|
5
|
+
It gives your app the primitives hosted voice platforms usually keep behind their dashboards: browser voice sessions, phone-call routes, provider routing, assistant tools, handoffs, traces, evals, production-readiness checks, latency proof, storage adapters, and framework-native UI helpers.
|
|
6
|
+
|
|
7
|
+
Use it when you want Vapi/Retell/Bland-style voice-agent capability, but you want the orchestration, data, traces, storage, and UI to live inside the AbsoluteJS server you already operate.
|
|
8
|
+
|
|
9
|
+
## Why AbsoluteJS Voice
|
|
10
|
+
|
|
11
|
+
- Self-hosted by default: your app owns sessions, traces, reviews, tasks, handoffs, retention, and provider keys.
|
|
12
|
+
- Provider-neutral: use Deepgram, AssemblyAI, OpenAI, Anthropic, Gemini, ElevenLabs-style TTS, or your own adapters without rewriting app workflow code.
|
|
13
|
+
- Browser and phone surfaces: mount browser WebSocket voice routes plus Twilio, Telnyx, and Plivo telephony routes from the same package.
|
|
14
|
+
- Production proof: App Kit, production readiness, turn quality, turn latency, live browser p50/p95 latency, trace timelines, evals, fixtures, and contracts are package primitives.
|
|
15
|
+
- Framework parity: React, Vue, Svelte, Angular, HTML, HTMX, and plain client entrypoints share the same core behavior.
|
|
16
|
+
- No hosted platform tax: AbsoluteJS Voice does not add a mandatory per-minute orchestration fee between your app and your providers.
|
|
17
|
+
|
|
18
|
+
## Start Here
|
|
19
|
+
|
|
20
|
+
Pick the path that matches what you are building:
|
|
21
|
+
|
|
22
|
+
- Browser voice agent: mount `voice(...)`, choose an STT adapter, and use the React/Vue/Svelte/Angular/HTML/HTMX client helpers for mic, transcript, reconnect, and status UI.
|
|
23
|
+
- Phone voice agent: mount Twilio, Telnyx, or Plivo routes, normalize carrier outcomes, inspect carrier readiness, and persist call lifecycle traces.
|
|
24
|
+
- Production readiness: mount `createVoiceAppKitRoutes(...)` to get ops console/status, quality, evals, provider health, sessions, handoffs, diagnostics, and readiness gates.
|
|
25
|
+
- Provider routing and fallback: use LLM/STT/TTS provider routers, provider health, provider simulation controls, and cost/latency-aware routing policies.
|
|
26
|
+
- Evals and simulation: run scenario fixtures, workflow contracts, tool contracts, outcome contracts, baseline comparisons, and saved benchmark artifacts before live traffic.
|
|
27
|
+
|
|
28
|
+
## How This Differs From Hosted Voice Platforms
|
|
29
|
+
|
|
30
|
+
Hosted voice-agent platforms are strongest when you want a managed dashboard, phone-number provisioning, hosted orchestration, and campaign tooling out of the box.
|
|
31
|
+
|
|
32
|
+
AbsoluteJS Voice is strongest when voice is part of your own product and you need code-owned primitives:
|
|
33
|
+
|
|
34
|
+
- Your app stores the call data instead of a vendor dashboard being the source of truth.
|
|
35
|
+
- Your app controls provider routing, fallback, retries, handoffs, and retention.
|
|
36
|
+
- Your team can inspect and extend every primitive.
|
|
37
|
+
- Your framework UI can render first-class voice state without iframe/dashboard handoffs.
|
|
38
|
+
- Your production checks and evals can run in CI, smoke tests, or your own admin UI.
|
|
39
|
+
|
|
40
|
+
The goal is not to clone a hosted platform. The goal is to make AbsoluteJS the best place to build and operate self-hosted voice products.
|
|
4
41
|
|
|
5
42
|
## Install
|
|
6
43
|
|
|
7
44
|
```bash
|
|
8
|
-
bun add @absolutejs/voice
|
|
45
|
+
bun add @absolutejs/voice @absolutejs/voice-deepgram
|
|
9
46
|
```
|
|
10
47
|
|
|
11
48
|
Peer dependencies:
|
|
@@ -21,7 +58,12 @@ Optional framework entrypoints:
|
|
|
21
58
|
- `@absolutejs/voice/angular`
|
|
22
59
|
- `@absolutejs/voice/client`
|
|
23
60
|
|
|
24
|
-
|
|
61
|
+
Common optional adapters:
|
|
62
|
+
|
|
63
|
+
- `@absolutejs/voice-deepgram`
|
|
64
|
+
- `@absolutejs/voice-assemblyai`
|
|
65
|
+
|
|
66
|
+
## Browser Voice Agent
|
|
25
67
|
|
|
26
68
|
```ts
|
|
27
69
|
import { Elysia } from 'elysia';
|
|
@@ -73,6 +115,132 @@ const app = new Elysia()
|
|
|
73
115
|
|
|
74
116
|
`createVoiceMemoryStore()` is dev-only. Real deployments should provide a shared store backed by Redis, Postgres, or equivalent.
|
|
75
117
|
|
|
118
|
+
## Production Readiness Path
|
|
119
|
+
|
|
120
|
+
Once the basic route works, mount the App Kit. This gives you the self-hosted operational surface that hosted platforms usually make mandatory:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import {
|
|
124
|
+
createVoiceAppKitRoutes,
|
|
125
|
+
createVoiceFileRuntimeStorage,
|
|
126
|
+
createVoiceLiveLatencyRoutes,
|
|
127
|
+
createVoiceProductionReadinessRoutes,
|
|
128
|
+
createVoiceTraceTimelineRoutes,
|
|
129
|
+
createVoiceTurnLatencyRoutes,
|
|
130
|
+
createVoiceTurnQualityRoutes
|
|
131
|
+
} from '@absolutejs/voice';
|
|
132
|
+
|
|
133
|
+
const runtime = createVoiceFileRuntimeStorage({
|
|
134
|
+
directory: '.voice-runtime/support'
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
app
|
|
138
|
+
.use(
|
|
139
|
+
createVoiceAppKitRoutes({
|
|
140
|
+
store: runtime.traces,
|
|
141
|
+
llmProviders: ['openai', 'anthropic', 'gemini'],
|
|
142
|
+
sttProviders: ['deepgram', 'assemblyai']
|
|
143
|
+
}).routes
|
|
144
|
+
)
|
|
145
|
+
.use(
|
|
146
|
+
createVoiceTurnLatencyRoutes({
|
|
147
|
+
htmlPath: '/turn-latency',
|
|
148
|
+
path: '/api/turn-latency',
|
|
149
|
+
store: runtime.session,
|
|
150
|
+
traceStore: runtime.traces
|
|
151
|
+
})
|
|
152
|
+
)
|
|
153
|
+
.use(
|
|
154
|
+
createVoiceLiveLatencyRoutes({
|
|
155
|
+
htmlPath: '/live-latency',
|
|
156
|
+
path: '/api/live-latency',
|
|
157
|
+
store: runtime.traces
|
|
158
|
+
})
|
|
159
|
+
)
|
|
160
|
+
.use(
|
|
161
|
+
createVoiceTurnQualityRoutes({
|
|
162
|
+
htmlPath: '/turn-quality',
|
|
163
|
+
path: '/api/turn-quality',
|
|
164
|
+
store: runtime.session
|
|
165
|
+
})
|
|
166
|
+
)
|
|
167
|
+
.use(
|
|
168
|
+
createVoiceTraceTimelineRoutes({
|
|
169
|
+
htmlPath: '/traces',
|
|
170
|
+
path: '/api/voice-traces',
|
|
171
|
+
store: runtime.traces
|
|
172
|
+
})
|
|
173
|
+
)
|
|
174
|
+
.use(
|
|
175
|
+
createVoiceProductionReadinessRoutes({
|
|
176
|
+
htmlPath: '/production-readiness',
|
|
177
|
+
path: '/api/production-readiness',
|
|
178
|
+
store: runtime.traces
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Recommended proof routes:
|
|
184
|
+
|
|
185
|
+
- `/app-kit/status`: compact customer-facing app status.
|
|
186
|
+
- `/production-readiness`: production gate summary.
|
|
187
|
+
- `/traces`: per-session trace timelines.
|
|
188
|
+
- `/turn-latency`: server-side turn-stage latency.
|
|
189
|
+
- `/live-latency`: browser-measured speech-to-assistant p50/p95 latency.
|
|
190
|
+
- `/turn-quality`: STT confidence, correction, fallback, and transcript diagnostics.
|
|
191
|
+
|
|
192
|
+
## Phone Voice Agent Path
|
|
193
|
+
|
|
194
|
+
Use the telephony primitives when the agent needs to answer or place calls through your own carrier account:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import {
|
|
198
|
+
createVoicePhoneAgent,
|
|
199
|
+
createVoiceTelephonyOutcomePolicy
|
|
200
|
+
} from '@absolutejs/voice';
|
|
201
|
+
import { deepgram } from '@absolutejs/voice-deepgram';
|
|
202
|
+
|
|
203
|
+
const outcomePolicy = createVoiceTelephonyOutcomePolicy({
|
|
204
|
+
transferTarget: '+15551234567'
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
app
|
|
208
|
+
.use(
|
|
209
|
+
createVoicePhoneAgent({
|
|
210
|
+
matrix: {
|
|
211
|
+
path: '/api/carriers',
|
|
212
|
+
title: 'AbsoluteJS Voice Carrier Matrix'
|
|
213
|
+
},
|
|
214
|
+
carriers: [
|
|
215
|
+
{
|
|
216
|
+
provider: 'twilio',
|
|
217
|
+
options: {
|
|
218
|
+
context: {},
|
|
219
|
+
outcomePolicy,
|
|
220
|
+
session: runtime.session,
|
|
221
|
+
stt: deepgram({ apiKey: process.env.DEEPGRAM_API_KEY! }),
|
|
222
|
+
streamPath: '/api/voice/twilio/stream',
|
|
223
|
+
twiml: {
|
|
224
|
+
path: '/api/voice/twilio',
|
|
225
|
+
streamUrl: process.env.TWILIO_STREAM_URL
|
|
226
|
+
},
|
|
227
|
+
webhook: {
|
|
228
|
+
path: '/api/voice/twilio/webhook',
|
|
229
|
+
signingSecret: process.env.TWILIO_AUTH_TOKEN
|
|
230
|
+
},
|
|
231
|
+
async onTurn({ turn }) {
|
|
232
|
+
return { assistantText: `I heard: ${turn.text}` };
|
|
233
|
+
},
|
|
234
|
+
onComplete: async () => {}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
}).routes
|
|
239
|
+
);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The wrapper mounts selected carrier routes and a readiness matrix. Telnyx and Plivo use the same wrapper with `{ provider: 'telnyx', options: ... }` or `{ provider: 'plivo', options: ... }`. The lower-level `createTwilioVoiceRoutes(...)`, `createTelnyxVoiceRoutes(...)`, and `createPlivoVoiceRoutes(...)` helpers remain available when you need carrier-specific control.
|
|
243
|
+
|
|
76
244
|
## App Kit And Status Widgets
|
|
77
245
|
|
|
78
246
|
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`.
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { createVoiceLiveLatencyRoutes, renderVoiceLiveLatencyHTML, summarizeVoic
|
|
|
15
15
|
export { createVoiceTurnQualityHTMLHandler, createVoiceTurnQualityJSONHandler, createVoiceTurnQualityRoutes, renderVoiceTurnQualityHTML, summarizeVoiceTurnQuality } from './turnQuality';
|
|
16
16
|
export { createVoiceOutcomeContractHTMLHandler, createVoiceOutcomeContractJSONHandler, createVoiceOutcomeContractRoutes, renderVoiceOutcomeContractHTML, runVoiceOutcomeContractSuite } from './outcomeContract';
|
|
17
17
|
export { applyVoiceTelephonyOutcome, createMemoryVoiceTelephonyWebhookIdempotencyStore, createVoiceTelephonyOutcomePolicy, createVoiceTelephonyWebhookHandler, createVoiceTelephonyWebhookRoutes, parseVoiceTelephonyWebhookEvent, resolveVoiceTelephonyOutcome, signVoiceTwilioWebhook, verifyVoiceTwilioWebhookSignature, voiceTelephonyOutcomeToRouteResult } from './telephonyOutcome';
|
|
18
|
+
export { createVoicePhoneAgent } from './phoneAgent';
|
|
18
19
|
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
|
|
19
20
|
export { createVoiceAssistantMemoryHandle, createVoiceAssistantMemoryRecord, createVoiceMemoryAssistantMemoryStore, resolveVoiceAssistantMemoryNamespace } from './assistantMemory';
|
|
20
21
|
export { createAnthropicVoiceAssistantModel, createGeminiVoiceAssistantModel, createJSONVoiceAssistantModel, createOpenAIVoiceAssistantModel, resolveVoiceProviderRoutingPolicyPreset, createVoiceProviderRouter } from './modelAdapters';
|
|
@@ -68,6 +69,7 @@ export type { VoiceLiveLatencyOptions, VoiceLiveLatencyReport, VoiceLiveLatencyR
|
|
|
68
69
|
export type { VoiceTurnQualityHTMLHandlerOptions, VoiceTurnQualityItem, VoiceTurnQualityOptions, VoiceTurnQualityReport, VoiceTurnQualityRoutesOptions, VoiceTurnQualityStatus } from './turnQuality';
|
|
69
70
|
export type { VoiceOutcomeContractDefinition, VoiceOutcomeContractHTMLHandlerOptions, VoiceOutcomeContractIssue, VoiceOutcomeContractOptions, VoiceOutcomeContractReport, VoiceOutcomeContractRoutesOptions, VoiceOutcomeContractStatus, VoiceOutcomeContractSuiteReport } from './outcomeContract';
|
|
70
71
|
export type { VoiceTelephonyOutcomeAction, VoiceTelephonyOutcomeDecision, VoiceTelephonyOutcomePolicy, VoiceTelephonyOutcomeProviderEvent, VoiceTelephonyOutcomeRouteResult, VoiceTelephonyOutcomeStatusDecision, VoiceTelephonyWebhookDecision, VoiceTelephonyWebhookHandlerOptions, VoiceTelephonyWebhookIdempotencyStore, VoiceTelephonyWebhookParseInput, VoiceTelephonyWebhookProvider, VoiceTelephonyWebhookRoutesOptions, VoiceTelephonyWebhookVerificationResult, StoredVoiceTelephonyWebhookDecision } from './telephonyOutcome';
|
|
72
|
+
export type { VoicePhoneAgentCarrier, VoicePhoneAgentPlivoCarrier, VoicePhoneAgentRoutes, VoicePhoneAgentRoutesOptions, VoicePhoneAgentTelnyxCarrier, VoicePhoneAgentTwilioCarrier } from './phoneAgent';
|
|
71
73
|
export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesOptions } from './opsConsoleRoutes';
|
|
72
74
|
export type { VoiceProductionReadinessAction, VoiceProductionReadinessCheck, VoiceProductionReadinessReport, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessStatus } from './productionReadiness';
|
|
73
75
|
export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQualityRoutesOptions, VoiceQualityStatus, VoiceQualityThresholds } from './qualityRoutes';
|