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

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,162 @@ 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
+ store.refresh().catch(() => {});
2253
+ onUnmounted8(() => {
2254
+ unsubscribe();
2255
+ store.close();
2256
+ });
2257
+ return {
2258
+ error,
2259
+ isLoading,
2260
+ refresh: store.refresh,
2261
+ report,
2262
+ runProof: store.runProof,
2263
+ status,
2264
+ updatedAt
2265
+ };
2266
+ };
2113
2267
  // src/vue/useVoiceStream.ts
2114
- import { onUnmounted as onUnmounted8, ref as ref5, shallowRef as shallowRef7 } from "vue";
2268
+ import { onUnmounted as onUnmounted9, ref as ref5, shallowRef as shallowRef8 } from "vue";
2115
2269
 
2116
2270
  // src/client/actions.ts
2117
2271
  var normalizeErrorMessage = (value) => {
@@ -2629,15 +2783,15 @@ var createVoiceStream = (path, options = {}) => {
2629
2783
  // src/vue/useVoiceStream.ts
2630
2784
  var useVoiceStream = (path, options = {}) => {
2631
2785
  const stream = createVoiceStream(path, options);
2632
- const assistantAudio = shallowRef7([]);
2633
- const assistantTexts = shallowRef7([]);
2634
- const call = shallowRef7(null);
2786
+ const assistantAudio = shallowRef8([]);
2787
+ const assistantTexts = shallowRef8([]);
2788
+ const call = shallowRef8(null);
2635
2789
  const error = ref5(null);
2636
2790
  const isConnected = ref5(false);
2637
2791
  const partial = ref5("");
2638
2792
  const sessionId = ref5(stream.sessionId);
2639
2793
  const status = ref5(stream.status);
2640
- const turns = shallowRef7([]);
2794
+ const turns = shallowRef8([]);
2641
2795
  const sync = () => {
2642
2796
  assistantAudio.value = [...stream.assistantAudio];
2643
2797
  assistantTexts.value = [...stream.assistantTexts];
@@ -2655,7 +2809,7 @@ var useVoiceStream = (path, options = {}) => {
2655
2809
  unsubscribe();
2656
2810
  stream.close();
2657
2811
  };
2658
- onUnmounted8(destroy);
2812
+ onUnmounted9(destroy);
2659
2813
  return {
2660
2814
  assistantAudio,
2661
2815
  assistantTexts,
@@ -2673,7 +2827,7 @@ var useVoiceStream = (path, options = {}) => {
2673
2827
  };
2674
2828
  };
2675
2829
  // src/vue/useVoiceController.ts
2676
- import { onUnmounted as onUnmounted9, ref as ref6, shallowRef as shallowRef8 } from "vue";
2830
+ import { onUnmounted as onUnmounted10, ref as ref6, shallowRef as shallowRef9 } from "vue";
2677
2831
 
2678
2832
  // src/client/htmx.ts
2679
2833
  var DEFAULT_EVENT_NAME = "voice-refresh";
@@ -3314,8 +3468,8 @@ var createVoiceController = (path, options = {}) => {
3314
3468
  // src/vue/useVoiceController.ts
3315
3469
  var useVoiceController = (path, options = {}) => {
3316
3470
  const controller = createVoiceController(path, options);
3317
- const assistantAudio = shallowRef8([]);
3318
- const assistantTexts = shallowRef8([]);
3471
+ const assistantAudio = shallowRef9([]);
3472
+ const assistantTexts = shallowRef9([]);
3319
3473
  const error = ref6(null);
3320
3474
  const isConnected = ref6(false);
3321
3475
  const isRecording = ref6(false);
@@ -3323,7 +3477,7 @@ var useVoiceController = (path, options = {}) => {
3323
3477
  const recordingError = ref6(null);
3324
3478
  const sessionId = ref6(controller.sessionId);
3325
3479
  const status = ref6(controller.status);
3326
- const turns = shallowRef8([]);
3480
+ const turns = shallowRef9([]);
3327
3481
  const sync = () => {
3328
3482
  assistantAudio.value = [...controller.assistantAudio];
3329
3483
  assistantTexts.value = [...controller.assistantTexts];
@@ -3342,7 +3496,7 @@ var useVoiceController = (path, options = {}) => {
3342
3496
  unsubscribe();
3343
3497
  controller.close();
3344
3498
  };
3345
- onUnmounted9(destroy);
3499
+ onUnmounted10(destroy);
3346
3500
  return {
3347
3501
  assistantAudio,
3348
3502
  assistantTexts,
@@ -3364,7 +3518,7 @@ var useVoiceController = (path, options = {}) => {
3364
3518
  };
3365
3519
  };
3366
3520
  // src/vue/useVoiceTraceTimeline.ts
3367
- import { onUnmounted as onUnmounted10, ref as ref7, shallowRef as shallowRef9 } from "vue";
3521
+ import { onUnmounted as onUnmounted11, ref as ref7, shallowRef as shallowRef10 } from "vue";
3368
3522
 
3369
3523
  // src/client/traceTimeline.ts
3370
3524
  var fetchVoiceTraceTimeline = async (path = "/api/voice-traces", options = {}) => {
@@ -3451,7 +3605,7 @@ var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
3451
3605
  const store = createVoiceTraceTimelineStore(path, options);
3452
3606
  const error = ref7(null);
3453
3607
  const isLoading = ref7(false);
3454
- const report = shallowRef9(null);
3608
+ const report = shallowRef10(null);
3455
3609
  const updatedAt = ref7(undefined);
3456
3610
  const sync = () => {
3457
3611
  const snapshot = store.getSnapshot();
@@ -3463,7 +3617,7 @@ var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
3463
3617
  const unsubscribe = store.subscribe(sync);
3464
3618
  sync();
3465
3619
  store.refresh().catch(() => {});
3466
- onUnmounted10(() => {
3620
+ onUnmounted11(() => {
3467
3621
  unsubscribe();
3468
3622
  store.close();
3469
3623
  });
@@ -3476,7 +3630,7 @@ var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
3476
3630
  };
3477
3631
  };
3478
3632
  // src/vue/useVoiceWorkflowStatus.ts
3479
- import { onUnmounted as onUnmounted11, ref as ref8, shallowRef as shallowRef10 } from "vue";
3633
+ import { onUnmounted as onUnmounted12, ref as ref8, shallowRef as shallowRef11 } from "vue";
3480
3634
 
3481
3635
  // src/client/workflowStatus.ts
3482
3636
  var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
@@ -3562,7 +3716,7 @@ var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
3562
3716
  const store = createVoiceWorkflowStatusStore(path, options);
3563
3717
  const error = ref8(null);
3564
3718
  const isLoading = ref8(false);
3565
- const report = shallowRef10(undefined);
3719
+ const report = shallowRef11(undefined);
3566
3720
  const updatedAt = ref8(undefined);
3567
3721
  const sync = () => {
3568
3722
  const snapshot = store.getSnapshot();
@@ -3576,7 +3730,7 @@ var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
3576
3730
  if (typeof window !== "undefined") {
3577
3731
  store.refresh().catch(() => {});
3578
3732
  }
3579
- onUnmounted11(() => {
3733
+ onUnmounted12(() => {
3580
3734
  unsubscribe();
3581
3735
  store.close();
3582
3736
  });
@@ -3599,6 +3753,7 @@ export {
3599
3753
  useVoiceProviderSimulationControls,
3600
3754
  useVoiceProviderCapabilities,
3601
3755
  useVoiceController,
3756
+ useVoiceCampaignDialerProof,
3602
3757
  useVoiceAppKitStatus,
3603
3758
  VoiceTurnQuality,
3604
3759
  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.117",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",