@absolutejs/voice 0.0.22-beta.4 → 0.0.22-beta.40
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/dist/angular/index.d.ts +1 -0
- package/dist/angular/index.js +172 -2
- package/dist/angular/voice-provider-status.service.d.ts +12 -0
- package/dist/angular/voice-stream.service.d.ts +2 -0
- package/dist/assistantHealth.d.ts +81 -0
- package/dist/client/actions.d.ts +22 -0
- package/dist/client/connection.d.ts +3 -0
- package/dist/client/htmxBootstrap.js +44 -2
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +125 -2
- package/dist/client/providerStatus.d.ts +19 -0
- package/dist/diagnosticsRoutes.d.ts +44 -0
- package/dist/handoff.d.ts +54 -0
- package/dist/handoffHealth.d.ts +94 -0
- package/dist/index.d.ts +24 -2
- package/dist/index.js +3431 -128
- package/dist/modelAdapters.d.ts +99 -0
- package/dist/opsWebhook.d.ts +126 -0
- package/dist/providerAdapters.d.ts +37 -0
- package/dist/providerHealth.d.ts +79 -0
- package/dist/qualityRoutes.d.ts +76 -0
- package/dist/queue.d.ts +52 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +148 -2
- package/dist/react/useVoiceController.d.ts +2 -0
- package/dist/react/useVoiceProviderStatus.d.ts +8 -0
- package/dist/react/useVoiceStream.d.ts +2 -0
- package/dist/resilienceRoutes.d.ts +106 -0
- package/dist/sessionReplay.d.ts +175 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +127 -2
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +1468 -7
- package/dist/testing/ioProviderSimulator.d.ts +41 -0
- package/dist/testing/providerSimulator.d.ts +44 -0
- package/dist/trace.d.ts +1 -1
- package/dist/types.d.ts +84 -2
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +161 -2
- package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
- package/dist/vue/useVoiceStream.d.ts +2 -0
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -120,6 +120,12 @@ var serverMessageToAction = (message) => {
|
|
|
120
120
|
sessionId: message.sessionId,
|
|
121
121
|
type: "complete"
|
|
122
122
|
};
|
|
123
|
+
case "call_lifecycle":
|
|
124
|
+
return {
|
|
125
|
+
event: message.event,
|
|
126
|
+
sessionId: message.sessionId,
|
|
127
|
+
type: "call_lifecycle"
|
|
128
|
+
};
|
|
123
129
|
case "error":
|
|
124
130
|
return {
|
|
125
131
|
message: normalizeErrorMessage(message.message),
|
|
@@ -163,7 +169,7 @@ var DEFAULT_SCENARIO_QUERY_PARAM = "scenarioId";
|
|
|
163
169
|
var noop = () => {};
|
|
164
170
|
var noopUnsubscribe = () => noop;
|
|
165
171
|
var NOOP_CONNECTION = {
|
|
166
|
-
|
|
172
|
+
callControl: noop,
|
|
167
173
|
close: noop,
|
|
168
174
|
endTurn: noop,
|
|
169
175
|
getReadyState: () => WS_CLOSED,
|
|
@@ -171,6 +177,7 @@ var NOOP_CONNECTION = {
|
|
|
171
177
|
getSessionId: () => "",
|
|
172
178
|
send: noop,
|
|
173
179
|
sendAudio: noop,
|
|
180
|
+
start: () => {},
|
|
174
181
|
subscribe: noopUnsubscribe
|
|
175
182
|
};
|
|
176
183
|
var createSessionId = () => crypto.randomUUID();
|
|
@@ -192,6 +199,7 @@ var isVoiceServerMessage = (value) => {
|
|
|
192
199
|
switch (value.type) {
|
|
193
200
|
case "audio":
|
|
194
201
|
case "assistant":
|
|
202
|
+
case "call_lifecycle":
|
|
195
203
|
case "complete":
|
|
196
204
|
case "error":
|
|
197
205
|
case "final":
|
|
@@ -332,6 +340,12 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
332
340
|
const endTurn = () => {
|
|
333
341
|
send({ type: "end_turn" });
|
|
334
342
|
};
|
|
343
|
+
const callControl = (message) => {
|
|
344
|
+
send({
|
|
345
|
+
...message,
|
|
346
|
+
type: "call_control"
|
|
347
|
+
});
|
|
348
|
+
};
|
|
335
349
|
const close = () => {
|
|
336
350
|
clearTimers();
|
|
337
351
|
if (state.ws) {
|
|
@@ -349,7 +363,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
349
363
|
};
|
|
350
364
|
connect();
|
|
351
365
|
return {
|
|
352
|
-
|
|
366
|
+
callControl,
|
|
353
367
|
close,
|
|
354
368
|
endTurn,
|
|
355
369
|
getReadyState: () => state.ws?.readyState ?? WS_CLOSED,
|
|
@@ -357,6 +371,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
357
371
|
getSessionId: () => state.sessionId,
|
|
358
372
|
send,
|
|
359
373
|
sendAudio,
|
|
374
|
+
start,
|
|
360
375
|
subscribe
|
|
361
376
|
};
|
|
362
377
|
};
|
|
@@ -365,6 +380,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
365
380
|
var createInitialState = () => ({
|
|
366
381
|
assistantAudio: [],
|
|
367
382
|
assistantTexts: [],
|
|
383
|
+
call: null,
|
|
368
384
|
error: null,
|
|
369
385
|
isConnected: false,
|
|
370
386
|
scenarioId: null,
|
|
@@ -408,6 +424,20 @@ var createVoiceStreamStore = () => {
|
|
|
408
424
|
status: "completed"
|
|
409
425
|
};
|
|
410
426
|
break;
|
|
427
|
+
case "call_lifecycle":
|
|
428
|
+
state = {
|
|
429
|
+
...state,
|
|
430
|
+
call: {
|
|
431
|
+
...state.call,
|
|
432
|
+
disposition: action.event.type === "end" ? action.event.disposition : state.call?.disposition,
|
|
433
|
+
endedAt: action.event.type === "end" ? action.event.at : state.call?.endedAt,
|
|
434
|
+
events: [...state.call?.events ?? [], action.event],
|
|
435
|
+
lastEventAt: action.event.at,
|
|
436
|
+
startedAt: state.call?.startedAt ?? action.event.at
|
|
437
|
+
},
|
|
438
|
+
sessionId: action.sessionId
|
|
439
|
+
};
|
|
440
|
+
break;
|
|
411
441
|
case "connected":
|
|
412
442
|
state = {
|
|
413
443
|
...state,
|
|
@@ -494,6 +524,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
494
524
|
}
|
|
495
525
|
});
|
|
496
526
|
return {
|
|
527
|
+
callControl(message) {
|
|
528
|
+
connection.callControl(message);
|
|
529
|
+
},
|
|
497
530
|
close() {
|
|
498
531
|
unsubscribeConnection();
|
|
499
532
|
connection.close();
|
|
@@ -537,6 +570,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
537
570
|
get assistantAudio() {
|
|
538
571
|
return store.getSnapshot().assistantAudio;
|
|
539
572
|
},
|
|
573
|
+
get call() {
|
|
574
|
+
return store.getSnapshot().call;
|
|
575
|
+
},
|
|
540
576
|
sendAudio(audio) {
|
|
541
577
|
connection.sendAudio(audio);
|
|
542
578
|
},
|
|
@@ -553,6 +589,7 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
553
589
|
var EMPTY_SNAPSHOT = {
|
|
554
590
|
assistantAudio: [],
|
|
555
591
|
assistantTexts: [],
|
|
592
|
+
call: null,
|
|
556
593
|
error: null,
|
|
557
594
|
isConnected: false,
|
|
558
595
|
partial: "",
|
|
@@ -570,6 +607,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
570
607
|
const snapshot = useSyncExternalStore(stream.subscribe, stream.getSnapshot, stream.getServerSnapshot) ?? EMPTY_SNAPSHOT;
|
|
571
608
|
return {
|
|
572
609
|
...snapshot,
|
|
610
|
+
callControl: (message) => stream.callControl(message),
|
|
573
611
|
close: () => stream.close(),
|
|
574
612
|
endTurn: () => stream.endTurn(),
|
|
575
613
|
sendAudio: (audio) => stream.sendAudio(audio)
|
|
@@ -1040,6 +1078,7 @@ var resolveVoiceRuntimePreset = (name = "default") => {
|
|
|
1040
1078
|
var createInitialState2 = (stream) => ({
|
|
1041
1079
|
assistantAudio: [...stream.assistantAudio],
|
|
1042
1080
|
assistantTexts: [...stream.assistantTexts],
|
|
1081
|
+
call: stream.call,
|
|
1043
1082
|
error: stream.error,
|
|
1044
1083
|
isConnected: stream.isConnected,
|
|
1045
1084
|
isRecording: false,
|
|
@@ -1069,6 +1108,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1069
1108
|
...state,
|
|
1070
1109
|
assistantAudio: [...stream.assistantAudio],
|
|
1071
1110
|
assistantTexts: [...stream.assistantTexts],
|
|
1111
|
+
call: stream.call,
|
|
1072
1112
|
error: stream.error,
|
|
1073
1113
|
isConnected: stream.isConnected,
|
|
1074
1114
|
partial: stream.partial,
|
|
@@ -1146,6 +1186,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1146
1186
|
bindHTMX(bindingOptions) {
|
|
1147
1187
|
return bindVoiceHTMX(stream, bindingOptions);
|
|
1148
1188
|
},
|
|
1189
|
+
callControl: (message) => stream.callControl(message),
|
|
1149
1190
|
close,
|
|
1150
1191
|
endTurn: () => stream.endTurn(),
|
|
1151
1192
|
get error() {
|
|
@@ -1198,6 +1239,9 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1198
1239
|
},
|
|
1199
1240
|
get assistantAudio() {
|
|
1200
1241
|
return state.assistantAudio;
|
|
1242
|
+
},
|
|
1243
|
+
get call() {
|
|
1244
|
+
return state.call;
|
|
1201
1245
|
}
|
|
1202
1246
|
};
|
|
1203
1247
|
};
|
|
@@ -1206,6 +1250,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1206
1250
|
var EMPTY_SNAPSHOT2 = {
|
|
1207
1251
|
assistantAudio: [],
|
|
1208
1252
|
assistantTexts: [],
|
|
1253
|
+
call: null,
|
|
1209
1254
|
error: null,
|
|
1210
1255
|
isConnected: false,
|
|
1211
1256
|
isRecording: false,
|
|
@@ -1226,6 +1271,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
1226
1271
|
return {
|
|
1227
1272
|
...snapshot,
|
|
1228
1273
|
bindHTMX: controller.bindHTMX,
|
|
1274
|
+
callControl: (message) => controller.callControl(message),
|
|
1229
1275
|
close: () => controller.close(),
|
|
1230
1276
|
endTurn: () => controller.endTurn(),
|
|
1231
1277
|
sendAudio: (audio) => controller.sendAudio(audio),
|
|
@@ -1234,7 +1280,107 @@ var useVoiceController = (path, options = {}) => {
|
|
|
1234
1280
|
toggleRecording: () => controller.toggleRecording()
|
|
1235
1281
|
};
|
|
1236
1282
|
};
|
|
1283
|
+
// src/react/useVoiceProviderStatus.tsx
|
|
1284
|
+
import { useEffect as useEffect3, useRef as useRef3, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
1285
|
+
|
|
1286
|
+
// src/client/providerStatus.ts
|
|
1287
|
+
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
1288
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1289
|
+
const response = await fetchImpl(path);
|
|
1290
|
+
if (!response.ok) {
|
|
1291
|
+
throw new Error(`Voice provider status failed: HTTP ${response.status}`);
|
|
1292
|
+
}
|
|
1293
|
+
return await response.json();
|
|
1294
|
+
};
|
|
1295
|
+
var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {}) => {
|
|
1296
|
+
const listeners = new Set;
|
|
1297
|
+
let closed = false;
|
|
1298
|
+
let timer;
|
|
1299
|
+
let snapshot = {
|
|
1300
|
+
error: null,
|
|
1301
|
+
isLoading: false,
|
|
1302
|
+
providers: []
|
|
1303
|
+
};
|
|
1304
|
+
const emit = () => {
|
|
1305
|
+
for (const listener of listeners) {
|
|
1306
|
+
listener();
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
const refresh = async () => {
|
|
1310
|
+
if (closed) {
|
|
1311
|
+
return snapshot.providers;
|
|
1312
|
+
}
|
|
1313
|
+
snapshot = {
|
|
1314
|
+
...snapshot,
|
|
1315
|
+
error: null,
|
|
1316
|
+
isLoading: true
|
|
1317
|
+
};
|
|
1318
|
+
emit();
|
|
1319
|
+
try {
|
|
1320
|
+
const providers = await fetchVoiceProviderStatus(path, options);
|
|
1321
|
+
snapshot = {
|
|
1322
|
+
error: null,
|
|
1323
|
+
isLoading: false,
|
|
1324
|
+
providers,
|
|
1325
|
+
updatedAt: Date.now()
|
|
1326
|
+
};
|
|
1327
|
+
emit();
|
|
1328
|
+
return providers;
|
|
1329
|
+
} catch (error) {
|
|
1330
|
+
snapshot = {
|
|
1331
|
+
...snapshot,
|
|
1332
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1333
|
+
isLoading: false
|
|
1334
|
+
};
|
|
1335
|
+
emit();
|
|
1336
|
+
throw error;
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
const close = () => {
|
|
1340
|
+
closed = true;
|
|
1341
|
+
if (timer) {
|
|
1342
|
+
clearInterval(timer);
|
|
1343
|
+
timer = undefined;
|
|
1344
|
+
}
|
|
1345
|
+
listeners.clear();
|
|
1346
|
+
};
|
|
1347
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
1348
|
+
timer = setInterval(() => {
|
|
1349
|
+
refresh().catch(() => {});
|
|
1350
|
+
}, options.intervalMs);
|
|
1351
|
+
}
|
|
1352
|
+
return {
|
|
1353
|
+
close,
|
|
1354
|
+
getServerSnapshot: () => snapshot,
|
|
1355
|
+
getSnapshot: () => snapshot,
|
|
1356
|
+
refresh,
|
|
1357
|
+
subscribe: (listener) => {
|
|
1358
|
+
listeners.add(listener);
|
|
1359
|
+
return () => {
|
|
1360
|
+
listeners.delete(listener);
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
// src/react/useVoiceProviderStatus.tsx
|
|
1367
|
+
var useVoiceProviderStatus = (path = "/api/provider-status", options = {}) => {
|
|
1368
|
+
const storeRef = useRef3(null);
|
|
1369
|
+
if (!storeRef.current) {
|
|
1370
|
+
storeRef.current = createVoiceProviderStatusStore(path, options);
|
|
1371
|
+
}
|
|
1372
|
+
const store = storeRef.current;
|
|
1373
|
+
useEffect3(() => {
|
|
1374
|
+
store.refresh().catch(() => {});
|
|
1375
|
+
return () => store.close();
|
|
1376
|
+
}, [store]);
|
|
1377
|
+
return {
|
|
1378
|
+
...useSyncExternalStore3(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1379
|
+
refresh: store.refresh
|
|
1380
|
+
};
|
|
1381
|
+
};
|
|
1237
1382
|
export {
|
|
1238
1383
|
useVoiceStream,
|
|
1384
|
+
useVoiceProviderStatus,
|
|
1239
1385
|
useVoiceController
|
|
1240
1386
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { VoiceControllerOptions } from '../types';
|
|
2
2
|
export declare const useVoiceController: <TResult = unknown>(path: string, options?: VoiceControllerOptions) => {
|
|
3
3
|
bindHTMX: (options: import("..").VoiceHTMXBindingOptions) => () => void;
|
|
4
|
+
callControl: (message: Parameters<(message: Omit<import("..").VoiceClientCallControlMessage, "type">) => void>[0]) => void;
|
|
4
5
|
close: () => void;
|
|
5
6
|
endTurn: () => void;
|
|
6
7
|
sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
|
|
7
8
|
startRecording: () => Promise<void>;
|
|
8
9
|
stopRecording: () => void;
|
|
9
10
|
toggleRecording: () => Promise<void>;
|
|
11
|
+
call: import("..").VoiceCallLifecycleState | null;
|
|
10
12
|
sessionId: string | null;
|
|
11
13
|
scenarioId: string | null;
|
|
12
14
|
status: import("..").VoiceSessionStatus | "idle";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type VoiceProviderStatusClientOptions } from '../client/providerStatus';
|
|
2
|
+
export declare const useVoiceProviderStatus: <TProvider extends string = string>(path?: string, options?: VoiceProviderStatusClientOptions) => {
|
|
3
|
+
refresh: () => Promise<import("..").VoiceProviderHealthSummary<TProvider>[]>;
|
|
4
|
+
error: string | null;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
providers: import("..").VoiceProviderHealthSummary<TProvider>[];
|
|
7
|
+
updatedAt?: number;
|
|
8
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { VoiceConnectionOptions } from '../types';
|
|
2
2
|
export declare const useVoiceStream: <TResult = unknown>(path: string, options?: VoiceConnectionOptions) => {
|
|
3
|
+
callControl: (message: Parameters<(message: Omit<import("..").VoiceClientCallControlMessage, "type">) => void>[0]) => void;
|
|
3
4
|
close: () => void;
|
|
4
5
|
endTurn: () => void;
|
|
5
6
|
sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
|
|
7
|
+
call: import("..").VoiceCallLifecycleState | null;
|
|
6
8
|
sessionId: string | null;
|
|
7
9
|
scenarioId: string | null;
|
|
8
10
|
status: import("..").VoiceSessionStatus | "idle";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { type VoiceProviderHealthSummary } from './providerHealth';
|
|
3
|
+
import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
|
|
4
|
+
import type { VoiceIOProviderFailureSimulationMode, VoiceIOProviderFailureSimulationResult } from './testing/ioProviderSimulator';
|
|
5
|
+
export type VoiceRoutingEventKind = 'llm' | 'stt' | 'tts';
|
|
6
|
+
export type VoiceRoutingEvent = {
|
|
7
|
+
at: number;
|
|
8
|
+
attempt?: number;
|
|
9
|
+
elapsedMs?: number;
|
|
10
|
+
error?: string;
|
|
11
|
+
fallbackProvider?: string;
|
|
12
|
+
kind: VoiceRoutingEventKind;
|
|
13
|
+
latencyBudgetMs?: number;
|
|
14
|
+
operation?: string;
|
|
15
|
+
provider?: string;
|
|
16
|
+
selectedProvider?: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
status?: string;
|
|
19
|
+
timedOut: boolean;
|
|
20
|
+
turnId?: string;
|
|
21
|
+
};
|
|
22
|
+
export type VoiceResilienceLink = {
|
|
23
|
+
href: string;
|
|
24
|
+
label: string;
|
|
25
|
+
};
|
|
26
|
+
export type VoiceResilienceSimulationProvider<TProvider extends string = string> = {
|
|
27
|
+
configured?: boolean;
|
|
28
|
+
provider: TProvider;
|
|
29
|
+
};
|
|
30
|
+
export type VoiceResilienceIOSimulator<TProvider extends string = string> = {
|
|
31
|
+
failureProviders?: readonly TProvider[];
|
|
32
|
+
fallbackRequiredProvider?: TProvider;
|
|
33
|
+
fallbackRequiredMessage?: string;
|
|
34
|
+
failureMessage?: string;
|
|
35
|
+
label?: string;
|
|
36
|
+
pathPrefix?: string;
|
|
37
|
+
providers: readonly VoiceResilienceSimulationProvider<TProvider>[];
|
|
38
|
+
recoveryMessage?: string;
|
|
39
|
+
run: (provider: TProvider, mode: VoiceIOProviderFailureSimulationMode) => Promise<VoiceIOProviderFailureSimulationResult<TProvider>>;
|
|
40
|
+
};
|
|
41
|
+
export type VoiceResiliencePageData = {
|
|
42
|
+
links?: readonly VoiceResilienceLink[];
|
|
43
|
+
llmProviderHealth: VoiceProviderHealthSummary<string>[];
|
|
44
|
+
routingEvents: VoiceRoutingEvent[];
|
|
45
|
+
sttProviderHealth: VoiceProviderHealthSummary<string>[];
|
|
46
|
+
sttSimulation?: VoiceResilienceIOSimulator<string>;
|
|
47
|
+
title?: string;
|
|
48
|
+
ttsProviderHealth: VoiceProviderHealthSummary<string>[];
|
|
49
|
+
ttsSimulation?: VoiceResilienceIOSimulator<string>;
|
|
50
|
+
};
|
|
51
|
+
export type VoiceResilienceRoutesOptions = {
|
|
52
|
+
headers?: HeadersInit;
|
|
53
|
+
links?: readonly VoiceResilienceLink[];
|
|
54
|
+
llmProviders?: readonly string[];
|
|
55
|
+
name?: string;
|
|
56
|
+
path?: string;
|
|
57
|
+
render?: (input: VoiceResiliencePageData) => string | Promise<string>;
|
|
58
|
+
sttProviders?: readonly string[];
|
|
59
|
+
sttSimulation?: VoiceResilienceIOSimulator<string>;
|
|
60
|
+
store: VoiceTraceEventStore;
|
|
61
|
+
title?: string;
|
|
62
|
+
ttsProviders?: readonly string[];
|
|
63
|
+
ttsSimulation?: VoiceResilienceIOSimulator<string>;
|
|
64
|
+
};
|
|
65
|
+
export declare const listVoiceRoutingEvents: (events: StoredVoiceTraceEvent[]) => VoiceRoutingEvent[];
|
|
66
|
+
export declare const renderVoiceResilienceHTML: (input: VoiceResiliencePageData) => string;
|
|
67
|
+
export declare const createVoiceResilienceRoutes: (options: VoiceResilienceRoutesOptions) => Elysia<"", {
|
|
68
|
+
decorator: {};
|
|
69
|
+
store: {};
|
|
70
|
+
derive: {};
|
|
71
|
+
resolve: {};
|
|
72
|
+
}, {
|
|
73
|
+
typebox: {};
|
|
74
|
+
error: {};
|
|
75
|
+
}, {
|
|
76
|
+
schema: {};
|
|
77
|
+
standaloneSchema: {};
|
|
78
|
+
macro: {};
|
|
79
|
+
macroFn: {};
|
|
80
|
+
parser: {};
|
|
81
|
+
response: {};
|
|
82
|
+
}, {
|
|
83
|
+
[x: string]: {
|
|
84
|
+
get: {
|
|
85
|
+
body: unknown;
|
|
86
|
+
params: {};
|
|
87
|
+
query: unknown;
|
|
88
|
+
headers: unknown;
|
|
89
|
+
response: {
|
|
90
|
+
200: Response;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}, {
|
|
95
|
+
derive: {};
|
|
96
|
+
resolve: {};
|
|
97
|
+
schema: {};
|
|
98
|
+
standaloneSchema: {};
|
|
99
|
+
response: {};
|
|
100
|
+
}, {
|
|
101
|
+
derive: {};
|
|
102
|
+
resolve: {};
|
|
103
|
+
schema: {};
|
|
104
|
+
standaloneSchema: {};
|
|
105
|
+
response: {};
|
|
106
|
+
}>;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { type StoredVoiceTraceEvent, type VoiceTraceEvaluationOptions, type VoiceTraceEventStore, type VoiceTraceRedactionConfig, type VoiceTraceSummary, type VoiceTraceEvaluation } from './trace';
|
|
3
|
+
export type VoiceSessionReplayTurn = {
|
|
4
|
+
assistantReplies: string[];
|
|
5
|
+
committedText?: string;
|
|
6
|
+
errors: Array<Record<string, unknown>>;
|
|
7
|
+
id: string;
|
|
8
|
+
modelCalls: Array<Record<string, unknown>>;
|
|
9
|
+
tools: Array<Record<string, unknown>>;
|
|
10
|
+
transcripts: Array<{
|
|
11
|
+
isFinal: boolean;
|
|
12
|
+
text?: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
export type VoiceSessionReplay = {
|
|
16
|
+
evaluation: VoiceTraceEvaluation;
|
|
17
|
+
events: StoredVoiceTraceEvent[];
|
|
18
|
+
html: string;
|
|
19
|
+
markdown: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
summary: VoiceTraceSummary;
|
|
22
|
+
timeline: Array<{
|
|
23
|
+
at: number;
|
|
24
|
+
offsetMs?: number;
|
|
25
|
+
payload: Record<string, unknown>;
|
|
26
|
+
turnId?: string;
|
|
27
|
+
type: StoredVoiceTraceEvent['type'];
|
|
28
|
+
}>;
|
|
29
|
+
turns: VoiceSessionReplayTurn[];
|
|
30
|
+
};
|
|
31
|
+
export type VoiceSessionListStatus = 'failed' | 'healthy';
|
|
32
|
+
export type VoiceSessionListItem = {
|
|
33
|
+
endedAt?: number;
|
|
34
|
+
errorCount: number;
|
|
35
|
+
eventCount: number;
|
|
36
|
+
latestOutcome?: string;
|
|
37
|
+
providerErrors: Record<string, number>;
|
|
38
|
+
providers: string[];
|
|
39
|
+
replayHref: string;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
startedAt?: number;
|
|
42
|
+
status: VoiceSessionListStatus;
|
|
43
|
+
transcriptCount: number;
|
|
44
|
+
turnCount: number;
|
|
45
|
+
};
|
|
46
|
+
export type VoiceSessionListOptions = {
|
|
47
|
+
events?: StoredVoiceTraceEvent[];
|
|
48
|
+
limit?: number;
|
|
49
|
+
provider?: string;
|
|
50
|
+
q?: string;
|
|
51
|
+
replayHref?: false | string | ((session: Omit<VoiceSessionListItem, 'replayHref'>) => string);
|
|
52
|
+
status?: VoiceSessionListStatus | 'all';
|
|
53
|
+
store?: VoiceTraceEventStore;
|
|
54
|
+
};
|
|
55
|
+
export type VoiceSessionListHTMLHandlerOptions = VoiceSessionListOptions & {
|
|
56
|
+
headers?: HeadersInit;
|
|
57
|
+
render?: (sessions: VoiceSessionListItem[]) => string | Promise<string>;
|
|
58
|
+
};
|
|
59
|
+
export type VoiceSessionListRoutesOptions = VoiceSessionListHTMLHandlerOptions & {
|
|
60
|
+
htmlPath?: false | string;
|
|
61
|
+
name?: string;
|
|
62
|
+
path?: string;
|
|
63
|
+
};
|
|
64
|
+
export type VoiceSessionReplayOptions = {
|
|
65
|
+
evaluation?: VoiceTraceEvaluationOptions;
|
|
66
|
+
events?: StoredVoiceTraceEvent[];
|
|
67
|
+
redact?: VoiceTraceRedactionConfig;
|
|
68
|
+
sessionId: string;
|
|
69
|
+
store?: VoiceTraceEventStore;
|
|
70
|
+
title?: string;
|
|
71
|
+
};
|
|
72
|
+
export type VoiceSessionReplayHTMLHandlerOptions = Omit<VoiceSessionReplayOptions, 'sessionId'> & {
|
|
73
|
+
headers?: HeadersInit;
|
|
74
|
+
render?: (replay: VoiceSessionReplay) => string | Promise<string>;
|
|
75
|
+
};
|
|
76
|
+
export type VoiceSessionReplayRoutesOptions = VoiceSessionReplayHTMLHandlerOptions & {
|
|
77
|
+
htmlPath?: false | string;
|
|
78
|
+
name?: string;
|
|
79
|
+
path?: string;
|
|
80
|
+
};
|
|
81
|
+
export declare const summarizeVoiceSessionReplay: (options: VoiceSessionReplayOptions) => Promise<VoiceSessionReplay>;
|
|
82
|
+
export declare const summarizeVoiceSessions: (options?: VoiceSessionListOptions) => Promise<VoiceSessionListItem[]>;
|
|
83
|
+
export declare const renderVoiceSessionsHTML: (sessions: VoiceSessionListItem[]) => string;
|
|
84
|
+
export declare const createVoiceSessionsJSONHandler: (options?: VoiceSessionListOptions) => ({ query }: {
|
|
85
|
+
query?: Record<string, string | undefined>;
|
|
86
|
+
}) => Promise<VoiceSessionListItem[]>;
|
|
87
|
+
export declare const createVoiceSessionsHTMLHandler: (options?: VoiceSessionListHTMLHandlerOptions) => ({ query }: {
|
|
88
|
+
query?: Record<string, string | undefined>;
|
|
89
|
+
}) => Promise<Response>;
|
|
90
|
+
export declare const createVoiceSessionListRoutes: (options?: VoiceSessionListRoutesOptions) => Elysia<"", {
|
|
91
|
+
decorator: {};
|
|
92
|
+
store: {};
|
|
93
|
+
derive: {};
|
|
94
|
+
resolve: {};
|
|
95
|
+
}, {
|
|
96
|
+
typebox: {};
|
|
97
|
+
error: {};
|
|
98
|
+
}, {
|
|
99
|
+
schema: {};
|
|
100
|
+
standaloneSchema: {};
|
|
101
|
+
macro: {};
|
|
102
|
+
macroFn: {};
|
|
103
|
+
parser: {};
|
|
104
|
+
response: {};
|
|
105
|
+
}, {
|
|
106
|
+
[x: string]: {
|
|
107
|
+
get: {
|
|
108
|
+
body: unknown;
|
|
109
|
+
params: {};
|
|
110
|
+
query: unknown;
|
|
111
|
+
headers: unknown;
|
|
112
|
+
response: {
|
|
113
|
+
200: VoiceSessionListItem[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}, {
|
|
118
|
+
derive: {};
|
|
119
|
+
resolve: {};
|
|
120
|
+
schema: {};
|
|
121
|
+
standaloneSchema: {};
|
|
122
|
+
response: {};
|
|
123
|
+
}, {
|
|
124
|
+
derive: {};
|
|
125
|
+
resolve: {};
|
|
126
|
+
schema: {};
|
|
127
|
+
standaloneSchema: {};
|
|
128
|
+
response: {};
|
|
129
|
+
}>;
|
|
130
|
+
export declare const createVoiceSessionReplayJSONHandler: (options: Omit<VoiceSessionReplayOptions, "sessionId">) => ({ params }: {
|
|
131
|
+
params: Record<string, string | undefined>;
|
|
132
|
+
}) => Promise<VoiceSessionReplay>;
|
|
133
|
+
export declare const createVoiceSessionReplayHTMLHandler: (options: VoiceSessionReplayHTMLHandlerOptions) => ({ params }: {
|
|
134
|
+
params: Record<string, string | undefined>;
|
|
135
|
+
}) => Promise<Response>;
|
|
136
|
+
export declare const createVoiceSessionReplayRoutes: (options: VoiceSessionReplayRoutesOptions) => Elysia<"", {
|
|
137
|
+
decorator: {};
|
|
138
|
+
store: {};
|
|
139
|
+
derive: {};
|
|
140
|
+
resolve: {};
|
|
141
|
+
}, {
|
|
142
|
+
typebox: {};
|
|
143
|
+
error: {};
|
|
144
|
+
}, {
|
|
145
|
+
schema: {};
|
|
146
|
+
standaloneSchema: {};
|
|
147
|
+
macro: {};
|
|
148
|
+
macroFn: {};
|
|
149
|
+
parser: {};
|
|
150
|
+
response: {};
|
|
151
|
+
}, {
|
|
152
|
+
[x: string]: {
|
|
153
|
+
get: {
|
|
154
|
+
body: unknown;
|
|
155
|
+
params: {};
|
|
156
|
+
query: unknown;
|
|
157
|
+
headers: unknown;
|
|
158
|
+
response: {
|
|
159
|
+
200: VoiceSessionReplay;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}, {
|
|
164
|
+
derive: {};
|
|
165
|
+
resolve: {};
|
|
166
|
+
schema: {};
|
|
167
|
+
standaloneSchema: {};
|
|
168
|
+
response: {};
|
|
169
|
+
}, {
|
|
170
|
+
derive: {};
|
|
171
|
+
resolve: {};
|
|
172
|
+
schema: {};
|
|
173
|
+
standaloneSchema: {};
|
|
174
|
+
response: {};
|
|
175
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VoiceProviderStatusClientOptions } from '../client/providerStatus';
|
|
2
|
+
export declare const createVoiceProviderStatus: <TProvider extends string = string>(path?: string, options?: VoiceProviderStatusClientOptions) => {
|
|
3
|
+
close: () => void;
|
|
4
|
+
getServerSnapshot: () => import("../client").VoiceProviderStatusSnapshot<TProvider>;
|
|
5
|
+
getSnapshot: () => import("../client").VoiceProviderStatusSnapshot<TProvider>;
|
|
6
|
+
refresh: () => Promise<import("..").VoiceProviderHealthSummary<TProvider>[]>;
|
|
7
|
+
subscribe: (listener: () => void) => () => void;
|
|
8
|
+
};
|
package/dist/svelte/index.d.ts
CHANGED