@absolutejs/voice 0.0.22-beta.116 → 0.0.22-beta.118

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/vue/index.js CHANGED
@@ -2110,8 +2110,164 @@ var VoiceTurnQuality = defineComponent7({
2110
2110
  ]);
2111
2111
  }
2112
2112
  });
2113
+ // src/vue/useVoiceCampaignDialerProof.ts
2114
+ import { onUnmounted as onUnmounted8, shallowRef as shallowRef7 } from "vue";
2115
+
2116
+ // src/client/campaignDialerProof.ts
2117
+ var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
2118
+ const fetchImpl = options.fetch ?? globalThis.fetch;
2119
+ const response = await fetchImpl(path);
2120
+ if (!response.ok) {
2121
+ throw new Error(`Voice campaign dialer proof status failed: HTTP ${response.status}`);
2122
+ }
2123
+ return await response.json();
2124
+ };
2125
+ var runVoiceCampaignDialerProofAction = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
2126
+ const fetchImpl = options.fetch ?? globalThis.fetch;
2127
+ const response = await fetchImpl(path, { method: "POST" });
2128
+ if (!response.ok) {
2129
+ throw new Error(`Voice campaign dialer proof failed: HTTP ${response.status}`);
2130
+ }
2131
+ return await response.json();
2132
+ };
2133
+ var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
2134
+ const listeners = new Set;
2135
+ let closed = false;
2136
+ let timer;
2137
+ let snapshot = {
2138
+ error: null,
2139
+ isLoading: false
2140
+ };
2141
+ const emit = () => {
2142
+ for (const listener of listeners) {
2143
+ listener();
2144
+ }
2145
+ };
2146
+ const refresh = async () => {
2147
+ if (closed) {
2148
+ return snapshot.status;
2149
+ }
2150
+ snapshot = { ...snapshot, error: null, isLoading: true };
2151
+ emit();
2152
+ try {
2153
+ const status = await fetchVoiceCampaignDialerProofStatus(path, options);
2154
+ snapshot = {
2155
+ ...snapshot,
2156
+ error: null,
2157
+ isLoading: false,
2158
+ status,
2159
+ updatedAt: Date.now()
2160
+ };
2161
+ emit();
2162
+ return status;
2163
+ } catch (error) {
2164
+ snapshot = {
2165
+ ...snapshot,
2166
+ error: error instanceof Error ? error.message : String(error),
2167
+ isLoading: false
2168
+ };
2169
+ emit();
2170
+ throw error;
2171
+ }
2172
+ };
2173
+ const runProof = async () => {
2174
+ const runPath = options.runPath ?? snapshot.status?.runPath ?? path;
2175
+ snapshot = { ...snapshot, error: null, isLoading: true };
2176
+ emit();
2177
+ try {
2178
+ const report = await runVoiceCampaignDialerProofAction(runPath, options);
2179
+ snapshot = {
2180
+ ...snapshot,
2181
+ error: null,
2182
+ isLoading: false,
2183
+ report,
2184
+ status: {
2185
+ generatedAt: Date.now(),
2186
+ mode: report.mode,
2187
+ ok: report.ok,
2188
+ providers: report.providers.map((provider) => provider.provider),
2189
+ runPath,
2190
+ safe: true
2191
+ },
2192
+ updatedAt: Date.now()
2193
+ };
2194
+ emit();
2195
+ return report;
2196
+ } catch (error) {
2197
+ snapshot = {
2198
+ ...snapshot,
2199
+ error: error instanceof Error ? error.message : String(error),
2200
+ isLoading: false
2201
+ };
2202
+ emit();
2203
+ throw error;
2204
+ }
2205
+ };
2206
+ const close = () => {
2207
+ closed = true;
2208
+ if (timer) {
2209
+ clearInterval(timer);
2210
+ timer = undefined;
2211
+ }
2212
+ listeners.clear();
2213
+ };
2214
+ if (options.intervalMs && options.intervalMs > 0) {
2215
+ timer = setInterval(() => {
2216
+ refresh().catch(() => {});
2217
+ }, options.intervalMs);
2218
+ }
2219
+ return {
2220
+ close,
2221
+ getServerSnapshot: () => snapshot,
2222
+ getSnapshot: () => snapshot,
2223
+ refresh,
2224
+ runProof,
2225
+ subscribe: (listener) => {
2226
+ listeners.add(listener);
2227
+ return () => {
2228
+ listeners.delete(listener);
2229
+ };
2230
+ }
2231
+ };
2232
+ };
2233
+
2234
+ // src/vue/useVoiceCampaignDialerProof.ts
2235
+ var useVoiceCampaignDialerProof = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
2236
+ const store = createVoiceCampaignDialerProofStore(path, options);
2237
+ const error = shallowRef7(null);
2238
+ const isLoading = shallowRef7(false);
2239
+ const report = shallowRef7();
2240
+ const status = shallowRef7();
2241
+ const updatedAt = shallowRef7(undefined);
2242
+ const sync = () => {
2243
+ const snapshot = store.getSnapshot();
2244
+ error.value = snapshot.error;
2245
+ isLoading.value = snapshot.isLoading;
2246
+ report.value = snapshot.report;
2247
+ status.value = snapshot.status;
2248
+ updatedAt.value = snapshot.updatedAt;
2249
+ };
2250
+ const unsubscribe = store.subscribe(sync);
2251
+ sync();
2252
+ if (typeof window !== "undefined") {
2253
+ store.refresh().catch(() => {});
2254
+ }
2255
+ onUnmounted8(() => {
2256
+ unsubscribe();
2257
+ store.close();
2258
+ });
2259
+ return {
2260
+ error,
2261
+ isLoading,
2262
+ refresh: store.refresh,
2263
+ report,
2264
+ runProof: store.runProof,
2265
+ status,
2266
+ updatedAt
2267
+ };
2268
+ };
2113
2269
  // src/vue/useVoiceStream.ts
