@absolutejs/voice 0.0.20 → 0.0.22-beta.0
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/README.md +884 -4
- package/dist/angular/index.d.ts +1 -0
- package/dist/angular/index.js +759 -3
- package/dist/angular/voice-controller.service.d.ts +27 -0
- package/dist/angular/voice-stream.service.d.ts +6 -0
- package/dist/audioConditioning.d.ts +3 -0
- package/dist/client/actions.d.ts +48 -0
- package/dist/client/audioPlayer.d.ts +40 -0
- package/dist/client/connection.d.ts +5 -0
- package/dist/client/controller.d.ts +2 -0
- package/dist/client/duplex.d.ts +3 -0
- package/dist/client/htmxBootstrap.js +660 -167
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +991 -6
- package/dist/client/microphone.d.ts +4 -2
- package/dist/correction.d.ts +33 -0
- package/dist/fileStore.d.ts +27 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +3721 -298
- package/dist/ops.d.ts +100 -0
- package/dist/presets.d.ts +13 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +728 -3
- package/dist/react/useVoiceController.d.ts +26 -0
- package/dist/react/useVoiceStream.d.ts +7 -0
- package/dist/routing.d.ts +3 -0
- package/dist/runtimeOps.d.ts +23 -0
- package/dist/store.d.ts +2 -2
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +691 -3
- package/dist/telephony/response.d.ts +7 -0
- package/dist/telephony/twilio.d.ts +116 -0
- package/dist/testing/benchmark.d.ts +93 -2
- package/dist/testing/corrected.d.ts +41 -0
- package/dist/testing/duplex.d.ts +59 -0
- package/dist/testing/fixtures.d.ts +18 -2
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.js +6247 -402
- package/dist/testing/review.d.ts +143 -0
- package/dist/testing/sessionBenchmark.d.ts +92 -2
- package/dist/testing/stt.d.ts +3 -1
- package/dist/testing/telephony.d.ts +70 -0
- package/dist/testing/tts.d.ts +73 -0
- package/dist/turnDetection.d.ts +5 -1
- package/dist/turnProfiles.d.ts +6 -0
- package/dist/types.d.ts +487 -10
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +750 -3
- package/dist/vue/useVoiceController.d.ts +30 -0
- package/dist/vue/useVoiceStream.d.ts +11 -0
- package/fixtures/README.md +9 -0
- package/fixtures/manifest.json +59 -1
- package/fixtures/pcm/dialogue-three-clean.pcm +0 -0
- package/fixtures/pcm/dialogue-three-mixed.pcm +0 -0
- package/fixtures/pcm/dialogue-two-clean.pcm +0 -0
- package/fixtures/pcm/dialogue-two-noisy.pcm +0 -0
- package/package.json +135 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { VoiceControllerOptions, VoiceTurnRecord } from '../types';
|
|
2
|
+
export declare class VoiceControllerService {
|
|
3
|
+
connect<TResult = unknown>(path: string, options?: VoiceControllerOptions): {
|
|
4
|
+
assistantAudio: import("@angular/core").Signal<{
|
|
5
|
+
chunk: Uint8Array;
|
|
6
|
+
format: import("..").AudioFormat;
|
|
7
|
+
receivedAt: number;
|
|
8
|
+
turnId?: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
assistantTexts: import("@angular/core").Signal<string[]>;
|
|
11
|
+
bindHTMX: (options: import("..").VoiceHTMXBindingOptions) => () => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
endTurn: () => void;
|
|
14
|
+
error: import("@angular/core").Signal<string | null>;
|
|
15
|
+
isConnected: import("@angular/core").Signal<boolean>;
|
|
16
|
+
isRecording: import("@angular/core").Signal<boolean>;
|
|
17
|
+
partial: import("@angular/core").Signal<string>;
|
|
18
|
+
recordingError: import("@angular/core").Signal<string | null>;
|
|
19
|
+
sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
|
|
20
|
+
sessionId: import("@angular/core").Signal<string | null>;
|
|
21
|
+
startRecording: () => Promise<void>;
|
|
22
|
+
status: import("@angular/core").Signal<import("..").VoiceSessionStatus | "idle">;
|
|
23
|
+
stopRecording: () => void;
|
|
24
|
+
toggleRecording: () => Promise<void>;
|
|
25
|
+
turns: import("@angular/core").Signal<VoiceTurnRecord<TResult>[]>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { VoiceConnectionOptions, VoiceTurnRecord } from '../types';
|
|
2
2
|
export declare class VoiceStreamService {
|
|
3
3
|
connect<TResult = unknown>(path: string, options?: VoiceConnectionOptions): {
|
|
4
|
+
assistantAudio: import("@angular/core").Signal<{
|
|
5
|
+
chunk: Uint8Array;
|
|
6
|
+
format: import("..").AudioFormat;
|
|
7
|
+
receivedAt: number;
|
|
8
|
+
turnId?: string;
|
|
9
|
+
}[]>;
|
|
4
10
|
assistantTexts: import("@angular/core").Signal<string[]>;
|
|
5
11
|
close: () => void;
|
|
6
12
|
endTurn: () => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AudioChunk, VoiceAudioConditioningConfig, VoiceResolvedAudioConditioningConfig } from './types';
|
|
2
|
+
export declare const resolveAudioConditioningConfig: (config?: VoiceAudioConditioningConfig) => VoiceResolvedAudioConditioningConfig | undefined;
|
|
3
|
+
export declare const conditionAudioChunk: (audio: AudioChunk, config?: VoiceResolvedAudioConditioningConfig) => AudioChunk;
|
package/dist/client/actions.d.ts
CHANGED
|
@@ -1,48 +1,91 @@
|
|
|
1
1
|
import type { VoiceServerMessage } from '../types';
|
|
2
2
|
export declare const serverMessageToAction: <TResult = unknown>(message: VoiceServerMessage<TResult>) => {
|
|
3
|
+
chunk: Uint8Array<ArrayBuffer>;
|
|
4
|
+
format: import("..").AudioFormat;
|
|
5
|
+
receivedAt: number;
|
|
6
|
+
turnId: string | undefined;
|
|
7
|
+
type: "audio";
|
|
8
|
+
text?: undefined;
|
|
9
|
+
sessionId?: undefined;
|
|
10
|
+
message?: undefined;
|
|
11
|
+
transcript?: undefined;
|
|
12
|
+
scenarioId?: undefined;
|
|
13
|
+
status?: undefined;
|
|
14
|
+
turn?: undefined;
|
|
15
|
+
} | {
|
|
3
16
|
text: string;
|
|
4
17
|
type: "assistant";
|
|
18
|
+
chunk?: undefined;
|
|
19
|
+
format?: undefined;
|
|
20
|
+
receivedAt?: undefined;
|
|
21
|
+
turnId?: undefined;
|
|
5
22
|
sessionId?: undefined;
|
|
6
23
|
message?: undefined;
|
|
7
24
|
transcript?: undefined;
|
|
25
|
+
scenarioId?: undefined;
|
|
8
26
|
status?: undefined;
|
|
9
27
|
turn?: undefined;
|
|
10
28
|
} | {
|
|
11
29
|
sessionId: string;
|
|
12
30
|
type: "complete";
|
|
31
|
+
chunk?: undefined;
|
|
32
|
+
format?: undefined;
|
|
33
|
+
receivedAt?: undefined;
|
|
34
|
+
turnId?: undefined;
|
|
13
35
|
text?: undefined;
|
|
14
36
|
message?: undefined;
|
|
15
37
|
transcript?: undefined;
|
|
38
|
+
scenarioId?: undefined;
|
|
16
39
|
status?: undefined;
|
|
17
40
|
turn?: undefined;
|
|
18
41
|
} | {
|
|
19
42
|
message: string;
|
|
20
43
|
type: "error";
|
|
44
|
+
chunk?: undefined;
|
|
45
|
+
format?: undefined;
|
|
46
|
+
receivedAt?: undefined;
|
|
47
|
+
turnId?: undefined;
|
|
21
48
|
text?: undefined;
|
|
22
49
|
sessionId?: undefined;
|
|
23
50
|
transcript?: undefined;
|
|
51
|
+
scenarioId?: undefined;
|
|
24
52
|
status?: undefined;
|
|
25
53
|
turn?: undefined;
|
|
26
54
|
} | {
|
|
27
55
|
transcript: import("..").Transcript;
|
|
28
56
|
type: "final";
|
|
57
|
+
chunk?: undefined;
|
|
58
|
+
format?: undefined;
|
|
59
|
+
receivedAt?: undefined;
|
|
60
|
+
turnId?: undefined;
|
|
29
61
|
text?: undefined;
|
|
30
62
|
sessionId?: undefined;
|
|
31
63
|
message?: undefined;
|
|
64
|
+
scenarioId?: undefined;
|
|
32
65
|
status?: undefined;
|
|
33
66
|
turn?: undefined;
|
|
34
67
|
} | {
|
|
35
68
|
transcript: import("..").Transcript;
|
|
36
69
|
type: "partial";
|
|
70
|
+
chunk?: undefined;
|
|
71
|
+
format?: undefined;
|
|
72
|
+
receivedAt?: undefined;
|
|
73
|
+
turnId?: undefined;
|
|
37
74
|
text?: undefined;
|
|
38
75
|
sessionId?: undefined;
|
|
39
76
|
message?: undefined;
|
|
77
|
+
scenarioId?: undefined;
|
|
40
78
|
status?: undefined;
|
|
41
79
|
turn?: undefined;
|
|
42
80
|
} | {
|
|
43
81
|
sessionId: string;
|
|
82
|
+
scenarioId: string | undefined;
|
|
44
83
|
status: import("..").VoiceSessionStatus;
|
|
45
84
|
type: "session";
|
|
85
|
+
chunk?: undefined;
|
|
86
|
+
format?: undefined;
|
|
87
|
+
receivedAt?: undefined;
|
|
88
|
+
turnId?: undefined;
|
|
46
89
|
text?: undefined;
|
|
47
90
|
message?: undefined;
|
|
48
91
|
transcript?: undefined;
|
|
@@ -50,9 +93,14 @@ export declare const serverMessageToAction: <TResult = unknown>(message: VoiceSe
|
|
|
50
93
|
} | {
|
|
51
94
|
turn: import("..").VoiceTurnRecord<TResult>;
|
|
52
95
|
type: "turn";
|
|
96
|
+
chunk?: undefined;
|
|
97
|
+
format?: undefined;
|
|
98
|
+
receivedAt?: undefined;
|
|
99
|
+
turnId?: undefined;
|
|
53
100
|
text?: undefined;
|
|
54
101
|
sessionId?: undefined;
|
|
55
102
|
message?: undefined;
|
|
56
103
|
transcript?: undefined;
|
|
104
|
+
scenarioId?: undefined;
|
|
57
105
|
status?: undefined;
|
|
58
106
|
} | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AudioFormat, VoiceAudioPlayer, VoiceAudioPlayerOptions, VoiceAudioPlayerSource } from '../types';
|
|
2
|
+
type MinimalAudioBuffer = {
|
|
3
|
+
duration: number;
|
|
4
|
+
getChannelData: (channel: number) => Float32Array;
|
|
5
|
+
};
|
|
6
|
+
type MinimalAudioBufferSourceNode = {
|
|
7
|
+
buffer: MinimalAudioBuffer | null;
|
|
8
|
+
connect: (destination: unknown) => void;
|
|
9
|
+
disconnect?: () => void;
|
|
10
|
+
onended: (() => void) | null;
|
|
11
|
+
start: (when?: number) => void;
|
|
12
|
+
stop?: () => void;
|
|
13
|
+
};
|
|
14
|
+
type MinimalGainNode = {
|
|
15
|
+
connect?: (destination: unknown) => void;
|
|
16
|
+
disconnect?: () => void;
|
|
17
|
+
gain: {
|
|
18
|
+
setValueAtTime?: (value: number, time: number) => void;
|
|
19
|
+
value: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type MinimalAudioContext = {
|
|
23
|
+
baseLatency?: number;
|
|
24
|
+
close: () => Promise<void>;
|
|
25
|
+
createBuffer: (numberOfChannels: number, length: number, sampleRate: number) => MinimalAudioBuffer;
|
|
26
|
+
createBufferSource: () => MinimalAudioBufferSourceNode;
|
|
27
|
+
createGain?: () => MinimalGainNode;
|
|
28
|
+
currentTime: number;
|
|
29
|
+
destination: unknown;
|
|
30
|
+
outputLatency?: number;
|
|
31
|
+
resume: () => Promise<void>;
|
|
32
|
+
state: 'closed' | 'running' | 'suspended';
|
|
33
|
+
suspend: () => Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
export declare const createVoiceAudioPlayer: (source: VoiceAudioPlayerSource, options?: VoiceAudioPlayerOptions) => VoiceAudioPlayer;
|
|
36
|
+
export declare const decodeVoiceAudioChunk: (audioContext: Pick<MinimalAudioContext, "createBuffer">, chunk: {
|
|
37
|
+
chunk: Uint8Array;
|
|
38
|
+
format: AudioFormat;
|
|
39
|
+
}) => MinimalAudioBuffer;
|
|
40
|
+
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { VoiceClientMessage, VoiceConnectionOptions, VoiceServerMessage } from '../types';
|
|
2
2
|
type VoiceConnectionHandle = {
|
|
3
|
+
start: (input?: {
|
|
4
|
+
sessionId?: string;
|
|
5
|
+
scenarioId?: string;
|
|
6
|
+
}) => void;
|
|
3
7
|
close: () => void;
|
|
4
8
|
endTurn: () => void;
|
|
5
9
|
getReadyState: () => number;
|
|
10
|
+
getScenarioId: () => string;
|
|
6
11
|
getSessionId: () => string;
|
|
7
12
|
send: (message: VoiceClientMessage) => void;
|
|
8
13
|
sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { VoiceAudioPlayer, VoiceBargeInBinding, VoiceBargeInOptions, VoiceController, VoiceDuplexController, VoiceDuplexControllerOptions } from '../types';
|
|
2
|
+
export declare const bindVoiceBargeIn: <TResult = unknown>(controller: Pick<VoiceController<TResult>, "partial" | "sendAudio" | "subscribe">, player: Pick<VoiceAudioPlayer, "interrupt" | "isPlaying">, options?: VoiceBargeInOptions) => VoiceBargeInBinding;
|
|
3
|
+
export declare const createVoiceDuplexController: <TResult = unknown>(path: string, options?: VoiceDuplexControllerOptions) => VoiceDuplexController<TResult>;
|