@absolutejs/voice 0.0.22-beta.5 → 0.0.22-beta.51
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 +3 -0
- package/dist/angular/index.js +463 -43
- package/dist/angular/voice-app-kit-status.service.d.ts +12 -0
- package/dist/angular/voice-provider-status.service.d.ts +12 -0
- package/dist/angular/voice-stream.service.d.ts +2 -0
- package/dist/angular/voice-workflow-status.service.d.ts +12 -0
- package/dist/appKit.d.ts +92 -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 +6 -0
- package/dist/client/index.js +285 -2
- package/dist/client/providerStatus.d.ts +19 -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 +32 -4
- package/dist/index.js +4425 -166
- package/dist/modelAdapters.d.ts +81 -0
- package/dist/opsConsoleRoutes.d.ts +77 -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 +3 -0
- package/dist/react/index.js +355 -11
- package/dist/react/useVoiceAppKitStatus.d.ts +8 -0
- 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/react/useVoiceWorkflowStatus.d.ts +8 -0
- package/dist/resilienceRoutes.d.ts +106 -0
- package/dist/sessionReplay.d.ts +175 -0
- package/dist/svelte/createVoiceAppKitStatus.d.ts +8 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +8 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +3 -0
- package/dist/svelte/index.js +292 -3
- 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 +3 -0
- package/dist/vue/index.js +412 -25
- package/dist/vue/useVoiceAppKitStatus.d.ts +9 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
- package/dist/vue/useVoiceStream.d.ts +2 -0
- package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
- package/dist/workflowContract.d.ts +91 -0
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -69,9 +69,122 @@ var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
|
69
69
|
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
// src/vue/
|
|
72
|
+
// src/vue/useVoiceAppKitStatus.ts
|
|
73
73
|
import { onUnmounted, ref, shallowRef } from "vue";
|
|
74
74
|
|
|
75
|
+
// src/client/appKitStatus.ts
|
|
76
|
+
var fetchVoiceAppKitStatus = async (path = "/app-kit/status", options = {}) => {
|
|
77
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
78
|
+
const response = await fetchImpl(path);
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
throw new Error(`Voice app kit status failed: HTTP ${response.status}`);
|
|
81
|
+
}
|
|
82
|
+
return await response.json();
|
|
83
|
+
};
|
|
84
|
+
var createVoiceAppKitStatusStore = (path = "/app-kit/status", options = {}) => {
|
|
85
|
+
const listeners = new Set;
|
|
86
|
+
let closed = false;
|
|
87
|
+
let timer;
|
|
88
|
+
let snapshot = {
|
|
89
|
+
error: null,
|
|
90
|
+
isLoading: false
|
|
91
|
+
};
|
|
92
|
+
const emit = () => {
|
|
93
|
+
for (const listener of listeners) {
|
|
94
|
+
listener();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const refresh = async () => {
|
|
98
|
+
if (closed) {
|
|
99
|
+
return snapshot.report;
|
|
100
|
+
}
|
|
101
|
+
snapshot = {
|
|
102
|
+
...snapshot,
|
|
103
|
+
error: null,
|
|
104
|
+
isLoading: true
|
|
105
|
+
};
|
|
106
|
+
emit();
|
|
107
|
+
try {
|
|
108
|
+
const report = await fetchVoiceAppKitStatus(path, options);
|
|
109
|
+
snapshot = {
|
|
110
|
+
error: null,
|
|
111
|
+
isLoading: false,
|
|
112
|
+
report,
|
|
113
|
+
updatedAt: Date.now()
|
|
114
|
+
};
|
|
115
|
+
emit();
|
|
116
|
+
return report;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
snapshot = {
|
|
119
|
+
...snapshot,
|
|
120
|
+
error: error instanceof Error ? error.message : String(error),
|
|
121
|
+
isLoading: false
|
|
122
|
+
};
|
|
123
|
+
emit();
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const close = () => {
|
|
128
|
+
closed = true;
|
|
129
|
+
if (timer) {
|
|
130
|
+
clearInterval(timer);
|
|
131
|
+
timer = undefined;
|
|
132
|
+
}
|
|
133
|
+
listeners.clear();
|
|
134
|
+
};
|
|
135
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
136
|
+
timer = setInterval(() => {
|
|
137
|
+
refresh().catch(() => {});
|
|
138
|
+
}, options.intervalMs);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
close,
|
|
142
|
+
getServerSnapshot: () => snapshot,
|
|
143
|
+
getSnapshot: () => snapshot,
|
|
144
|
+
refresh,
|
|
145
|
+
subscribe: (listener) => {
|
|
146
|
+
listeners.add(listener);
|
|
147
|
+
return () => {
|
|
148
|
+
listeners.delete(listener);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/vue/useVoiceAppKitStatus.ts
|
|
155
|
+
var useVoiceAppKitStatus = (path = "/app-kit/status", options = {}) => {
|
|
156
|
+
const store = createVoiceAppKitStatusStore(path, options);
|
|
157
|
+
const error = ref(null);
|
|
158
|
+
const isLoading = ref(false);
|
|
159
|
+
const report = shallowRef(undefined);
|
|
160
|
+
const updatedAt = ref(undefined);
|
|
161
|
+
const sync = () => {
|
|
162
|
+
const snapshot = store.getSnapshot();
|
|
163
|
+
error.value = snapshot.error;
|
|
164
|
+
isLoading.value = snapshot.isLoading;
|
|
165
|
+
report.value = snapshot.report;
|
|
166
|
+
updatedAt.value = snapshot.updatedAt;
|
|
167
|
+
};
|
|
168
|
+
const unsubscribe = store.subscribe(sync);
|
|
169
|
+
sync();
|
|
170
|
+
if (typeof window !== "undefined") {
|
|
171
|
+
store.refresh().catch(() => {});
|
|
172
|
+
}
|
|
173
|
+
onUnmounted(() => {
|
|
174
|
+
unsubscribe();
|
|
175
|
+
store.close();
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
error,
|
|
179
|
+
isLoading,
|
|
180
|
+
refresh: store.refresh,
|
|
181
|
+
report,
|
|
182
|
+
updatedAt
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
// src/vue/useVoiceStream.ts
|
|
186
|
+
import { onUnmounted as onUnmounted2, ref as ref2, shallowRef as shallowRef2 } from "vue";
|
|
187
|
+
|
|
75
188
|
// src/client/actions.ts
|
|
76
189
|
var normalizeErrorMessage = (value) => {
|
|
77
190
|
if (typeof value === "string" && value.trim()) {
|
|
@@ -120,6 +233,12 @@ var serverMessageToAction = (message) => {
|
|
|
120
233
|
sessionId: message.sessionId,
|
|
121
234
|
type: "complete"
|
|
122
235
|
};
|
|
236
|
+
case "call_lifecycle":
|
|
237
|
+
return {
|
|
238
|
+
event: message.event,
|
|
239
|
+
sessionId: message.sessionId,
|
|
240
|
+
type: "call_lifecycle"
|
|
241
|
+
};
|
|
123
242
|
case "error":
|
|
124
243
|
return {
|
|
125
244
|
message: normalizeErrorMessage(message.message),
|
|
@@ -163,7 +282,7 @@ var DEFAULT_SCENARIO_QUERY_PARAM = "scenarioId";
|
|
|
163
282
|
var noop = () => {};
|
|
164
283
|
var noopUnsubscribe = () => noop;
|
|
165
284
|
var NOOP_CONNECTION = {
|
|
166
|
-
|
|
285
|
+
callControl: noop,
|
|
167
286
|
close: noop,
|
|
168
287
|
endTurn: noop,
|
|
169
288
|
getReadyState: () => WS_CLOSED,
|
|
@@ -171,6 +290,7 @@ var NOOP_CONNECTION = {
|
|
|
171
290
|
getSessionId: () => "",
|
|
172
291
|
send: noop,
|
|
173
292
|
sendAudio: noop,
|
|
293
|
+
start: () => {},
|
|
174
294
|
subscribe: noopUnsubscribe
|
|
175
295
|
};
|
|
176
296
|
var createSessionId = () => crypto.randomUUID();
|
|
@@ -192,6 +312,7 @@ var isVoiceServerMessage = (value) => {
|
|
|
192
312
|
switch (value.type) {
|
|
193
313
|
case "audio":
|
|
194
314
|
case "assistant":
|
|
315
|
+
case "call_lifecycle":
|
|
195
316
|
case "complete":
|
|
196
317
|
case "error":
|
|
197
318
|
case "final":
|
|
@@ -332,6 +453,12 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
332
453
|
const endTurn = () => {
|
|
333
454
|
send({ type: "end_turn" });
|
|
334
455
|
};
|
|
456
|
+
const callControl = (message) => {
|
|
457
|
+
send({
|
|
458
|
+
...message,
|
|
459
|
+
type: "call_control"
|
|
460
|
+
});
|
|
461
|
+
};
|
|
335
462
|
const close = () => {
|
|
336
463
|
clearTimers();
|
|
337
464
|
if (state.ws) {
|
|
@@ -349,7 +476,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
349
476
|
};
|
|
350
477
|
connect();
|
|
351
478
|
return {
|
|
352
|
-
|
|
479
|
+
callControl,
|
|
353
480
|
close,
|
|
354
481
|
endTurn,
|
|
355
482
|
getReadyState: () => state.ws?.readyState ?? WS_CLOSED,
|
|
@@ -357,6 +484,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
357
484
|
getSessionId: () => state.sessionId,
|
|
358
485
|
send,
|
|
359
486
|
sendAudio,
|
|
487
|
+
start,
|
|
360
488
|
subscribe
|
|
361
489
|
};
|
|
362
490
|
};
|
|
@@ -365,6 +493,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
365
493
|
var createInitialState = () => ({
|
|
366
494
|
assistantAudio: [],
|
|
367
495
|
assistantTexts: [],
|
|
496
|
+
call: null,
|
|
368
497
|
error: null,
|
|
369
498
|
isConnected: false,
|
|
370
499
|
scenarioId: null,
|
|
@@ -408,6 +537,20 @@ var createVoiceStreamStore = () => {
|
|
|
408
537
|
status: "completed"
|
|
409
538
|
};
|
|
410
539
|
break;
|
|
540
|
+
case "call_lifecycle":
|
|
541
|
+
state = {
|
|
542
|
+
...state,
|
|
543
|
+
call: {
|
|
544
|
+
...state.call,
|
|
545
|
+
disposition: action.event.type === "end" ? action.event.disposition : state.call?.disposition,
|
|
546
|
+
endedAt: action.event.type === "end" ? action.event.at : state.call?.endedAt,
|
|
547
|
+
events: [...state.call?.events ?? [], action.event],
|
|
548
|
+
lastEventAt: action.event.at,
|
|
549
|
+
startedAt: state.call?.startedAt ?? action.event.at
|
|
550
|
+
},
|
|
551
|
+
sessionId: action.sessionId
|
|
552
|
+
};
|
|
553
|
+
break;
|
|
411
554
|
case "connected":
|
|
412
555
|
state = {
|
|
413
556
|
...state,
|
|
@@ -494,6 +637,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
494
637
|
}
|
|
495
638
|
});
|
|
496
639
|
return {
|
|
640
|
+
callControl(message) {
|
|
641
|
+
connection.callControl(message);
|
|
642
|
+
},
|
|
497
643
|
close() {
|
|
498
644
|
unsubscribeConnection();
|
|
499
645
|
connection.close();
|
|
@@ -537,6 +683,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
537
683
|
get assistantAudio() {
|
|
538
684
|
return store.getSnapshot().assistantAudio;
|
|
539
685
|
},
|
|
686
|
+
get call() {
|
|
687
|
+
return store.getSnapshot().call;
|
|
688
|
+
},
|
|
540
689
|
sendAudio(audio) {
|
|
541
690
|
connection.sendAudio(audio);
|
|
542
691
|
},
|
|
@@ -552,17 +701,19 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
552
701
|
// src/vue/useVoiceStream.ts
|
|
553
702
|
var useVoiceStream = (path, options = {}) => {
|
|
554
703
|
const stream = createVoiceStream(path, options);
|
|
555
|
-
const assistantAudio =
|
|
556
|
-
const assistantTexts =
|
|
557
|
-
const
|
|
558
|
-
const
|
|
559
|
-
const
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
const
|
|
704
|
+
const assistantAudio = shallowRef2([]);
|
|
705
|
+
const assistantTexts = shallowRef2([]);
|
|
706
|
+
const call = shallowRef2(null);
|
|
707
|
+
const error = ref2(null);
|
|
708
|
+
const isConnected = ref2(false);
|
|
709
|
+
const partial = ref2("");
|
|
710
|
+
const sessionId = ref2(stream.sessionId);
|
|
711
|
+
const status = ref2(stream.status);
|
|
712
|
+
const turns = shallowRef2([]);
|
|
563
713
|
const sync = () => {
|
|
564
714
|
assistantAudio.value = [...stream.assistantAudio];
|
|
565
715
|
assistantTexts.value = [...stream.assistantTexts];
|
|
716
|
+
call.value = stream.call;
|
|
566
717
|
error.value = stream.error;
|
|
567
718
|
isConnected.value = stream.isConnected;
|
|
568
719
|
partial.value = stream.partial;
|
|
@@ -576,10 +727,12 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
576
727
|
unsubscribe();
|
|
577
728
|
stream.close();
|
|
578
729
|
};
|
|
579
|
-
|
|
730
|
+
onUnmounted2(destroy);
|
|
580
731
|
return {
|
|
581
732
|
assistantAudio,
|
|
582
733
|
assistantTexts,
|
|
734
|
+
call,
|
|
735
|
+
callControl: (message) => stream.callControl(message),
|
|
583
736
|
close: () => destroy(),
|
|
584
737
|
endTurn: () => stream.endTurn(),
|
|
585
738
|
error,
|
|
@@ -592,7 +745,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
592
745
|
};
|
|
593
746
|
};
|
|
594
747
|
// src/vue/useVoiceController.ts
|
|
595
|
-
import { onUnmounted as
|
|
748
|
+
import { onUnmounted as onUnmounted3, ref as ref3, shallowRef as shallowRef3 } from "vue";
|
|
596
749
|
|
|
597
750
|
// src/client/htmx.ts
|
|
598
751
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -1056,6 +1209,7 @@ var resolveVoiceRuntimePreset = (name = "default") => {
|
|
|
1056
1209
|
var createInitialState2 = (stream) => ({
|
|
1057
1210
|
assistantAudio: [...stream.assistantAudio],
|
|
1058
1211
|
assistantTexts: [...stream.assistantTexts],
|
|
1212
|
+
call: stream.call,
|
|
1059
1213
|
error: stream.error,
|
|
1060
1214
|
isConnected: stream.isConnected,
|
|
1061
1215
|
isRecording: false,
|
|
@@ -1085,6 +1239,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1085
1239
|
...state,
|
|
1086
1240
|
assistantAudio: [...stream.assistantAudio],
|
|
1087
1241
|
assistantTexts: [...stream.assistantTexts],
|
|
1242
|
+
call: stream.call,
|
|
1088
1243
|
error: stream.error,
|
|
1089
1244
|
isConnected: stream.isConnected,
|
|
1090
1245
|
partial: stream.partial,
|
|
@@ -1162,6 +1317,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1162
1317
|
bindHTMX(bindingOptions) {
|
|
1163
1318
|
return bindVoiceHTMX(stream, bindingOptions);
|
|
1164
1319
|
},
|
|
1320
|
+
callControl: (message) => stream.callControl(message),
|
|
1165
1321
|
close,
|
|
1166
1322
|
endTurn: () => stream.endTurn(),
|
|
1167
1323
|
get error() {
|
|
@@ -1214,6 +1370,9 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1214
1370
|
},
|
|
1215
1371
|
get assistantAudio() {
|
|
1216
1372
|
return state.assistantAudio;
|
|
1373
|
+
},
|
|
1374
|
+
get call() {
|
|
1375
|
+
return state.call;
|
|
1217
1376
|
}
|
|
1218
1377
|
};
|
|
1219
1378
|
};
|
|
@@ -1221,16 +1380,16 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1221
1380
|
// src/vue/useVoiceController.ts
|
|
1222
1381
|
var useVoiceController = (path, options = {}) => {
|
|
1223
1382
|
const controller = createVoiceController(path, options);
|
|
1224
|
-
const assistantAudio =
|
|
1225
|
-
const assistantTexts =
|
|
1226
|
-
const error =
|
|
1227
|
-
const isConnected =
|
|
1228
|
-
const isRecording =
|
|
1229
|
-
const partial =
|
|
1230
|
-
const recordingError =
|
|
1231
|
-
const sessionId =
|
|
1232
|
-
const status =
|
|
1233
|
-
const turns =
|
|
1383
|
+
const assistantAudio = shallowRef3([]);
|
|
1384
|
+
const assistantTexts = shallowRef3([]);
|
|
1385
|
+
const error = ref3(null);
|
|
1386
|
+
const isConnected = ref3(false);
|
|
1387
|
+
const isRecording = ref3(false);
|
|
1388
|
+
const partial = ref3("");
|
|
1389
|
+
const recordingError = ref3(null);
|
|
1390
|
+
const sessionId = ref3(controller.sessionId);
|
|
1391
|
+
const status = ref3(controller.status);
|
|
1392
|
+
const turns = shallowRef3([]);
|
|
1234
1393
|
const sync = () => {
|
|
1235
1394
|
assistantAudio.value = [...controller.assistantAudio];
|
|
1236
1395
|
assistantTexts.value = [...controller.assistantTexts];
|
|
@@ -1249,7 +1408,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
1249
1408
|
unsubscribe();
|
|
1250
1409
|
controller.close();
|
|
1251
1410
|
};
|
|
1252
|
-
|
|
1411
|
+
onUnmounted3(destroy);
|
|
1253
1412
|
return {
|
|
1254
1413
|
assistantAudio,
|
|
1255
1414
|
assistantTexts,
|
|
@@ -1270,7 +1429,235 @@ var useVoiceController = (path, options = {}) => {
|
|
|
1270
1429
|
turns
|
|
1271
1430
|
};
|
|
1272
1431
|
};
|
|
1432
|
+
// src/vue/useVoiceProviderStatus.ts
|
|
1433
|
+
import { onUnmounted as onUnmounted4, ref as ref4, shallowRef as shallowRef4 } from "vue";
|
|
1434
|
+
|
|
1435
|
+
// src/client/providerStatus.ts
|
|
1436
|
+
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
1437
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1438
|
+
const response = await fetchImpl(path);
|
|
1439
|
+
if (!response.ok) {
|
|
1440
|
+
throw new Error(`Voice provider status failed: HTTP ${response.status}`);
|
|
1441
|
+
}
|
|
1442
|
+
return await response.json();
|
|
1443
|
+
};
|
|
1444
|
+
var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {}) => {
|
|
1445
|
+
const listeners = new Set;
|
|
1446
|
+
let closed = false;
|
|
1447
|
+
let timer;
|
|
1448
|
+
let snapshot = {
|
|
1449
|
+
error: null,
|
|
1450
|
+
isLoading: false,
|
|
1451
|
+
providers: []
|
|
1452
|
+
};
|
|
1453
|
+
const emit = () => {
|
|
1454
|
+
for (const listener of listeners) {
|
|
1455
|
+
listener();
|
|
1456
|
+
}
|
|
1457
|
+
};
|
|
1458
|
+
const refresh = async () => {
|
|
1459
|
+
if (closed) {
|
|
1460
|
+
return snapshot.providers;
|
|
1461
|
+
}
|
|
1462
|
+
snapshot = {
|
|
1463
|
+
...snapshot,
|
|
1464
|
+
error: null,
|
|
1465
|
+
isLoading: true
|
|
1466
|
+
};
|
|
1467
|
+
emit();
|
|
1468
|
+
try {
|
|
1469
|
+
const providers = await fetchVoiceProviderStatus(path, options);
|
|
1470
|
+
snapshot = {
|
|
1471
|
+
error: null,
|
|
1472
|
+
isLoading: false,
|
|
1473
|
+
providers,
|
|
1474
|
+
updatedAt: Date.now()
|
|
1475
|
+
};
|
|
1476
|
+
emit();
|
|
1477
|
+
return providers;
|
|
1478
|
+
} catch (error) {
|
|
1479
|
+
snapshot = {
|
|
1480
|
+
...snapshot,
|
|
1481
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1482
|
+
isLoading: false
|
|
1483
|
+
};
|
|
1484
|
+
emit();
|
|
1485
|
+
throw error;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
const close = () => {
|
|
1489
|
+
closed = true;
|
|
1490
|
+
if (timer) {
|
|
1491
|
+
clearInterval(timer);
|
|
1492
|
+
timer = undefined;
|
|
1493
|
+
}
|
|
1494
|
+
listeners.clear();
|
|
1495
|
+
};
|
|
1496
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
1497
|
+
timer = setInterval(() => {
|
|
1498
|
+
refresh().catch(() => {});
|
|
1499
|
+
}, options.intervalMs);
|
|
1500
|
+
}
|
|
1501
|
+
return {
|
|
1502
|
+
close,
|
|
1503
|
+
getServerSnapshot: () => snapshot,
|
|
1504
|
+
getSnapshot: () => snapshot,
|
|
1505
|
+
refresh,
|
|
1506
|
+
subscribe: (listener) => {
|
|
1507
|
+
listeners.add(listener);
|
|
1508
|
+
return () => {
|
|
1509
|
+
listeners.delete(listener);
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
// src/vue/useVoiceProviderStatus.ts
|
|
1516
|
+
var useVoiceProviderStatus = (path = "/api/provider-status", options = {}) => {
|
|
1517
|
+
const store = createVoiceProviderStatusStore(path, options);
|
|
1518
|
+
const error = ref4(null);
|
|
1519
|
+
const isLoading = ref4(false);
|
|
1520
|
+
const providers = shallowRef4([]);
|
|
1521
|
+
const updatedAt = ref4(undefined);
|
|
1522
|
+
const sync = () => {
|
|
1523
|
+
const snapshot = store.getSnapshot();
|
|
1524
|
+
error.value = snapshot.error;
|
|
1525
|
+
isLoading.value = snapshot.isLoading;
|
|
1526
|
+
providers.value = [...snapshot.providers];
|
|
1527
|
+
updatedAt.value = snapshot.updatedAt;
|
|
1528
|
+
};
|
|
1529
|
+
const unsubscribe = store.subscribe(sync);
|
|
1530
|
+
sync();
|
|
1531
|
+
store.refresh().catch(() => {});
|
|
1532
|
+
onUnmounted4(() => {
|
|
1533
|
+
unsubscribe();
|
|
1534
|
+
store.close();
|
|
1535
|
+
});
|
|
1536
|
+
return {
|
|
1537
|
+
error,
|
|
1538
|
+
isLoading,
|
|
1539
|
+
providers,
|
|
1540
|
+
refresh: store.refresh,
|
|
1541
|
+
updatedAt
|
|
1542
|
+
};
|
|
1543
|
+
};
|
|
1544
|
+
// src/vue/useVoiceWorkflowStatus.ts
|
|
1545
|
+
import { onUnmounted as onUnmounted5, ref as ref5, shallowRef as shallowRef5 } from "vue";
|
|
1546
|
+
|
|
1547
|
+
// src/client/workflowStatus.ts
|
|
1548
|
+
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
1549
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1550
|
+
const response = await fetchImpl(path);
|
|
1551
|
+
if (!response.ok) {
|
|
1552
|
+
throw new Error(`Voice workflow status failed: HTTP ${response.status}`);
|
|
1553
|
+
}
|
|
1554
|
+
return await response.json();
|
|
1555
|
+
};
|
|
1556
|
+
var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options = {}) => {
|
|
1557
|
+
const listeners = new Set;
|
|
1558
|
+
let closed = false;
|
|
1559
|
+
let timer;
|
|
1560
|
+
let snapshot = {
|
|
1561
|
+
error: null,
|
|
1562
|
+
isLoading: false
|
|
1563
|
+
};
|
|
1564
|
+
const emit = () => {
|
|
1565
|
+
for (const listener of listeners) {
|
|
1566
|
+
listener();
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
const refresh = async () => {
|
|
1570
|
+
if (closed) {
|
|
1571
|
+
return snapshot.report;
|
|
1572
|
+
}
|
|
1573
|
+
snapshot = {
|
|
1574
|
+
...snapshot,
|
|
1575
|
+
error: null,
|
|
1576
|
+
isLoading: true
|
|
1577
|
+
};
|
|
1578
|
+
emit();
|
|
1579
|
+
try {
|
|
1580
|
+
const report = await fetchVoiceWorkflowStatus(path, options);
|
|
1581
|
+
snapshot = {
|
|
1582
|
+
error: null,
|
|
1583
|
+
isLoading: false,
|
|
1584
|
+
report,
|
|
1585
|
+
updatedAt: Date.now()
|
|
1586
|
+
};
|
|
1587
|
+
emit();
|
|
1588
|
+
return report;
|
|
1589
|
+
} catch (error) {
|
|
1590
|
+
snapshot = {
|
|
1591
|
+
...snapshot,
|
|
1592
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1593
|
+
isLoading: false
|
|
1594
|
+
};
|
|
1595
|
+
emit();
|
|
1596
|
+
throw error;
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
const close = () => {
|
|
1600
|
+
closed = true;
|
|
1601
|
+
if (timer) {
|
|
1602
|
+
clearInterval(timer);
|
|
1603
|
+
timer = undefined;
|
|
1604
|
+
}
|
|
1605
|
+
listeners.clear();
|
|
1606
|
+
};
|
|
1607
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
1608
|
+
timer = setInterval(() => {
|
|
1609
|
+
refresh().catch(() => {});
|
|
1610
|
+
}, options.intervalMs);
|
|
1611
|
+
}
|
|
1612
|
+
return {
|
|
1613
|
+
close,
|
|
1614
|
+
getServerSnapshot: () => snapshot,
|
|
1615
|
+
getSnapshot: () => snapshot,
|
|
1616
|
+
refresh,
|
|
1617
|
+
subscribe: (listener) => {
|
|
1618
|
+
listeners.add(listener);
|
|
1619
|
+
return () => {
|
|
1620
|
+
listeners.delete(listener);
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
};
|
|
1625
|
+
|
|
1626
|
+
// src/vue/useVoiceWorkflowStatus.ts
|
|
1627
|
+
var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
|
|
1628
|
+
const store = createVoiceWorkflowStatusStore(path, options);
|
|
1629
|
+
const error = ref5(null);
|
|
1630
|
+
const isLoading = ref5(false);
|
|
1631
|
+
const report = shallowRef5(undefined);
|
|
1632
|
+
const updatedAt = ref5(undefined);
|
|
1633
|
+
const sync = () => {
|
|
1634
|
+
const snapshot = store.getSnapshot();
|
|
1635
|
+
error.value = snapshot.error;
|
|
1636
|
+
isLoading.value = snapshot.isLoading;
|
|
1637
|
+
report.value = snapshot.report;
|
|
1638
|
+
updatedAt.value = snapshot.updatedAt;
|
|
1639
|
+
};
|
|
1640
|
+
const unsubscribe = store.subscribe(sync);
|
|
1641
|
+
sync();
|
|
1642
|
+
if (typeof window !== "undefined") {
|
|
1643
|
+
store.refresh().catch(() => {});
|
|
1644
|
+
}
|
|
1645
|
+
onUnmounted5(() => {
|
|
1646
|
+
unsubscribe();
|
|
1647
|
+
store.close();
|
|
1648
|
+
});
|
|
1649
|
+
return {
|
|
1650
|
+
error,
|
|
1651
|
+
isLoading,
|
|
1652
|
+
refresh: store.refresh,
|
|
1653
|
+
report,
|
|
1654
|
+
updatedAt
|
|
1655
|
+
};
|
|
1656
|
+
};
|
|
1273
1657
|
export {
|
|
1658
|
+
useVoiceWorkflowStatus,
|
|
1274
1659
|
useVoiceStream,
|
|
1275
|
-
|
|
1660
|
+
useVoiceProviderStatus,
|
|
1661
|
+
useVoiceController,
|
|
1662
|
+
useVoiceAppKitStatus
|
|
1276
1663
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VoiceAppKitStatusClientOptions } from '../client/appKitStatus';
|
|
2
|
+
import type { VoiceAppKitStatusReport } from '../appKit';
|
|
3
|
+
export declare const useVoiceAppKitStatus: (path?: string, options?: VoiceAppKitStatusClientOptions) => {
|
|
4
|
+
error: import("vue").Ref<string | null, string | null>;
|
|
5
|
+
isLoading: import("vue").Ref<boolean, boolean>;
|
|
6
|
+
refresh: () => Promise<VoiceAppKitStatusReport | undefined>;
|
|
7
|
+
report: import("vue").ShallowRef<VoiceAppKitStatusReport | undefined, VoiceAppKitStatusReport | undefined>;
|
|
8
|
+
updatedAt: import("vue").Ref<number | undefined, number | undefined>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VoiceProviderStatusClientOptions } from '../client/providerStatus';
|
|
2
|
+
import type { VoiceProviderHealthSummary } from '../providerHealth';
|
|
3
|
+
export declare const useVoiceProviderStatus: <TProvider extends string = string>(path?: string, options?: VoiceProviderStatusClientOptions) => {
|
|
4
|
+
error: import("vue").Ref<string | null, string | null>;
|
|
5
|
+
isLoading: import("vue").Ref<boolean, boolean>;
|
|
6
|
+
providers: import("vue").ShallowRef<VoiceProviderHealthSummary<TProvider>[], VoiceProviderHealthSummary<TProvider>[]>;
|
|
7
|
+
refresh: () => Promise<VoiceProviderHealthSummary<TProvider>[]>;
|
|
8
|
+
updatedAt: import("vue").Ref<number | undefined, number | undefined>;
|
|
9
|
+
};
|
|
@@ -12,6 +12,8 @@ export declare const useVoiceStream: <TResult = unknown>(path: string, options?:
|
|
|
12
12
|
turnId?: string;
|
|
13
13
|
}[]>;
|
|
14
14
|
assistantTexts: import("vue").ShallowRef<string[], string[]>;
|
|
15
|
+
call: import("vue").ShallowRef<import("..").VoiceCallLifecycleState | null, import("..").VoiceCallLifecycleState | null>;
|
|
16
|
+
callControl: (message: Parameters<(message: Omit<import("..").VoiceClientCallControlMessage, "type">) => void>[0]) => void;
|
|
15
17
|
close: () => void;
|
|
16
18
|
endTurn: () => void;
|
|
17
19
|
error: import("vue").Ref<string | null, string | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VoiceWorkflowStatusClientOptions } from '../client/workflowStatus';
|
|
2
|
+
import type { VoiceScenarioEvalReport } from '../evalRoutes';
|
|
3
|
+
export declare const useVoiceWorkflowStatus: (path?: string, options?: VoiceWorkflowStatusClientOptions) => {
|
|
4
|
+
error: import("vue").Ref<string | null, string | null>;
|
|
5
|
+
isLoading: import("vue").Ref<boolean, boolean>;
|
|
6
|
+
refresh: () => Promise<VoiceScenarioEvalReport | undefined>;
|
|
7
|
+
report: import("vue").ShallowRef<VoiceScenarioEvalReport | undefined, VoiceScenarioEvalReport | undefined>;
|
|
8
|
+
updatedAt: import("vue").Ref<number | undefined, number | undefined>;
|
|
9
|
+
};
|