@absolutejs/voice 0.0.22-beta.498 → 0.0.22-beta.499
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/index.d.ts +2 -2
- package/dist/index.js +36 -0
- package/dist/midCallSummary.d.ts +27 -0
- package/dist/recordingStore.d.ts +39 -0
- package/dist/testing/index.js +33 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -132,8 +132,8 @@ export { assertVoiceOutcomeContractEvidence, createVoiceOutcomeContractHTMLHandl
|
|
|
132
132
|
export { applyVoiceTelephonyOutcome, assertVoiceTelephonyWebhookNormalizationEvidence, createMemoryVoiceTelephonyWebhookIdempotencyStore, createVoiceTelephonyOutcomePolicy, createVoiceTelephonyWebhookHandler, createVoiceTelephonyWebhookRoutes, evaluateVoiceTelephonyWebhookNormalizationEvidence, parseVoiceTelephonyWebhookEvent, resolveVoiceTelephonyOutcome, signVoiceTwilioWebhook, verifyVoiceTwilioWebhookSignature, voiceTelephonyOutcomeToRouteResult, } from "./telephonyOutcome";
|
|
133
133
|
export { assertVoicePhoneCallControlEvidence, assertVoicePhoneAssistantEvidence, createVoicePhoneAgent, evaluateVoicePhoneCallControlEvidence, evaluateVoicePhoneAssistantEvidence, } from "./phoneAgent";
|
|
134
134
|
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileIncidentBundleStore, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileAuditEventStore, createVoiceFileAuditSinkDeliveryStore, createVoiceFileCampaignStore, createVoiceFileIntegrationEventStore, createVoiceFileRecordingStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore, } from "./fileStore";
|
|
135
|
-
export { computePcmDurationMs, createVoiceMemoryRecordingStore, encodePcmAsWav, } from "./recordingStore";
|
|
136
|
-
export type { StoredVoiceRecordingArtifact, VoiceRecordingArtifact, VoiceRecordingChannel, VoiceRecordingStore, } from "./recordingStore";
|
|
135
|
+
export { computePcmDurationMs, createVoiceMemoryRecordingStore, createVoiceWavRecordingEncoder, encodePcmAsWav, encodeStereoWav, interleaveStereoPcm, } from "./recordingStore";
|
|
136
|
+
export type { EncodeStereoWavInput, InterleavePcmInput, StoredVoiceRecordingArtifact, VoiceRecordingArtifact, VoiceRecordingChannel, VoiceRecordingEncoder, VoiceRecordingEncoderInput, VoiceRecordingEncoderResult, VoiceRecordingStore, } from "./recordingStore";
|
|
137
137
|
export { createVoiceAssistantMemoryHandle, createVoiceAssistantMemoryRecord, createVoiceMemoryAssistantMemoryStore, resolveVoiceAssistantMemoryNamespace, } from "./assistantMemory";
|
|
138
138
|
export { createAnthropicVoiceAssistantModel, createGeminiVoiceAssistantModel, createJSONVoiceAssistantModel, createOpenAIVoiceAssistantModel, createVoiceProviderOrchestrationProfile, resolveVoiceProviderRoutingPolicyPreset, createVoiceProviderRouter, } from "./modelAdapters";
|
|
139
139
|
export { createOpenAIVoiceTTS } from "./openaiTTS";
|
package/dist/index.js
CHANGED
|
@@ -3413,6 +3413,39 @@ var encodePcmAsWav = (pcm, format) => {
|
|
|
3413
3413
|
output.set(pcm, 44);
|
|
3414
3414
|
return output;
|
|
3415
3415
|
};
|
|
3416
|
+
var interleaveStereoPcm = (input) => {
|
|
3417
|
+
const leftSamples = new Int16Array(input.left.buffer, input.left.byteOffset, Math.floor(input.left.byteLength / 2));
|
|
3418
|
+
const rightSamples = new Int16Array(input.right.buffer, input.right.byteOffset, Math.floor(input.right.byteLength / 2));
|
|
3419
|
+
const frameCount = Math.max(leftSamples.length, rightSamples.length);
|
|
3420
|
+
const output = new Int16Array(frameCount * 2);
|
|
3421
|
+
for (let frame = 0;frame < frameCount; frame += 1) {
|
|
3422
|
+
output[frame * 2] = leftSamples[frame] ?? 0;
|
|
3423
|
+
output[frame * 2 + 1] = rightSamples[frame] ?? 0;
|
|
3424
|
+
}
|
|
3425
|
+
return new Uint8Array(output.buffer);
|
|
3426
|
+
};
|
|
3427
|
+
var encodeStereoWav = ({
|
|
3428
|
+
format,
|
|
3429
|
+
left,
|
|
3430
|
+
right
|
|
3431
|
+
}) => {
|
|
3432
|
+
if (format.container !== "raw" || format.encoding !== "pcm_s16le") {
|
|
3433
|
+
throw new Error("encodeStereoWav requires raw pcm_s16le format on each channel");
|
|
3434
|
+
}
|
|
3435
|
+
if (format.channels !== 1) {
|
|
3436
|
+
throw new Error("encodeStereoWav expects mono input channels");
|
|
3437
|
+
}
|
|
3438
|
+
const interleaved = interleaveStereoPcm({ left, right });
|
|
3439
|
+
return encodePcmAsWav(interleaved, { ...format, channels: 2 });
|
|
3440
|
+
};
|
|
3441
|
+
var createVoiceWavRecordingEncoder = () => ({
|
|
3442
|
+
encode: ({ format, pcm }) => ({
|
|
3443
|
+
bytes: encodePcmAsWav(pcm, format),
|
|
3444
|
+
contentType: "audio/wav",
|
|
3445
|
+
extension: "wav"
|
|
3446
|
+
}),
|
|
3447
|
+
kind: "wav"
|
|
3448
|
+
});
|
|
3416
3449
|
var computePcmDurationMs = (pcmByteLength, format) => {
|
|
3417
3450
|
if (format.container !== "raw" || format.encoding !== "pcm_s16le") {
|
|
3418
3451
|
return 0;
|
|
@@ -47465,6 +47498,7 @@ export {
|
|
|
47465
47498
|
isWithinCampaignWindow,
|
|
47466
47499
|
isVoiceOpsTaskOverdue,
|
|
47467
47500
|
isPhoneOnDNC,
|
|
47501
|
+
interleaveStereoPcm,
|
|
47468
47502
|
importVoiceCampaignRecipients,
|
|
47469
47503
|
heartbeatVoiceOpsTask,
|
|
47470
47504
|
hasVoiceOpsTaskSLABreach,
|
|
@@ -47522,6 +47556,7 @@ export {
|
|
|
47522
47556
|
evaluateVoiceBrowserCallProfileEvidence,
|
|
47523
47557
|
evaluateVoiceAgentSquadContractEvidence,
|
|
47524
47558
|
encodeTwilioMulawBase64,
|
|
47559
|
+
encodeStereoWav,
|
|
47525
47560
|
encodePcmAsWav,
|
|
47526
47561
|
describeVoiceIVRPlan,
|
|
47527
47562
|
describeVoiceAssistantMode,
|
|
@@ -47551,6 +47586,7 @@ export {
|
|
|
47551
47586
|
createVoiceWebhookDeliveryWorkerLoop,
|
|
47552
47587
|
createVoiceWebhookDeliveryWorker,
|
|
47553
47588
|
createVoiceWebhookDeliverySink,
|
|
47589
|
+
createVoiceWavRecordingEncoder,
|
|
47554
47590
|
createVoiceVoicemailDetectionTool,
|
|
47555
47591
|
createVoiceTwilioRedirectHandoffAdapter,
|
|
47556
47592
|
createVoiceTwilioCampaignDialer,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Transcript, VoiceSessionRecord, VoiceTurnRecord } from "./types";
|
|
2
|
+
import type { VoiceLLMJudgeCompletion } from "./llmJudge";
|
|
3
|
+
export type MidCallSummary = {
|
|
4
|
+
generatedAt: number;
|
|
5
|
+
summary: string;
|
|
6
|
+
topicalShift?: boolean;
|
|
7
|
+
turnCount: number;
|
|
8
|
+
};
|
|
9
|
+
export type CreateMidCallSummarizerOptions = {
|
|
10
|
+
completion: VoiceLLMJudgeCompletion;
|
|
11
|
+
/** Force a summary every N turns. Default 6. */
|
|
12
|
+
everyTurns?: number;
|
|
13
|
+
/** Force a summary at most every M ms. Default 60_000. */
|
|
14
|
+
minIntervalMs?: number;
|
|
15
|
+
/** Maximum chars to include in the system prompt. Default 600. */
|
|
16
|
+
summaryMaxChars?: number;
|
|
17
|
+
systemPrompt?: string;
|
|
18
|
+
};
|
|
19
|
+
export type MidCallSummarizer = {
|
|
20
|
+
evaluate: (input: {
|
|
21
|
+
session: VoiceSessionRecord;
|
|
22
|
+
turn?: VoiceTurnRecord;
|
|
23
|
+
}) => Promise<MidCallSummary | undefined>;
|
|
24
|
+
latest: () => MidCallSummary | undefined;
|
|
25
|
+
};
|
|
26
|
+
export declare const createMidCallSummarizer: (options: CreateMidCallSummarizerOptions) => MidCallSummarizer;
|
|
27
|
+
export declare const extractTranscriptText: (transcripts: Transcript[]) => string;
|
package/dist/recordingStore.d.ts
CHANGED
|
@@ -11,11 +11,50 @@ export type VoiceRecordingArtifact = {
|
|
|
11
11
|
export type StoredVoiceRecordingArtifact = VoiceRecordingArtifact & {
|
|
12
12
|
recordingUrl?: string;
|
|
13
13
|
};
|
|
14
|
+
export type VoiceRecordingEncoderInput = {
|
|
15
|
+
channel: VoiceRecordingChannel;
|
|
16
|
+
format: AudioFormat;
|
|
17
|
+
pcm: Uint8Array;
|
|
18
|
+
sessionId: string;
|
|
19
|
+
};
|
|
20
|
+
export type VoiceRecordingEncoderResult = {
|
|
21
|
+
bytes: Uint8Array;
|
|
22
|
+
contentType: string;
|
|
23
|
+
extension: string;
|
|
24
|
+
};
|
|
25
|
+
export type VoiceRecordingEncoder = {
|
|
26
|
+
encode: (input: VoiceRecordingEncoderInput) => Promise<VoiceRecordingEncoderResult> | VoiceRecordingEncoderResult;
|
|
27
|
+
kind: string;
|
|
28
|
+
};
|
|
14
29
|
export type VoiceRecordingStore = {
|
|
15
30
|
get: (sessionId: string, channel: VoiceRecordingChannel) => Promise<StoredVoiceRecordingArtifact | undefined>;
|
|
16
31
|
list: (sessionId: string) => Promise<StoredVoiceRecordingArtifact[]>;
|
|
17
32
|
put: (artifact: VoiceRecordingArtifact) => Promise<StoredVoiceRecordingArtifact>;
|
|
18
33
|
};
|
|
19
34
|
export declare const encodePcmAsWav: (pcm: Uint8Array, format: AudioFormat) => Uint8Array;
|
|
35
|
+
export type InterleavePcmInput = {
|
|
36
|
+
/** Mono PCM bytes for the left channel. */
|
|
37
|
+
left: Uint8Array;
|
|
38
|
+
/** Mono PCM bytes for the right channel. */
|
|
39
|
+
right: Uint8Array;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Interleaves two mono pcm_s16le buffers into a single stereo pcm_s16le
|
|
43
|
+
* buffer at the same sample rate. Output length is max(left, right) * 2.
|
|
44
|
+
* The shorter buffer is right-padded with silence to align frame counts.
|
|
45
|
+
*/
|
|
46
|
+
export declare const interleaveStereoPcm: (input: InterleavePcmInput) => Uint8Array;
|
|
47
|
+
export type EncodeStereoWavInput = {
|
|
48
|
+
format: AudioFormat;
|
|
49
|
+
left: Uint8Array;
|
|
50
|
+
right: Uint8Array;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Builds a stereo WAV file from two mono pcm_s16le channels. Convention:
|
|
54
|
+
* left = user track, right = assistant track. Review tools can split them
|
|
55
|
+
* back out with any DAW.
|
|
56
|
+
*/
|
|
57
|
+
export declare const encodeStereoWav: ({ format, left, right, }: EncodeStereoWavInput) => Uint8Array;
|
|
58
|
+
export declare const createVoiceWavRecordingEncoder: () => VoiceRecordingEncoder;
|
|
20
59
|
export declare const computePcmDurationMs: (pcmByteLength: number, format: AudioFormat) => number;
|
|
21
60
|
export declare const createVoiceMemoryRecordingStore: () => VoiceRecordingStore;
|
package/dist/testing/index.js
CHANGED
|
@@ -5381,6 +5381,39 @@ var encodePcmAsWav = (pcm, format) => {
|
|
|
5381
5381
|
output.set(pcm, 44);
|
|
5382
5382
|
return output;
|
|
5383
5383
|
};
|
|
5384
|
+
var interleaveStereoPcm = (input) => {
|
|
5385
|
+
const leftSamples = new Int16Array(input.left.buffer, input.left.byteOffset, Math.floor(input.left.byteLength / 2));
|
|
5386
|
+
const rightSamples = new Int16Array(input.right.buffer, input.right.byteOffset, Math.floor(input.right.byteLength / 2));
|
|
5387
|
+
const frameCount = Math.max(leftSamples.length, rightSamples.length);
|
|
5388
|
+
const output = new Int16Array(frameCount * 2);
|
|
5389
|
+
for (let frame = 0;frame < frameCount; frame += 1) {
|
|
5390
|
+
output[frame * 2] = leftSamples[frame] ?? 0;
|
|
5391
|
+
output[frame * 2 + 1] = rightSamples[frame] ?? 0;
|
|
5392
|
+
}
|
|
5393
|
+
return new Uint8Array(output.buffer);
|
|
5394
|
+
};
|
|
5395
|
+
var encodeStereoWav = ({
|
|
5396
|
+
format,
|
|
5397
|
+
left,
|
|
5398
|
+
right
|
|
5399
|
+
}) => {
|
|
5400
|
+
if (format.container !== "raw" || format.encoding !== "pcm_s16le") {
|
|
5401
|
+
throw new Error("encodeStereoWav requires raw pcm_s16le format on each channel");
|
|
5402
|
+
}
|
|
5403
|
+
if (format.channels !== 1) {
|
|
5404
|
+
throw new Error("encodeStereoWav expects mono input channels");
|
|
5405
|
+
}
|
|
5406
|
+
const interleaved = interleaveStereoPcm({ left, right });
|
|
5407
|
+
return encodePcmAsWav(interleaved, { ...format, channels: 2 });
|
|
5408
|
+
};
|
|
5409
|
+
var createVoiceWavRecordingEncoder = () => ({
|
|
5410
|
+
encode: ({ format, pcm }) => ({
|
|
5411
|
+
bytes: encodePcmAsWav(pcm, format),
|
|
5412
|
+
contentType: "audio/wav",
|
|
5413
|
+
extension: "wav"
|
|
5414
|
+
}),
|
|
5415
|
+
kind: "wav"
|
|
5416
|
+
});
|
|
5384
5417
|
var computePcmDurationMs = (pcmByteLength, format) => {
|
|
5385
5418
|
if (format.container !== "raw" || format.encoding !== "pcm_s16le") {
|
|
5386
5419
|
return 0;
|