2114
- import { onUnmounted as onUnmounted8, ref as ref5, shallowRef as shallowRef7 } from "vue";
2270
+ import { onUnmounted as onUnmounted9, ref as ref5, shallowRef as shallowRef8 } from "vue";
2115
2271
 
2116
2272
  // src/client/actions.ts
2117
2273
  var normalizeErrorMessage = (value) => {
@@ -2629,15 +2785,15 @@ var createVoiceStream = (path, options = {}) => {
2629
2785
  // src/vue/useVoiceStream.ts
2630
2786
  var useVoiceStream = (path, options = {}) => {
2631
2787
  const stream = createVoiceStream(path, options);
2632
- const assistantAudio = shallowRef7([]);
2633
- const assistantTexts = shallowRef7([]);
2634
- const call = shallowRef7(null);
2788
+ const assistantAudio = shallowRef8([]);
2789
+ const assistantTexts = shallowRef8([]);
2790
+ const call = shallowRef8(null);
2635
2791
  const error = ref5(null);
2636
2792
  const isConnected = ref5(false);
2637
2793
  const partial = ref5("");
2638
2794
  const sessionId = ref5(stream.sessionId);
2639
2795
  const status = ref5(stream.status);
2640
- const turns = shallowRef7([]);
2796
+ const turns = shallowRef8([]);
2641
2797
  const sync = () => {
2642
2798
  assistantAudio.value = [...stream.assistantAudio];
2643
2799
  assistantTexts.value = [...stream.assistantTexts];
@@ -2655,7 +2811,7 @@ var useVoiceStream = (path, options = {}) => {
2655
2811
  unsubscribe();
2656
2812
  stream.close();
2657
2813
  };
2658
- onUnmounted8(destroy);
2814
+ onUnmounted9(destroy);
2659
2815
  return {
2660
2816
  assistantAudio,
2661
2817
  assistantTexts,
@@ -2673,7 +2829,7 @@ var useVoiceStream = (path, options = {}) => {
2673
2829
  };
2674
2830
  };
2675
2831
  // src/vue/useVoiceController.ts
2676
- import { onUnmounted as onUnmounted9, ref as ref6, shallowRef as shallowRef8 } from "vue";
2832
+ import { onUnmounted as onUnmounted10, ref as ref6, shallowRef as shallowRef9 } from "vue";
2677
2833
 
2678
2834
  // src/client/htmx.ts
2679
2835
  var DEFAULT_EVENT_NAME = "voice-refresh";
@@ -3314,8 +3470,8 @@ var createVoiceController = (path, options = {}) => {
3314
3470
  // src/vue/useVoiceController.ts
3315
3471
  var useVoiceController = (path, options = {}) => {
3316
3472
  const controller = createVoiceController(path, options);
3317
- const assistantAudio = shallowRef8([]);
3318
- const assistantTexts = shallowRef8([]);
3473
+ const assistantAudio = shallowRef9([]);
3474
+ const assistantTexts = shallowRef9([]);
3319
3475
  const error = ref6(null);
3320
3476
  const isConnected = ref6(false);
3321
3477
  const isRecording = ref6(false);
@@ -3323,7 +3479,7 @@ var useVoiceController = (path, options = {}) => {
3323
3479
  const recordingError = ref6(null);
3324
3480
  const sessionId = ref6(controller.sessionId);
3325
3481
  const status = ref6(controller.status);
3326
- const turns = shallowRef8([]);
3482
+ const turns = shallowRef9([]);
3327
3483
  const sync = () => {
3328
3484
  assistantAudio.value = [...controller.assistantAudio];
3329
3485
  assistantTexts.value = [...controller.assistantTexts];
@@ -3342,7 +3498,7 @@ var useVoiceController = (path, options = {}) => {
3342
3498
  unsubscribe();
3343
3499
  controller.close();
3344
3500
  };
3345
- onUnmounted9(destroy);
3501
+ onUnmounted10(destroy);
3346
3502
  return {
3347
3503
  assistantAudio,
3348
3504
  assistantTexts,
@@ -3364,7 +3520,7 @@ var useVoiceController = (path, options = {}) => {
3364
3520
  };
3365
3521
  };
3366
3522
  // src/vue/useVoiceTraceTimeline.ts
3367
- import { onUnmounted as onUnmounted10, ref as ref7, shallowRef as shallowRef9 } from "vue";
3523
+ import { onUnmounted as onUnmounted11, ref as ref7, shallowRef as shallowRef10 } from "vue";
3368
3524
 
3369
3525
  // src/client/traceTimeline.ts
3370
3526
  var fetchVoiceTraceTimeline = async (path = "/api/voice-traces", options = {}) => {
@@ -3451,7 +3607,7 @@ var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
3451
3607
  const store = createVoiceTraceTimelineStore(path, options);
3452
3608
  const error = ref7(null);
3453
3609
  const isLoading = ref7(false);
3454
- const report = shallowRef9(null);
3610
+ const report = shallowRef10(null);
3455
3611
  const updatedAt = ref7(undefined);
3456
3612
  const sync = () => {
3457
3613
  const snapshot = store.getSnapshot();
@@ -3463,7 +3619,7 @@ var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
3463
3619
  const unsubscribe = store.subscribe(sync);
3464
3620
  sync();
3465
3621
  store.refresh().catch(() => {});
3466
- onUnmounted10(() => {
3622
+ onUnmounted11(() => {
3467
3623
  unsubscribe();
3468
3624
  store.close();
3469
3625
  });
@@ -3476,7 +3632,7 @@ var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
3476
3632
  };
3477
3633
  };
3478
3634
  // src/vue/useVoiceWorkflowStatus.ts
3479
- import { onUnmounted as onUnmounted11, ref as ref8, shallowRef as shallowRef10 } from "vue";
3635
+ import { onUnmounted as onUnmounted12, ref as ref8, shallowRef as shallowRef11 } from "vue";
3480
3636
 
3481
3637
  // src/client/workflowStatus.ts
3482
3638
  var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
@@ -3562,7 +3718,7 @@ var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
3562
3718
  const store = createVoiceWorkflowStatusStore(path, options);
3563
3719
  const error = ref8(null);
3564
3720
  const isLoading = ref8(false);
3565
- const report = shallowRef10(undefined);
3721
+ const report = shallowRef11(undefined);
3566
3722
  const updatedAt = ref8(undefined);
3567
3723
  const sync = () => {
3568
3724
  const snapshot = store.getSnapshot();
@@ -3576,7 +3732,7 @@ var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
3576
3732
  if (typeof window !== "undefined") {
3577
3733
  store.refresh().catch(() => {});
3578
3734
  }
3579
- onUnmounted11(() => {
3735
+ onUnmounted12(() => {
3580
3736
  unsubscribe();
3581
3737
  store.close();
3582
3738
  });
@@ -3599,6 +3755,7 @@ export {
3599
3755
  useVoiceProviderSimulationControls,
3600
3756
  useVoiceProviderCapabilities,
3601
3757
  useVoiceController,
3758
+ useVoiceCampaignDialerProof,
3602
3759
  useVoiceAppKitStatus,
3603
3760
  VoiceTurnQuality,
3604
3761
  VoiceTurnLatency,
@@ -0,0 +1,11 @@
1
+ import { type VoiceCampaignDialerProofClientOptions } from '../client/campaignDialerProof';
2
+ import type { VoiceCampaignDialerProofReport, VoiceCampaignDialerProofStatus } from '../campaignDialers';
3
+ export declare const useVoiceCampaignDialerProof: (path?: string, options?: VoiceCampaignDialerProofClientOptions) => {
4
+ error: import("vue").ShallowRef<string | null, string | null>;
5
+ isLoading: import("vue").ShallowRef<boolean, boolean>;
6
+ refresh: () => Promise<VoiceCampaignDialerProofStatus | undefined>;
7
+ report: import("vue").ShallowRef<VoiceCampaignDialerProofReport | undefined, VoiceCampaignDialerProofReport | undefined>;
8
+ runProof: () => Promise<VoiceCampaignDialerProofReport>;
9
+ status: import("vue").ShallowRef<VoiceCampaignDialerProofStatus | undefined, VoiceCampaignDialerProofStatus | undefined>;
10
+ updatedAt: import("vue").ShallowRef<number | undefined, number | undefined>;
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.116",
3
+ "version": "0.0.22-beta.118",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",