@absolutejs/voice 0.0.22-beta.150 → 0.0.22-beta.151

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 (2) hide show
  1. package/README.md +123 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -214,6 +214,129 @@ Recommended proof routes:
214
214
  - `/live-latency`: browser-measured speech-to-assistant p50/p95 latency.
215
215
  - `/turn-quality`: STT confidence, correction, fallback, and transcript diagnostics.
216
216
 
217
+ ## Delivery Runtime Presets
218
+
219
+ Use `createVoiceDeliveryRuntimePresetConfig(...)` when you want one primitive to create paired audit and trace delivery workers for the same target. The preset returns a normal `VoiceDeliveryRuntimeConfig`, so you can still inspect or override worker options before passing it to `createVoiceDeliveryRuntime(...)`.
220
+
221
+ ### File Delivery
222
+
223
+ Use file delivery for local demos, dev environments, or self-hosted deployments that collect exports from disk.
224
+
225
+ ```ts
226
+ import {
227
+ createVoiceDeliveryRuntime,
228
+ createVoiceDeliveryRuntimePresetConfig,
229
+ createVoiceDeliveryRuntimeRoutes,
230
+ createVoiceFileRuntimeStorage
231
+ } from '@absolutejs/voice';
232
+
233
+ const runtimeStorage = createVoiceFileRuntimeStorage({
234
+ directory: '.voice-runtime/support'
235
+ });
236
+
237
+ const deliveryRuntime = createVoiceDeliveryRuntime(
238
+ createVoiceDeliveryRuntimePresetConfig({
239
+ auditDeliveries: runtimeStorage.auditDeliveries,
240
+ directory: '.voice-runtime/support/delivery-exports',
241
+ leases: createLeaseCoordinator(),
242
+ mode: 'file',
243
+ traceDeliveries: runtimeStorage.traceDeliveries
244
+ })
245
+ );
246
+
247
+ app.use(
248
+ createVoiceDeliveryRuntimeRoutes({
249
+ runtime: deliveryRuntime
250
+ })
251
+ );
252
+ ```
253
+
254
+ ### Webhook Delivery
255
+
256
+ Use webhook delivery when audit and trace exports should go to your own ingestion service, SIEM bridge, warehouse collector, or internal ops backend. The built-in HTTP sinks support retries, optional HMAC signing, custom headers, timeouts, and custom envelope bodies.
257
+
258
+ ```ts
259
+ const deliveryRuntime = createVoiceDeliveryRuntime(
260
+ createVoiceDeliveryRuntimePresetConfig({
261
+ auditDeliveries: runtimeStorage.auditDeliveries,
262
+ auditSinkId: 'support-audit-webhook',
263
+ body: {
264
+ audit: ({ events }) => ({
265
+ eventCount: events.length,
266
+ events,
267
+ source: 'support-app',
268
+ surface: 'audit-deliveries'
269
+ }),
270
+ trace: ({ events }) => ({
271
+ eventCount: events.length,
272
+ events,
273
+ source: 'support-app',
274
+ surface: 'trace-deliveries'
275
+ })
276
+ },
277
+ failures: {
278
+ maxFailures: 3
279
+ },
280
+ leases: {
281
+ audit: createLeaseCoordinator(),
282
+ trace: createLeaseCoordinator()
283
+ },
284
+ mode: 'webhook',
285
+ signingSecret: process.env.VOICE_DELIVERY_WEBHOOK_SECRET,
286
+ traceDeliveries: runtimeStorage.traceDeliveries,
287
+ traceSinkId: 'support-trace-webhook',
288
+ url: process.env.VOICE_DELIVERY_WEBHOOK_URL!
289
+ })
290
+ );
291
+ ```
292
+
293
+ ### S3 Delivery
294
+
295
+ Use S3 delivery when exports should land directly in object storage through Bun's native S3 client. Set `bucket` and `keyPrefix`; the preset writes audit and trace exports under separate prefixes.
296
+
297
+ ```ts
298
+ const deliveryRuntime = createVoiceDeliveryRuntime(
299
+ createVoiceDeliveryRuntimePresetConfig({
300
+ auditDeliveries: runtimeStorage.auditDeliveries,
301
+ auditSinkId: 'support-audit-s3',
302
+ bucket: process.env.VOICE_DELIVERY_S3_BUCKET,
303
+ failures: {
304
+ maxFailures: 3
305
+ },
306
+ keyPrefix: 'support/voice-deliveries',
307
+ leases: {
308
+ audit: createLeaseCoordinator(),
309
+ trace: createLeaseCoordinator()
310
+ },
311
+ mode: 's3',
312
+ traceDeliveries: runtimeStorage.traceDeliveries,
313
+ traceSinkId: 'support-trace-s3'
314
+ })
315
+ );
316
+ ```
317
+
318
+ Mount `createVoiceDeliveryRuntimeRoutes({ runtime: deliveryRuntime })` to expose:
319
+
320
+ - `/api/voice-delivery-runtime`: combined audit and trace worker summary.
321
+ - `/api/voice-delivery-runtime/tick`: manual tick for both workers.
322
+ - `/delivery-runtime`: HTML worker control plane.
323
+
324
+ Pass the same runtime to production readiness so failed, dead-lettered, or pending export queues become deploy-blocking evidence:
325
+
326
+ ```ts
327
+ app.use(
328
+ createVoiceProductionReadinessRoutes({
329
+ auditDeliveries: runtimeStorage.auditDeliveries,
330
+ deliveryRuntime,
331
+ links: {
332
+ deliveryRuntime: '/delivery-runtime'
333
+ },
334
+ store: runtimeStorage.traces,
335
+ traceDeliveries: runtimeStorage.traceDeliveries
336
+ })
337
+ );
338
+ ```
339
+
217
340
  ## Simulation Suite Path
218
341
 
219
342
  Use `createVoiceSimulationSuiteRoutes(...)` when you want one pre-production proof surface for the things that usually live in separate dashboards or scripts:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.150",
3
+ "version": "0.0.22-beta.151",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",