@absolutejs/voice 0.0.22-beta.189 → 0.0.22-beta.190
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 +277 -148
- package/dist/angular/voice-live-ops.service.d.ts +11 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +1385 -105
- package/dist/client/liveOps.d.ts +22 -0
- package/dist/client/liveOpsWidget.d.ts +23 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +252 -59
- package/dist/liveOps.d.ts +122 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +119 -16
- package/dist/react/useVoiceLiveOps.d.ts +9 -0
- package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +1389 -101
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +165 -44
- package/dist/vue/useVoiceLiveOps.d.ts +9 -0
- package/package.json +1 -1
package/dist/vue/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { VoiceTurnLatency } from './VoiceTurnLatency';
|
|
|
10
10
|
export { VoiceTurnQuality } from './VoiceTurnQuality';
|
|
11
11
|
export { useVoiceOpsStatus } from './useVoiceOpsStatus';
|
|
12
12
|
export { useVoiceOpsActionCenter } from './useVoiceOpsActionCenter';
|
|
13
|
+
export { useVoiceLiveOps } from './useVoiceLiveOps';
|
|
13
14
|
export { useVoiceDeliveryRuntime } from './useVoiceDeliveryRuntime';
|
|
14
15
|
export { useVoiceCampaignDialerProof } from './useVoiceCampaignDialerProof';
|
|
15
16
|
export { useVoiceStream } from './useVoiceStream';
|
package/dist/vue/index.js
CHANGED
|
@@ -3152,8 +3152,128 @@ var VoiceTurnQuality = defineComponent10({
|
|
|
3152
3152
|
]);
|
|
3153
3153
|
}
|
|
3154
3154
|
});
|
|
3155
|
+
// src/vue/useVoiceLiveOps.ts
|
|
3156
|
+
import { onUnmounted as onUnmounted11, ref as ref7, shallowRef as shallowRef10 } from "vue";
|
|
3157
|
+
|
|
3158
|
+
// src/client/liveOps.ts
|
|
3159
|
+
var postVoiceLiveOpsAction = async (input, options = {}) => {
|
|
3160
|
+
if (!input.sessionId) {
|
|
3161
|
+
throw new Error("Start a voice session before running live ops actions.");
|
|
3162
|
+
}
|
|
3163
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3164
|
+
const response = await fetchImpl(options.actionPath ?? "/api/voice/live-ops/action", {
|
|
3165
|
+
body: JSON.stringify(input),
|
|
3166
|
+
headers: {
|
|
3167
|
+
"Content-Type": "application/json"
|
|
3168
|
+
},
|
|
3169
|
+
method: "POST"
|
|
3170
|
+
});
|
|
3171
|
+
const payload = await response.json().catch(() => null);
|
|
3172
|
+
if (!response.ok || !payload?.ok) {
|
|
3173
|
+
const message = payload && typeof payload === "object" && "error" in payload ? String(payload.error) : `Voice live ops action failed: HTTP ${response.status}`;
|
|
3174
|
+
throw new Error(message);
|
|
3175
|
+
}
|
|
3176
|
+
return payload;
|
|
3177
|
+
};
|
|
3178
|
+
var createVoiceLiveOpsStore = (options = {}) => {
|
|
3179
|
+
const listeners = new Set;
|
|
3180
|
+
let closed = false;
|
|
3181
|
+
let snapshot = {
|
|
3182
|
+
error: null,
|
|
3183
|
+
isRunning: false
|
|
3184
|
+
};
|
|
3185
|
+
const emit = () => {
|
|
3186
|
+
for (const listener of listeners) {
|
|
3187
|
+
listener();
|
|
3188
|
+
}
|
|
3189
|
+
};
|
|
3190
|
+
const run = async (input) => {
|
|
3191
|
+
if (closed) {
|
|
3192
|
+
return snapshot.lastResult;
|
|
3193
|
+
}
|
|
3194
|
+
snapshot = {
|
|
3195
|
+
...snapshot,
|
|
3196
|
+
error: null,
|
|
3197
|
+
isRunning: true,
|
|
3198
|
+
runningAction: input.action
|
|
3199
|
+
};
|
|
3200
|
+
emit();
|
|
3201
|
+
try {
|
|
3202
|
+
const result = await postVoiceLiveOpsAction(input, options);
|
|
3203
|
+
await options.onControl?.(result);
|
|
3204
|
+
snapshot = {
|
|
3205
|
+
...snapshot,
|
|
3206
|
+
error: null,
|
|
3207
|
+
isRunning: false,
|
|
3208
|
+
lastResult: result,
|
|
3209
|
+
runningAction: undefined,
|
|
3210
|
+
updatedAt: Date.now()
|
|
3211
|
+
};
|
|
3212
|
+
emit();
|
|
3213
|
+
return result;
|
|
3214
|
+
} catch (error) {
|
|
3215
|
+
snapshot = {
|
|
3216
|
+
...snapshot,
|
|
3217
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3218
|
+
isRunning: false,
|
|
3219
|
+
runningAction: undefined,
|
|
3220
|
+
updatedAt: Date.now()
|
|
3221
|
+
};
|
|
3222
|
+
emit();
|
|
3223
|
+
throw error;
|
|
3224
|
+
}
|
|
3225
|
+
};
|
|
3226
|
+
const close = () => {
|
|
3227
|
+
closed = true;
|
|
3228
|
+
listeners.clear();
|
|
3229
|
+
};
|
|
3230
|
+
return {
|
|
3231
|
+
close,
|
|
3232
|
+
getServerSnapshot: () => snapshot,
|
|
3233
|
+
getSnapshot: () => snapshot,
|
|
3234
|
+
run,
|
|
3235
|
+
subscribe: (listener) => {
|
|
3236
|
+
listeners.add(listener);
|
|
3237
|
+
return () => {
|
|
3238
|
+
listeners.delete(listener);
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
};
|
|
3242
|
+
};
|
|
3243
|
+
|
|
3244
|
+
// src/vue/useVoiceLiveOps.ts
|
|
3245
|
+
function useVoiceLiveOps(options = {}) {
|
|
3246
|
+
const store = createVoiceLiveOpsStore(options);
|
|
3247
|
+
const error = ref7(null);
|
|
3248
|
+
const isRunning = ref7(false);
|
|
3249
|
+
const lastResult = shallowRef10(undefined);
|
|
3250
|
+
const runningAction = ref7(undefined);
|
|
3251
|
+
const updatedAt = ref7(undefined);
|
|
3252
|
+
const sync = () => {
|
|
3253
|
+
const snapshot = store.getSnapshot();
|
|
3254
|
+
error.value = snapshot.error;
|
|
3255
|
+
isRunning.value = snapshot.isRunning;
|
|
3256
|
+
lastResult.value = snapshot.lastResult;
|
|
3257
|
+
runningAction.value = snapshot.runningAction;
|
|
3258
|
+
updatedAt.value = snapshot.updatedAt;
|
|
3259
|
+
};
|
|
3260
|
+
const unsubscribe = store.subscribe(sync);
|
|
3261
|
+
sync();
|
|
3262
|
+
onUnmounted11(() => {
|
|
3263
|
+
unsubscribe();
|
|
3264
|
+
store.close();
|
|
3265
|
+
});
|
|
3266
|
+
return {
|
|
3267
|
+
error,
|
|
3268
|
+
isRunning,
|
|
3269
|
+
lastResult,
|
|
3270
|
+
run: store.run,
|
|
3271
|
+
runningAction,
|
|
3272
|
+
updatedAt
|
|
3273
|
+
};
|
|
3274
|
+
}
|
|
3155
3275
|
// src/vue/useVoiceCampaignDialerProof.ts
|
|
3156
|
-
import { onUnmounted as
|
|
3276
|
+
import { onUnmounted as onUnmounted12, shallowRef as shallowRef11 } from "vue";
|
|
3157
3277
|
|
|
3158
3278
|
// src/client/campaignDialerProof.ts
|
|
3159
3279
|
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
@@ -3276,11 +3396,11 @@ var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-p
|
|
|
3276
3396
|
// src/vue/useVoiceCampaignDialerProof.ts
|
|
3277
3397
|
function useVoiceCampaignDialerProof(path = "/api/voice/campaigns/dialer-proof", options = {}) {
|
|
3278
3398
|
const store = createVoiceCampaignDialerProofStore(path, options);
|
|
3279
|
-
const error =
|
|
3280
|
-
const isLoading =
|
|
3281
|
-
const report =
|
|
3282
|
-
const status =
|
|
3283
|
-
const updatedAt =
|
|
3399
|
+
const error = shallowRef11(null);
|
|
3400
|
+
const isLoading = shallowRef11(false);
|
|
3401
|
+
const report = shallowRef11();
|
|
3402
|
+
const status = shallowRef11();
|
|
3403
|
+
const updatedAt = shallowRef11(undefined);
|
|
3284
3404
|
const sync = () => {
|
|
3285
3405
|
const snapshot = store.getSnapshot();
|
|
3286
3406
|
error.value = snapshot.error;
|
|
@@ -3294,7 +3414,7 @@ function useVoiceCampaignDialerProof(path = "/api/voice/campaigns/dialer-proof",
|
|
|
3294
3414
|
if (typeof window !== "undefined") {
|
|
3295
3415
|
store.refresh().catch(() => {});
|
|
3296
3416
|
}
|
|
3297
|
-
|
|
3417
|
+
onUnmounted12(() => {
|
|
3298
3418
|
unsubscribe();
|
|
3299
3419
|
store.close();
|
|
3300
3420
|
});
|
|
@@ -3309,7 +3429,7 @@ function useVoiceCampaignDialerProof(path = "/api/voice/campaigns/dialer-proof",
|
|
|
3309
3429
|
};
|
|
3310
3430
|
}
|
|
3311
3431
|
// src/vue/useVoiceStream.ts
|
|
3312
|
-
import { onUnmounted as
|
|
3432
|
+
import { onUnmounted as onUnmounted13, ref as ref8, shallowRef as shallowRef12 } from "vue";
|
|
3313
3433
|
|
|
3314
3434
|
// src/client/actions.ts
|
|
3315
3435
|
var normalizeErrorMessage = (value) => {
|
|
@@ -3954,16 +4074,16 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
3954
4074
|
// src/vue/useVoiceStream.ts
|
|
3955
4075
|
function useVoiceStream(path, options = {}) {
|
|
3956
4076
|
const stream = createVoiceStream(path, options);
|
|
3957
|
-
const assistantAudio =
|
|
3958
|
-
const assistantTexts =
|
|
3959
|
-
const call =
|
|
3960
|
-
const error =
|
|
3961
|
-
const isConnected =
|
|
3962
|
-
const partial =
|
|
3963
|
-
const reconnect =
|
|
3964
|
-
const sessionId =
|
|
3965
|
-
const status =
|
|
3966
|
-
const turns =
|
|
4077
|
+
const assistantAudio = shallowRef12([]);
|
|
4078
|
+
const assistantTexts = shallowRef12([]);
|
|
4079
|
+
const call = shallowRef12(null);
|
|
4080
|
+
const error = ref8(null);
|
|
4081
|
+
const isConnected = ref8(false);
|
|
4082
|
+
const partial = ref8("");
|
|
4083
|
+
const reconnect = shallowRef12(stream.reconnect);
|
|
4084
|
+
const sessionId = ref8(stream.sessionId);
|
|
4085
|
+
const status = ref8(stream.status);
|
|
4086
|
+
const turns = shallowRef12([]);
|
|
3967
4087
|
const sync = () => {
|
|
3968
4088
|
assistantAudio.value = [...stream.assistantAudio];
|
|
3969
4089
|
assistantTexts.value = [...stream.assistantTexts];
|
|
@@ -3982,7 +4102,7 @@ function useVoiceStream(path, options = {}) {
|
|
|
3982
4102
|
unsubscribe();
|
|
3983
4103
|
stream.close();
|
|
3984
4104
|
};
|
|
3985
|
-
|
|
4105
|
+
onUnmounted13(destroy);
|
|
3986
4106
|
return {
|
|
3987
4107
|
assistantAudio,
|
|
3988
4108
|
assistantTexts,
|
|
@@ -4001,7 +4121,7 @@ function useVoiceStream(path, options = {}) {
|
|
|
4001
4121
|
};
|
|
4002
4122
|
}
|
|
4003
4123
|
// src/vue/useVoiceController.ts
|
|
4004
|
-
import { onUnmounted as
|
|
4124
|
+
import { onUnmounted as onUnmounted14, ref as ref9, shallowRef as shallowRef13 } from "vue";
|
|
4005
4125
|
|
|
4006
4126
|
// src/client/htmx.ts
|
|
4007
4127
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -4647,17 +4767,17 @@ var createVoiceController = (path, options = {}) => {
|
|
|
4647
4767
|
// src/vue/useVoiceController.ts
|
|
4648
4768
|
function useVoiceController(path, options = {}) {
|
|
4649
4769
|
const controller = createVoiceController(path, options);
|
|
4650
|
-
const assistantAudio =
|
|
4651
|
-
const assistantTexts =
|
|
4652
|
-
const error =
|
|
4653
|
-
const isConnected =
|
|
4654
|
-
const isRecording =
|
|
4655
|
-
const partial =
|
|
4656
|
-
const reconnect =
|
|
4657
|
-
const recordingError =
|
|
4658
|
-
const sessionId =
|
|
4659
|
-
const status =
|
|
4660
|
-
const turns =
|
|
4770
|
+
const assistantAudio = shallowRef13([]);
|
|
4771
|
+
const assistantTexts = shallowRef13([]);
|
|
4772
|
+
const error = ref9(null);
|
|
4773
|
+
const isConnected = ref9(false);
|
|
4774
|
+
const isRecording = ref9(false);
|
|
4775
|
+
const partial = ref9("");
|
|
4776
|
+
const reconnect = shallowRef13(controller.reconnect);
|
|
4777
|
+
const recordingError = ref9(null);
|
|
4778
|
+
const sessionId = ref9(controller.sessionId);
|
|
4779
|
+
const status = ref9(controller.status);
|
|
4780
|
+
const turns = shallowRef13([]);
|
|
4661
4781
|
const sync = () => {
|
|
4662
4782
|
assistantAudio.value = [...controller.assistantAudio];
|
|
4663
4783
|
assistantTexts.value = [...controller.assistantTexts];
|
|
@@ -4677,7 +4797,7 @@ function useVoiceController(path, options = {}) {
|
|
|
4677
4797
|
unsubscribe();
|
|
4678
4798
|
controller.close();
|
|
4679
4799
|
};
|
|
4680
|
-
|
|
4800
|
+
onUnmounted14(destroy);
|
|
4681
4801
|
return {
|
|
4682
4802
|
assistantAudio,
|
|
4683
4803
|
assistantTexts,
|
|
@@ -4700,7 +4820,7 @@ function useVoiceController(path, options = {}) {
|
|
|
4700
4820
|
};
|
|
4701
4821
|
}
|
|
4702
4822
|
// src/vue/useVoiceTraceTimeline.ts
|
|
4703
|
-
import { onUnmounted as
|
|
4823
|
+
import { onUnmounted as onUnmounted15, ref as ref10, shallowRef as shallowRef14 } from "vue";
|
|
4704
4824
|
|
|
4705
4825
|
// src/client/traceTimeline.ts
|
|
4706
4826
|
var fetchVoiceTraceTimeline = async (path = "/api/voice-traces", options = {}) => {
|
|
@@ -4785,10 +4905,10 @@ var createVoiceTraceTimelineStore = (path = "/api/voice-traces", options = {}) =
|
|
|
4785
4905
|
// src/vue/useVoiceTraceTimeline.ts
|
|
4786
4906
|
function useVoiceTraceTimeline(path = "/api/voice-traces", options = {}) {
|
|
4787
4907
|
const store = createVoiceTraceTimelineStore(path, options);
|
|
4788
|
-
const error =
|
|
4789
|
-
const isLoading =
|
|
4790
|
-
const report =
|
|
4791
|
-
const updatedAt =
|
|
4908
|
+
const error = ref10(null);
|
|
4909
|
+
const isLoading = ref10(false);
|
|
4910
|
+
const report = shallowRef14(null);
|
|
4911
|
+
const updatedAt = ref10(undefined);
|
|
4792
4912
|
const sync = () => {
|
|
4793
4913
|
const snapshot = store.getSnapshot();
|
|
4794
4914
|
error.value = snapshot.error;
|
|
@@ -4799,7 +4919,7 @@ function useVoiceTraceTimeline(path = "/api/voice-traces", options = {}) {
|
|
|
4799
4919
|
const unsubscribe = store.subscribe(sync);
|
|
4800
4920
|
sync();
|
|
4801
4921
|
store.refresh().catch(() => {});
|
|
4802
|
-
|
|
4922
|
+
onUnmounted15(() => {
|
|
4803
4923
|
unsubscribe();
|
|
4804
4924
|
store.close();
|
|
4805
4925
|
});
|
|
@@ -4812,7 +4932,7 @@ function useVoiceTraceTimeline(path = "/api/voice-traces", options = {}) {
|
|
|
4812
4932
|
};
|
|
4813
4933
|
}
|
|
4814
4934
|
// src/vue/useVoiceWorkflowStatus.ts
|
|
4815
|
-
import { onUnmounted as
|
|
4935
|
+
import { onUnmounted as onUnmounted16, ref as ref11, shallowRef as shallowRef15 } from "vue";
|
|
4816
4936
|
|
|
4817
4937
|
// src/client/workflowStatus.ts
|
|
4818
4938
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -4896,10 +5016,10 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
4896
5016
|
// src/vue/useVoiceWorkflowStatus.ts
|
|
4897
5017
|
function useVoiceWorkflowStatus(path = "/evals/scenarios/json", options = {}) {
|
|
4898
5018
|
const store = createVoiceWorkflowStatusStore(path, options);
|
|
4899
|
-
const error =
|
|
4900
|
-
const isLoading =
|
|
4901
|
-
const report =
|
|
4902
|
-
const updatedAt =
|
|
5019
|
+
const error = ref11(null);
|
|
5020
|
+
const isLoading = ref11(false);
|
|
5021
|
+
const report = shallowRef15(undefined);
|
|
5022
|
+
const updatedAt = ref11(undefined);
|
|
4903
5023
|
const sync = () => {
|
|
4904
5024
|
const snapshot = store.getSnapshot();
|
|
4905
5025
|
error.value = snapshot.error;
|
|
@@ -4912,7 +5032,7 @@ function useVoiceWorkflowStatus(path = "/evals/scenarios/json", options = {}) {
|
|
|
4912
5032
|
if (typeof window !== "undefined") {
|
|
4913
5033
|
store.refresh().catch(() => {});
|
|
4914
5034
|
}
|
|
4915
|
-
|
|
5035
|
+
onUnmounted16(() => {
|
|
4916
5036
|
unsubscribe();
|
|
4917
5037
|
store.close();
|
|
4918
5038
|
});
|
|
@@ -4937,6 +5057,7 @@ export {
|
|
|
4937
5057
|
useVoiceProviderCapabilities,
|
|
4938
5058
|
useVoiceOpsStatus,
|
|
4939
5059
|
useVoiceOpsActionCenter,
|
|
5060
|
+
useVoiceLiveOps,
|
|
4940
5061
|
useVoiceDeliveryRuntime,
|
|
4941
5062
|
useVoiceController,
|
|
4942
5063
|
useVoiceCampaignDialerProof,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VoiceLiveOpsClientOptions, type VoiceLiveOpsActionResult } from '../client/liveOps';
|
|
2
|
+
export declare function useVoiceLiveOps(options?: VoiceLiveOpsClientOptions): {
|
|
3
|
+
error: import("vue").Ref<string | null, string | null>;
|
|
4
|
+
isRunning: import("vue").Ref<boolean, boolean>;
|
|
5
|
+
lastResult: import("vue").ShallowRef<VoiceLiveOpsActionResult | undefined, VoiceLiveOpsActionResult | undefined>;
|
|
6
|
+
run: (input: import("..").VoiceLiveOpsActionInput) => Promise<VoiceLiveOpsActionResult | undefined>;
|
|
7
|
+
runningAction: import("vue").Ref<"escalate" | "assign" | "create-task" | "force-handoff" | "inject-instruction" | "operator-takeover" | "pause-assistant" | "resume-assistant" | "tag" | undefined, "escalate" | "assign" | "create-task" | "force-handoff" | "inject-instruction" | "operator-takeover" | "pause-assistant" | "resume-assistant" | "tag" | undefined>;
|
|
8
|
+
updatedAt: import("vue").Ref<number | undefined, number | undefined>;
|
|
9
|
+
};
|