@absolutejs/voice 0.0.22-beta.506 → 0.0.22-beta.507
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,22 @@
|
|
|
1
|
+
export type BrowserVoiceSupportProbe = {
|
|
2
|
+
hasAudioContext: boolean;
|
|
3
|
+
hasAudioWorklet: boolean;
|
|
4
|
+
hasGetUserMedia: boolean;
|
|
5
|
+
hasMediaRecorder: boolean;
|
|
6
|
+
hasOpusEncoding: boolean;
|
|
7
|
+
hasRTCPeerConnection: boolean;
|
|
8
|
+
hasWebSocket: boolean;
|
|
9
|
+
isInsecureContext: boolean;
|
|
10
|
+
isIos: boolean;
|
|
11
|
+
isSafari: boolean;
|
|
12
|
+
requiresUserGestureToResumeAudio: boolean;
|
|
13
|
+
userAgent: string;
|
|
14
|
+
};
|
|
15
|
+
export type BrowserVoiceSupportReport = {
|
|
16
|
+
blockers: string[];
|
|
17
|
+
capabilities: BrowserVoiceSupportProbe;
|
|
18
|
+
ok: boolean;
|
|
19
|
+
warnings: string[];
|
|
20
|
+
};
|
|
21
|
+
export declare const probeBrowserVoiceSupport: (globalScope?: typeof globalThis) => BrowserVoiceSupportProbe;
|
|
22
|
+
export declare const checkBrowserVoiceSupport: (globalScope?: typeof globalThis) => BrowserVoiceSupportReport;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StoredVoiceTraceEvent } from "../trace";
|
|
2
|
+
export type VoiceTrafficBucket = {
|
|
3
|
+
bucketKey: string;
|
|
4
|
+
callsCompleted: number;
|
|
5
|
+
callsFailed: number;
|
|
6
|
+
callsTransferred: number;
|
|
7
|
+
callsVoicemail: number;
|
|
8
|
+
callsTotal: number;
|
|
9
|
+
totalDurationMs: number;
|
|
10
|
+
};
|
|
11
|
+
export type VoiceTrafficSummary = {
|
|
12
|
+
buckets: VoiceTrafficBucket[];
|
|
13
|
+
callsByDisposition: Record<string, number>;
|
|
14
|
+
transferReasons: Record<string, number>;
|
|
15
|
+
topTransferTargets: Array<{
|
|
16
|
+
count: number;
|
|
17
|
+
target: string;
|
|
18
|
+
}>;
|
|
19
|
+
totals: VoiceTrafficBucket;
|
|
20
|
+
windowEndMs: number;
|
|
21
|
+
windowStartMs: number;
|
|
22
|
+
};
|
|
23
|
+
export type SummarizeVoiceCallTrafficOptions = {
|
|
24
|
+
bucketBy?: "day" | "hour" | "month";
|
|
25
|
+
events: ReadonlyArray<StoredVoiceTraceEvent>;
|
|
26
|
+
fromMs?: number;
|
|
27
|
+
toMs?: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const summarizeVoiceCallTraffic: (options: SummarizeVoiceCallTrafficOptions) => VoiceTrafficSummary;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type CreateLiveCallViewerOptions, type LiveCallTimelineEvent, type LiveCallViewState, type LiveCallViewer } from "./liveCallViewer";
|
|
2
|
+
import type { VoiceCallerMemorySnapshot } from "../callerMemory";
|
|
3
|
+
export type LiveAgentConsoleState = {
|
|
4
|
+
caller?: VoiceCallerMemorySnapshot;
|
|
5
|
+
hasTakeover: boolean;
|
|
6
|
+
recentTimeline: LiveCallTimelineEvent[];
|
|
7
|
+
takeoverAt?: number;
|
|
8
|
+
takeoverReason?: string;
|
|
9
|
+
view: LiveCallViewState;
|
|
10
|
+
};
|
|
11
|
+
export type CreateLiveAgentConsoleOptions = CreateLiveCallViewerOptions & {
|
|
12
|
+
/** Recent timeline window length. Default 12. */
|
|
13
|
+
recentLimit?: number;
|
|
14
|
+
/** Resolves the caller memory snapshot for this session (fetched once on attach). */
|
|
15
|
+
resolveCaller?: () => Promise<VoiceCallerMemorySnapshot | undefined> | VoiceCallerMemorySnapshot | undefined;
|
|
16
|
+
};
|
|
17
|
+
export type LiveAgentConsole = {
|
|
18
|
+
getState: () => LiveAgentConsoleState;
|
|
19
|
+
noteAgentAudio: (at?: number) => void;
|
|
20
|
+
notePartial: (text: string, at?: number) => void;
|
|
21
|
+
noteTranscript: (text: string, at?: number) => void;
|
|
22
|
+
releaseTakeover: () => void;
|
|
23
|
+
setCaller: (caller: VoiceCallerMemorySnapshot | undefined) => void;
|
|
24
|
+
subscribe: (listener: () => void) => () => void;
|
|
25
|
+
takeover: (reason?: string) => void;
|
|
26
|
+
viewer: LiveCallViewer;
|
|
27
|
+
};
|
|
28
|
+
export declare const createLiveAgentConsole: (options: CreateLiveAgentConsoleOptions) => LiveAgentConsole;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type VoicePriceBook } from "./costAccounting";
|
|
2
|
+
export type VoiceCostProfile = {
|
|
3
|
+
/** Stored callers? Set to true to include caller-memory storage costs (per snapshot, monthly). Default false (we don't model storage here). */
|
|
4
|
+
includeCallerMemory?: boolean;
|
|
5
|
+
/** Inbound calls per day. */
|
|
6
|
+
inboundPerDay?: number;
|
|
7
|
+
/** Average input tokens per agent turn. */
|
|
8
|
+
inputTokensPerTurn: number;
|
|
9
|
+
/** LLM model id used for provider:model price lookup. */
|
|
10
|
+
llmModel: string;
|
|
11
|
+
/** LLM provider — must match price book namespace. */
|
|
12
|
+
llmProvider: string;
|
|
13
|
+
/** Average minutes per call. */
|
|
14
|
+
minutesPerCall: number;
|
|
15
|
+
/** Outbound calls per day. */
|
|
16
|
+
outboundPerDay?: number;
|
|
17
|
+
/** Average output tokens per agent turn. */
|
|
18
|
+
outputTokensPerTurn: number;
|
|
19
|
+
/** STT model. */
|
|
20
|
+
sttModel?: string;
|
|
21
|
+
/** STT provider. */
|
|
22
|
+
sttProvider?: string;
|
|
23
|
+
/** Telephony provider key in the price book (e.g. 'twilio', 'telnyx'). */
|
|
24
|
+
telephonyProvider?: string;
|
|
25
|
+
/** Total turns per call. */
|
|
26
|
+
turnsPerCall: number;
|
|
27
|
+
/** Average TTS characters spoken per agent turn. */
|
|
28
|
+
ttsCharsPerTurn: number;
|
|
29
|
+
/** TTS model / voice id. */
|
|
30
|
+
ttsModel?: string;
|
|
31
|
+
/** TTS provider. */
|
|
32
|
+
ttsProvider?: string;
|
|
33
|
+
};
|
|
34
|
+
export type VoiceCostPrediction = {
|
|
35
|
+
callsPerDay: number;
|
|
36
|
+
monthly: {
|
|
37
|
+
llmUsd: number;
|
|
38
|
+
sttUsd: number;
|
|
39
|
+
telephonyUsd: number;
|
|
40
|
+
totalUsd: number;
|
|
41
|
+
ttsUsd: number;
|
|
42
|
+
};
|
|
43
|
+
perCall: {
|
|
44
|
+
llmUsd: number;
|
|
45
|
+
sttUsd: number;
|
|
46
|
+
telephonyUsd: number;
|
|
47
|
+
totalUsd: number;
|
|
48
|
+
ttsUsd: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type PredictVoiceCallCostInput = {
|
|
52
|
+
priceBook?: VoicePriceBook;
|
|
53
|
+
profile: VoiceCostProfile;
|
|
54
|
+
};
|
|
55
|
+
export declare const predictVoiceCallCost: (input: PredictVoiceCallCostInput) => VoiceCostPrediction;
|
|
56
|
+
export type VoiceCostScenarioComparison = {
|
|
57
|
+
delta: {
|
|
58
|
+
monthlyUsd: number;
|
|
59
|
+
perCallUsd: number;
|
|
60
|
+
};
|
|
61
|
+
prediction: VoiceCostPrediction;
|
|
62
|
+
scenarioId: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const compareVoiceCostScenarios: (input: {
|
|
65
|
+
baselineId: string;
|
|
66
|
+
priceBook?: VoicePriceBook;
|
|
67
|
+
scenarios: ReadonlyArray<{
|
|
68
|
+
id: string;
|
|
69
|
+
profile: VoiceCostProfile;
|
|
70
|
+
}>;
|
|
71
|
+
}) => {
|
|
72
|
+
baseline: VoiceCostPrediction;
|
|
73
|
+
scenarios: VoiceCostScenarioComparison[];
|
|
74
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type VoiceIceServer = {
|
|
2
|
+
credential?: string;
|
|
3
|
+
urls: string | string[];
|
|
4
|
+
username?: string;
|
|
5
|
+
};
|
|
6
|
+
export type CreateCoturnIceServersInput = {
|
|
7
|
+
/** TURN realm. */
|
|
8
|
+
realm: string;
|
|
9
|
+
/** Credential TTL in seconds. Default 3600. */
|
|
10
|
+
ttlSec?: number;
|
|
11
|
+
/** Coturn shared secret (use_auth_secret). */
|
|
12
|
+
sharedSecret: string;
|
|
13
|
+
/** TURN endpoint host:port (e.g. 'turn.example.com:3478'). */
|
|
14
|
+
turnHost: string;
|
|
15
|
+
/** Username to derive ephemeral credential for. */
|
|
16
|
+
username: string;
|
|
17
|
+
/** Optional STUN endpoints to prepend. Default ['stun:stun.l.google.com:19302']. */
|
|
18
|
+
stunUrls?: string[];
|
|
19
|
+
/** UTC unix-seconds NOW override for testing. */
|
|
20
|
+
now?: number;
|
|
21
|
+
/** SHA-1 HMAC implementation for testing. Defaults to crypto.subtle. */
|
|
22
|
+
hmacSha1Base64?: (key: string, message: string) => Promise<string>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Builds an iceServers array using the coturn `use-auth-secret` REST API
|
|
26
|
+
* pattern: username = `${expires}:${callerId}`, credential = HMAC-SHA1(secret, username) base64-encoded.
|
|
27
|
+
*/
|
|
28
|
+
export declare const createCoturnIceServers: (input: CreateCoturnIceServersInput) => Promise<VoiceIceServer[]>;
|
|
29
|
+
export type CreateTwilioNTSIceServersInput = {
|
|
30
|
+
accountSid: string;
|
|
31
|
+
authToken: string;
|
|
32
|
+
fetch?: typeof fetch;
|
|
33
|
+
};
|
|
34
|
+
export declare const createTwilioNTSIceServers: (input: CreateTwilioNTSIceServersInput) => Promise<VoiceIceServer[]>;
|