@absolutejs/voice 0.0.22-beta.49 → 0.0.22-beta.50
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 +188 -63
- package/dist/angular/voice-app-kit-status.service.d.ts +12 -0
- package/dist/appKit.d.ts +40 -1
- package/dist/client/appKitStatus.d.ts +19 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +80 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +84 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +116 -17
- package/dist/react/useVoiceAppKitStatus.d.ts +8 -0
- package/dist/svelte/createVoiceAppKitStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +83 -1
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +150 -36
- package/dist/vue/useVoiceAppKitStatus.d.ts +9 -0
- package/package.json +1 -1
package/dist/angular/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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';
|
|
3
4
|
export { VoiceProviderStatusService } from './voice-provider-status.service';
|
package/dist/angular/index.js
CHANGED
|
@@ -69,9 +69,133 @@ 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/angular/voice-
|
|
72
|
+
// src/angular/voice-app-kit-status.service.ts
|
|
73
73
|
import { computed, Injectable, signal } from "@angular/core";
|
|
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/angular/voice-app-kit-status.service.ts
|
|
155
|
+
var _dec = [
|
|
156
|
+
Injectable({ providedIn: "root" })
|
|
157
|
+
];
|
|
158
|
+
var _init = __decoratorStart(undefined);
|
|
159
|
+
|
|
160
|
+
class VoiceAppKitStatusService {
|
|
161
|
+
connect(path = "/app-kit/status", options = {}) {
|
|
162
|
+
const store = createVoiceAppKitStatusStore(path, options);
|
|
163
|
+
const errorSignal = signal(null);
|
|
164
|
+
const isLoadingSignal = signal(false);
|
|
165
|
+
const reportSignal = signal(undefined);
|
|
166
|
+
const updatedAtSignal = signal(undefined);
|
|
167
|
+
const sync = () => {
|
|
168
|
+
const snapshot = store.getSnapshot();
|
|
169
|
+
errorSignal.set(snapshot.error);
|
|
170
|
+
isLoadingSignal.set(snapshot.isLoading);
|
|
171
|
+
reportSignal.set(snapshot.report);
|
|
172
|
+
updatedAtSignal.set(snapshot.updatedAt);
|
|
173
|
+
};
|
|
174
|
+
const unsubscribe = store.subscribe(sync);
|
|
175
|
+
sync();
|
|
176
|
+
if (typeof window !== "undefined") {
|
|
177
|
+
store.refresh().catch(() => {});
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
close: () => {
|
|
181
|
+
unsubscribe();
|
|
182
|
+
store.close();
|
|
183
|
+
},
|
|
184
|
+
error: computed(() => errorSignal()),
|
|
185
|
+
isLoading: computed(() => isLoadingSignal()),
|
|
186
|
+
refresh: store.refresh,
|
|
187
|
+
report: computed(() => reportSignal()),
|
|
188
|
+
updatedAt: computed(() => updatedAtSignal())
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
VoiceAppKitStatusService = __decorateElement(_init, 0, "VoiceAppKitStatusService", _dec, VoiceAppKitStatusService);
|
|
193
|
+
__runInitializers(_init, 1, VoiceAppKitStatusService);
|
|
194
|
+
__decoratorMetadata(_init, VoiceAppKitStatusService);
|
|
195
|
+
let _VoiceAppKitStatusService = VoiceAppKitStatusService;
|
|
196
|
+
// src/angular/voice-stream.service.ts
|
|
197
|
+
import { computed as computed2, Injectable as Injectable2, signal as signal2 } from "@angular/core";
|
|
198
|
+
|
|
75
199
|
// src/client/actions.ts
|
|
76
200
|
var normalizeErrorMessage = (value) => {
|
|
77
201
|
if (typeof value === "string" && value.trim()) {
|
|
@@ -587,22 +711,22 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
587
711
|
|
|
588
712
|
// src/angular/voice-stream.service.ts
|
|
589
713
|
var _dec = [
|
|
590
|
-
|
|
714
|
+
Injectable2({ providedIn: "root" })
|
|
591
715
|
];
|
|
592
716
|
var _init = __decoratorStart(undefined);
|
|
593
717
|
|
|
594
718
|
class VoiceStreamService {
|
|
595
719
|
connect(path, options = {}) {
|
|
596
720
|
const stream = createVoiceStream(path, options);
|
|
597
|
-
const assistantAudioSignal =
|
|
598
|
-
const assistantTextsSignal =
|
|
599
|
-
const callSignal =
|
|
600
|
-
const errorSignal =
|
|
601
|
-
const isConnectedSignal =
|
|
602
|
-
const partialSignal =
|
|
603
|
-
const sessionIdSignal =
|
|
604
|
-
const statusSignal =
|
|
605
|
-
const turnsSignal =
|
|
721
|
+
const assistantAudioSignal = signal2([]);
|
|
722
|
+
const assistantTextsSignal = signal2([]);
|
|
723
|
+
const callSignal = signal2(null);
|
|
724
|
+
const errorSignal = signal2(null);
|
|
725
|
+
const isConnectedSignal = signal2(false);
|
|
726
|
+
const partialSignal = signal2("");
|
|
727
|
+
const sessionIdSignal = signal2(stream.sessionId);
|
|
728
|
+
const statusSignal = signal2(stream.status);
|
|
729
|
+
const turnsSignal = signal2([]);
|
|
606
730
|
const sync = () => {
|
|
607
731
|
assistantAudioSignal.set([...stream.assistantAudio]);
|
|
608
732
|
assistantTextsSignal.set([...stream.assistantTexts]);
|
|
@@ -617,22 +741,22 @@ class VoiceStreamService {
|
|
|
617
741
|
const unsubscribe = stream.subscribe(sync);
|
|
618
742
|
sync();
|
|
619
743
|
return {
|
|
620
|
-
assistantAudio:
|
|
621
|
-
assistantTexts:
|
|
622
|
-
call:
|
|
744
|
+
assistantAudio: computed2(() => assistantAudioSignal()),
|
|
745
|
+
assistantTexts: computed2(() => assistantTextsSignal()),
|
|
746
|
+
call: computed2(() => callSignal()),
|
|
623
747
|
callControl: (message) => stream.callControl(message),
|
|
624
748
|
close: () => {
|
|
625
749
|
unsubscribe();
|
|
626
750
|
stream.close();
|
|
627
751
|
},
|
|
628
752
|
endTurn: () => stream.endTurn(),
|
|
629
|
-
error:
|
|
630
|
-
isConnected:
|
|
631
|
-
partial:
|
|
753
|
+
error: computed2(() => errorSignal()),
|
|
754
|
+
isConnected: computed2(() => isConnectedSignal()),
|
|
755
|
+
partial: computed2(() => partialSignal()),
|
|
632
756
|
sendAudio: (audio) => stream.sendAudio(audio),
|
|
633
|
-
sessionId:
|
|
634
|
-
status:
|
|
635
|
-
turns:
|
|
757
|
+
sessionId: computed2(() => sessionIdSignal()),
|
|
758
|
+
status: computed2(() => statusSignal()),
|
|
759
|
+
turns: computed2(() => turnsSignal())
|
|
636
760
|
};
|
|
637
761
|
}
|
|
638
762
|
}
|
|
@@ -641,7 +765,7 @@ __runInitializers(_init, 1, VoiceStreamService);
|
|
|
641
765
|
__decoratorMetadata(_init, VoiceStreamService);
|
|
642
766
|
let _VoiceStreamService = VoiceStreamService;
|
|
643
767
|
// src/angular/voice-controller.service.ts
|
|
644
|
-
import { computed as
|
|
768
|
+
import { computed as computed3, Injectable as Injectable3, signal as signal3 } from "@angular/core";
|
|
645
769
|
|
|
646
770
|
// src/client/htmx.ts
|
|
647
771
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -1275,23 +1399,23 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1275
1399
|
|
|
1276
1400
|
// src/angular/voice-controller.service.ts
|
|
1277
1401
|
var _dec = [
|
|
1278
|
-
|
|
1402
|
+
Injectable3({ providedIn: "root" })
|
|
1279
1403
|
];
|
|
1280
1404
|
var _init = __decoratorStart(undefined);
|
|
1281
1405
|
|
|
1282
1406
|
class VoiceControllerService {
|
|
1283
1407
|
connect(path, options = {}) {
|
|
1284
1408
|
const controller = createVoiceController(path, options);
|
|
1285
|
-
const assistantAudioSignal =
|
|
1286
|
-
const assistantTextsSignal =
|
|
1287
|
-
const errorSignal =
|
|
1288
|
-
const isConnectedSignal =
|
|
1289
|
-
const isRecordingSignal =
|
|
1290
|
-
const partialSignal =
|
|
1291
|
-
const recordingErrorSignal =
|
|
1292
|
-
const sessionIdSignal =
|
|
1293
|
-
const statusSignal =
|
|
1294
|
-
const turnsSignal =
|
|
1409
|
+
const assistantAudioSignal = signal3([]);
|
|
1410
|
+
const assistantTextsSignal = signal3([]);
|
|
1411
|
+
const errorSignal = signal3(null);
|
|
1412
|
+
const isConnectedSignal = signal3(false);
|
|
1413
|
+
const isRecordingSignal = signal3(false);
|
|
1414
|
+
const partialSignal = signal3("");
|
|
1415
|
+
const recordingErrorSignal = signal3(null);
|
|
1416
|
+
const sessionIdSignal = signal3(controller.sessionId);
|
|
1417
|
+
const statusSignal = signal3(controller.status);
|
|
1418
|
+
const turnsSignal = signal3([]);
|
|
1295
1419
|
const sync = () => {
|
|
1296
1420
|
assistantAudioSignal.set([...controller.assistantAudio]);
|
|
1297
1421
|
assistantTextsSignal.set([...controller.assistantTexts]);
|
|
@@ -1307,26 +1431,26 @@ class VoiceControllerService {
|
|
|
1307
1431
|
const unsubscribe = controller.subscribe(sync);
|
|
1308
1432
|
sync();
|
|
1309
1433
|
return {
|
|
1310
|
-
assistantAudio:
|
|
1311
|
-
assistantTexts:
|
|
1434
|
+
assistantAudio: computed3(() => assistantAudioSignal()),
|
|
1435
|
+
assistantTexts: computed3(() => assistantTextsSignal()),
|
|
1312
1436
|
bindHTMX: controller.bindHTMX,
|
|
1313
1437
|
close: () => {
|
|
1314
1438
|
unsubscribe();
|
|
1315
1439
|
controller.close();
|
|
1316
1440
|
},
|
|
1317
1441
|
endTurn: () => controller.endTurn(),
|
|
1318
|
-
error:
|
|
1319
|
-
isConnected:
|
|
1320
|
-
isRecording:
|
|
1321
|
-
partial:
|
|
1322
|
-
recordingError:
|
|
1442
|
+
error: computed3(() => errorSignal()),
|
|
1443
|
+
isConnected: computed3(() => isConnectedSignal()),
|
|
1444
|
+
isRecording: computed3(() => isRecordingSignal()),
|
|
1445
|
+
partial: computed3(() => partialSignal()),
|
|
1446
|
+
recordingError: computed3(() => recordingErrorSignal()),
|
|
1323
1447
|
sendAudio: (audio) => controller.sendAudio(audio),
|
|
1324
|
-
sessionId:
|
|
1448
|
+
sessionId: computed3(() => sessionIdSignal()),
|
|
1325
1449
|
startRecording: () => controller.startRecording(),
|
|
1326
|
-
status:
|
|
1450
|
+
status: computed3(() => statusSignal()),
|
|
1327
1451
|
stopRecording: () => controller.stopRecording(),
|
|
1328
1452
|
toggleRecording: () => controller.toggleRecording(),
|
|
1329
|
-
turns:
|
|
1453
|
+
turns: computed3(() => turnsSignal())
|
|
1330
1454
|
};
|
|
1331
1455
|
}
|
|
1332
1456
|
}
|
|
@@ -1335,7 +1459,7 @@ __runInitializers(_init, 1, VoiceControllerService);
|
|
|
1335
1459
|
__decoratorMetadata(_init, VoiceControllerService);
|
|
1336
1460
|
let _VoiceControllerService = VoiceControllerService;
|
|
1337
1461
|
// src/angular/voice-provider-status.service.ts
|
|
1338
|
-
import { computed as
|
|
1462
|
+
import { computed as computed4, Injectable as Injectable4, signal as signal4 } from "@angular/core";
|
|
1339
1463
|
|
|
1340
1464
|
// src/client/providerStatus.ts
|
|
1341
1465
|
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
@@ -1419,17 +1543,17 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1419
1543
|
|
|
1420
1544
|
// src/angular/voice-provider-status.service.ts
|
|
1421
1545
|
var _dec = [
|
|
1422
|
-
|
|
1546
|
+
Injectable4({ providedIn: "root" })
|
|
1423
1547
|
];
|
|
1424
1548
|
var _init = __decoratorStart(undefined);
|
|
1425
1549
|
|
|
1426
1550
|
class VoiceProviderStatusService {
|
|
1427
1551
|
connect(path = "/api/provider-status", options = {}) {
|
|
1428
1552
|
const store = createVoiceProviderStatusStore(path, options);
|
|
1429
|
-
const errorSignal =
|
|
1430
|
-
const isLoadingSignal =
|
|
1431
|
-
const providersSignal =
|
|
1432
|
-
const updatedAtSignal =
|
|
1553
|
+
const errorSignal = signal4(null);
|
|
1554
|
+
const isLoadingSignal = signal4(false);
|
|
1555
|
+
const providersSignal = signal4([]);
|
|
1556
|
+
const updatedAtSignal = signal4(undefined);
|
|
1433
1557
|
const sync = () => {
|
|
1434
1558
|
const snapshot = store.getSnapshot();
|
|
1435
1559
|
errorSignal.set(snapshot.error);
|
|
@@ -1445,11 +1569,11 @@ class VoiceProviderStatusService {
|
|
|
1445
1569
|
unsubscribe();
|
|
1446
1570
|
store.close();
|
|
1447
1571
|
},
|
|
1448
|
-
error:
|
|
1449
|
-
isLoading:
|
|
1450
|
-
providers:
|
|
1572
|
+
error: computed4(() => errorSignal()),
|
|
1573
|
+
isLoading: computed4(() => isLoadingSignal()),
|
|
1574
|
+
providers: computed4(() => providersSignal()),
|
|
1451
1575
|
refresh: store.refresh,
|
|
1452
|
-
updatedAt:
|
|
1576
|
+
updatedAt: computed4(() => updatedAtSignal())
|
|
1453
1577
|
};
|
|
1454
1578
|
}
|
|
1455
1579
|
}
|
|
@@ -1458,7 +1582,7 @@ __runInitializers(_init, 1, VoiceProviderStatusService);
|
|
|
1458
1582
|
__decoratorMetadata(_init, VoiceProviderStatusService);
|
|
1459
1583
|
let _VoiceProviderStatusService = VoiceProviderStatusService;
|
|
1460
1584
|
// src/angular/voice-workflow-status.service.ts
|
|
1461
|
-
import { computed as
|
|
1585
|
+
import { computed as computed5, Injectable as Injectable5, signal as signal5 } from "@angular/core";
|
|
1462
1586
|
|
|
1463
1587
|
// src/client/workflowStatus.ts
|
|
1464
1588
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -1541,17 +1665,17 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
1541
1665
|
|
|
1542
1666
|
// src/angular/voice-workflow-status.service.ts
|
|
1543
1667
|
var _dec = [
|
|
1544
|
-
|
|
1668
|
+
Injectable5({ providedIn: "root" })
|
|
1545
1669
|
];
|
|
1546
1670
|
var _init = __decoratorStart(undefined);
|
|
1547
1671
|
|
|
1548
1672
|
class VoiceWorkflowStatusService {
|
|
1549
1673
|
connect(path = "/evals/scenarios/json", options = {}) {
|
|
1550
1674
|
const store = createVoiceWorkflowStatusStore(path, options);
|
|
1551
|
-
const errorSignal =
|
|
1552
|
-
const isLoadingSignal =
|
|
1553
|
-
const reportSignal =
|
|
1554
|
-
const updatedAtSignal =
|
|
1675
|
+
const errorSignal = signal5(null);
|
|
1676
|
+
const isLoadingSignal = signal5(false);
|
|
1677
|
+
const reportSignal = signal5(undefined);
|
|
1678
|
+
const updatedAtSignal = signal5(undefined);
|
|
1555
1679
|
const sync = () => {
|
|
1556
1680
|
const snapshot = store.getSnapshot();
|
|
1557
1681
|
errorSignal.set(snapshot.error);
|
|
@@ -1569,11 +1693,11 @@ class VoiceWorkflowStatusService {
|
|
|
1569
1693
|
unsubscribe();
|
|
1570
1694
|
store.close();
|
|
1571
1695
|
},
|
|
1572
|
-
error:
|
|
1573
|
-
isLoading:
|
|
1696
|
+
error: computed5(() => errorSignal()),
|
|
1697
|
+
isLoading: computed5(() => isLoadingSignal()),
|
|
1574
1698
|
refresh: store.refresh,
|
|
1575
|
-
report:
|
|
1576
|
-
updatedAt:
|
|
1699
|
+
report: computed5(() => reportSignal()),
|
|
1700
|
+
updatedAt: computed5(() => updatedAtSignal())
|
|
1577
1701
|
};
|
|
1578
1702
|
}
|
|
1579
1703
|
}
|
|
@@ -1585,5 +1709,6 @@ export {
|
|
|
1585
1709
|
VoiceWorkflowStatusService,
|
|
1586
1710
|
VoiceStreamService,
|
|
1587
1711
|
VoiceProviderStatusService,
|
|
1588
|
-
VoiceControllerService
|
|
1712
|
+
VoiceControllerService,
|
|
1713
|
+
VoiceAppKitStatusService
|
|
1589
1714
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VoiceAppKitStatusClientOptions } from '../client/appKitStatus';
|
|
2
|
+
import type { VoiceAppKitStatusReport } from '../appKit';
|
|
3
|
+
export declare class VoiceAppKitStatusService {
|
|
4
|
+
connect(path?: string, options?: VoiceAppKitStatusClientOptions): {
|
|
5
|
+
close: () => void;
|
|
6
|
+
error: import("@angular/core").Signal<string | null>;
|
|
7
|
+
isLoading: import("@angular/core").Signal<boolean>;
|
|
8
|
+
refresh: () => Promise<VoiceAppKitStatusReport | undefined>;
|
|
9
|
+
report: import("@angular/core").Signal<VoiceAppKitStatusReport | undefined>;
|
|
10
|
+
updatedAt: import("@angular/core").Signal<number | undefined>;
|
|
11
|
+
};
|
|
12
|
+
}
|
package/dist/appKit.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ import { type VoiceProviderHealthRoutesOptions } from './providerHealth';
|
|
|
8
8
|
import { type VoiceQualityRoutesOptions } from './qualityRoutes';
|
|
9
9
|
import { type VoiceResilienceRoutesOptions } from './resilienceRoutes';
|
|
10
10
|
import { type VoiceSessionListRoutesOptions, type VoiceSessionReplayRoutesOptions } from './sessionReplay';
|
|
11
|
-
import type
|
|
11
|
+
import { type VoiceTraceEventStore } from './trace';
|
|
12
12
|
export type VoiceAppKitSurface = 'assistantHealth' | 'diagnostics' | 'evals' | 'handoffs' | 'opsConsole' | 'providerHealth' | 'quality' | 'resilience' | 'sessionReplay' | 'sessions';
|
|
13
13
|
export type VoiceAppKitLink = VoiceEvalLink & {
|
|
14
14
|
description?: string;
|
|
15
15
|
statusHref?: string;
|
|
16
16
|
};
|
|
17
17
|
export type VoiceAppKitRoutesOptions<TProvider extends string = string> = {
|
|
18
|
+
appStatus?: false | VoiceAppKitStatusOptions;
|
|
18
19
|
assistantHealth?: false | Partial<VoiceAssistantHealthRoutesOptions<TProvider>>;
|
|
19
20
|
diagnostics?: false | Partial<Omit<VoiceDiagnosticsRoutesOptions, 'store'>>;
|
|
20
21
|
evals?: false | Partial<VoiceEvalRoutesOptions>;
|
|
@@ -34,11 +35,49 @@ export type VoiceAppKitRoutesOptions<TProvider extends string = string> = {
|
|
|
34
35
|
title?: string;
|
|
35
36
|
ttsProviders?: readonly string[];
|
|
36
37
|
};
|
|
38
|
+
export type VoiceAppKitStatus = 'pass' | 'fail';
|
|
39
|
+
export type VoiceAppKitStatusOptions = {
|
|
40
|
+
path?: string;
|
|
41
|
+
};
|
|
42
|
+
export type VoiceAppKitStatusReport = {
|
|
43
|
+
checkedAt: number;
|
|
44
|
+
failed: number;
|
|
45
|
+
links: VoiceAppKitLink[];
|
|
46
|
+
passed: number;
|
|
47
|
+
status: VoiceAppKitStatus;
|
|
48
|
+
surfaces: {
|
|
49
|
+
handoffs?: {
|
|
50
|
+
failed: number;
|
|
51
|
+
status: VoiceAppKitStatus;
|
|
52
|
+
total: number;
|
|
53
|
+
};
|
|
54
|
+
providers?: {
|
|
55
|
+
degraded: number;
|
|
56
|
+
status: VoiceAppKitStatus;
|
|
57
|
+
total: number;
|
|
58
|
+
};
|
|
59
|
+
quality?: {
|
|
60
|
+
status: VoiceAppKitStatus;
|
|
61
|
+
};
|
|
62
|
+
sessions?: {
|
|
63
|
+
failed: number;
|
|
64
|
+
status: VoiceAppKitStatus;
|
|
65
|
+
total: number;
|
|
66
|
+
};
|
|
67
|
+
workflows?: {
|
|
68
|
+
failed: number;
|
|
69
|
+
status: VoiceAppKitStatus;
|
|
70
|
+
total: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
total: number;
|
|
74
|
+
};
|
|
37
75
|
export type VoiceAppKitRoutes<TProvider extends string = string> = {
|
|
38
76
|
links: VoiceAppKitLink[];
|
|
39
77
|
routes: Elysia;
|
|
40
78
|
surfaces: VoiceAppKitSurface[];
|
|
41
79
|
use: Elysia['use'];
|
|
42
80
|
};
|
|
81
|
+
export declare const summarizeVoiceAppKitStatus: <TProvider extends string = string>(options: VoiceAppKitRoutesOptions<TProvider>) => Promise<VoiceAppKitStatusReport>;
|
|
43
82
|
export declare const createVoiceAppKitRoutes: <TProvider extends string = string>(options: VoiceAppKitRoutesOptions<TProvider>) => VoiceAppKitRoutes<TProvider>;
|
|
44
83
|
export declare const createVoiceAppKit: <TProvider extends string = string>(options: VoiceAppKitRoutesOptions<TProvider>) => VoiceAppKitRoutes<TProvider>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { VoiceAppKitStatusReport } from '../appKit';
|
|
2
|
+
export type VoiceAppKitStatusClientOptions = {
|
|
3
|
+
fetch?: typeof fetch;
|
|
4
|
+
intervalMs?: number;
|
|
5
|
+
};
|
|
6
|
+
export type VoiceAppKitStatusSnapshot = {
|
|
7
|
+
error: string | null;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
report?: VoiceAppKitStatusReport;
|
|
10
|
+
updatedAt?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const fetchVoiceAppKitStatus: (path?: string, options?: Pick<VoiceAppKitStatusClientOptions, "fetch">) => Promise<VoiceAppKitStatusReport>;
|
|
13
|
+
export declare const createVoiceAppKitStatusStore: (path?: string, options?: VoiceAppKitStatusClientOptions) => {
|
|
14
|
+
close: () => void;
|
|
15
|
+
getServerSnapshot: () => VoiceAppKitStatusSnapshot;
|
|
16
|
+
getSnapshot: () => VoiceAppKitStatusSnapshot;
|
|
17
|
+
refresh: () => Promise<VoiceAppKitStatusReport | undefined>;
|
|
18
|
+
subscribe: (listener: () => void) => () => void;
|
|
19
|
+
};
|
package/dist/client/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export { createVoiceController } from './controller';
|
|
|
5
5
|
export { bindVoiceBargeIn, createVoiceDuplexController } from './duplex';
|
|
6
6
|
export { bindVoiceHTMX } from './htmx';
|
|
7
7
|
export { createMicrophoneCapture } from './microphone';
|
|
8
|
+
export { createVoiceAppKitStatusStore, fetchVoiceAppKitStatus } from './appKitStatus';
|
|
8
9
|
export { createVoiceProviderStatusStore, fetchVoiceProviderStatus } from './providerStatus';
|
|
9
10
|
export { createVoiceWorkflowStatusStore, fetchVoiceWorkflowStatus } from './workflowStatus';
|
|
11
|
+
export type { VoiceAppKitStatusClientOptions, VoiceAppKitStatusSnapshot } from './appKitStatus';
|
|
10
12
|
export type { VoiceProviderStatusClientOptions, VoiceProviderStatusSnapshot } from './providerStatus';
|
|
11
13
|
export type { VoiceWorkflowStatusClientOptions, VoiceWorkflowStatusSnapshot } from './workflowStatus';
|
package/dist/client/index.js
CHANGED
|
@@ -1623,6 +1623,84 @@ var createVoiceDuplexController = (path, options = {}) => {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
};
|
|
1625
1625
|
};
|
|
1626
|
+
// src/client/appKitStatus.ts
|
|
1627
|
+
var fetchVoiceAppKitStatus = async (path = "/app-kit/status", options = {}) => {
|
|
1628
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1629
|
+
const response = await fetchImpl(path);
|
|
1630
|
+
if (!response.ok) {
|
|
1631
|
+
throw new Error(`Voice app kit status failed: HTTP ${response.status}`);
|
|
1632
|
+
}
|
|
1633
|
+
return await response.json();
|
|
1634
|
+
};
|
|
1635
|
+
var createVoiceAppKitStatusStore = (path = "/app-kit/status", options = {}) => {
|
|
1636
|
+
const listeners = new Set;
|
|
1637
|
+
let closed = false;
|
|
1638
|
+
let timer;
|
|
1639
|
+
let snapshot = {
|
|
1640
|
+
error: null,
|
|
1641
|
+
isLoading: false
|
|
1642
|
+
};
|
|
1643
|
+
const emit = () => {
|
|
1644
|
+
for (const listener of listeners) {
|
|
1645
|
+
listener();
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
const refresh = async () => {
|
|
1649
|
+
if (closed) {
|
|
1650
|
+
return snapshot.report;
|
|
1651
|
+
}
|
|
1652
|
+
snapshot = {
|
|
1653
|
+
...snapshot,
|
|
1654
|
+
error: null,
|
|
1655
|
+
isLoading: true
|
|
1656
|
+
};
|
|
1657
|
+
emit();
|
|
1658
|
+
try {
|
|
1659
|
+
const report = await fetchVoiceAppKitStatus(path, options);
|
|
1660
|
+
snapshot = {
|
|
1661
|
+
error: null,
|
|
1662
|
+
isLoading: false,
|
|
1663
|
+
report,
|
|
1664
|
+
updatedAt: Date.now()
|
|
1665
|
+
};
|
|
1666
|
+
emit();
|
|
1667
|
+
return report;
|
|
1668
|
+
} catch (error) {
|
|
1669
|
+
snapshot = {
|
|
1670
|
+
...snapshot,
|
|
1671
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1672
|
+
isLoading: false
|
|
1673
|
+
};
|
|
1674
|
+
emit();
|
|
1675
|
+
throw error;
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
const close = () => {
|
|
1679
|
+
closed = true;
|
|
1680
|
+
if (timer) {
|
|
1681
|
+
clearInterval(timer);
|
|
1682
|
+
timer = undefined;
|
|
1683
|
+
}
|
|
1684
|
+
listeners.clear();
|
|
1685
|
+
};
|
|
1686
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
1687
|
+
timer = setInterval(() => {
|
|
1688
|
+
refresh().catch(() => {});
|
|
1689
|
+
}, options.intervalMs);
|
|
1690
|
+
}
|
|
1691
|
+
return {
|
|
1692
|
+
close,
|
|
1693
|
+
getServerSnapshot: () => snapshot,
|
|
1694
|
+
getSnapshot: () => snapshot,
|
|
1695
|
+
refresh,
|
|
1696
|
+
subscribe: (listener) => {
|
|
1697
|
+
listeners.add(listener);
|
|
1698
|
+
return () => {
|
|
1699
|
+
listeners.delete(listener);
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
};
|
|
1703
|
+
};
|
|
1626
1704
|
// src/client/providerStatus.ts
|
|
1627
1705
|
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
1628
1706
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
@@ -1783,6 +1861,7 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
1783
1861
|
export {
|
|
1784
1862
|
fetchVoiceWorkflowStatus,
|
|
1785
1863
|
fetchVoiceProviderStatus,
|
|
1864
|
+
fetchVoiceAppKitStatus,
|
|
1786
1865
|
decodeVoiceAudioChunk,
|
|
1787
1866
|
createVoiceWorkflowStatusStore,
|
|
1788
1867
|
createVoiceStream,
|
|
@@ -1791,6 +1870,7 @@ export {
|
|
|
1791
1870
|
createVoiceController,
|
|
1792
1871
|
createVoiceConnection,
|
|
1793
1872
|
createVoiceAudioPlayer,
|
|
1873
|
+
createVoiceAppKitStatusStore,
|
|
1794
1874
|
createMicrophoneCapture,
|
|
1795
1875
|
bindVoiceHTMX,
|
|
1796
1876
|
bindVoiceBargeIn
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { voice } from './plugin';
|
|
2
|
-
export { createVoiceAppKit, createVoiceAppKitRoutes } from './appKit';
|
|
2
|
+
export { createVoiceAppKit, createVoiceAppKitRoutes, summarizeVoiceAppKitStatus } from './appKit';
|
|
3
3
|
export { createVoiceAssistant, createVoiceExperiment, summarizeVoiceAssistantRuns } from './assistant';
|
|
4
4
|
export { createVoiceAssistantHealthHTMLHandler, createVoiceAssistantHealthJSONHandler, createVoiceAssistantHealthRoutes, renderVoiceAssistantHealthHTML, summarizeVoiceAssistantHealth } from './assistantHealth';
|
|
5
5
|
export { buildVoiceDiagnosticsMarkdown, createVoiceDiagnosticsRoutes, resolveVoiceDiagnosticsTraceFilter } from './diagnosticsRoutes';
|
|
@@ -38,7 +38,7 @@ export { conditionAudioChunk, resolveAudioConditioningConfig } from './audioCond
|
|
|
38
38
|
export { resolveVoiceRuntimePreset } from './presets';
|
|
39
39
|
export { resolveTurnDetectionConfig, TURN_PROFILE_DEFAULTS } from './turnProfiles';
|
|
40
40
|
export { createVoiceCallReviewFromLiveTelephonyReport, createVoiceCallReviewRecorder, renderVoiceCallReviewHTML, renderVoiceCallReviewMarkdown } from './testing/review';
|
|
41
|
-
export type { VoiceAppKitLink, VoiceAppKitRoutes, VoiceAppKitRoutesOptions, VoiceAppKitSurface } from './appKit';
|
|
41
|
+
export type { VoiceAppKitLink, VoiceAppKitRoutes, VoiceAppKitRoutesOptions, VoiceAppKitStatus, VoiceAppKitStatusOptions, VoiceAppKitStatusReport, VoiceAppKitSurface } from './appKit';
|
|
42
42
|
export type { VoiceAssistant, VoiceAssistantArtifactPlan, VoiceAssistantExperiment, VoiceAssistantExperimentOptions, VoiceAssistantGuardrailInput, VoiceAssistantGuardrails, VoiceAssistantMemoryLifecycle, VoiceAssistantMemoryLifecycleInput, VoiceAssistantOptions, VoiceAssistantOutputGuardrailInput, VoiceAssistantPreset, VoiceAssistantRunsSummary, VoiceAssistantRunSummary, VoiceAssistantVariant } from './assistant';
|
|
43
43
|
export type { VoiceAssistantHealthFailure, VoiceAssistantHealthHTMLHandlerOptions, VoiceAssistantHealthRoutesOptions, VoiceAssistantHealthSummary, VoiceAssistantHealthSummaryOptions } from './assistantHealth';
|
|
44
44
|
export type { VoiceAssistantMemoryBinding, VoiceAssistantMemoryHandle, VoiceAssistantMemoryOptions, VoiceAssistantMemoryRecord, VoiceAssistantMemoryStore } from './assistantMemory';
|