@absolutejs/voice 0.0.22-beta.397 → 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.
@@ -0,0 +1,13 @@
1
+ import { type VoiceSessionSnapshotClientOptions } from '../client/sessionSnapshot';
2
+ import type { VoiceSessionSnapshot } from '../sessionSnapshot';
3
+ export declare class VoiceSessionSnapshotService {
4
+ connect(path: string, options?: VoiceSessionSnapshotClientOptions): {
5
+ close: () => void;
6
+ download: () => Blob;
7
+ error: import("@angular/core").Signal<string | null>;
8
+ isLoading: import("@angular/core").Signal<boolean>;
9
+ refresh: () => Promise<VoiceSessionSnapshot | undefined>;
10
+ snapshot: import("@angular/core").Signal<VoiceSessionSnapshot | undefined>;
11
+ updatedAt: import("@angular/core").Signal<number | undefined>;
12
+ };
13
+ }
@@ -12,6 +12,8 @@ export { createVoiceLiveTurnLatencyMonitor } from './liveTurnLatency';
12
12
  export { createVoiceOpsStatusStore, fetchVoiceOpsStatus } from './opsStatus';
13
13
  export { createVoicePlatformCoverageStore, fetchVoicePlatformCoverage } from './platformCoverage';
14
14
  export { createVoiceProofTrendsStore, fetchVoiceProofTrends } from './proofTrends';
15
+ export { createVoiceSessionSnapshotStore, fetchVoiceSessionSnapshot } from './sessionSnapshot';
16
+ export type { VoiceSessionSnapshotClientOptions, VoiceSessionSnapshotClientState } from './sessionSnapshot';
15
17
  export { createVoiceProfileComparisonStore, fetchVoiceProfileComparison } from './profileComparison';
16
18
  export { createVoiceProfileSwitchRecommendationStore, fetchVoiceProfileSwitchRecommendation } from './profileSwitchRecommendation';
17
19
  export { createVoiceReadinessFailuresStore, fetchVoiceReadinessFailures } from './readinessFailures';
@@ -2974,6 +2974,98 @@ var createVoiceProofTrendsStore = (path = "/api/voice/proof-trends", options = {
2974
2974
  }
2975
2975
  };
2976
2976
  };
2977
+ // src/client/sessionSnapshot.ts
2978
+ var withTurnId = (path, turnId) => {
2979
+ if (!turnId) {
2980
+ return path;
2981
+ }
2982
+ const url = new URL(path, "http://absolutejs.local");
2983
+ url.searchParams.set("turnId", turnId);
2984
+ return `${url.pathname}${url.search}`;
2985
+ };
2986
+ var fetchVoiceSessionSnapshot = async (path, options = {}) => {
2987
+ const fetchImpl = options.fetch ?? globalThis.fetch;
2988
+ const response = await fetchImpl(withTurnId(path, options.turnId));
2989
+ if (!response.ok) {
2990
+ throw new Error(`Voice session snapshot failed: HTTP ${response.status}`);
2991
+ }
2992
+ return await response.json();
2993
+ };
2994
+ var createVoiceSessionSnapshotStore = (path, options = {}) => {
2995
+ const listeners = new Set;
2996
+ let closed = false;
2997
+ let timer;
2998
+ let snapshot = {
2999
+ error: null,
3000
+ isLoading: false
3001
+ };
3002
+ const emit = () => {
3003
+ for (const listener of listeners) {
3004
+ listener();
3005
+ }
3006
+ };
3007
+ const refresh = async () => {
3008
+ if (closed) {
3009
+ return snapshot.snapshot;
3010
+ }
3011
+ snapshot = { ...snapshot, error: null, isLoading: true };
3012
+ emit();
3013
+ try {
3014
+ const next = await fetchVoiceSessionSnapshot(path, options);
3015
+ snapshot = {
3016
+ error: null,
3017
+ isLoading: false,
3018
+ snapshot: next,
3019
+ updatedAt: Date.now()
3020
+ };
3021
+ emit();
3022
+ return next;
3023
+ } catch (error) {
3024
+ snapshot = {
3025
+ ...snapshot,
3026
+ error: error instanceof Error ? error.message : String(error),
3027
+ isLoading: false
3028
+ };
3029
+ emit();
3030
+ throw error;
3031
+ }
3032
+ };
3033
+ const download = () => {
3034
+ const current = snapshot.snapshot;
3035
+ if (current === undefined) {
3036
+ throw new Error("Voice session snapshot has not been loaded.");
3037
+ }
3038
+ return new Blob([JSON.stringify(current, null, 2)], {
3039
+ type: "application/json"
3040
+ });
3041
+ };
3042
+ const close = () => {
3043
+ closed = true;
3044
+ if (timer) {
3045
+ clearInterval(timer);
3046
+ timer = undefined;
3047
+ }
3048
+ listeners.clear();
3049
+ };
3050
+ if (options.intervalMs && options.intervalMs > 0) {
3051
+ timer = setInterval(() => {
3052
+ refresh().catch(() => {});
3053
+ }, options.intervalMs);
3054
+ }
3055
+ return {
3056
+ close,
3057
+ download,
3058
+ getServerSnapshot: () => snapshot,
3059
+ getSnapshot: () => snapshot,
3060
+ refresh,
3061
+ subscribe: (listener) => {
3062
+ listeners.add(listener);
3063
+ return () => {
3064
+ listeners.delete(listener);
3065
+ };
3066
+ }
3067
+ };
3068
+ };
2977
3069
  // src/client/profileComparison.ts
