@absolutejs/voice 0.0.22-beta.310 → 0.0.22-beta.312

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.
@@ -43,6 +43,44 @@ export type VoiceMediaTransportAdapter = {
43
43
  outputFormat?: AudioFormat;
44
44
  send: (frame: VoiceMediaFrame) => Promise<void> | void;
45
45
  };
46
+ export type VoiceMediaTransportState = 'closed' | 'closing' | 'failed' | 'idle' | 'open';
47
+ export type VoiceMediaTransportEventKind = 'backpressure' | 'close' | 'connect' | 'error' | 'frame-in' | 'frame-out';
48
+ export type VoiceMediaTransportEvent = {
49
+ at: number;
50
+ bufferedFrames?: number;
51
+ error?: string;
52
+ frameId?: string;
53
+ kind: VoiceMediaTransportEventKind;
54
+ state: VoiceMediaTransportState;
55
+ };
56
+ export type VoiceMediaTransportReport = {
57
+ backpressureEvents: number;
58
+ checkedAt: number;
59
+ closed: boolean;
60
+ connected: boolean;
61
+ events: readonly VoiceMediaTransportEvent[];
62
+ failed: boolean;
63
+ inputFrames: number;
64
+ name: string;
65
+ outputFrames: number;
66
+ state: VoiceMediaTransportState;
67
+ status: VoiceMediaPipelineStatus;
68
+ };
69
+ export type VoiceMediaTransport = VoiceMediaTransportAdapter & {
70
+ events: () => readonly VoiceMediaTransportEvent[];
71
+ receive: (frame: VoiceMediaFrame) => Promise<void>;
72
+ report: () => VoiceMediaTransportReport;
73
+ state: () => VoiceMediaTransportState;
74
+ };
75
+ export type VoiceMediaTransportOptions = {
76
+ inputFormat?: AudioFormat;
77
+ maxBufferedFrames?: number;
78
+ name: string;
79
+ onClose?: () => Promise<void> | void;
80
+ onConnect?: () => Promise<void> | void;
81
+ onSend?: (frame: VoiceMediaFrame) => Promise<void> | void;
82
+ outputFormat?: AudioFormat;
83
+ };
46
84
  export type VoiceMediaPipelineCalibrationInput = {
47
85
  expectedInputFormat?: AudioFormat;
48
86
  expectedOutputFormat?: AudioFormat;
@@ -113,6 +151,12 @@ export type VoiceMediaInterruptionReport = {
113
151
  status: VoiceMediaPipelineStatus;
114
152
  };
115
153
  export declare const createVoiceMediaFrame: (frame: VoiceMediaFrame) => VoiceMediaFrame;
154
+ export declare const buildVoiceMediaTransportReport: (input: {
155
+ events?: readonly VoiceMediaTransportEvent[];
156
+ name: string;
157
+ state?: VoiceMediaTransportState;
158
+ }) => VoiceMediaTransportReport;
159
+ export declare const createVoiceMediaTransport: (options: VoiceMediaTransportOptions) => VoiceMediaTransport;
116
160
  export declare const buildVoiceMediaResamplingPlan: (input: {
117
161
  inputFormat: AudioFormat;
118
162
  outputFormat: AudioFormat;
@@ -0,0 +1,99 @@
1
+ import { Elysia } from 'elysia';
2
+ import { type VoiceMediaFrame, type VoiceMediaInterruptionReport, type VoiceMediaPipelineCalibrationInput, type VoiceMediaPipelineCalibrationReport, type VoiceMediaPipelineStatus, type VoiceMediaResamplingPlan, type VoiceMediaTransportReport, type VoiceMediaVadReport } from './mediaPipeline';
3
+ export type VoiceMediaPipelineReportOptions = VoiceMediaPipelineCalibrationInput & {
4
+ frames?: readonly VoiceMediaFrame[];
5
+ maxInterruptionLatencyMs?: number;
6
+ maxSilenceFrames?: number;
7
+ minSpeechFrames?: number;
8
+ speechEndThreshold?: number;
9
+ speechStartThreshold?: number;
10
+ transport?: VoiceMediaTransportReport;
11
+ };
12
+ export type VoiceMediaPipelineReport = {
13
+ calibration: VoiceMediaPipelineCalibrationReport;
14
+ checkedAt: number;
15
+ frames: number;
16
+ interruption: VoiceMediaInterruptionReport;
17
+ ok: boolean;
18
+ resampling?: VoiceMediaResamplingPlan;
19
+ status: VoiceMediaPipelineStatus;
20
+ surface: string;
21
+ transport?: VoiceMediaTransportReport;
22
+ vad: VoiceMediaVadReport;
23
+ };
24
+ export type VoiceMediaPipelineAssertionInput = {
25
+ maxFirstAudioLatencyMs?: number;
26
+ maxInterruptionLatencyMs?: number;
27
+ minAssistantAudioFrames?: number;
28
+ minInputAudioFrames?: number;
29
+ minTransportInputFrames?: number;
30
+ minTransportOutputFrames?: number;
31
+ minTraceLinkedFrames?: number;
32
+ minVadSegments?: number;
33
+ maxTransportBackpressureEvents?: number;
34
+ requireInterruptionFrame?: boolean;
35
+ requirePass?: boolean;
36
+ requireResamplingReady?: boolean;
37
+ requireTransportConnected?: boolean;
38
+ };
39
+ export type VoiceMediaPipelineAssertionReport = {
40
+ issues: string[];
41
+ ok: boolean;
42
+ status: VoiceMediaPipelineStatus;
43
+ surface: string;
44
+ };
45
+ export type VoiceMediaPipelineRoutesOptions = VoiceMediaPipelineReportOptions & {
46
+ headers?: HeadersInit;
47
+ htmlPath?: false | string;
48
+ markdownPath?: false | string;
49
+ name?: string;
50
+ path?: string;
51
+ render?: (report: VoiceMediaPipelineReport) => Promise<string> | string;
52
+ source?: (() => Promise<VoiceMediaPipelineReportOptions> | VoiceMediaPipelineReportOptions) | VoiceMediaPipelineReportOptions;
53
+ title?: string;
54
+ };
55
+ export declare const buildVoiceMediaPipelineReport: (options?: VoiceMediaPipelineReportOptions) => VoiceMediaPipelineReport;
56
+ export declare const evaluateVoiceMediaPipelineEvidence: (report: VoiceMediaPipelineReport, input?: VoiceMediaPipelineAssertionInput) => VoiceMediaPipelineAssertionReport;
57
+ export declare const assertVoiceMediaPipelineEvidence: (report: VoiceMediaPipelineReport, input?: VoiceMediaPipelineAssertionInput) => VoiceMediaPipelineAssertionReport;
58
+ export declare const renderVoiceMediaPipelineMarkdown: (report: VoiceMediaPipelineReport) => string;
59
+ export declare const renderVoiceMediaPipelineHTML: (report: VoiceMediaPipelineReport, title?: string) => string;
60
+ export declare const createVoiceMediaPipelineRoutes: (options?: VoiceMediaPipelineRoutesOptions) => Elysia<"", {
61
+ decorator: {};
62
+ store: {};
63
+ derive: {};
64
+ resolve: {};
65
+ }, {
66
+ typebox: {};
67
+ error: {};
68
+ }, {
69
+ schema: {};
70
+ standaloneSchema: {};
71
+ macro: {};
72
+ macroFn: {};
73
+ parser: {};
74
+ response: {};
75
+ }, {
76
+ [x: string]: {
77
+ get: {
78
+ body: unknown;
79
+ params: {};
80
+ query: unknown;
81
+ headers: unknown;
82
+ response: {
83
+ 200: Response;
84
+ };
85
+ };
86
+ };
87
+ }, {
88
+ derive: {};
89
+ resolve: {};
90
+ schema: {};
91
+ standaloneSchema: {};
92
+ response: {};
93
+ }, {
94
+ derive: {};
95
+ resolve: {};
96
+ schema: {};
97
+ standaloneSchema: {};
98
+ response: {};
99
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.310",
3
+ "version": "0.0.22-beta.312",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",