@xmov/avatar 2.1.0 → 2.1.1

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.
@@ -1,32 +0,0 @@
1
- import type { AgentClientMessage, AgentServerEvent, AgentSocketState } from "./types";
2
- export interface AgentE2EClientOptions {
3
- wsUrl: string;
4
- token: string;
5
- audioInputEnabled?: boolean;
6
- WebSocketCtor?: typeof WebSocket;
7
- onStateChange?: (state: AgentSocketState) => void;
8
- onEvent?: (event: AgentServerEvent) => void;
9
- onError?: (error: Error) => void;
10
- onClose?: (event: CloseEvent) => void;
11
- }
12
- export declare class AgentE2EClient {
13
- private ws;
14
- private connectPromise;
15
- private rejectConnect;
16
- private audioInputEnabled;
17
- private readonly WebSocketCtor;
18
- private readonly options;
19
- constructor(options: AgentE2EClientOptions);
20
- get isOpen(): boolean;
21
- connect(): Promise<void>;
22
- disconnect(code?: number, reason?: string): void;
23
- send(message: AgentClientMessage): void;
24
- trySend(message: AgentClientMessage): boolean;
25
- sendBinary(frame: ArrayBuffer | ArrayBufferView | Blob): void;
26
- ping(): void;
27
- setAudioInputEnabled(enabled: boolean): void;
28
- private assertOpen;
29
- private parseMessage;
30
- private buildWsUrl;
31
- private updateAudioInputQuery;
32
- }
@@ -1,48 +0,0 @@
1
- export interface FixedAudioTrackOptions {
2
- onError?: (error: Error) => void;
3
- }
4
- /**
5
- * Converts a microphone MediaStreamTrack to a verifiable 16 kHz mono track
6
- * before it is handed to MediaRecorder. WebM/Opus remains the container/codec
7
- * used on the wire; this class only owns the decoded audio track conversion.
8
- */
9
- export declare class FixedAudioTrack {
10
- private readonly options;
11
- private inputTrack;
12
- private reader;
13
- private writer;
14
- private generator;
15
- private audioContext;
16
- private audioSource;
17
- private audioDestination;
18
- private pumpPromise;
19
- private pumpFinished;
20
- private outputClosed;
21
- private draining;
22
- private inputSampleRate;
23
- private resampleBuffer;
24
- private resamplePosition;
25
- private outputBuffer;
26
- private outputTimestamp;
27
- private startGeneration;
28
- constructor(options?: FixedAudioTrackOptions);
29
- start(inputTrack: MediaStreamTrack): Promise<MediaStream>;
30
- private startWebAudio;
31
- stop(): Promise<void>;
32
- /** Stop input and flush decoded samples while keeping the output track live. */
33
- drain(): Promise<void>;
34
- private closeOutput;
35
- private closeWebAudioOutput;
36
- private pump;
37
- private toMono;
38
- private resample;
39
- private writeChunk;
40
- private validateAudioData;
41
- private delay;
42
- private stopGenerator;
43
- private unsupported;
44
- private contextSuspended;
45
- private assertStartActive;
46
- private normalizeWebAudioError;
47
- private validateOutputTrack;
48
- }
@@ -1,49 +0,0 @@
1
- import type { AgentAudioMetadata, AgentAudioOptions } from "./types";
2
- export interface MicrophoneControllerOptions {
3
- audio?: AgentAudioOptions;
4
- debugAudioChunks?: boolean;
5
- /** Agent-owned input stream. When omitted, the controller requests the microphone. */
6
- inputStream?: MediaStream;
7
- /** Use deterministic 100ms PCM buckets with WebCodecs Opus encoding. */
8
- usePcmWebCodecs?: boolean;
9
- onMetadata?: (metadata: AgentAudioMetadata) => void;
10
- /** WebM/Opus Blob callback; timestamp is the media-block start time. */
11
- onFrame: (frame: Blob, timestamp?: number) => void;
12
- onError?: (error: Error) => void;
13
- }
14
- export declare class MicrophoneController {
15
- private stream;
16
- private pendingInputStream;
17
- private recordingStream;
18
- private audioTransformer;
19
- private mediaRecorder;
20
- private pcmAudioContext;
21
- private pcmSource;
22
- private pcmWorklet;
23
- private pcmEncoder;
24
- private pcmEncodeQueue;
25
- private pcmStartedAt;
26
- private pcmGeneration;
27
- private resolvePcmFlush;
28
- private startGeneration;
29
- private starting;
30
- private hasAudioSessionCapture;
31
- private metadata;
32
- private readonly options;
33
- private readonly usesProvidedInput;
34
- constructor(options: MicrophoneControllerOptions);
35
- get isRecording(): boolean;
36
- getAudioMetadata(): AgentAudioMetadata;
37
- start(): Promise<void>;
38
- stop(): Promise<void>;
39
- private startWebMRecorder;
40
- private assertStartActive;
41
- private cancelled;
42
- private webMOpusUnsupported;
43
- private webCodecsOpusUnsupported;
44
- private startPcmWebMRecorder;
45
- private stopPcmWebMRecorder;
46
- private monotonicEpochNow;
47
- private audioContextSuspended;
48
- private stopMediaRecorder;
49
- }