@absolutejs/voice 0.0.22-beta.302 → 0.0.22-beta.304
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 +3 -1
- package/dist/index.js +733 -435
- package/dist/realtimeChannel.d.ts +9 -0
- package/dist/realtimeProviderContracts.d.ts +115 -0
- package/package.json +1 -1
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
2
|
import type { AudioFormat } from './types';
|
|
3
|
+
import type { StoredVoiceTraceEvent } from './trace';
|
|
3
4
|
export type VoiceRealtimeChannelStatus = 'fail' | 'pass' | 'warn';
|
|
4
5
|
export type VoiceRealtimeChannelRuntimeSample = {
|
|
5
6
|
format?: AudioFormat;
|
|
7
|
+
observedAt?: number;
|
|
6
8
|
kind: 'assistant-audio' | 'browser-capture' | 'input-audio' | 'reconnect' | 'turn-commit';
|
|
7
9
|
latencyMs?: number;
|
|
8
10
|
ok?: boolean;
|
|
11
|
+
sessionId?: string;
|
|
9
12
|
source?: string;
|
|
13
|
+
turnId?: string;
|
|
10
14
|
};
|
|
11
15
|
export type VoiceRealtimeChannelBrowserCapture = {
|
|
12
16
|
audioContextSampleRateHz?: number;
|
|
@@ -78,8 +82,13 @@ export type VoiceRealtimeChannelRoutesOptions = VoiceRealtimeChannelReportOption
|
|
|
78
82
|
name?: string;
|
|
79
83
|
path?: string;
|
|
80
84
|
render?: (report: VoiceRealtimeChannelReport) => Promise<string> | string;
|
|
85
|
+
source?: (() => Promise<VoiceRealtimeChannelReportOptions> | VoiceRealtimeChannelReportOptions) | VoiceRealtimeChannelReportOptions;
|
|
81
86
|
title?: string;
|
|
82
87
|
};
|
|
88
|
+
export declare const buildVoiceRealtimeChannelRuntimeSamplesFromTrace: (events: readonly StoredVoiceTraceEvent[], options?: {
|
|
89
|
+
format?: AudioFormat;
|
|
90
|
+
source?: string;
|
|
91
|
+
}) => VoiceRealtimeChannelRuntimeSample[];
|
|
83
92
|
export declare const buildVoiceRealtimeChannelReport: (options: VoiceRealtimeChannelReportOptions) => VoiceRealtimeChannelReport;
|
|
84
93
|
export declare const evaluateVoiceRealtimeChannelEvidence: (report: VoiceRealtimeChannelReport, input?: VoiceRealtimeChannelAssertionInput) => VoiceRealtimeChannelAssertionReport;
|
|
85
94
|
export declare const assertVoiceRealtimeChannelEvidence: (report: VoiceRealtimeChannelReport, input?: VoiceRealtimeChannelAssertionInput) => VoiceRealtimeChannelAssertionReport;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { VoiceRealtimeChannelReport } from './realtimeChannel';
|
|
3
|
+
export type VoiceRealtimeProviderContractStatus = 'fail' | 'pass' | 'warn';
|
|
4
|
+
export type VoiceRealtimeProviderContractCapability = 'barge-in' | 'browser-format-negotiation' | 'duplex-audio' | 'first-audio-latency' | 'raw-pcm' | 'reconnect' | 'trace-evidence' | 'turn-commit';
|
|
5
|
+
export type VoiceRealtimeProviderContractDefinition<TProvider extends string = string> = {
|
|
6
|
+
capabilities?: readonly VoiceRealtimeProviderContractCapability[];
|
|
7
|
+
configured?: boolean;
|
|
8
|
+
env?: Record<string, string | undefined>;
|
|
9
|
+
fallbackProviders?: readonly TProvider[];
|
|
10
|
+
latencyBudgetMs?: number;
|
|
11
|
+
provider: TProvider;
|
|
12
|
+
readinessHref?: string;
|
|
13
|
+
realtimeChannel?: VoiceRealtimeChannelReport;
|
|
14
|
+
requiredCapabilities?: readonly VoiceRealtimeProviderContractCapability[];
|
|
15
|
+
requiredEnv?: readonly string[];
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
traceHref?: string;
|
|
18
|
+
};
|
|
19
|
+
export type VoiceRealtimeProviderContractCheck = {
|
|
20
|
+
detail?: string;
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
status: VoiceRealtimeProviderContractStatus;
|
|
24
|
+
};
|
|
25
|
+
export type VoiceRealtimeProviderContractRow<TProvider extends string = string> = {
|
|
26
|
+
checks: VoiceRealtimeProviderContractCheck[];
|
|
27
|
+
configured: boolean;
|
|
28
|
+
provider: TProvider;
|
|
29
|
+
selected: boolean;
|
|
30
|
+
status: VoiceRealtimeProviderContractStatus;
|
|
31
|
+
};
|
|
32
|
+
export type VoiceRealtimeProviderContractMatrixInput<TProvider extends string = string> = {
|
|
33
|
+
contracts: readonly VoiceRealtimeProviderContractDefinition<TProvider>[];
|
|
34
|
+
};
|
|
35
|
+
export type VoiceRealtimeProviderContractMatrixReport<TProvider extends string = string> = {
|
|
36
|
+
failed: number;
|
|
37
|
+
passed: number;
|
|
38
|
+
rows: VoiceRealtimeProviderContractRow<TProvider>[];
|
|
39
|
+
status: VoiceRealtimeProviderContractStatus;
|
|
40
|
+
total: number;
|
|
41
|
+
warned: number;
|
|
42
|
+
};
|
|
43
|
+
export type VoiceRealtimeProviderContractAssertionInput<TProvider extends string = string> = {
|
|
44
|
+
maxFailed?: number;
|
|
45
|
+
maxStatus?: VoiceRealtimeProviderContractStatus;
|
|
46
|
+
maxWarned?: number;
|
|
47
|
+
minRows?: number;
|
|
48
|
+
requireSelected?: boolean;
|
|
49
|
+
requiredCapabilities?: readonly VoiceRealtimeProviderContractCapability[];
|
|
50
|
+
requiredCheckKeys?: readonly string[];
|
|
51
|
+
requiredProviders?: readonly TProvider[];
|
|
52
|
+
};
|
|
53
|
+
export type VoiceRealtimeProviderContractAssertionReport<TProvider extends string = string> = {
|
|
54
|
+
failed: number;
|
|
55
|
+
issues: string[];
|
|
56
|
+
ok: boolean;
|
|
57
|
+
providers: TProvider[];
|
|
58
|
+
selectedProviders: TProvider[];
|
|
59
|
+
status: VoiceRealtimeProviderContractStatus;
|
|
60
|
+
total: number;
|
|
61
|
+
warned: number;
|
|
62
|
+
};
|
|
63
|
+
export type VoiceRealtimeProviderContractRoutesOptions<TProvider extends string = string> = {
|
|
64
|
+
headers?: HeadersInit;
|
|
65
|
+
htmlPath?: false | string;
|
|
66
|
+
matrix: (() => Promise<VoiceRealtimeProviderContractMatrixInput<TProvider>> | VoiceRealtimeProviderContractMatrixInput<TProvider>) | VoiceRealtimeProviderContractMatrixInput<TProvider>;
|
|
67
|
+
name?: string;
|
|
68
|
+
path?: string;
|
|
69
|
+
render?: (report: VoiceRealtimeProviderContractMatrixReport<TProvider>) => Promise<string> | string;
|
|
70
|
+
title?: string;
|
|
71
|
+
};
|
|
72
|
+
export declare const buildVoiceRealtimeProviderContractMatrix: <TProvider extends string = string>(input: VoiceRealtimeProviderContractMatrixInput<TProvider>) => VoiceRealtimeProviderContractMatrixReport<TProvider>;
|
|
73
|
+
export declare const evaluateVoiceRealtimeProviderContractEvidence: <TProvider extends string = string>(report: VoiceRealtimeProviderContractMatrixReport<TProvider>, input?: VoiceRealtimeProviderContractAssertionInput<TProvider>) => VoiceRealtimeProviderContractAssertionReport<TProvider>;
|
|
74
|
+
export declare const assertVoiceRealtimeProviderContractEvidence: <TProvider extends string = string>(report: VoiceRealtimeProviderContractMatrixReport<TProvider>, input?: VoiceRealtimeProviderContractAssertionInput<TProvider>) => VoiceRealtimeProviderContractAssertionReport<TProvider>;
|
|
75
|
+
export declare const renderVoiceRealtimeProviderContractHTML: <TProvider extends string = string>(report: VoiceRealtimeProviderContractMatrixReport<TProvider>, title?: string) => string;
|
|
76
|
+
export declare const createVoiceRealtimeProviderContractRoutes: <TProvider extends string = string>(options: VoiceRealtimeProviderContractRoutesOptions<TProvider>) => Elysia<"", {
|
|
77
|
+
decorator: {};
|
|
78
|
+
store: {};
|
|
79
|
+
derive: {};
|
|
80
|
+
resolve: {};
|
|
81
|
+
}, {
|
|
82
|
+
typebox: {};
|
|
83
|
+
error: {};
|
|
84
|
+
}, {
|
|
85
|
+
schema: {};
|
|
86
|
+
standaloneSchema: {};
|
|
87
|
+
macro: {};
|
|
88
|
+
macroFn: {};
|
|
89
|
+
parser: {};
|
|
90
|
+
response: {};
|
|
91
|
+
}, {
|
|
92
|
+
[x: string]: {
|
|
93
|
+
get: {
|
|
94
|
+
body: unknown;
|
|
95
|
+
params: {};
|
|
96
|
+
query: unknown;
|
|
97
|
+
headers: unknown;
|
|
98
|
+
response: {
|
|
99
|
+
200: Response;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
}, {
|
|
104
|
+
derive: {};
|
|
105
|
+
resolve: {};
|
|
106
|
+
schema: {};
|
|
107
|
+
standaloneSchema: {};
|
|
108
|
+
response: {};
|
|
109
|
+
}, {
|
|
110
|
+
derive: {};
|
|
111
|
+
resolve: {};
|
|
112
|
+
schema: {};
|
|
113
|
+
standaloneSchema: {};
|
|
114
|
+
response: {};
|
|
115
|
+
}>;
|