2978
3070
  var fetchVoiceProfileComparison = async (path = "/api/voice/real-call-profile-history", options = {}) => {
2979
3071
  const fetchImpl = options.fetch ?? globalThis.fetch;
@@ -10973,6 +11065,7 @@ export {
10973
11065
  fetchVoiceTurnQuality,
10974
11066
  fetchVoiceTurnLatency,
10975
11067
  fetchVoiceTraceTimeline,
11068
+ fetchVoiceSessionSnapshot,
10976
11069
  fetchVoiceRoutingStatus,
10977
11070
  fetchVoiceReadinessFailures,
10978
11071
  fetchVoiceProviderStatus,
@@ -11013,6 +11106,7 @@ export {
11013
11106
  createVoiceTraceTimelineViewModel,
11014
11107
  createVoiceTraceTimelineStore,
11015
11108
  createVoiceStream,
11109
+ createVoiceSessionSnapshotStore,
11016
11110
  createVoiceRoutingStatusViewModel,
11017
11111
  createVoiceRoutingStatusStore,
11018
11112
  createVoiceReadinessFailuresViewModel,
@@ -0,0 +1,21 @@
1
+ import type { VoiceSessionSnapshot } from '../sessionSnapshot';
2
+ export type VoiceSessionSnapshotClientOptions = {
3
+ fetch?: typeof fetch;
4
+ intervalMs?: number;
5
+ turnId?: string;
6
+ };
7
+ export type VoiceSessionSnapshotClientState = {
8
+ error: string | null;
9
+ isLoading: boolean;
10
+ snapshot?: VoiceSessionSnapshot;
11
+ updatedAt?: number;
12
+ };
13
+ export declare const fetchVoiceSessionSnapshot: (path: string, options?: Pick<VoiceSessionSnapshotClientOptions, "fetch" | "turnId">) => Promise<VoiceSessionSnapshot>;
14
+ export declare const createVoiceSessionSnapshotStore: (path: string, options?: VoiceSessionSnapshotClientOptions) => {
15
+ close: () => void;
16
+ download: () => Blob;
17
+ getServerSnapshot: () => VoiceSessionSnapshotClientState;
18
+ getSnapshot: () => VoiceSessionSnapshotClientState;
19
+ refresh: () => Promise<VoiceSessionSnapshot | undefined>;
20
+ subscribe: (listener: () => void) => () => void;
21
+ };
package/dist/index.d.ts CHANGED
@@ -32,9 +32,9 @@ export type { VoiceCompetitiveCoverageAssertionInput, VoiceCompetitiveCoverageAs
32
32
  export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
33
33
  export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryJobHistoryCheck, buildVoiceRealCallProfileRecoveryActions, createVoiceInMemoryRealCallProfileRecoveryJobStore, createVoiceRealCallProfileTraceCollector, createVoiceSQLiteRealCallProfileRecoveryJobStore, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, createVoiceRealCallProfileRecoveryActionRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, loadVoiceRealCallProfileEvidenceFromTraceStore, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, runVoiceRealCallProfileRecoveryLoop, resolveVoiceRealCallProfileProviderRoute } from './proofTrends';
34
34
  export { createVoiceEvidenceAssertion, createVoiceProofAssertion, summarizeVoiceProofAssertions } from './proofAssertions';
35
- export { buildVoiceSessionSnapshot, buildVoiceSessionSnapshotStatus, parseVoiceSessionSnapshot } from './sessionSnapshot';
35
+ export { buildVoiceSessionSnapshot, buildVoiceSessionSnapshotStatus, createVoiceSessionSnapshotRoutes, parseVoiceSessionSnapshot } from './sessionSnapshot';
36
36
  export type { VoiceEvidenceAssertionInput, VoiceProofAssertionInput, VoiceProofAssertionResult, VoiceProofAssertionSummary } from './proofAssertions';
37
- export type { VoiceSessionSnapshot, VoiceSessionSnapshotInput, VoiceSessionSnapshotQualityEvidence, VoiceSessionSnapshotStatus } from './sessionSnapshot';
37
+ export type { VoiceSessionSnapshot, VoiceSessionSnapshotInput, VoiceSessionSnapshotQualityEvidence, VoiceSessionSnapshotRoutesOptions, VoiceSessionSnapshotRouteSource, VoiceSessionSnapshotRouteSourceInput, VoiceSessionSnapshotStatus } from './sessionSnapshot';
38
38
  export { fetchVoiceProofTarget, getVoiceProofTargetLogicalFailure, mapVoiceProofTargetsWithConcurrency, runVoiceCommandProofTarget, runVoiceCommandProofTargets, runVoiceProofTargets } from './proofRunner';
39
39
  export type { VoiceCommandProofExecutionResult, VoiceCommandProofTarget, VoiceCommandProofTargetResult, VoiceCommandProofTargetRunnerOptions, VoiceCommandProofTargetRunOptions, VoiceProofTarget, VoiceProofTargetMethod, VoiceProofTargetResult, VoiceProofTargetRunnerOptions, VoiceProofTargetRunOptions } from './proofRunner';
40
40
  export { applyVoiceProfileSwitchGuard, buildVoiceProfileSwitchReadinessReport, buildVoiceProfileSwitchLiveDecisionReport, createVoiceProfileSwitchLiveDecisionRoutes, createVoiceProfileSwitchPolicyProofRoutes, createVoiceProfileSwitchReadinessRoutes, recommendVoiceProfileSwitch, renderVoiceProfileSwitchLiveDecisionHTML, renderVoiceProfileSwitchPolicyProofHTML, renderVoiceProfileSwitchReadinessHTML, runVoiceProfileSwitchPolicyProof } from './profileSwitchRecommendation';