@urun-sh/openai 0.5.5 → 0.6.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/dist/{ResponsesClient-BYx3YLGo.d.ts → ResponsesClient-CSSrOYD8.d.ts} +7 -1
- package/dist/{ResponsesClient-Dft3bg3b.d.cts → ResponsesClient-_OZERUjH.d.cts} +11 -1
- package/dist/chunk-3JWYIKHM.js +2 -0
- package/dist/chunk-45FJ5GTP.js +7 -0
- package/dist/chunk-6M5JK4YC.js +1 -0
- package/dist/chunk-QTVTCMJU.js +1 -0
- package/dist/chunk-TDRZZGUK.js +1 -0
- package/dist/chunk-TPH77ZOW.js +58 -0
- package/dist/chunk-WCMX5VOF.js +4 -0
- package/dist/chunk-YXK42SKC.js +1 -0
- package/dist/gemini-live.cjs +2 -2
- package/dist/gemini-live.d.cts +79 -7
- package/dist/gemini-live.d.ts +32 -7
- package/dist/gemini-live.js +1 -1
- package/dist/hosted/bin.cjs +43 -27
- package/dist/hosted/bin.js +4 -4
- package/dist/hosted/index.cjs +41 -26
- package/dist/hosted/index.d.cts +710 -17
- package/dist/hosted/index.d.ts +171 -6
- package/dist/hosted/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/{models-NYMZrklp.d.cts → models-DUdx_Y6X.d.cts} +1 -1
- package/dist/pi-extension/index.cjs +7 -7
- package/dist/pi-extension/index.d.cts +2 -2
- package/dist/pi-extension/index.d.ts +2 -2
- package/dist/pi-extension/index.js +1 -1
- package/dist/pi-extension/standalone.cjs +53 -53
- package/dist/proxy/cli.cjs +55 -43
- package/dist/proxy/cli.js +14 -13
- package/dist/proxy/index.cjs +31 -28
- package/dist/proxy/index.d.cts +132 -18
- package/dist/proxy/index.d.ts +28 -11
- package/dist/proxy/index.js +1 -6
- package/dist/responses-turn-BfdBbey8.d.cts +2394 -0
- package/dist/responses-turn-CdhIre_a.d.ts +652 -0
- package/dist/{translator-CcDBEfvm.d.cts → translator-CO8W_hmJ.d.cts} +3 -3
- package/dist/{translator-C9uPKypK.d.ts → translator-Ddd65sXR.d.ts} +1 -1
- package/dist/{types-lsVTbNcH.d.cts → types-CHPtJx6d.d.cts} +13 -0
- package/dist/{types-lsVTbNcH.d.ts → types-CHPtJx6d.d.ts} +4 -0
- package/dist/{video-out-D20UuJ8G.d.cts → video-out-BsuLqlID.d.cts} +6 -6
- package/dist/{video-out-CWesbk12.d.ts → video-out-Cawtm7SF.d.ts} +1 -1
- package/package.json +14 -11
- package/dist/chunk-5BZCM3RS.js +0 -4
- package/dist/chunk-5NXM4IO3.js +0 -2
- package/dist/chunk-CWJRDBDC.js +0 -1
- package/dist/chunk-DMD5UENK.js +0 -1
- package/dist/chunk-GBBY3PCZ.js +0 -1
- package/dist/chunk-I2Q3B3OG.js +0 -6
- package/dist/chunk-OI2OY32M.js +0 -1
- package/dist/chunk-QVF7NF7G.js +0 -44
- package/dist/responses-turn-KOAoIqZ-.d.ts +0 -200
- package/dist/responses-turn-OrO4euEN.d.cts +0 -513
- /package/dist/{models-NYMZrklp.d.ts → models-DUdx_Y6X.d.ts} +0 -0
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
import { C as CatalogRow } from './models-DUdx_Y6X.js';
|
|
2
|
+
import { IncomingMessage } from 'node:http';
|
|
3
|
+
import { a as AudioBridge, h as VideoFrameLane, j as VideoOutLane } from './video-out-Cawtm7SF.js';
|
|
4
|
+
|
|
5
|
+
interface ProxyIdentity {
|
|
6
|
+
app: string;
|
|
7
|
+
org: string;
|
|
8
|
+
fn: string;
|
|
9
|
+
|
|
10
|
+
base_url: string;
|
|
11
|
+
proxy_version: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type TurnCatalogIdentity = {
|
|
15
|
+
kind: 'catalog';
|
|
16
|
+
model_id: string;
|
|
17
|
+
variant: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'not-a-catalog-model';
|
|
20
|
+
model: string | null;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'unresolved';
|
|
23
|
+
reason: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
interface DialReport {
|
|
27
|
+
|
|
28
|
+
sessionId: string | null;
|
|
29
|
+
|
|
30
|
+
identity: TurnCatalogIdentity;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type DialObserver = (dial: DialReport) => void;
|
|
34
|
+
|
|
35
|
+
interface InferenceRecord {
|
|
36
|
+
readonly event: 'inference_request';
|
|
37
|
+
readonly ts: string;
|
|
38
|
+
readonly inference_id: string;
|
|
39
|
+
readonly method: string;
|
|
40
|
+
readonly path: string;
|
|
41
|
+
readonly status: number | null;
|
|
42
|
+
readonly delivered: boolean;
|
|
43
|
+
readonly stream_error: boolean;
|
|
44
|
+
readonly model: string | null;
|
|
45
|
+
readonly stream: boolean | null;
|
|
46
|
+
readonly org: string | null;
|
|
47
|
+
readonly duration_ms: number;
|
|
48
|
+
readonly ttft_ms: number | null;
|
|
49
|
+
|
|
50
|
+
readonly prompt_tokens: number | null;
|
|
51
|
+
readonly completion_tokens: number | null;
|
|
52
|
+
readonly output_units: number | null;
|
|
53
|
+
|
|
54
|
+
readonly session_id: string | null;
|
|
55
|
+
|
|
56
|
+
readonly queue_ms: number | null;
|
|
57
|
+
readonly prefill_ms: number | null;
|
|
58
|
+
readonly decode_ms: number | null;
|
|
59
|
+
readonly total_ms: number | null;
|
|
60
|
+
|
|
61
|
+
readonly catalog: TurnCatalogIdentity;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface SharedEndpointRow {
|
|
65
|
+
model_id: string;
|
|
66
|
+
variant: string;
|
|
67
|
+
|
|
68
|
+
app_slug: string;
|
|
69
|
+
|
|
70
|
+
function: string;
|
|
71
|
+
|
|
72
|
+
gpu_spec?: string | null;
|
|
73
|
+
|
|
74
|
+
warm?: number | null;
|
|
75
|
+
|
|
76
|
+
compat_default?: boolean | null;
|
|
77
|
+
|
|
78
|
+
output_free?: boolean | null;
|
|
79
|
+
|
|
80
|
+
ready?: boolean | null;
|
|
81
|
+
|
|
82
|
+
ready_runtimes?: number | null;
|
|
83
|
+
|
|
84
|
+
ready_since?: string | null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface SharedCatalogBlock {
|
|
88
|
+
shared_org_id: string;
|
|
89
|
+
endpoints: SharedEndpointRow[];
|
|
90
|
+
|
|
91
|
+
regions?: string[] | null;
|
|
92
|
+
|
|
93
|
+
compliance?: {
|
|
94
|
+
zdr: boolean;
|
|
95
|
+
hipaa: boolean;
|
|
96
|
+
} | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface TokenPricing {
|
|
100
|
+
input: number;
|
|
101
|
+
output: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type Side = 'input' | 'output';
|
|
105
|
+
|
|
106
|
+
interface ModelPriceRow {
|
|
107
|
+
model_id: string;
|
|
108
|
+
|
|
109
|
+
variant: string | null;
|
|
110
|
+
side: Side;
|
|
111
|
+
|
|
112
|
+
usd: number;
|
|
113
|
+
|
|
114
|
+
effective_at: number;
|
|
115
|
+
|
|
116
|
+
expires_at: number | null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
type OpenRouterProviderDoc = {
|
|
120
|
+
data: OpenRouterProviderModel[];
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
interface OpenRouterDatacenter {
|
|
124
|
+
country_code: string;
|
|
125
|
+
region?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface OpenRouterCompliance {
|
|
129
|
+
zdr: boolean;
|
|
130
|
+
hipaa: boolean;
|
|
131
|
+
}
|
|
132
|
+
interface OpenRouterProviderModel {
|
|
133
|
+
schema_version: '2.4';
|
|
134
|
+
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
created: number;
|
|
138
|
+
|
|
139
|
+
quantization: string | null;
|
|
140
|
+
|
|
141
|
+
tokenizer?: string;
|
|
142
|
+
description: string;
|
|
143
|
+
hugging_face_id: string;
|
|
144
|
+
|
|
145
|
+
is_ready: boolean;
|
|
146
|
+
|
|
147
|
+
is_free: boolean;
|
|
148
|
+
input_modalities: Array<Record<string, unknown>>;
|
|
149
|
+
output_modalities: Array<Record<string, unknown>>;
|
|
150
|
+
|
|
151
|
+
datacenters?: OpenRouterDatacenter[];
|
|
152
|
+
|
|
153
|
+
compliance?: OpenRouterCompliance;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface SpeechVoicesResolution {
|
|
157
|
+
|
|
158
|
+
readonly published: readonly string[];
|
|
159
|
+
|
|
160
|
+
readonly defect: string | null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
interface DeployedApp {
|
|
164
|
+
app_slug: string;
|
|
165
|
+
|
|
166
|
+
function_name?: string | null;
|
|
167
|
+
|
|
168
|
+
serves?: string | null;
|
|
169
|
+
deployment_status?: string | null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
declare class UnknownModelError extends Error {
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare class SessionGoneError extends Error {
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface RouterModelEntry {
|
|
179
|
+
id: string;
|
|
180
|
+
object: 'model';
|
|
181
|
+
created: number;
|
|
182
|
+
owned_by: string;
|
|
183
|
+
|
|
184
|
+
name?: string;
|
|
185
|
+
|
|
186
|
+
description?: string;
|
|
187
|
+
|
|
188
|
+
task?: string;
|
|
189
|
+
|
|
190
|
+
engine?: string;
|
|
191
|
+
|
|
192
|
+
gpu_spec?: string;
|
|
193
|
+
|
|
194
|
+
context_length?: number;
|
|
195
|
+
|
|
196
|
+
pricing?: TokenPricing;
|
|
197
|
+
|
|
198
|
+
warm?: number;
|
|
199
|
+
|
|
200
|
+
voices?: string[];
|
|
201
|
+
}
|
|
202
|
+
interface RouterModelList {
|
|
203
|
+
object: 'list';
|
|
204
|
+
data: RouterModelEntry[];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
interface RouterImageModelEntry extends RouterModelEntry {
|
|
208
|
+
image_modes: ImageCapabilityMode[];
|
|
209
|
+
}
|
|
210
|
+
interface RouterImageModelList {
|
|
211
|
+
object: 'list';
|
|
212
|
+
data: RouterImageModelEntry[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
interface RouteTarget {
|
|
216
|
+
appSlug: string;
|
|
217
|
+
|
|
218
|
+
fnName?: string;
|
|
219
|
+
|
|
220
|
+
sharedApp?: boolean;
|
|
221
|
+
|
|
222
|
+
modelId?: string;
|
|
223
|
+
|
|
224
|
+
variant?: string;
|
|
225
|
+
|
|
226
|
+
sharedOrgId?: string;
|
|
227
|
+
}
|
|
228
|
+
interface ModelRouterOptions<S> {
|
|
229
|
+
|
|
230
|
+
defaultApp: string | null;
|
|
231
|
+
|
|
232
|
+
fnName: string;
|
|
233
|
+
|
|
234
|
+
openSession: (target: RouteTarget, poolKey: string) => S | Promise<S>;
|
|
235
|
+
|
|
236
|
+
closeSession: (entry: S) => Promise<void>;
|
|
237
|
+
|
|
238
|
+
listApps: (() => Promise<DeployedApp[]>) | null;
|
|
239
|
+
|
|
240
|
+
listCatalog: (() => Promise<CatalogRow[]>) | null;
|
|
241
|
+
|
|
242
|
+
listPrices: (() => Promise<ModelPriceRow[]>) | null;
|
|
243
|
+
|
|
244
|
+
warn?: (line: string) => void;
|
|
245
|
+
|
|
246
|
+
appsTtlMs?: number;
|
|
247
|
+
|
|
248
|
+
sessionKey?: (entry: S) => string;
|
|
249
|
+
|
|
250
|
+
shared?: (() => Promise<SharedCatalogBlock | null>) | null;
|
|
251
|
+
|
|
252
|
+
sharedOnlyListing?: boolean;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
type ImageCapabilityMode = 'generation' | 'edit';
|
|
256
|
+
|
|
257
|
+
declare class ModelRouter<S> {
|
|
258
|
+
private readonly opts;
|
|
259
|
+
private readonly pool;
|
|
260
|
+
private appsCache;
|
|
261
|
+
private rowsCache;
|
|
262
|
+
constructor(opts: ModelRouterOptions<S>);
|
|
263
|
+
|
|
264
|
+
seed(appSlug: string, entry: S): void;
|
|
265
|
+
private deployedApps;
|
|
266
|
+
|
|
267
|
+
private sharedBlock;
|
|
268
|
+
private sharedCache;
|
|
269
|
+
|
|
270
|
+
private catalogRows;
|
|
271
|
+
private pricesCache;
|
|
272
|
+
|
|
273
|
+
private priceRows;
|
|
274
|
+
|
|
275
|
+
private pricesForListing;
|
|
276
|
+
|
|
277
|
+
private outputFreeKeys;
|
|
278
|
+
|
|
279
|
+
private warn;
|
|
280
|
+
|
|
281
|
+
private servable;
|
|
282
|
+
private availableIds;
|
|
283
|
+
|
|
284
|
+
private noDefaultApp;
|
|
285
|
+
|
|
286
|
+
private resolveTarget;
|
|
287
|
+
|
|
288
|
+
catalogIdentityFor(model: string | undefined): Promise<{
|
|
289
|
+
model_id: string;
|
|
290
|
+
variant: string;
|
|
291
|
+
} | null>;
|
|
292
|
+
|
|
293
|
+
servingAppSlugFor(model: string | undefined): Promise<string>;
|
|
294
|
+
|
|
295
|
+
targetFor(model: string | undefined): Promise<RouteTarget>;
|
|
296
|
+
|
|
297
|
+
resolveApp(model: string | undefined): Promise<string>;
|
|
298
|
+
|
|
299
|
+
sessionFor(model: string | undefined): Promise<{
|
|
300
|
+
app: string;
|
|
301
|
+
entry: S;
|
|
302
|
+
identity: TurnCatalogIdentity;
|
|
303
|
+
}>;
|
|
304
|
+
|
|
305
|
+
speechSessionFor(model: string | undefined): Promise<{
|
|
306
|
+
app: string;
|
|
307
|
+
entry: S;
|
|
308
|
+
identity: TurnCatalogIdentity;
|
|
309
|
+
}>;
|
|
310
|
+
|
|
311
|
+
private acquire;
|
|
312
|
+
private keyOf;
|
|
313
|
+
|
|
314
|
+
handleFor(model: string | undefined): Promise<{
|
|
315
|
+
app: string;
|
|
316
|
+
handle: string;
|
|
317
|
+
}>;
|
|
318
|
+
|
|
319
|
+
speechHandleFor(model: string | undefined): Promise<{
|
|
320
|
+
app: string;
|
|
321
|
+
handle: string;
|
|
322
|
+
}>;
|
|
323
|
+
|
|
324
|
+
sessionForHandle(handle: string): Promise<{
|
|
325
|
+
app: string;
|
|
326
|
+
entry: S;
|
|
327
|
+
}>;
|
|
328
|
+
|
|
329
|
+
evict(app: string, entry: S): Promise<void>;
|
|
330
|
+
|
|
331
|
+
modelList(): Promise<RouterModelList>;
|
|
332
|
+
|
|
333
|
+
openRouterModels(): Promise<OpenRouterProviderDoc>;
|
|
334
|
+
|
|
335
|
+
supportsImages(model: string | undefined, mode: ImageCapabilityMode): Promise<boolean>;
|
|
336
|
+
|
|
337
|
+
supportsAudio(model: string | undefined): Promise<boolean>;
|
|
338
|
+
|
|
339
|
+
supportsSpeech(model: string | undefined): Promise<boolean>;
|
|
340
|
+
|
|
341
|
+
speechVoices(model: string | undefined): Promise<SpeechVoicesResolution>;
|
|
342
|
+
|
|
343
|
+
imageModelList(): Promise<RouterImageModelList>;
|
|
344
|
+
|
|
345
|
+
closeAll(): Promise<void>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
interface RuntimePresenceRow {
|
|
349
|
+
runtime_id: string;
|
|
350
|
+
|
|
351
|
+
address: string;
|
|
352
|
+
ready: boolean;
|
|
353
|
+
|
|
354
|
+
last_seen: string;
|
|
355
|
+
status?: string | null;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
interface DialTarget {
|
|
359
|
+
appSlug: string;
|
|
360
|
+
fnName?: string;
|
|
361
|
+
sharedApp?: boolean;
|
|
362
|
+
modelId?: string;
|
|
363
|
+
variant?: string;
|
|
364
|
+
sharedOrgId?: string;
|
|
365
|
+
}
|
|
366
|
+
interface StatelessDecisionDialOptions {
|
|
367
|
+
|
|
368
|
+
targetFor: (model: string | undefined) => Promise<DialTarget>;
|
|
369
|
+
apiUrl: string;
|
|
370
|
+
apiKey: string;
|
|
371
|
+
|
|
372
|
+
orgId: string;
|
|
373
|
+
|
|
374
|
+
fnName: string;
|
|
375
|
+
|
|
376
|
+
secret: string;
|
|
377
|
+
|
|
378
|
+
shared?: {
|
|
379
|
+
apiKey: string;
|
|
380
|
+
};
|
|
381
|
+
fetchImpl?: typeof fetch;
|
|
382
|
+
nowMs?: () => number;
|
|
383
|
+
|
|
384
|
+
timeoutMs?: number;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare class StatelessDecisionDial {
|
|
388
|
+
private readonly opts;
|
|
389
|
+
private readonly replicas;
|
|
390
|
+
private readonly nowMs;
|
|
391
|
+
|
|
392
|
+
private readonly presenceCache;
|
|
393
|
+
constructor(opts: StatelessDecisionDialOptions);
|
|
394
|
+
|
|
395
|
+
get enabled(): boolean;
|
|
396
|
+
|
|
397
|
+
targetFor(model: string | undefined): Promise<DialTarget | null>;
|
|
398
|
+
|
|
399
|
+
decide(body: Record<string, unknown>, model: string | undefined): Promise<{
|
|
400
|
+
status: number;
|
|
401
|
+
body: unknown;
|
|
402
|
+
completed: unknown;
|
|
403
|
+
target: DialTarget & {
|
|
404
|
+
fnName: string;
|
|
405
|
+
};
|
|
406
|
+
}>;
|
|
407
|
+
|
|
408
|
+
private ensureRows;
|
|
409
|
+
private readPresence;
|
|
410
|
+
|
|
411
|
+
pick(rows: RuntimePresenceRow[]): string | null;
|
|
412
|
+
private post;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
interface InferenceUsageRecord {
|
|
416
|
+
|
|
417
|
+
inference_id: string;
|
|
418
|
+
|
|
419
|
+
model_id: string;
|
|
420
|
+
|
|
421
|
+
identity_kind: string;
|
|
422
|
+
|
|
423
|
+
variant: string | null;
|
|
424
|
+
task: string;
|
|
425
|
+
http_status: number;
|
|
426
|
+
started_at: string;
|
|
427
|
+
completed_at: string;
|
|
428
|
+
|
|
429
|
+
prompt_tokens: number | null;
|
|
430
|
+
completion_tokens: number | null;
|
|
431
|
+
output_units: number | null;
|
|
432
|
+
|
|
433
|
+
cost_nano_usd: number | null;
|
|
434
|
+
price_version: string | null;
|
|
435
|
+
priced_at: string | null;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
interface UsageRowRejection {
|
|
439
|
+
|
|
440
|
+
where: string;
|
|
441
|
+
|
|
442
|
+
reason: string;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
type UsageRowReporter = (rejection: UsageRowRejection) => void | Promise<void>;
|
|
446
|
+
|
|
447
|
+
interface UsageLane {
|
|
448
|
+
|
|
449
|
+
authorize(req: IncomingMessage): string;
|
|
450
|
+
|
|
451
|
+
lookup(credential: string, inferenceIds: readonly string[]): Promise<InferenceUsageRecord[]>;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
interface LedgerWrite {
|
|
455
|
+
|
|
456
|
+
inference_id: string;
|
|
457
|
+
|
|
458
|
+
model_id: string;
|
|
459
|
+
|
|
460
|
+
identity_kind: 'catalog_model' | 'caller_org_app';
|
|
461
|
+
variant: string | null;
|
|
462
|
+
task: string;
|
|
463
|
+
http_status: number;
|
|
464
|
+
started_at: string;
|
|
465
|
+
completed_at: string;
|
|
466
|
+
|
|
467
|
+
billable_outcome: boolean;
|
|
468
|
+
|
|
469
|
+
session_id: string | null;
|
|
470
|
+
|
|
471
|
+
prompt_tokens: number | null;
|
|
472
|
+
completion_tokens: number | null;
|
|
473
|
+
output_units: number | null;
|
|
474
|
+
|
|
475
|
+
queue_ms: number | null;
|
|
476
|
+
prefill_ms: number | null;
|
|
477
|
+
decode_ms: number | null;
|
|
478
|
+
total_ms: number | null;
|
|
479
|
+
|
|
480
|
+
ttft_ms: number | null;
|
|
481
|
+
|
|
482
|
+
e2e_ms: number | null;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
interface LedgerRecorded {
|
|
486
|
+
inference_id: string;
|
|
487
|
+
|
|
488
|
+
cost_nano_usd: number | null;
|
|
489
|
+
|
|
490
|
+
price_version: string | null;
|
|
491
|
+
|
|
492
|
+
unpriced_reason: string | null;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
declare const LEDGER_FAILURE_REASONS: readonly ["duplicate", "duplicate_foreign", "auth", "surface", "unknown", "dwell_expired", "dropped_on_exit"];
|
|
496
|
+
type LedgerFailureReason = (typeof LEDGER_FAILURE_REASONS)[number];
|
|
497
|
+
|
|
498
|
+
interface LedgerFailure {
|
|
499
|
+
readonly ledgerFailureReason: LedgerFailureReason;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
declare const LEDGER_SKIP_REASONS: readonly ["no_response_head", "no_org", "model_unresolved", "no_model_named", "queue_full"];
|
|
503
|
+
type LedgerSkipReason = (typeof LEDGER_SKIP_REASONS)[number];
|
|
504
|
+
|
|
505
|
+
declare const LEDGER_PRICING_STATES: readonly ["priced", "unpriced"];
|
|
506
|
+
type LedgerPricingState = (typeof LEDGER_PRICING_STATES)[number];
|
|
507
|
+
|
|
508
|
+
type LedgerOutcome =
|
|
509
|
+
|
|
510
|
+
{
|
|
511
|
+
outcome: 'written';
|
|
512
|
+
reason: LedgerPricingState;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
| {
|
|
516
|
+
outcome: 'already_written';
|
|
517
|
+
reason: LedgerPricingState;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
| {
|
|
521
|
+
outcome: 'skipped';
|
|
522
|
+
reason: LedgerSkipReason;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
| {
|
|
526
|
+
outcome: 'failed';
|
|
527
|
+
reason: LedgerFailureReason;
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
interface LedgerLane {
|
|
531
|
+
|
|
532
|
+
write(req: IncomingMessage, entry: LedgerWrite): Promise<LedgerRecorded>;
|
|
533
|
+
|
|
534
|
+
observe(outcome: LedgerOutcome): void;
|
|
535
|
+
|
|
536
|
+
report?(line: string): void;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
interface ResponsesCreateParams {
|
|
540
|
+
model?: string;
|
|
541
|
+
input: unknown;
|
|
542
|
+
stream?: boolean;
|
|
543
|
+
tools?: unknown;
|
|
544
|
+
tool_choice?: unknown;
|
|
545
|
+
temperature?: number;
|
|
546
|
+
max_output_tokens?: number;
|
|
547
|
+
|
|
548
|
+
instructions?: string;
|
|
549
|
+
top_p?: number;
|
|
550
|
+
stop?: string[];
|
|
551
|
+
|
|
552
|
+
reasoning_effort?: string;
|
|
553
|
+
chat_template_kwargs?: Record<string, unknown>;
|
|
554
|
+
|
|
555
|
+
response_format?: unknown;
|
|
556
|
+
|
|
557
|
+
voice?: string;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
interface SessionEndInfo {
|
|
561
|
+
|
|
562
|
+
timeLeftMs: number | null;
|
|
563
|
+
|
|
564
|
+
reason: string;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
interface ProxyClients {
|
|
568
|
+
|
|
569
|
+
readonly tenant?: string;
|
|
570
|
+
|
|
571
|
+
createResponse(params: ResponsesCreateParams, onDial?: DialObserver): Promise<AsyncIterable<unknown>> | AsyncIterable<unknown>;
|
|
572
|
+
|
|
573
|
+
listModels(): Promise<unknown>;
|
|
574
|
+
|
|
575
|
+
openRouterModels?(): Promise<unknown>;
|
|
576
|
+
|
|
577
|
+
supportsImages?(model: string | undefined, mode: 'generation' | 'edit'): Promise<boolean>;
|
|
578
|
+
|
|
579
|
+
supportsAudio?(model: string | undefined): Promise<boolean>;
|
|
580
|
+
|
|
581
|
+
supportsSpeech?(model: string | undefined): Promise<boolean>;
|
|
582
|
+
|
|
583
|
+
speechVoices?(model: string | undefined): Promise<SpeechVoicesResolution>;
|
|
584
|
+
|
|
585
|
+
listImageModels?(): Promise<unknown>;
|
|
586
|
+
|
|
587
|
+
catalogIdentity(model: string | undefined): Promise<{
|
|
588
|
+
model_id: string;
|
|
589
|
+
variant: string;
|
|
590
|
+
} | null>;
|
|
591
|
+
|
|
592
|
+
servingAppSlug?(model: string | undefined): Promise<string | null>;
|
|
593
|
+
|
|
594
|
+
openAudio?(model: string | undefined, signal?: AbortSignal): Promise<ProxyAudioLane>;
|
|
595
|
+
|
|
596
|
+
openAudioOn?(handle: string): Promise<PinnedAudioLane>;
|
|
597
|
+
|
|
598
|
+
openVideo?(model: string | undefined): Promise<ProxyVideoLane>;
|
|
599
|
+
|
|
600
|
+
openVideoOut?(model: string | undefined): Promise<ProxyVideoOutLane>;
|
|
601
|
+
|
|
602
|
+
sessionHandle(model: string | undefined): Promise<string>;
|
|
603
|
+
|
|
604
|
+
speechSessionHandle?(model: string | undefined): Promise<string>;
|
|
605
|
+
|
|
606
|
+
evictSpeechSession?(handle: string): Promise<void>;
|
|
607
|
+
|
|
608
|
+
createResponseOn(handle: string, params: ResponsesCreateParams): Promise<AsyncIterable<unknown>> | AsyncIterable<unknown>;
|
|
609
|
+
|
|
610
|
+
onSessionEnd(handle: string, cb: (end: SessionEndInfo) => void): Promise<() => void>;
|
|
611
|
+
|
|
612
|
+
readonly stateless?: StatelessDecisionDial;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
type ProxyAudioLane = Pick<AudioBridge, 'appendInputAudio' | 'onOutputAudio'> & {
|
|
616
|
+
sessionId?: string | null;
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
interface PinnedAudioLane extends ProxyAudioLane {
|
|
620
|
+
|
|
621
|
+
readonly sessionId: string | null;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
type ProxyVideoLane = Pick<VideoFrameLane, 'sendInputFrame'>;
|
|
625
|
+
|
|
626
|
+
type ProxyVideoOutLane = Pick<VideoOutLane, 'codec' | 'onOutputFrame' | 'onLaneError'>;
|
|
627
|
+
|
|
628
|
+
type ProxyClientsFor = (req: IncomingMessage) => ProxyClients | Promise<ProxyClients>;
|
|
629
|
+
interface ProxyHandlerOptions {
|
|
630
|
+
|
|
631
|
+
clients: ProxyClients | ProxyClientsFor;
|
|
632
|
+
|
|
633
|
+
apiKey?: string;
|
|
634
|
+
|
|
635
|
+
identity?: ProxyIdentity;
|
|
636
|
+
|
|
637
|
+
statusOf?: (err: unknown) => {
|
|
638
|
+
status: number;
|
|
639
|
+
openaiType: string;
|
|
640
|
+
anthropicType: string;
|
|
641
|
+
} | null;
|
|
642
|
+
|
|
643
|
+
requestLog?: (line: string) => void;
|
|
644
|
+
|
|
645
|
+
usage?: UsageLane;
|
|
646
|
+
|
|
647
|
+
ledger?: LedgerLane;
|
|
648
|
+
|
|
649
|
+
observe?: (record: InferenceRecord) => void;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export { type DialObserver as D, type InferenceRecord as I, type LedgerFailure as L, ModelRouter as M, type ProxyClients as P, SessionGoneError as S, UnknownModelError as U, type DialReport as a, type InferenceUsageRecord as b, type LedgerOutcome as c, type LedgerRecorded as d, type LedgerWrite as e, type ProxyHandlerOptions as f, type ProxyIdentity as g, type ProxyVideoOutLane as h, type UsageRowReporter as i };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as VideoOutRecord } from './video-out-
|
|
1
|
+
import { k as VideoOutRecord } from './video-out-BsuLqlID.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Gemini Live (BidiGenerateContent) ⇄ uRun Responses translation — PURE
|
|
@@ -90,7 +90,7 @@ interface LiveSessionConfig {
|
|
|
90
90
|
/**
|
|
91
91
|
* `generationConfig.responseModalities` includes AUDIO — the handler opens
|
|
92
92
|
* the native audio lane (ProxyClients.openAudio → AudioBridge over
|
|
93
|
-
*
|
|
93
|
+
* the canonical `audio` lane, transport/media.ts AUDIO_STREAM) EAGERLY at setup instead of on first audio chunk.
|
|
94
94
|
*/
|
|
95
95
|
audioModality: boolean;
|
|
96
96
|
/** VAD/activity posture from setup.realtimeInputConfig (manual mode only). */
|
|
@@ -209,7 +209,7 @@ declare function serverContentOfDelta(ev: {
|
|
|
209
209
|
delta?: unknown;
|
|
210
210
|
}): Rec | null;
|
|
211
211
|
/**
|
|
212
|
-
* One native `
|
|
212
|
+
* One native `audio`-lane chunk (base64 PCM16 @24 kHz, exactly as the
|
|
213
213
|
* AudioBridge emits it — no conversion: the Live spec output rate IS the
|
|
214
214
|
* native rate) → a serverContent.modelTurn inlineData message.
|
|
215
215
|
*/
|
|
@@ -3,6 +3,19 @@ interface UrunDocLike {
|
|
|
3
3
|
set(patch: Record<string, unknown>): void;
|
|
4
4
|
get(path?: string, defaultValue?: unknown): unknown;
|
|
5
5
|
on(event: 'change', handler: (snapshot: Record<string, unknown>) => void): () => void;
|
|
6
|
+
/**
|
|
7
|
+
* Whether the provider's initial sync has completed (core
|
|
8
|
+
* `SessionDocumentImpl.synced`) — true also for local-only docs. Absent on
|
|
9
|
+
* legacy/test doubles that never model a doc plane; the turn path's
|
|
10
|
+
* first-write gate skips when the surface is absent (it cannot hold a gate
|
|
11
|
+
* it cannot observe).
|
|
12
|
+
*/
|
|
13
|
+
synced?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* One-shot first-sync callback (core `SessionDocumentImpl.onSynced`).
|
|
16
|
+
* Returns an unsubscribe fn. Absent on legacy/test doubles.
|
|
17
|
+
*/
|
|
18
|
+
onSynced?(handler: () => void): () => void;
|
|
6
19
|
}
|
|
7
20
|
interface UrunStreamLike {
|
|
8
21
|
messages(): AsyncIterable<unknown>;
|
|
@@ -3,6 +3,10 @@ interface UrunDocLike {
|
|
|
3
3
|
set(patch: Record<string, unknown>): void;
|
|
4
4
|
get(path?: string, defaultValue?: unknown): unknown;
|
|
5
5
|
on(event: 'change', handler: (snapshot: Record<string, unknown>) => void): () => void;
|
|
6
|
+
|
|
7
|
+
synced?: boolean;
|
|
8
|
+
|
|
9
|
+
onSynced?(handler: () => void): () => void;
|
|
6
10
|
}
|
|
7
11
|
interface UrunStreamLike {
|
|
8
12
|
messages(): AsyncIterable<unknown>;
|