@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/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()) {
|
|
@@ -588,15 +701,15 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
588
701
|
// src/vue/useVoiceStream.ts
|
|
589
702
|
var useVoiceStream = (path, options = {}) => {
|
|
590
703
|
const stream = createVoiceStream(path, options);
|
|
591
|
-
const assistantAudio =
|
|
592
|
-
const assistantTexts =
|
|
593
|
-
const call =
|
|
594
|
-
const error =
|
|
595
|
-
const isConnected =
|
|
596
|
-
const partial =
|
|
597
|
-
const sessionId =
|
|
598
|
-
const status =
|
|
599
|
-
const turns =
|
|
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([]);
|
|
600
713
|
const sync = () => {
|
|
601
714
|
assistantAudio.value = [...stream.assistantAudio];
|
|
602
715
|
assistantTexts.value = [...stream.assistantTexts];
|
|
@@ -614,7 +727,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
614
727
|
unsubscribe();
|
|
615
728
|
stream.close();
|
|
616
729
|
};
|
|
617
|
-
|
|
730
|
+
onUnmounted2(destroy);
|
|
618
731
|
return {
|
|
619
732
|
assistantAudio,
|
|
620
733
|
assistantTexts,
|
|
@@ -632,7 +745,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
632
745
|
};
|
|
633
746
|
};
|
|
634
747
|
// src/vue/useVoiceController.ts
|
|
635
|
-
import { onUnmounted as
|
|
748
|
+
import { onUnmounted as onUnmounted3, ref as ref3, shallowRef as shallowRef3 } from "vue";
|
|
636
749
|
|
|
637
750
|
// src/client/htmx.ts
|
|
638
751
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -1267,16 +1380,16 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1267
1380
|
// src/vue/useVoiceController.ts
|
|
1268
1381
|
var useVoiceController = (path, options = {}) => {
|
|
1269
1382
|
const controller = createVoiceController(path, options);
|
|
1270
|
-
const assistantAudio =
|
|
1271
|
-
const assistantTexts =
|
|
1272
|
-
const error =
|
|
1273
|
-
const isConnected =
|
|
1274
|
-
const isRecording =
|
|
1275
|
-
const partial =
|
|
1276
|
-
const recordingError =
|
|
1277
|
-
const sessionId =
|
|
1278
|
-
const status =
|
|
1279
|
-
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([]);
|
|
1280
1393
|
const sync = () => {
|
|
1281
1394
|
assistantAudio.value = [...controller.assistantAudio];
|
|
1282
1395
|
assistantTexts.value = [...controller.assistantTexts];
|
|
@@ -1295,7 +1408,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
1295
1408
|
unsubscribe();
|
|
1296
1409
|
controller.close();
|
|
1297
1410
|
};
|
|
1298
|
-
|
|
1411
|
+
onUnmounted3(destroy);
|
|
1299
1412
|
return {
|
|
1300
1413
|
assistantAudio,
|
|
1301
1414
|
assistantTexts,
|
|
@@ -1317,7 +1430,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
1317
1430
|
};
|
|
1318
1431
|
};
|
|
1319
1432
|
// src/vue/useVoiceProviderStatus.ts
|
|
1320
|
-
import { onUnmounted as
|
|
1433
|
+
import { onUnmounted as onUnmounted4, ref as ref4, shallowRef as shallowRef4 } from "vue";
|
|
1321
1434
|
|
|
1322
1435
|
// src/client/providerStatus.ts
|
|
1323
1436
|
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
@@ -1402,10 +1515,10 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1402
1515
|
// src/vue/useVoiceProviderStatus.ts
|
|
1403
1516
|
var useVoiceProviderStatus = (path = "/api/provider-status", options = {}) => {
|
|
1404
1517
|
const store = createVoiceProviderStatusStore(path, options);
|
|
1405
|
-
const error =
|
|
1406
|
-
const isLoading =
|
|
1407
|
-
const providers =
|
|
1408
|
-
const updatedAt =
|
|
1518
|
+
const error = ref4(null);
|
|
1519
|
+
const isLoading = ref4(false);
|
|
1520
|
+
const providers = shallowRef4([]);
|
|
1521
|
+
const updatedAt = ref4(undefined);
|
|
1409
1522
|
const sync = () => {
|
|
1410
1523
|
const snapshot = store.getSnapshot();
|
|
1411
1524
|
error.value = snapshot.error;
|
|
@@ -1416,7 +1529,7 @@ var useVoiceProviderStatus = (path = "/api/provider-status", options = {}) => {
|
|
|
1416
1529
|
const unsubscribe = store.subscribe(sync);
|
|
1417
1530
|
sync();
|
|
1418
1531
|
store.refresh().catch(() => {});
|
|
1419
|
-
|
|
1532
|
+
onUnmounted4(() => {
|
|
1420
1533
|
unsubscribe();
|
|
1421
1534
|
store.close();
|
|
1422
1535
|
});
|
|
@@ -1429,7 +1542,7 @@ var useVoiceProviderStatus = (path = "/api/provider-status", options = {}) => {
|
|
|
1429
1542
|
};
|
|
1430
1543
|
};
|
|
1431
1544
|
// src/vue/useVoiceWorkflowStatus.ts
|
|
1432
|
-
import { onUnmounted as
|
|
1545
|
+
import { onUnmounted as onUnmounted5, ref as ref5, shallowRef as shallowRef5 } from "vue";
|
|
1433
1546
|
|
|
1434
1547
|
// src/client/workflowStatus.ts
|
|
1435
1548
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -1513,10 +1626,10 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
1513
1626
|
// src/vue/useVoiceWorkflowStatus.ts
|
|
1514
1627
|
var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
|
|
1515
1628
|
const store = createVoiceWorkflowStatusStore(path, options);
|
|
1516
|
-
const error =
|
|
1517
|
-
const isLoading =
|
|
1518
|
-
const report =
|
|
1519
|
-
const updatedAt =
|
|
1629
|
+
const error = ref5(null);
|
|
1630
|
+
const isLoading = ref5(false);
|
|
1631
|
+
const report = shallowRef5(undefined);
|
|
1632
|
+
const updatedAt = ref5(undefined);
|
|
1520
1633
|
const sync = () => {
|
|
1521
1634
|
const snapshot = store.getSnapshot();
|
|
1522
1635
|
error.value = snapshot.error;
|
|
@@ -1529,7 +1642,7 @@ var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
|
|
|
1529
1642
|
if (typeof window !== "undefined") {
|
|
1530
1643
|
store.refresh().catch(() => {});
|
|
1531
1644
|
}
|
|
1532
|
-
|
|
1645
|
+
onUnmounted5(() => {
|
|
1533
1646
|
unsubscribe();
|
|
1534
1647
|
store.close();
|
|
1535
1648
|
});
|
|
@@ -1545,5 +1658,6 @@ export {
|
|
|
1545
1658
|
useVoiceWorkflowStatus,
|
|
1546
1659
|
useVoiceStream,
|
|
1547
1660
|
useVoiceProviderStatus,
|
|
1548
|
-
useVoiceController
|
|
1661
|
+
useVoiceController,
|
|
1662
|
+
useVoiceAppKitStatus
|
|
1549
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
|
+
};
|