@absolutejs/voice 0.0.22-beta.398 → 0.0.22-beta.399
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 +342 -204
- package/dist/angular/voice-session-snapshot.service.d.ts +13 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +94 -0
- package/dist/client/sessionSnapshot.d.ts +21 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +134 -20
- package/dist/react/useVoiceSessionSnapshot.d.ts +9 -0
- package/dist/svelte/createVoiceSessionSnapshot.d.ts +9 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +96 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +160 -33
- package/dist/vue/useVoiceSessionSnapshot.d.ts +10 -0
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -8106,8 +8106,134 @@ var VoiceTurnQuality = defineComponent13({
|
|
|
8106
8106
|
]);
|
|
8107
8107
|
}
|
|
8108
8108
|
});
|
|
8109
|
+
// src/vue/useVoiceSessionSnapshot.ts
|
|
8110
|
+
import { onUnmounted as onUnmounted14, shallowRef as shallowRef13 } from "vue";
|
|
8111
|
+
|
|
8112
|
+
// src/client/sessionSnapshot.ts
|
|
8113
|
+
var withTurnId = (path, turnId) => {
|
|
8114
|
+
if (!turnId) {
|
|
8115
|
+
return path;
|
|
8116
|
+
}
|
|
8117
|
+
const url = new URL(path, "http://absolutejs.local");
|
|
8118
|
+
url.searchParams.set("turnId", turnId);
|
|
8119
|
+
return `${url.pathname}${url.search}`;
|
|
8120
|
+
};
|
|
8121
|
+
var fetchVoiceSessionSnapshot = async (path, options = {}) => {
|
|
8122
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
8123
|
+
const response = await fetchImpl(withTurnId(path, options.turnId));
|
|
8124
|
+
if (!response.ok) {
|
|
8125
|
+
throw new Error(`Voice session snapshot failed: HTTP ${response.status}`);
|
|
8126
|
+
}
|
|
8127
|
+
return await response.json();
|
|
8128
|
+
};
|
|
8129
|
+
var createVoiceSessionSnapshotStore = (path, options = {}) => {
|
|
8130
|
+
const listeners = new Set;
|
|
8131
|
+
let closed = false;
|
|
8132
|
+
let timer;
|
|
8133
|
+
let snapshot = {
|
|
8134
|
+
error: null,
|
|
8135
|
+
isLoading: false
|
|
8136
|
+
};
|
|
8137
|
+
const emit = () => {
|
|
8138
|
+
for (const listener of listeners) {
|
|
8139
|
+
listener();
|
|
8140
|
+
}
|
|
8141
|
+
};
|
|
8142
|
+
const refresh = async () => {
|
|
8143
|
+
if (closed) {
|
|
8144
|
+
return snapshot.snapshot;
|
|
8145
|
+
}
|
|
8146
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
8147
|
+
emit();
|
|
8148
|
+
try {
|
|
8149
|
+
const next = await fetchVoiceSessionSnapshot(path, options);
|
|
8150
|
+
snapshot = {
|
|
8151
|
+
error: null,
|
|
8152
|
+
isLoading: false,
|
|
8153
|
+
snapshot: next,
|
|
8154
|
+
updatedAt: Date.now()
|
|
8155
|
+
};
|
|
8156
|
+
emit();
|
|
8157
|
+
return next;
|
|
8158
|
+
} catch (error) {
|
|
8159
|
+
snapshot = {
|
|
8160
|
+
...snapshot,
|
|
8161
|
+
error: error instanceof Error ? error.message : String(error),
|
|
8162
|
+
isLoading: false
|
|
8163
|
+
};
|
|
8164
|
+
emit();
|
|
8165
|
+
throw error;
|
|
8166
|
+
}
|
|
8167
|
+
};
|
|
8168
|
+
const download = () => {
|
|
8169
|
+
const current = snapshot.snapshot;
|
|
8170
|
+
if (current === undefined) {
|
|
8171
|
+
throw new Error("Voice session snapshot has not been loaded.");
|
|
8172
|
+
}
|
|
8173
|
+
return new Blob([JSON.stringify(current, null, 2)], {
|
|
8174
|
+
type: "application/json"
|
|
8175
|
+
});
|
|
8176
|
+
};
|
|
8177
|
+
const close = () => {
|
|
8178
|
+
closed = true;
|
|
8179
|
+
if (timer) {
|
|
8180
|
+
clearInterval(timer);
|
|
8181
|
+
timer = undefined;
|
|
8182
|
+
}
|
|
8183
|
+
listeners.clear();
|
|
8184
|
+
};
|
|
8185
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
8186
|
+
timer = setInterval(() => {
|
|
8187
|
+
refresh().catch(() => {});
|
|
8188
|
+
}, options.intervalMs);
|
|
8189
|
+
}
|
|
8190
|
+
return {
|
|
8191
|
+
close,
|
|
8192
|
+
download,
|
|
8193
|
+
getServerSnapshot: () => snapshot,
|
|
8194
|
+
getSnapshot: () => snapshot,
|
|
8195
|
+
refresh,
|
|
8196
|
+
subscribe: (listener) => {
|
|
8197
|
+
listeners.add(listener);
|
|
8198
|
+
return () => {
|
|
8199
|
+
listeners.delete(listener);
|
|
8200
|
+
};
|
|
8201
|
+
}
|
|
8202
|
+
};
|
|
8203
|
+
};
|
|
8204
|
+
|
|
8205
|
+
// src/vue/useVoiceSessionSnapshot.ts
|
|
8206
|
+
function useVoiceSessionSnapshot(path, options = {}) {
|
|
8207
|
+
const store = createVoiceSessionSnapshotStore(path, options);
|
|
8208
|
+
const error = shallowRef13(null);
|
|
8209
|
+
const isLoading = shallowRef13(false);
|
|
8210
|
+
const snapshot = shallowRef13();
|
|
8211
|
+
const updatedAt = shallowRef13(undefined);
|
|
8212
|
+
const sync = () => {
|
|
8213
|
+
const state = store.getSnapshot();
|
|
8214
|
+
error.value = state.error;
|
|
8215
|
+
isLoading.value = state.isLoading;
|
|
8216
|
+
snapshot.value = state.snapshot;
|
|
8217
|
+
updatedAt.value = state.updatedAt;
|
|
8218
|
+
};
|
|
8219
|
+
const unsubscribe = store.subscribe(sync);
|
|
8220
|
+
sync();
|
|
8221
|
+
store.refresh().catch(() => {});
|
|
8222
|
+
onUnmounted14(() => {
|
|
8223
|
+
unsubscribe();
|
|
8224
|
+
store.close();
|
|
8225
|
+
});
|
|
8226
|
+
return {
|
|
8227
|
+
download: store.download,
|
|
8228
|
+
error,
|
|
8229
|
+
isLoading,
|
|
8230
|
+
refresh: store.refresh,
|
|
8231
|
+
snapshot,
|
|
8232
|
+
updatedAt
|
|
8233
|
+
};
|
|
8234
|
+
}
|
|
8109
8235
|
// src/vue/useVoiceProfileComparison.ts
|
|
8110
|
-
import { onUnmounted as
|
|
8236
|
+
import { onUnmounted as onUnmounted15, ref as ref11, shallowRef as shallowRef14 } from "vue";
|
|
8111
8237
|
|
|
8112
8238
|
// src/client/profileComparison.ts
|
|
8113
8239
|
var fetchVoiceProfileComparison = async (path = "/api/voice/real-call-profile-history", options = {}) => {
|
|
@@ -8189,7 +8315,7 @@ function useVoiceProfileComparison(path = "/api/voice/real-call-profile-history"
|
|
|
8189
8315
|
const store = createVoiceProfileComparisonStore(path, options);
|
|
8190
8316
|
const error = ref11(null);
|
|
8191
8317
|
const isLoading = ref11(false);
|
|
8192
|
-
const report =
|
|
8318
|
+
const report = shallowRef14(undefined);
|
|
8193
8319
|
const updatedAt = ref11(undefined);
|
|
8194
8320
|
const sync = () => {
|
|
8195
8321
|
const snapshot = store.getSnapshot();
|
|
@@ -8203,7 +8329,7 @@ function useVoiceProfileComparison(path = "/api/voice/real-call-profile-history"
|
|
|
8203
8329
|
if (typeof window !== "undefined") {
|
|
8204
8330
|
store.refresh().catch(() => {});
|
|
8205
8331
|
}
|
|
8206
|
-
|
|
8332
|
+
onUnmounted15(() => {
|
|
8207
8333
|
unsubscribe();
|
|
8208
8334
|
store.close();
|
|
8209
8335
|
});
|
|
@@ -8216,7 +8342,7 @@ function useVoiceProfileComparison(path = "/api/voice/real-call-profile-history"
|
|
|
8216
8342
|
};
|
|
8217
8343
|
}
|
|
8218
8344
|
// src/vue/useVoiceLiveOps.ts
|
|
8219
|
-
import { onUnmounted as
|
|
8345
|
+
import { onUnmounted as onUnmounted16, ref as ref12, shallowRef as shallowRef15 } from "vue";
|
|
8220
8346
|
|
|
8221
8347
|
// src/client/liveOps.ts
|
|
8222
8348
|
var postVoiceLiveOpsAction = async (input, options = {}) => {
|
|
@@ -8309,7 +8435,7 @@ function useVoiceLiveOps(options = {}) {
|
|
|
8309
8435
|
const store = createVoiceLiveOpsStore(options);
|
|
8310
8436
|
const error = ref12(null);
|
|
8311
8437
|
const isRunning = ref12(false);
|
|
8312
|
-
const lastResult =
|
|
8438
|
+
const lastResult = shallowRef15(undefined);
|
|
8313
8439
|
const runningAction = ref12(undefined);
|
|
8314
8440
|
const updatedAt = ref12(undefined);
|
|
8315
8441
|
const sync = () => {
|
|
@@ -8322,7 +8448,7 @@ function useVoiceLiveOps(options = {}) {
|
|
|
8322
8448
|
};
|
|
8323
8449
|
const unsubscribe = store.subscribe(sync);
|
|
8324
8450
|
sync();
|
|
8325
|
-
|
|
8451
|
+
onUnmounted16(() => {
|
|
8326
8452
|
unsubscribe();
|
|
8327
8453
|
store.close();
|
|
8328
8454
|
});
|
|
@@ -8336,7 +8462,7 @@ function useVoiceLiveOps(options = {}) {
|
|
|
8336
8462
|
};
|
|
8337
8463
|
}
|
|
8338
8464
|
// src/vue/useVoiceCampaignDialerProof.ts
|
|
8339
|
-
import { onUnmounted as
|
|
8465
|
+
import { onUnmounted as onUnmounted17, shallowRef as shallowRef16 } from "vue";
|
|
8340
8466
|
|
|
8341
8467
|
// src/client/campaignDialerProof.ts
|
|
8342
8468
|
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
@@ -8459,11 +8585,11 @@ var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-p
|
|
|
8459
8585
|
// src/vue/useVoiceCampaignDialerProof.ts
|
|
8460
8586
|
function useVoiceCampaignDialerProof(path = "/api/voice/campaigns/dialer-proof", options = {}) {
|
|
8461
8587
|
const store = createVoiceCampaignDialerProofStore(path, options);
|
|
8462
|
-
const error =
|
|
8463
|
-
const isLoading =
|
|
8464
|
-
const report =
|
|
8465
|
-
const status =
|
|
8466
|
-
const updatedAt =
|
|
8588
|
+
const error = shallowRef16(null);
|
|
8589
|
+
const isLoading = shallowRef16(false);
|
|
8590
|
+
const report = shallowRef16();
|
|
8591
|
+
const status = shallowRef16();
|
|
8592
|
+
const updatedAt = shallowRef16(undefined);
|
|
8467
8593
|
const sync = () => {
|
|
8468
8594
|
const snapshot = store.getSnapshot();
|
|
8469
8595
|
error.value = snapshot.error;
|
|
@@ -8477,7 +8603,7 @@ function useVoiceCampaignDialerProof(path = "/api/voice/campaigns/dialer-proof",
|
|
|
8477
8603
|
if (typeof window !== "undefined") {
|
|
8478
8604
|
store.refresh().catch(() => {});
|
|
8479
8605
|
}
|
|
8480
|
-
|
|
8606
|
+
onUnmounted17(() => {
|
|
8481
8607
|
unsubscribe();
|
|
8482
8608
|
store.close();
|
|
8483
8609
|
});
|
|
@@ -8492,7 +8618,7 @@ function useVoiceCampaignDialerProof(path = "/api/voice/campaigns/dialer-proof",
|
|
|
8492
8618
|
};
|
|
8493
8619
|
}
|
|
8494
8620
|
// src/vue/useVoiceStream.ts
|
|
8495
|
-
import { onUnmounted as
|
|
8621
|
+
import { onUnmounted as onUnmounted18, ref as ref13, shallowRef as shallowRef17 } from "vue";
|
|
8496
8622
|
|
|
8497
8623
|
// src/client/actions.ts
|
|
8498
8624
|
var normalizeErrorMessage = (value) => {
|
|
@@ -9887,17 +10013,17 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
9887
10013
|
// src/vue/useVoiceStream.ts
|
|
9888
10014
|
function useVoiceStream(path, options = {}) {
|
|
9889
10015
|
const stream = createVoiceStream(path, options);
|
|
9890
|
-
const assistantAudio =
|
|
9891
|
-
const assistantTexts =
|
|
9892
|
-
const call =
|
|
10016
|
+
const assistantAudio = shallowRef17([]);
|
|
10017
|
+
const assistantTexts = shallowRef17([]);
|
|
10018
|
+
const call = shallowRef17(null);
|
|
9893
10019
|
const error = ref13(null);
|
|
9894
10020
|
const isConnected = ref13(false);
|
|
9895
10021
|
const partial = ref13("");
|
|
9896
|
-
const reconnect =
|
|
10022
|
+
const reconnect = shallowRef17(stream.reconnect);
|
|
9897
10023
|
const sessionId = ref13(stream.sessionId);
|
|
9898
|
-
const sessionMetadata =
|
|
10024
|
+
const sessionMetadata = shallowRef17(stream.sessionMetadata);
|
|
9899
10025
|
const status = ref13(stream.status);
|
|
9900
|
-
const turns =
|
|
10026
|
+
const turns = shallowRef17([]);
|
|
9901
10027
|
const sync = () => {
|
|
9902
10028
|
assistantAudio.value = [...stream.assistantAudio];
|
|
9903
10029
|
assistantTexts.value = [...stream.assistantTexts];
|
|
@@ -9917,7 +10043,7 @@ function useVoiceStream(path, options = {}) {
|
|
|
9917
10043
|
unsubscribe();
|
|
9918
10044
|
stream.close();
|
|
9919
10045
|
};
|
|
9920
|
-
|
|
10046
|
+
onUnmounted18(destroy);
|
|
9921
10047
|
return {
|
|
9922
10048
|
assistantAudio,
|
|
9923
10049
|
assistantTexts,
|
|
@@ -9937,7 +10063,7 @@ function useVoiceStream(path, options = {}) {
|
|
|
9937
10063
|
};
|
|
9938
10064
|
}
|
|
9939
10065
|
// src/vue/useVoiceController.ts
|
|
9940
|
-
import { onUnmounted as
|
|
10066
|
+
import { onUnmounted as onUnmounted19, ref as ref14, shallowRef as shallowRef18 } from "vue";
|
|
9941
10067
|
|
|
9942
10068
|
// src/client/htmx.ts
|
|
9943
10069
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -10588,17 +10714,17 @@ var createVoiceController = (path, options = {}) => {
|
|
|
10588
10714
|
// src/vue/useVoiceController.ts
|
|
10589
10715
|
function useVoiceController(path, options = {}) {
|
|
10590
10716
|
const controller = createVoiceController(path, options);
|
|
10591
|
-
const assistantAudio =
|
|
10592
|
-
const assistantTexts =
|
|
10717
|
+
const assistantAudio = shallowRef18([]);
|
|
10718
|
+
const assistantTexts = shallowRef18([]);
|
|
10593
10719
|
const error = ref14(null);
|
|
10594
10720
|
const isConnected = ref14(false);
|
|
10595
10721
|
const isRecording = ref14(false);
|
|
10596
10722
|
const partial = ref14("");
|
|
10597
|
-
const reconnect =
|
|
10723
|
+
const reconnect = shallowRef18(controller.reconnect);
|
|
10598
10724
|
const recordingError = ref14(null);
|
|
10599
10725
|
const sessionId = ref14(controller.sessionId);
|
|
10600
10726
|
const status = ref14(controller.status);
|
|
10601
|
-
const turns =
|
|
10727
|
+
const turns = shallowRef18([]);
|
|
10602
10728
|
const sync = () => {
|
|
10603
10729
|
assistantAudio.value = [...controller.assistantAudio];
|
|
10604
10730
|
assistantTexts.value = [...controller.assistantTexts];
|
|
@@ -10618,7 +10744,7 @@ function useVoiceController(path, options = {}) {
|
|
|
10618
10744
|
unsubscribe();
|
|
10619
10745
|
controller.close();
|
|
10620
10746
|
};
|
|
10621
|
-
|
|
10747
|
+
onUnmounted19(destroy);
|
|
10622
10748
|
return {
|
|
10623
10749
|
assistantAudio,
|
|
10624
10750
|
assistantTexts,
|
|
@@ -10641,12 +10767,12 @@ function useVoiceController(path, options = {}) {
|
|
|
10641
10767
|
};
|
|
10642
10768
|
}
|
|
10643
10769
|
// src/vue/useVoiceTraceTimeline.ts
|
|
10644
|
-
import { onUnmounted as
|
|
10770
|
+
import { onUnmounted as onUnmounted20, ref as ref15, shallowRef as shallowRef19 } from "vue";
|
|
10645
10771
|
function useVoiceTraceTimeline(path = "/api/voice-traces", options = {}) {
|
|
10646
10772
|
const store = createVoiceTraceTimelineStore(path, options);
|
|
10647
10773
|
const error = ref15(null);
|
|
10648
10774
|
const isLoading = ref15(false);
|
|
10649
|
-
const report =
|
|
10775
|
+
const report = shallowRef19(null);
|
|
10650
10776
|
const updatedAt = ref15(undefined);
|
|
10651
10777
|
const sync = () => {
|
|
10652
10778
|
const snapshot = store.getSnapshot();
|
|
@@ -10658,7 +10784,7 @@ function useVoiceTraceTimeline(path = "/api/voice-traces", options = {}) {
|
|
|
10658
10784
|
const unsubscribe = store.subscribe(sync);
|
|
10659
10785
|
sync();
|
|
10660
10786
|
store.refresh().catch(() => {});
|
|
10661
|
-
|
|
10787
|
+
onUnmounted20(() => {
|
|
10662
10788
|
unsubscribe();
|
|
10663
10789
|
store.close();
|
|
10664
10790
|
});
|
|
@@ -10671,7 +10797,7 @@ function useVoiceTraceTimeline(path = "/api/voice-traces", options = {}) {
|
|
|
10671
10797
|
};
|
|
10672
10798
|
}
|
|
10673
10799
|
// src/vue/useVoiceWorkflowStatus.ts
|
|
10674
|
-
import { onUnmounted as
|
|
10800
|
+
import { onUnmounted as onUnmounted21, ref as ref16, shallowRef as shallowRef20 } from "vue";
|
|
10675
10801
|
|
|
10676
10802
|
// src/client/workflowStatus.ts
|
|
10677
10803
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -10757,7 +10883,7 @@ function useVoiceWorkflowStatus(path = "/evals/scenarios/json", options = {}) {
|
|
|
10757
10883
|
const store = createVoiceWorkflowStatusStore(path, options);
|
|
10758
10884
|
const error = ref16(null);
|
|
10759
10885
|
const isLoading = ref16(false);
|
|
10760
|
-
const report =
|
|
10886
|
+
const report = shallowRef20(undefined);
|
|
10761
10887
|
const updatedAt = ref16(undefined);
|
|
10762
10888
|
const sync = () => {
|
|
10763
10889
|
const snapshot = store.getSnapshot();
|
|
@@ -10771,7 +10897,7 @@ function useVoiceWorkflowStatus(path = "/evals/scenarios/json", options = {}) {
|
|
|
10771
10897
|
if (typeof window !== "undefined") {
|
|
10772
10898
|
store.refresh().catch(() => {});
|
|
10773
10899
|
}
|
|
10774
|
-
|
|
10900
|
+
onUnmounted21(() => {
|
|
10775
10901
|
unsubscribe();
|
|
10776
10902
|
store.close();
|
|
10777
10903
|
});
|
|
@@ -10789,6 +10915,7 @@ export {
|
|
|
10789
10915
|
useVoiceTurnLatency,
|
|
10790
10916
|
useVoiceTraceTimeline,
|
|
10791
10917
|
useVoiceStream,
|
|
10918
|
+
useVoiceSessionSnapshot,
|
|
10792
10919
|
useVoiceRoutingStatus,
|
|
10793
10920
|
useVoiceReadinessFailures,
|
|
10794
10921
|
useVoiceProviderStatus,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VoiceSessionSnapshotClientOptions } from '../client/sessionSnapshot';
|
|
2
|
+
import type { VoiceSessionSnapshot } from '../sessionSnapshot';
|
|
3
|
+
export declare function useVoiceSessionSnapshot(path: string, options?: VoiceSessionSnapshotClientOptions): {
|
|
4
|
+
download: () => Blob;
|
|
5
|
+
error: import("vue").ShallowRef<string | null, string | null>;
|
|
6
|
+
isLoading: import("vue").ShallowRef<boolean, boolean>;
|
|
7
|
+
refresh: () => Promise<VoiceSessionSnapshot | undefined>;
|
|
8
|
+
snapshot: import("vue").ShallowRef<VoiceSessionSnapshot | undefined, VoiceSessionSnapshot | undefined>;
|
|
9
|
+
updatedAt: import("vue").ShallowRef<number | undefined, number | undefined>;
|
|
10
|
+
};
|